MicrosoftAjax.debug.js 302 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117
  1. // Name: MicrosoftAjax.debug.js
  2. // Assembly: System.Web.Extensions
  3. // Version: 4.0.0.0
  4. // FileVersion: 4.0.20526.0
  5. //-----------------------------------------------------------------------
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------
  8. // MicrosoftAjax.js
  9. // Microsoft AJAX Framework.
  10. Function.__typeName = 'Function';
  11. Function.__class = true;
  12. Function.createCallback = function Function$createCallback(method, context) {
  13. /// <summary locid="M:J#Function.createCallback" />
  14. /// <param name="method" type="Function"></param>
  15. /// <param name="context" mayBeNull="true"></param>
  16. /// <returns type="Function"></returns>
  17. var e = Function._validateParams(arguments, [
  18. {name: "method", type: Function},
  19. {name: "context", mayBeNull: true}
  20. ]);
  21. if (e) throw e;
  22. return function() {
  23. var l = arguments.length;
  24. if (l > 0) {
  25. var args = [];
  26. for (var i = 0; i < l; i++) {
  27. args[i] = arguments[i];
  28. }
  29. args[l] = context;
  30. return method.apply(this, args);
  31. }
  32. return method.call(this, context);
  33. }
  34. }
  35. Function.createDelegate = function Function$createDelegate(instance, method) {
  36. /// <summary locid="M:J#Function.createDelegate" />
  37. /// <param name="instance" mayBeNull="true"></param>
  38. /// <param name="method" type="Function"></param>
  39. /// <returns type="Function"></returns>
  40. var e = Function._validateParams(arguments, [
  41. {name: "instance", mayBeNull: true},
  42. {name: "method", type: Function}
  43. ]);
  44. if (e) throw e;
  45. return function() {
  46. return method.apply(instance, arguments);
  47. }
  48. }
  49. Function.emptyFunction = Function.emptyMethod = function Function$emptyMethod() {
  50. /// <summary locid="M:J#Function.emptyMethod" />
  51. }
  52. Function.validateParameters = function Function$validateParameters(parameters, expectedParameters, validateParameterCount) {
  53. /// <summary locid="M:J#Function.validateParameters" />
  54. /// <param name="parameters"></param>
  55. /// <param name="expectedParameters"></param>
  56. /// <param name="validateParameterCount" type="Boolean" optional="true"></param>
  57. /// <returns type="Error" mayBeNull="true"></returns>
  58. var e = Function._validateParams(arguments, [
  59. {name: "parameters"},
  60. {name: "expectedParameters"},
  61. {name: "validateParameterCount", type: Boolean, optional: true}
  62. ]);
  63. if (e) throw e;
  64. return Function._validateParams(parameters, expectedParameters, validateParameterCount);
  65. }
  66. Function._validateParams = function Function$_validateParams(params, expectedParams, validateParameterCount) {
  67. var e, expectedLength = expectedParams.length;
  68. validateParameterCount = validateParameterCount || (typeof(validateParameterCount) === "undefined");
  69. e = Function._validateParameterCount(params, expectedParams, validateParameterCount);
  70. if (e) {
  71. e.popStackFrame();
  72. return e;
  73. }
  74. for (var i = 0, l = params.length; i < l; i++) {
  75. var expectedParam = expectedParams[Math.min(i, expectedLength - 1)],
  76. paramName = expectedParam.name;
  77. if (expectedParam.parameterArray) {
  78. paramName += "[" + (i - expectedLength + 1) + "]";
  79. }
  80. else if (!validateParameterCount && (i >= expectedLength)) {
  81. break;
  82. }
  83. e = Function._validateParameter(params[i], expectedParam, paramName);
  84. if (e) {
  85. e.popStackFrame();
  86. return e;
  87. }
  88. }
  89. return null;
  90. }
  91. Function._validateParameterCount = function Function$_validateParameterCount(params, expectedParams, validateParameterCount) {
  92. var i, error,
  93. expectedLen = expectedParams.length,
  94. actualLen = params.length;
  95. if (actualLen < expectedLen) {
  96. var minParams = expectedLen;
  97. for (i = 0; i < expectedLen; i++) {
  98. var param = expectedParams[i];
  99. if (param.optional || param.parameterArray) {
  100. minParams--;
  101. }
  102. }
  103. if (actualLen < minParams) {
  104. error = true;
  105. }
  106. }
  107. else if (validateParameterCount && (actualLen > expectedLen)) {
  108. error = true;
  109. for (i = 0; i < expectedLen; i++) {
  110. if (expectedParams[i].parameterArray) {
  111. error = false;
  112. break;
  113. }
  114. }
  115. }
  116. if (error) {
  117. var e = Error.parameterCount();
  118. e.popStackFrame();
  119. return e;
  120. }
  121. return null;
  122. }
  123. Function._validateParameter = function Function$_validateParameter(param, expectedParam, paramName) {
  124. var e,
  125. expectedType = expectedParam.type,
  126. expectedInteger = !!expectedParam.integer,
  127. expectedDomElement = !!expectedParam.domElement,
  128. mayBeNull = !!expectedParam.mayBeNull;
  129. e = Function._validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName);
  130. if (e) {
  131. e.popStackFrame();
  132. return e;
  133. }
  134. var expectedElementType = expectedParam.elementType,
  135. elementMayBeNull = !!expectedParam.elementMayBeNull;
  136. if (expectedType === Array && typeof(param) !== "undefined" && param !== null &&
  137. (expectedElementType || !elementMayBeNull)) {
  138. var expectedElementInteger = !!expectedParam.elementInteger,
  139. expectedElementDomElement = !!expectedParam.elementDomElement;
  140. for (var i=0; i < param.length; i++) {
  141. var elem = param[i];
  142. e = Function._validateParameterType(elem, expectedElementType,
  143. expectedElementInteger, expectedElementDomElement, elementMayBeNull,
  144. paramName + "[" + i + "]");
  145. if (e) {
  146. e.popStackFrame();
  147. return e;
  148. }
  149. }
  150. }
  151. return null;
  152. }
  153. Function._validateParameterType = function Function$_validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName) {
  154. var e, i;
  155. if (typeof(param) === "undefined") {
  156. if (mayBeNull) {
  157. return null;
  158. }
  159. else {
  160. e = Error.argumentUndefined(paramName);
  161. e.popStackFrame();
  162. return e;
  163. }
  164. }
  165. if (param === null) {
  166. if (mayBeNull) {
  167. return null;
  168. }
  169. else {
  170. e = Error.argumentNull(paramName);
  171. e.popStackFrame();
  172. return e;
  173. }
  174. }
  175. if (expectedType && expectedType.__enum) {
  176. if (typeof(param) !== 'number') {
  177. e = Error.argumentType(paramName, Object.getType(param), expectedType);
  178. e.popStackFrame();
  179. return e;
  180. }
  181. if ((param % 1) === 0) {
  182. var values = expectedType.prototype;
  183. if (!expectedType.__flags || (param === 0)) {
  184. for (i in values) {
  185. if (values[i] === param) return null;
  186. }
  187. }
  188. else {
  189. var v = param;
  190. for (i in values) {
  191. var vali = values[i];
  192. if (vali === 0) continue;
  193. if ((vali & param) === vali) {
  194. v -= vali;
  195. }
  196. if (v === 0) return null;
  197. }
  198. }
  199. }
  200. e = Error.argumentOutOfRange(paramName, param, String.format(Sys.Res.enumInvalidValue, param, expectedType.getName()));
  201. e.popStackFrame();
  202. return e;
  203. }
  204. if (expectedDomElement && (!Sys._isDomElement(param) || (param.nodeType === 3))) {
  205. e = Error.argument(paramName, Sys.Res.argumentDomElement);
  206. e.popStackFrame();
  207. return e;
  208. }
  209. if (expectedType && !Sys._isInstanceOfType(expectedType, param)) {
  210. e = Error.argumentType(paramName, Object.getType(param), expectedType);
  211. e.popStackFrame();
  212. return e;
  213. }
  214. if (expectedType === Number && expectedInteger) {
  215. if ((param % 1) !== 0) {
  216. e = Error.argumentOutOfRange(paramName, param, Sys.Res.argumentInteger);
  217. e.popStackFrame();
  218. return e;
  219. }
  220. }
  221. return null;
  222. }
  223. Error.__typeName = 'Error';
  224. Error.__class = true;
  225. Error.create = function Error$create(message, errorInfo) {
  226. /// <summary locid="M:J#Error.create" />
  227. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  228. /// <param name="errorInfo" optional="true" mayBeNull="true"></param>
  229. /// <returns type="Error"></returns>
  230. var e = Function._validateParams(arguments, [
  231. {name: "message", type: String, mayBeNull: true, optional: true},
  232. {name: "errorInfo", mayBeNull: true, optional: true}
  233. ]);
  234. if (e) throw e;
  235. var err = new Error(message);
  236. err.message = message;
  237. if (errorInfo) {
  238. for (var v in errorInfo) {
  239. err[v] = errorInfo[v];
  240. }
  241. }
  242. err.popStackFrame();
  243. return err;
  244. }
  245. Error.argument = function Error$argument(paramName, message) {
  246. /// <summary locid="M:J#Error.argument" />
  247. /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
  248. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  249. /// <returns></returns>
  250. var e = Function._validateParams(arguments, [
  251. {name: "paramName", type: String, mayBeNull: true, optional: true},
  252. {name: "message", type: String, mayBeNull: true, optional: true}
  253. ]);
  254. if (e) throw e;
  255. var displayMessage = "Sys.ArgumentException: " + (message ? message : Sys.Res.argument);
  256. if (paramName) {
  257. displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
  258. }
  259. var err = Error.create(displayMessage, { name: "Sys.ArgumentException", paramName: paramName });
  260. err.popStackFrame();
  261. return err;
  262. }
  263. Error.argumentNull = function Error$argumentNull(paramName, message) {
  264. /// <summary locid="M:J#Error.argumentNull" />
  265. /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
  266. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  267. /// <returns></returns>
  268. var e = Function._validateParams(arguments, [
  269. {name: "paramName", type: String, mayBeNull: true, optional: true},
  270. {name: "message", type: String, mayBeNull: true, optional: true}
  271. ]);
  272. if (e) throw e;
  273. var displayMessage = "Sys.ArgumentNullException: " + (message ? message : Sys.Res.argumentNull);
  274. if (paramName) {
  275. displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
  276. }
  277. var err = Error.create(displayMessage, { name: "Sys.ArgumentNullException", paramName: paramName });
  278. err.popStackFrame();
  279. return err;
  280. }
  281. Error.argumentOutOfRange = function Error$argumentOutOfRange(paramName, actualValue, message) {
  282. /// <summary locid="M:J#Error.argumentOutOfRange" />
  283. /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
  284. /// <param name="actualValue" optional="true" mayBeNull="true"></param>
  285. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  286. /// <returns></returns>
  287. var e = Function._validateParams(arguments, [
  288. {name: "paramName", type: String, mayBeNull: true, optional: true},
  289. {name: "actualValue", mayBeNull: true, optional: true},
  290. {name: "message", type: String, mayBeNull: true, optional: true}
  291. ]);
  292. if (e) throw e;
  293. var displayMessage = "Sys.ArgumentOutOfRangeException: " + (message ? message : Sys.Res.argumentOutOfRange);
  294. if (paramName) {
  295. displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
  296. }
  297. if (typeof(actualValue) !== "undefined" && actualValue !== null) {
  298. displayMessage += "\n" + String.format(Sys.Res.actualValue, actualValue);
  299. }
  300. var err = Error.create(displayMessage, {
  301. name: "Sys.ArgumentOutOfRangeException",
  302. paramName: paramName,
  303. actualValue: actualValue
  304. });
  305. err.popStackFrame();
  306. return err;
  307. }
  308. Error.argumentType = function Error$argumentType(paramName, actualType, expectedType, message) {
  309. /// <summary locid="M:J#Error.argumentType" />
  310. /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
  311. /// <param name="actualType" type="Type" optional="true" mayBeNull="true"></param>
  312. /// <param name="expectedType" type="Type" optional="true" mayBeNull="true"></param>
  313. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  314. /// <returns></returns>
  315. var e = Function._validateParams(arguments, [
  316. {name: "paramName", type: String, mayBeNull: true, optional: true},
  317. {name: "actualType", type: Type, mayBeNull: true, optional: true},
  318. {name: "expectedType", type: Type, mayBeNull: true, optional: true},
  319. {name: "message", type: String, mayBeNull: true, optional: true}
  320. ]);
  321. if (e) throw e;
  322. var displayMessage = "Sys.ArgumentTypeException: ";
  323. if (message) {
  324. displayMessage += message;
  325. }
  326. else if (actualType && expectedType) {
  327. displayMessage +=
  328. String.format(Sys.Res.argumentTypeWithTypes, actualType.getName(), expectedType.getName());
  329. }
  330. else {
  331. displayMessage += Sys.Res.argumentType;
  332. }
  333. if (paramName) {
  334. displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
  335. }
  336. var err = Error.create(displayMessage, {
  337. name: "Sys.ArgumentTypeException",
  338. paramName: paramName,
  339. actualType: actualType,
  340. expectedType: expectedType
  341. });
  342. err.popStackFrame();
  343. return err;
  344. }
  345. Error.argumentUndefined = function Error$argumentUndefined(paramName, message) {
  346. /// <summary locid="M:J#Error.argumentUndefined" />
  347. /// <param name="paramName" type="String" optional="true" mayBeNull="true"></param>
  348. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  349. /// <returns></returns>
  350. var e = Function._validateParams(arguments, [
  351. {name: "paramName", type: String, mayBeNull: true, optional: true},
  352. {name: "message", type: String, mayBeNull: true, optional: true}
  353. ]);
  354. if (e) throw e;
  355. var displayMessage = "Sys.ArgumentUndefinedException: " + (message ? message : Sys.Res.argumentUndefined);
  356. if (paramName) {
  357. displayMessage += "\n" + String.format(Sys.Res.paramName, paramName);
  358. }
  359. var err = Error.create(displayMessage, { name: "Sys.ArgumentUndefinedException", paramName: paramName });
  360. err.popStackFrame();
  361. return err;
  362. }
  363. Error.format = function Error$format(message) {
  364. /// <summary locid="M:J#Error.format" />
  365. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  366. /// <returns></returns>
  367. var e = Function._validateParams(arguments, [
  368. {name: "message", type: String, mayBeNull: true, optional: true}
  369. ]);
  370. if (e) throw e;
  371. var displayMessage = "Sys.FormatException: " + (message ? message : Sys.Res.format);
  372. var err = Error.create(displayMessage, {name: 'Sys.FormatException'});
  373. err.popStackFrame();
  374. return err;
  375. }
  376. Error.invalidOperation = function Error$invalidOperation(message) {
  377. /// <summary locid="M:J#Error.invalidOperation" />
  378. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  379. /// <returns></returns>
  380. var e = Function._validateParams(arguments, [
  381. {name: "message", type: String, mayBeNull: true, optional: true}
  382. ]);
  383. if (e) throw e;
  384. var displayMessage = "Sys.InvalidOperationException: " + (message ? message : Sys.Res.invalidOperation);
  385. var err = Error.create(displayMessage, {name: 'Sys.InvalidOperationException'});
  386. err.popStackFrame();
  387. return err;
  388. }
  389. Error.notImplemented = function Error$notImplemented(message) {
  390. /// <summary locid="M:J#Error.notImplemented" />
  391. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  392. /// <returns></returns>
  393. var e = Function._validateParams(arguments, [
  394. {name: "message", type: String, mayBeNull: true, optional: true}
  395. ]);
  396. if (e) throw e;
  397. var displayMessage = "Sys.NotImplementedException: " + (message ? message : Sys.Res.notImplemented);
  398. var err = Error.create(displayMessage, {name: 'Sys.NotImplementedException'});
  399. err.popStackFrame();
  400. return err;
  401. }
  402. Error.parameterCount = function Error$parameterCount(message) {
  403. /// <summary locid="M:J#Error.parameterCount" />
  404. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  405. /// <returns></returns>
  406. var e = Function._validateParams(arguments, [
  407. {name: "message", type: String, mayBeNull: true, optional: true}
  408. ]);
  409. if (e) throw e;
  410. var displayMessage = "Sys.ParameterCountException: " + (message ? message : Sys.Res.parameterCount);
  411. var err = Error.create(displayMessage, {name: 'Sys.ParameterCountException'});
  412. err.popStackFrame();
  413. return err;
  414. }
  415. Error.prototype.popStackFrame = function Error$popStackFrame() {
  416. /// <summary locid="M:J#checkParam" />
  417. if (arguments.length !== 0) throw Error.parameterCount();
  418. if (typeof(this.stack) === "undefined" || this.stack === null ||
  419. typeof(this.fileName) === "undefined" || this.fileName === null ||
  420. typeof(this.lineNumber) === "undefined" || this.lineNumber === null) {
  421. return;
  422. }
  423. var stackFrames = this.stack.split("\n");
  424. var currentFrame = stackFrames[0];
  425. var pattern = this.fileName + ":" + this.lineNumber;
  426. while(typeof(currentFrame) !== "undefined" &&
  427. currentFrame !== null &&
  428. currentFrame.indexOf(pattern) === -1) {
  429. stackFrames.shift();
  430. currentFrame = stackFrames[0];
  431. }
  432. var nextFrame = stackFrames[1];
  433. if (typeof(nextFrame) === "undefined" || nextFrame === null) {
  434. return;
  435. }
  436. var nextFrameParts = nextFrame.match(/@(.*):(\d+)$/);
  437. if (typeof(nextFrameParts) === "undefined" || nextFrameParts === null) {
  438. return;
  439. }
  440. this.fileName = nextFrameParts[1];
  441. this.lineNumber = parseInt(nextFrameParts[2]);
  442. stackFrames.shift();
  443. this.stack = stackFrames.join("\n");
  444. }
  445. Object.__typeName = 'Object';
  446. Object.__class = true;
  447. Object.getType = function Object$getType(instance) {
  448. /// <summary locid="M:J#Object.getType" />
  449. /// <param name="instance"></param>
  450. /// <returns type="Type"></returns>
  451. var e = Function._validateParams(arguments, [
  452. {name: "instance"}
  453. ]);
  454. if (e) throw e;
  455. var ctor = instance.constructor;
  456. if (!ctor || (typeof(ctor) !== "function") || !ctor.__typeName || (ctor.__typeName === 'Object')) {
  457. return Object;
  458. }
  459. return ctor;
  460. }
  461. Object.getTypeName = function Object$getTypeName(instance) {
  462. /// <summary locid="M:J#Object.getTypeName" />
  463. /// <param name="instance"></param>
  464. /// <returns type="String"></returns>
  465. var e = Function._validateParams(arguments, [
  466. {name: "instance"}
  467. ]);
  468. if (e) throw e;
  469. return Object.getType(instance).getName();
  470. }
  471. String.__typeName = 'String';
  472. String.__class = true;
  473. String.prototype.endsWith = function String$endsWith(suffix) {
  474. /// <summary locid="M:J#String.endsWith" />
  475. /// <param name="suffix" type="String"></param>
  476. /// <returns type="Boolean"></returns>
  477. var e = Function._validateParams(arguments, [
  478. {name: "suffix", type: String}
  479. ]);
  480. if (e) throw e;
  481. return (this.substr(this.length - suffix.length) === suffix);
  482. }
  483. String.prototype.startsWith = function String$startsWith(prefix) {
  484. /// <summary locid="M:J#String.startsWith" />
  485. /// <param name="prefix" type="String"></param>
  486. /// <returns type="Boolean"></returns>
  487. var e = Function._validateParams(arguments, [
  488. {name: "prefix", type: String}
  489. ]);
  490. if (e) throw e;
  491. return (this.substr(0, prefix.length) === prefix);
  492. }
  493. String.prototype.trim = function String$trim() {
  494. /// <summary locid="M:J#String.trim" />
  495. /// <returns type="String"></returns>
  496. if (arguments.length !== 0) throw Error.parameterCount();
  497. return this.replace(/^\s+|\s+$/g, '');
  498. }
  499. String.prototype.trimEnd = function String$trimEnd() {
  500. /// <summary locid="M:J#String.trimEnd" />
  501. /// <returns type="String"></returns>
  502. if (arguments.length !== 0) throw Error.parameterCount();
  503. return this.replace(/\s+$/, '');
  504. }
  505. String.prototype.trimStart = function String$trimStart() {
  506. /// <summary locid="M:J#String.trimStart" />
  507. /// <returns type="String"></returns>
  508. if (arguments.length !== 0) throw Error.parameterCount();
  509. return this.replace(/^\s+/, '');
  510. }
  511. String.format = function String$format(format, args) {
  512. /// <summary locid="M:J#String.format" />
  513. /// <param name="format" type="String"></param>
  514. /// <param name="args" parameterArray="true" mayBeNull="true"></param>
  515. /// <returns type="String"></returns>
  516. var e = Function._validateParams(arguments, [
  517. {name: "format", type: String},
  518. {name: "args", mayBeNull: true, parameterArray: true}
  519. ]);
  520. if (e) throw e;
  521. return String._toFormattedString(false, arguments);
  522. }
  523. String._toFormattedString = function String$_toFormattedString(useLocale, args) {
  524. var result = '';
  525. var format = args[0];
  526. for (var i=0;;) {
  527. var open = format.indexOf('{', i);
  528. var close = format.indexOf('}', i);
  529. if ((open < 0) && (close < 0)) {
  530. result += format.slice(i);
  531. break;
  532. }
  533. if ((close > 0) && ((close < open) || (open < 0))) {
  534. if (format.charAt(close + 1) !== '}') {
  535. throw Error.argument('format', Sys.Res.stringFormatBraceMismatch);
  536. }
  537. result += format.slice(i, close + 1);
  538. i = close + 2;
  539. continue;
  540. }
  541. result += format.slice(i, open);
  542. i = open + 1;
  543. if (format.charAt(i) === '{') {
  544. result += '{';
  545. i++;
  546. continue;
  547. }
  548. if (close < 0) throw Error.argument('format', Sys.Res.stringFormatBraceMismatch);
  549. var brace = format.substring(i, close);
  550. var colonIndex = brace.indexOf(':');
  551. var argNumber = parseInt((colonIndex < 0)? brace : brace.substring(0, colonIndex), 10) + 1;
  552. if (isNaN(argNumber)) throw Error.argument('format', Sys.Res.stringFormatInvalid);
  553. var argFormat = (colonIndex < 0)? '' : brace.substring(colonIndex + 1);
  554. var arg = args[argNumber];
  555. if (typeof(arg) === "undefined" || arg === null) {
  556. arg = '';
  557. }
  558. if (arg.toFormattedString) {
  559. result += arg.toFormattedString(argFormat);
  560. }
  561. else if (useLocale && arg.localeFormat) {
  562. result += arg.localeFormat(argFormat);
  563. }
  564. else if (arg.format) {
  565. result += arg.format(argFormat);
  566. }
  567. else
  568. result += arg.toString();
  569. i = close + 1;
  570. }
  571. return result;
  572. }
  573. Boolean.__typeName = 'Boolean';
  574. Boolean.__class = true;
  575. Boolean.parse = function Boolean$parse(value) {
  576. /// <summary locid="M:J#Boolean.parse" />
  577. /// <param name="value" type="String"></param>
  578. /// <returns type="Boolean"></returns>
  579. var e = Function._validateParams(arguments, [
  580. {name: "value", type: String}
  581. ], false);
  582. if (e) throw e;
  583. var v = value.trim().toLowerCase();
  584. if (v === 'false') return false;
  585. if (v === 'true') return true;
  586. throw Error.argumentOutOfRange('value', value, Sys.Res.boolTrueOrFalse);
  587. }
  588. Date.__typeName = 'Date';
  589. Date.__class = true;
  590. Number.__typeName = 'Number';
  591. Number.__class = true;
  592. RegExp.__typeName = 'RegExp';
  593. RegExp.__class = true;
  594. if (!window) this.window = this;
  595. window.Type = Function;
  596. Type.__fullyQualifiedIdentifierRegExp = new RegExp("^[^.0-9 \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]([^ \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]*[^. \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\])?$", "i");
  597. Type.__identifierRegExp = new RegExp("^[^.0-9 \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\][^. \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]*$", "i");
  598. Type.prototype.callBaseMethod = function Type$callBaseMethod(instance, name, baseArguments) {
  599. /// <summary locid="M:J#Type.callBaseMethod" />
  600. /// <param name="instance"></param>
  601. /// <param name="name" type="String"></param>
  602. /// <param name="baseArguments" type="Array" optional="true" mayBeNull="true" elementMayBeNull="true"></param>
  603. /// <returns></returns>
  604. var e = Function._validateParams(arguments, [
  605. {name: "instance"},
  606. {name: "name", type: String},
  607. {name: "baseArguments", type: Array, mayBeNull: true, optional: true, elementMayBeNull: true}
  608. ]);
  609. if (e) throw e;
  610. var baseMethod = Sys._getBaseMethod(this, instance, name);
  611. if (!baseMethod) throw Error.invalidOperation(String.format(Sys.Res.methodNotFound, name));
  612. if (!baseArguments) {
  613. return baseMethod.apply(instance);
  614. }
  615. else {
  616. return baseMethod.apply(instance, baseArguments);
  617. }
  618. }
  619. Type.prototype.getBaseMethod = function Type$getBaseMethod(instance, name) {
  620. /// <summary locid="M:J#Type.getBaseMethod" />
  621. /// <param name="instance"></param>
  622. /// <param name="name" type="String"></param>
  623. /// <returns type="Function" mayBeNull="true"></returns>
  624. var e = Function._validateParams(arguments, [
  625. {name: "instance"},
  626. {name: "name", type: String}
  627. ]);
  628. if (e) throw e;
  629. return Sys._getBaseMethod(this, instance, name);
  630. }
  631. Type.prototype.getBaseType = function Type$getBaseType() {
  632. /// <summary locid="M:J#Type.getBaseType" />
  633. /// <returns type="Type" mayBeNull="true"></returns>
  634. if (arguments.length !== 0) throw Error.parameterCount();
  635. return (typeof(this.__baseType) === "undefined") ? null : this.__baseType;
  636. }
  637. Type.prototype.getInterfaces = function Type$getInterfaces() {
  638. /// <summary locid="M:J#Type.getInterfaces" />
  639. /// <returns type="Array" elementType="Type" mayBeNull="false" elementMayBeNull="false"></returns>
  640. if (arguments.length !== 0) throw Error.parameterCount();
  641. var result = [];
  642. var type = this;
  643. while(type) {
  644. var interfaces = type.__interfaces;
  645. if (interfaces) {
  646. for (var i = 0, l = interfaces.length; i < l; i++) {
  647. var interfaceType = interfaces[i];
  648. if (!Array.contains(result, interfaceType)) {
  649. result[result.length] = interfaceType;
  650. }
  651. }
  652. }
  653. type = type.__baseType;
  654. }
  655. return result;
  656. }
  657. Type.prototype.getName = function Type$getName() {
  658. /// <summary locid="M:J#Type.getName" />
  659. /// <returns type="String"></returns>
  660. if (arguments.length !== 0) throw Error.parameterCount();
  661. return (typeof(this.__typeName) === "undefined") ? "" : this.__typeName;
  662. }
  663. Type.prototype.implementsInterface = function Type$implementsInterface(interfaceType) {
  664. /// <summary locid="M:J#Type.implementsInterface" />
  665. /// <param name="interfaceType" type="Type"></param>
  666. /// <returns type="Boolean"></returns>
  667. var e = Function._validateParams(arguments, [
  668. {name: "interfaceType", type: Type}
  669. ]);
  670. if (e) throw e;
  671. this.resolveInheritance();
  672. var interfaceName = interfaceType.getName();
  673. var cache = this.__interfaceCache;
  674. if (cache) {
  675. var cacheEntry = cache[interfaceName];
  676. if (typeof(cacheEntry) !== 'undefined') return cacheEntry;
  677. }
  678. else {
  679. cache = this.__interfaceCache = {};
  680. }
  681. var baseType = this;
  682. while (baseType) {
  683. var interfaces = baseType.__interfaces;
  684. if (interfaces) {
  685. if (Array.indexOf(interfaces, interfaceType) !== -1) {
  686. return cache[interfaceName] = true;
  687. }
  688. }
  689. baseType = baseType.__baseType;
  690. }
  691. return cache[interfaceName] = false;
  692. }
  693. Type.prototype.inheritsFrom = function Type$inheritsFrom(parentType) {
  694. /// <summary locid="M:J#Type.inheritsFrom" />
  695. /// <param name="parentType" type="Type"></param>
  696. /// <returns type="Boolean"></returns>
  697. var e = Function._validateParams(arguments, [
  698. {name: "parentType", type: Type}
  699. ]);
  700. if (e) throw e;
  701. this.resolveInheritance();
  702. var baseType = this.__baseType;
  703. while (baseType) {
  704. if (baseType === parentType) {
  705. return true;
  706. }
  707. baseType = baseType.__baseType;
  708. }
  709. return false;
  710. }
  711. Type.prototype.initializeBase = function Type$initializeBase(instance, baseArguments) {
  712. /// <summary locid="M:J#Type.initializeBase" />
  713. /// <param name="instance"></param>
  714. /// <param name="baseArguments" type="Array" optional="true" mayBeNull="true" elementMayBeNull="true"></param>
  715. /// <returns></returns>
  716. var e = Function._validateParams(arguments, [
  717. {name: "instance"},
  718. {name: "baseArguments", type: Array, mayBeNull: true, optional: true, elementMayBeNull: true}
  719. ]);
  720. if (e) throw e;
  721. if (!Sys._isInstanceOfType(this, instance)) throw Error.argumentType('instance', Object.getType(instance), this);
  722. this.resolveInheritance();
  723. if (this.__baseType) {
  724. if (!baseArguments) {
  725. this.__baseType.apply(instance);
  726. }
  727. else {
  728. this.__baseType.apply(instance, baseArguments);
  729. }
  730. }
  731. return instance;
  732. }
  733. Type.prototype.isImplementedBy = function Type$isImplementedBy(instance) {
  734. /// <summary locid="M:J#Type.isImplementedBy" />
  735. /// <param name="instance" mayBeNull="true"></param>
  736. /// <returns type="Boolean"></returns>
  737. var e = Function._validateParams(arguments, [
  738. {name: "instance", mayBeNull: true}
  739. ]);
  740. if (e) throw e;
  741. if (typeof(instance) === "undefined" || instance === null) return false;
  742. var instanceType = Object.getType(instance);
  743. return !!(instanceType.implementsInterface && instanceType.implementsInterface(this));
  744. }
  745. Type.prototype.isInstanceOfType = function Type$isInstanceOfType(instance) {
  746. /// <summary locid="M:J#Type.isInstanceOfType" />
  747. /// <param name="instance" mayBeNull="true"></param>
  748. /// <returns type="Boolean"></returns>
  749. var e = Function._validateParams(arguments, [
  750. {name: "instance", mayBeNull: true}
  751. ]);
  752. if (e) throw e;
  753. return Sys._isInstanceOfType(this, instance);
  754. }
  755. Type.prototype.registerClass = function Type$registerClass(typeName, baseType, interfaceTypes) {
  756. /// <summary locid="M:J#Type.registerClass" />
  757. /// <param name="typeName" type="String"></param>
  758. /// <param name="baseType" type="Type" optional="true" mayBeNull="true"></param>
  759. /// <param name="interfaceTypes" parameterArray="true" type="Type"></param>
  760. /// <returns type="Type"></returns>
  761. var e = Function._validateParams(arguments, [
  762. {name: "typeName", type: String},
  763. {name: "baseType", type: Type, mayBeNull: true, optional: true},
  764. {name: "interfaceTypes", type: Type, parameterArray: true}
  765. ]);
  766. if (e) throw e;
  767. if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw Error.argument('typeName', Sys.Res.notATypeName);
  768. var parsedName;
  769. try {
  770. parsedName = eval(typeName);
  771. }
  772. catch(e) {
  773. throw Error.argument('typeName', Sys.Res.argumentTypeName);
  774. }
  775. if (parsedName !== this) throw Error.argument('typeName', Sys.Res.badTypeName);
  776. if (Sys.__registeredTypes[typeName]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, typeName));
  777. if ((arguments.length > 1) && (typeof(baseType) === 'undefined')) throw Error.argumentUndefined('baseType');
  778. if (baseType && !baseType.__class) throw Error.argument('baseType', Sys.Res.baseNotAClass);
  779. this.prototype.constructor = this;
  780. this.__typeName = typeName;
  781. this.__class = true;
  782. if (baseType) {
  783. this.__baseType = baseType;
  784. this.__basePrototypePending = true;
  785. }
  786. Sys.__upperCaseTypes[typeName.toUpperCase()] = this;
  787. if (interfaceTypes) {
  788. this.__interfaces = [];
  789. this.resolveInheritance();
  790. for (var i = 2, l = arguments.length; i < l; i++) {
  791. var interfaceType = arguments[i];
  792. if (!interfaceType.__interface) throw Error.argument('interfaceTypes[' + (i - 2) + ']', Sys.Res.notAnInterface);
  793. for (var methodName in interfaceType.prototype) {
  794. var method = interfaceType.prototype[methodName];
  795. if (!this.prototype[methodName]) {
  796. this.prototype[methodName] = method;
  797. }
  798. }
  799. this.__interfaces.push(interfaceType);
  800. }
  801. }
  802. Sys.__registeredTypes[typeName] = true;
  803. return this;
  804. }
  805. Type.prototype.registerInterface = function Type$registerInterface(typeName) {
  806. /// <summary locid="M:J#Type.registerInterface" />
  807. /// <param name="typeName" type="String"></param>
  808. /// <returns type="Type"></returns>
  809. var e = Function._validateParams(arguments, [
  810. {name: "typeName", type: String}
  811. ]);
  812. if (e) throw e;
  813. if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw Error.argument('typeName', Sys.Res.notATypeName);
  814. var parsedName;
  815. try {
  816. parsedName = eval(typeName);
  817. }
  818. catch(e) {
  819. throw Error.argument('typeName', Sys.Res.argumentTypeName);
  820. }
  821. if (parsedName !== this) throw Error.argument('typeName', Sys.Res.badTypeName);
  822. if (Sys.__registeredTypes[typeName]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, typeName));
  823. Sys.__upperCaseTypes[typeName.toUpperCase()] = this;
  824. this.prototype.constructor = this;
  825. this.__typeName = typeName;
  826. this.__interface = true;
  827. Sys.__registeredTypes[typeName] = true;
  828. return this;
  829. }
  830. Type.prototype.resolveInheritance = function Type$resolveInheritance() {
  831. /// <summary locid="M:J#Type.resolveInheritance" />
  832. if (arguments.length !== 0) throw Error.parameterCount();
  833. if (this.__basePrototypePending) {
  834. var baseType = this.__baseType;
  835. baseType.resolveInheritance();
  836. for (var memberName in baseType.prototype) {
  837. var memberValue = baseType.prototype[memberName];
  838. if (!this.prototype[memberName]) {
  839. this.prototype[memberName] = memberValue;
  840. }
  841. }
  842. delete this.__basePrototypePending;
  843. }
  844. }
  845. Type.getRootNamespaces = function Type$getRootNamespaces() {
  846. /// <summary locid="M:J#Type.getRootNamespaces" />
  847. /// <returns type="Array"></returns>
  848. if (arguments.length !== 0) throw Error.parameterCount();
  849. return Array.clone(Sys.__rootNamespaces);
  850. }
  851. Type.isClass = function Type$isClass(type) {
  852. /// <summary locid="M:J#Type.isClass" />
  853. /// <param name="type" mayBeNull="true"></param>
  854. /// <returns type="Boolean"></returns>
  855. var e = Function._validateParams(arguments, [
  856. {name: "type", mayBeNull: true}
  857. ]);
  858. if (e) throw e;
  859. if ((typeof(type) === 'undefined') || (type === null)) return false;
  860. return !!type.__class;
  861. }
  862. Type.isInterface = function Type$isInterface(type) {
  863. /// <summary locid="M:J#Type.isInterface" />
  864. /// <param name="type" mayBeNull="true"></param>
  865. /// <returns type="Boolean"></returns>
  866. var e = Function._validateParams(arguments, [
  867. {name: "type", mayBeNull: true}
  868. ]);
  869. if (e) throw e;
  870. if ((typeof(type) === 'undefined') || (type === null)) return false;
  871. return !!type.__interface;
  872. }
  873. Type.isNamespace = function Type$isNamespace(object) {
  874. /// <summary locid="M:J#Type.isNamespace" />
  875. /// <param name="object" mayBeNull="true"></param>
  876. /// <returns type="Boolean"></returns>
  877. var e = Function._validateParams(arguments, [
  878. {name: "object", mayBeNull: true}
  879. ]);
  880. if (e) throw e;
  881. if ((typeof(object) === 'undefined') || (object === null)) return false;
  882. return !!object.__namespace;
  883. }
  884. Type.parse = function Type$parse(typeName, ns) {
  885. /// <summary locid="M:J#Type.parse" />
  886. /// <param name="typeName" type="String" mayBeNull="true"></param>
  887. /// <param name="ns" optional="true" mayBeNull="true"></param>
  888. /// <returns type="Type" mayBeNull="true"></returns>
  889. var e = Function._validateParams(arguments, [
  890. {name: "typeName", type: String, mayBeNull: true},
  891. {name: "ns", mayBeNull: true, optional: true}
  892. ]);
  893. if (e) throw e;
  894. var fn;
  895. if (ns) {
  896. fn = Sys.__upperCaseTypes[ns.getName().toUpperCase() + '.' + typeName.toUpperCase()];
  897. return fn || null;
  898. }
  899. if (!typeName) return null;
  900. if (!Type.__htClasses) {
  901. Type.__htClasses = {};
  902. }
  903. fn = Type.__htClasses[typeName];
  904. if (!fn) {
  905. fn = eval(typeName);
  906. if (typeof(fn) !== 'function') throw Error.argument('typeName', Sys.Res.notATypeName);
  907. Type.__htClasses[typeName] = fn;
  908. }
  909. return fn;
  910. }
  911. Type.registerNamespace = function Type$registerNamespace(namespacePath) {
  912. /// <summary locid="M:J#Type.registerNamespace" />
  913. /// <param name="namespacePath" type="String"></param>
  914. var e = Function._validateParams(arguments, [
  915. {name: "namespacePath", type: String}
  916. ]);
  917. if (e) throw e;
  918. Type._registerNamespace(namespacePath);
  919. }
  920. Type._registerNamespace = function Type$_registerNamespace(namespacePath) {
  921. if (!Type.__fullyQualifiedIdentifierRegExp.test(namespacePath)) throw Error.argument('namespacePath', Sys.Res.invalidNameSpace);
  922. var rootObject = window;
  923. var namespaceParts = namespacePath.split('.');
  924. for (var i = 0; i < namespaceParts.length; i++) {
  925. var currentPart = namespaceParts[i];
  926. var ns = rootObject[currentPart];
  927. var nsType = typeof(ns);
  928. if ((nsType !== "undefined") && (ns !== null)) {
  929. if (nsType === "function") {
  930. throw Error.invalidOperation(String.format(Sys.Res.namespaceContainsClass, namespaceParts.splice(0, i + 1).join('.')));
  931. }
  932. if ((typeof(ns) !== "object") || (ns instanceof Array)) {
  933. throw Error.invalidOperation(String.format(Sys.Res.namespaceContainsNonObject, namespaceParts.splice(0, i + 1).join('.')));
  934. }
  935. }
  936. if (!ns) {
  937. ns = rootObject[currentPart] = {};
  938. }
  939. if (!ns.__namespace) {
  940. if ((i === 0) && (namespacePath !== "Sys")) {
  941. Sys.__rootNamespaces[Sys.__rootNamespaces.length] = ns;
  942. }
  943. ns.__namespace = true;
  944. ns.__typeName = namespaceParts.slice(0, i + 1).join('.');
  945. var parsedName;
  946. try {
  947. parsedName = eval(ns.__typeName);
  948. }
  949. catch(e) {
  950. parsedName = null;
  951. }
  952. if (parsedName !== ns) {
  953. delete rootObject[currentPart];
  954. throw Error.argument('namespacePath', Sys.Res.invalidNameSpace);
  955. }
  956. ns.getName = function ns$getName() {return this.__typeName;}
  957. }
  958. rootObject = ns;
  959. }
  960. }
  961. Type._checkDependency = function Type$_checkDependency(dependency, featureName) {
  962. var scripts = Type._registerScript._scripts, isDependent = (scripts ? (!!scripts[dependency]) : false);
  963. if ((typeof(featureName) !== 'undefined') && !isDependent) {
  964. throw Error.invalidOperation(String.format(Sys.Res.requiredScriptReferenceNotIncluded,
  965. featureName, dependency));
  966. }
  967. return isDependent;
  968. }
  969. Type._registerScript = function Type$_registerScript(scriptName, dependencies) {
  970. var scripts = Type._registerScript._scripts;
  971. if (!scripts) {
  972. Type._registerScript._scripts = scripts = {};
  973. }
  974. if (scripts[scriptName]) {
  975. throw Error.invalidOperation(String.format(Sys.Res.scriptAlreadyLoaded, scriptName));
  976. }
  977. scripts[scriptName] = true;
  978. if (dependencies) {
  979. for (var i = 0, l = dependencies.length; i < l; i++) {
  980. var dependency = dependencies[i];
  981. if (!Type._checkDependency(dependency)) {
  982. throw Error.invalidOperation(String.format(Sys.Res.scriptDependencyNotFound, scriptName, dependency));
  983. }
  984. }
  985. }
  986. }
  987. Type._registerNamespace("Sys");
  988. Sys.__upperCaseTypes = {};
  989. Sys.__rootNamespaces = [Sys];
  990. Sys.__registeredTypes = {};
  991. Sys._isInstanceOfType = function Sys$_isInstanceOfType(type, instance) {
  992. if (typeof(instance) === "undefined" || instance === null) return false;
  993. if (instance instanceof type) return true;
  994. var instanceType = Object.getType(instance);
  995. return !!(instanceType === type) ||
  996. (instanceType.inheritsFrom && instanceType.inheritsFrom(type)) ||
  997. (instanceType.implementsInterface && instanceType.implementsInterface(type));
  998. }
  999. Sys._getBaseMethod = function Sys$_getBaseMethod(type, instance, name) {
  1000. if (!Sys._isInstanceOfType(type, instance)) throw Error.argumentType('instance', Object.getType(instance), type);
  1001. var baseType = type.getBaseType();
  1002. if (baseType) {
  1003. var baseMethod = baseType.prototype[name];
  1004. return (baseMethod instanceof Function) ? baseMethod : null;
  1005. }
  1006. return null;
  1007. }
  1008. Sys._isDomElement = function Sys$_isDomElement(obj) {
  1009. var val = false;
  1010. if (typeof (obj.nodeType) !== 'number') {
  1011. var doc = obj.ownerDocument || obj.document || obj;
  1012. if (doc != obj) {
  1013. var w = doc.defaultView || doc.parentWindow;
  1014. val = (w != obj);
  1015. }
  1016. else {
  1017. val = (typeof (doc.body) === 'undefined');
  1018. }
  1019. }
  1020. return !val;
  1021. }
  1022. Array.__typeName = 'Array';
  1023. Array.__class = true;
  1024. Array.add = Array.enqueue = function Array$enqueue(array, item) {
  1025. /// <summary locid="M:J#Array.enqueue" />
  1026. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1027. /// <param name="item" mayBeNull="true"></param>
  1028. var e = Function._validateParams(arguments, [
  1029. {name: "array", type: Array, elementMayBeNull: true},
  1030. {name: "item", mayBeNull: true}
  1031. ]);
  1032. if (e) throw e;
  1033. array[array.length] = item;
  1034. }
  1035. Array.addRange = function Array$addRange(array, items) {
  1036. /// <summary locid="M:J#Array.addRange" />
  1037. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1038. /// <param name="items" type="Array" elementMayBeNull="true"></param>
  1039. var e = Function._validateParams(arguments, [
  1040. {name: "array", type: Array, elementMayBeNull: true},
  1041. {name: "items", type: Array, elementMayBeNull: true}
  1042. ]);
  1043. if (e) throw e;
  1044. array.push.apply(array, items);
  1045. }
  1046. Array.clear = function Array$clear(array) {
  1047. /// <summary locid="M:J#Array.clear" />
  1048. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1049. var e = Function._validateParams(arguments, [
  1050. {name: "array", type: Array, elementMayBeNull: true}
  1051. ]);
  1052. if (e) throw e;
  1053. array.length = 0;
  1054. }
  1055. Array.clone = function Array$clone(array) {
  1056. /// <summary locid="M:J#Array.clone" />
  1057. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1058. /// <returns type="Array" elementMayBeNull="true"></returns>
  1059. var e = Function._validateParams(arguments, [
  1060. {name: "array", type: Array, elementMayBeNull: true}
  1061. ]);
  1062. if (e) throw e;
  1063. if (array.length === 1) {
  1064. return [array[0]];
  1065. }
  1066. else {
  1067. return Array.apply(null, array);
  1068. }
  1069. }
  1070. Array.contains = function Array$contains(array, item) {
  1071. /// <summary locid="M:J#Array.contains" />
  1072. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1073. /// <param name="item" mayBeNull="true"></param>
  1074. /// <returns type="Boolean"></returns>
  1075. var e = Function._validateParams(arguments, [
  1076. {name: "array", type: Array, elementMayBeNull: true},
  1077. {name: "item", mayBeNull: true}
  1078. ]);
  1079. if (e) throw e;
  1080. return (Sys._indexOf(array, item) >= 0);
  1081. }
  1082. Array.dequeue = function Array$dequeue(array) {
  1083. /// <summary locid="M:J#Array.dequeue" />
  1084. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1085. /// <returns mayBeNull="true"></returns>
  1086. var e = Function._validateParams(arguments, [
  1087. {name: "array", type: Array, elementMayBeNull: true}
  1088. ]);
  1089. if (e) throw e;
  1090. return array.shift();
  1091. }
  1092. Array.forEach = function Array$forEach(array, method, instance) {
  1093. /// <summary locid="M:J#Array.forEach" />
  1094. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1095. /// <param name="method" type="Function"></param>
  1096. /// <param name="instance" optional="true" mayBeNull="true"></param>
  1097. var e = Function._validateParams(arguments, [
  1098. {name: "array", type: Array, elementMayBeNull: true},
  1099. {name: "method", type: Function},
  1100. {name: "instance", mayBeNull: true, optional: true}
  1101. ]);
  1102. if (e) throw e;
  1103. for (var i = 0, l = array.length; i < l; i++) {
  1104. var elt = array[i];
  1105. if (typeof(elt) !== 'undefined') method.call(instance, elt, i, array);
  1106. }
  1107. }
  1108. Array.indexOf = function Array$indexOf(array, item, start) {
  1109. /// <summary locid="M:J#Array.indexOf" />
  1110. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1111. /// <param name="item" optional="true" mayBeNull="true"></param>
  1112. /// <param name="start" optional="true" mayBeNull="true"></param>
  1113. /// <returns type="Number"></returns>
  1114. var e = Function._validateParams(arguments, [
  1115. {name: "array", type: Array, elementMayBeNull: true},
  1116. {name: "item", mayBeNull: true, optional: true},
  1117. {name: "start", mayBeNull: true, optional: true}
  1118. ]);
  1119. if (e) throw e;
  1120. return Sys._indexOf(array, item, start);
  1121. }
  1122. Array.insert = function Array$insert(array, index, item) {
  1123. /// <summary locid="M:J#Array.insert" />
  1124. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1125. /// <param name="index" mayBeNull="true"></param>
  1126. /// <param name="item" mayBeNull="true"></param>
  1127. var e = Function._validateParams(arguments, [
  1128. {name: "array", type: Array, elementMayBeNull: true},
  1129. {name: "index", mayBeNull: true},
  1130. {name: "item", mayBeNull: true}
  1131. ]);
  1132. if (e) throw e;
  1133. array.splice(index, 0, item);
  1134. }
  1135. Array.parse = function Array$parse(value) {
  1136. /// <summary locid="M:J#Array.parse" />
  1137. /// <param name="value" type="String" mayBeNull="true"></param>
  1138. /// <returns type="Array" elementMayBeNull="true"></returns>
  1139. var e = Function._validateParams(arguments, [
  1140. {name: "value", type: String, mayBeNull: true}
  1141. ]);
  1142. if (e) throw e;
  1143. if (!value) return [];
  1144. var v = eval(value);
  1145. if (!Array.isInstanceOfType(v)) throw Error.argument('value', Sys.Res.arrayParseBadFormat);
  1146. return v;
  1147. }
  1148. Array.remove = function Array$remove(array, item) {
  1149. /// <summary locid="M:J#Array.remove" />
  1150. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1151. /// <param name="item" mayBeNull="true"></param>
  1152. /// <returns type="Boolean"></returns>
  1153. var e = Function._validateParams(arguments, [
  1154. {name: "array", type: Array, elementMayBeNull: true},
  1155. {name: "item", mayBeNull: true}
  1156. ]);
  1157. if (e) throw e;
  1158. var index = Sys._indexOf(array, item);
  1159. if (index >= 0) {
  1160. array.splice(index, 1);
  1161. }
  1162. return (index >= 0);
  1163. }
  1164. Array.removeAt = function Array$removeAt(array, index) {
  1165. /// <summary locid="M:J#Array.removeAt" />
  1166. /// <param name="array" type="Array" elementMayBeNull="true"></param>
  1167. /// <param name="index" mayBeNull="true"></param>
  1168. var e = Function._validateParams(arguments, [
  1169. {name: "array", type: Array, elementMayBeNull: true},
  1170. {name: "index", mayBeNull: true}
  1171. ]);
  1172. if (e) throw e;
  1173. array.splice(index, 1);
  1174. }
  1175. Sys._indexOf = function Sys$_indexOf(array, item, start) {
  1176. if (typeof(item) === "undefined") return -1;
  1177. var length = array.length;
  1178. if (length !== 0) {
  1179. start = start - 0;
  1180. if (isNaN(start)) {
  1181. start = 0;
  1182. }
  1183. else {
  1184. if (isFinite(start)) {
  1185. start = start - (start % 1);
  1186. }
  1187. if (start < 0) {
  1188. start = Math.max(0, length + start);
  1189. }
  1190. }
  1191. for (var i = start; i < length; i++) {
  1192. if ((typeof(array[i]) !== "undefined") && (array[i] === item)) {
  1193. return i;
  1194. }
  1195. }
  1196. }
  1197. return -1;
  1198. }
  1199. Type._registerScript._scripts = {
  1200. "MicrosoftAjaxCore.js": true,
  1201. "MicrosoftAjaxGlobalization.js": true,
  1202. "MicrosoftAjaxSerialization.js": true,
  1203. "MicrosoftAjaxComponentModel.js": true,
  1204. "MicrosoftAjaxHistory.js": true,
  1205. "MicrosoftAjaxNetwork.js" : true,
  1206. "MicrosoftAjaxWebServices.js": true };
  1207. Sys.IDisposable = function Sys$IDisposable() {
  1208. throw Error.notImplemented();
  1209. }
  1210. function Sys$IDisposable$dispose() {
  1211. throw Error.notImplemented();
  1212. }
  1213. Sys.IDisposable.prototype = {
  1214. dispose: Sys$IDisposable$dispose
  1215. }
  1216. Sys.IDisposable.registerInterface('Sys.IDisposable');
  1217. Sys.StringBuilder = function Sys$StringBuilder(initialText) {
  1218. /// <summary locid="M:J#Sys.StringBuilder.#ctor" />
  1219. /// <param name="initialText" optional="true" mayBeNull="true"></param>
  1220. var e = Function._validateParams(arguments, [
  1221. {name: "initialText", mayBeNull: true, optional: true}
  1222. ]);
  1223. if (e) throw e;
  1224. this._parts = (typeof(initialText) !== 'undefined' && initialText !== null && initialText !== '') ?
  1225. [initialText.toString()] : [];
  1226. this._value = {};
  1227. this._len = 0;
  1228. }
  1229. function Sys$StringBuilder$append(text) {
  1230. /// <summary locid="M:J#Sys.StringBuilder.append" />
  1231. /// <param name="text" mayBeNull="true"></param>
  1232. var e = Function._validateParams(arguments, [
  1233. {name: "text", mayBeNull: true}
  1234. ]);
  1235. if (e) throw e;
  1236. this._parts[this._parts.length] = text;
  1237. }
  1238. function Sys$StringBuilder$appendLine(text) {
  1239. /// <summary locid="M:J#Sys.StringBuilder.appendLine" />
  1240. /// <param name="text" optional="true" mayBeNull="true"></param>
  1241. var e = Function._validateParams(arguments, [
  1242. {name: "text", mayBeNull: true, optional: true}
  1243. ]);
  1244. if (e) throw e;
  1245. this._parts[this._parts.length] =
  1246. ((typeof(text) === 'undefined') || (text === null) || (text === '')) ?
  1247. '\r\n' : text + '\r\n';
  1248. }
  1249. function Sys$StringBuilder$clear() {
  1250. /// <summary locid="M:J#Sys.StringBuilder.clear" />
  1251. if (arguments.length !== 0) throw Error.parameterCount();
  1252. this._parts = [];
  1253. this._value = {};
  1254. this._len = 0;
  1255. }
  1256. function Sys$StringBuilder$isEmpty() {
  1257. /// <summary locid="M:J#Sys.StringBuilder.isEmpty" />
  1258. /// <returns type="Boolean"></returns>
  1259. if (arguments.length !== 0) throw Error.parameterCount();
  1260. if (this._parts.length === 0) return true;
  1261. return this.toString() === '';
  1262. }
  1263. function Sys$StringBuilder$toString(separator) {
  1264. /// <summary locid="M:J#Sys.StringBuilder.toString" />
  1265. /// <param name="separator" type="String" optional="true" mayBeNull="true"></param>
  1266. /// <returns type="String"></returns>
  1267. var e = Function._validateParams(arguments, [
  1268. {name: "separator", type: String, mayBeNull: true, optional: true}
  1269. ]);
  1270. if (e) throw e;
  1271. separator = separator || '';
  1272. var parts = this._parts;
  1273. if (this._len !== parts.length) {
  1274. this._value = {};
  1275. this._len = parts.length;
  1276. }
  1277. var val = this._value;
  1278. if (typeof(val[separator]) === 'undefined') {
  1279. if (separator !== '') {
  1280. for (var i = 0; i < parts.length;) {
  1281. if ((typeof(parts[i]) === 'undefined') || (parts[i] === '') || (parts[i] === null)) {
  1282. parts.splice(i, 1);
  1283. }
  1284. else {
  1285. i++;
  1286. }
  1287. }
  1288. }
  1289. val[separator] = this._parts.join(separator);
  1290. }
  1291. return val[separator];
  1292. }
  1293. Sys.StringBuilder.prototype = {
  1294. append: Sys$StringBuilder$append,
  1295. appendLine: Sys$StringBuilder$appendLine,
  1296. clear: Sys$StringBuilder$clear,
  1297. isEmpty: Sys$StringBuilder$isEmpty,
  1298. toString: Sys$StringBuilder$toString
  1299. }
  1300. Sys.StringBuilder.registerClass('Sys.StringBuilder');
  1301. Sys.Browser = {};
  1302. Sys.Browser.InternetExplorer = {};
  1303. Sys.Browser.Firefox = {};
  1304. Sys.Browser.Safari = {};
  1305. Sys.Browser.Opera = {};
  1306. Sys.Browser.agent = null;
  1307. Sys.Browser.hasDebuggerStatement = false;
  1308. Sys.Browser.name = navigator.appName;
  1309. Sys.Browser.version = parseFloat(navigator.appVersion);
  1310. Sys.Browser.documentMode = 0;
  1311. if (navigator.userAgent.indexOf(' MSIE ') > -1) {
  1312. Sys.Browser.agent = Sys.Browser.InternetExplorer;
  1313. Sys.Browser.version = parseFloat(navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1]);
  1314. if (Sys.Browser.version >= 8) {
  1315. if (document.documentMode >= 7) {
  1316. Sys.Browser.documentMode = document.documentMode;
  1317. }
  1318. }
  1319. Sys.Browser.hasDebuggerStatement = true;
  1320. }
  1321. else if (navigator.userAgent.indexOf(' Firefox/') > -1) {
  1322. Sys.Browser.agent = Sys.Browser.Firefox;
  1323. Sys.Browser.version = parseFloat(navigator.userAgent.match(/ Firefox\/(\d+\.\d+)/)[1]);
  1324. Sys.Browser.name = 'Firefox';
  1325. Sys.Browser.hasDebuggerStatement = true;
  1326. }
  1327. else if (navigator.userAgent.indexOf(' AppleWebKit/') > -1) {
  1328. Sys.Browser.agent = Sys.Browser.Safari;
  1329. Sys.Browser.version = parseFloat(navigator.userAgent.match(/ AppleWebKit\/(\d+(\.\d+)?)/)[1]);
  1330. Sys.Browser.name = 'Safari';
  1331. }
  1332. else if (navigator.userAgent.indexOf('Opera/') > -1) {
  1333. Sys.Browser.agent = Sys.Browser.Opera;
  1334. }
  1335. Sys.EventArgs = function Sys$EventArgs() {
  1336. /// <summary locid="M:J#Sys.EventArgs.#ctor" />
  1337. if (arguments.length !== 0) throw Error.parameterCount();
  1338. }
  1339. Sys.EventArgs.registerClass('Sys.EventArgs');
  1340. Sys.EventArgs.Empty = new Sys.EventArgs();
  1341. Sys.CancelEventArgs = function Sys$CancelEventArgs() {
  1342. /// <summary locid="M:J#Sys.CancelEventArgs.#ctor" />
  1343. if (arguments.length !== 0) throw Error.parameterCount();
  1344. Sys.CancelEventArgs.initializeBase(this);
  1345. this._cancel = false;
  1346. }
  1347. function Sys$CancelEventArgs$get_cancel() {
  1348. /// <value type="Boolean" locid="P:J#Sys.CancelEventArgs.cancel"></value>
  1349. if (arguments.length !== 0) throw Error.parameterCount();
  1350. return this._cancel;
  1351. }
  1352. function Sys$CancelEventArgs$set_cancel(value) {
  1353. var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
  1354. if (e) throw e;
  1355. this._cancel = value;
  1356. }
  1357. Sys.CancelEventArgs.prototype = {
  1358. get_cancel: Sys$CancelEventArgs$get_cancel,
  1359. set_cancel: Sys$CancelEventArgs$set_cancel
  1360. }
  1361. Sys.CancelEventArgs.registerClass('Sys.CancelEventArgs', Sys.EventArgs);
  1362. Type.registerNamespace('Sys.UI');
  1363. Sys._Debug = function Sys$_Debug() {
  1364. /// <summary locid="M:J#Sys.Debug.#ctor" />
  1365. /// <field name="isDebug" type="Boolean" locid="F:J#Sys.Debug.isDebug"></field>
  1366. if (arguments.length !== 0) throw Error.parameterCount();
  1367. }
  1368. function Sys$_Debug$_appendConsole(text) {
  1369. if ((typeof(Debug) !== 'undefined') && Debug.writeln) {
  1370. Debug.writeln(text);
  1371. }
  1372. if (window.console && window.console.log) {
  1373. window.console.log(text);
  1374. }
  1375. if (window.opera) {
  1376. window.opera.postError(text);
  1377. }
  1378. if (window.debugService) {
  1379. window.debugService.trace(text);
  1380. }
  1381. }
  1382. function Sys$_Debug$_appendTrace(text) {
  1383. var traceElement = document.getElementById('TraceConsole');
  1384. if (traceElement && (traceElement.tagName.toUpperCase() === 'TEXTAREA')) {
  1385. traceElement.value += text + '\n';
  1386. }
  1387. }
  1388. function Sys$_Debug$assert(condition, message, displayCaller) {
  1389. /// <summary locid="M:J#Sys.Debug.assert" />
  1390. /// <param name="condition" type="Boolean"></param>
  1391. /// <param name="message" type="String" optional="true" mayBeNull="true"></param>
  1392. /// <param name="displayCaller" type="Boolean" optional="true"></param>
  1393. var e = Function._validateParams(arguments, [
  1394. {name: "condition", type: Boolean},
  1395. {name: "message", type: String, mayBeNull: true, optional: true},
  1396. {name: "displayCaller", type: Boolean, optional: true}
  1397. ]);
  1398. if (e) throw e;
  1399. if (!condition) {
  1400. message = (displayCaller && this.assert.caller) ?
  1401. String.format(Sys.Res.assertFailedCaller, message, this.assert.caller) :
  1402. String.format(Sys.Res.assertFailed, message);
  1403. if (confirm(String.format(Sys.Res.breakIntoDebugger, message))) {
  1404. this.fail(message);
  1405. }
  1406. }
  1407. }
  1408. function Sys$_Debug$clearTrace() {
  1409. /// <summary locid="M:J#Sys.Debug.clearTrace" />
  1410. if (arguments.length !== 0) throw Error.parameterCount();
  1411. var traceElement = document.getElementById('TraceConsole');
  1412. if (traceElement && (traceElement.tagName.toUpperCase() === 'TEXTAREA')) {
  1413. traceElement.value = '';
  1414. }
  1415. }
  1416. function Sys$_Debug$fail(message) {
  1417. /// <summary locid="M:J#Sys.Debug.fail" />
  1418. /// <param name="message" type="String" mayBeNull="true"></param>
  1419. var e = Function._validateParams(arguments, [
  1420. {name: "message", type: String, mayBeNull: true}
  1421. ]);
  1422. if (e) throw e;
  1423. this._appendConsole(message);
  1424. if (Sys.Browser.hasDebuggerStatement) {
  1425. eval('debugger');
  1426. }
  1427. }
  1428. function Sys$_Debug$trace(text) {
  1429. /// <summary locid="M:J#Sys.Debug.trace" />
  1430. /// <param name="text"></param>
  1431. var e = Function._validateParams(arguments, [
  1432. {name: "text"}
  1433. ]);
  1434. if (e) throw e;
  1435. this._appendConsole(text);
  1436. this._appendTrace(text);
  1437. }
  1438. function Sys$_Debug$traceDump(object, name) {
  1439. /// <summary locid="M:J#Sys.Debug.traceDump" />
  1440. /// <param name="object" mayBeNull="true"></param>
  1441. /// <param name="name" type="String" mayBeNull="true" optional="true"></param>
  1442. var e = Function._validateParams(arguments, [
  1443. {name: "object", mayBeNull: true},
  1444. {name: "name", type: String, mayBeNull: true, optional: true}
  1445. ]);
  1446. if (e) throw e;
  1447. var text = this._traceDump(object, name, true);
  1448. }
  1449. function Sys$_Debug$_traceDump(object, name, recursive, indentationPadding, loopArray) {
  1450. name = name? name : 'traceDump';
  1451. indentationPadding = indentationPadding? indentationPadding : '';
  1452. if (object === null) {
  1453. this.trace(indentationPadding + name + ': null');
  1454. return;
  1455. }
  1456. switch(typeof(object)) {
  1457. case 'undefined':
  1458. this.trace(indentationPadding + name + ': Undefined');
  1459. break;
  1460. case 'number': case 'string': case 'boolean':
  1461. this.trace(indentationPadding + name + ': ' + object);
  1462. break;
  1463. default:
  1464. if (Date.isInstanceOfType(object) || RegExp.isInstanceOfType(object)) {
  1465. this.trace(indentationPadding + name + ': ' + object.toString());
  1466. break;
  1467. }
  1468. if (!loopArray) {
  1469. loopArray = [];
  1470. }
  1471. else if (Array.contains(loopArray, object)) {
  1472. this.trace(indentationPadding + name + ': ...');
  1473. return;
  1474. }
  1475. Array.add(loopArray, object);
  1476. if ((object == window) || (object === document) ||
  1477. (window.HTMLElement && (object instanceof HTMLElement)) ||
  1478. (typeof(object.nodeName) === 'string')) {
  1479. var tag = object.tagName? object.tagName : 'DomElement';
  1480. if (object.id) {
  1481. tag += ' - ' + object.id;
  1482. }
  1483. this.trace(indentationPadding + name + ' {' + tag + '}');
  1484. }
  1485. else {
  1486. var typeName = Object.getTypeName(object);
  1487. this.trace(indentationPadding + name + (typeof(typeName) === 'string' ? ' {' + typeName + '}' : ''));
  1488. if ((indentationPadding === '') || recursive) {
  1489. indentationPadding += " ";
  1490. var i, length, properties, p, v;
  1491. if (Array.isInstanceOfType(object)) {
  1492. length = object.length;
  1493. for (i = 0; i < length; i++) {
  1494. this._traceDump(object[i], '[' + i + ']', recursive, indentationPadding, loopArray);
  1495. }
  1496. }
  1497. else {
  1498. for (p in object) {
  1499. v = object[p];
  1500. if (!Function.isInstanceOfType(v)) {
  1501. this._traceDump(v, p, recursive, indentationPadding, loopArray);
  1502. }
  1503. }
  1504. }
  1505. }
  1506. }
  1507. Array.remove(loopArray, object);
  1508. }
  1509. }
  1510. Sys._Debug.prototype = {
  1511. _appendConsole: Sys$_Debug$_appendConsole,
  1512. _appendTrace: Sys$_Debug$_appendTrace,
  1513. assert: Sys$_Debug$assert,
  1514. clearTrace: Sys$_Debug$clearTrace,
  1515. fail: Sys$_Debug$fail,
  1516. trace: Sys$_Debug$trace,
  1517. traceDump: Sys$_Debug$traceDump,
  1518. _traceDump: Sys$_Debug$_traceDump
  1519. }
  1520. Sys._Debug.registerClass('Sys._Debug');
  1521. Sys.Debug = new Sys._Debug();
  1522. Sys.Debug.isDebug = true;
  1523. function Sys$Enum$parse(value, ignoreCase) {
  1524. /// <summary locid="M:J#Sys.Enum.parse" />
  1525. /// <param name="value" type="String"></param>
  1526. /// <param name="ignoreCase" type="Boolean" optional="true"></param>
  1527. /// <returns></returns>
  1528. var e = Function._validateParams(arguments, [
  1529. {name: "value", type: String},
  1530. {name: "ignoreCase", type: Boolean, optional: true}
  1531. ]);
  1532. if (e) throw e;
  1533. var values, parsed, val;
  1534. if (ignoreCase) {
  1535. values = this.__lowerCaseValues;
  1536. if (!values) {
  1537. this.__lowerCaseValues = values = {};
  1538. var prototype = this.prototype;
  1539. for (var name in prototype) {
  1540. values[name.toLowerCase()] = prototype[name];
  1541. }
  1542. }
  1543. }
  1544. else {
  1545. values = this.prototype;
  1546. }
  1547. if (!this.__flags) {
  1548. val = (ignoreCase ? value.toLowerCase() : value);
  1549. parsed = values[val.trim()];
  1550. if (typeof(parsed) !== 'number') throw Error.argument('value', String.format(Sys.Res.enumInvalidValue, value, this.__typeName));
  1551. return parsed;
  1552. }
  1553. else {
  1554. var parts = (ignoreCase ? value.toLowerCase() : value).split(',');
  1555. var v = 0;
  1556. for (var i = parts.length - 1; i >= 0; i--) {
  1557. var part = parts[i].trim();
  1558. parsed = values[part];
  1559. if (typeof(parsed) !== 'number') throw Error.argument('value', String.format(Sys.Res.enumInvalidValue, value.split(',')[i].trim(), this.__typeName));
  1560. v |= parsed;
  1561. }
  1562. return v;
  1563. }
  1564. }
  1565. function Sys$Enum$toString(value) {
  1566. /// <summary locid="M:J#Sys.Enum.toString" />
  1567. /// <param name="value" optional="true" mayBeNull="true"></param>
  1568. /// <returns type="String"></returns>
  1569. var e = Function._validateParams(arguments, [
  1570. {name: "value", mayBeNull: true, optional: true}
  1571. ]);
  1572. if (e) throw e;
  1573. if ((typeof(value) === 'undefined') || (value === null)) return this.__string;
  1574. if ((typeof(value) != 'number') || ((value % 1) !== 0)) throw Error.argumentType('value', Object.getType(value), this);
  1575. var values = this.prototype;
  1576. var i;
  1577. if (!this.__flags || (value === 0)) {
  1578. for (i in values) {
  1579. if (values[i] === value) {
  1580. return i;
  1581. }
  1582. }
  1583. }
  1584. else {
  1585. var sorted = this.__sortedValues;
  1586. if (!sorted) {
  1587. sorted = [];
  1588. for (i in values) {
  1589. sorted[sorted.length] = {key: i, value: values[i]};
  1590. }
  1591. sorted.sort(function(a, b) {
  1592. return a.value - b.value;
  1593. });
  1594. this.__sortedValues = sorted;
  1595. }
  1596. var parts = [];
  1597. var v = value;
  1598. for (i = sorted.length - 1; i >= 0; i--) {
  1599. var kvp = sorted[i];
  1600. var vali = kvp.value;
  1601. if (vali === 0) continue;
  1602. if ((vali & value) === vali) {
  1603. parts[parts.length] = kvp.key;
  1604. v -= vali;
  1605. if (v === 0) break;
  1606. }
  1607. }
  1608. if (parts.length && v === 0) return parts.reverse().join(', ');
  1609. }
  1610. throw Error.argumentOutOfRange('value', value, String.format(Sys.Res.enumInvalidValue, value, this.__typeName));
  1611. }
  1612. Type.prototype.registerEnum = function Type$registerEnum(name, flags) {
  1613. /// <summary locid="M:J#Sys.UI.LineType.#ctor" />
  1614. /// <param name="name" type="String"></param>
  1615. /// <param name="flags" type="Boolean" optional="true"></param>
  1616. var e = Function._validateParams(arguments, [
  1617. {name: "name", type: String},
  1618. {name: "flags", type: Boolean, optional: true}
  1619. ]);
  1620. if (e) throw e;
  1621. if (!Type.__fullyQualifiedIdentifierRegExp.test(name)) throw Error.argument('name', Sys.Res.notATypeName);
  1622. var parsedName;
  1623. try {
  1624. parsedName = eval(name);
  1625. }
  1626. catch(e) {
  1627. throw Error.argument('name', Sys.Res.argumentTypeName);
  1628. }
  1629. if (parsedName !== this) throw Error.argument('name', Sys.Res.badTypeName);
  1630. if (Sys.__registeredTypes[name]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, name));
  1631. for (var j in this.prototype) {
  1632. var val = this.prototype[j];
  1633. if (!Type.__identifierRegExp.test(j)) throw Error.invalidOperation(String.format(Sys.Res.enumInvalidValueName, j));
  1634. if (typeof(val) !== 'number' || (val % 1) !== 0) throw Error.invalidOperation(Sys.Res.enumValueNotInteger);
  1635. if (typeof(this[j]) !== 'undefined') throw Error.invalidOperation(String.format(Sys.Res.enumReservedName, j));
  1636. }
  1637. Sys.__upperCaseTypes[name.toUpperCase()] = this;
  1638. for (var i in this.prototype) {
  1639. this[i] = this.prototype[i];
  1640. }
  1641. this.__typeName = name;
  1642. this.parse = Sys$Enum$parse;
  1643. this.__string = this.toString();
  1644. this.toString = Sys$Enum$toString;
  1645. this.__flags = flags;
  1646. this.__enum = true;
  1647. Sys.__registeredTypes[name] = true;
  1648. }
  1649. Type.isEnum = function Type$isEnum(type) {
  1650. /// <summary locid="M:J#Type.isEnum" />
  1651. /// <param name="type" mayBeNull="true"></param>
  1652. /// <returns type="Boolean"></returns>
  1653. var e = Function._validateParams(arguments, [
  1654. {name: "type", mayBeNull: true}
  1655. ]);
  1656. if (e) throw e;
  1657. if ((typeof(type) === 'undefined') || (type === null)) return false;
  1658. return !!type.__enum;
  1659. }
  1660. Type.isFlags = function Type$isFlags(type) {
  1661. /// <summary locid="M:J#Type.isFlags" />
  1662. /// <param name="type" mayBeNull="true"></param>
  1663. /// <returns type="Boolean"></returns>
  1664. var e = Function._validateParams(arguments, [
  1665. {name: "type", mayBeNull: true}
  1666. ]);
  1667. if (e) throw e;
  1668. if ((typeof(type) === 'undefined') || (type === null)) return false;
  1669. return !!type.__flags;
  1670. }
  1671. Sys.CollectionChange = function Sys$CollectionChange(action, newItems, newStartingIndex, oldItems, oldStartingIndex) {
  1672. /// <summary locid="M:J#Sys.CollectionChange.#ctor" />
  1673. /// <param name="action" type="Sys.NotifyCollectionChangedAction"></param>
  1674. /// <param name="newItems" optional="true" mayBeNull="true"></param>
  1675. /// <param name="newStartingIndex" type="Number" integer="true" optional="true" mayBeNull="true"></param>
  1676. /// <param name="oldItems" optional="true" mayBeNull="true"></param>
  1677. /// <param name="oldStartingIndex" type="Number" integer="true" optional="true" mayBeNull="true"></param>
  1678. /// <field name="action" type="Sys.NotifyCollectionChangedAction" locid="F:J#Sys.CollectionChange.action"></field>
  1679. /// <field name="newItems" type="Array" mayBeNull="true" elementMayBeNull="true" locid="F:J#Sys.CollectionChange.newItems"></field>
  1680. /// <field name="newStartingIndex" type="Number" integer="true" locid="F:J#Sys.CollectionChange.newStartingIndex"></field>
  1681. /// <field name="oldItems" type="Array" mayBeNull="true" elementMayBeNull="true" locid="F:J#Sys.CollectionChange.oldItems"></field>
  1682. /// <field name="oldStartingIndex" type="Number" integer="true" locid="F:J#Sys.CollectionChange.oldStartingIndex"></field>
  1683. var e = Function._validateParams(arguments, [
  1684. {name: "action", type: Sys.NotifyCollectionChangedAction},
  1685. {name: "newItems", mayBeNull: true, optional: true},
  1686. {name: "newStartingIndex", type: Number, mayBeNull: true, integer: true, optional: true},
  1687. {name: "oldItems", mayBeNull: true, optional: true},
  1688. {name: "oldStartingIndex", type: Number, mayBeNull: true, integer: true, optional: true}
  1689. ]);
  1690. if (e) throw e;
  1691. this.action = action;
  1692. if (newItems) {
  1693. if (!(newItems instanceof Array)) {
  1694. newItems = [newItems];
  1695. }
  1696. }
  1697. this.newItems = newItems || null;
  1698. if (typeof newStartingIndex !== "number") {
  1699. newStartingIndex = -1;
  1700. }
  1701. this.newStartingIndex = newStartingIndex;
  1702. if (oldItems) {
  1703. if (!(oldItems instanceof Array)) {
  1704. oldItems = [oldItems];
  1705. }
  1706. }
  1707. this.oldItems = oldItems || null;
  1708. if (typeof oldStartingIndex !== "number") {
  1709. oldStartingIndex = -1;
  1710. }
  1711. this.oldStartingIndex = oldStartingIndex;
  1712. }
  1713. Sys.CollectionChange.registerClass("Sys.CollectionChange");
  1714. Sys.NotifyCollectionChangedAction = function Sys$NotifyCollectionChangedAction() {
  1715. /// <summary locid="M:J#Sys.NotifyCollectionChangedAction.#ctor" />
  1716. /// <field name="add" type="Number" integer="true" static="true" locid="F:J#Sys.NotifyCollectionChangedAction.add"></field>
  1717. /// <field name="remove" type="Number" integer="true" static="true" locid="F:J#Sys.NotifyCollectionChangedAction.remove"></field>
  1718. /// <field name="reset" type="Number" integer="true" static="true" locid="F:J#Sys.NotifyCollectionChangedAction.reset"></field>
  1719. if (arguments.length !== 0) throw Error.parameterCount();
  1720. throw Error.notImplemented();
  1721. }
  1722. Sys.NotifyCollectionChangedAction.prototype = {
  1723. add: 0,
  1724. remove: 1,
  1725. reset: 2
  1726. }
  1727. Sys.NotifyCollectionChangedAction.registerEnum('Sys.NotifyCollectionChangedAction');
  1728. Sys.NotifyCollectionChangedEventArgs = function Sys$NotifyCollectionChangedEventArgs(changes) {
  1729. /// <summary locid="M:J#Sys.NotifyCollectionChangedEventArgs.#ctor" />
  1730. /// <param name="changes" type="Array" elementType="Sys.CollectionChange"></param>
  1731. var e = Function._validateParams(arguments, [
  1732. {name: "changes", type: Array, elementType: Sys.CollectionChange}
  1733. ]);
  1734. if (e) throw e;
  1735. this._changes = changes;
  1736. Sys.NotifyCollectionChangedEventArgs.initializeBase(this);
  1737. }
  1738. function Sys$NotifyCollectionChangedEventArgs$get_changes() {
  1739. /// <value type="Array" elementType="Sys.CollectionChange" locid="P:J#Sys.NotifyCollectionChangedEventArgs.changes"></value>
  1740. if (arguments.length !== 0) throw Error.parameterCount();
  1741. return this._changes || [];
  1742. }
  1743. Sys.NotifyCollectionChangedEventArgs.prototype = {
  1744. get_changes: Sys$NotifyCollectionChangedEventArgs$get_changes
  1745. }
  1746. Sys.NotifyCollectionChangedEventArgs.registerClass("Sys.NotifyCollectionChangedEventArgs", Sys.EventArgs);
  1747. Sys.Observer = function Sys$Observer() {
  1748. throw Error.invalidOperation();
  1749. }
  1750. Sys.Observer.registerClass("Sys.Observer");
  1751. Sys.Observer.makeObservable = function Sys$Observer$makeObservable(target) {
  1752. /// <summary locid="M:J#Sys.Observer.makeObservable" />
  1753. /// <param name="target" mayBeNull="false"></param>
  1754. /// <returns></returns>
  1755. var e = Function._validateParams(arguments, [
  1756. {name: "target"}
  1757. ]);
  1758. if (e) throw e;
  1759. var isArray = target instanceof Array,
  1760. o = Sys.Observer;
  1761. Sys.Observer._ensureObservable(target);
  1762. if (target.setValue === o._observeMethods.setValue) return target;
  1763. o._addMethods(target, o._observeMethods);
  1764. if (isArray) {
  1765. o._addMethods(target, o._arrayMethods);
  1766. }
  1767. return target;
  1768. }
  1769. Sys.Observer._ensureObservable = function Sys$Observer$_ensureObservable(target) {
  1770. var type = typeof target;
  1771. if ((type === "string") || (type === "number") || (type === "boolean") || (type === "date")) {
  1772. throw Error.invalidOperation(String.format(Sys.Res.notObservable, type));
  1773. }
  1774. }
  1775. Sys.Observer._addMethods = function Sys$Observer$_addMethods(target, methods) {
  1776. for (var m in methods) {
  1777. if (target[m] && (target[m] !== methods[m])) {
  1778. throw Error.invalidOperation(String.format(Sys.Res.observableConflict, m));
  1779. }
  1780. target[m] = methods[m];
  1781. }
  1782. }
  1783. Sys.Observer._addEventHandler = function Sys$Observer$_addEventHandler(target, eventName, handler) {
  1784. Sys.Observer._getContext(target, true).events._addHandler(eventName, handler);
  1785. }
  1786. Sys.Observer.addEventHandler = function Sys$Observer$addEventHandler(target, eventName, handler) {
  1787. /// <summary locid="M:J#Sys.Observer.addEventHandler" />
  1788. /// <param name="target"></param>
  1789. /// <param name="eventName" type="String"></param>
  1790. /// <param name="handler" type="Function"></param>
  1791. var e = Function._validateParams(arguments, [
  1792. {name: "target"},
  1793. {name: "eventName", type: String},
  1794. {name: "handler", type: Function}
  1795. ]);
  1796. if (e) throw e;
  1797. Sys.Observer._ensureObservable(target);
  1798. Sys.Observer._addEventHandler(target, eventName, handler);
  1799. }
  1800. Sys.Observer._removeEventHandler = function Sys$Observer$_removeEventHandler(target, eventName, handler) {
  1801. Sys.Observer._getContext(target, true).events._removeHandler(eventName, handler);
  1802. }
  1803. Sys.Observer.removeEventHandler = function Sys$Observer$removeEventHandler(target, eventName, handler) {
  1804. /// <summary locid="M:J#Sys.Observer.removeEventHandler" />
  1805. /// <param name="target"></param>
  1806. /// <param name="eventName" type="String"></param>
  1807. /// <param name="handler" type="Function"></param>
  1808. var e = Function._validateParams(arguments, [
  1809. {name: "target"},
  1810. {name: "eventName", type: String},
  1811. {name: "handler", type: Function}
  1812. ]);
  1813. if (e) throw e;
  1814. Sys.Observer._ensureObservable(target);
  1815. Sys.Observer._removeEventHandler(target, eventName, handler);
  1816. }
  1817. Sys.Observer.raiseEvent = function Sys$Observer$raiseEvent(target, eventName, eventArgs) {
  1818. /// <summary locid="M:J#Sys.Observer.raiseEvent" />
  1819. /// <param name="target"></param>
  1820. /// <param name="eventName" type="String"></param>
  1821. /// <param name="eventArgs" type="Sys.EventArgs"></param>
  1822. var e = Function._validateParams(arguments, [
  1823. {name: "target"},
  1824. {name: "eventName", type: String},
  1825. {name: "eventArgs", type: Sys.EventArgs}
  1826. ]);
  1827. if (e) throw e;
  1828. Sys.Observer._ensureObservable(target);
  1829. var ctx = Sys.Observer._getContext(target);
  1830. if (!ctx) return;
  1831. var handler = ctx.events.getHandler(eventName);
  1832. if (handler) {
  1833. handler(target, eventArgs);
  1834. }
  1835. }
  1836. Sys.Observer.addPropertyChanged = function Sys$Observer$addPropertyChanged(target, handler) {
  1837. /// <summary locid="M:J#Sys.Observer.addPropertyChanged" />
  1838. /// <param name="target" mayBeNull="false"></param>
  1839. /// <param name="handler" type="Function"></param>
  1840. var e = Function._validateParams(arguments, [
  1841. {name: "target"},
  1842. {name: "handler", type: Function}
  1843. ]);
  1844. if (e) throw e;
  1845. Sys.Observer._ensureObservable(target);
  1846. Sys.Observer._addEventHandler(target, "propertyChanged", handler);
  1847. }
  1848. Sys.Observer.removePropertyChanged = function Sys$Observer$removePropertyChanged(target, handler) {
  1849. /// <summary locid="M:J#Sys.Observer.removePropertyChanged" />
  1850. /// <param name="target" mayBeNull="false"></param>
  1851. /// <param name="handler" type="Function"></param>
  1852. var e = Function._validateParams(arguments, [
  1853. {name: "target"},
  1854. {name: "handler", type: Function}
  1855. ]);
  1856. if (e) throw e;
  1857. Sys.Observer._ensureObservable(target);
  1858. Sys.Observer._removeEventHandler(target, "propertyChanged", handler);
  1859. }
  1860. Sys.Observer.beginUpdate = function Sys$Observer$beginUpdate(target) {
  1861. /// <summary locid="M:J#Sys.Observer.beginUpdate" />
  1862. /// <param name="target" mayBeNull="false"></param>
  1863. var e = Function._validateParams(arguments, [
  1864. {name: "target"}
  1865. ]);
  1866. if (e) throw e;
  1867. Sys.Observer._ensureObservable(target);
  1868. Sys.Observer._getContext(target, true).updating = true;
  1869. }
  1870. Sys.Observer.endUpdate = function Sys$Observer$endUpdate(target) {
  1871. /// <summary locid="M:J#Sys.Observer.endUpdate" />
  1872. /// <param name="target" mayBeNull="false"></param>
  1873. var e = Function._validateParams(arguments, [
  1874. {name: "target"}
  1875. ]);
  1876. if (e) throw e;
  1877. Sys.Observer._ensureObservable(target);
  1878. var ctx = Sys.Observer._getContext(target);
  1879. if (!ctx || !ctx.updating) return;
  1880. ctx.updating = false;
  1881. var dirty = ctx.dirty;
  1882. ctx.dirty = false;
  1883. if (dirty) {
  1884. if (target instanceof Array) {
  1885. var changes = ctx.changes;
  1886. ctx.changes = null;
  1887. Sys.Observer.raiseCollectionChanged(target, changes);
  1888. }
  1889. Sys.Observer.raisePropertyChanged(target, "");
  1890. }
  1891. }
  1892. Sys.Observer.isUpdating = function Sys$Observer$isUpdating(target) {
  1893. /// <summary locid="M:J#Sys.Observer.isUpdating" />
  1894. /// <param name="target" mayBeNull="false"></param>
  1895. /// <returns type="Boolean"></returns>
  1896. var e = Function._validateParams(arguments, [
  1897. {name: "target"}
  1898. ]);
  1899. if (e) throw e;
  1900. Sys.Observer._ensureObservable(target);
  1901. var ctx = Sys.Observer._getContext(target);
  1902. return ctx ? ctx.updating : false;
  1903. }
  1904. Sys.Observer._setValue = function Sys$Observer$_setValue(target, propertyName, value) {
  1905. var getter, setter, mainTarget = target, path = propertyName.split('.');
  1906. for (var i = 0, l = (path.length - 1); i < l ; i++) {
  1907. var name = path[i];
  1908. getter = target["get_" + name];
  1909. if (typeof (getter) === "function") {
  1910. target = getter.call(target);
  1911. }
  1912. else {
  1913. target = target[name];
  1914. }
  1915. var type = typeof (target);
  1916. if ((target === null) || (type === "undefined")) {
  1917. throw Error.invalidOperation(String.format(Sys.Res.nullReferenceInPath, propertyName));
  1918. }
  1919. }
  1920. var currentValue, lastPath = path[l];
  1921. getter = target["get_" + lastPath];
  1922. setter = target["set_" + lastPath];
  1923. if (typeof(getter) === 'function') {
  1924. currentValue = getter.call(target);
  1925. }
  1926. else {
  1927. currentValue = target[lastPath];
  1928. }
  1929. if (typeof(setter) === 'function') {
  1930. setter.call(target, value);
  1931. }
  1932. else {
  1933. target[lastPath] = value;
  1934. }
  1935. if (currentValue !== value) {
  1936. var ctx = Sys.Observer._getContext(mainTarget);
  1937. if (ctx && ctx.updating) {
  1938. ctx.dirty = true;
  1939. return;
  1940. };
  1941. Sys.Observer.raisePropertyChanged(mainTarget, path[0]);
  1942. }
  1943. }
  1944. Sys.Observer.setValue = function Sys$Observer$setValue(target, propertyName, value) {
  1945. /// <summary locid="M:J#Sys.Observer.setValue" />
  1946. /// <param name="target" mayBeNull="false"></param>
  1947. /// <param name="propertyName" type="String"></param>
  1948. /// <param name="value" mayBeNull="true"></param>
  1949. var e = Function._validateParams(arguments, [
  1950. {name: "target"},
  1951. {name: "propertyName", type: String},
  1952. {name: "value", mayBeNull: true}
  1953. ]);
  1954. if (e) throw e;
  1955. Sys.Observer._ensureObservable(target);
  1956. Sys.Observer._setValue(target, propertyName, value);
  1957. }
  1958. Sys.Observer.raisePropertyChanged = function Sys$Observer$raisePropertyChanged(target, propertyName) {
  1959. /// <summary locid="M:J#Sys.Observer.raisePropertyChanged" />
  1960. /// <param name="target" mayBeNull="false"></param>
  1961. /// <param name="propertyName" type="String"></param>
  1962. Sys.Observer.raiseEvent(target, "propertyChanged", new Sys.PropertyChangedEventArgs(propertyName));
  1963. }
  1964. Sys.Observer.addCollectionChanged = function Sys$Observer$addCollectionChanged(target, handler) {
  1965. /// <summary locid="M:J#Sys.Observer.addCollectionChanged" />
  1966. /// <param name="target" type="Array" elementMayBeNull="true"></param>
  1967. /// <param name="handler" type="Function"></param>
  1968. var e = Function._validateParams(arguments, [
  1969. {name: "target", type: Array, elementMayBeNull: true},
  1970. {name: "handler", type: Function}
  1971. ]);
  1972. if (e) throw e;
  1973. Sys.Observer._addEventHandler(target, "collectionChanged", handler);
  1974. }
  1975. Sys.Observer.removeCollectionChanged = function Sys$Observer$removeCollectionChanged(target, handler) {
  1976. /// <summary locid="M:J#Sys.Observer.removeCollectionChanged" />
  1977. /// <param name="target" type="Array" elementMayBeNull="true"></param>
  1978. /// <param name="handler" type="Function"></param>
  1979. var e = Function._validateParams(arguments, [
  1980. {name: "target", type: Array, elementMayBeNull: true},
  1981. {name: "handler", type: Function}
  1982. ]);
  1983. if (e) throw e;
  1984. Sys.Observer._removeEventHandler(target, "collectionChanged", handler);
  1985. }
  1986. Sys.Observer._collectionChange = function Sys$Observer$_collectionChange(target, change) {
  1987. var ctx = Sys.Observer._getContext(target);
  1988. if (ctx && ctx.updating) {
  1989. ctx.dirty = true;
  1990. var changes = ctx.changes;
  1991. if (!changes) {
  1992. ctx.changes = changes = [change];
  1993. }
  1994. else {
  1995. changes.push(change);
  1996. }
  1997. }
  1998. else {
  1999. Sys.Observer.raiseCollectionChanged(target, [change]);
  2000. Sys.Observer.raisePropertyChanged(target, 'length');
  2001. }
  2002. }
  2003. Sys.Observer.add = function Sys$Observer$add(target, item) {
  2004. /// <summary locid="M:J#Sys.Observer.add" />
  2005. /// <param name="target" type="Array" elementMayBeNull="true"></param>
  2006. /// <param name="item" mayBeNull="true"></param>
  2007. var e = Function._validateParams(arguments, [
  2008. {name: "target", type: Array, elementMayBeNull: true},
  2009. {name: "item", mayBeNull: true}
  2010. ]);
  2011. if (e) throw e;
  2012. var change = new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, [item], target.length);
  2013. Array.add(target, item);
  2014. Sys.Observer._collectionChange(target, change);
  2015. }
  2016. Sys.Observer.addRange = function Sys$Observer$addRange(target, items) {
  2017. /// <summary locid="M:J#Sys.Observer.addRange" />
  2018. /// <param name="target" type="Array" elementMayBeNull="true"></param>
  2019. /// <param name="items" type="Array" elementMayBeNull="true"></param>
  2020. var e = Function._validateParams(arguments, [
  2021. {name: "target", type: Array, elementMayBeNull: true},
  2022. {name: "items", type: Array, elementMayBeNull: true}
  2023. ]);
  2024. if (e) throw e;
  2025. var change = new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, items, target.length);
  2026. Array.addRange(target, items);
  2027. Sys.Observer._collectionChange(target, change);
  2028. }
  2029. Sys.Observer.clear = function Sys$Observer$clear(target) {
  2030. /// <summary locid="M:J#Sys.Observer.clear" />
  2031. /// <param name="target" type="Array" elementMayBeNull="true"></param>
  2032. var e = Function._validateParams(arguments, [
  2033. {name: "target", type: Array, elementMayBeNull: true}
  2034. ]);
  2035. if (e) throw e;
  2036. var oldItems = Array.clone(target);
  2037. Array.clear(target);
  2038. Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.reset, null, -1, oldItems, 0));
  2039. }
  2040. Sys.Observer.insert = function Sys$Observer$insert(target, index, item) {
  2041. /// <summary locid="M:J#Sys.Observer.insert" />
  2042. /// <param name="target" type="Array" elementMayBeNull="true"></param>
  2043. /// <param name="index" type="Number" integer="true"></param>
  2044. /// <param name="item" mayBeNull="true"></param>
  2045. var e = Function._validateParams(arguments, [
  2046. {name: "target", type: Array, elementMayBeNull: true},
  2047. {name: "index", type: Number, integer: true},
  2048. {name: "item", mayBeNull: true}
  2049. ]);
  2050. if (e) throw e;
  2051. Array.insert(target, index, item);
  2052. Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, [item], index));
  2053. }
  2054. Sys.Observer.remove = function Sys$Observer$remove(target, item) {
  2055. /// <summary locid="M:J#Sys.Observer.remove" />
  2056. /// <param name="target" type="Array" elementMayBeNull="true"></param>
  2057. /// <param name="item" mayBeNull="true"></param>
  2058. /// <returns type="Boolean"></returns>
  2059. var e = Function._validateParams(arguments, [
  2060. {name: "target", type: Array, elementMayBeNull: true},
  2061. {name: "item", mayBeNull: true}
  2062. ]);
  2063. if (e) throw e;
  2064. var index = Array.indexOf(target, item);
  2065. if (index !== -1) {
  2066. Array.remove(target, item);
  2067. Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.remove, null, -1, [item], index));
  2068. return true;
  2069. }
  2070. return false;
  2071. }
  2072. Sys.Observer.removeAt = function Sys$Observer$removeAt(target, index) {
  2073. /// <summary locid="M:J#Sys.Observer.removeAt" />
  2074. /// <param name="target" type="Array" elementMayBeNull="true"></param>
  2075. /// <param name="index" type="Number" integer="true"></param>
  2076. var e = Function._validateParams(arguments, [
  2077. {name: "target", type: Array, elementMayBeNull: true},
  2078. {name: "index", type: Number, integer: true}
  2079. ]);
  2080. if (e) throw e;
  2081. if ((index > -1) && (index < target.length)) {
  2082. var item = target[index];
  2083. Array.removeAt(target, index);
  2084. Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.remove, null, -1, [item], index));
  2085. }
  2086. }
  2087. Sys.Observer.raiseCollectionChanged = function Sys$Observer$raiseCollectionChanged(target, changes) {
  2088. /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
  2089. /// <param name="target"></param>
  2090. /// <param name="changes" type="Array" elementType="Sys.CollectionChange"></param>
  2091. Sys.Observer.raiseEvent(target, "collectionChanged", new Sys.NotifyCollectionChangedEventArgs(changes));
  2092. }
  2093. Sys.Observer._observeMethods = {
  2094. add_propertyChanged: function(handler) {
  2095. Sys.Observer._addEventHandler(this, "propertyChanged", handler);
  2096. },
  2097. remove_propertyChanged: function(handler) {
  2098. Sys.Observer._removeEventHandler(this, "propertyChanged", handler);
  2099. },
  2100. addEventHandler: function(eventName, handler) {
  2101. /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
  2102. /// <param name="eventName" type="String"></param>
  2103. /// <param name="handler" type="Function"></param>
  2104. var e = Function._validateParams(arguments, [
  2105. {name: "eventName", type: String},
  2106. {name: "handler", type: Function}
  2107. ]);
  2108. if (e) throw e;
  2109. Sys.Observer._addEventHandler(this, eventName, handler);
  2110. },
  2111. removeEventHandler: function(eventName, handler) {
  2112. /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
  2113. /// <param name="eventName" type="String"></param>
  2114. /// <param name="handler" type="Function"></param>
  2115. var e = Function._validateParams(arguments, [
  2116. {name: "eventName", type: String},
  2117. {name: "handler", type: Function}
  2118. ]);
  2119. if (e) throw e;
  2120. Sys.Observer._removeEventHandler(this, eventName, handler);
  2121. },
  2122. get_isUpdating: function() {
  2123. /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
  2124. /// <returns type="Boolean"></returns>
  2125. return Sys.Observer.isUpdating(this);
  2126. },
  2127. beginUpdate: function() {
  2128. /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
  2129. Sys.Observer.beginUpdate(this);
  2130. },
  2131. endUpdate: function() {
  2132. /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
  2133. Sys.Observer.endUpdate(this);
  2134. },
  2135. setValue: function(name, value) {
  2136. /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
  2137. /// <param name="name" type="String"></param>
  2138. /// <param name="value" mayBeNull="true"></param>
  2139. var e = Function._validateParams(arguments, [
  2140. {name: "name", type: String},
  2141. {name: "value", mayBeNull: true}
  2142. ]);
  2143. if (e) throw e;
  2144. Sys.Observer._setValue(this, name, value);
  2145. },
  2146. raiseEvent: function(eventName, eventArgs) {
  2147. /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
  2148. /// <param name="eventName" type="String"></param>
  2149. /// <param name="eventArgs" type="Sys.EventArgs"></param>
  2150. Sys.Observer.raiseEvent(this, eventName, eventArgs);
  2151. },
  2152. raisePropertyChanged: function(name) {
  2153. /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
  2154. /// <param name="name" type="String"></param>
  2155. Sys.Observer.raiseEvent(this, "propertyChanged", new Sys.PropertyChangedEventArgs(name));
  2156. }
  2157. }
  2158. Sys.Observer._arrayMethods = {
  2159. add_collectionChanged: function(handler) {
  2160. Sys.Observer._addEventHandler(this, "collectionChanged", handler);
  2161. },
  2162. remove_collectionChanged: function(handler) {
  2163. Sys.Observer._removeEventHandler(this, "collectionChanged", handler);
  2164. },
  2165. add: function(item) {
  2166. /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
  2167. /// <param name="item" mayBeNull="true"></param>
  2168. Sys.Observer.add(this, item);
  2169. },
  2170. addRange: function(items) {
  2171. /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
  2172. /// <param name="items" type="Array" elementMayBeNull="true"></param>
  2173. Sys.Observer.addRange(this, items);
  2174. },
  2175. clear: function() {
  2176. /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
  2177. Sys.Observer.clear(this);
  2178. },
  2179. insert: function(index, item) {
  2180. /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
  2181. /// <param name="index" type="Number" integer="true"></param>
  2182. /// <param name="item" mayBeNull="true"></param>
  2183. Sys.Observer.insert(this, index, item);
  2184. },
  2185. remove: function(item) {
  2186. /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
  2187. /// <param name="item" mayBeNull="true"></param>
  2188. /// <returns type="Boolean"></returns>
  2189. return Sys.Observer.remove(this, item);
  2190. },
  2191. removeAt: function(index) {
  2192. /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
  2193. /// <param name="index" type="Number" integer="true"></param>
  2194. Sys.Observer.removeAt(this, index);
  2195. },
  2196. raiseCollectionChanged: function(changes) {
  2197. /// <summary locid="M:J#Sys.Observer.raiseCollectionChanged" />
  2198. /// <param name="changes" type="Array" elementType="Sys.CollectionChange"></param>
  2199. Sys.Observer.raiseEvent(this, "collectionChanged", new Sys.NotifyCollectionChangedEventArgs(changes));
  2200. }
  2201. }
  2202. Sys.Observer._getContext = function Sys$Observer$_getContext(obj, create) {
  2203. var ctx = obj._observerContext;
  2204. if (ctx) return ctx();
  2205. if (create) {
  2206. return (obj._observerContext = Sys.Observer._createContext())();
  2207. }
  2208. return null;
  2209. }
  2210. Sys.Observer._createContext = function Sys$Observer$_createContext() {
  2211. var ctx = {
  2212. events: new Sys.EventHandlerList()
  2213. };
  2214. return function() {
  2215. return ctx;
  2216. }
  2217. }
  2218. Date._appendPreOrPostMatch = function Date$_appendPreOrPostMatch(preMatch, strBuilder) {
  2219. var quoteCount = 0;
  2220. var escaped = false;
  2221. for (var i = 0, il = preMatch.length; i < il; i++) {
  2222. var c = preMatch.charAt(i);
  2223. switch (c) {
  2224. case '\'':
  2225. if (escaped) strBuilder.append("'");
  2226. else quoteCount++;
  2227. escaped = false;
  2228. break;
  2229. case '\\':
  2230. if (escaped) strBuilder.append("\\");
  2231. escaped = !escaped;
  2232. break;
  2233. default:
  2234. strBuilder.append(c);
  2235. escaped = false;
  2236. break;
  2237. }
  2238. }
  2239. return quoteCount;
  2240. }
  2241. Date._expandFormat = function Date$_expandFormat(dtf, format) {
  2242. if (!format) {
  2243. format = "F";
  2244. }
  2245. var len = format.length;
  2246. if (len === 1) {
  2247. switch (format) {
  2248. case "d":
  2249. return dtf.ShortDatePattern;
  2250. case "D":
  2251. return dtf.LongDatePattern;
  2252. case "t":
  2253. return dtf.ShortTimePattern;
  2254. case "T":
  2255. return dtf.LongTimePattern;
  2256. case "f":
  2257. return dtf.LongDatePattern + " " + dtf.ShortTimePattern;
  2258. case "F":
  2259. return dtf.FullDateTimePattern;
  2260. case "M": case "m":
  2261. return dtf.MonthDayPattern;
  2262. case "s":
  2263. return dtf.SortableDateTimePattern;
  2264. case "Y": case "y":
  2265. return dtf.YearMonthPattern;
  2266. default:
  2267. throw Error.format(Sys.Res.formatInvalidString);
  2268. }
  2269. }
  2270. else if ((len === 2) && (format.charAt(0) === "%")) {
  2271. format = format.charAt(1);
  2272. }
  2273. return format;
  2274. }
  2275. Date._expandYear = function Date$_expandYear(dtf, year) {
  2276. var now = new Date(),
  2277. era = Date._getEra(now);
  2278. if (year < 100) {
  2279. var curr = Date._getEraYear(now, dtf, era);
  2280. year += curr - (curr % 100);
  2281. if (year > dtf.Calendar.TwoDigitYearMax) {
  2282. year -= 100;
  2283. }
  2284. }
  2285. return year;
  2286. }
  2287. Date._getEra = function Date$_getEra(date, eras) {
  2288. if (!eras) return 0;
  2289. var start, ticks = date.getTime();
  2290. for (var i = 0, l = eras.length; i < l; i += 4) {
  2291. start = eras[i+2];
  2292. if ((start === null) || (ticks >= start)) {
  2293. return i;
  2294. }
  2295. }
  2296. return 0;
  2297. }
  2298. Date._getEraYear = function Date$_getEraYear(date, dtf, era, sortable) {
  2299. var year = date.getFullYear();
  2300. if (!sortable && dtf.eras) {
  2301. year -= dtf.eras[era + 3];
  2302. }
  2303. return year;
  2304. }
  2305. Date._getParseRegExp = function Date$_getParseRegExp(dtf, format) {
  2306. if (!dtf._parseRegExp) {
  2307. dtf._parseRegExp = {};
  2308. }
  2309. else if (dtf._parseRegExp[format]) {
  2310. return dtf._parseRegExp[format];
  2311. }
  2312. var expFormat = Date._expandFormat(dtf, format);
  2313. expFormat = expFormat.replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g, "\\\\$1");
  2314. var regexp = new Sys.StringBuilder("^");
  2315. var groups = [];
  2316. var index = 0;
  2317. var quoteCount = 0;
  2318. var tokenRegExp = Date._getTokenRegExp();
  2319. var match;
  2320. while ((match = tokenRegExp.exec(expFormat)) !== null) {
  2321. var preMatch = expFormat.slice(index, match.index);
  2322. index = tokenRegExp.lastIndex;
  2323. quoteCount += Date._appendPreOrPostMatch(preMatch, regexp);
  2324. if ((quoteCount%2) === 1) {
  2325. regexp.append(match[0]);
  2326. continue;
  2327. }
  2328. switch (match[0]) {
  2329. case 'dddd': case 'ddd':
  2330. case 'MMMM': case 'MMM':
  2331. case 'gg': case 'g':
  2332. regexp.append("(\\D+)");
  2333. break;
  2334. case 'tt': case 't':
  2335. regexp.append("(\\D*)");
  2336. break;
  2337. case 'yyyy':
  2338. regexp.append("(\\d{4})");
  2339. break;
  2340. case 'fff':
  2341. regexp.append("(\\d{3})");
  2342. break;
  2343. case 'ff':
  2344. regexp.append("(\\d{2})");
  2345. break;
  2346. case 'f':
  2347. regexp.append("(\\d)");
  2348. break;
  2349. case 'dd': case 'd':
  2350. case 'MM': case 'M':
  2351. case 'yy': case 'y':
  2352. case 'HH': case 'H':
  2353. case 'hh': case 'h':
  2354. case 'mm': case 'm':
  2355. case 'ss': case 's':
  2356. regexp.append("(\\d\\d?)");
  2357. break;
  2358. case 'zzz':
  2359. regexp.append("([+-]?\\d\\d?:\\d{2})");
  2360. break;
  2361. case 'zz': case 'z':
  2362. regexp.append("([+-]?\\d\\d?)");
  2363. break;
  2364. case '/':
  2365. regexp.append("(\\" + dtf.DateSeparator + ")");
  2366. break;
  2367. default:
  2368. Sys.Debug.fail("Invalid date format pattern");
  2369. }
  2370. Array.add(groups, match[0]);
  2371. }
  2372. Date._appendPreOrPostMatch(expFormat.slice(index), regexp);
  2373. regexp.append("$");
  2374. var regexpStr = regexp.toString().replace(/\s+/g, "\\s+");
  2375. var parseRegExp = {'regExp': regexpStr, 'groups': groups};
  2376. dtf._parseRegExp[format] = parseRegExp;
  2377. return parseRegExp;
  2378. }
  2379. Date._getTokenRegExp = function Date$_getTokenRegExp() {
  2380. return /\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|gg|g/g;
  2381. }
  2382. Date.parseLocale = function Date$parseLocale(value, formats) {
  2383. /// <summary locid="M:J#Date.parseLocale" />
  2384. /// <param name="value" type="String"></param>
  2385. /// <param name="formats" parameterArray="true" optional="true" mayBeNull="true"></param>
  2386. /// <returns type="Date"></returns>
  2387. var e = Function._validateParams(arguments, [
  2388. {name: "value", type: String},
  2389. {name: "formats", mayBeNull: true, optional: true, parameterArray: true}
  2390. ]);
  2391. if (e) throw e;
  2392. return Date._parse(value, Sys.CultureInfo.CurrentCulture, arguments);
  2393. }
  2394. Date.parseInvariant = function Date$parseInvariant(value, formats) {
  2395. /// <summary locid="M:J#Date.parseInvariant" />
  2396. /// <param name="value" type="String"></param>
  2397. /// <param name="formats" parameterArray="true" optional="true" mayBeNull="true"></param>
  2398. /// <returns type="Date"></returns>
  2399. var e = Function._validateParams(arguments, [
  2400. {name: "value", type: String},
  2401. {name: "formats", mayBeNull: true, optional: true, parameterArray: true}
  2402. ]);
  2403. if (e) throw e;
  2404. return Date._parse(value, Sys.CultureInfo.InvariantCulture, arguments);
  2405. }
  2406. Date._parse = function Date$_parse(value, cultureInfo, args) {
  2407. var i, l, date, format, formats, custom = false;
  2408. for (i = 1, l = args.length; i < l; i++) {
  2409. format = args[i];
  2410. if (format) {
  2411. custom = true;
  2412. date = Date._parseExact(value, format, cultureInfo);
  2413. if (date) return date;
  2414. }
  2415. }
  2416. if (! custom) {
  2417. formats = cultureInfo._getDateTimeFormats();
  2418. for (i = 0, l = formats.length; i < l; i++) {
  2419. date = Date._parseExact(value, formats[i], cultureInfo);
  2420. if (date) return date;
  2421. }
  2422. }
  2423. return null;
  2424. }
  2425. Date._parseExact = function Date$_parseExact(value, format, cultureInfo) {
  2426. value = value.trim();
  2427. var dtf = cultureInfo.dateTimeFormat,
  2428. parseInfo = Date._getParseRegExp(dtf, format),
  2429. match = new RegExp(parseInfo.regExp).exec(value);
  2430. if (match === null) return null;
  2431. var groups = parseInfo.groups,
  2432. era = null, year = null, month = null, date = null, weekDay = null,
  2433. hour = 0, hourOffset, min = 0, sec = 0, msec = 0, tzMinOffset = null,
  2434. pmHour = false;
  2435. for (var j = 0, jl = groups.length; j < jl; j++) {
  2436. var matchGroup = match[j+1];
  2437. if (matchGroup) {
  2438. switch (groups[j]) {
  2439. case 'dd': case 'd':
  2440. date = parseInt(matchGroup, 10);
  2441. if ((date < 1) || (date > 31)) return null;
  2442. break;
  2443. case 'MMMM':
  2444. month = cultureInfo._getMonthIndex(matchGroup);
  2445. if ((month < 0) || (month > 11)) return null;
  2446. break;
  2447. case 'MMM':
  2448. month = cultureInfo._getAbbrMonthIndex(matchGroup);
  2449. if ((month < 0) || (month > 11)) return null;
  2450. break;
  2451. case 'M': case 'MM':
  2452. month = parseInt(matchGroup, 10) - 1;
  2453. if ((month < 0) || (month > 11)) return null;
  2454. break;
  2455. case 'y': case 'yy':
  2456. year = Date._expandYear(dtf,parseInt(matchGroup, 10));
  2457. if ((year < 0) || (year > 9999)) return null;
  2458. break;
  2459. case 'yyyy':
  2460. year = parseInt(matchGroup, 10);
  2461. if ((year < 0) || (year > 9999)) return null;
  2462. break;
  2463. case 'h': case 'hh':
  2464. hour = parseInt(matchGroup, 10);
  2465. if (hour === 12) hour = 0;
  2466. if ((hour < 0) || (hour > 11)) return null;
  2467. break;
  2468. case 'H': case 'HH':
  2469. hour = parseInt(matchGroup, 10);
  2470. if ((hour < 0) || (hour > 23)) return null;
  2471. break;
  2472. case 'm': case 'mm':
  2473. min = parseInt(matchGroup, 10);
  2474. if ((min < 0) || (min > 59)) return null;
  2475. break;
  2476. case 's': case 'ss':
  2477. sec = parseInt(matchGroup, 10);
  2478. if ((sec < 0) || (sec > 59)) return null;
  2479. break;
  2480. case 'tt': case 't':
  2481. var upperToken = matchGroup.toUpperCase();
  2482. pmHour = (upperToken === dtf.PMDesignator.toUpperCase());
  2483. if (!pmHour && (upperToken !== dtf.AMDesignator.toUpperCase())) return null;
  2484. break;
  2485. case 'f':
  2486. msec = parseInt(matchGroup, 10) * 100;
  2487. if ((msec < 0) || (msec > 999)) return null;
  2488. break;
  2489. case 'ff':
  2490. msec = parseInt(matchGroup, 10) * 10;
  2491. if ((msec < 0) || (msec > 999)) return null;
  2492. break;
  2493. case 'fff':
  2494. msec = parseInt(matchGroup, 10);
  2495. if ((msec < 0) || (msec > 999)) return null;
  2496. break;
  2497. case 'dddd':
  2498. weekDay = cultureInfo._getDayIndex(matchGroup);
  2499. if ((weekDay < 0) || (weekDay > 6)) return null;
  2500. break;
  2501. case 'ddd':
  2502. weekDay = cultureInfo._getAbbrDayIndex(matchGroup);
  2503. if ((weekDay < 0) || (weekDay > 6)) return null;
  2504. break;
  2505. case 'zzz':
  2506. var offsets = matchGroup.split(/:/);
  2507. if (offsets.length !== 2) return null;
  2508. hourOffset = parseInt(offsets[0], 10);
  2509. if ((hourOffset < -12) || (hourOffset > 13)) return null;
  2510. var minOffset = parseInt(offsets[1], 10);
  2511. if ((minOffset < 0) || (minOffset > 59)) return null;
  2512. tzMinOffset = (hourOffset * 60) + (matchGroup.startsWith('-')? -minOffset : minOffset);
  2513. break;
  2514. case 'z': case 'zz':
  2515. hourOffset = parseInt(matchGroup, 10);
  2516. if ((hourOffset < -12) || (hourOffset > 13)) return null;
  2517. tzMinOffset = hourOffset * 60;
  2518. break;
  2519. case 'g': case 'gg':
  2520. var eraName = matchGroup;
  2521. if (!eraName || !dtf.eras) return null;
  2522. eraName = eraName.toLowerCase().trim();
  2523. for (var i = 0, l = dtf.eras.length; i < l; i += 4) {
  2524. if (eraName === dtf.eras[i + 1].toLowerCase()) {
  2525. era = i;
  2526. break;
  2527. }
  2528. }
  2529. if (era === null) return null;
  2530. break;
  2531. }
  2532. }
  2533. }
  2534. var result = new Date(), defaults, convert = dtf.Calendar.convert;
  2535. if (convert) {
  2536. defaults = convert.fromGregorian(result);
  2537. }
  2538. if (!convert) {
  2539. defaults = [result.getFullYear(), result.getMonth(), result.getDate()];
  2540. }
  2541. if (year === null) {
  2542. year = defaults[0];
  2543. }
  2544. else if (dtf.eras) {
  2545. year += dtf.eras[(era || 0) + 3];
  2546. }
  2547. if (month === null) {
  2548. month = defaults[1];
  2549. }
  2550. if (date === null) {
  2551. date = defaults[2];
  2552. }
  2553. if (convert) {
  2554. result = convert.toGregorian(year, month, date);
  2555. if (result === null) return null;
  2556. }
  2557. else {
  2558. result.setFullYear(year, month, date);
  2559. if (result.getDate() !== date) return null;
  2560. if ((weekDay !== null) && (result.getDay() !== weekDay)) {
  2561. return null;
  2562. }
  2563. }
  2564. if (pmHour && (hour < 12)) {
  2565. hour += 12;
  2566. }
  2567. result.setHours(hour, min, sec, msec);
  2568. if (tzMinOffset !== null) {
  2569. var adjustedMin = result.getMinutes() - (tzMinOffset + result.getTimezoneOffset());
  2570. result.setHours(result.getHours() + parseInt(adjustedMin/60, 10), adjustedMin%60);
  2571. }
  2572. return result;
  2573. }
  2574. Date.prototype.format = function Date$format(format) {
  2575. /// <summary locid="M:J#Date.format" />
  2576. /// <param name="format" type="String"></param>
  2577. /// <returns type="String"></returns>
  2578. var e = Function._validateParams(arguments, [
  2579. {name: "format", type: String}
  2580. ]);
  2581. if (e) throw e;
  2582. return this._toFormattedString(format, Sys.CultureInfo.InvariantCulture);
  2583. }
  2584. Date.prototype.localeFormat = function Date$localeFormat(format) {
  2585. /// <summary locid="M:J#Date.localeFormat" />
  2586. /// <param name="format" type="String"></param>
  2587. /// <returns type="String"></returns>
  2588. var e = Function._validateParams(arguments, [
  2589. {name: "format", type: String}
  2590. ]);
  2591. if (e) throw e;
  2592. return this._toFormattedString(format, Sys.CultureInfo.CurrentCulture);
  2593. }
  2594. Date.prototype._toFormattedString = function Date$_toFormattedString(format, cultureInfo) {
  2595. var dtf = cultureInfo.dateTimeFormat,
  2596. convert = dtf.Calendar.convert;
  2597. if (!format || !format.length || (format === 'i')) {
  2598. if (cultureInfo && cultureInfo.name.length) {
  2599. if (convert) {
  2600. return this._toFormattedString(dtf.FullDateTimePattern, cultureInfo);
  2601. }
  2602. else {
  2603. var eraDate = new Date(this.getTime());
  2604. var era = Date._getEra(this, dtf.eras);
  2605. eraDate.setFullYear(Date._getEraYear(this, dtf, era));
  2606. return eraDate.toLocaleString();
  2607. }
  2608. }
  2609. else {
  2610. return this.toString();
  2611. }
  2612. }
  2613. var eras = dtf.eras,
  2614. sortable = (format === "s");
  2615. format = Date._expandFormat(dtf, format);
  2616. var ret = new Sys.StringBuilder();
  2617. var hour;
  2618. function addLeadingZero(num) {
  2619. if (num < 10) {
  2620. return '0' + num;
  2621. }
  2622. return num.toString();
  2623. }
  2624. function addLeadingZeros(num) {
  2625. if (num < 10) {
  2626. return '00' + num;
  2627. }
  2628. if (num < 100) {
  2629. return '0' + num;
  2630. }
  2631. return num.toString();
  2632. }
  2633. function padYear(year) {
  2634. if (year < 10) {
  2635. return '000' + year;
  2636. }
  2637. else if (year < 100) {
  2638. return '00' + year;
  2639. }
  2640. else if (year < 1000) {
  2641. return '0' + year;
  2642. }
  2643. return year.toString();
  2644. }
  2645. var foundDay, checkedDay, dayPartRegExp = /([^d]|^)(d|dd)([^d]|$)/g;
  2646. function hasDay() {
  2647. if (foundDay || checkedDay) {
  2648. return foundDay;
  2649. }
  2650. foundDay = dayPartRegExp.test(format);
  2651. checkedDay = true;
  2652. return foundDay;
  2653. }
  2654. var quoteCount = 0,
  2655. tokenRegExp = Date._getTokenRegExp(),
  2656. converted;
  2657. if (!sortable && convert) {
  2658. converted = convert.fromGregorian(this);
  2659. }
  2660. for (;;) {
  2661. var index = tokenRegExp.lastIndex;
  2662. var ar = tokenRegExp.exec(format);
  2663. var preMatch = format.slice(index, ar ? ar.index : format.length);
  2664. quoteCount += Date._appendPreOrPostMatch(preMatch, ret);
  2665. if (!ar) break;
  2666. if ((quoteCount%2) === 1) {
  2667. ret.append(ar[0]);
  2668. continue;
  2669. }
  2670. function getPart(date, part) {
  2671. if (converted) {
  2672. return converted[part];
  2673. }
  2674. switch (part) {
  2675. case 0: return date.getFullYear();
  2676. case 1: return date.getMonth();
  2677. case 2: return date.getDate();
  2678. }
  2679. }
  2680. switch (ar[0]) {
  2681. case "dddd":
  2682. ret.append(dtf.DayNames[this.getDay()]);
  2683. break;
  2684. case "ddd":
  2685. ret.append(dtf.AbbreviatedDayNames[this.getDay()]);
  2686. break;
  2687. case "dd":
  2688. foundDay = true;
  2689. ret.append(addLeadingZero(getPart(this, 2)));
  2690. break;
  2691. case "d":
  2692. foundDay = true;
  2693. ret.append(getPart(this, 2));
  2694. break;
  2695. case "MMMM":
  2696. ret.append((dtf.MonthGenitiveNames && hasDay())
  2697. ? dtf.MonthGenitiveNames[getPart(this, 1)]
  2698. : dtf.MonthNames[getPart(this, 1)]);
  2699. break;
  2700. case "MMM":
  2701. ret.append((dtf.AbbreviatedMonthGenitiveNames && hasDay())
  2702. ? dtf.AbbreviatedMonthGenitiveNames[getPart(this, 1)]
  2703. : dtf.AbbreviatedMonthNames[getPart(this, 1)]);
  2704. break;
  2705. case "MM":
  2706. ret.append(addLeadingZero(getPart(this, 1) + 1));
  2707. break;
  2708. case "M":
  2709. ret.append(getPart(this, 1) + 1);
  2710. break;
  2711. case "yyyy":
  2712. ret.append(padYear(converted ? converted[0] : Date._getEraYear(this, dtf, Date._getEra(this, eras), sortable)));
  2713. break;
  2714. case "yy":
  2715. ret.append(addLeadingZero((converted ? converted[0] : Date._getEraYear(this, dtf, Date._getEra(this, eras), sortable)) % 100));
  2716. break;
  2717. case "y":
  2718. ret.append((converted ? converted[0] : Date._getEraYear(this, dtf, Date._getEra(this, eras), sortable)) % 100);
  2719. break;
  2720. case "hh":
  2721. hour = this.getHours() % 12;
  2722. if (hour === 0) hour = 12;
  2723. ret.append(addLeadingZero(hour));
  2724. break;
  2725. case "h":
  2726. hour = this.getHours() % 12;
  2727. if (hour === 0) hour = 12;
  2728. ret.append(hour);
  2729. break;
  2730. case "HH":
  2731. ret.append(addLeadingZero(this.getHours()));
  2732. break;
  2733. case "H":
  2734. ret.append(this.getHours());
  2735. break;
  2736. case "mm":
  2737. ret.append(addLeadingZero(this.getMinutes()));
  2738. break;
  2739. case "m":
  2740. ret.append(this.getMinutes());
  2741. break;
  2742. case "ss":
  2743. ret.append(addLeadingZero(this.getSeconds()));
  2744. break;
  2745. case "s":
  2746. ret.append(this.getSeconds());
  2747. break;
  2748. case "tt":
  2749. ret.append((this.getHours() < 12) ? dtf.AMDesignator : dtf.PMDesignator);
  2750. break;
  2751. case "t":
  2752. ret.append(((this.getHours() < 12) ? dtf.AMDesignator : dtf.PMDesignator).charAt(0));
  2753. break;
  2754. case "f":
  2755. ret.append(addLeadingZeros(this.getMilliseconds()).charAt(0));
  2756. break;
  2757. case "ff":
  2758. ret.append(addLeadingZeros(this.getMilliseconds()).substr(0, 2));
  2759. break;
  2760. case "fff":
  2761. ret.append(addLeadingZeros(this.getMilliseconds()));
  2762. break;
  2763. case "z":
  2764. hour = this.getTimezoneOffset() / 60;
  2765. ret.append(((hour <= 0) ? '+' : '-') + Math.floor(Math.abs(hour)));
  2766. break;
  2767. case "zz":
  2768. hour = this.getTimezoneOffset() / 60;
  2769. ret.append(((hour <= 0) ? '+' : '-') + addLeadingZero(Math.floor(Math.abs(hour))));
  2770. break;
  2771. case "zzz":
  2772. hour = this.getTimezoneOffset() / 60;
  2773. ret.append(((hour <= 0) ? '+' : '-') + addLeadingZero(Math.floor(Math.abs(hour))) +
  2774. ":" + addLeadingZero(Math.abs(this.getTimezoneOffset() % 60)));
  2775. break;
  2776. case "g":
  2777. case "gg":
  2778. if (dtf.eras) {
  2779. ret.append(dtf.eras[Date._getEra(this, eras) + 1]);
  2780. }
  2781. break;
  2782. case "/":
  2783. ret.append(dtf.DateSeparator);
  2784. break;
  2785. default:
  2786. Sys.Debug.fail("Invalid date format pattern");
  2787. }
  2788. }
  2789. return ret.toString();
  2790. }
  2791. String.localeFormat = function String$localeFormat(format, args) {
  2792. /// <summary locid="M:J#String.localeFormat" />
  2793. /// <param name="format" type="String"></param>
  2794. /// <param name="args" parameterArray="true" mayBeNull="true"></param>
  2795. /// <returns type="String"></returns>
  2796. var e = Function._validateParams(arguments, [
  2797. {name: "format", type: String},
  2798. {name: "args", mayBeNull: true, parameterArray: true}
  2799. ]);
  2800. if (e) throw e;
  2801. return String._toFormattedString(true, arguments);
  2802. }
  2803. Number.parseLocale = function Number$parseLocale(value) {
  2804. /// <summary locid="M:J#Number.parseLocale" />
  2805. /// <param name="value" type="String"></param>
  2806. /// <returns type="Number"></returns>
  2807. var e = Function._validateParams(arguments, [
  2808. {name: "value", type: String}
  2809. ], false);
  2810. if (e) throw e;
  2811. return Number._parse(value, Sys.CultureInfo.CurrentCulture);
  2812. }
  2813. Number.parseInvariant = function Number$parseInvariant(value) {
  2814. /// <summary locid="M:J#Number.parseInvariant" />
  2815. /// <param name="value" type="String"></param>
  2816. /// <returns type="Number"></returns>
  2817. var e = Function._validateParams(arguments, [
  2818. {name: "value", type: String}
  2819. ], false);
  2820. if (e) throw e;
  2821. return Number._parse(value, Sys.CultureInfo.InvariantCulture);
  2822. }
  2823. Number._parse = function Number$_parse(value, cultureInfo) {
  2824. value = value.trim();
  2825. if (value.match(/^[+-]?infinity$/i)) {
  2826. return parseFloat(value);
  2827. }
  2828. if (value.match(/^0x[a-f0-9]+$/i)) {
  2829. return parseInt(value);
  2830. }
  2831. var numFormat = cultureInfo.numberFormat;
  2832. var signInfo = Number._parseNumberNegativePattern(value, numFormat, numFormat.NumberNegativePattern);
  2833. var sign = signInfo[0];
  2834. var num = signInfo[1];
  2835. if ((sign === '') && (numFormat.NumberNegativePattern !== 1)) {
  2836. signInfo = Number._parseNumberNegativePattern(value, numFormat, 1);
  2837. sign = signInfo[0];
  2838. num = signInfo[1];
  2839. }
  2840. if (sign === '') sign = '+';
  2841. var exponent;
  2842. var intAndFraction;
  2843. var exponentPos = num.indexOf('e');
  2844. if (exponentPos < 0) exponentPos = num.indexOf('E');
  2845. if (exponentPos < 0) {
  2846. intAndFraction = num;
  2847. exponent = null;
  2848. }
  2849. else {
  2850. intAndFraction = num.substr(0, exponentPos);
  2851. exponent = num.substr(exponentPos + 1);
  2852. }
  2853. var integer;
  2854. var fraction;
  2855. var decimalPos = intAndFraction.indexOf(numFormat.NumberDecimalSeparator);
  2856. if (decimalPos < 0) {
  2857. integer = intAndFraction;
  2858. fraction = null;
  2859. }
  2860. else {
  2861. integer = intAndFraction.substr(0, decimalPos);
  2862. fraction = intAndFraction.substr(decimalPos + numFormat.NumberDecimalSeparator.length);
  2863. }
  2864. integer = integer.split(numFormat.NumberGroupSeparator).join('');
  2865. var altNumGroupSeparator = numFormat.NumberGroupSeparator.replace(/\u00A0/g, " ");
  2866. if (numFormat.NumberGroupSeparator !== altNumGroupSeparator) {
  2867. integer = integer.split(altNumGroupSeparator).join('');
  2868. }
  2869. var p = sign + integer;
  2870. if (fraction !== null) {
  2871. p += '.' + fraction;
  2872. }
  2873. if (exponent !== null) {
  2874. var expSignInfo = Number._parseNumberNegativePattern(exponent, numFormat, 1);
  2875. if (expSignInfo[0] === '') {
  2876. expSignInfo[0] = '+';
  2877. }
  2878. p += 'e' + expSignInfo[0] + expSignInfo[1];
  2879. }
  2880. if (p.match(/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/)) {
  2881. return parseFloat(p);
  2882. }
  2883. return Number.NaN;
  2884. }
  2885. Number._parseNumberNegativePattern = function Number$_parseNumberNegativePattern(value, numFormat, numberNegativePattern) {
  2886. var neg = numFormat.NegativeSign;
  2887. var pos = numFormat.PositiveSign;
  2888. switch (numberNegativePattern) {
  2889. case 4:
  2890. neg = ' ' + neg;
  2891. pos = ' ' + pos;
  2892. case 3:
  2893. if (value.endsWith(neg)) {
  2894. return ['-', value.substr(0, value.length - neg.length)];
  2895. }
  2896. else if (value.endsWith(pos)) {
  2897. return ['+', value.substr(0, value.length - pos.length)];
  2898. }
  2899. break;
  2900. case 2:
  2901. neg += ' ';
  2902. pos += ' ';
  2903. case 1:
  2904. if (value.startsWith(neg)) {
  2905. return ['-', value.substr(neg.length)];
  2906. }
  2907. else if (value.startsWith(pos)) {
  2908. return ['+', value.substr(pos.length)];
  2909. }
  2910. break;
  2911. case 0:
  2912. if (value.startsWith('(') && value.endsWith(')')) {
  2913. return ['-', value.substr(1, value.length - 2)];
  2914. }
  2915. break;
  2916. default:
  2917. Sys.Debug.fail("");
  2918. }
  2919. return ['', value];
  2920. }
  2921. Number.prototype.format = function Number$format(format) {
  2922. /// <summary locid="M:J#Number.format" />
  2923. /// <param name="format" type="String"></param>
  2924. /// <returns type="String"></returns>
  2925. var e = Function._validateParams(arguments, [
  2926. {name: "format", type: String}
  2927. ]);
  2928. if (e) throw e;
  2929. return this._toFormattedString(format, Sys.CultureInfo.InvariantCulture);
  2930. }
  2931. Number.prototype.localeFormat = function Number$localeFormat(format) {
  2932. /// <summary locid="M:J#Number.localeFormat" />
  2933. /// <param name="format" type="String"></param>
  2934. /// <returns type="String"></returns>
  2935. var e = Function._validateParams(arguments, [
  2936. {name: "format", type: String}
  2937. ]);
  2938. if (e) throw e;
  2939. return this._toFormattedString(format, Sys.CultureInfo.CurrentCulture);
  2940. }
  2941. Number.prototype._toFormattedString = function Number$_toFormattedString(format, cultureInfo) {
  2942. if (!format || (format.length === 0) || (format === 'i')) {
  2943. if (cultureInfo && (cultureInfo.name.length > 0)) {
  2944. return this.toLocaleString();
  2945. }
  2946. else {
  2947. return this.toString();
  2948. }
  2949. }
  2950. var _percentPositivePattern = ["n %", "n%", "%n" ];
  2951. var _percentNegativePattern = ["-n %", "-n%", "-%n"];
  2952. var _numberNegativePattern = ["(n)","-n","- n","n-","n -"];
  2953. var _currencyPositivePattern = ["$n","n$","$ n","n $"];
  2954. var _currencyNegativePattern = ["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)"];
  2955. function zeroPad(str, count, left) {
  2956. for (var l=str.length; l < count; l++) {
  2957. str = (left ? ('0' + str) : (str + '0'));
  2958. }
  2959. return str;
  2960. }
  2961. function expandNumber(number, precision, groupSizes, sep, decimalChar) {
  2962. Sys.Debug.assert(groupSizes.length > 0, "groupSizes must be an array of at least 1");
  2963. var curSize = groupSizes[0];
  2964. var curGroupIndex = 1;
  2965. var factor = Math.pow(10, precision);
  2966. var rounded = (Math.round(number * factor) / factor);
  2967. if (!isFinite(rounded)) {
  2968. rounded = number;
  2969. }
  2970. number = rounded;
  2971. var numberString = number.toString();
  2972. var right = "";
  2973. var exponent;
  2974. var split = numberString.split(/e/i);
  2975. numberString = split[0];
  2976. exponent = (split.length > 1 ? parseInt(split[1]) : 0);
  2977. split = numberString.split('.');
  2978. numberString = split[0];
  2979. right = split.length > 1 ? split[1] : "";
  2980. var l;
  2981. if (exponent > 0) {
  2982. right = zeroPad(right, exponent, false);
  2983. numberString += right.slice(0, exponent);
  2984. right = right.substr(exponent);
  2985. }
  2986. else if (exponent < 0) {
  2987. exponent = -exponent;
  2988. numberString = zeroPad(numberString, exponent+1, true);
  2989. right = numberString.slice(-exponent, numberString.length) + right;
  2990. numberString = numberString.slice(0, -exponent);
  2991. }
  2992. if (precision > 0) {
  2993. if (right.length > precision) {
  2994. right = right.slice(0, precision);
  2995. }
  2996. else {
  2997. right = zeroPad(right, precision, false);
  2998. }
  2999. right = decimalChar + right;
  3000. }
  3001. else {
  3002. right = "";
  3003. }
  3004. var stringIndex = numberString.length-1;
  3005. var ret = "";
  3006. while (stringIndex >= 0) {
  3007. if (curSize === 0 || curSize > stringIndex) {
  3008. if (ret.length > 0)
  3009. return numberString.slice(0, stringIndex + 1) + sep + ret + right;
  3010. else
  3011. return numberString.slice(0, stringIndex + 1) + right;
  3012. }
  3013. if (ret.length > 0)
  3014. ret = numberString.slice(stringIndex - curSize + 1, stringIndex+1) + sep + ret;
  3015. else
  3016. ret = numberString.slice(stringIndex - curSize + 1, stringIndex+1);
  3017. stringIndex -= curSize;
  3018. if (curGroupIndex < groupSizes.length) {
  3019. curSize = groupSizes[curGroupIndex];
  3020. curGroupIndex++;
  3021. }
  3022. }
  3023. return numberString.slice(0, stringIndex + 1) + sep + ret + right;
  3024. }
  3025. var nf = cultureInfo.numberFormat;
  3026. var number = Math.abs(this);
  3027. if (!format)
  3028. format = "D";
  3029. var precision = -1;
  3030. if (format.length > 1) precision = parseInt(format.slice(1), 10);
  3031. var pattern;
  3032. switch (format.charAt(0)) {
  3033. case "d":
  3034. case "D":
  3035. pattern = 'n';
  3036. if (precision !== -1) {
  3037. number = zeroPad(""+number, precision, true);
  3038. }
  3039. if (this < 0) number = -number;
  3040. break;
  3041. case "c":
  3042. case "C":
  3043. if (this < 0) pattern = _currencyNegativePattern[nf.CurrencyNegativePattern];
  3044. else pattern = _currencyPositivePattern[nf.CurrencyPositivePattern];
  3045. if (precision === -1) precision = nf.CurrencyDecimalDigits;
  3046. number = expandNumber(Math.abs(this), precision, nf.CurrencyGroupSizes, nf.CurrencyGroupSeparator, nf.CurrencyDecimalSeparator);
  3047. break;
  3048. case "n":
  3049. case "N":
  3050. if (this < 0) pattern = _numberNegativePattern[nf.NumberNegativePattern];
  3051. else pattern = 'n';
  3052. if (precision === -1) precision = nf.NumberDecimalDigits;
  3053. number = expandNumber(Math.abs(this), precision, nf.NumberGroupSizes, nf.NumberGroupSeparator, nf.NumberDecimalSeparator);
  3054. break;
  3055. case "p":
  3056. case "P":
  3057. if (this < 0) pattern = _percentNegativePattern[nf.PercentNegativePattern];
  3058. else pattern = _percentPositivePattern[nf.PercentPositivePattern];
  3059. if (precision === -1) precision = nf.PercentDecimalDigits;
  3060. number = expandNumber(Math.abs(this) * 100, precision, nf.PercentGroupSizes, nf.PercentGroupSeparator, nf.PercentDecimalSeparator);
  3061. break;
  3062. default:
  3063. throw Error.format(Sys.Res.formatBadFormatSpecifier);
  3064. }
  3065. var regex = /n|\$|-|%/g;
  3066. var ret = "";
  3067. for (;;) {
  3068. var index = regex.lastIndex;
  3069. var ar = regex.exec(pattern);
  3070. ret += pattern.slice(index, ar ? ar.index : pattern.length);
  3071. if (!ar)
  3072. break;
  3073. switch (ar[0]) {
  3074. case "n":
  3075. ret += number;
  3076. break;
  3077. case "$":
  3078. ret += nf.CurrencySymbol;
  3079. break;
  3080. case "-":
  3081. if (/[1-9]/.test(number)) {
  3082. ret += nf.NegativeSign;
  3083. }
  3084. break;
  3085. case "%":
  3086. ret += nf.PercentSymbol;
  3087. break;
  3088. default:
  3089. Sys.Debug.fail("Invalid number format pattern");
  3090. }
  3091. }
  3092. return ret;
  3093. }
  3094. Sys.CultureInfo = function Sys$CultureInfo(name, numberFormat, dateTimeFormat) {
  3095. /// <summary locid="M:J#Sys.CultureInfo.#ctor" />
  3096. /// <param name="name" type="String"></param>
  3097. /// <param name="numberFormat" type="Object"></param>
  3098. /// <param name="dateTimeFormat" type="Object"></param>
  3099. var e = Function._validateParams(arguments, [
  3100. {name: "name", type: String},
  3101. {name: "numberFormat", type: Object},
  3102. {name: "dateTimeFormat", type: Object}
  3103. ]);
  3104. if (e) throw e;
  3105. this.name = name;
  3106. this.numberFormat = numberFormat;
  3107. this.dateTimeFormat = dateTimeFormat;
  3108. }
  3109. function Sys$CultureInfo$_getDateTimeFormats() {
  3110. if (! this._dateTimeFormats) {
  3111. var dtf = this.dateTimeFormat;
  3112. this._dateTimeFormats =
  3113. [ dtf.MonthDayPattern,
  3114. dtf.YearMonthPattern,
  3115. dtf.ShortDatePattern,
  3116. dtf.ShortTimePattern,
  3117. dtf.LongDatePattern,
  3118. dtf.LongTimePattern,
  3119. dtf.FullDateTimePattern,
  3120. dtf.RFC1123Pattern,
  3121. dtf.SortableDateTimePattern,
  3122. dtf.UniversalSortableDateTimePattern ];
  3123. }
  3124. return this._dateTimeFormats;
  3125. }
  3126. function Sys$CultureInfo$_getIndex(value, a1, a2) {
  3127. var upper = this._toUpper(value),
  3128. i = Array.indexOf(a1, upper);
  3129. if (i === -1) {
  3130. i = Array.indexOf(a2, upper);
  3131. }
  3132. return i;
  3133. }
  3134. function Sys$CultureInfo$_getMonthIndex(value) {
  3135. if (!this._upperMonths) {
  3136. this._upperMonths = this._toUpperArray(this.dateTimeFormat.MonthNames);
  3137. this._upperMonthsGenitive = this._toUpperArray(this.dateTimeFormat.MonthGenitiveNames);
  3138. }
  3139. return this._getIndex(value, this._upperMonths, this._upperMonthsGenitive);
  3140. }
  3141. function Sys$CultureInfo$_getAbbrMonthIndex(value) {
  3142. if (!this._upperAbbrMonths) {
  3143. this._upperAbbrMonths = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames);
  3144. this._upperAbbrMonthsGenitive = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthGenitiveNames);
  3145. }
  3146. return this._getIndex(value, this._upperAbbrMonths, this._upperAbbrMonthsGenitive);
  3147. }
  3148. function Sys$CultureInfo$_getDayIndex(value) {
  3149. if (!this._upperDays) {
  3150. this._upperDays = this._toUpperArray(this.dateTimeFormat.DayNames);
  3151. }
  3152. return Array.indexOf(this._upperDays, this._toUpper(value));
  3153. }
  3154. function Sys$CultureInfo$_getAbbrDayIndex(value) {
  3155. if (!this._upperAbbrDays) {
  3156. this._upperAbbrDays = this._toUpperArray(this.dateTimeFormat.AbbreviatedDayNames);
  3157. }
  3158. return Array.indexOf(this._upperAbbrDays, this._toUpper(value));
  3159. }
  3160. function Sys$CultureInfo$_toUpperArray(arr) {
  3161. var result = [];
  3162. for (var i = 0, il = arr.length; i < il; i++) {
  3163. result[i] = this._toUpper(arr[i]);
  3164. }
  3165. return result;
  3166. }
  3167. function Sys$CultureInfo$_toUpper(value) {
  3168. return value.split("\u00A0").join(' ').toUpperCase();
  3169. }
  3170. Sys.CultureInfo.prototype = {
  3171. _getDateTimeFormats: Sys$CultureInfo$_getDateTimeFormats,
  3172. _getIndex: Sys$CultureInfo$_getIndex,
  3173. _getMonthIndex: Sys$CultureInfo$_getMonthIndex,
  3174. _getAbbrMonthIndex: Sys$CultureInfo$_getAbbrMonthIndex,
  3175. _getDayIndex: Sys$CultureInfo$_getDayIndex,
  3176. _getAbbrDayIndex: Sys$CultureInfo$_getAbbrDayIndex,
  3177. _toUpperArray: Sys$CultureInfo$_toUpperArray,
  3178. _toUpper: Sys$CultureInfo$_toUpper
  3179. }
  3180. Sys.CultureInfo.registerClass('Sys.CultureInfo');
  3181. Sys.CultureInfo._parse = function Sys$CultureInfo$_parse(value) {
  3182. var dtf = value.dateTimeFormat;
  3183. if (dtf && !dtf.eras) {
  3184. dtf.eras = value.eras;
  3185. }
  3186. return new Sys.CultureInfo(value.name, value.numberFormat, dtf);
  3187. }
  3188. Sys.CultureInfo.InvariantCulture = Sys.CultureInfo._parse({"name":"","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","IsReadOnly":true,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":",","CurrencySymbol":"\u00A4","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Infinity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","PercentGroupSeparator":",","PercentSymbol":"%","PerMilleSymbol":"\u2030","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"AM","Calendar":{"MinSupportedDateTime":"@-62135568000000@","MaxSupportedDateTime":"@253402300799999@","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":true},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRule":0,"FullDateTimePattern":"dddd, dd MMMM yyyy HH:mm:ss","LongDatePattern":"dddd, dd MMMM yyyy","LongTimePattern":"HH:mm:ss","MonthDayPattern":"MMMM dd","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH\':\'mm\':\'ss \'GMT\'","ShortDatePattern":"MM/dd/yyyy","ShortTimePattern":"HH:mm","SortableDateTimePattern":"yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy\'-\'MM\'-\'dd HH\':\'mm\':\'ss\'Z\'","YearMonthPattern":"yyyy MMMM","AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"ShortestDayNames":["Su","Mo","Tu","We","Th","Fr","Sa"],"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"IsReadOnly":true,"NativeCalendarName":"Gregorian Calendar","AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""]},"eras":[1,"A.D.",null,0]});
  3189. if (typeof(__cultureInfo) === "object") {
  3190. Sys.CultureInfo.CurrentCulture = Sys.CultureInfo._parse(__cultureInfo);
  3191. delete __cultureInfo;
  3192. }
  3193. else {
  3194. Sys.CultureInfo.CurrentCulture = Sys.CultureInfo._parse({"name":"en-US","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","IsReadOnly":false,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":",","CurrencySymbol":"$","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Infinity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","PercentGroupSeparator":",","PercentSymbol":"%","PerMilleSymbol":"\u2030","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"AM","Calendar":{"MinSupportedDateTime":"@-62135568000000@","MaxSupportedDateTime":"@253402300799999@","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":false},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRule":0,"FullDateTimePattern":"dddd, MMMM dd, yyyy h:mm:ss tt","LongDatePattern":"dddd, MMMM dd, yyyy","LongTimePattern":"h:mm:ss tt","MonthDayPattern":"MMMM dd","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH\':\'mm\':\'ss \'GMT\'","ShortDatePattern":"M/d/yyyy","ShortTimePattern":"h:mm tt","SortableDateTimePattern":"yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy\'-\'MM\'-\'dd HH\':\'mm\':\'ss\'Z\'","YearMonthPattern":"MMMM, yyyy","AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"ShortestDayNames":["Su","Mo","Tu","We","Th","Fr","Sa"],"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"IsReadOnly":false,"NativeCalendarName":"Gregorian Calendar","AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""]},"eras":[1,"A.D.",null,0]});
  3195. }
  3196. Type.registerNamespace('Sys.Serialization');
  3197. Sys.Serialization.JavaScriptSerializer = function Sys$Serialization$JavaScriptSerializer() {
  3198. /// <summary locid="M:J#Sys.Serialization.JavaScriptSerializer.#ctor" />
  3199. if (arguments.length !== 0) throw Error.parameterCount();
  3200. }
  3201. Sys.Serialization.JavaScriptSerializer.registerClass('Sys.Serialization.JavaScriptSerializer');
  3202. Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs = [];
  3203. Sys.Serialization.JavaScriptSerializer._charsToEscape = [];
  3204. Sys.Serialization.JavaScriptSerializer._dateRegEx = new RegExp('(^|[^\\\\])\\"\\\\/Date\\((-?[0-9]+)(?:[a-zA-Z]|(?:\\+|-)[0-9]{4})?\\)\\\\/\\"', 'g');
  3205. Sys.Serialization.JavaScriptSerializer._escapeChars = {};
  3206. Sys.Serialization.JavaScriptSerializer._escapeRegEx = new RegExp('["\\\\\\x00-\\x1F]', 'i');
  3207. Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal = new RegExp('["\\\\\\x00-\\x1F]', 'g');
  3208. Sys.Serialization.JavaScriptSerializer._jsonRegEx = new RegExp('[^,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]', 'g');
  3209. Sys.Serialization.JavaScriptSerializer._jsonStringRegEx = new RegExp('"(\\\\.|[^"\\\\])*"', 'g');
  3210. Sys.Serialization.JavaScriptSerializer._serverTypeFieldName = '__type';
  3211. Sys.Serialization.JavaScriptSerializer._init = function Sys$Serialization$JavaScriptSerializer$_init() {
  3212. var replaceChars = ['\\u0000','\\u0001','\\u0002','\\u0003','\\u0004','\\u0005','\\u0006','\\u0007',
  3213. '\\b','\\t','\\n','\\u000b','\\f','\\r','\\u000e','\\u000f','\\u0010','\\u0011',
  3214. '\\u0012','\\u0013','\\u0014','\\u0015','\\u0016','\\u0017','\\u0018','\\u0019',
  3215. '\\u001a','\\u001b','\\u001c','\\u001d','\\u001e','\\u001f'];
  3216. Sys.Serialization.JavaScriptSerializer._charsToEscape[0] = '\\';
  3217. Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs['\\'] = new RegExp('\\\\', 'g');
  3218. Sys.Serialization.JavaScriptSerializer._escapeChars['\\'] = '\\\\';
  3219. Sys.Serialization.JavaScriptSerializer._charsToEscape[1] = '"';
  3220. Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs['"'] = new RegExp('"', 'g');
  3221. Sys.Serialization.JavaScriptSerializer._escapeChars['"'] = '\\"';
  3222. for (var i = 0; i < 32; i++) {
  3223. var c = String.fromCharCode(i);
  3224. Sys.Serialization.JavaScriptSerializer._charsToEscape[i+2] = c;
  3225. Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[c] = new RegExp(c, 'g');
  3226. Sys.Serialization.JavaScriptSerializer._escapeChars[c] = replaceChars[i];
  3227. }
  3228. }
  3229. Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeBooleanWithBuilder(object, stringBuilder) {
  3230. stringBuilder.append(object.toString());
  3231. }
  3232. Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeNumberWithBuilder(object, stringBuilder) {
  3233. if (isFinite(object)) {
  3234. stringBuilder.append(String(object));
  3235. }
  3236. else {
  3237. throw Error.invalidOperation(Sys.Res.cannotSerializeNonFiniteNumbers);
  3238. }
  3239. }
  3240. Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeStringWithBuilder(string, stringBuilder) {
  3241. stringBuilder.append('"');
  3242. if (Sys.Serialization.JavaScriptSerializer._escapeRegEx.test(string)) {
  3243. if (Sys.Serialization.JavaScriptSerializer._charsToEscape.length === 0) {
  3244. Sys.Serialization.JavaScriptSerializer._init();
  3245. }
  3246. if (string.length < 128) {
  3247. string = string.replace(Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal,
  3248. function(x) { return Sys.Serialization.JavaScriptSerializer._escapeChars[x]; });
  3249. }
  3250. else {
  3251. for (var i = 0; i < 34; i++) {
  3252. var c = Sys.Serialization.JavaScriptSerializer._charsToEscape[i];
  3253. if (string.indexOf(c) !== -1) {
  3254. if (Sys.Browser.agent === Sys.Browser.Opera || Sys.Browser.agent === Sys.Browser.FireFox) {
  3255. string = string.split(c).join(Sys.Serialization.JavaScriptSerializer._escapeChars[c]);
  3256. }
  3257. else {
  3258. string = string.replace(Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[c],
  3259. Sys.Serialization.JavaScriptSerializer._escapeChars[c]);
  3260. }
  3261. }
  3262. }
  3263. }
  3264. }
  3265. stringBuilder.append(string);
  3266. stringBuilder.append('"');
  3267. }
  3268. Sys.Serialization.JavaScriptSerializer._serializeWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeWithBuilder(object, stringBuilder, sort, prevObjects) {
  3269. var i;
  3270. switch (typeof object) {
  3271. case 'object':
  3272. if (object) {
  3273. if (prevObjects){
  3274. for( var j = 0; j < prevObjects.length; j++) {
  3275. if (prevObjects[j] === object) {
  3276. throw Error.invalidOperation(Sys.Res.cannotSerializeObjectWithCycle);
  3277. }
  3278. }
  3279. }
  3280. else {
  3281. prevObjects = new Array();
  3282. }
  3283. try {
  3284. Array.add(prevObjects, object);
  3285. if (Number.isInstanceOfType(object)){
  3286. Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder(object, stringBuilder);
  3287. }
  3288. else if (Boolean.isInstanceOfType(object)){
  3289. Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder(object, stringBuilder);
  3290. }
  3291. else if (String.isInstanceOfType(object)){
  3292. Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder(object, stringBuilder);
  3293. }
  3294. else if (Array.isInstanceOfType(object)) {
  3295. stringBuilder.append('[');
  3296. for (i = 0; i < object.length; ++i) {
  3297. if (i > 0) {
  3298. stringBuilder.append(',');
  3299. }
  3300. Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(object[i], stringBuilder,false,prevObjects);
  3301. }
  3302. stringBuilder.append(']');
  3303. }
  3304. else {
  3305. if (Date.isInstanceOfType(object)) {
  3306. stringBuilder.append('"\\/Date(');
  3307. stringBuilder.append(object.getTime());
  3308. stringBuilder.append(')\\/"');
  3309. break;
  3310. }
  3311. var properties = [];
  3312. var propertyCount = 0;
  3313. for (var name in object) {
  3314. if (name.startsWith('$')) {
  3315. continue;
  3316. }
  3317. if (name === Sys.Serialization.JavaScriptSerializer._serverTypeFieldName && propertyCount !== 0){
  3318. properties[propertyCount++] = properties[0];
  3319. properties[0] = name;
  3320. }
  3321. else{
  3322. properties[propertyCount++] = name;
  3323. }
  3324. }
  3325. if (sort) properties.sort();
  3326. stringBuilder.append('{');
  3327. var needComma = false;
  3328. for (i=0; i<propertyCount; i++) {
  3329. var value = object[properties[i]];
  3330. if (typeof value !== 'undefined' && typeof value !== 'function') {
  3331. if (needComma) {
  3332. stringBuilder.append(',');
  3333. }
  3334. else {
  3335. needComma = true;
  3336. }
  3337. Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(properties[i], stringBuilder, sort, prevObjects);
  3338. stringBuilder.append(':');
  3339. Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(value, stringBuilder, sort, prevObjects);
  3340. }
  3341. }
  3342. stringBuilder.append('}');
  3343. }
  3344. }
  3345. finally {
  3346. Array.removeAt(prevObjects, prevObjects.length - 1);
  3347. }
  3348. }
  3349. else {
  3350. stringBuilder.append('null');
  3351. }
  3352. break;
  3353. case 'number':
  3354. Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder(object, stringBuilder);
  3355. break;
  3356. case 'string':
  3357. Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder(object, stringBuilder);
  3358. break;
  3359. case 'boolean':
  3360. Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder(object, stringBuilder);
  3361. break;
  3362. default:
  3363. stringBuilder.append('null');
  3364. break;
  3365. }
  3366. }
  3367. Sys.Serialization.JavaScriptSerializer.serialize = function Sys$Serialization$JavaScriptSerializer$serialize(object) {
  3368. /// <summary locid="M:J#Sys.Serialization.JavaScriptSerializer.serialize" />
  3369. /// <param name="object" mayBeNull="true"></param>
  3370. /// <returns type="String"></returns>
  3371. var e = Function._validateParams(arguments, [
  3372. {name: "object", mayBeNull: true}
  3373. ]);
  3374. if (e) throw e;
  3375. var stringBuilder = new Sys.StringBuilder();
  3376. Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(object, stringBuilder, false);
  3377. return stringBuilder.toString();
  3378. }
  3379. Sys.Serialization.JavaScriptSerializer.deserialize = function Sys$Serialization$JavaScriptSerializer$deserialize(data, secure) {
  3380. /// <summary locid="M:J#Sys.Serialization.JavaScriptSerializer.deserialize" />
  3381. /// <param name="data" type="String"></param>
  3382. /// <param name="secure" type="Boolean" optional="true"></param>
  3383. /// <returns></returns>
  3384. var e = Function._validateParams(arguments, [
  3385. {name: "data", type: String},
  3386. {name: "secure", type: Boolean, optional: true}
  3387. ]);
  3388. if (e) throw e;
  3389. if (data.length === 0) throw Error.argument('data', Sys.Res.cannotDeserializeEmptyString);
  3390. try {
  3391. var exp = data.replace(Sys.Serialization.JavaScriptSerializer._dateRegEx, "$1new Date($2)");
  3392. if (secure && Sys.Serialization.JavaScriptSerializer._jsonRegEx.test(
  3393. exp.replace(Sys.Serialization.JavaScriptSerializer._jsonStringRegEx, ''))) throw null;
  3394. return eval('(' + exp + ')');
  3395. }
  3396. catch (e) {
  3397. throw Error.argument('data', Sys.Res.cannotDeserializeInvalidJson);
  3398. }
  3399. }
  3400. Type.registerNamespace('Sys.UI');
  3401. Sys.EventHandlerList = function Sys$EventHandlerList() {
  3402. /// <summary locid="M:J#Sys.EventHandlerList.#ctor" />
  3403. if (arguments.length !== 0) throw Error.parameterCount();
  3404. this._list = {};
  3405. }
  3406. function Sys$EventHandlerList$_addHandler(id, handler) {
  3407. Array.add(this._getEvent(id, true), handler);
  3408. }
  3409. function Sys$EventHandlerList$addHandler(id, handler) {
  3410. /// <summary locid="M:J#Sys.EventHandlerList.addHandler" />
  3411. /// <param name="id" type="String"></param>
  3412. /// <param name="handler" type="Function"></param>
  3413. var e = Function._validateParams(arguments, [
  3414. {name: "id", type: String},
  3415. {name: "handler", type: Function}
  3416. ]);
  3417. if (e) throw e;
  3418. this._addHandler(id, handler);
  3419. }
  3420. function Sys$EventHandlerList$_removeHandler(id, handler) {
  3421. var evt = this._getEvent(id);
  3422. if (!evt) return;
  3423. Array.remove(evt, handler);
  3424. }
  3425. function Sys$EventHandlerList$removeHandler(id, handler) {
  3426. /// <summary locid="M:J#Sys.EventHandlerList.removeHandler" />
  3427. /// <param name="id" type="String"></param>
  3428. /// <param name="handler" type="Function"></param>
  3429. var e = Function._validateParams(arguments, [
  3430. {name: "id", type: String},
  3431. {name: "handler", type: Function}
  3432. ]);
  3433. if (e) throw e;
  3434. this._removeHandler(id, handler);
  3435. }
  3436. function Sys$EventHandlerList$getHandler(id) {
  3437. /// <summary locid="M:J#Sys.EventHandlerList.getHandler" />
  3438. /// <param name="id" type="String"></param>
  3439. /// <returns type="Function"></returns>
  3440. var e = Function._validateParams(arguments, [
  3441. {name: "id", type: String}
  3442. ]);
  3443. if (e) throw e;
  3444. var evt = this._getEvent(id);
  3445. if (!evt || (evt.length === 0)) return null;
  3446. evt = Array.clone(evt);
  3447. return function(source, args) {
  3448. for (var i = 0, l = evt.length; i < l; i++) {
  3449. evt[i](source, args);
  3450. }
  3451. };
  3452. }
  3453. function Sys$EventHandlerList$_getEvent(id, create) {
  3454. if (!this._list[id]) {
  3455. if (!create) return null;
  3456. this._list[id] = [];
  3457. }
  3458. return this._list[id];
  3459. }
  3460. Sys.EventHandlerList.prototype = {
  3461. _addHandler: Sys$EventHandlerList$_addHandler,
  3462. addHandler: Sys$EventHandlerList$addHandler,
  3463. _removeHandler: Sys$EventHandlerList$_removeHandler,
  3464. removeHandler: Sys$EventHandlerList$removeHandler,
  3465. getHandler: Sys$EventHandlerList$getHandler,
  3466. _getEvent: Sys$EventHandlerList$_getEvent
  3467. }
  3468. Sys.EventHandlerList.registerClass('Sys.EventHandlerList');
  3469. Sys.CommandEventArgs = function Sys$CommandEventArgs(commandName, commandArgument, commandSource) {
  3470. /// <summary locid="M:J#Sys.CommandEventArgs.#ctor" />
  3471. /// <param name="commandName" type="String"></param>
  3472. /// <param name="commandArgument" mayBeNull="true"></param>
  3473. /// <param name="commandSource" mayBeNull="true"></param>
  3474. var e = Function._validateParams(arguments, [
  3475. {name: "commandName", type: String},
  3476. {name: "commandArgument", mayBeNull: true},
  3477. {name: "commandSource", mayBeNull: true}
  3478. ]);
  3479. if (e) throw e;
  3480. Sys.CommandEventArgs.initializeBase(this);
  3481. this._commandName = commandName;
  3482. this._commandArgument = commandArgument;
  3483. this._commandSource = commandSource;
  3484. }
  3485. function Sys$CommandEventArgs$get_commandName() {
  3486. /// <value type="String" locid="P:J#Sys.CommandEventArgs.commandName"></value>
  3487. if (arguments.length !== 0) throw Error.parameterCount();
  3488. return this._commandName;
  3489. }
  3490. function Sys$CommandEventArgs$get_commandArgument() {
  3491. /// <value mayBeNull="true" locid="P:J#Sys.CommandEventArgs.commandArgument"></value>
  3492. if (arguments.length !== 0) throw Error.parameterCount();
  3493. return this._commandArgument;
  3494. }
  3495. function Sys$CommandEventArgs$get_commandSource() {
  3496. /// <value mayBeNull="true" locid="P:J#Sys.CommandEventArgs.commandSource"></value>
  3497. if (arguments.length !== 0) throw Error.parameterCount();
  3498. return this._commandSource;
  3499. }
  3500. Sys.CommandEventArgs.prototype = {
  3501. _commandName: null,
  3502. _commandArgument: null,
  3503. _commandSource: null,
  3504. get_commandName: Sys$CommandEventArgs$get_commandName,
  3505. get_commandArgument: Sys$CommandEventArgs$get_commandArgument,
  3506. get_commandSource: Sys$CommandEventArgs$get_commandSource
  3507. }
  3508. Sys.CommandEventArgs.registerClass("Sys.CommandEventArgs", Sys.CancelEventArgs);
  3509. Sys.INotifyPropertyChange = function Sys$INotifyPropertyChange() {
  3510. /// <summary locid="M:J#Sys.INotifyPropertyChange.#ctor" />
  3511. if (arguments.length !== 0) throw Error.parameterCount();
  3512. throw Error.notImplemented();
  3513. }
  3514. function Sys$INotifyPropertyChange$add_propertyChanged(handler) {
  3515. /// <summary locid="E:J#Sys.INotifyPropertyChange.propertyChanged" />
  3516. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  3517. if (e) throw e;
  3518. throw Error.notImplemented();
  3519. }
  3520. function Sys$INotifyPropertyChange$remove_propertyChanged(handler) {
  3521. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  3522. if (e) throw e;
  3523. throw Error.notImplemented();
  3524. }
  3525. Sys.INotifyPropertyChange.prototype = {
  3526. add_propertyChanged: Sys$INotifyPropertyChange$add_propertyChanged,
  3527. remove_propertyChanged: Sys$INotifyPropertyChange$remove_propertyChanged
  3528. }
  3529. Sys.INotifyPropertyChange.registerInterface('Sys.INotifyPropertyChange');
  3530. Sys.PropertyChangedEventArgs = function Sys$PropertyChangedEventArgs(propertyName) {
  3531. /// <summary locid="M:J#Sys.PropertyChangedEventArgs.#ctor" />
  3532. /// <param name="propertyName" type="String"></param>
  3533. var e = Function._validateParams(arguments, [
  3534. {name: "propertyName", type: String}
  3535. ]);
  3536. if (e) throw e;
  3537. Sys.PropertyChangedEventArgs.initializeBase(this);
  3538. this._propertyName = propertyName;
  3539. }
  3540. function Sys$PropertyChangedEventArgs$get_propertyName() {
  3541. /// <value type="String" locid="P:J#Sys.PropertyChangedEventArgs.propertyName"></value>
  3542. if (arguments.length !== 0) throw Error.parameterCount();
  3543. return this._propertyName;
  3544. }
  3545. Sys.PropertyChangedEventArgs.prototype = {
  3546. get_propertyName: Sys$PropertyChangedEventArgs$get_propertyName
  3547. }
  3548. Sys.PropertyChangedEventArgs.registerClass('Sys.PropertyChangedEventArgs', Sys.EventArgs);
  3549. Sys.INotifyDisposing = function Sys$INotifyDisposing() {
  3550. /// <summary locid="M:J#Sys.INotifyDisposing.#ctor" />
  3551. if (arguments.length !== 0) throw Error.parameterCount();
  3552. throw Error.notImplemented();
  3553. }
  3554. function Sys$INotifyDisposing$add_disposing(handler) {
  3555. /// <summary locid="E:J#Sys.INotifyDisposing.disposing" />
  3556. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  3557. if (e) throw e;
  3558. throw Error.notImplemented();
  3559. }
  3560. function Sys$INotifyDisposing$remove_disposing(handler) {
  3561. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  3562. if (e) throw e;
  3563. throw Error.notImplemented();
  3564. }
  3565. Sys.INotifyDisposing.prototype = {
  3566. add_disposing: Sys$INotifyDisposing$add_disposing,
  3567. remove_disposing: Sys$INotifyDisposing$remove_disposing
  3568. }
  3569. Sys.INotifyDisposing.registerInterface("Sys.INotifyDisposing");
  3570. Sys.Component = function Sys$Component() {
  3571. /// <summary locid="M:J#Sys.Component.#ctor" />
  3572. if (arguments.length !== 0) throw Error.parameterCount();
  3573. if (Sys.Application) Sys.Application.registerDisposableObject(this);
  3574. }
  3575. function Sys$Component$get_events() {
  3576. /// <value type="Sys.EventHandlerList" locid="P:J#Sys.Component.events"></value>
  3577. if (arguments.length !== 0) throw Error.parameterCount();
  3578. if (!this._events) {
  3579. this._events = new Sys.EventHandlerList();
  3580. }
  3581. return this._events;
  3582. }
  3583. function Sys$Component$get_id() {
  3584. /// <value type="String" locid="P:J#Sys.Component.id"></value>
  3585. if (arguments.length !== 0) throw Error.parameterCount();
  3586. return this._id;
  3587. }
  3588. function Sys$Component$set_id(value) {
  3589. var e = Function._validateParams(arguments, [{name: "value", type: String}]);
  3590. if (e) throw e;
  3591. if (this._idSet) throw Error.invalidOperation(Sys.Res.componentCantSetIdTwice);
  3592. this._idSet = true;
  3593. var oldId = this.get_id();
  3594. if (oldId && Sys.Application.findComponent(oldId)) throw Error.invalidOperation(Sys.Res.componentCantSetIdAfterAddedToApp);
  3595. this._id = value;
  3596. }
  3597. function Sys$Component$get_isInitialized() {
  3598. /// <value type="Boolean" locid="P:J#Sys.Component.isInitialized"></value>
  3599. if (arguments.length !== 0) throw Error.parameterCount();
  3600. return this._initialized;
  3601. }
  3602. function Sys$Component$get_isUpdating() {
  3603. /// <value type="Boolean" locid="P:J#Sys.Component.isUpdating"></value>
  3604. if (arguments.length !== 0) throw Error.parameterCount();
  3605. return this._updating;
  3606. }
  3607. function Sys$Component$add_disposing(handler) {
  3608. /// <summary locid="E:J#Sys.Component.disposing" />
  3609. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  3610. if (e) throw e;
  3611. this.get_events().addHandler("disposing", handler);
  3612. }
  3613. function Sys$Component$remove_disposing(handler) {
  3614. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  3615. if (e) throw e;
  3616. this.get_events().removeHandler("disposing", handler);
  3617. }
  3618. function Sys$Component$add_propertyChanged(handler) {
  3619. /// <summary locid="E:J#Sys.Component.propertyChanged" />
  3620. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  3621. if (e) throw e;
  3622. this.get_events().addHandler("propertyChanged", handler);
  3623. }
  3624. function Sys$Component$remove_propertyChanged(handler) {
  3625. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  3626. if (e) throw e;
  3627. this.get_events().removeHandler("propertyChanged", handler);
  3628. }
  3629. function Sys$Component$beginUpdate() {
  3630. this._updating = true;
  3631. }
  3632. function Sys$Component$dispose() {
  3633. if (this._events) {
  3634. var handler = this._events.getHandler("disposing");
  3635. if (handler) {
  3636. handler(this, Sys.EventArgs.Empty);
  3637. }
  3638. }
  3639. delete this._events;
  3640. Sys.Application.unregisterDisposableObject(this);
  3641. Sys.Application.removeComponent(this);
  3642. }
  3643. function Sys$Component$endUpdate() {
  3644. this._updating = false;
  3645. if (!this._initialized) this.initialize();
  3646. this.updated();
  3647. }
  3648. function Sys$Component$initialize() {
  3649. this._initialized = true;
  3650. }
  3651. function Sys$Component$raisePropertyChanged(propertyName) {
  3652. /// <summary locid="M:J#Sys.Component.raisePropertyChanged" />
  3653. /// <param name="propertyName" type="String"></param>
  3654. var e = Function._validateParams(arguments, [
  3655. {name: "propertyName", type: String}
  3656. ]);
  3657. if (e) throw e;
  3658. if (!this._events) return;
  3659. var handler = this._events.getHandler("propertyChanged");
  3660. if (handler) {
  3661. handler(this, new Sys.PropertyChangedEventArgs(propertyName));
  3662. }
  3663. }
  3664. function Sys$Component$updated() {
  3665. }
  3666. Sys.Component.prototype = {
  3667. _id: null,
  3668. _idSet: false,
  3669. _initialized: false,
  3670. _updating: false,
  3671. get_events: Sys$Component$get_events,
  3672. get_id: Sys$Component$get_id,
  3673. set_id: Sys$Component$set_id,
  3674. get_isInitialized: Sys$Component$get_isInitialized,
  3675. get_isUpdating: Sys$Component$get_isUpdating,
  3676. add_disposing: Sys$Component$add_disposing,
  3677. remove_disposing: Sys$Component$remove_disposing,
  3678. add_propertyChanged: Sys$Component$add_propertyChanged,
  3679. remove_propertyChanged: Sys$Component$remove_propertyChanged,
  3680. beginUpdate: Sys$Component$beginUpdate,
  3681. dispose: Sys$Component$dispose,
  3682. endUpdate: Sys$Component$endUpdate,
  3683. initialize: Sys$Component$initialize,
  3684. raisePropertyChanged: Sys$Component$raisePropertyChanged,
  3685. updated: Sys$Component$updated
  3686. }
  3687. Sys.Component.registerClass('Sys.Component', null, Sys.IDisposable, Sys.INotifyPropertyChange, Sys.INotifyDisposing);
  3688. function Sys$Component$_setProperties(target, properties) {
  3689. /// <summary locid="M:J#Sys.Component._setProperties" />
  3690. /// <param name="target"></param>
  3691. /// <param name="properties"></param>
  3692. var e = Function._validateParams(arguments, [
  3693. {name: "target"},
  3694. {name: "properties"}
  3695. ]);
  3696. if (e) throw e;
  3697. var current;
  3698. var targetType = Object.getType(target);
  3699. var isObject = (targetType === Object) || (targetType === Sys.UI.DomElement);
  3700. var isComponent = Sys.Component.isInstanceOfType(target) && !target.get_isUpdating();
  3701. if (isComponent) target.beginUpdate();
  3702. for (var name in properties) {
  3703. var val = properties[name];
  3704. var getter = isObject ? null : target["get_" + name];
  3705. if (isObject || typeof(getter) !== 'function') {
  3706. var targetVal = target[name];
  3707. if (!isObject && typeof(targetVal) === 'undefined') throw Error.invalidOperation(String.format(Sys.Res.propertyUndefined, name));
  3708. if (!val || (typeof(val) !== 'object') || (isObject && !targetVal)) {
  3709. target[name] = val;
  3710. }
  3711. else {
  3712. Sys$Component$_setProperties(targetVal, val);
  3713. }
  3714. }
  3715. else {
  3716. var setter = target["set_" + name];
  3717. if (typeof(setter) === 'function') {
  3718. setter.apply(target, [val]);
  3719. }
  3720. else if (val instanceof Array) {
  3721. current = getter.apply(target);
  3722. if (!(current instanceof Array)) throw new Error.invalidOperation(String.format(Sys.Res.propertyNotAnArray, name));
  3723. for (var i = 0, j = current.length, l= val.length; i < l; i++, j++) {
  3724. current[j] = val[i];
  3725. }
  3726. }
  3727. else if ((typeof(val) === 'object') && (Object.getType(val) === Object)) {
  3728. current = getter.apply(target);
  3729. if ((typeof(current) === 'undefined') || (current === null)) throw new Error.invalidOperation(String.format(Sys.Res.propertyNullOrUndefined, name));
  3730. Sys$Component$_setProperties(current, val);
  3731. }
  3732. else {
  3733. throw new Error.invalidOperation(String.format(Sys.Res.propertyNotWritable, name));
  3734. }
  3735. }
  3736. }
  3737. if (isComponent) target.endUpdate();
  3738. }
  3739. function Sys$Component$_setReferences(component, references) {
  3740. for (var name in references) {
  3741. var setter = component["set_" + name];
  3742. var reference = $find(references[name]);
  3743. if (typeof(setter) !== 'function') throw new Error.invalidOperation(String.format(Sys.Res.propertyNotWritable, name));
  3744. if (!reference) throw Error.invalidOperation(String.format(Sys.Res.referenceNotFound, references[name]));
  3745. setter.apply(component, [reference]);
  3746. }
  3747. }
  3748. var $create = Sys.Component.create = function Sys$Component$create(type, properties, events, references, element) {
  3749. /// <summary locid="M:J#Sys.Component.create" />
  3750. /// <param name="type" type="Type"></param>
  3751. /// <param name="properties" optional="true" mayBeNull="true"></param>
  3752. /// <param name="events" optional="true" mayBeNull="true"></param>
  3753. /// <param name="references" optional="true" mayBeNull="true"></param>
  3754. /// <param name="element" domElement="true" optional="true" mayBeNull="true"></param>
  3755. /// <returns type="Sys.UI.Component"></returns>
  3756. var e = Function._validateParams(arguments, [
  3757. {name: "type", type: Type},
  3758. {name: "properties", mayBeNull: true, optional: true},
  3759. {name: "events", mayBeNull: true, optional: true},
  3760. {name: "references", mayBeNull: true, optional: true},
  3761. {name: "element", mayBeNull: true, domElement: true, optional: true}
  3762. ]);
  3763. if (e) throw e;
  3764. if (!type.inheritsFrom(Sys.Component)) {
  3765. throw Error.argument('type', String.format(Sys.Res.createNotComponent, type.getName()));
  3766. }
  3767. if (type.inheritsFrom(Sys.UI.Behavior) || type.inheritsFrom(Sys.UI.Control)) {
  3768. if (!element) throw Error.argument('element', Sys.Res.createNoDom);
  3769. }
  3770. else if (element) throw Error.argument('element', Sys.Res.createComponentOnDom);
  3771. var component = (element ? new type(element): new type());
  3772. var app = Sys.Application;
  3773. var creatingComponents = app.get_isCreatingComponents();
  3774. component.beginUpdate();
  3775. if (properties) {
  3776. Sys$Component$_setProperties(component, properties);
  3777. }
  3778. if (events) {
  3779. for (var name in events) {
  3780. if (!(component["add_" + name] instanceof Function)) throw new Error.invalidOperation(String.format(Sys.Res.undefinedEvent, name));
  3781. if (!(events[name] instanceof Function)) throw new Error.invalidOperation(Sys.Res.eventHandlerNotFunction);
  3782. component["add_" + name](events[name]);
  3783. }
  3784. }
  3785. if (component.get_id()) {
  3786. app.addComponent(component);
  3787. }
  3788. if (creatingComponents) {
  3789. app._createdComponents[app._createdComponents.length] = component;
  3790. if (references) {
  3791. app._addComponentToSecondPass(component, references);
  3792. }
  3793. else {
  3794. component.endUpdate();
  3795. }
  3796. }
  3797. else {
  3798. if (references) {
  3799. Sys$Component$_setReferences(component, references);
  3800. }
  3801. component.endUpdate();
  3802. }
  3803. return component;
  3804. }
  3805. Sys.UI.MouseButton = function Sys$UI$MouseButton() {
  3806. /// <summary locid="M:J#Sys.UI.MouseButton.#ctor" />
  3807. /// <field name="leftButton" type="Number" integer="true" static="true" locid="F:J#Sys.UI.MouseButton.leftButton"></field>
  3808. /// <field name="middleButton" type="Number" integer="true" static="true" locid="F:J#Sys.UI.MouseButton.middleButton"></field>
  3809. /// <field name="rightButton" type="Number" integer="true" static="true" locid="F:J#Sys.UI.MouseButton.rightButton"></field>
  3810. if (arguments.length !== 0) throw Error.parameterCount();
  3811. throw Error.notImplemented();
  3812. }
  3813. Sys.UI.MouseButton.prototype = {
  3814. leftButton: 0,
  3815. middleButton: 1,
  3816. rightButton: 2
  3817. }
  3818. Sys.UI.MouseButton.registerEnum("Sys.UI.MouseButton");
  3819. Sys.UI.Key = function Sys$UI$Key() {
  3820. /// <summary locid="M:J#Sys.UI.Key.#ctor" />
  3821. /// <field name="backspace" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.backspace"></field>
  3822. /// <field name="tab" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.tab"></field>
  3823. /// <field name="enter" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.enter"></field>
  3824. /// <field name="esc" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.esc"></field>
  3825. /// <field name="space" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.space"></field>
  3826. /// <field name="pageUp" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.pageUp"></field>
  3827. /// <field name="pageDown" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.pageDown"></field>
  3828. /// <field name="end" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.end"></field>
  3829. /// <field name="home" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.home"></field>
  3830. /// <field name="left" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.left"></field>
  3831. /// <field name="up" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.up"></field>
  3832. /// <field name="right" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.right"></field>
  3833. /// <field name="down" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.down"></field>
  3834. /// <field name="del" type="Number" integer="true" static="true" locid="F:J#Sys.UI.Key.del"></field>
  3835. if (arguments.length !== 0) throw Error.parameterCount();
  3836. throw Error.notImplemented();
  3837. }
  3838. Sys.UI.Key.prototype = {
  3839. backspace: 8,
  3840. tab: 9,
  3841. enter: 13,
  3842. esc: 27,
  3843. space: 32,
  3844. pageUp: 33,
  3845. pageDown: 34,
  3846. end: 35,
  3847. home: 36,
  3848. left: 37,
  3849. up: 38,
  3850. right: 39,
  3851. down: 40,
  3852. del: 127
  3853. }
  3854. Sys.UI.Key.registerEnum("Sys.UI.Key");
  3855. Sys.UI.Point = function Sys$UI$Point(x, y) {
  3856. /// <summary locid="M:J#Sys.UI.Point.#ctor" />
  3857. /// <param name="x" type="Number" integer="true"></param>
  3858. /// <param name="y" type="Number" integer="true"></param>
  3859. /// <field name="x" type="Number" integer="true" locid="F:J#Sys.UI.Point.x"></field>
  3860. /// <field name="y" type="Number" integer="true" locid="F:J#Sys.UI.Point.y"></field>
  3861. var e = Function._validateParams(arguments, [
  3862. {name: "x", type: Number, integer: true},
  3863. {name: "y", type: Number, integer: true}
  3864. ]);
  3865. if (e) throw e;
  3866. this.x = x;
  3867. this.y = y;
  3868. }
  3869. Sys.UI.Point.registerClass('Sys.UI.Point');
  3870. Sys.UI.Bounds = function Sys$UI$Bounds(x, y, width, height) {
  3871. /// <summary locid="M:J#Sys.UI.Bounds.#ctor" />
  3872. /// <param name="x" type="Number" integer="true"></param>
  3873. /// <param name="y" type="Number" integer="true"></param>
  3874. /// <param name="width" type="Number" integer="true"></param>
  3875. /// <param name="height" type="Number" integer="true"></param>
  3876. /// <field name="x" type="Number" integer="true" locid="F:J#Sys.UI.Bounds.x"></field>
  3877. /// <field name="y" type="Number" integer="true" locid="F:J#Sys.UI.Bounds.y"></field>
  3878. /// <field name="width" type="Number" integer="true" locid="F:J#Sys.UI.Bounds.width"></field>
  3879. /// <field name="height" type="Number" integer="true" locid="F:J#Sys.UI.Bounds.height"></field>
  3880. var e = Function._validateParams(arguments, [
  3881. {name: "x", type: Number, integer: true},
  3882. {name: "y", type: Number, integer: true},
  3883. {name: "width", type: Number, integer: true},
  3884. {name: "height", type: Number, integer: true}
  3885. ]);
  3886. if (e) throw e;
  3887. this.x = x;
  3888. this.y = y;
  3889. this.height = height;
  3890. this.width = width;
  3891. }
  3892. Sys.UI.Bounds.registerClass('Sys.UI.Bounds');
  3893. Sys.UI.DomEvent = function Sys$UI$DomEvent(eventObject) {
  3894. /// <summary locid="M:J#Sys.UI.DomEvent.#ctor" />
  3895. /// <param name="eventObject"></param>
  3896. /// <field name="altKey" type="Boolean" locid="F:J#Sys.UI.DomEvent.altKey"></field>
  3897. /// <field name="button" type="Sys.UI.MouseButton" locid="F:J#Sys.UI.DomEvent.button"></field>
  3898. /// <field name="charCode" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.charCode"></field>
  3899. /// <field name="clientX" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.clientX"></field>
  3900. /// <field name="clientY" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.clientY"></field>
  3901. /// <field name="ctrlKey" type="Boolean" locid="F:J#Sys.UI.DomEvent.ctrlKey"></field>
  3902. /// <field name="keyCode" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.keyCode"></field>
  3903. /// <field name="offsetX" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.offsetX"></field>
  3904. /// <field name="offsetY" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.offsetY"></field>
  3905. /// <field name="screenX" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.screenX"></field>
  3906. /// <field name="screenY" type="Number" integer="true" locid="F:J#Sys.UI.DomEvent.screenY"></field>
  3907. /// <field name="shiftKey" type="Boolean" locid="F:J#Sys.UI.DomEvent.shiftKey"></field>
  3908. /// <field name="target" locid="F:J#Sys.UI.DomEvent.target"></field>
  3909. /// <field name="type" type="String" locid="F:J#Sys.UI.DomEvent.type"></field>
  3910. var e = Function._validateParams(arguments, [
  3911. {name: "eventObject"}
  3912. ]);
  3913. if (e) throw e;
  3914. var ev = eventObject;
  3915. var etype = this.type = ev.type.toLowerCase();
  3916. this.rawEvent = ev;
  3917. this.altKey = ev.altKey;
  3918. if (typeof(ev.button) !== 'undefined') {
  3919. this.button = (typeof(ev.which) !== 'undefined') ? ev.button :
  3920. (ev.button === 4) ? Sys.UI.MouseButton.middleButton :
  3921. (ev.button === 2) ? Sys.UI.MouseButton.rightButton :
  3922. Sys.UI.MouseButton.leftButton;
  3923. }
  3924. if (etype === 'keypress') {
  3925. this.charCode = ev.charCode || ev.keyCode;
  3926. }
  3927. else if (ev.keyCode && (ev.keyCode === 46)) {
  3928. this.keyCode = 127;
  3929. }
  3930. else {
  3931. this.keyCode = ev.keyCode;
  3932. }
  3933. this.clientX = ev.clientX;
  3934. this.clientY = ev.clientY;
  3935. this.ctrlKey = ev.ctrlKey;
  3936. this.target = ev.target ? ev.target : ev.srcElement;
  3937. if (!etype.startsWith('key')) {
  3938. if ((typeof(ev.offsetX) !== 'undefined') && (typeof(ev.offsetY) !== 'undefined')) {
  3939. this.offsetX = ev.offsetX;
  3940. this.offsetY = ev.offsetY;
  3941. }
  3942. else if (this.target && (this.target.nodeType !== 3) && (typeof(ev.clientX) === 'number')) {
  3943. var loc = Sys.UI.DomElement.getLocation(this.target);
  3944. var w = Sys.UI.DomElement._getWindow(this.target);
  3945. this.offsetX = (w.pageXOffset || 0) + ev.clientX - loc.x;
  3946. this.offsetY = (w.pageYOffset || 0) + ev.clientY - loc.y;
  3947. }
  3948. }
  3949. this.screenX = ev.screenX;
  3950. this.screenY = ev.screenY;
  3951. this.shiftKey = ev.shiftKey;
  3952. }
  3953. function Sys$UI$DomEvent$preventDefault() {
  3954. /// <summary locid="M:J#Sys.UI.DomEvent.preventDefault" />
  3955. if (arguments.length !== 0) throw Error.parameterCount();
  3956. if (this.rawEvent.preventDefault) {
  3957. this.rawEvent.preventDefault();
  3958. }
  3959. else if (window.event) {
  3960. this.rawEvent.returnValue = false;
  3961. }
  3962. }
  3963. function Sys$UI$DomEvent$stopPropagation() {
  3964. /// <summary locid="M:J#Sys.UI.DomEvent.stopPropagation" />
  3965. if (arguments.length !== 0) throw Error.parameterCount();
  3966. if (this.rawEvent.stopPropagation) {
  3967. this.rawEvent.stopPropagation();
  3968. }
  3969. else if (window.event) {
  3970. this.rawEvent.cancelBubble = true;
  3971. }
  3972. }
  3973. Sys.UI.DomEvent.prototype = {
  3974. preventDefault: Sys$UI$DomEvent$preventDefault,
  3975. stopPropagation: Sys$UI$DomEvent$stopPropagation
  3976. }
  3977. Sys.UI.DomEvent.registerClass('Sys.UI.DomEvent');
  3978. var $addHandler = Sys.UI.DomEvent.addHandler = function Sys$UI$DomEvent$addHandler(element, eventName, handler, autoRemove) {
  3979. /// <summary locid="M:J#Sys.UI.DomEvent.addHandler" />
  3980. /// <param name="element"></param>
  3981. /// <param name="eventName" type="String"></param>
  3982. /// <param name="handler" type="Function"></param>
  3983. /// <param name="autoRemove" type="Boolean" optional="true"></param>
  3984. var e = Function._validateParams(arguments, [
  3985. {name: "element"},
  3986. {name: "eventName", type: String},
  3987. {name: "handler", type: Function},
  3988. {name: "autoRemove", type: Boolean, optional: true}
  3989. ]);
  3990. if (e) throw e;
  3991. Sys.UI.DomEvent._ensureDomNode(element);
  3992. if (eventName === "error") throw Error.invalidOperation(Sys.Res.addHandlerCantBeUsedForError);
  3993. if (!element._events) {
  3994. element._events = {};
  3995. }
  3996. var eventCache = element._events[eventName];
  3997. if (!eventCache) {
  3998. element._events[eventName] = eventCache = [];
  3999. }
  4000. var browserHandler;
  4001. if (element.addEventListener) {
  4002. browserHandler = function(e) {
  4003. return handler.call(element, new Sys.UI.DomEvent(e));
  4004. }
  4005. element.addEventListener(eventName, browserHandler, false);
  4006. }
  4007. else if (element.attachEvent) {
  4008. browserHandler = function() {
  4009. var e = {};
  4010. try {e = Sys.UI.DomElement._getWindow(element).event} catch(ex) {}
  4011. return handler.call(element, new Sys.UI.DomEvent(e));
  4012. }
  4013. element.attachEvent('on' + eventName, browserHandler);
  4014. }
  4015. eventCache[eventCache.length] = {handler: handler, browserHandler: browserHandler, autoRemove: autoRemove };
  4016. if (autoRemove) {
  4017. var d = element.dispose;
  4018. if (d !== Sys.UI.DomEvent._disposeHandlers) {
  4019. element.dispose = Sys.UI.DomEvent._disposeHandlers;
  4020. if (typeof(d) !== "undefined") {
  4021. element._chainDispose = d;
  4022. }
  4023. }
  4024. }
  4025. }
  4026. var $addHandlers = Sys.UI.DomEvent.addHandlers = function Sys$UI$DomEvent$addHandlers(element, events, handlerOwner, autoRemove) {
  4027. /// <summary locid="M:J#Sys.UI.DomEvent.addHandlers" />
  4028. /// <param name="element"></param>
  4029. /// <param name="events" type="Object"></param>
  4030. /// <param name="handlerOwner" optional="true"></param>
  4031. /// <param name="autoRemove" type="Boolean" optional="true"></param>
  4032. var e = Function._validateParams(arguments, [
  4033. {name: "element"},
  4034. {name: "events", type: Object},
  4035. {name: "handlerOwner", optional: true},
  4036. {name: "autoRemove", type: Boolean, optional: true}
  4037. ]);
  4038. if (e) throw e;
  4039. Sys.UI.DomEvent._ensureDomNode(element);
  4040. for (var name in events) {
  4041. var handler = events[name];
  4042. if (typeof(handler) !== 'function') throw Error.invalidOperation(Sys.Res.cantAddNonFunctionhandler);
  4043. if (handlerOwner) {
  4044. handler = Function.createDelegate(handlerOwner, handler);
  4045. }
  4046. $addHandler(element, name, handler, autoRemove || false);
  4047. }
  4048. }
  4049. var $clearHandlers = Sys.UI.DomEvent.clearHandlers = function Sys$UI$DomEvent$clearHandlers(element) {
  4050. /// <summary locid="M:J#Sys.UI.DomEvent.clearHandlers" />
  4051. /// <param name="element"></param>
  4052. var e = Function._validateParams(arguments, [
  4053. {name: "element"}
  4054. ]);
  4055. if (e) throw e;
  4056. Sys.UI.DomEvent._ensureDomNode(element);
  4057. Sys.UI.DomEvent._clearHandlers(element, false);
  4058. }
  4059. Sys.UI.DomEvent._clearHandlers = function Sys$UI$DomEvent$_clearHandlers(element, autoRemoving) {
  4060. if (element._events) {
  4061. var cache = element._events;
  4062. for (var name in cache) {
  4063. var handlers = cache[name];
  4064. for (var i = handlers.length - 1; i >= 0; i--) {
  4065. var entry = handlers[i];
  4066. if (!autoRemoving || entry.autoRemove) {
  4067. $removeHandler(element, name, entry.handler);
  4068. }
  4069. }
  4070. }
  4071. element._events = null;
  4072. }
  4073. }
  4074. Sys.UI.DomEvent._disposeHandlers = function Sys$UI$DomEvent$_disposeHandlers() {
  4075. Sys.UI.DomEvent._clearHandlers(this, true);
  4076. var d = this._chainDispose, type = typeof(d);
  4077. if (type !== "undefined") {
  4078. this.dispose = d;
  4079. this._chainDispose = null;
  4080. if (type === "function") {
  4081. this.dispose();
  4082. }
  4083. }
  4084. }
  4085. var $removeHandler = Sys.UI.DomEvent.removeHandler = function Sys$UI$DomEvent$removeHandler(element, eventName, handler) {
  4086. /// <summary locid="M:J#Sys.UI.DomEvent.removeHandler" />
  4087. /// <param name="element"></param>
  4088. /// <param name="eventName" type="String"></param>
  4089. /// <param name="handler" type="Function"></param>
  4090. var e = Function._validateParams(arguments, [
  4091. {name: "element"},
  4092. {name: "eventName", type: String},
  4093. {name: "handler", type: Function}
  4094. ]);
  4095. if (e) throw e;
  4096. Sys.UI.DomEvent._removeHandler(element, eventName, handler);
  4097. }
  4098. Sys.UI.DomEvent._removeHandler = function Sys$UI$DomEvent$_removeHandler(element, eventName, handler) {
  4099. Sys.UI.DomEvent._ensureDomNode(element);
  4100. var browserHandler = null;
  4101. if ((typeof(element._events) !== 'object') || !element._events) throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);
  4102. var cache = element._events[eventName];
  4103. if (!(cache instanceof Array)) throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);
  4104. for (var i = 0, l = cache.length; i < l; i++) {
  4105. if (cache[i].handler === handler) {
  4106. browserHandler = cache[i].browserHandler;
  4107. break;
  4108. }
  4109. }
  4110. if (typeof(browserHandler) !== 'function') throw Error.invalidOperation(Sys.Res.eventHandlerInvalid);
  4111. if (element.removeEventListener) {
  4112. element.removeEventListener(eventName, browserHandler, false);
  4113. }
  4114. else if (element.detachEvent) {
  4115. element.detachEvent('on' + eventName, browserHandler);
  4116. }
  4117. cache.splice(i, 1);
  4118. }
  4119. Sys.UI.DomEvent._ensureDomNode = function Sys$UI$DomEvent$_ensureDomNode(element) {
  4120. if (element.tagName && (element.tagName.toUpperCase() === "SCRIPT")) return;
  4121. var doc = element.ownerDocument || element.document || element;
  4122. if ((typeof(element.document) !== 'object') && (element != doc) && (typeof(element.nodeType) !== 'number')) {
  4123. throw Error.argument("element", Sys.Res.argumentDomNode);
  4124. }
  4125. }
  4126. Sys.UI.DomElement = function Sys$UI$DomElement() {
  4127. /// <summary locid="M:J#Sys.UI.DomElement.#ctor" />
  4128. if (arguments.length !== 0) throw Error.parameterCount();
  4129. throw Error.notImplemented();
  4130. }
  4131. Sys.UI.DomElement.registerClass('Sys.UI.DomElement');
  4132. Sys.UI.DomElement.addCssClass = function Sys$UI$DomElement$addCssClass(element, className) {
  4133. /// <summary locid="M:J#Sys.UI.DomElement.addCssClass" />
  4134. /// <param name="element" domElement="true"></param>
  4135. /// <param name="className" type="String"></param>
  4136. var e = Function._validateParams(arguments, [
  4137. {name: "element", domElement: true},
  4138. {name: "className", type: String}
  4139. ]);
  4140. if (e) throw e;
  4141. if (!Sys.UI.DomElement.containsCssClass(element, className)) {
  4142. if (element.className === '') {
  4143. element.className = className;
  4144. }
  4145. else {
  4146. element.className += ' ' + className;
  4147. }
  4148. }
  4149. }
  4150. Sys.UI.DomElement.containsCssClass = function Sys$UI$DomElement$containsCssClass(element, className) {
  4151. /// <summary locid="M:J#Sys.UI.DomElement.containsCssClass" />
  4152. /// <param name="element" domElement="true"></param>
  4153. /// <param name="className" type="String"></param>
  4154. /// <returns type="Boolean"></returns>
  4155. var e = Function._validateParams(arguments, [
  4156. {name: "element", domElement: true},
  4157. {name: "className", type: String}
  4158. ]);
  4159. if (e) throw e;
  4160. return Array.contains(element.className.split(' '), className);
  4161. }
  4162. Sys.UI.DomElement.getBounds = function Sys$UI$DomElement$getBounds(element) {
  4163. /// <summary locid="M:J#Sys.UI.DomElement.getBounds" />
  4164. /// <param name="element" domElement="true"></param>
  4165. /// <returns type="Sys.UI.Bounds"></returns>
  4166. var e = Function._validateParams(arguments, [
  4167. {name: "element", domElement: true}
  4168. ]);
  4169. if (e) throw e;
  4170. var offset = Sys.UI.DomElement.getLocation(element);
  4171. return new Sys.UI.Bounds(offset.x, offset.y, element.offsetWidth || 0, element.offsetHeight || 0);
  4172. }
  4173. var $get = Sys.UI.DomElement.getElementById = function Sys$UI$DomElement$getElementById(id, element) {
  4174. /// <summary locid="M:J#Sys.UI.DomElement.getElementById" />
  4175. /// <param name="id" type="String"></param>
  4176. /// <param name="element" domElement="true" optional="true" mayBeNull="true"></param>
  4177. /// <returns domElement="true" mayBeNull="true"></returns>
  4178. var e = Function._validateParams(arguments, [
  4179. {name: "id", type: String},
  4180. {name: "element", mayBeNull: true, domElement: true, optional: true}
  4181. ]);
  4182. if (e) throw e;
  4183. if (!element) return document.getElementById(id);
  4184. if (element.getElementById) return element.getElementById(id);
  4185. var nodeQueue = [];
  4186. var childNodes = element.childNodes;
  4187. for (var i = 0; i < childNodes.length; i++) {
  4188. var node = childNodes[i];
  4189. if (node.nodeType == 1) {
  4190. nodeQueue[nodeQueue.length] = node;
  4191. }
  4192. }
  4193. while (nodeQueue.length) {
  4194. node = nodeQueue.shift();
  4195. if (node.id == id) {
  4196. return node;
  4197. }
  4198. childNodes = node.childNodes;
  4199. for (i = 0; i < childNodes.length; i++) {
  4200. node = childNodes[i];
  4201. if (node.nodeType == 1) {
  4202. nodeQueue[nodeQueue.length] = node;
  4203. }
  4204. }
  4205. }
  4206. return null;
  4207. }
  4208. if (document.documentElement.getBoundingClientRect) {
  4209. Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) {
  4210. /// <summary locid="M:J#Sys.UI.DomElement.getLocation" />
  4211. /// <param name="element" domElement="true"></param>
  4212. /// <returns type="Sys.UI.Point"></returns>
  4213. var e = Function._validateParams(arguments, [
  4214. {name: "element", domElement: true}
  4215. ]);
  4216. if (e) throw e;
  4217. if (element.self || element.nodeType === 9) return new Sys.UI.Point(0,0);
  4218. var clientRect = element.getBoundingClientRect();
  4219. if (!clientRect) {
  4220. return new Sys.UI.Point(0,0);
  4221. }
  4222. var documentElement = element.ownerDocument.documentElement,
  4223. offsetX = Math.floor(clientRect.left + 0.5) + documentElement.scrollLeft,
  4224. offsetY = Math.floor(clientRect.top + 0.5) + documentElement.scrollTop;
  4225. if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
  4226. try {
  4227. var f = element.ownerDocument.parentWindow.frameElement || null;
  4228. if (f) {
  4229. var offset = (f.frameBorder === "0" || f.frameBorder === "no") ? 2 : 0;
  4230. offsetX += offset;
  4231. offsetY += offset;
  4232. }
  4233. }
  4234. catch(ex) {
  4235. }
  4236. if (Sys.Browser.version <= 7) {
  4237. var multiplier, before, rect, d = document.createElement("div");
  4238. d.style.cssText = "position:absolute !important;left:0px !important;right:0px !important;height:0px !important;width:1px !important;display:hidden !important";
  4239. try {
  4240. before = document.body.childNodes[0];
  4241. document.body.insertBefore(d, before);
  4242. rect = d.getBoundingClientRect();
  4243. document.body.removeChild(d);
  4244. multiplier = (rect.right - rect.left);
  4245. }
  4246. catch (e) {
  4247. }
  4248. if (multiplier && (multiplier !== 1)) {
  4249. offsetX = Math.floor(offsetX / multiplier);
  4250. offsetY = Math.floor(offsetY / multiplier);
  4251. }
  4252. }
  4253. if ((document.documentMode || 0) < 8) {
  4254. offsetX -= 2;
  4255. offsetY -= 2;
  4256. }
  4257. }
  4258. return new Sys.UI.Point(offsetX, offsetY);
  4259. }
  4260. }
  4261. else if (Sys.Browser.agent === Sys.Browser.Safari) {
  4262. Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) {
  4263. /// <summary locid="M:J#Sys.UI.DomElement.getLocation" />
  4264. /// <param name="element" domElement="true"></param>
  4265. /// <returns type="Sys.UI.Point"></returns>
  4266. var e = Function._validateParams(arguments, [
  4267. {name: "element", domElement: true}
  4268. ]);
  4269. if (e) throw e;
  4270. if ((element.window && (element.window === element)) || element.nodeType === 9) return new Sys.UI.Point(0,0);
  4271. var offsetX = 0, offsetY = 0,
  4272. parent,
  4273. previous = null,
  4274. previousStyle = null,
  4275. currentStyle;
  4276. for (parent = element; parent; previous = parent, previousStyle = currentStyle, parent = parent.offsetParent) {
  4277. currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
  4278. var tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
  4279. if ((parent.offsetLeft || parent.offsetTop) &&
  4280. ((tagName !== "BODY") || (!previousStyle || previousStyle.position !== "absolute"))) {
  4281. offsetX += parent.offsetLeft;
  4282. offsetY += parent.offsetTop;
  4283. }
  4284. if (previous && Sys.Browser.version >= 3) {
  4285. offsetX += parseInt(currentStyle.borderLeftWidth);
  4286. offsetY += parseInt(currentStyle.borderTopWidth);
  4287. }
  4288. }
  4289. currentStyle = Sys.UI.DomElement._getCurrentStyle(element);
  4290. var elementPosition = currentStyle ? currentStyle.position : null;
  4291. if (!elementPosition || (elementPosition !== "absolute")) {
  4292. for (parent = element.parentNode; parent; parent = parent.parentNode) {
  4293. tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
  4294. if ((tagName !== "BODY") && (tagName !== "HTML") && (parent.scrollLeft || parent.scrollTop)) {
  4295. offsetX -= (parent.scrollLeft || 0);
  4296. offsetY -= (parent.scrollTop || 0);
  4297. }
  4298. currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
  4299. var parentPosition = currentStyle ? currentStyle.position : null;
  4300. if (parentPosition && (parentPosition === "absolute")) break;
  4301. }
  4302. }
  4303. return new Sys.UI.Point(offsetX, offsetY);
  4304. }
  4305. }
  4306. else {
  4307. Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) {
  4308. /// <summary locid="M:J#Sys.UI.DomElement.getLocation" />
  4309. /// <param name="element" domElement="true"></param>
  4310. /// <returns type="Sys.UI.Point"></returns>
  4311. var e = Function._validateParams(arguments, [
  4312. {name: "element", domElement: true}
  4313. ]);
  4314. if (e) throw e;
  4315. if ((element.window && (element.window === element)) || element.nodeType === 9) return new Sys.UI.Point(0,0);
  4316. var offsetX = 0, offsetY = 0,
  4317. parent,
  4318. previous = null,
  4319. previousStyle = null,
  4320. currentStyle = null;
  4321. for (parent = element; parent; previous = parent, previousStyle = currentStyle, parent = parent.offsetParent) {
  4322. var tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
  4323. currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
  4324. if ((parent.offsetLeft || parent.offsetTop) &&
  4325. !((tagName === "BODY") &&
  4326. (!previousStyle || previousStyle.position !== "absolute"))) {
  4327. offsetX += parent.offsetLeft;
  4328. offsetY += parent.offsetTop;
  4329. }
  4330. if (previous !== null && currentStyle) {
  4331. if ((tagName !== "TABLE") && (tagName !== "TD") && (tagName !== "HTML")) {
  4332. offsetX += parseInt(currentStyle.borderLeftWidth) || 0;
  4333. offsetY += parseInt(currentStyle.borderTopWidth) || 0;
  4334. }
  4335. if (tagName === "TABLE" &&
  4336. (currentStyle.position === "relative" || currentStyle.position === "absolute")) {
  4337. offsetX += parseInt(currentStyle.marginLeft) || 0;
  4338. offsetY += parseInt(currentStyle.marginTop) || 0;
  4339. }
  4340. }
  4341. }
  4342. currentStyle = Sys.UI.DomElement._getCurrentStyle(element);
  4343. var elementPosition = currentStyle ? currentStyle.position : null;
  4344. if (!elementPosition || (elementPosition !== "absolute")) {
  4345. for (parent = element.parentNode; parent; parent = parent.parentNode) {
  4346. tagName = parent.tagName ? parent.tagName.toUpperCase() : null;
  4347. if ((tagName !== "BODY") && (tagName !== "HTML") && (parent.scrollLeft || parent.scrollTop)) {
  4348. offsetX -= (parent.scrollLeft || 0);
  4349. offsetY -= (parent.scrollTop || 0);
  4350. currentStyle = Sys.UI.DomElement._getCurrentStyle(parent);
  4351. if (currentStyle) {
  4352. offsetX += parseInt(currentStyle.borderLeftWidth) || 0;
  4353. offsetY += parseInt(currentStyle.borderTopWidth) || 0;
  4354. }
  4355. }
  4356. }
  4357. }
  4358. return new Sys.UI.Point(offsetX, offsetY);
  4359. }
  4360. }
  4361. Sys.UI.DomElement.isDomElement = function Sys$UI$DomElement$isDomElement(obj) {
  4362. /// <summary locid="M:J#Sys.UI.DomElement.isDomElement" />
  4363. /// <param name="obj"></param>
  4364. /// <returns type="Boolean"></returns>
  4365. var e = Function._validateParams(arguments, [
  4366. {name: "obj"}
  4367. ]);
  4368. if (e) throw e;
  4369. return Sys._isDomElement(obj);
  4370. }
  4371. Sys.UI.DomElement.removeCssClass = function Sys$UI$DomElement$removeCssClass(element, className) {
  4372. /// <summary locid="M:J#Sys.UI.DomElement.removeCssClass" />
  4373. /// <param name="element" domElement="true"></param>
  4374. /// <param name="className" type="String"></param>
  4375. var e = Function._validateParams(arguments, [
  4376. {name: "element", domElement: true},
  4377. {name: "className", type: String}
  4378. ]);
  4379. if (e) throw e;
  4380. var currentClassName = ' ' + element.className + ' ';
  4381. var index = currentClassName.indexOf(' ' + className + ' ');
  4382. if (index >= 0) {
  4383. element.className = (currentClassName.substr(0, index) + ' ' +
  4384. currentClassName.substring(index + className.length + 1, currentClassName.length)).trim();
  4385. }
  4386. }
  4387. Sys.UI.DomElement.resolveElement = function Sys$UI$DomElement$resolveElement(elementOrElementId, containerElement) {
  4388. /// <summary locid="M:J#Sys.UI.DomElement.resolveElement" />
  4389. /// <param name="elementOrElementId" mayBeNull="true"></param>
  4390. /// <param name="containerElement" domElement="true" optional="true" mayBeNull="true"></param>
  4391. /// <returns domElement="true"></returns>
  4392. var e = Function._validateParams(arguments, [
  4393. {name: "elementOrElementId", mayBeNull: true},
  4394. {name: "containerElement", mayBeNull: true, domElement: true, optional: true}
  4395. ]);
  4396. if (e) throw e;
  4397. var el = elementOrElementId;
  4398. if (!el) return null;
  4399. if (typeof(el) === "string") {
  4400. el = Sys.UI.DomElement.getElementById(el, containerElement);
  4401. if (!el) {
  4402. throw Error.argument("elementOrElementId", String.format(Sys.Res.elementNotFound, elementOrElementId));
  4403. }
  4404. }
  4405. else if(!Sys.UI.DomElement.isDomElement(el)) {
  4406. throw Error.argument("elementOrElementId", Sys.Res.expectedElementOrId);
  4407. }
  4408. return el;
  4409. }
  4410. Sys.UI.DomElement.raiseBubbleEvent = function Sys$UI$DomElement$raiseBubbleEvent(source, args) {
  4411. /// <summary locid="M:J#Sys.UI.DomElement.raiseBubbleEvent" />
  4412. /// <param name="source" domElement="true"></param>
  4413. /// <param name="args" type="Sys.EventArgs"></param>
  4414. var e = Function._validateParams(arguments, [
  4415. {name: "source", domElement: true},
  4416. {name: "args", type: Sys.EventArgs}
  4417. ]);
  4418. if (e) throw e;
  4419. var target = source;
  4420. while (target) {
  4421. var control = target.control;
  4422. if (control && control.onBubbleEvent && control.raiseBubbleEvent) {
  4423. Sys.UI.DomElement._raiseBubbleEventFromControl(control, source, args);
  4424. return;
  4425. }
  4426. target = target.parentNode;
  4427. }
  4428. }
  4429. Sys.UI.DomElement._raiseBubbleEventFromControl = function Sys$UI$DomElement$_raiseBubbleEventFromControl(control, source, args) {
  4430. if (!control.onBubbleEvent(source, args)) {
  4431. control._raiseBubbleEvent(source, args);
  4432. }
  4433. }
  4434. Sys.UI.DomElement.setLocation = function Sys$UI$DomElement$setLocation(element, x, y) {
  4435. /// <summary locid="M:J#Sys.UI.DomElement.setLocation" />
  4436. /// <param name="element" domElement="true"></param>
  4437. /// <param name="x" type="Number" integer="true"></param>
  4438. /// <param name="y" type="Number" integer="true"></param>
  4439. var e = Function._validateParams(arguments, [
  4440. {name: "element", domElement: true},
  4441. {name: "x", type: Number, integer: true},
  4442. {name: "y", type: Number, integer: true}
  4443. ]);
  4444. if (e) throw e;
  4445. var style = element.style;
  4446. style.position = 'absolute';
  4447. style.left = x + "px";
  4448. style.top = y + "px";
  4449. }
  4450. Sys.UI.DomElement.toggleCssClass = function Sys$UI$DomElement$toggleCssClass(element, className) {
  4451. /// <summary locid="M:J#Sys.UI.DomElement.toggleCssClass" />
  4452. /// <param name="element" domElement="true"></param>
  4453. /// <param name="className" type="String"></param>
  4454. var e = Function._validateParams(arguments, [
  4455. {name: "element", domElement: true},
  4456. {name: "className", type: String}
  4457. ]);
  4458. if (e) throw e;
  4459. if (Sys.UI.DomElement.containsCssClass(element, className)) {
  4460. Sys.UI.DomElement.removeCssClass(element, className);
  4461. }
  4462. else {
  4463. Sys.UI.DomElement.addCssClass(element, className);
  4464. }
  4465. }
  4466. Sys.UI.DomElement.getVisibilityMode = function Sys$UI$DomElement$getVisibilityMode(element) {
  4467. /// <summary locid="M:J#Sys.UI.DomElement.getVisibilityMode" />
  4468. /// <param name="element" domElement="true"></param>
  4469. /// <returns type="Sys.UI.VisibilityMode"></returns>
  4470. var e = Function._validateParams(arguments, [
  4471. {name: "element", domElement: true}
  4472. ]);
  4473. if (e) throw e;
  4474. return (element._visibilityMode === Sys.UI.VisibilityMode.hide) ?
  4475. Sys.UI.VisibilityMode.hide :
  4476. Sys.UI.VisibilityMode.collapse;
  4477. }
  4478. Sys.UI.DomElement.setVisibilityMode = function Sys$UI$DomElement$setVisibilityMode(element, value) {
  4479. /// <summary locid="M:J#Sys.UI.DomElement.setVisibilityMode" />
  4480. /// <param name="element" domElement="true"></param>
  4481. /// <param name="value" type="Sys.UI.VisibilityMode"></param>
  4482. var e = Function._validateParams(arguments, [
  4483. {name: "element", domElement: true},
  4484. {name: "value", type: Sys.UI.VisibilityMode}
  4485. ]);
  4486. if (e) throw e;
  4487. Sys.UI.DomElement._ensureOldDisplayMode(element);
  4488. if (element._visibilityMode !== value) {
  4489. element._visibilityMode = value;
  4490. if (Sys.UI.DomElement.getVisible(element) === false) {
  4491. if (element._visibilityMode === Sys.UI.VisibilityMode.hide) {
  4492. element.style.display = element._oldDisplayMode;
  4493. }
  4494. else {
  4495. element.style.display = 'none';
  4496. }
  4497. }
  4498. element._visibilityMode = value;
  4499. }
  4500. }
  4501. Sys.UI.DomElement.getVisible = function Sys$UI$DomElement$getVisible(element) {
  4502. /// <summary locid="M:J#Sys.UI.DomElement.getVisible" />
  4503. /// <param name="element" domElement="true"></param>
  4504. /// <returns type="Boolean"></returns>
  4505. var e = Function._validateParams(arguments, [
  4506. {name: "element", domElement: true}
  4507. ]);
  4508. if (e) throw e;
  4509. var style = element.currentStyle || Sys.UI.DomElement._getCurrentStyle(element);
  4510. if (!style) return true;
  4511. return (style.visibility !== 'hidden') && (style.display !== 'none');
  4512. }
  4513. Sys.UI.DomElement.setVisible = function Sys$UI$DomElement$setVisible(element, value) {
  4514. /// <summary locid="M:J#Sys.UI.DomElement.setVisible" />
  4515. /// <param name="element" domElement="true"></param>
  4516. /// <param name="value" type="Boolean"></param>
  4517. var e = Function._validateParams(arguments, [
  4518. {name: "element", domElement: true},
  4519. {name: "value", type: Boolean}
  4520. ]);
  4521. if (e) throw e;
  4522. if (value !== Sys.UI.DomElement.getVisible(element)) {
  4523. Sys.UI.DomElement._ensureOldDisplayMode(element);
  4524. element.style.visibility = value ? 'visible' : 'hidden';
  4525. if (value || (element._visibilityMode === Sys.UI.VisibilityMode.hide)) {
  4526. element.style.display = element._oldDisplayMode;
  4527. }
  4528. else {
  4529. element.style.display = 'none';
  4530. }
  4531. }
  4532. }
  4533. Sys.UI.DomElement._ensureOldDisplayMode = function Sys$UI$DomElement$_ensureOldDisplayMode(element) {
  4534. if (!element._oldDisplayMode) {
  4535. var style = element.currentStyle || Sys.UI.DomElement._getCurrentStyle(element);
  4536. element._oldDisplayMode = style ? style.display : null;
  4537. if (!element._oldDisplayMode || element._oldDisplayMode === 'none') {
  4538. switch(element.tagName.toUpperCase()) {
  4539. case 'DIV': case 'P': case 'ADDRESS': case 'BLOCKQUOTE': case 'BODY': case 'COL':
  4540. case 'COLGROUP': case 'DD': case 'DL': case 'DT': case 'FIELDSET': case 'FORM':
  4541. case 'H1': case 'H2': case 'H3': case 'H4': case 'H5': case 'H6': case 'HR':
  4542. case 'IFRAME': case 'LEGEND': case 'OL': case 'PRE': case 'TABLE': case 'TD':
  4543. case 'TH': case 'TR': case 'UL':
  4544. element._oldDisplayMode = 'block';
  4545. break;
  4546. case 'LI':
  4547. element._oldDisplayMode = 'list-item';
  4548. break;
  4549. default:
  4550. element._oldDisplayMode = 'inline';
  4551. }
  4552. }
  4553. }
  4554. }
  4555. Sys.UI.DomElement._getWindow = function Sys$UI$DomElement$_getWindow(element) {
  4556. var doc = element.ownerDocument || element.document || element;
  4557. return doc.defaultView || doc.parentWindow;
  4558. }
  4559. Sys.UI.DomElement._getCurrentStyle = function Sys$UI$DomElement$_getCurrentStyle(element) {
  4560. if (element.nodeType === 3) return null;
  4561. var w = Sys.UI.DomElement._getWindow(element);
  4562. if (element.documentElement) element = element.documentElement;
  4563. var computedStyle = (w && (element !== w) && w.getComputedStyle) ?
  4564. w.getComputedStyle(element, null) :
  4565. element.currentStyle || element.style;
  4566. if (!computedStyle && (Sys.Browser.agent === Sys.Browser.Safari) && element.style) {
  4567. var oldDisplay = element.style.display;
  4568. var oldPosition = element.style.position;
  4569. element.style.position = 'absolute';
  4570. element.style.display = 'block';
  4571. var style = w.getComputedStyle(element, null);
  4572. element.style.display = oldDisplay;
  4573. element.style.position = oldPosition;
  4574. computedStyle = {};
  4575. for (var n in style) {
  4576. computedStyle[n] = style[n];
  4577. }
  4578. computedStyle.display = 'none';
  4579. }
  4580. return computedStyle;
  4581. }
  4582. Sys.IContainer = function Sys$IContainer() {
  4583. throw Error.notImplemented();
  4584. }
  4585. function Sys$IContainer$addComponent(component) {
  4586. /// <summary locid="M:J#Sys.IContainer.addComponent" />
  4587. /// <param name="component" type="Sys.Component"></param>
  4588. var e = Function._validateParams(arguments, [
  4589. {name: "component", type: Sys.Component}
  4590. ]);
  4591. if (e) throw e;
  4592. throw Error.notImplemented();
  4593. }
  4594. function Sys$IContainer$removeComponent(component) {
  4595. /// <summary locid="M:J#Sys.IContainer.removeComponent" />
  4596. /// <param name="component" type="Sys.Component"></param>
  4597. var e = Function._validateParams(arguments, [
  4598. {name: "component", type: Sys.Component}
  4599. ]);
  4600. if (e) throw e;
  4601. throw Error.notImplemented();
  4602. }
  4603. function Sys$IContainer$findComponent(id) {
  4604. /// <summary locid="M:J#Sys.IContainer.findComponent" />
  4605. /// <param name="id" type="String"></param>
  4606. /// <returns type="Sys.Component"></returns>
  4607. var e = Function._validateParams(arguments, [
  4608. {name: "id", type: String}
  4609. ]);
  4610. if (e) throw e;
  4611. throw Error.notImplemented();
  4612. }
  4613. function Sys$IContainer$getComponents() {
  4614. /// <summary locid="M:J#Sys.IContainer.getComponents" />
  4615. /// <returns type="Array" elementType="Sys.Component"></returns>
  4616. if (arguments.length !== 0) throw Error.parameterCount();
  4617. throw Error.notImplemented();
  4618. }
  4619. Sys.IContainer.prototype = {
  4620. addComponent: Sys$IContainer$addComponent,
  4621. removeComponent: Sys$IContainer$removeComponent,
  4622. findComponent: Sys$IContainer$findComponent,
  4623. getComponents: Sys$IContainer$getComponents
  4624. }
  4625. Sys.IContainer.registerInterface("Sys.IContainer");
  4626. Sys.ApplicationLoadEventArgs = function Sys$ApplicationLoadEventArgs(components, isPartialLoad) {
  4627. /// <summary locid="M:J#Sys.ApplicationLoadEventArgs.#ctor" />
  4628. /// <param name="components" type="Array" elementType="Sys.Component"></param>
  4629. /// <param name="isPartialLoad" type="Boolean"></param>
  4630. var e = Function._validateParams(arguments, [
  4631. {name: "components", type: Array, elementType: Sys.Component},
  4632. {name: "isPartialLoad", type: Boolean}
  4633. ]);
  4634. if (e) throw e;
  4635. Sys.ApplicationLoadEventArgs.initializeBase(this);
  4636. this._components = components;
  4637. this._isPartialLoad = isPartialLoad;
  4638. }
  4639. function Sys$ApplicationLoadEventArgs$get_components() {
  4640. /// <value type="Array" elementType="Sys.Component" locid="P:J#Sys.ApplicationLoadEventArgs.components"></value>
  4641. if (arguments.length !== 0) throw Error.parameterCount();
  4642. return this._components;
  4643. }
  4644. function Sys$ApplicationLoadEventArgs$get_isPartialLoad() {
  4645. /// <value type="Boolean" locid="P:J#Sys.ApplicationLoadEventArgs.isPartialLoad"></value>
  4646. if (arguments.length !== 0) throw Error.parameterCount();
  4647. return this._isPartialLoad;
  4648. }
  4649. Sys.ApplicationLoadEventArgs.prototype = {
  4650. get_components: Sys$ApplicationLoadEventArgs$get_components,
  4651. get_isPartialLoad: Sys$ApplicationLoadEventArgs$get_isPartialLoad
  4652. }
  4653. Sys.ApplicationLoadEventArgs.registerClass('Sys.ApplicationLoadEventArgs', Sys.EventArgs);
  4654. Sys._Application = function Sys$_Application() {
  4655. /// <summary locid="M:J#Sys.Application.#ctor" />
  4656. if (arguments.length !== 0) throw Error.parameterCount();
  4657. Sys._Application.initializeBase(this);
  4658. this._disposableObjects = [];
  4659. this._components = {};
  4660. this._createdComponents = [];
  4661. this._secondPassComponents = [];
  4662. this._unloadHandlerDelegate = Function.createDelegate(this, this._unloadHandler);
  4663. Sys.UI.DomEvent.addHandler(window, "unload", this._unloadHandlerDelegate);
  4664. this._domReady();
  4665. }
  4666. function Sys$_Application$get_isCreatingComponents() {
  4667. /// <value type="Boolean" locid="P:J#Sys.Application.isCreatingComponents"></value>
  4668. if (arguments.length !== 0) throw Error.parameterCount();
  4669. return this._creatingComponents;
  4670. }
  4671. function Sys$_Application$get_isDisposing() {
  4672. /// <value type="Boolean" locid="P:J#Sys.Application.isDisposing"></value>
  4673. if (arguments.length !== 0) throw Error.parameterCount();
  4674. return this._disposing;
  4675. }
  4676. function Sys$_Application$add_init(handler) {
  4677. /// <summary locid="E:J#Sys.Application.init" />
  4678. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  4679. if (e) throw e;
  4680. if (this._initialized) {
  4681. handler(this, Sys.EventArgs.Empty);
  4682. }
  4683. else {
  4684. this.get_events().addHandler("init", handler);
  4685. }
  4686. }
  4687. function Sys$_Application$remove_init(handler) {
  4688. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  4689. if (e) throw e;
  4690. this.get_events().removeHandler("init", handler);
  4691. }
  4692. function Sys$_Application$add_load(handler) {
  4693. /// <summary locid="E:J#Sys.Application.load" />
  4694. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  4695. if (e) throw e;
  4696. this.get_events().addHandler("load", handler);
  4697. }
  4698. function Sys$_Application$remove_load(handler) {
  4699. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  4700. if (e) throw e;
  4701. this.get_events().removeHandler("load", handler);
  4702. }
  4703. function Sys$_Application$add_unload(handler) {
  4704. /// <summary locid="E:J#Sys.Application.unload" />
  4705. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  4706. if (e) throw e;
  4707. this.get_events().addHandler("unload", handler);
  4708. }
  4709. function Sys$_Application$remove_unload(handler) {
  4710. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  4711. if (e) throw e;
  4712. this.get_events().removeHandler("unload", handler);
  4713. }
  4714. function Sys$_Application$addComponent(component) {
  4715. /// <summary locid="M:J#Sys.Application.addComponent" />
  4716. /// <param name="component" type="Sys.Component"></param>
  4717. var e = Function._validateParams(arguments, [
  4718. {name: "component", type: Sys.Component}
  4719. ]);
  4720. if (e) throw e;
  4721. var id = component.get_id();
  4722. if (!id) throw Error.invalidOperation(Sys.Res.cantAddWithoutId);
  4723. if (typeof(this._components[id]) !== 'undefined') throw Error.invalidOperation(String.format(Sys.Res.appDuplicateComponent, id));
  4724. this._components[id] = component;
  4725. }
  4726. function Sys$_Application$beginCreateComponents() {
  4727. /// <summary locid="M:J#Sys.Application.beginCreateComponents" />
  4728. if (arguments.length !== 0) throw Error.parameterCount();
  4729. this._creatingComponents = true;
  4730. }
  4731. function Sys$_Application$dispose() {
  4732. /// <summary locid="M:J#Sys.Application.dispose" />
  4733. if (arguments.length !== 0) throw Error.parameterCount();
  4734. if (!this._disposing) {
  4735. this._disposing = true;
  4736. if (this._timerCookie) {
  4737. window.clearTimeout(this._timerCookie);
  4738. delete this._timerCookie;
  4739. }
  4740. if (this._endRequestHandler) {
  4741. Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(this._endRequestHandler);
  4742. delete this._endRequestHandler;
  4743. }
  4744. if (this._beginRequestHandler) {
  4745. Sys.WebForms.PageRequestManager.getInstance().remove_beginRequest(this._beginRequestHandler);
  4746. delete this._beginRequestHandler;
  4747. }
  4748. if (window.pageUnload) {
  4749. window.pageUnload(this, Sys.EventArgs.Empty);
  4750. }
  4751. var unloadHandler = this.get_events().getHandler("unload");
  4752. if (unloadHandler) {
  4753. unloadHandler(this, Sys.EventArgs.Empty);
  4754. }
  4755. var disposableObjects = Array.clone(this._disposableObjects);
  4756. for (var i = 0, l = disposableObjects.length; i < l; i++) {
  4757. var object = disposableObjects[i];
  4758. if (typeof(object) !== "undefined") {
  4759. object.dispose();
  4760. }
  4761. }
  4762. Array.clear(this._disposableObjects);
  4763. Sys.UI.DomEvent.removeHandler(window, "unload", this._unloadHandlerDelegate);
  4764. if (Sys._ScriptLoader) {
  4765. var sl = Sys._ScriptLoader.getInstance();
  4766. if(sl) {
  4767. sl.dispose();
  4768. }
  4769. }
  4770. Sys._Application.callBaseMethod(this, 'dispose');
  4771. }
  4772. }
  4773. function Sys$_Application$disposeElement(element, childNodesOnly) {
  4774. /// <summary locid="M:J#Sys._Application.disposeElement" />
  4775. /// <param name="element"></param>
  4776. /// <param name="childNodesOnly" type="Boolean"></param>
  4777. var e = Function._validateParams(arguments, [
  4778. {name: "element"},
  4779. {name: "childNodesOnly", type: Boolean}
  4780. ]);
  4781. if (e) throw e;
  4782. if (element.nodeType === 1) {
  4783. var children = element.getElementsByTagName("*");
  4784. for (var i = children.length - 1; i >= 0; i--) {
  4785. this._disposeElementInternal(children[i]);
  4786. }
  4787. if (!childNodesOnly) {
  4788. this._disposeElementInternal(element);
  4789. }
  4790. }
  4791. }
  4792. function Sys$_Application$endCreateComponents() {
  4793. /// <summary locid="M:J#Sys.Application.endCreateComponents" />
  4794. if (arguments.length !== 0) throw Error.parameterCount();
  4795. var components = this._secondPassComponents;
  4796. for (var i = 0, l = components.length; i < l; i++) {
  4797. var component = components[i].component;
  4798. Sys$Component$_setReferences(component, components[i].references);
  4799. component.endUpdate();
  4800. }
  4801. this._secondPassComponents = [];
  4802. this._creatingComponents = false;
  4803. }
  4804. function Sys$_Application$findComponent(id, parent) {
  4805. /// <summary locid="M:J#Sys.Application.findComponent" />
  4806. /// <param name="id" type="String"></param>
  4807. /// <param name="parent" optional="true" mayBeNull="true"></param>
  4808. /// <returns type="Sys.Component" mayBeNull="true"></returns>
  4809. var e = Function._validateParams(arguments, [
  4810. {name: "id", type: String},
  4811. {name: "parent", mayBeNull: true, optional: true}
  4812. ]);
  4813. if (e) throw e;
  4814. return (parent ?
  4815. ((Sys.IContainer.isInstanceOfType(parent)) ?
  4816. parent.findComponent(id) :
  4817. parent[id] || null) :
  4818. Sys.Application._components[id] || null);
  4819. }
  4820. function Sys$_Application$getComponents() {
  4821. /// <summary locid="M:J#Sys.Application.getComponents" />
  4822. /// <returns type="Array" elementType="Sys.Component"></returns>
  4823. if (arguments.length !== 0) throw Error.parameterCount();
  4824. var res = [];
  4825. var components = this._components;
  4826. for (var name in components) {
  4827. res[res.length] = components[name];
  4828. }
  4829. return res;
  4830. }
  4831. function Sys$_Application$initialize() {
  4832. /// <summary locid="M:J#Sys.Application.initialize" />
  4833. if (arguments.length !== 0) throw Error.parameterCount();
  4834. if(!this.get_isInitialized() && !this._disposing) {
  4835. Sys._Application.callBaseMethod(this, 'initialize');
  4836. this._raiseInit();
  4837. if (this.get_stateString) {
  4838. if (Sys.WebForms && Sys.WebForms.PageRequestManager) {
  4839. this._beginRequestHandler = Function.createDelegate(this, this._onPageRequestManagerBeginRequest);
  4840. Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(this._beginRequestHandler);
  4841. this._endRequestHandler = Function.createDelegate(this, this._onPageRequestManagerEndRequest);
  4842. Sys.WebForms.PageRequestManager.getInstance().add_endRequest(this._endRequestHandler);
  4843. }
  4844. var loadedEntry = this.get_stateString();
  4845. if (loadedEntry !== this._currentEntry) {
  4846. this._navigate(loadedEntry);
  4847. }
  4848. else {
  4849. this._ensureHistory();
  4850. }
  4851. }
  4852. this.raiseLoad();
  4853. }
  4854. }
  4855. function Sys$_Application$notifyScriptLoaded() {
  4856. /// <summary locid="M:J#Sys.Application.notifyScriptLoaded" />
  4857. if (arguments.length !== 0) throw Error.parameterCount();
  4858. }
  4859. function Sys$_Application$registerDisposableObject(object) {
  4860. /// <summary locid="M:J#Sys.Application.registerDisposableObject" />
  4861. /// <param name="object" type="Sys.IDisposable"></param>
  4862. var e = Function._validateParams(arguments, [
  4863. {name: "object", type: Sys.IDisposable}
  4864. ]);
  4865. if (e) throw e;
  4866. if (!this._disposing) {
  4867. var objects = this._disposableObjects,
  4868. i = objects.length;
  4869. objects[i] = object;
  4870. object.__msdisposeindex = i;
  4871. }
  4872. }
  4873. function Sys$_Application$raiseLoad() {
  4874. /// <summary locid="M:J#Sys.Application.raiseLoad" />
  4875. if (arguments.length !== 0) throw Error.parameterCount();
  4876. var h = this.get_events().getHandler("load");
  4877. var args = new Sys.ApplicationLoadEventArgs(Array.clone(this._createdComponents), !!this._loaded);
  4878. this._loaded = true;
  4879. if (h) {
  4880. h(this, args);
  4881. }
  4882. if (window.pageLoad) {
  4883. window.pageLoad(this, args);
  4884. }
  4885. this._createdComponents = [];
  4886. }
  4887. function Sys$_Application$removeComponent(component) {
  4888. /// <summary locid="M:J#Sys.Application.removeComponent" />
  4889. /// <param name="component" type="Sys.Component"></param>
  4890. var e = Function._validateParams(arguments, [
  4891. {name: "component", type: Sys.Component}
  4892. ]);
  4893. if (e) throw e;
  4894. var id = component.get_id();
  4895. if (id) delete this._components[id];
  4896. }
  4897. function Sys$_Application$unregisterDisposableObject(object) {
  4898. /// <summary locid="M:J#Sys.Application.unregisterDisposableObject" />
  4899. /// <param name="object" type="Sys.IDisposable"></param>
  4900. var e = Function._validateParams(arguments, [
  4901. {name: "object", type: Sys.IDisposable}
  4902. ]);
  4903. if (e) throw e;
  4904. if (!this._disposing) {
  4905. var i = object.__msdisposeindex;
  4906. if (typeof(i) === "number") {
  4907. var disposableObjects = this._disposableObjects;
  4908. delete disposableObjects[i];
  4909. delete object.__msdisposeindex;
  4910. if (++this._deleteCount > 1000) {
  4911. var newArray = [];
  4912. for (var j = 0, l = disposableObjects.length; j < l; j++) {
  4913. object = disposableObjects[j];
  4914. if (typeof(object) !== "undefined") {
  4915. object.__msdisposeindex = newArray.length;
  4916. newArray.push(object);
  4917. }
  4918. }
  4919. this._disposableObjects = newArray;
  4920. this._deleteCount = 0;
  4921. }
  4922. }
  4923. }
  4924. }
  4925. function Sys$_Application$_addComponentToSecondPass(component, references) {
  4926. this._secondPassComponents[this._secondPassComponents.length] = {component: component, references: references};
  4927. }
  4928. function Sys$_Application$_disposeComponents(list) {
  4929. if (list) {
  4930. for (var i = list.length - 1; i >= 0; i--) {
  4931. var item = list[i];
  4932. if (typeof(item.dispose) === "function") {
  4933. item.dispose();
  4934. }
  4935. }
  4936. }
  4937. }
  4938. function Sys$_Application$_disposeElementInternal(element) {
  4939. var d = element.dispose;
  4940. if (d && typeof(d) === "function") {
  4941. element.dispose();
  4942. }
  4943. else {
  4944. var c = element.control;
  4945. if (c && typeof(c.dispose) === "function") {
  4946. c.dispose();
  4947. }
  4948. }
  4949. var list = element._behaviors;
  4950. if (list) {
  4951. this._disposeComponents(list);
  4952. }
  4953. list = element._components;
  4954. if (list) {
  4955. this._disposeComponents(list);
  4956. element._components = null;
  4957. }
  4958. }
  4959. function Sys$_Application$_domReady() {
  4960. var check, er, app = this;
  4961. function init() { app.initialize(); }
  4962. var onload = function() {
  4963. Sys.UI.DomEvent.removeHandler(window, "load", onload);
  4964. init();
  4965. }
  4966. Sys.UI.DomEvent.addHandler(window, "load", onload);
  4967. if (document.addEventListener) {
  4968. try {
  4969. document.addEventListener("DOMContentLoaded", check = function() {
  4970. document.removeEventListener("DOMContentLoaded", check, false);
  4971. init();
  4972. }, false);
  4973. }
  4974. catch (er) { }
  4975. }
  4976. else if (document.attachEvent) {
  4977. if ((window == window.top) && document.documentElement.doScroll) {
  4978. var timeout, el = document.createElement("div");
  4979. check = function() {
  4980. try {
  4981. el.doScroll("left");
  4982. }
  4983. catch (er) {
  4984. timeout = window.setTimeout(check, 0);
  4985. return;
  4986. }
  4987. el = null;
  4988. init();
  4989. }
  4990. check();
  4991. }
  4992. else {
  4993. document.attachEvent("onreadystatechange", check = function() {
  4994. if (document.readyState === "complete") {
  4995. document.detachEvent("onreadystatechange", check);
  4996. init();
  4997. }
  4998. });
  4999. }
  5000. }
  5001. }
  5002. function Sys$_Application$_raiseInit() {
  5003. var handler = this.get_events().getHandler("init");
  5004. if (handler) {
  5005. this.beginCreateComponents();
  5006. handler(this, Sys.EventArgs.Empty);
  5007. this.endCreateComponents();
  5008. }
  5009. }
  5010. function Sys$_Application$_unloadHandler(event) {
  5011. this.dispose();
  5012. }
  5013. Sys._Application.prototype = {
  5014. _creatingComponents: false,
  5015. _disposing: false,
  5016. _deleteCount: 0,
  5017. get_isCreatingComponents: Sys$_Application$get_isCreatingComponents,
  5018. get_isDisposing: Sys$_Application$get_isDisposing,
  5019. add_init: Sys$_Application$add_init,
  5020. remove_init: Sys$_Application$remove_init,
  5021. add_load: Sys$_Application$add_load,
  5022. remove_load: Sys$_Application$remove_load,
  5023. add_unload: Sys$_Application$add_unload,
  5024. remove_unload: Sys$_Application$remove_unload,
  5025. addComponent: Sys$_Application$addComponent,
  5026. beginCreateComponents: Sys$_Application$beginCreateComponents,
  5027. dispose: Sys$_Application$dispose,
  5028. disposeElement: Sys$_Application$disposeElement,
  5029. endCreateComponents: Sys$_Application$endCreateComponents,
  5030. findComponent: Sys$_Application$findComponent,
  5031. getComponents: Sys$_Application$getComponents,
  5032. initialize: Sys$_Application$initialize,
  5033. notifyScriptLoaded: Sys$_Application$notifyScriptLoaded,
  5034. registerDisposableObject: Sys$_Application$registerDisposableObject,
  5035. raiseLoad: Sys$_Application$raiseLoad,
  5036. removeComponent: Sys$_Application$removeComponent,
  5037. unregisterDisposableObject: Sys$_Application$unregisterDisposableObject,
  5038. _addComponentToSecondPass: Sys$_Application$_addComponentToSecondPass,
  5039. _disposeComponents: Sys$_Application$_disposeComponents,
  5040. _disposeElementInternal: Sys$_Application$_disposeElementInternal,
  5041. _domReady: Sys$_Application$_domReady,
  5042. _raiseInit: Sys$_Application$_raiseInit,
  5043. _unloadHandler: Sys$_Application$_unloadHandler
  5044. }
  5045. Sys._Application.registerClass('Sys._Application', Sys.Component, Sys.IContainer);
  5046. Sys.Application = new Sys._Application();
  5047. var $find = Sys.Application.findComponent;
  5048. Sys.UI.Behavior = function Sys$UI$Behavior(element) {
  5049. /// <summary locid="M:J#Sys.UI.Behavior.#ctor" />
  5050. /// <param name="element" domElement="true"></param>
  5051. var e = Function._validateParams(arguments, [
  5052. {name: "element", domElement: true}
  5053. ]);
  5054. if (e) throw e;
  5055. Sys.UI.Behavior.initializeBase(this);
  5056. this._element = element;
  5057. var behaviors = element._behaviors;
  5058. if (!behaviors) {
  5059. element._behaviors = [this];
  5060. }
  5061. else {
  5062. behaviors[behaviors.length] = this;
  5063. }
  5064. }
  5065. function Sys$UI$Behavior$get_element() {
  5066. /// <value domElement="true" locid="P:J#Sys.UI.Behavior.element"></value>
  5067. if (arguments.length !== 0) throw Error.parameterCount();
  5068. return this._element;
  5069. }
  5070. function Sys$UI$Behavior$get_id() {
  5071. /// <value type="String" locid="P:J#Sys.UI.Behavior.id"></value>
  5072. if (arguments.length !== 0) throw Error.parameterCount();
  5073. var baseId = Sys.UI.Behavior.callBaseMethod(this, 'get_id');
  5074. if (baseId) return baseId;
  5075. if (!this._element || !this._element.id) return '';
  5076. return this._element.id + '$' + this.get_name();
  5077. }
  5078. function Sys$UI$Behavior$get_name() {
  5079. /// <value type="String" locid="P:J#Sys.UI.Behavior.name"></value>
  5080. if (arguments.length !== 0) throw Error.parameterCount();
  5081. if (this._name) return this._name;
  5082. var name = Object.getTypeName(this);
  5083. var i = name.lastIndexOf('.');
  5084. if (i !== -1) name = name.substr(i + 1);
  5085. if (!this.get_isInitialized()) this._name = name;
  5086. return name;
  5087. }
  5088. function Sys$UI$Behavior$set_name(value) {
  5089. var e = Function._validateParams(arguments, [{name: "value", type: String}]);
  5090. if (e) throw e;
  5091. if ((value === '') || (value.charAt(0) === ' ') || (value.charAt(value.length - 1) === ' '))
  5092. throw Error.argument('value', Sys.Res.invalidId);
  5093. if (typeof(this._element[value]) !== 'undefined')
  5094. throw Error.invalidOperation(String.format(Sys.Res.behaviorDuplicateName, value));
  5095. if (this.get_isInitialized()) throw Error.invalidOperation(Sys.Res.cantSetNameAfterInit);
  5096. this._name = value;
  5097. }
  5098. function Sys$UI$Behavior$initialize() {
  5099. Sys.UI.Behavior.callBaseMethod(this, 'initialize');
  5100. var name = this.get_name();
  5101. if (name) this._element[name] = this;
  5102. }
  5103. function Sys$UI$Behavior$dispose() {
  5104. Sys.UI.Behavior.callBaseMethod(this, 'dispose');
  5105. var e = this._element;
  5106. if (e) {
  5107. var name = this.get_name();
  5108. if (name) {
  5109. e[name] = null;
  5110. }
  5111. var behaviors = e._behaviors;
  5112. Array.remove(behaviors, this);
  5113. if (behaviors.length === 0) {
  5114. e._behaviors = null;
  5115. }
  5116. delete this._element;
  5117. }
  5118. }
  5119. Sys.UI.Behavior.prototype = {
  5120. _name: null,
  5121. get_element: Sys$UI$Behavior$get_element,
  5122. get_id: Sys$UI$Behavior$get_id,
  5123. get_name: Sys$UI$Behavior$get_name,
  5124. set_name: Sys$UI$Behavior$set_name,
  5125. initialize: Sys$UI$Behavior$initialize,
  5126. dispose: Sys$UI$Behavior$dispose
  5127. }
  5128. Sys.UI.Behavior.registerClass('Sys.UI.Behavior', Sys.Component);
  5129. Sys.UI.Behavior.getBehaviorByName = function Sys$UI$Behavior$getBehaviorByName(element, name) {
  5130. /// <summary locid="M:J#Sys.UI.Behavior.getBehaviorByName" />
  5131. /// <param name="element" domElement="true"></param>
  5132. /// <param name="name" type="String"></param>
  5133. /// <returns type="Sys.UI.Behavior" mayBeNull="true"></returns>
  5134. var e = Function._validateParams(arguments, [
  5135. {name: "element", domElement: true},
  5136. {name: "name", type: String}
  5137. ]);
  5138. if (e) throw e;
  5139. var b = element[name];
  5140. return (b && Sys.UI.Behavior.isInstanceOfType(b)) ? b : null;
  5141. }
  5142. Sys.UI.Behavior.getBehaviors = function Sys$UI$Behavior$getBehaviors(element) {
  5143. /// <summary locid="M:J#Sys.UI.Behavior.getBehaviors" />
  5144. /// <param name="element" domElement="true"></param>
  5145. /// <returns type="Array" elementType="Sys.UI.Behavior"></returns>
  5146. var e = Function._validateParams(arguments, [
  5147. {name: "element", domElement: true}
  5148. ]);
  5149. if (e) throw e;
  5150. if (!element._behaviors) return [];
  5151. return Array.clone(element._behaviors);
  5152. }
  5153. Sys.UI.Behavior.getBehaviorsByType = function Sys$UI$Behavior$getBehaviorsByType(element, type) {
  5154. /// <summary locid="M:J#Sys.UI.Behavior.getBehaviorsByType" />
  5155. /// <param name="element" domElement="true"></param>
  5156. /// <param name="type" type="Type"></param>
  5157. /// <returns type="Array" elementType="Sys.UI.Behavior"></returns>
  5158. var e = Function._validateParams(arguments, [
  5159. {name: "element", domElement: true},
  5160. {name: "type", type: Type}
  5161. ]);
  5162. if (e) throw e;
  5163. var behaviors = element._behaviors;
  5164. var results = [];
  5165. if (behaviors) {
  5166. for (var i = 0, l = behaviors.length; i < l; i++) {
  5167. if (type.isInstanceOfType(behaviors[i])) {
  5168. results[results.length] = behaviors[i];
  5169. }
  5170. }
  5171. }
  5172. return results;
  5173. }
  5174. Sys.UI.VisibilityMode = function Sys$UI$VisibilityMode() {
  5175. /// <summary locid="M:J#Sys.UI.VisibilityMode.#ctor" />
  5176. /// <field name="hide" type="Number" integer="true" static="true" locid="F:J#Sys.UI.VisibilityMode.hide"></field>
  5177. /// <field name="collapse" type="Number" integer="true" static="true" locid="F:J#Sys.UI.VisibilityMode.collapse"></field>
  5178. if (arguments.length !== 0) throw Error.parameterCount();
  5179. throw Error.notImplemented();
  5180. }
  5181. Sys.UI.VisibilityMode.prototype = {
  5182. hide: 0,
  5183. collapse: 1
  5184. }
  5185. Sys.UI.VisibilityMode.registerEnum("Sys.UI.VisibilityMode");
  5186. Sys.UI.Control = function Sys$UI$Control(element) {
  5187. /// <summary locid="M:J#Sys.UI.Control.#ctor" />
  5188. /// <param name="element" domElement="true"></param>
  5189. var e = Function._validateParams(arguments, [
  5190. {name: "element", domElement: true}
  5191. ]);
  5192. if (e) throw e;
  5193. if (typeof(element.control) !== 'undefined') throw Error.invalidOperation(Sys.Res.controlAlreadyDefined);
  5194. Sys.UI.Control.initializeBase(this);
  5195. this._element = element;
  5196. element.control = this;
  5197. var role = this.get_role();
  5198. if (role) {
  5199. element.setAttribute("role", role);
  5200. }
  5201. }
  5202. function Sys$UI$Control$get_element() {
  5203. /// <value domElement="true" locid="P:J#Sys.UI.Control.element"></value>
  5204. if (arguments.length !== 0) throw Error.parameterCount();
  5205. return this._element;
  5206. }
  5207. function Sys$UI$Control$get_id() {
  5208. /// <value type="String" locid="P:J#Sys.UI.Control.id"></value>
  5209. if (arguments.length !== 0) throw Error.parameterCount();
  5210. if (!this._element) return '';
  5211. return this._element.id;
  5212. }
  5213. function Sys$UI$Control$set_id(value) {
  5214. var e = Function._validateParams(arguments, [{name: "value", type: String}]);
  5215. if (e) throw e;
  5216. throw Error.invalidOperation(Sys.Res.cantSetId);
  5217. }
  5218. function Sys$UI$Control$get_parent() {
  5219. /// <value type="Sys.UI.Control" locid="P:J#Sys.UI.Control.parent"></value>
  5220. if (arguments.length !== 0) throw Error.parameterCount();
  5221. if (this._parent) return this._parent;
  5222. if (!this._element) return null;
  5223. var parentElement = this._element.parentNode;
  5224. while (parentElement) {
  5225. if (parentElement.control) {
  5226. return parentElement.control;
  5227. }
  5228. parentElement = parentElement.parentNode;
  5229. }
  5230. return null;
  5231. }
  5232. function Sys$UI$Control$set_parent(value) {
  5233. var e = Function._validateParams(arguments, [{name: "value", type: Sys.UI.Control}]);
  5234. if (e) throw e;
  5235. if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
  5236. var parents = [this];
  5237. var current = value;
  5238. while (current) {
  5239. if (Array.contains(parents, current)) throw Error.invalidOperation(Sys.Res.circularParentChain);
  5240. parents[parents.length] = current;
  5241. current = current.get_parent();
  5242. }
  5243. this._parent = value;
  5244. }
  5245. function Sys$UI$Control$get_role() {
  5246. /// <value type="String" locid="P:J#Sys.UI.Control.role"></value>
  5247. if (arguments.length !== 0) throw Error.parameterCount();
  5248. return null;
  5249. }
  5250. function Sys$UI$Control$get_visibilityMode() {
  5251. /// <value type="Sys.UI.VisibilityMode" locid="P:J#Sys.UI.Control.visibilityMode"></value>
  5252. if (arguments.length !== 0) throw Error.parameterCount();
  5253. if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
  5254. return Sys.UI.DomElement.getVisibilityMode(this._element);
  5255. }
  5256. function Sys$UI$Control$set_visibilityMode(value) {
  5257. var e = Function._validateParams(arguments, [{name: "value", type: Sys.UI.VisibilityMode}]);
  5258. if (e) throw e;
  5259. if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
  5260. Sys.UI.DomElement.setVisibilityMode(this._element, value);
  5261. }
  5262. function Sys$UI$Control$get_visible() {
  5263. /// <value type="Boolean" locid="P:J#Sys.UI.Control.visible"></value>
  5264. if (arguments.length !== 0) throw Error.parameterCount();
  5265. if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
  5266. return Sys.UI.DomElement.getVisible(this._element);
  5267. }
  5268. function Sys$UI$Control$set_visible(value) {
  5269. var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
  5270. if (e) throw e;
  5271. if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
  5272. Sys.UI.DomElement.setVisible(this._element, value)
  5273. }
  5274. function Sys$UI$Control$addCssClass(className) {
  5275. /// <summary locid="M:J#Sys.UI.Control.addCssClass" />
  5276. /// <param name="className" type="String"></param>
  5277. var e = Function._validateParams(arguments, [
  5278. {name: "className", type: String}
  5279. ]);
  5280. if (e) throw e;
  5281. if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
  5282. Sys.UI.DomElement.addCssClass(this._element, className);
  5283. }
  5284. function Sys$UI$Control$dispose() {
  5285. Sys.UI.Control.callBaseMethod(this, 'dispose');
  5286. if (this._element) {
  5287. this._element.control = null;
  5288. delete this._element;
  5289. }
  5290. if (this._parent) delete this._parent;
  5291. }
  5292. function Sys$UI$Control$onBubbleEvent(source, args) {
  5293. /// <summary locid="M:J#Sys.UI.Control.onBubbleEvent" />
  5294. /// <param name="source"></param>
  5295. /// <param name="args" type="Sys.EventArgs"></param>
  5296. /// <returns type="Boolean"></returns>
  5297. var e = Function._validateParams(arguments, [
  5298. {name: "source"},
  5299. {name: "args", type: Sys.EventArgs}
  5300. ]);
  5301. if (e) throw e;
  5302. return false;
  5303. }
  5304. function Sys$UI$Control$raiseBubbleEvent(source, args) {
  5305. /// <summary locid="M:J#Sys.UI.Control.raiseBubbleEvent" />
  5306. /// <param name="source"></param>
  5307. /// <param name="args" type="Sys.EventArgs"></param>
  5308. var e = Function._validateParams(arguments, [
  5309. {name: "source"},
  5310. {name: "args", type: Sys.EventArgs}
  5311. ]);
  5312. if (e) throw e;
  5313. this._raiseBubbleEvent(source, args);
  5314. }
  5315. function Sys$UI$Control$_raiseBubbleEvent(source, args) {
  5316. var currentTarget = this.get_parent();
  5317. while (currentTarget) {
  5318. if (currentTarget.onBubbleEvent(source, args)) {
  5319. return;
  5320. }
  5321. currentTarget = currentTarget.get_parent();
  5322. }
  5323. }
  5324. function Sys$UI$Control$removeCssClass(className) {
  5325. /// <summary locid="M:J#Sys.UI.Control.removeCssClass" />
  5326. /// <param name="className" type="String"></param>
  5327. var e = Function._validateParams(arguments, [
  5328. {name: "className", type: String}
  5329. ]);
  5330. if (e) throw e;
  5331. if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
  5332. Sys.UI.DomElement.removeCssClass(this._element, className);
  5333. }
  5334. function Sys$UI$Control$toggleCssClass(className) {
  5335. /// <summary locid="M:J#Sys.UI.Control.toggleCssClass" />
  5336. /// <param name="className" type="String"></param>
  5337. var e = Function._validateParams(arguments, [
  5338. {name: "className", type: String}
  5339. ]);
  5340. if (e) throw e;
  5341. if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose);
  5342. Sys.UI.DomElement.toggleCssClass(this._element, className);
  5343. }
  5344. Sys.UI.Control.prototype = {
  5345. _parent: null,
  5346. _visibilityMode: Sys.UI.VisibilityMode.hide,
  5347. get_element: Sys$UI$Control$get_element,
  5348. get_id: Sys$UI$Control$get_id,
  5349. set_id: Sys$UI$Control$set_id,
  5350. get_parent: Sys$UI$Control$get_parent,
  5351. set_parent: Sys$UI$Control$set_parent,
  5352. get_role: Sys$UI$Control$get_role,
  5353. get_visibilityMode: Sys$UI$Control$get_visibilityMode,
  5354. set_visibilityMode: Sys$UI$Control$set_visibilityMode,
  5355. get_visible: Sys$UI$Control$get_visible,
  5356. set_visible: Sys$UI$Control$set_visible,
  5357. addCssClass: Sys$UI$Control$addCssClass,
  5358. dispose: Sys$UI$Control$dispose,
  5359. onBubbleEvent: Sys$UI$Control$onBubbleEvent,
  5360. raiseBubbleEvent: Sys$UI$Control$raiseBubbleEvent,
  5361. _raiseBubbleEvent: Sys$UI$Control$_raiseBubbleEvent,
  5362. removeCssClass: Sys$UI$Control$removeCssClass,
  5363. toggleCssClass: Sys$UI$Control$toggleCssClass
  5364. }
  5365. Sys.UI.Control.registerClass('Sys.UI.Control', Sys.Component);
  5366. Sys.HistoryEventArgs = function Sys$HistoryEventArgs(state) {
  5367. /// <summary locid="M:J#Sys.HistoryEventArgs.#ctor" />
  5368. /// <param name="state" type="Object"></param>
  5369. var e = Function._validateParams(arguments, [
  5370. {name: "state", type: Object}
  5371. ]);
  5372. if (e) throw e;
  5373. Sys.HistoryEventArgs.initializeBase(this);
  5374. this._state = state;
  5375. }
  5376. function Sys$HistoryEventArgs$get_state() {
  5377. /// <value type="Object" locid="P:J#Sys.HistoryEventArgs.state"></value>
  5378. if (arguments.length !== 0) throw Error.parameterCount();
  5379. return this._state;
  5380. }
  5381. Sys.HistoryEventArgs.prototype = {
  5382. get_state: Sys$HistoryEventArgs$get_state
  5383. }
  5384. Sys.HistoryEventArgs.registerClass('Sys.HistoryEventArgs', Sys.EventArgs);
  5385. Sys.Application._appLoadHandler = null;
  5386. Sys.Application._beginRequestHandler = null;
  5387. Sys.Application._clientId = null;
  5388. Sys.Application._currentEntry = '';
  5389. Sys.Application._endRequestHandler = null;
  5390. Sys.Application._history = null;
  5391. Sys.Application._enableHistory = false;
  5392. Sys.Application._historyEnabledInScriptManager = false;
  5393. Sys.Application._historyFrame = null;
  5394. Sys.Application._historyInitialized = false;
  5395. Sys.Application._historyPointIsNew = false;
  5396. Sys.Application._ignoreTimer = false;
  5397. Sys.Application._initialState = null;
  5398. Sys.Application._state = {};
  5399. Sys.Application._timerCookie = 0;
  5400. Sys.Application._timerHandler = null;
  5401. Sys.Application._uniqueId = null;
  5402. Sys._Application.prototype.get_stateString = function Sys$_Application$get_stateString() {
  5403. /// <summary locid="M:J#Sys._Application.get_stateString" />
  5404. if (arguments.length !== 0) throw Error.parameterCount();
  5405. var hash = null;
  5406. if (Sys.Browser.agent === Sys.Browser.Firefox) {
  5407. var href = window.location.href;
  5408. var hashIndex = href.indexOf('#');
  5409. if (hashIndex !== -1) {
  5410. hash = href.substring(hashIndex + 1);
  5411. }
  5412. else {
  5413. hash = "";
  5414. }
  5415. return hash;
  5416. }
  5417. else {
  5418. hash = window.location.hash;
  5419. }
  5420. if ((hash.length > 0) && (hash.charAt(0) === '#')) {
  5421. hash = hash.substring(1);
  5422. }
  5423. return hash;
  5424. };
  5425. Sys._Application.prototype.get_enableHistory = function Sys$_Application$get_enableHistory() {
  5426. /// <summary locid="M:J#Sys._Application.get_enableHistory" />
  5427. if (arguments.length !== 0) throw Error.parameterCount();
  5428. return this._enableHistory;
  5429. };
  5430. Sys._Application.prototype.set_enableHistory = function Sys$_Application$set_enableHistory(value) {
  5431. if (this._initialized && !this._initializing) {
  5432. throw Error.invalidOperation(Sys.Res.historyCannotEnableHistory);
  5433. }
  5434. else if (this._historyEnabledInScriptManager && !value) {
  5435. throw Error.invalidOperation(Sys.Res.invalidHistorySettingCombination);
  5436. }
  5437. this._enableHistory = value;
  5438. };
  5439. Sys._Application.prototype.add_navigate = function Sys$_Application$add_navigate(handler) {
  5440. /// <summary locid="E:J#Sys.Application.navigate" />
  5441. /// <param name="handler" type="Function"></param>
  5442. var e = Function._validateParams(arguments, [
  5443. {name: "handler", type: Function}
  5444. ]);
  5445. if (e) throw e;
  5446. this.get_events().addHandler("navigate", handler);
  5447. };
  5448. Sys._Application.prototype.remove_navigate = function Sys$_Application$remove_navigate(handler) {
  5449. /// <summary locid="M:J#Sys._Application.remove_navigate" />
  5450. /// <param name="handler" type="Function"></param>
  5451. var e = Function._validateParams(arguments, [
  5452. {name: "handler", type: Function}
  5453. ]);
  5454. if (e) throw e;
  5455. this.get_events().removeHandler("navigate", handler);
  5456. };
  5457. Sys._Application.prototype.addHistoryPoint = function Sys$_Application$addHistoryPoint(state, title) {
  5458. /// <summary locid="M:J#Sys.Application.addHistoryPoint" />
  5459. /// <param name="state" type="Object"></param>
  5460. /// <param name="title" type="String" optional="true" mayBeNull="true"></param>
  5461. var e = Function._validateParams(arguments, [
  5462. {name: "state", type: Object},
  5463. {name: "title", type: String, mayBeNull: true, optional: true}
  5464. ]);
  5465. if (e) throw e;
  5466. if (!this._enableHistory) throw Error.invalidOperation(Sys.Res.historyCannotAddHistoryPointWithHistoryDisabled);
  5467. for (var n in state) {
  5468. var v = state[n];
  5469. var t = typeof(v);
  5470. if ((v !== null) && ((t === 'object') || (t === 'function') || (t === 'undefined'))) {
  5471. throw Error.argument('state', Sys.Res.stateMustBeStringDictionary);
  5472. }
  5473. }
  5474. this._ensureHistory();
  5475. var initialState = this._state;
  5476. for (var key in state) {
  5477. var value = state[key];
  5478. if (value === null) {
  5479. if (typeof(initialState[key]) !== 'undefined') {
  5480. delete initialState[key];
  5481. }
  5482. }
  5483. else {
  5484. initialState[key] = value;
  5485. }
  5486. }
  5487. var entry = this._serializeState(initialState);
  5488. this._historyPointIsNew = true;
  5489. this._setState(entry, title);
  5490. this._raiseNavigate();
  5491. };
  5492. Sys._Application.prototype.setServerId = function Sys$_Application$setServerId(clientId, uniqueId) {
  5493. /// <summary locid="M:J#Sys.Application.setServerId" />
  5494. /// <param name="clientId" type="String"></param>
  5495. /// <param name="uniqueId" type="String"></param>
  5496. var e = Function._validateParams(arguments, [
  5497. {name: "clientId", type: String},
  5498. {name: "uniqueId", type: String}
  5499. ]);
  5500. if (e) throw e;
  5501. this._clientId = clientId;
  5502. this._uniqueId = uniqueId;
  5503. };
  5504. Sys._Application.prototype.setServerState = function Sys$_Application$setServerState(value) {
  5505. /// <summary locid="M:J#Sys.Application.setServerState" />
  5506. /// <param name="value" type="String"></param>
  5507. var e = Function._validateParams(arguments, [
  5508. {name: "value", type: String}
  5509. ]);
  5510. if (e) throw e;
  5511. this._ensureHistory();
  5512. this._state.__s = value;
  5513. this._updateHiddenField(value);
  5514. };
  5515. Sys._Application.prototype._deserializeState = function Sys$_Application$_deserializeState(entry) {
  5516. var result = {};
  5517. entry = entry || '';
  5518. var serverSeparator = entry.indexOf('&&');
  5519. if ((serverSeparator !== -1) && (serverSeparator + 2 < entry.length)) {
  5520. result.__s = entry.substr(serverSeparator + 2);
  5521. entry = entry.substr(0, serverSeparator);
  5522. }
  5523. var tokens = entry.split('&');
  5524. for (var i = 0, l = tokens.length; i < l; i++) {
  5525. var token = tokens[i];
  5526. var equal = token.indexOf('=');
  5527. if ((equal !== -1) && (equal + 1 < token.length)) {
  5528. var name = token.substr(0, equal);
  5529. var value = token.substr(equal + 1);
  5530. result[name] = decodeURIComponent(value);
  5531. }
  5532. }
  5533. return result;
  5534. };
  5535. Sys._Application.prototype._enableHistoryInScriptManager = function Sys$_Application$_enableHistoryInScriptManager() {
  5536. this._enableHistory = true;
  5537. this._historyEnabledInScriptManager = true;
  5538. };
  5539. Sys._Application.prototype._ensureHistory = function Sys$_Application$_ensureHistory() {
  5540. if (!this._historyInitialized && this._enableHistory) {
  5541. if ((Sys.Browser.agent === Sys.Browser.InternetExplorer) && (Sys.Browser.documentMode < 8)) {
  5542. this._historyFrame = document.getElementById('__historyFrame');
  5543. if (!this._historyFrame) throw Error.invalidOperation(Sys.Res.historyMissingFrame);
  5544. this._ignoreIFrame = true;
  5545. }
  5546. this._timerHandler = Function.createDelegate(this, this._onIdle);
  5547. this._timerCookie = window.setTimeout(this._timerHandler, 100);
  5548. try {
  5549. this._initialState = this._deserializeState(this.get_stateString());
  5550. } catch(e) {}
  5551. this._historyInitialized = true;
  5552. }
  5553. };
  5554. Sys._Application.prototype._navigate = function Sys$_Application$_navigate(entry) {
  5555. this._ensureHistory();
  5556. var state = this._deserializeState(entry);
  5557. if (this._uniqueId) {
  5558. var oldServerEntry = this._state.__s || '';
  5559. var newServerEntry = state.__s || '';
  5560. if (newServerEntry !== oldServerEntry) {
  5561. this._updateHiddenField(newServerEntry);
  5562. __doPostBack(this._uniqueId, newServerEntry);
  5563. this._state = state;
  5564. return;
  5565. }
  5566. }
  5567. this._setState(entry);
  5568. this._state = state;
  5569. this._raiseNavigate();
  5570. };
  5571. Sys._Application.prototype._onIdle = function Sys$_Application$_onIdle() {
  5572. delete this._timerCookie;
  5573. var entry = this.get_stateString();
  5574. if (entry !== this._currentEntry) {
  5575. if (!this._ignoreTimer) {
  5576. this._historyPointIsNew = false;
  5577. this._navigate(entry);
  5578. }
  5579. }
  5580. else {
  5581. this._ignoreTimer = false;
  5582. }
  5583. this._timerCookie = window.setTimeout(this._timerHandler, 100);
  5584. };
  5585. Sys._Application.prototype._onIFrameLoad = function Sys$_Application$_onIFrameLoad(entry) {
  5586. this._ensureHistory();
  5587. if (!this._ignoreIFrame) {
  5588. this._historyPointIsNew = false;
  5589. this._navigate(entry);
  5590. }
  5591. this._ignoreIFrame = false;
  5592. };
  5593. Sys._Application.prototype._onPageRequestManagerBeginRequest = function Sys$_Application$_onPageRequestManagerBeginRequest(sender, args) {
  5594. this._ignoreTimer = true;
  5595. };
  5596. Sys._Application.prototype._onPageRequestManagerEndRequest = function Sys$_Application$_onPageRequestManagerEndRequest(sender, args) {
  5597. var dataItem = args.get_dataItems()[this._clientId];
  5598. var eventTarget = document.getElementById("__EVENTTARGET");
  5599. if (eventTarget && eventTarget.value === this._uniqueId) {
  5600. eventTarget.value = '';
  5601. }
  5602. if (typeof(dataItem) !== 'undefined') {
  5603. this.setServerState(dataItem);
  5604. this._historyPointIsNew = true;
  5605. }
  5606. else {
  5607. this._ignoreTimer = false;
  5608. }
  5609. var entry = this._serializeState(this._state);
  5610. if (entry !== this._currentEntry) {
  5611. this._ignoreTimer = true;
  5612. this._setState(entry);
  5613. this._raiseNavigate();
  5614. }
  5615. };
  5616. Sys._Application.prototype._raiseNavigate = function Sys$_Application$_raiseNavigate() {
  5617. var h = this.get_events().getHandler("navigate");
  5618. var stateClone = {};
  5619. for (var key in this._state) {
  5620. if (key !== '__s') {
  5621. stateClone[key] = this._state[key];
  5622. }
  5623. }
  5624. var args = new Sys.HistoryEventArgs(stateClone);
  5625. if (h) {
  5626. h(this, args);
  5627. }
  5628. var err;
  5629. try {
  5630. if ((Sys.Browser.agent === Sys.Browser.Firefox) && window.location.hash &&
  5631. (!window.frameElement || window.top.location.hash)) {
  5632. window.history.go(0);
  5633. }
  5634. }
  5635. catch(err) {
  5636. }
  5637. };
  5638. Sys._Application.prototype._serializeState = function Sys$_Application$_serializeState(state) {
  5639. var serialized = [];
  5640. for (var key in state) {
  5641. var value = state[key];
  5642. if (key === '__s') {
  5643. var serverState = value;
  5644. }
  5645. else {
  5646. if (key.indexOf('=') !== -1) throw Error.argument('state', Sys.Res.stateFieldNameInvalid);
  5647. serialized[serialized.length] = key + '=' + encodeURIComponent(value);
  5648. }
  5649. }
  5650. return serialized.join('&') + (serverState ? '&&' + serverState : '');
  5651. };
  5652. Sys._Application.prototype._setState = function Sys$_Application$_setState(entry, title) {
  5653. if (this._enableHistory) {
  5654. entry = entry || '';
  5655. if (entry !== this._currentEntry) {
  5656. if (window.theForm) {
  5657. var action = window.theForm.action;
  5658. var hashIndex = action.indexOf('#');
  5659. window.theForm.action = ((hashIndex !== -1) ? action.substring(0, hashIndex) : action) + '#' + entry;
  5660. }
  5661. if (this._historyFrame && this._historyPointIsNew) {
  5662. this._ignoreIFrame = true;
  5663. var frameDoc = this._historyFrame.contentWindow.document;
  5664. frameDoc.open("javascript:'<html></html>'");
  5665. frameDoc.write("<html><head><title>" + (title || document.title) +
  5666. "</title><scri" + "pt type=\"text/javascript\">parent.Sys.Application._onIFrameLoad(" +
  5667. Sys.Serialization.JavaScriptSerializer.serialize(entry) +
  5668. ");</scri" + "pt></head><body></body></html>");
  5669. frameDoc.close();
  5670. }
  5671. this._ignoreTimer = false;
  5672. this._currentEntry = entry;
  5673. if (this._historyFrame || this._historyPointIsNew) {
  5674. var currentHash = this.get_stateString();
  5675. if (entry !== currentHash) {
  5676. var loc = document.location;
  5677. if (loc.href.length - loc.hash.length + entry.length > 1024) {
  5678. throw Error.invalidOperation(Sys.Res.urlMustBeLessThan1024chars);
  5679. }
  5680. window.location.hash = entry;
  5681. this._currentEntry = this.get_stateString();
  5682. if ((typeof(title) !== 'undefined') && (title !== null)) {
  5683. document.title = title;
  5684. }
  5685. }
  5686. }
  5687. this._historyPointIsNew = false;
  5688. }
  5689. }
  5690. };
  5691. Sys._Application.prototype._updateHiddenField = function Sys$_Application$_updateHiddenField(value) {
  5692. if (this._clientId) {
  5693. var serverStateField = document.getElementById(this._clientId);
  5694. if (serverStateField) {
  5695. serverStateField.value = value;
  5696. }
  5697. }
  5698. };
  5699. if (!window.XMLHttpRequest) {
  5700. window.XMLHttpRequest = function window$XMLHttpRequest() {
  5701. var progIDs = [ 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP' ];
  5702. for (var i = 0, l = progIDs.length; i < l; i++) {
  5703. try {
  5704. return new ActiveXObject(progIDs[i]);
  5705. }
  5706. catch (ex) {
  5707. }
  5708. }
  5709. return null;
  5710. }
  5711. }
  5712. Type.registerNamespace('Sys.Net');
  5713. Sys.Net.WebRequestExecutor = function Sys$Net$WebRequestExecutor() {
  5714. /// <summary locid="M:J#Sys.Net.WebRequestExecutor.#ctor" />
  5715. if (arguments.length !== 0) throw Error.parameterCount();
  5716. this._webRequest = null;
  5717. this._resultObject = null;
  5718. }
  5719. function Sys$Net$WebRequestExecutor$get_webRequest() {
  5720. /// <value type="Sys.Net.WebRequest" locid="P:J#Sys.Net.WebRequestExecutor.webRequest"></value>
  5721. if (arguments.length !== 0) throw Error.parameterCount();
  5722. return this._webRequest;
  5723. }
  5724. function Sys$Net$WebRequestExecutor$_set_webRequest(value) {
  5725. if (this.get_started()) {
  5726. throw Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted, 'set_webRequest'));
  5727. }
  5728. this._webRequest = value;
  5729. }
  5730. function Sys$Net$WebRequestExecutor$get_started() {
  5731. /// <value type="Boolean" locid="P:J#Sys.Net.WebRequestExecutor.started"></value>
  5732. if (arguments.length !== 0) throw Error.parameterCount();
  5733. throw Error.notImplemented();
  5734. }
  5735. function Sys$Net$WebRequestExecutor$get_responseAvailable() {
  5736. /// <value type="Boolean" locid="P:J#Sys.Net.WebRequestExecutor.responseAvailable"></value>
  5737. if (arguments.length !== 0) throw Error.parameterCount();
  5738. throw Error.notImplemented();
  5739. }
  5740. function Sys$Net$WebRequestExecutor$get_timedOut() {
  5741. /// <value type="Boolean" locid="P:J#Sys.Net.WebRequestExecutor.timedOut"></value>
  5742. if (arguments.length !== 0) throw Error.parameterCount();
  5743. throw Error.notImplemented();
  5744. }
  5745. function Sys$Net$WebRequestExecutor$get_aborted() {
  5746. /// <value type="Boolean" locid="P:J#Sys.Net.WebRequestExecutor.aborted"></value>
  5747. if (arguments.length !== 0) throw Error.parameterCount();
  5748. throw Error.notImplemented();
  5749. }
  5750. function Sys$Net$WebRequestExecutor$get_responseData() {
  5751. /// <value type="String" locid="P:J#Sys.Net.WebRequestExecutor.responseData"></value>
  5752. if (arguments.length !== 0) throw Error.parameterCount();
  5753. throw Error.notImplemented();
  5754. }
  5755. function Sys$Net$WebRequestExecutor$get_statusCode() {
  5756. /// <value type="Number" locid="P:J#Sys.Net.WebRequestExecutor.statusCode"></value>
  5757. if (arguments.length !== 0) throw Error.parameterCount();
  5758. throw Error.notImplemented();
  5759. }
  5760. function Sys$Net$WebRequestExecutor$get_statusText() {
  5761. /// <value type="String" locid="P:J#Sys.Net.WebRequestExecutor.statusText"></value>
  5762. if (arguments.length !== 0) throw Error.parameterCount();
  5763. throw Error.notImplemented();
  5764. }
  5765. function Sys$Net$WebRequestExecutor$get_xml() {
  5766. /// <value locid="P:J#Sys.Net.WebRequestExecutor.xml"></value>
  5767. if (arguments.length !== 0) throw Error.parameterCount();
  5768. throw Error.notImplemented();
  5769. }
  5770. function Sys$Net$WebRequestExecutor$get_object() {
  5771. /// <value locid="P:J#Sys.Net.WebRequestExecutor.object"></value>
  5772. if (arguments.length !== 0) throw Error.parameterCount();
  5773. if (!this._resultObject) {
  5774. this._resultObject = Sys.Serialization.JavaScriptSerializer.deserialize(this.get_responseData());
  5775. }
  5776. return this._resultObject;
  5777. }
  5778. function Sys$Net$WebRequestExecutor$executeRequest() {
  5779. /// <summary locid="M:J#Sys.Net.WebRequestExecutor.executeRequest" />
  5780. if (arguments.length !== 0) throw Error.parameterCount();
  5781. throw Error.notImplemented();
  5782. }
  5783. function Sys$Net$WebRequestExecutor$abort() {
  5784. /// <summary locid="M:J#Sys.Net.WebRequestExecutor.abort" />
  5785. if (arguments.length !== 0) throw Error.parameterCount();
  5786. throw Error.notImplemented();
  5787. }
  5788. function Sys$Net$WebRequestExecutor$getResponseHeader(header) {
  5789. /// <summary locid="M:J#Sys.Net.WebRequestExecutor.getResponseHeader" />
  5790. /// <param name="header" type="String"></param>
  5791. var e = Function._validateParams(arguments, [
  5792. {name: "header", type: String}
  5793. ]);
  5794. if (e) throw e;
  5795. throw Error.notImplemented();
  5796. }
  5797. function Sys$Net$WebRequestExecutor$getAllResponseHeaders() {
  5798. /// <summary locid="M:J#Sys.Net.WebRequestExecutor.getAllResponseHeaders" />
  5799. if (arguments.length !== 0) throw Error.parameterCount();
  5800. throw Error.notImplemented();
  5801. }
  5802. Sys.Net.WebRequestExecutor.prototype = {
  5803. get_webRequest: Sys$Net$WebRequestExecutor$get_webRequest,
  5804. _set_webRequest: Sys$Net$WebRequestExecutor$_set_webRequest,
  5805. get_started: Sys$Net$WebRequestExecutor$get_started,
  5806. get_responseAvailable: Sys$Net$WebRequestExecutor$get_responseAvailable,
  5807. get_timedOut: Sys$Net$WebRequestExecutor$get_timedOut,
  5808. get_aborted: Sys$Net$WebRequestExecutor$get_aborted,
  5809. get_responseData: Sys$Net$WebRequestExecutor$get_responseData,
  5810. get_statusCode: Sys$Net$WebRequestExecutor$get_statusCode,
  5811. get_statusText: Sys$Net$WebRequestExecutor$get_statusText,
  5812. get_xml: Sys$Net$WebRequestExecutor$get_xml,
  5813. get_object: Sys$Net$WebRequestExecutor$get_object,
  5814. executeRequest: Sys$Net$WebRequestExecutor$executeRequest,
  5815. abort: Sys$Net$WebRequestExecutor$abort,
  5816. getResponseHeader: Sys$Net$WebRequestExecutor$getResponseHeader,
  5817. getAllResponseHeaders: Sys$Net$WebRequestExecutor$getAllResponseHeaders
  5818. }
  5819. Sys.Net.WebRequestExecutor.registerClass('Sys.Net.WebRequestExecutor');
  5820. Sys.Net.XMLDOM = function Sys$Net$XMLDOM(markup) {
  5821. /// <summary locid="M:J#Sys.Net.XMLDOM.#ctor" />
  5822. /// <param name="markup" type="String"></param>
  5823. var e = Function._validateParams(arguments, [
  5824. {name: "markup", type: String}
  5825. ]);
  5826. if (e) throw e;
  5827. if (!window.DOMParser) {
  5828. var progIDs = [ 'Msxml2.DOMDocument.3.0', 'Msxml2.DOMDocument' ];
  5829. for (var i = 0, l = progIDs.length; i < l; i++) {
  5830. try {
  5831. var xmlDOM = new ActiveXObject(progIDs[i]);
  5832. xmlDOM.async = false;
  5833. xmlDOM.loadXML(markup);
  5834. xmlDOM.setProperty('SelectionLanguage', 'XPath');
  5835. return xmlDOM;
  5836. }
  5837. catch (ex) {
  5838. }
  5839. }
  5840. }
  5841. else {
  5842. try {
  5843. var domParser = new window.DOMParser();
  5844. return domParser.parseFromString(markup, 'text/xml');
  5845. }
  5846. catch (ex) {
  5847. }
  5848. }
  5849. return null;
  5850. }
  5851. Sys.Net.XMLHttpExecutor = function Sys$Net$XMLHttpExecutor() {
  5852. /// <summary locid="M:J#Sys.Net.XMLHttpExecutor.#ctor" />
  5853. if (arguments.length !== 0) throw Error.parameterCount();
  5854. Sys.Net.XMLHttpExecutor.initializeBase(this);
  5855. var _this = this;
  5856. this._xmlHttpRequest = null;
  5857. this._webRequest = null;
  5858. this._responseAvailable = false;
  5859. this._timedOut = false;
  5860. this._timer = null;
  5861. this._aborted = false;
  5862. this._started = false;
  5863. this._onReadyStateChange = (function () {
  5864. if (_this._xmlHttpRequest.readyState === 4 ) {
  5865. try {
  5866. if (typeof(_this._xmlHttpRequest.status) === "undefined") {
  5867. return;
  5868. }
  5869. }
  5870. catch(ex) {
  5871. return;
  5872. }
  5873. _this._clearTimer();
  5874. _this._responseAvailable = true;
  5875. _this._webRequest.completed(Sys.EventArgs.Empty);
  5876. if (_this._xmlHttpRequest != null) {
  5877. _this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
  5878. _this._xmlHttpRequest = null;
  5879. }
  5880. }
  5881. });
  5882. this._clearTimer = (function() {
  5883. if (_this._timer != null) {
  5884. window.clearTimeout(_this._timer);
  5885. _this._timer = null;
  5886. }
  5887. });
  5888. this._onTimeout = (function() {
  5889. if (!_this._responseAvailable) {
  5890. _this._clearTimer();
  5891. _this._timedOut = true;
  5892. _this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
  5893. _this._xmlHttpRequest.abort();
  5894. _this._webRequest.completed(Sys.EventArgs.Empty);
  5895. _this._xmlHttpRequest = null;
  5896. }
  5897. });
  5898. }
  5899. function Sys$Net$XMLHttpExecutor$get_timedOut() {
  5900. /// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.timedOut"></value>
  5901. if (arguments.length !== 0) throw Error.parameterCount();
  5902. return this._timedOut;
  5903. }
  5904. function Sys$Net$XMLHttpExecutor$get_started() {
  5905. /// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.started"></value>
  5906. if (arguments.length !== 0) throw Error.parameterCount();
  5907. return this._started;
  5908. }
  5909. function Sys$Net$XMLHttpExecutor$get_responseAvailable() {
  5910. /// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.responseAvailable"></value>
  5911. if (arguments.length !== 0) throw Error.parameterCount();
  5912. return this._responseAvailable;
  5913. }
  5914. function Sys$Net$XMLHttpExecutor$get_aborted() {
  5915. /// <value type="Boolean" locid="P:J#Sys.Net.XMLHttpExecutor.aborted"></value>
  5916. if (arguments.length !== 0) throw Error.parameterCount();
  5917. return this._aborted;
  5918. }
  5919. function Sys$Net$XMLHttpExecutor$executeRequest() {
  5920. /// <summary locid="M:J#Sys.Net.XMLHttpExecutor.executeRequest" />
  5921. if (arguments.length !== 0) throw Error.parameterCount();
  5922. this._webRequest = this.get_webRequest();
  5923. if (this._started) {
  5924. throw Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted, 'executeRequest'));
  5925. }
  5926. if (this._webRequest === null) {
  5927. throw Error.invalidOperation(Sys.Res.nullWebRequest);
  5928. }
  5929. var body = this._webRequest.get_body();
  5930. var headers = this._webRequest.get_headers();
  5931. this._xmlHttpRequest = new XMLHttpRequest();
  5932. this._xmlHttpRequest.onreadystatechange = this._onReadyStateChange;
  5933. var verb = this._webRequest.get_httpVerb();
  5934. this._xmlHttpRequest.open(verb, this._webRequest.getResolvedUrl(), true );
  5935. this._xmlHttpRequest.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  5936. if (headers) {
  5937. for (var header in headers) {
  5938. var val = headers[header];
  5939. if (typeof(val) !== "function")
  5940. this._xmlHttpRequest.setRequestHeader(header, val);
  5941. }
  5942. }
  5943. if (verb.toLowerCase() === "post") {
  5944. if ((headers === null) || !headers['Content-Type']) {
  5945. this._xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
  5946. }
  5947. if (!body) {
  5948. body = "";
  5949. }
  5950. }
  5951. var timeout = this._webRequest.get_timeout();
  5952. if (timeout > 0) {
  5953. this._timer = window.setTimeout(Function.createDelegate(this, this._onTimeout), timeout);
  5954. }
  5955. this._xmlHttpRequest.send(body);
  5956. this._started = true;
  5957. }
  5958. function Sys$Net$XMLHttpExecutor$getResponseHeader(header) {
  5959. /// <summary locid="M:J#Sys.Net.XMLHttpExecutor.getResponseHeader" />
  5960. /// <param name="header" type="String"></param>
  5961. /// <returns type="String"></returns>
  5962. var e = Function._validateParams(arguments, [
  5963. {name: "header", type: String}
  5964. ]);
  5965. if (e) throw e;
  5966. if (!this._responseAvailable) {
  5967. throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'getResponseHeader'));
  5968. }
  5969. if (!this._xmlHttpRequest) {
  5970. throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'getResponseHeader'));
  5971. }
  5972. var result;
  5973. try {
  5974. result = this._xmlHttpRequest.getResponseHeader(header);
  5975. } catch (e) {
  5976. }
  5977. if (!result) result = "";
  5978. return result;
  5979. }
  5980. function Sys$Net$XMLHttpExecutor$getAllResponseHeaders() {
  5981. /// <summary locid="M:J#Sys.Net.XMLHttpExecutor.getAllResponseHeaders" />
  5982. /// <returns type="String"></returns>
  5983. if (arguments.length !== 0) throw Error.parameterCount();
  5984. if (!this._responseAvailable) {
  5985. throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'getAllResponseHeaders'));
  5986. }
  5987. if (!this._xmlHttpRequest) {
  5988. throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'getAllResponseHeaders'));
  5989. }
  5990. return this._xmlHttpRequest.getAllResponseHeaders();
  5991. }
  5992. function Sys$Net$XMLHttpExecutor$get_responseData() {
  5993. /// <value type="String" locid="P:J#Sys.Net.XMLHttpExecutor.responseData"></value>
  5994. if (arguments.length !== 0) throw Error.parameterCount();
  5995. if (!this._responseAvailable) {
  5996. throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_responseData'));
  5997. }
  5998. if (!this._xmlHttpRequest) {
  5999. throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_responseData'));
  6000. }
  6001. return this._xmlHttpRequest.responseText;
  6002. }
  6003. function Sys$Net$XMLHttpExecutor$get_statusCode() {
  6004. /// <value type="Number" locid="P:J#Sys.Net.XMLHttpExecutor.statusCode"></value>
  6005. if (arguments.length !== 0) throw Error.parameterCount();
  6006. if (!this._responseAvailable) {
  6007. throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_statusCode'));
  6008. }
  6009. if (!this._xmlHttpRequest) {
  6010. throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_statusCode'));
  6011. }
  6012. var result = 0;
  6013. try {
  6014. result = this._xmlHttpRequest.status;
  6015. }
  6016. catch(ex) {
  6017. }
  6018. return result;
  6019. }
  6020. function Sys$Net$XMLHttpExecutor$get_statusText() {
  6021. /// <value type="String" locid="P:J#Sys.Net.XMLHttpExecutor.statusText"></value>
  6022. if (arguments.length !== 0) throw Error.parameterCount();
  6023. if (!this._responseAvailable) {
  6024. throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_statusText'));
  6025. }
  6026. if (!this._xmlHttpRequest) {
  6027. throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_statusText'));
  6028. }
  6029. return this._xmlHttpRequest.statusText;
  6030. }
  6031. function Sys$Net$XMLHttpExecutor$get_xml() {
  6032. /// <value locid="P:J#Sys.Net.XMLHttpExecutor.xml"></value>
  6033. if (arguments.length !== 0) throw Error.parameterCount();
  6034. if (!this._responseAvailable) {
  6035. throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_xml'));
  6036. }
  6037. if (!this._xmlHttpRequest) {
  6038. throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_xml'));
  6039. }
  6040. var xml = this._xmlHttpRequest.responseXML;
  6041. if (!xml || !xml.documentElement) {
  6042. xml = Sys.Net.XMLDOM(this._xmlHttpRequest.responseText);
  6043. if (!xml || !xml.documentElement)
  6044. return null;
  6045. }
  6046. else if (navigator.userAgent.indexOf('MSIE') !== -1) {
  6047. xml.setProperty('SelectionLanguage', 'XPath');
  6048. }
  6049. if (xml.documentElement.namespaceURI === "http://www.mozilla.org/newlayout/xml/parsererror.xml" &&
  6050. xml.documentElement.tagName === "parsererror") {
  6051. return null;
  6052. }
  6053. if (xml.documentElement.firstChild && xml.documentElement.firstChild.tagName === "parsererror") {
  6054. return null;
  6055. }
  6056. return xml;
  6057. }
  6058. function Sys$Net$XMLHttpExecutor$abort() {
  6059. /// <summary locid="M:J#Sys.Net.XMLHttpExecutor.abort" />
  6060. if (arguments.length !== 0) throw Error.parameterCount();
  6061. if (!this._started) {
  6062. throw Error.invalidOperation(Sys.Res.cannotAbortBeforeStart);
  6063. }
  6064. if (this._aborted || this._responseAvailable || this._timedOut)
  6065. return;
  6066. this._aborted = true;
  6067. this._clearTimer();
  6068. if (this._xmlHttpRequest && !this._responseAvailable) {
  6069. this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
  6070. this._xmlHttpRequest.abort();
  6071. this._xmlHttpRequest = null;
  6072. this._webRequest.completed(Sys.EventArgs.Empty);
  6073. }
  6074. }
  6075. Sys.Net.XMLHttpExecutor.prototype = {
  6076. get_timedOut: Sys$Net$XMLHttpExecutor$get_timedOut,
  6077. get_started: Sys$Net$XMLHttpExecutor$get_started,
  6078. get_responseAvailable: Sys$Net$XMLHttpExecutor$get_responseAvailable,
  6079. get_aborted: Sys$Net$XMLHttpExecutor$get_aborted,
  6080. executeRequest: Sys$Net$XMLHttpExecutor$executeRequest,
  6081. getResponseHeader: Sys$Net$XMLHttpExecutor$getResponseHeader,
  6082. getAllResponseHeaders: Sys$Net$XMLHttpExecutor$getAllResponseHeaders,
  6083. get_responseData: Sys$Net$XMLHttpExecutor$get_responseData,
  6084. get_statusCode: Sys$Net$XMLHttpExecutor$get_statusCode,
  6085. get_statusText: Sys$Net$XMLHttpExecutor$get_statusText,
  6086. get_xml: Sys$Net$XMLHttpExecutor$get_xml,
  6087. abort: Sys$Net$XMLHttpExecutor$abort
  6088. }
  6089. Sys.Net.XMLHttpExecutor.registerClass('Sys.Net.XMLHttpExecutor', Sys.Net.WebRequestExecutor);
  6090. Sys.Net._WebRequestManager = function Sys$Net$_WebRequestManager() {
  6091. /// <summary locid="P:J#Sys.Net.WebRequestManager.#ctor" />
  6092. if (arguments.length !== 0) throw Error.parameterCount();
  6093. this._defaultTimeout = 0;
  6094. this._defaultExecutorType = "Sys.Net.XMLHttpExecutor";
  6095. }
  6096. function Sys$Net$_WebRequestManager$add_invokingRequest(handler) {
  6097. /// <summary locid="E:J#Sys.Net.WebRequestManager.invokingRequest" />
  6098. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  6099. if (e) throw e;
  6100. this._get_eventHandlerList().addHandler("invokingRequest", handler);
  6101. }
  6102. function Sys$Net$_WebRequestManager$remove_invokingRequest(handler) {
  6103. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  6104. if (e) throw e;
  6105. this._get_eventHandlerList().removeHandler("invokingRequest", handler);
  6106. }
  6107. function Sys$Net$_WebRequestManager$add_completedRequest(handler) {
  6108. /// <summary locid="E:J#Sys.Net.WebRequestManager.completedRequest" />
  6109. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  6110. if (e) throw e;
  6111. this._get_eventHandlerList().addHandler("completedRequest", handler);
  6112. }
  6113. function Sys$Net$_WebRequestManager$remove_completedRequest(handler) {
  6114. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  6115. if (e) throw e;
  6116. this._get_eventHandlerList().removeHandler("completedRequest", handler);
  6117. }
  6118. function Sys$Net$_WebRequestManager$_get_eventHandlerList() {
  6119. if (!this._events) {
  6120. this._events = new Sys.EventHandlerList();
  6121. }
  6122. return this._events;
  6123. }
  6124. function Sys$Net$_WebRequestManager$get_defaultTimeout() {
  6125. /// <value type="Number" locid="P:J#Sys.Net.WebRequestManager.defaultTimeout"></value>
  6126. if (arguments.length !== 0) throw Error.parameterCount();
  6127. return this._defaultTimeout;
  6128. }
  6129. function Sys$Net$_WebRequestManager$set_defaultTimeout(value) {
  6130. var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
  6131. if (e) throw e;
  6132. if (value < 0) {
  6133. throw Error.argumentOutOfRange("value", value, Sys.Res.invalidTimeout);
  6134. }
  6135. this._defaultTimeout = value;
  6136. }
  6137. function Sys$Net$_WebRequestManager$get_defaultExecutorType() {
  6138. /// <value type="String" locid="P:J#Sys.Net.WebRequestManager.defaultExecutorType"></value>
  6139. if (arguments.length !== 0) throw Error.parameterCount();
  6140. return this._defaultExecutorType;
  6141. }
  6142. function Sys$Net$_WebRequestManager$set_defaultExecutorType(value) {
  6143. var e = Function._validateParams(arguments, [{name: "value", type: String}]);
  6144. if (e) throw e;
  6145. this._defaultExecutorType = value;
  6146. }
  6147. function Sys$Net$_WebRequestManager$executeRequest(webRequest) {
  6148. /// <summary locid="M:J#Sys.Net.WebRequestManager.executeRequest" />
  6149. /// <param name="webRequest" type="Sys.Net.WebRequest"></param>
  6150. var e = Function._validateParams(arguments, [
  6151. {name: "webRequest", type: Sys.Net.WebRequest}
  6152. ]);
  6153. if (e) throw e;
  6154. var executor = webRequest.get_executor();
  6155. if (!executor) {
  6156. var failed = false;
  6157. try {
  6158. var executorType = eval(this._defaultExecutorType);
  6159. executor = new executorType();
  6160. } catch (e) {
  6161. failed = true;
  6162. }
  6163. if (failed || !Sys.Net.WebRequestExecutor.isInstanceOfType(executor) || !executor) {
  6164. throw Error.argument("defaultExecutorType", String.format(Sys.Res.invalidExecutorType, this._defaultExecutorType));
  6165. }
  6166. webRequest.set_executor(executor);
  6167. }
  6168. if (executor.get_aborted()) {
  6169. return;
  6170. }
  6171. var evArgs = new Sys.Net.NetworkRequestEventArgs(webRequest);
  6172. var handler = this._get_eventHandlerList().getHandler("invokingRequest");
  6173. if (handler) {
  6174. handler(this, evArgs);
  6175. }
  6176. if (!evArgs.get_cancel()) {
  6177. executor.executeRequest();
  6178. }
  6179. }
  6180. Sys.Net._WebRequestManager.prototype = {
  6181. add_invokingRequest: Sys$Net$_WebRequestManager$add_invokingRequest,
  6182. remove_invokingRequest: Sys$Net$_WebRequestManager$remove_invokingRequest,
  6183. add_completedRequest: Sys$Net$_WebRequestManager$add_completedRequest,
  6184. remove_completedRequest: Sys$Net$_WebRequestManager$remove_completedRequest,
  6185. _get_eventHandlerList: Sys$Net$_WebRequestManager$_get_eventHandlerList,
  6186. get_defaultTimeout: Sys$Net$_WebRequestManager$get_defaultTimeout,
  6187. set_defaultTimeout: Sys$Net$_WebRequestManager$set_defaultTimeout,
  6188. get_defaultExecutorType: Sys$Net$_WebRequestManager$get_defaultExecutorType,
  6189. set_defaultExecutorType: Sys$Net$_WebRequestManager$set_defaultExecutorType,
  6190. executeRequest: Sys$Net$_WebRequestManager$executeRequest
  6191. }
  6192. Sys.Net._WebRequestManager.registerClass('Sys.Net._WebRequestManager');
  6193. Sys.Net.WebRequestManager = new Sys.Net._WebRequestManager();
  6194. Sys.Net.NetworkRequestEventArgs = function Sys$Net$NetworkRequestEventArgs(webRequest) {
  6195. /// <summary locid="M:J#Sys.Net.NetworkRequestEventArgs.#ctor" />
  6196. /// <param name="webRequest" type="Sys.Net.WebRequest"></param>
  6197. var e = Function._validateParams(arguments, [
  6198. {name: "webRequest", type: Sys.Net.WebRequest}
  6199. ]);
  6200. if (e) throw e;
  6201. Sys.Net.NetworkRequestEventArgs.initializeBase(this);
  6202. this._webRequest = webRequest;
  6203. }
  6204. function Sys$Net$NetworkRequestEventArgs$get_webRequest() {
  6205. /// <value type="Sys.Net.WebRequest" locid="P:J#Sys.Net.NetworkRequestEventArgs.webRequest"></value>
  6206. if (arguments.length !== 0) throw Error.parameterCount();
  6207. return this._webRequest;
  6208. }
  6209. Sys.Net.NetworkRequestEventArgs.prototype = {
  6210. get_webRequest: Sys$Net$NetworkRequestEventArgs$get_webRequest
  6211. }
  6212. Sys.Net.NetworkRequestEventArgs.registerClass('Sys.Net.NetworkRequestEventArgs', Sys.CancelEventArgs);
  6213. Sys.Net.WebRequest = function Sys$Net$WebRequest() {
  6214. /// <summary locid="M:J#Sys.Net.WebRequest.#ctor" />
  6215. if (arguments.length !== 0) throw Error.parameterCount();
  6216. this._url = "";
  6217. this._headers = { };
  6218. this._body = null;
  6219. this._userContext = null;
  6220. this._httpVerb = null;
  6221. this._executor = null;
  6222. this._invokeCalled = false;
  6223. this._timeout = 0;
  6224. }
  6225. function Sys$Net$WebRequest$add_completed(handler) {
  6226. /// <summary locid="E:J#Sys.Net.WebRequest.completed" />
  6227. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  6228. if (e) throw e;
  6229. this._get_eventHandlerList().addHandler("completed", handler);
  6230. }
  6231. function Sys$Net$WebRequest$remove_completed(handler) {
  6232. var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
  6233. if (e) throw e;
  6234. this._get_eventHandlerList().removeHandler("completed", handler);
  6235. }
  6236. function Sys$Net$WebRequest$completed(eventArgs) {
  6237. /// <summary locid="M:J#Sys.Net.WebRequest.completed" />
  6238. /// <param name="eventArgs" type="Sys.EventArgs"></param>
  6239. var e = Function._validateParams(arguments, [
  6240. {name: "eventArgs", type: Sys.EventArgs}
  6241. ]);
  6242. if (e) throw e;
  6243. var handler = Sys.Net.WebRequestManager._get_eventHandlerList().getHandler("completedRequest");
  6244. if (handler) {
  6245. handler(this._executor, eventArgs);
  6246. }
  6247. handler = this._get_eventHandlerList().getHandler("completed");
  6248. if (handler) {
  6249. handler(this._executor, eventArgs);
  6250. }
  6251. }
  6252. function Sys$Net$WebRequest$_get_eventHandlerList() {
  6253. if (!this._events) {
  6254. this._events = new Sys.EventHandlerList();
  6255. }
  6256. return this._events;
  6257. }
  6258. function Sys$Net$WebRequest$get_url() {
  6259. /// <value type="String" locid="P:J#Sys.Net.WebRequest.url"></value>
  6260. if (arguments.length !== 0) throw Error.parameterCount();
  6261. return this._url;
  6262. }
  6263. function Sys$Net$WebRequest$set_url(value) {
  6264. var e = Function._validateParams(arguments, [{name: "value", type: String}]);
  6265. if (e) throw e;
  6266. this._url = value;
  6267. }
  6268. function Sys$Net$WebRequest$get_headers() {
  6269. /// <value locid="P:J#Sys.Net.WebRequest.headers"></value>
  6270. if (arguments.length !== 0) throw Error.parameterCount();
  6271. return this._headers;
  6272. }
  6273. function Sys$Net$WebRequest$get_httpVerb() {
  6274. /// <value type="String" locid="P:J#Sys.Net.WebRequest.httpVerb"></value>
  6275. if (arguments.length !== 0) throw Error.parameterCount();
  6276. if (this._httpVerb === null) {
  6277. if (this._body === null) {
  6278. return "GET";
  6279. }
  6280. return "POST";
  6281. }
  6282. return this._httpVerb;
  6283. }
  6284. function Sys$Net$WebRequest$set_httpVerb(value) {
  6285. var e = Function._validateParams(arguments, [{name: "value", type: String}]);
  6286. if (e) throw e;
  6287. if (value.length === 0) {
  6288. throw Error.argument('value', Sys.Res.invalidHttpVerb);
  6289. }
  6290. this._httpVerb = value;
  6291. }
  6292. function Sys$Net$WebRequest$get_body() {
  6293. /// <value mayBeNull="true" locid="P:J#Sys.Net.WebRequest.body"></value>
  6294. if (arguments.length !== 0) throw Error.parameterCount();
  6295. return this._body;
  6296. }
  6297. function Sys$Net$WebRequest$set_body(value) {
  6298. var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
  6299. if (e) throw e;
  6300. this._body = value;
  6301. }
  6302. function Sys$Net$WebRequest$get_userContext() {
  6303. /// <value mayBeNull="true" locid="P:J#Sys.Net.WebRequest.userContext"></value>
  6304. if (arguments.length !== 0) throw Error.parameterCount();
  6305. return this._userContext;
  6306. }
  6307. function Sys$Net$WebRequest$set_userContext(value) {
  6308. var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
  6309. if (e) throw e;
  6310. this._userContext = value;
  6311. }
  6312. function Sys$Net$WebRequest$get_executor() {
  6313. /// <value type="Sys.Net.WebRequestExecutor" locid="P:J#Sys.Net.WebRequest.executor"></value>
  6314. if (arguments.length !== 0) throw Error.parameterCount();
  6315. return this._executor;
  6316. }
  6317. function Sys$Net$WebRequest$set_executor(value) {
  6318. var e = Function._validateParams(arguments, [{name: "value", type: Sys.Net.WebRequestExecutor}]);
  6319. if (e) throw e;
  6320. if (this._executor !== null && this._executor.get_started()) {
  6321. throw Error.invalidOperation(Sys.Res.setExecutorAfterActive);
  6322. }
  6323. this._executor = value;
  6324. this._executor._set_webRequest(this);
  6325. }
  6326. function Sys$Net$WebRequest$get_timeout() {
  6327. /// <value type="Number" locid="P:J#Sys.Net.WebRequest.timeout"></value>
  6328. if (arguments.length !== 0) throw Error.parameterCount();
  6329. if (this._timeout === 0) {
  6330. return Sys.Net.WebRequestManager.get_defaultTimeout();
  6331. }
  6332. return this._timeout;
  6333. }
  6334. function Sys$Net$WebRequest$set_timeout(value) {
  6335. var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
  6336. if (e) throw e;
  6337. if (value < 0) {
  6338. throw Error.argumentOutOfRange("value", value, Sys.Res.invalidTimeout);
  6339. }
  6340. this._timeout = value;
  6341. }
  6342. function Sys$Net$WebRequest$getResolvedUrl() {
  6343. /// <summary locid="M:J#Sys.Net.WebRequest.getResolvedUrl" />
  6344. /// <returns type="String"></returns>
  6345. if (arguments.length !== 0) throw Error.parameterCount();
  6346. return Sys.Net.WebRequest._resolveUrl(this._url);
  6347. }
  6348. function Sys$Net$WebRequest$invoke() {
  6349. /// <summary locid="M:J#Sys.Net.WebRequest.invoke" />
  6350. if (arguments.length !== 0) throw Error.parameterCount();
  6351. if (this._invokeCalled) {
  6352. throw Error.invalidOperation(Sys.Res.invokeCalledTwice);
  6353. }
  6354. Sys.Net.WebRequestManager.executeRequest(this);
  6355. this._invokeCalled = true;
  6356. }
  6357. Sys.Net.WebRequest.prototype = {
  6358. add_completed: Sys$Net$WebRequest$add_completed,
  6359. remove_completed: Sys$Net$WebRequest$remove_completed,
  6360. completed: Sys$Net$WebRequest$completed,
  6361. _get_eventHandlerList: Sys$Net$WebRequest$_get_eventHandlerList,
  6362. get_url: Sys$Net$WebRequest$get_url,
  6363. set_url: Sys$Net$WebRequest$set_url,
  6364. get_headers: Sys$Net$WebRequest$get_headers,
  6365. get_httpVerb: Sys$Net$WebRequest$get_httpVerb,
  6366. set_httpVerb: Sys$Net$WebRequest$set_httpVerb,
  6367. get_body: Sys$Net$WebRequest$get_body,
  6368. set_body: Sys$Net$WebRequest$set_body,
  6369. get_userContext: Sys$Net$WebRequest$get_userContext,
  6370. set_userContext: Sys$Net$WebRequest$set_userContext,
  6371. get_executor: Sys$Net$WebRequest$get_executor,
  6372. set_executor: Sys$Net$WebRequest$set_executor,
  6373. get_timeout: Sys$Net$WebRequest$get_timeout,
  6374. set_timeout: Sys$Net$WebRequest$set_timeout,
  6375. getResolvedUrl: Sys$Net$WebRequest$getResolvedUrl,
  6376. invoke: Sys$Net$WebRequest$invoke
  6377. }
  6378. Sys.Net.WebRequest._resolveUrl = function Sys$Net$WebRequest$_resolveUrl(url, baseUrl) {
  6379. if (url && url.indexOf('://') !== -1) {
  6380. return url;
  6381. }
  6382. if (!baseUrl || baseUrl.length === 0) {
  6383. var baseElement = document.getElementsByTagName('base')[0];
  6384. if (baseElement && baseElement.href && baseElement.href.length > 0) {
  6385. baseUrl = baseElement.href;
  6386. }
  6387. else {
  6388. baseUrl = document.URL;
  6389. }
  6390. }
  6391. var qsStart = baseUrl.indexOf('?');
  6392. if (qsStart !== -1) {
  6393. baseUrl = baseUrl.substr(0, qsStart);
  6394. }
  6395. qsStart = baseUrl.indexOf('#');
  6396. if (qsStart !== -1) {
  6397. baseUrl = baseUrl.substr(0, qsStart);
  6398. }
  6399. baseUrl = baseUrl.substr(0, baseUrl.lastIndexOf('/') + 1);
  6400. if (!url || url.length === 0) {
  6401. return baseUrl;
  6402. }
  6403. if (url.charAt(0) === '/') {
  6404. var slashslash = baseUrl.indexOf('://');
  6405. if (slashslash === -1) {
  6406. throw Error.argument("baseUrl", Sys.Res.badBaseUrl1);
  6407. }
  6408. var nextSlash = baseUrl.indexOf('/', slashslash + 3);
  6409. if (nextSlash === -1) {
  6410. throw Error.argument("baseUrl", Sys.Res.badBaseUrl2);
  6411. }
  6412. return baseUrl.substr(0, nextSlash) + url;
  6413. }
  6414. else {
  6415. var lastSlash = baseUrl.lastIndexOf('/');
  6416. if (lastSlash === -1) {
  6417. throw Error.argument("baseUrl", Sys.Res.badBaseUrl3);
  6418. }
  6419. return baseUrl.substr(0, lastSlash+1) + url;
  6420. }
  6421. }
  6422. Sys.Net.WebRequest._createQueryString = function Sys$Net$WebRequest$_createQueryString(queryString, encodeMethod, addParams) {
  6423. encodeMethod = encodeMethod || encodeURIComponent;
  6424. var i = 0, obj, val, arg, sb = new Sys.StringBuilder();
  6425. if (queryString) {
  6426. for (arg in queryString) {
  6427. obj = queryString[arg];
  6428. if (typeof(obj) === "function") continue;
  6429. val = Sys.Serialization.JavaScriptSerializer.serialize(obj);
  6430. if (i++) {
  6431. sb.append('&');
  6432. }
  6433. sb.append(arg);
  6434. sb.append('=');
  6435. sb.append(encodeMethod(val));
  6436. }
  6437. }
  6438. if (addParams) {
  6439. if (i) {
  6440. sb.append('&');
  6441. }
  6442. sb.append(addParams);
  6443. }
  6444. return sb.toString();
  6445. }
  6446. Sys.Net.WebRequest._createUrl = function Sys$Net$WebRequest$_createUrl(url, queryString, addParams) {
  6447. if (!queryString && !addParams) {
  6448. return url;
  6449. }
  6450. var qs = Sys.Net.WebRequest._createQueryString(queryString, null, addParams);
  6451. return qs.length
  6452. ? url + ((url && url.indexOf('?') >= 0) ? "&" : "?") + qs
  6453. : url;
  6454. }
  6455. Sys.Net.WebRequest.registerClass('Sys.Net.WebRequest');
  6456. Sys._ScriptLoaderTask = function Sys$_ScriptLoaderTask(scriptElement, completedCallback) {
  6457. /// <summary locid="M:J#Sys._ScriptLoaderTask.#ctor" />
  6458. /// <param name="scriptElement" domElement="true"></param>
  6459. /// <param name="completedCallback" type="Function"></param>
  6460. var e = Function._validateParams(arguments, [
  6461. {name: "scriptElement", domElement: true},
  6462. {name: "completedCallback", type: Function}
  6463. ]);
  6464. if (e) throw e;
  6465. this._scriptElement = scriptElement;
  6466. this._completedCallback = completedCallback;
  6467. }
  6468. function Sys$_ScriptLoaderTask$get_scriptElement() {
  6469. /// <value domElement="true" locid="P:J#Sys._ScriptLoaderTask.scriptElement"></value>
  6470. if (arguments.length !== 0) throw Error.parameterCount();
  6471. return this._scriptElement;
  6472. }
  6473. function Sys$_ScriptLoaderTask$dispose() {
  6474. if(this._disposed) {
  6475. return;
  6476. }
  6477. this._disposed = true;
  6478. this._removeScriptElementHandlers();
  6479. Sys._ScriptLoaderTask._clearScript(this._scriptElement);
  6480. this._scriptElement = null;
  6481. }
  6482. function Sys$_ScriptLoaderTask$execute() {
  6483. /// <summary locid="M:J#Sys._ScriptLoaderTask.execute" />
  6484. if (arguments.length !== 0) throw Error.parameterCount();
  6485. this._addScriptElementHandlers();
  6486. var headElements = document.getElementsByTagName('head');
  6487. if (headElements.length === 0) {
  6488. throw new Error.invalidOperation(Sys.Res.scriptLoadFailedNoHead);
  6489. }
  6490. else {
  6491. headElements[0].appendChild(this._scriptElement);
  6492. }
  6493. }
  6494. function Sys$_ScriptLoaderTask$_addScriptElementHandlers() {
  6495. this._scriptLoadDelegate = Function.createDelegate(this, this._scriptLoadHandler);
  6496. if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) {
  6497. this._scriptElement.readyState = 'loaded';
  6498. $addHandler(this._scriptElement, 'load', this._scriptLoadDelegate);
  6499. }
  6500. else {
  6501. $addHandler(this._scriptElement, 'readystatechange', this._scriptLoadDelegate);
  6502. }
  6503. if (this._scriptElement.addEventListener) {
  6504. this._scriptErrorDelegate = Function.createDelegate(this, this._scriptErrorHandler);
  6505. this._scriptElement.addEventListener('error', this._scriptErrorDelegate, false);
  6506. }
  6507. }
  6508. function Sys$_ScriptLoaderTask$_removeScriptElementHandlers() {
  6509. if(this._scriptLoadDelegate) {
  6510. var scriptElement = this.get_scriptElement();
  6511. if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) {
  6512. $removeHandler(scriptElement, 'load', this._scriptLoadDelegate);
  6513. }
  6514. else {
  6515. $removeHandler(scriptElement, 'readystatechange', this._scriptLoadDelegate);
  6516. }
  6517. if (this._scriptErrorDelegate) {
  6518. this._scriptElement.removeEventListener('error', this._scriptErrorDelegate, false);
  6519. this._scriptErrorDelegate = null;
  6520. }
  6521. this._scriptLoadDelegate = null;
  6522. }
  6523. }
  6524. function Sys$_ScriptLoaderTask$_scriptErrorHandler() {
  6525. if(this._disposed) {
  6526. return;
  6527. }
  6528. this._completedCallback(this.get_scriptElement(), false);
  6529. }
  6530. function Sys$_ScriptLoaderTask$_scriptLoadHandler() {
  6531. if(this._disposed) {
  6532. return;
  6533. }
  6534. var scriptElement = this.get_scriptElement();
  6535. if ((scriptElement.readyState !== 'loaded') &&
  6536. (scriptElement.readyState !== 'complete')) {
  6537. return;
  6538. }
  6539. this._completedCallback(scriptElement, true);
  6540. }
  6541. Sys._ScriptLoaderTask.prototype = {
  6542. get_scriptElement: Sys$_ScriptLoaderTask$get_scriptElement,
  6543. dispose: Sys$_ScriptLoaderTask$dispose,
  6544. execute: Sys$_ScriptLoaderTask$execute,
  6545. _addScriptElementHandlers: Sys$_ScriptLoaderTask$_addScriptElementHandlers,
  6546. _removeScriptElementHandlers: Sys$_ScriptLoaderTask$_removeScriptElementHandlers,
  6547. _scriptErrorHandler: Sys$_ScriptLoaderTask$_scriptErrorHandler,
  6548. _scriptLoadHandler: Sys$_ScriptLoaderTask$_scriptLoadHandler
  6549. }
  6550. Sys._ScriptLoaderTask.registerClass("Sys._ScriptLoaderTask", null, Sys.IDisposable);
  6551. Sys._ScriptLoaderTask._clearScript = function Sys$_ScriptLoaderTask$_clearScript(scriptElement) {
  6552. if (!Sys.Debug.isDebug) {
  6553. scriptElement.parentNode.removeChild(scriptElement);
  6554. }
  6555. }
  6556. Type.registerNamespace('Sys.Net');
  6557. Sys.Net.WebServiceProxy = function Sys$Net$WebServiceProxy() {
  6558. }
  6559. function Sys$Net$WebServiceProxy$get_timeout() {
  6560. /// <value type="Number" locid="P:J#Sys.Net.WebServiceProxy.timeout"></value>
  6561. if (arguments.length !== 0) throw Error.parameterCount();
  6562. return this._timeout || 0;
  6563. }
  6564. function Sys$Net$WebServiceProxy$set_timeout(value) {
  6565. var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
  6566. if (e) throw e;
  6567. if (value < 0) { throw Error.argumentOutOfRange('value', value, Sys.Res.invalidTimeout); }
  6568. this._timeout = value;
  6569. }
  6570. function Sys$Net$WebServiceProxy$get_defaultUserContext() {
  6571. /// <value mayBeNull="true" locid="P:J#Sys.Net.WebServiceProxy.defaultUserContext"></value>
  6572. if (arguments.length !== 0) throw Error.parameterCount();
  6573. return (typeof(this._userContext) === "undefined") ? null : this._userContext;
  6574. }
  6575. function Sys$Net$WebServiceProxy$set_defaultUserContext(value) {
  6576. var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
  6577. if (e) throw e;
  6578. this._userContext = value;
  6579. }
  6580. function Sys$Net$WebServiceProxy$get_defaultSucceededCallback() {
  6581. /// <value type="Function" mayBeNull="true" locid="P:J#Sys.Net.WebServiceProxy.defaultSucceededCallback"></value>
  6582. if (arguments.length !== 0) throw Error.parameterCount();
  6583. return this._succeeded || null;
  6584. }
  6585. function Sys$Net$WebServiceProxy$set_defaultSucceededCallback(value) {
  6586. var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]);
  6587. if (e) throw e;
  6588. this._succeeded = value;
  6589. }
  6590. function Sys$Net$WebServiceProxy$get_defaultFailedCallback() {
  6591. /// <value type="Function" mayBeNull="true" locid="P:J#Sys.Net.WebServiceProxy.defaultFailedCallback"></value>
  6592. if (arguments.length !== 0) throw Error.parameterCount();
  6593. return this._failed || null;
  6594. }
  6595. function Sys$Net$WebServiceProxy$set_defaultFailedCallback(value) {
  6596. var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]);
  6597. if (e) throw e;
  6598. this._failed = value;
  6599. }
  6600. function Sys$Net$WebServiceProxy$get_enableJsonp() {
  6601. /// <value type="Boolean" locid="P:J#Sys.Net.WebServiceProxy.enableJsonp"></value>
  6602. if (arguments.length !== 0) throw Error.parameterCount();
  6603. return !!this._jsonp;
  6604. }
  6605. function Sys$Net$WebServiceProxy$set_enableJsonp(value) {
  6606. var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
  6607. if (e) throw e;
  6608. this._jsonp = value;
  6609. }
  6610. function Sys$Net$WebServiceProxy$get_path() {
  6611. /// <value type="String" locid="P:J#Sys.Net.WebServiceProxy.path"></value>
  6612. if (arguments.length !== 0) throw Error.parameterCount();
  6613. return this._path || null;
  6614. }
  6615. function Sys$Net$WebServiceProxy$set_path(value) {
  6616. var e = Function._validateParams(arguments, [{name: "value", type: String}]);
  6617. if (e) throw e;
  6618. this._path = value;
  6619. }
  6620. function Sys$Net$WebServiceProxy$get_jsonpCallbackParameter() {
  6621. /// <value type="String" locid="P:J#Sys.Net.WebServiceProxy.jsonpCallbackParameter"></value>
  6622. if (arguments.length !== 0) throw Error.parameterCount();
  6623. return this._callbackParameter || "callback";
  6624. }
  6625. function Sys$Net$WebServiceProxy$set_jsonpCallbackParameter(value) {
  6626. var e = Function._validateParams(arguments, [{name: "value", type: String}]);
  6627. if (e) throw e;
  6628. this._callbackParameter = value;
  6629. }
  6630. function Sys$Net$WebServiceProxy$_invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext) {
  6631. /// <summary locid="M:J#Sys.Net.WebServiceProxy._invoke" />
  6632. /// <param name="servicePath" type="String"></param>
  6633. /// <param name="methodName" type="String"></param>
  6634. /// <param name="useGet" type="Boolean"></param>
  6635. /// <param name="params"></param>
  6636. /// <param name="onSuccess" type="Function" mayBeNull="true" optional="true"></param>
  6637. /// <param name="onFailure" type="Function" mayBeNull="true" optional="true"></param>
  6638. /// <param name="userContext" mayBeNull="true" optional="true"></param>
  6639. /// <returns type="Sys.Net.WebRequest" mayBeNull="true"></returns>
  6640. var e = Function._validateParams(arguments, [
  6641. {name: "servicePath", type: String},
  6642. {name: "methodName", type: String},
  6643. {name: "useGet", type: Boolean},
  6644. {name: "params"},
  6645. {name: "onSuccess", type: Function, mayBeNull: true, optional: true},
  6646. {name: "onFailure", type: Function, mayBeNull: true, optional: true},
  6647. {name: "userContext", mayBeNull: true, optional: true}
  6648. ]);
  6649. if (e) throw e;
  6650. onSuccess = onSuccess || this.get_defaultSucceededCallback();
  6651. onFailure = onFailure || this.get_defaultFailedCallback();
  6652. if (userContext === null || typeof userContext === 'undefined') userContext = this.get_defaultUserContext();
  6653. return Sys.Net.WebServiceProxy.invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext, this.get_timeout(), this.get_enableJsonp(), this.get_jsonpCallbackParameter());
  6654. }
  6655. Sys.Net.WebServiceProxy.prototype = {
  6656. get_timeout: Sys$Net$WebServiceProxy$get_timeout,
  6657. set_timeout: Sys$Net$WebServiceProxy$set_timeout,
  6658. get_defaultUserContext: Sys$Net$WebServiceProxy$get_defaultUserContext,
  6659. set_defaultUserContext: Sys$Net$WebServiceProxy$set_defaultUserContext,
  6660. get_defaultSucceededCallback: Sys$Net$WebServiceProxy$get_defaultSucceededCallback,
  6661. set_defaultSucceededCallback: Sys$Net$WebServiceProxy$set_defaultSucceededCallback,
  6662. get_defaultFailedCallback: Sys$Net$WebServiceProxy$get_defaultFailedCallback,
  6663. set_defaultFailedCallback: Sys$Net$WebServiceProxy$set_defaultFailedCallback,
  6664. get_enableJsonp: Sys$Net$WebServiceProxy$get_enableJsonp,
  6665. set_enableJsonp: Sys$Net$WebServiceProxy$set_enableJsonp,
  6666. get_path: Sys$Net$WebServiceProxy$get_path,
  6667. set_path: Sys$Net$WebServiceProxy$set_path,
  6668. get_jsonpCallbackParameter: Sys$Net$WebServiceProxy$get_jsonpCallbackParameter,
  6669. set_jsonpCallbackParameter: Sys$Net$WebServiceProxy$set_jsonpCallbackParameter,
  6670. _invoke: Sys$Net$WebServiceProxy$_invoke
  6671. }
  6672. Sys.Net.WebServiceProxy.registerClass('Sys.Net.WebServiceProxy');
  6673. Sys.Net.WebServiceProxy.invoke = function Sys$Net$WebServiceProxy$invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext, timeout, enableJsonp, jsonpCallbackParameter) {
  6674. /// <summary locid="M:J#Sys.Net.WebServiceProxy.invoke" />
  6675. /// <param name="servicePath" type="String"></param>
  6676. /// <param name="methodName" type="String" mayBeNull="true" optional="true"></param>
  6677. /// <param name="useGet" type="Boolean" optional="true"></param>
  6678. /// <param name="params" mayBeNull="true" optional="true"></param>
  6679. /// <param name="onSuccess" type="Function" mayBeNull="true" optional="true"></param>
  6680. /// <param name="onFailure" type="Function" mayBeNull="true" optional="true"></param>
  6681. /// <param name="userContext" mayBeNull="true" optional="true"></param>
  6682. /// <param name="timeout" type="Number" optional="true"></param>
  6683. /// <param name="enableJsonp" type="Boolean" optional="true" mayBeNull="true"></param>
  6684. /// <param name="jsonpCallbackParameter" type="String" optional="true" mayBeNull="true"></param>
  6685. /// <returns type="Sys.Net.WebRequest" mayBeNull="true"></returns>
  6686. var e = Function._validateParams(arguments, [
  6687. {name: "servicePath", type: String},
  6688. {name: "methodName", type: String, mayBeNull: true, optional: true},
  6689. {name: "useGet", type: Boolean, optional: true},
  6690. {name: "params", mayBeNull: true, optional: true},
  6691. {name: "onSuccess", type: Function, mayBeNull: true, optional: true},
  6692. {name: "onFailure", type: Function, mayBeNull: true, optional: true},
  6693. {name: "userContext", mayBeNull: true, optional: true},
  6694. {name: "timeout", type: Number, optional: true},
  6695. {name: "enableJsonp", type: Boolean, mayBeNull: true, optional: true},
  6696. {name: "jsonpCallbackParameter", type: String, mayBeNull: true, optional: true}
  6697. ]);
  6698. if (e) throw e;
  6699. var schemeHost = (enableJsonp !== false) ? Sys.Net.WebServiceProxy._xdomain.exec(servicePath) : null,
  6700. tempCallback, jsonp = schemeHost && (schemeHost.length === 3) &&
  6701. ((schemeHost[1] !== location.protocol) || (schemeHost[2] !== location.host));
  6702. useGet = jsonp || useGet;
  6703. if (jsonp) {
  6704. jsonpCallbackParameter = jsonpCallbackParameter || "callback";
  6705. tempCallback = "_jsonp" + Sys._jsonp++;
  6706. }
  6707. if (!params) params = {};
  6708. var urlParams = params;
  6709. if (!useGet || !urlParams) urlParams = {};
  6710. var script, error, timeoutcookie = null, loader, body = null,
  6711. url = Sys.Net.WebRequest._createUrl(methodName
  6712. ? (servicePath+"/"+encodeURIComponent(methodName))
  6713. : servicePath, urlParams, jsonp ? (jsonpCallbackParameter + "=Sys." + tempCallback) : null);
  6714. if (jsonp) {
  6715. script = document.createElement("script");
  6716. script.src = url;
  6717. loader = new Sys._ScriptLoaderTask(script, function(script, loaded) {
  6718. if (!loaded || tempCallback) {
  6719. jsonpComplete({ Message: String.format(Sys.Res.webServiceFailedNoMsg, methodName) }, -1);
  6720. }
  6721. });
  6722. function jsonpComplete(data, statusCode) {
  6723. if (timeoutcookie !== null) {
  6724. window.clearTimeout(timeoutcookie);
  6725. timeoutcookie = null;
  6726. }
  6727. loader.dispose();
  6728. delete Sys[tempCallback];
  6729. tempCallback = null;
  6730. if ((typeof(statusCode) !== "undefined") && (statusCode !== 200)) {
  6731. if (onFailure) {
  6732. error = new Sys.Net.WebServiceError(false,
  6733. data.Message || String.format(Sys.Res.webServiceFailedNoMsg, methodName),
  6734. data.StackTrace || null,
  6735. data.ExceptionType || null,
  6736. data);
  6737. error._statusCode = statusCode;
  6738. onFailure(error, userContext, methodName);
  6739. }
  6740. else {
  6741. if (data.StackTrace && data.Message) {
  6742. error = data.StackTrace + "-- " + data.Message;
  6743. }
  6744. else {
  6745. error = data.StackTrace || data.Message;
  6746. }
  6747. error = String.format(error ? Sys.Res.webServiceFailed : Sys.Res.webServiceFailedNoMsg, methodName, error);
  6748. throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error));
  6749. }
  6750. }
  6751. else if (onSuccess) {
  6752. onSuccess(data, userContext, methodName);
  6753. }
  6754. }
  6755. Sys[tempCallback] = jsonpComplete;
  6756. loader.execute();
  6757. return null;
  6758. }
  6759. var request = new Sys.Net.WebRequest();
  6760. request.set_url(url);
  6761. request.get_headers()['Content-Type'] = 'application/json; charset=utf-8';
  6762. if (!useGet) {
  6763. body = Sys.Serialization.JavaScriptSerializer.serialize(params);
  6764. if (body === "{}") body = "";
  6765. }
  6766. request.set_body(body);
  6767. request.add_completed(onComplete);
  6768. if (timeout && timeout > 0) request.set_timeout(timeout);
  6769. request.invoke();
  6770. function onComplete(response, eventArgs) {
  6771. if (response.get_responseAvailable()) {
  6772. var statusCode = response.get_statusCode();
  6773. var result = null;
  6774. try {
  6775. var contentType = response.getResponseHeader("Content-Type");
  6776. if (contentType.startsWith("application/json")) {
  6777. result = response.get_object();
  6778. }
  6779. else if (contentType.startsWith("text/xml")) {
  6780. result = response.get_xml();
  6781. }
  6782. else {
  6783. result = response.get_responseData();
  6784. }
  6785. } catch (ex) {
  6786. }
  6787. var error = response.getResponseHeader("jsonerror");
  6788. var errorObj = (error === "true");
  6789. if (errorObj) {
  6790. if (result) {
  6791. result = new Sys.Net.WebServiceError(false, result.Message, result.StackTrace, result.ExceptionType, result);
  6792. }
  6793. }
  6794. else if (contentType.startsWith("application/json")) {
  6795. result = (!result || (typeof(result.d) === "undefined")) ? result : result.d;
  6796. }
  6797. if (((statusCode < 200) || (statusCode >= 300)) || errorObj) {
  6798. if (onFailure) {
  6799. if (!result || !errorObj) {
  6800. result = new Sys.Net.WebServiceError(false , String.format(Sys.Res.webServiceFailedNoMsg, methodName));
  6801. }
  6802. result._statusCode = statusCode;
  6803. onFailure(result, userContext, methodName);
  6804. }
  6805. else {
  6806. if (result && errorObj) {
  6807. error = result.get_exceptionType() + "-- " + result.get_message();
  6808. }
  6809. else {
  6810. error = response.get_responseData();
  6811. }
  6812. throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error));
  6813. }
  6814. }
  6815. else if (onSuccess) {
  6816. onSuccess(result, userContext, methodName);
  6817. }
  6818. }
  6819. else {
  6820. var msg;
  6821. if (response.get_timedOut()) {
  6822. msg = String.format(Sys.Res.webServiceTimedOut, methodName);
  6823. }
  6824. else {
  6825. msg = String.format(Sys.Res.webServiceFailedNoMsg, methodName)
  6826. }
  6827. if (onFailure) {
  6828. onFailure(new Sys.Net.WebServiceError(response.get_timedOut(), msg, "", ""), userContext, methodName);
  6829. }
  6830. else {
  6831. throw Sys.Net.WebServiceProxy._createFailedError(methodName, msg);
  6832. }
  6833. }
  6834. }
  6835. return request;
  6836. }
  6837. Sys.Net.WebServiceProxy._createFailedError = function Sys$Net$WebServiceProxy$_createFailedError(methodName, errorMessage) {
  6838. var displayMessage = "Sys.Net.WebServiceFailedException: " + errorMessage;
  6839. var e = Error.create(displayMessage, { 'name': 'Sys.Net.WebServiceFailedException', 'methodName': methodName });
  6840. e.popStackFrame();
  6841. return e;
  6842. }
  6843. Sys.Net.WebServiceProxy._defaultFailedCallback = function Sys$Net$WebServiceProxy$_defaultFailedCallback(err, methodName) {
  6844. var error = err.get_exceptionType() + "-- " + err.get_message();
  6845. throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error));
  6846. }
  6847. Sys.Net.WebServiceProxy._generateTypedConstructor = function Sys$Net$WebServiceProxy$_generateTypedConstructor(type) {
  6848. return function(properties) {
  6849. if (properties) {
  6850. for (var name in properties) {
  6851. this[name] = properties[name];
  6852. }
  6853. }
  6854. this.__type = type;
  6855. }
  6856. }
  6857. Sys._jsonp = 0;
  6858. Sys.Net.WebServiceProxy._xdomain = /^\s*([a-zA-Z0-9\+\-\.]+\:)\/\/([^?#\/]+)/;
  6859. Sys.Net.WebServiceError = function Sys$Net$WebServiceError(timedOut, message, stackTrace, exceptionType, errorObject) {
  6860. /// <summary locid="M:J#Sys.Net.WebServiceError.#ctor" />
  6861. /// <param name="timedOut" type="Boolean"></param>
  6862. /// <param name="message" type="String" mayBeNull="true"></param>
  6863. /// <param name="stackTrace" type="String" mayBeNull="true" optional="true"></param>
  6864. /// <param name="exceptionType" type="String" mayBeNull="true" optional="true"></param>
  6865. /// <param name="errorObject" type="Object" mayBeNull="true" optional="true"></param>
  6866. var e = Function._validateParams(arguments, [
  6867. {name: "timedOut", type: Boolean},
  6868. {name: "message", type: String, mayBeNull: true},
  6869. {name: "stackTrace", type: String, mayBeNull: true, optional: true},
  6870. {name: "exceptionType", type: String, mayBeNull: true, optional: true},
  6871. {name: "errorObject", type: Object, mayBeNull: true, optional: true}
  6872. ]);
  6873. if (e) throw e;
  6874. this._timedOut = timedOut;
  6875. this._message = message;
  6876. this._stackTrace = stackTrace;
  6877. this._exceptionType = exceptionType;
  6878. this._errorObject = errorObject;
  6879. this._statusCode = -1;
  6880. }
  6881. function Sys$Net$WebServiceError$get_timedOut() {
  6882. /// <value type="Boolean" locid="P:J#Sys.Net.WebServiceError.timedOut"></value>
  6883. if (arguments.length !== 0) throw Error.parameterCount();
  6884. return this._timedOut;
  6885. }
  6886. function Sys$Net$WebServiceError$get_statusCode() {
  6887. /// <value type="Number" locid="P:J#Sys.Net.WebServiceError.statusCode"></value>
  6888. if (arguments.length !== 0) throw Error.parameterCount();
  6889. return this._statusCode;
  6890. }
  6891. function Sys$Net$WebServiceError$get_message() {
  6892. /// <value type="String" locid="P:J#Sys.Net.WebServiceError.message"></value>
  6893. if (arguments.length !== 0) throw Error.parameterCount();
  6894. return this._message;
  6895. }
  6896. function Sys$Net$WebServiceError$get_stackTrace() {
  6897. /// <value type="String" locid="P:J#Sys.Net.WebServiceError.stackTrace"></value>
  6898. if (arguments.length !== 0) throw Error.parameterCount();
  6899. return this._stackTrace || "";
  6900. }
  6901. function Sys$Net$WebServiceError$get_exceptionType() {
  6902. /// <value type="String" locid="P:J#Sys.Net.WebServiceError.exceptionType"></value>
  6903. if (arguments.length !== 0) throw Error.parameterCount();
  6904. return this._exceptionType || "";
  6905. }
  6906. function Sys$Net$WebServiceError$get_errorObject() {
  6907. /// <value type="Object" locid="P:J#Sys.Net.WebServiceError.errorObject"></value>
  6908. if (arguments.length !== 0) throw Error.parameterCount();
  6909. return this._errorObject || null;
  6910. }
  6911. Sys.Net.WebServiceError.prototype = {
  6912. get_timedOut: Sys$Net$WebServiceError$get_timedOut,
  6913. get_statusCode: Sys$Net$WebServiceError$get_statusCode,
  6914. get_message: Sys$Net$WebServiceError$get_message,
  6915. get_stackTrace: Sys$Net$WebServiceError$get_stackTrace,
  6916. get_exceptionType: Sys$Net$WebServiceError$get_exceptionType,
  6917. get_errorObject: Sys$Net$WebServiceError$get_errorObject
  6918. }
  6919. Sys.Net.WebServiceError.registerClass('Sys.Net.WebServiceError');
  6920. Type.registerNamespace('Sys');
  6921. Sys.Res={
  6922. 'urlMustBeLessThan1024chars':'The history state must be small enough to not make the url larger than 1024 characters.',
  6923. 'argumentTypeName':'Value is not the name of an existing type.',
  6924. 'cantBeCalledAfterDispose':'Can\'t be called after dispose.',
  6925. 'componentCantSetIdAfterAddedToApp':'The id property of a component can\'t be set after it\'s been added to the Application object.',
  6926. 'behaviorDuplicateName':'A behavior with name \'{0}\' already exists or it is the name of an existing property on the target element.',
  6927. 'notATypeName':'Value is not a valid type name.',
  6928. 'elementNotFound':'An element with id \'{0}\' could not be found.',
  6929. 'stateMustBeStringDictionary':'The state object can only have null and string fields.',
  6930. 'boolTrueOrFalse':'Value must be \'true\' or \'false\'.',
  6931. 'scriptLoadFailedNoHead':'ScriptLoader requires pages to contain a <head> element.',
  6932. 'stringFormatInvalid':'The format string is invalid.',
  6933. 'referenceNotFound':'Component \'{0}\' was not found.',
  6934. 'enumReservedName':'\'{0}\' is a reserved name that can\'t be used as an enum value name.',
  6935. 'circularParentChain':'The chain of control parents can\'t have circular references.',
  6936. 'namespaceContainsNonObject':'Object {0} already exists and is not an object.',
  6937. 'undefinedEvent':'\'{0}\' is not an event.',
  6938. 'propertyUndefined':'\'{0}\' is not a property or an existing field.',
  6939. 'observableConflict':'Object already contains a member with the name \'{0}\'.',
  6940. 'historyCannotEnableHistory':'Cannot set enableHistory after initialization.',
  6941. 'eventHandlerInvalid':'Handler was not added through the Sys.UI.DomEvent.addHandler method.',
  6942. 'scriptLoadFailedDebug':'The script \'{0}\' failed to load. Check for:\r\n Inaccessible path.\r\n Script errors. (IE) Enable \'Display a notification about every script error\' under advanced settings.',
  6943. 'propertyNotWritable':'\'{0}\' is not a writable property.',
  6944. 'enumInvalidValueName':'\'{0}\' is not a valid name for an enum value.',
  6945. 'controlAlreadyDefined':'A control is already associated with the element.',
  6946. 'addHandlerCantBeUsedForError':'Can\'t add a handler for the error event using this method. Please set the window.onerror property instead.',
  6947. 'cantAddNonFunctionhandler':'Can\'t add a handler that is not a function.',
  6948. 'invalidNameSpace':'Value is not a valid namespace identifier.',
  6949. 'notAnInterface':'Value is not a valid interface.',
  6950. 'eventHandlerNotFunction':'Handler must be a function.',
  6951. 'propertyNotAnArray':'\'{0}\' is not an Array property.',
  6952. 'namespaceContainsClass':'Object {0} already exists as a class, enum, or interface.',
  6953. 'typeRegisteredTwice':'Type {0} has already been registered. The type may be defined multiple times or the script file that defines it may have already been loaded. A possible cause is a change of settings during a partial update.',
  6954. 'cantSetNameAfterInit':'The name property can\'t be set on this object after initialization.',
  6955. 'historyMissingFrame':'For the history feature to work in IE, the page must have an iFrame element with id \'__historyFrame\' pointed to a page that gets its title from the \'title\' query string parameter and calls Sys.Application._onIFrameLoad() on the parent window. This can be done by setting EnableHistory to true on ScriptManager.',
  6956. 'appDuplicateComponent':'Two components with the same id \'{0}\' can\'t be added to the application.',
  6957. 'historyCannotAddHistoryPointWithHistoryDisabled':'A history point can only be added if enableHistory is set to true.',
  6958. 'baseNotAClass':'Value is not a class.',
  6959. 'expectedElementOrId':'Value must be a DOM element or DOM element Id.',
  6960. 'methodNotFound':'No method found with name \'{0}\'.',
  6961. 'arrayParseBadFormat':'Value must be a valid string representation for an array. It must start with a \'[\' and end with a \']\'.',
  6962. 'stateFieldNameInvalid':'State field names must not contain any \'=\' characters.',
  6963. 'cantSetId':'The id property can\'t be set on this object.',
  6964. 'stringFormatBraceMismatch':'The format string contains an unmatched opening or closing brace.',
  6965. 'enumValueNotInteger':'An enumeration definition can only contain integer values.',
  6966. 'propertyNullOrUndefined':'Cannot set the properties of \'{0}\' because it returned a null value.',
  6967. 'argumentDomNode':'Value must be a DOM element or a text node.',
  6968. 'componentCantSetIdTwice':'The id property of a component can\'t be set more than once.',
  6969. 'createComponentOnDom':'Value must be null for Components that are not Controls or Behaviors.',
  6970. 'createNotComponent':'{0} does not derive from Sys.Component.',
  6971. 'createNoDom':'Value must not be null for Controls and Behaviors.',
  6972. 'cantAddWithoutId':'Can\'t add a component that doesn\'t have an id.',
  6973. 'notObservable':'Instances of type \'{0}\' cannot be observed.',
  6974. 'badTypeName':'Value is not the name of the type being registered or the name is a reserved word.',
  6975. 'argumentInteger':'Value must be an integer.',
  6976. 'invokeCalledTwice':'Cannot call invoke more than once.',
  6977. 'webServiceFailed':'The server method \'{0}\' failed with the following error: {1}',
  6978. 'argumentType':'Object cannot be converted to the required type.',
  6979. 'argumentNull':'Value cannot be null.',
  6980. 'scriptAlreadyLoaded':'The script \'{0}\' has been referenced multiple times. If referencing Microsoft AJAX scripts explicitly, set the MicrosoftAjaxMode property of the ScriptManager to Explicit.',
  6981. 'scriptDependencyNotFound':'The script \'{0}\' failed to load because it is dependent on script \'{1}\'.',
  6982. 'formatBadFormatSpecifier':'Format specifier was invalid.',
  6983. 'requiredScriptReferenceNotIncluded':'\'{0}\' requires that you have included a script reference to \'{1}\'.',
  6984. 'webServiceFailedNoMsg':'The server method \'{0}\' failed.',
  6985. 'argumentDomElement':'Value must be a DOM element.',
  6986. 'invalidExecutorType':'Could not create a valid Sys.Net.WebRequestExecutor from: {0}.',
  6987. 'cannotCallBeforeResponse':'Cannot call {0} when responseAvailable is false.',
  6988. 'actualValue':'Actual value was {0}.',
  6989. 'enumInvalidValue':'\'{0}\' is not a valid value for enum {1}.',
  6990. 'scriptLoadFailed':'The script \'{0}\' could not be loaded.',
  6991. 'parameterCount':'Parameter count mismatch.',
  6992. 'cannotDeserializeEmptyString':'Cannot deserialize empty string.',
  6993. 'formatInvalidString':'Input string was not in a correct format.',
  6994. 'invalidTimeout':'Value must be greater than or equal to zero.',
  6995. 'cannotAbortBeforeStart':'Cannot abort when executor has not started.',
  6996. 'argument':'Value does not fall within the expected range.',
  6997. 'cannotDeserializeInvalidJson':'Cannot deserialize. The data does not correspond to valid JSON.',
  6998. 'invalidHttpVerb':'httpVerb cannot be set to an empty or null string.',
  6999. 'nullWebRequest':'Cannot call executeRequest with a null webRequest.',
  7000. 'eventHandlerInvalid':'Handler was not added through the Sys.UI.DomEvent.addHandler method.',
  7001. 'cannotSerializeNonFiniteNumbers':'Cannot serialize non finite numbers.',
  7002. 'argumentUndefined':'Value cannot be undefined.',
  7003. 'webServiceInvalidReturnType':'The server method \'{0}\' returned an invalid type. Expected type: {1}',
  7004. 'servicePathNotSet':'The path to the web service has not been set.',
  7005. 'argumentTypeWithTypes':'Object of type \'{0}\' cannot be converted to type \'{1}\'.',
  7006. 'cannotCallOnceStarted':'Cannot call {0} once started.',
  7007. 'badBaseUrl1':'Base URL does not contain ://.',
  7008. 'badBaseUrl2':'Base URL does not contain another /.',
  7009. 'badBaseUrl3':'Cannot find last / in base URL.',
  7010. 'setExecutorAfterActive':'Cannot set executor after it has become active.',
  7011. 'paramName':'Parameter name: {0}',
  7012. 'nullReferenceInPath':'Null reference while evaluating data path: \'{0}\'.',
  7013. 'cannotCallOutsideHandler':'Cannot call {0} outside of a completed event handler.',
  7014. 'cannotSerializeObjectWithCycle':'Cannot serialize object with cyclic reference within child properties.',
  7015. 'format':'One of the identified items was in an invalid format.',
  7016. 'assertFailedCaller':'Assertion Failed: {0}\r\nat {1}',
  7017. 'argumentOutOfRange':'Specified argument was out of the range of valid values.',
  7018. 'webServiceTimedOut':'The server method \'{0}\' timed out.',
  7019. 'notImplemented':'The method or operation is not implemented.',
  7020. 'assertFailed':'Assertion Failed: {0}',
  7021. 'invalidOperation':'Operation is not valid due to the current state of the object.',
  7022. 'breakIntoDebugger':'{0}\r\n\r\nBreak into debugger?'
  7023. };