jquery.js 276 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364
  1. /*!
  2. * jQuery JavaScript Library v3.3.1
  3. * https://jquery.com/
  4. *
  5. * Includes Sizzle.js
  6. * https://sizzlejs.com/
  7. *
  8. * Copyright JS Foundation and other contributors
  9. * Released under the MIT license
  10. * https://jquery.org/license
  11. *
  12. * Date: 2018-01-20T17:24Z
  13. */
  14. ( function( global, factory ) {
  15. "use strict";
  16. if ( typeof module === "object" && typeof module.exports === "object" ) {
  17. // For CommonJS and CommonJS-like environments where a proper `window`
  18. // is present, execute the factory and get jQuery.
  19. // For environments that do not have a `window` with a `document`
  20. // (such as Node.js), expose a factory as module.exports.
  21. // This accentuates the need for the creation of a real `window`.
  22. // e.g. var jQuery = require("jquery")(window);
  23. // See ticket #14549 for more info.
  24. module.exports = global.document ?
  25. factory( global, true ) :
  26. function( w ) {
  27. if ( !w.document ) {
  28. throw new Error( "jQuery requires a window with a document" );
  29. }
  30. return factory( w );
  31. };
  32. } else {
  33. factory( global );
  34. }
  35. // Pass this if window is not defined yet
  36. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  37. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  38. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  39. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  40. // enough that all such attempts are guarded in a try block.
  41. "use strict";
  42. var arr = [];
  43. var document = window.document;
  44. var getProto = Object.getPrototypeOf;
  45. var slice = arr.slice;
  46. var concat = arr.concat;
  47. var push = arr.push;
  48. var indexOf = arr.indexOf;
  49. var class2type = {};
  50. var toString = class2type.toString;
  51. var hasOwn = class2type.hasOwnProperty;
  52. var fnToString = hasOwn.toString;
  53. var ObjectFunctionString = fnToString.call( Object );
  54. var support = {};
  55. var isFunction = function isFunction( obj ) {
  56. // Support: Chrome <=57, Firefox <=52
  57. // In some browsers, typeof returns "function" for HTML <object> elements
  58. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  59. // We don't want to classify *any* DOM node as a function.
  60. return typeof obj === "function" && typeof obj.nodeType !== "number";
  61. };
  62. var isWindow = function isWindow( obj ) {
  63. return obj != null && obj === obj.window;
  64. };
  65. var preservedScriptAttributes = {
  66. type: true,
  67. src: true,
  68. noModule: true
  69. };
  70. function DOMEval( code, doc, node ) {
  71. doc = doc || document;
  72. var i,
  73. script = doc.createElement( "script" );
  74. script.text = code;
  75. if ( node ) {
  76. for ( i in preservedScriptAttributes ) {
  77. if ( node[ i ] ) {
  78. script[ i ] = node[ i ];
  79. }
  80. }
  81. }
  82. doc.head.appendChild( script ).parentNode.removeChild( script );
  83. }
  84. function toType( obj ) {
  85. if ( obj == null ) {
  86. return obj + "";
  87. }
  88. // Support: Android <=2.3 only (functionish RegExp)
  89. return typeof obj === "object" || typeof obj === "function" ?
  90. class2type[ toString.call( obj ) ] || "object" :
  91. typeof obj;
  92. }
  93. /* global Symbol */
  94. // Defining this global in .eslintrc.json would create a danger of using the global
  95. // unguarded in another place, it seems safer to define global only for this module
  96. var
  97. version = "3.3.1",
  98. // Define a local copy of jQuery
  99. jQuery = function( selector, context ) {
  100. // The jQuery object is actually just the init constructor 'enhanced'
  101. // Need init if jQuery is called (just allow error to be thrown if not included)
  102. return new jQuery.fn.init( selector, context );
  103. },
  104. // Support: Android <=4.0 only
  105. // Make sure we trim BOM and NBSP
  106. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  107. jQuery.fn = jQuery.prototype = {
  108. // The current version of jQuery being used
  109. jquery: version,
  110. constructor: jQuery,
  111. // The default length of a jQuery object is 0
  112. length: 0,
  113. toArray: function() {
  114. return slice.call( this );
  115. },
  116. // Get the Nth element in the matched element set OR
  117. // Get the whole matched element set as a clean array
  118. get: function( num ) {
  119. // Return all the elements in a clean array
  120. if ( num == null ) {
  121. return slice.call( this );
  122. }
  123. // Return just the one element from the set
  124. return num < 0 ? this[ num + this.length ] : this[ num ];
  125. },
  126. // Take an array of elements and push it onto the stack
  127. // (returning the new matched element set)
  128. pushStack: function( elems ) {
  129. // Build a new jQuery matched element set
  130. var ret = jQuery.merge( this.constructor(), elems );
  131. // Add the old object onto the stack (as a reference)
  132. ret.prevObject = this;
  133. // Return the newly-formed element set
  134. return ret;
  135. },
  136. // Execute a callback for every element in the matched set.
  137. each: function( callback ) {
  138. return jQuery.each( this, callback );
  139. },
  140. map: function( callback ) {
  141. return this.pushStack( jQuery.map( this, function( elem, i ) {
  142. return callback.call( elem, i, elem );
  143. } ) );
  144. },
  145. slice: function() {
  146. return this.pushStack( slice.apply( this, arguments ) );
  147. },
  148. first: function() {
  149. return this.eq( 0 );
  150. },
  151. last: function() {
  152. return this.eq( -1 );
  153. },
  154. eq: function( i ) {
  155. var len = this.length,
  156. j = +i + ( i < 0 ? len : 0 );
  157. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  158. },
  159. end: function() {
  160. return this.prevObject || this.constructor();
  161. },
  162. // For internal use only.
  163. // Behaves like an Array's method, not like a jQuery method.
  164. push: push,
  165. sort: arr.sort,
  166. splice: arr.splice
  167. };
  168. jQuery.extend = jQuery.fn.extend = function() {
  169. var options, name, src, copy, copyIsArray, clone,
  170. target = arguments[ 0 ] || {},
  171. i = 1,
  172. length = arguments.length,
  173. deep = false;
  174. // Handle a deep copy situation
  175. if ( typeof target === "boolean" ) {
  176. deep = target;
  177. // Skip the boolean and the target
  178. target = arguments[ i ] || {};
  179. i++;
  180. }
  181. // Handle case when target is a string or something (possible in deep copy)
  182. if ( typeof target !== "object" && !isFunction( target ) ) {
  183. target = {};
  184. }
  185. // Extend jQuery itself if only one argument is passed
  186. if ( i === length ) {
  187. target = this;
  188. i--;
  189. }
  190. for ( ; i < length; i++ ) {
  191. // Only deal with non-null/undefined values
  192. if ( ( options = arguments[ i ] ) != null ) {
  193. // Extend the base object
  194. for ( name in options ) {
  195. src = target[ name ];
  196. copy = options[ name ];
  197. // Prevent never-ending loop
  198. if ( target === copy ) {
  199. continue;
  200. }
  201. // Recurse if we're merging plain objects or arrays
  202. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  203. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  204. if ( copyIsArray ) {
  205. copyIsArray = false;
  206. clone = src && Array.isArray( src ) ? src : [];
  207. } else {
  208. clone = src && jQuery.isPlainObject( src ) ? src : {};
  209. }
  210. // Never move original objects, clone them
  211. target[ name ] = jQuery.extend( deep, clone, copy );
  212. // Don't bring in undefined values
  213. } else if ( copy !== undefined ) {
  214. target[ name ] = copy;
  215. }
  216. }
  217. }
  218. }
  219. // Return the modified object
  220. return target;
  221. };
  222. jQuery.extend( {
  223. // Unique for each copy of jQuery on the page
  224. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  225. // Assume jQuery is ready without the ready module
  226. isReady: true,
  227. error: function( msg ) {
  228. throw new Error( msg );
  229. },
  230. noop: function() {},
  231. isPlainObject: function( obj ) {
  232. var proto, Ctor;
  233. // Detect obvious negatives
  234. // Use toString instead of jQuery.type to catch host objects
  235. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  236. return false;
  237. }
  238. proto = getProto( obj );
  239. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  240. if ( !proto ) {
  241. return true;
  242. }
  243. // Objects with prototype are plain iff they were constructed by a global Object function
  244. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  245. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  246. },
  247. isEmptyObject: function( obj ) {
  248. /* eslint-disable no-unused-vars */
  249. // See https://github.com/eslint/eslint/issues/6125
  250. var name;
  251. for ( name in obj ) {
  252. return false;
  253. }
  254. return true;
  255. },
  256. // Evaluates a script in a global context
  257. globalEval: function( code ) {
  258. DOMEval( code );
  259. },
  260. each: function( obj, callback ) {
  261. var length, i = 0;
  262. if ( isArrayLike( obj ) ) {
  263. length = obj.length;
  264. for ( ; i < length; i++ ) {
  265. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  266. break;
  267. }
  268. }
  269. } else {
  270. for ( i in obj ) {
  271. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  272. break;
  273. }
  274. }
  275. }
  276. return obj;
  277. },
  278. // Support: Android <=4.0 only
  279. trim: function( text ) {
  280. return text == null ?
  281. "" :
  282. ( text + "" ).replace( rtrim, "" );
  283. },
  284. // results is for internal usage only
  285. makeArray: function( arr, results ) {
  286. var ret = results || [];
  287. if ( arr != null ) {
  288. if ( isArrayLike( Object( arr ) ) ) {
  289. jQuery.merge( ret,
  290. typeof arr === "string" ?
  291. [ arr ] : arr
  292. );
  293. } else {
  294. push.call( ret, arr );
  295. }
  296. }
  297. return ret;
  298. },
  299. inArray: function( elem, arr, i ) {
  300. return arr == null ? -1 : indexOf.call( arr, elem, i );
  301. },
  302. // Support: Android <=4.0 only, PhantomJS 1 only
  303. // push.apply(_, arraylike) throws on ancient WebKit
  304. merge: function( first, second ) {
  305. var len = +second.length,
  306. j = 0,
  307. i = first.length;
  308. for ( ; j < len; j++ ) {
  309. first[ i++ ] = second[ j ];
  310. }
  311. first.length = i;
  312. return first;
  313. },
  314. grep: function( elems, callback, invert ) {
  315. var callbackInverse,
  316. matches = [],
  317. i = 0,
  318. length = elems.length,
  319. callbackExpect = !invert;
  320. // Go through the array, only saving the items
  321. // that pass the validator function
  322. for ( ; i < length; i++ ) {
  323. callbackInverse = !callback( elems[ i ], i );
  324. if ( callbackInverse !== callbackExpect ) {
  325. matches.push( elems[ i ] );
  326. }
  327. }
  328. return matches;
  329. },
  330. // arg is for internal usage only
  331. map: function( elems, callback, arg ) {
  332. var length, value,
  333. i = 0,
  334. ret = [];
  335. // Go through the array, translating each of the items to their new values
  336. if ( isArrayLike( elems ) ) {
  337. length = elems.length;
  338. for ( ; i < length; i++ ) {
  339. value = callback( elems[ i ], i, arg );
  340. if ( value != null ) {
  341. ret.push( value );
  342. }
  343. }
  344. // Go through every key on the object,
  345. } else {
  346. for ( i in elems ) {
  347. value = callback( elems[ i ], i, arg );
  348. if ( value != null ) {
  349. ret.push( value );
  350. }
  351. }
  352. }
  353. // Flatten any nested arrays
  354. return concat.apply( [], ret );
  355. },
  356. // A global GUID counter for objects
  357. guid: 1,
  358. // jQuery.support is not used in Core but other projects attach their
  359. // properties to it so it needs to exist.
  360. support: support
  361. } );
  362. if ( typeof Symbol === "function" ) {
  363. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  364. }
  365. // Populate the class2type map
  366. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  367. function( i, name ) {
  368. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  369. } );
  370. function isArrayLike( obj ) {
  371. // Support: real iOS 8.2 only (not reproducible in simulator)
  372. // `in` check used to prevent JIT error (gh-2145)
  373. // hasOwn isn't used here due to false negatives
  374. // regarding Nodelist length in IE
  375. var length = !!obj && "length" in obj && obj.length,
  376. type = toType( obj );
  377. if ( isFunction( obj ) || isWindow( obj ) ) {
  378. return false;
  379. }
  380. return type === "array" || length === 0 ||
  381. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  382. }
  383. var Sizzle =
  384. /*!
  385. * Sizzle CSS Selector Engine v2.3.3
  386. * https://sizzlejs.com/
  387. *
  388. * Copyright jQuery Foundation and other contributors
  389. * Released under the MIT license
  390. * http://jquery.org/license
  391. *
  392. * Date: 2016-08-08
  393. */
  394. (function( window ) {
  395. var i,
  396. support,
  397. Expr,
  398. getText,
  399. isXML,
  400. tokenize,
  401. compile,
  402. select,
  403. outermostContext,
  404. sortInput,
  405. hasDuplicate,
  406. // Local document vars
  407. setDocument,
  408. document,
  409. docElem,
  410. documentIsHTML,
  411. rbuggyQSA,
  412. rbuggyMatches,
  413. matches,
  414. contains,
  415. // Instance-specific data
  416. expando = "sizzle" + 1 * new Date(),
  417. preferredDoc = window.document,
  418. dirruns = 0,
  419. done = 0,
  420. classCache = createCache(),
  421. tokenCache = createCache(),
  422. compilerCache = createCache(),
  423. sortOrder = function( a, b ) {
  424. if ( a === b ) {
  425. hasDuplicate = true;
  426. }
  427. return 0;
  428. },
  429. // Instance methods
  430. hasOwn = ({}).hasOwnProperty,
  431. arr = [],
  432. pop = arr.pop,
  433. push_native = arr.push,
  434. push = arr.push,
  435. slice = arr.slice,
  436. // Use a stripped-down indexOf as it's faster than native
  437. // https://jsperf.com/thor-indexof-vs-for/5
  438. indexOf = function( list, elem ) {
  439. var i = 0,
  440. len = list.length;
  441. for ( ; i < len; i++ ) {
  442. if ( list[i] === elem ) {
  443. return i;
  444. }
  445. }
  446. return -1;
  447. },
  448. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  449. // Regular expressions
  450. // http://www.w3.org/TR/css3-selectors/#whitespace
  451. whitespace = "[\\x20\\t\\r\\n\\f]",
  452. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  453. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  454. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  455. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  456. // Operator (capture 2)
  457. "*([*^$|!~]?=)" + whitespace +
  458. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  459. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  460. "*\\]",
  461. pseudos = ":(" + identifier + ")(?:\\((" +
  462. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  463. // 1. quoted (capture 3; capture 4 or capture 5)
  464. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  465. // 2. simple (capture 6)
  466. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  467. // 3. anything else (capture 2)
  468. ".*" +
  469. ")\\)|)",
  470. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  471. rwhitespace = new RegExp( whitespace + "+", "g" ),
  472. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  473. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  474. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  475. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  476. rpseudo = new RegExp( pseudos ),
  477. ridentifier = new RegExp( "^" + identifier + "$" ),
  478. matchExpr = {
  479. "ID": new RegExp( "^#(" + identifier + ")" ),
  480. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  481. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  482. "ATTR": new RegExp( "^" + attributes ),
  483. "PSEUDO": new RegExp( "^" + pseudos ),
  484. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  485. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  486. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  487. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  488. // For use in libraries implementing .is()
  489. // We use this for POS matching in `select`
  490. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  491. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  492. },
  493. rinputs = /^(?:input|select|textarea|button)$/i,
  494. rheader = /^h\d$/i,
  495. rnative = /^[^{]+\{\s*\[native \w/,
  496. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  497. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  498. rsibling = /[+~]/,
  499. // CSS escapes
  500. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  501. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  502. funescape = function( _, escaped, escapedWhitespace ) {
  503. var high = "0x" + escaped - 0x10000;
  504. // NaN means non-codepoint
  505. // Support: Firefox<24
  506. // Workaround erroneous numeric interpretation of +"0x"
  507. return high !== high || escapedWhitespace ?
  508. escaped :
  509. high < 0 ?
  510. // BMP codepoint
  511. String.fromCharCode( high + 0x10000 ) :
  512. // Supplemental Plane codepoint (surrogate pair)
  513. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  514. },
  515. // CSS string/identifier serialization
  516. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  517. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  518. fcssescape = function( ch, asCodePoint ) {
  519. if ( asCodePoint ) {
  520. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  521. if ( ch === "\0" ) {
  522. return "\uFFFD";
  523. }
  524. // Control characters and (dependent upon position) numbers get escaped as code points
  525. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  526. }
  527. // Other potentially-special ASCII characters get backslash-escaped
  528. return "\\" + ch;
  529. },
  530. // Used for iframes
  531. // See setDocument()
  532. // Removing the function wrapper causes a "Permission Denied"
  533. // error in IE
  534. unloadHandler = function() {
  535. setDocument();
  536. },
  537. disabledAncestor = addCombinator(
  538. function( elem ) {
  539. return elem.disabled === true && ("form" in elem || "label" in elem);
  540. },
  541. { dir: "parentNode", next: "legend" }
  542. );
  543. // Optimize for push.apply( _, NodeList )
  544. try {
  545. push.apply(
  546. (arr = slice.call( preferredDoc.childNodes )),
  547. preferredDoc.childNodes
  548. );
  549. // Support: Android<4.0
  550. // Detect silently failing push.apply
  551. arr[ preferredDoc.childNodes.length ].nodeType;
  552. } catch ( e ) {
  553. push = { apply: arr.length ?
  554. // Leverage slice if possible
  555. function( target, els ) {
  556. push_native.apply( target, slice.call(els) );
  557. } :
  558. // Support: IE<9
  559. // Otherwise append directly
  560. function( target, els ) {
  561. var j = target.length,
  562. i = 0;
  563. // Can't trust NodeList.length
  564. while ( (target[j++] = els[i++]) ) {}
  565. target.length = j - 1;
  566. }
  567. };
  568. }
  569. function Sizzle( selector, context, results, seed ) {
  570. var m, i, elem, nid, match, groups, newSelector,
  571. newContext = context && context.ownerDocument,
  572. // nodeType defaults to 9, since context defaults to document
  573. nodeType = context ? context.nodeType : 9;
  574. results = results || [];
  575. // Return early from calls with invalid selector or context
  576. if ( typeof selector !== "string" || !selector ||
  577. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  578. return results;
  579. }
  580. // Try to shortcut find operations (as opposed to filters) in HTML documents
  581. if ( !seed ) {
  582. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  583. setDocument( context );
  584. }
  585. context = context || document;
  586. if ( documentIsHTML ) {
  587. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  588. // (excepting DocumentFragment context, where the methods don't exist)
  589. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  590. // ID selector
  591. if ( (m = match[1]) ) {
  592. // Document context
  593. if ( nodeType === 9 ) {
  594. if ( (elem = context.getElementById( m )) ) {
  595. // Support: IE, Opera, Webkit
  596. // TODO: identify versions
  597. // getElementById can match elements by name instead of ID
  598. if ( elem.id === m ) {
  599. results.push( elem );
  600. return results;
  601. }
  602. } else {
  603. return results;
  604. }
  605. // Element context
  606. } else {
  607. // Support: IE, Opera, Webkit
  608. // TODO: identify versions
  609. // getElementById can match elements by name instead of ID
  610. if ( newContext && (elem = newContext.getElementById( m )) &&
  611. contains( context, elem ) &&
  612. elem.id === m ) {
  613. results.push( elem );
  614. return results;
  615. }
  616. }
  617. // Type selector
  618. } else if ( match[2] ) {
  619. push.apply( results, context.getElementsByTagName( selector ) );
  620. return results;
  621. // Class selector
  622. } else if ( (m = match[3]) && support.getElementsByClassName &&
  623. context.getElementsByClassName ) {
  624. push.apply( results, context.getElementsByClassName( m ) );
  625. return results;
  626. }
  627. }
  628. // Take advantage of querySelectorAll
  629. if ( support.qsa &&
  630. !compilerCache[ selector + " " ] &&
  631. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  632. if ( nodeType !== 1 ) {
  633. newContext = context;
  634. newSelector = selector;
  635. // qSA looks outside Element context, which is not what we want
  636. // Thanks to Andrew Dupont for this workaround technique
  637. // Support: IE <=8
  638. // Exclude object elements
  639. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  640. // Capture the context ID, setting it first if necessary
  641. if ( (nid = context.getAttribute( "id" )) ) {
  642. nid = nid.replace( rcssescape, fcssescape );
  643. } else {
  644. context.setAttribute( "id", (nid = expando) );
  645. }
  646. // Prefix every selector in the list
  647. groups = tokenize( selector );
  648. i = groups.length;
  649. while ( i-- ) {
  650. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  651. }
  652. newSelector = groups.join( "," );
  653. // Expand context for sibling selectors
  654. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  655. context;
  656. }
  657. if ( newSelector ) {
  658. try {
  659. push.apply( results,
  660. newContext.querySelectorAll( newSelector )
  661. );
  662. return results;
  663. } catch ( qsaError ) {
  664. } finally {
  665. if ( nid === expando ) {
  666. context.removeAttribute( "id" );
  667. }
  668. }
  669. }
  670. }
  671. }
  672. }
  673. // All others
  674. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  675. }
  676. /**
  677. * Create key-value caches of limited size
  678. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  679. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  680. * deleting the oldest entry
  681. */
  682. function createCache() {
  683. var keys = [];
  684. function cache( key, value ) {
  685. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  686. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  687. // Only keep the most recent entries
  688. delete cache[ keys.shift() ];
  689. }
  690. return (cache[ key + " " ] = value);
  691. }
  692. return cache;
  693. }
  694. /**
  695. * Mark a function for special use by Sizzle
  696. * @param {Function} fn The function to mark
  697. */
  698. function markFunction( fn ) {
  699. fn[ expando ] = true;
  700. return fn;
  701. }
  702. /**
  703. * Support testing using an element
  704. * @param {Function} fn Passed the created element and returns a boolean result
  705. */
  706. function assert( fn ) {
  707. var el = document.createElement("fieldset");
  708. try {
  709. return !!fn( el );
  710. } catch (e) {
  711. return false;
  712. } finally {
  713. // Remove from its parent by default
  714. if ( el.parentNode ) {
  715. el.parentNode.removeChild( el );
  716. }
  717. // release memory in IE
  718. el = null;
  719. }
  720. }
  721. /**
  722. * Adds the same handler for all of the specified attrs
  723. * @param {String} attrs Pipe-separated list of attributes
  724. * @param {Function} handler The method that will be applied
  725. */
  726. function addHandle( attrs, handler ) {
  727. var arr = attrs.split("|"),
  728. i = arr.length;
  729. while ( i-- ) {
  730. Expr.attrHandle[ arr[i] ] = handler;
  731. }
  732. }
  733. /**
  734. * Checks document order of two siblings
  735. * @param {Element} a
  736. * @param {Element} b
  737. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  738. */
  739. function siblingCheck( a, b ) {
  740. var cur = b && a,
  741. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  742. a.sourceIndex - b.sourceIndex;
  743. // Use IE sourceIndex if available on both nodes
  744. if ( diff ) {
  745. return diff;
  746. }
  747. // Check if b follows a
  748. if ( cur ) {
  749. while ( (cur = cur.nextSibling) ) {
  750. if ( cur === b ) {
  751. return -1;
  752. }
  753. }
  754. }
  755. return a ? 1 : -1;
  756. }
  757. /**
  758. * Returns a function to use in pseudos for input types
  759. * @param {String} type
  760. */
  761. function createInputPseudo( type ) {
  762. return function( elem ) {
  763. var name = elem.nodeName.toLowerCase();
  764. return name === "input" && elem.type === type;
  765. };
  766. }
  767. /**
  768. * Returns a function to use in pseudos for buttons
  769. * @param {String} type
  770. */
  771. function createButtonPseudo( type ) {
  772. return function( elem ) {
  773. var name = elem.nodeName.toLowerCase();
  774. return (name === "input" || name === "button") && elem.type === type;
  775. };
  776. }
  777. /**
  778. * Returns a function to use in pseudos for :enabled/:disabled
  779. * @param {Boolean} disabled true for :disabled; false for :enabled
  780. */
  781. function createDisabledPseudo( disabled ) {
  782. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  783. return function( elem ) {
  784. // Only certain elements can match :enabled or :disabled
  785. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  786. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  787. if ( "form" in elem ) {
  788. // Check for inherited disabledness on relevant non-disabled elements:
  789. // * listed form-associated elements in a disabled fieldset
  790. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  791. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  792. // * option elements in a disabled optgroup
  793. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  794. // All such elements have a "form" property.
  795. if ( elem.parentNode && elem.disabled === false ) {
  796. // Option elements defer to a parent optgroup if present
  797. if ( "label" in elem ) {
  798. if ( "label" in elem.parentNode ) {
  799. return elem.parentNode.disabled === disabled;
  800. } else {
  801. return elem.disabled === disabled;
  802. }
  803. }
  804. // Support: IE 6 - 11
  805. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  806. return elem.isDisabled === disabled ||
  807. // Where there is no isDisabled, check manually
  808. /* jshint -W018 */
  809. elem.isDisabled !== !disabled &&
  810. disabledAncestor( elem ) === disabled;
  811. }
  812. return elem.disabled === disabled;
  813. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  814. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  815. // even exist on them, let alone have a boolean value.
  816. } else if ( "label" in elem ) {
  817. return elem.disabled === disabled;
  818. }
  819. // Remaining elements are neither :enabled nor :disabled
  820. return false;
  821. };
  822. }
  823. /**
  824. * Returns a function to use in pseudos for positionals
  825. * @param {Function} fn
  826. */
  827. function createPositionalPseudo( fn ) {
  828. return markFunction(function( argument ) {
  829. argument = +argument;
  830. return markFunction(function( seed, matches ) {
  831. var j,
  832. matchIndexes = fn( [], seed.length, argument ),
  833. i = matchIndexes.length;
  834. // Match elements found at the specified indexes
  835. while ( i-- ) {
  836. if ( seed[ (j = matchIndexes[i]) ] ) {
  837. seed[j] = !(matches[j] = seed[j]);
  838. }
  839. }
  840. });
  841. });
  842. }
  843. /**
  844. * Checks a node for validity as a Sizzle context
  845. * @param {Element|Object=} context
  846. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  847. */
  848. function testContext( context ) {
  849. return context && typeof context.getElementsByTagName !== "undefined" && context;
  850. }
  851. // Expose support vars for convenience
  852. support = Sizzle.support = {};
  853. /**
  854. * Detects XML nodes
  855. * @param {Element|Object} elem An element or a document
  856. * @returns {Boolean} True iff elem is a non-HTML XML node
  857. */
  858. isXML = Sizzle.isXML = function( elem ) {
  859. // documentElement is verified for cases where it doesn't yet exist
  860. // (such as loading iframes in IE - #4833)
  861. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  862. return documentElement ? documentElement.nodeName !== "HTML" : false;
  863. };
  864. /**
  865. * Sets document-related variables once based on the current document
  866. * @param {Element|Object} [doc] An element or document object to use to set the document
  867. * @returns {Object} Returns the current document
  868. */
  869. setDocument = Sizzle.setDocument = function( node ) {
  870. var hasCompare, subWindow,
  871. doc = node ? node.ownerDocument || node : preferredDoc;
  872. // Return early if doc is invalid or already selected
  873. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  874. return document;
  875. }
  876. // Update global variables
  877. document = doc;
  878. docElem = document.documentElement;
  879. documentIsHTML = !isXML( document );
  880. // Support: IE 9-11, Edge
  881. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  882. if ( preferredDoc !== document &&
  883. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  884. // Support: IE 11, Edge
  885. if ( subWindow.addEventListener ) {
  886. subWindow.addEventListener( "unload", unloadHandler, false );
  887. // Support: IE 9 - 10 only
  888. } else if ( subWindow.attachEvent ) {
  889. subWindow.attachEvent( "onunload", unloadHandler );
  890. }
  891. }
  892. /* Attributes
  893. ---------------------------------------------------------------------- */
  894. // Support: IE<8
  895. // Verify that getAttribute really returns attributes and not properties
  896. // (excepting IE8 booleans)
  897. support.attributes = assert(function( el ) {
  898. el.className = "i";
  899. return !el.getAttribute("className");
  900. });
  901. /* getElement(s)By*
  902. ---------------------------------------------------------------------- */
  903. // Check if getElementsByTagName("*") returns only elements
  904. support.getElementsByTagName = assert(function( el ) {
  905. el.appendChild( document.createComment("") );
  906. return !el.getElementsByTagName("*").length;
  907. });
  908. // Support: IE<9
  909. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  910. // Support: IE<10
  911. // Check if getElementById returns elements by name
  912. // The broken getElementById methods don't pick up programmatically-set names,
  913. // so use a roundabout getElementsByName test
  914. support.getById = assert(function( el ) {
  915. docElem.appendChild( el ).id = expando;
  916. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  917. });
  918. // ID filter and find
  919. if ( support.getById ) {
  920. Expr.filter["ID"] = function( id ) {
  921. var attrId = id.replace( runescape, funescape );
  922. return function( elem ) {
  923. return elem.getAttribute("id") === attrId;
  924. };
  925. };
  926. Expr.find["ID"] = function( id, context ) {
  927. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  928. var elem = context.getElementById( id );
  929. return elem ? [ elem ] : [];
  930. }
  931. };
  932. } else {
  933. Expr.filter["ID"] = function( id ) {
  934. var attrId = id.replace( runescape, funescape );
  935. return function( elem ) {
  936. var node = typeof elem.getAttributeNode !== "undefined" &&
  937. elem.getAttributeNode("id");
  938. return node && node.value === attrId;
  939. };
  940. };
  941. // Support: IE 6 - 7 only
  942. // getElementById is not reliable as a find shortcut
  943. Expr.find["ID"] = function( id, context ) {
  944. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  945. var node, i, elems,
  946. elem = context.getElementById( id );
  947. if ( elem ) {
  948. // Verify the id attribute
  949. node = elem.getAttributeNode("id");
  950. if ( node && node.value === id ) {
  951. return [ elem ];
  952. }
  953. // Fall back on getElementsByName
  954. elems = context.getElementsByName( id );
  955. i = 0;
  956. while ( (elem = elems[i++]) ) {
  957. node = elem.getAttributeNode("id");
  958. if ( node && node.value === id ) {
  959. return [ elem ];
  960. }
  961. }
  962. }
  963. return [];
  964. }
  965. };
  966. }
  967. // Tag
  968. Expr.find["TAG"] = support.getElementsByTagName ?
  969. function( tag, context ) {
  970. if ( typeof context.getElementsByTagName !== "undefined" ) {
  971. return context.getElementsByTagName( tag );
  972. // DocumentFragment nodes don't have gEBTN
  973. } else if ( support.qsa ) {
  974. return context.querySelectorAll( tag );
  975. }
  976. } :
  977. function( tag, context ) {
  978. var elem,
  979. tmp = [],
  980. i = 0,
  981. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  982. results = context.getElementsByTagName( tag );
  983. // Filter out possible comments
  984. if ( tag === "*" ) {
  985. while ( (elem = results[i++]) ) {
  986. if ( elem.nodeType === 1 ) {
  987. tmp.push( elem );
  988. }
  989. }
  990. return tmp;
  991. }
  992. return results;
  993. };
  994. // Class
  995. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  996. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  997. return context.getElementsByClassName( className );
  998. }
  999. };
  1000. /* QSA/matchesSelector
  1001. ---------------------------------------------------------------------- */
  1002. // QSA and matchesSelector support
  1003. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  1004. rbuggyMatches = [];
  1005. // qSa(:focus) reports false when true (Chrome 21)
  1006. // We allow this because of a bug in IE8/9 that throws an error
  1007. // whenever `document.activeElement` is accessed on an iframe
  1008. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  1009. // See https://bugs.jquery.com/ticket/13378
  1010. rbuggyQSA = [];
  1011. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  1012. // Build QSA regex
  1013. // Regex strategy adopted from Diego Perini
  1014. assert(function( el ) {
  1015. // Select is set to empty string on purpose
  1016. // This is to test IE's treatment of not explicitly
  1017. // setting a boolean content attribute,
  1018. // since its presence should be enough
  1019. // https://bugs.jquery.com/ticket/12359
  1020. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  1021. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  1022. "<option selected=''></option></select>";
  1023. // Support: IE8, Opera 11-12.16
  1024. // Nothing should be selected when empty strings follow ^= or $= or *=
  1025. // The test attribute must be unknown in Opera but "safe" for WinRT
  1026. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  1027. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  1028. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  1029. }
  1030. // Support: IE8
  1031. // Boolean attributes and "value" are not treated correctly
  1032. if ( !el.querySelectorAll("[selected]").length ) {
  1033. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1034. }
  1035. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  1036. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1037. rbuggyQSA.push("~=");
  1038. }
  1039. // Webkit/Opera - :checked should return selected option elements
  1040. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1041. // IE8 throws error here and will not see later tests
  1042. if ( !el.querySelectorAll(":checked").length ) {
  1043. rbuggyQSA.push(":checked");
  1044. }
  1045. // Support: Safari 8+, iOS 8+
  1046. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1047. // In-page `selector#id sibling-combinator selector` fails
  1048. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1049. rbuggyQSA.push(".#.+[+~]");
  1050. }
  1051. });
  1052. assert(function( el ) {
  1053. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  1054. "<select disabled='disabled'><option/></select>";
  1055. // Support: Windows 8 Native Apps
  1056. // The type and name attributes are restricted during .innerHTML assignment
  1057. var input = document.createElement("input");
  1058. input.setAttribute( "type", "hidden" );
  1059. el.appendChild( input ).setAttribute( "name", "D" );
  1060. // Support: IE8
  1061. // Enforce case-sensitivity of name attribute
  1062. if ( el.querySelectorAll("[name=d]").length ) {
  1063. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1064. }
  1065. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1066. // IE8 throws error here and will not see later tests
  1067. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  1068. rbuggyQSA.push( ":enabled", ":disabled" );
  1069. }
  1070. // Support: IE9-11+
  1071. // IE's :disabled selector does not pick up the children of disabled fieldsets
  1072. docElem.appendChild( el ).disabled = true;
  1073. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  1074. rbuggyQSA.push( ":enabled", ":disabled" );
  1075. }
  1076. // Opera 10-11 does not throw on post-comma invalid pseudos
  1077. el.querySelectorAll("*,:x");
  1078. rbuggyQSA.push(",.*:");
  1079. });
  1080. }
  1081. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  1082. docElem.webkitMatchesSelector ||
  1083. docElem.mozMatchesSelector ||
  1084. docElem.oMatchesSelector ||
  1085. docElem.msMatchesSelector) )) ) {
  1086. assert(function( el ) {
  1087. // Check to see if it's possible to do matchesSelector
  1088. // on a disconnected node (IE 9)
  1089. support.disconnectedMatch = matches.call( el, "*" );
  1090. // This should fail with an exception
  1091. // Gecko does not error, returns false instead
  1092. matches.call( el, "[s!='']:x" );
  1093. rbuggyMatches.push( "!=", pseudos );
  1094. });
  1095. }
  1096. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  1097. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  1098. /* Contains
  1099. ---------------------------------------------------------------------- */
  1100. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1101. // Element contains another
  1102. // Purposefully self-exclusive
  1103. // As in, an element does not contain itself
  1104. contains = hasCompare || rnative.test( docElem.contains ) ?
  1105. function( a, b ) {
  1106. var adown = a.nodeType === 9 ? a.documentElement : a,
  1107. bup = b && b.parentNode;
  1108. return a === bup || !!( bup && bup.nodeType === 1 && (
  1109. adown.contains ?
  1110. adown.contains( bup ) :
  1111. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1112. ));
  1113. } :
  1114. function( a, b ) {
  1115. if ( b ) {
  1116. while ( (b = b.parentNode) ) {
  1117. if ( b === a ) {
  1118. return true;
  1119. }
  1120. }
  1121. }
  1122. return false;
  1123. };
  1124. /* Sorting
  1125. ---------------------------------------------------------------------- */
  1126. // Document order sorting
  1127. sortOrder = hasCompare ?
  1128. function( a, b ) {
  1129. // Flag for duplicate removal
  1130. if ( a === b ) {
  1131. hasDuplicate = true;
  1132. return 0;
  1133. }
  1134. // Sort on method existence if only one input has compareDocumentPosition
  1135. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1136. if ( compare ) {
  1137. return compare;
  1138. }
  1139. // Calculate position if both inputs belong to the same document
  1140. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  1141. a.compareDocumentPosition( b ) :
  1142. // Otherwise we know they are disconnected
  1143. 1;
  1144. // Disconnected nodes
  1145. if ( compare & 1 ||
  1146. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  1147. // Choose the first element that is related to our preferred document
  1148. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  1149. return -1;
  1150. }
  1151. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  1152. return 1;
  1153. }
  1154. // Maintain original order
  1155. return sortInput ?
  1156. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1157. 0;
  1158. }
  1159. return compare & 4 ? -1 : 1;
  1160. } :
  1161. function( a, b ) {
  1162. // Exit early if the nodes are identical
  1163. if ( a === b ) {
  1164. hasDuplicate = true;
  1165. return 0;
  1166. }
  1167. var cur,
  1168. i = 0,
  1169. aup = a.parentNode,
  1170. bup = b.parentNode,
  1171. ap = [ a ],
  1172. bp = [ b ];
  1173. // Parentless nodes are either documents or disconnected
  1174. if ( !aup || !bup ) {
  1175. return a === document ? -1 :
  1176. b === document ? 1 :
  1177. aup ? -1 :
  1178. bup ? 1 :
  1179. sortInput ?
  1180. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1181. 0;
  1182. // If the nodes are siblings, we can do a quick check
  1183. } else if ( aup === bup ) {
  1184. return siblingCheck( a, b );
  1185. }
  1186. // Otherwise we need full lists of their ancestors for comparison
  1187. cur = a;
  1188. while ( (cur = cur.parentNode) ) {
  1189. ap.unshift( cur );
  1190. }
  1191. cur = b;
  1192. while ( (cur = cur.parentNode) ) {
  1193. bp.unshift( cur );
  1194. }
  1195. // Walk down the tree looking for a discrepancy
  1196. while ( ap[i] === bp[i] ) {
  1197. i++;
  1198. }
  1199. return i ?
  1200. // Do a sibling check if the nodes have a common ancestor
  1201. siblingCheck( ap[i], bp[i] ) :
  1202. // Otherwise nodes in our document sort first
  1203. ap[i] === preferredDoc ? -1 :
  1204. bp[i] === preferredDoc ? 1 :
  1205. 0;
  1206. };
  1207. return document;
  1208. };
  1209. Sizzle.matches = function( expr, elements ) {
  1210. return Sizzle( expr, null, null, elements );
  1211. };
  1212. Sizzle.matchesSelector = function( elem, expr ) {
  1213. // Set document vars if needed
  1214. if ( ( elem.ownerDocument || elem ) !== document ) {
  1215. setDocument( elem );
  1216. }
  1217. // Make sure that attribute selectors are quoted
  1218. expr = expr.replace( rattributeQuotes, "='$1']" );
  1219. if ( support.matchesSelector && documentIsHTML &&
  1220. !compilerCache[ expr + " " ] &&
  1221. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  1222. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  1223. try {
  1224. var ret = matches.call( elem, expr );
  1225. // IE 9's matchesSelector returns false on disconnected nodes
  1226. if ( ret || support.disconnectedMatch ||
  1227. // As well, disconnected nodes are said to be in a document
  1228. // fragment in IE 9
  1229. elem.document && elem.document.nodeType !== 11 ) {
  1230. return ret;
  1231. }
  1232. } catch (e) {}
  1233. }
  1234. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  1235. };
  1236. Sizzle.contains = function( context, elem ) {
  1237. // Set document vars if needed
  1238. if ( ( context.ownerDocument || context ) !== document ) {
  1239. setDocument( context );
  1240. }
  1241. return contains( context, elem );
  1242. };
  1243. Sizzle.attr = function( elem, name ) {
  1244. // Set document vars if needed
  1245. if ( ( elem.ownerDocument || elem ) !== document ) {
  1246. setDocument( elem );
  1247. }
  1248. var fn = Expr.attrHandle[ name.toLowerCase() ],
  1249. // Don't get fooled by Object.prototype properties (jQuery #13807)
  1250. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  1251. fn( elem, name, !documentIsHTML ) :
  1252. undefined;
  1253. return val !== undefined ?
  1254. val :
  1255. support.attributes || !documentIsHTML ?
  1256. elem.getAttribute( name ) :
  1257. (val = elem.getAttributeNode(name)) && val.specified ?
  1258. val.value :
  1259. null;
  1260. };
  1261. Sizzle.escape = function( sel ) {
  1262. return (sel + "").replace( rcssescape, fcssescape );
  1263. };
  1264. Sizzle.error = function( msg ) {
  1265. throw new Error( "Syntax error, unrecognized expression: " + msg );
  1266. };
  1267. /**
  1268. * Document sorting and removing duplicates
  1269. * @param {ArrayLike} results
  1270. */
  1271. Sizzle.uniqueSort = function( results ) {
  1272. var elem,
  1273. duplicates = [],
  1274. j = 0,
  1275. i = 0;
  1276. // Unless we *know* we can detect duplicates, assume their presence
  1277. hasDuplicate = !support.detectDuplicates;
  1278. sortInput = !support.sortStable && results.slice( 0 );
  1279. results.sort( sortOrder );
  1280. if ( hasDuplicate ) {
  1281. while ( (elem = results[i++]) ) {
  1282. if ( elem === results[ i ] ) {
  1283. j = duplicates.push( i );
  1284. }
  1285. }
  1286. while ( j-- ) {
  1287. results.splice( duplicates[ j ], 1 );
  1288. }
  1289. }
  1290. // Clear input after sorting to release objects
  1291. // See https://github.com/jquery/sizzle/pull/225
  1292. sortInput = null;
  1293. return results;
  1294. };
  1295. /**
  1296. * Utility function for retrieving the text value of an array of DOM nodes
  1297. * @param {Array|Element} elem
  1298. */
  1299. getText = Sizzle.getText = function( elem ) {
  1300. var node,
  1301. ret = "",
  1302. i = 0,
  1303. nodeType = elem.nodeType;
  1304. if ( !nodeType ) {
  1305. // If no nodeType, this is expected to be an array
  1306. while ( (node = elem[i++]) ) {
  1307. // Do not traverse comment nodes
  1308. ret += getText( node );
  1309. }
  1310. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  1311. // Use textContent for elements
  1312. // innerText usage removed for consistency of new lines (jQuery #11153)
  1313. if ( typeof elem.textContent === "string" ) {
  1314. return elem.textContent;
  1315. } else {
  1316. // Traverse its children
  1317. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1318. ret += getText( elem );
  1319. }
  1320. }
  1321. } else if ( nodeType === 3 || nodeType === 4 ) {
  1322. return elem.nodeValue;
  1323. }
  1324. // Do not include comment or processing instruction nodes
  1325. return ret;
  1326. };
  1327. Expr = Sizzle.selectors = {
  1328. // Can be adjusted by the user
  1329. cacheLength: 50,
  1330. createPseudo: markFunction,
  1331. match: matchExpr,
  1332. attrHandle: {},
  1333. find: {},
  1334. relative: {
  1335. ">": { dir: "parentNode", first: true },
  1336. " ": { dir: "parentNode" },
  1337. "+": { dir: "previousSibling", first: true },
  1338. "~": { dir: "previousSibling" }
  1339. },
  1340. preFilter: {
  1341. "ATTR": function( match ) {
  1342. match[1] = match[1].replace( runescape, funescape );
  1343. // Move the given value to match[3] whether quoted or unquoted
  1344. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  1345. if ( match[2] === "~=" ) {
  1346. match[3] = " " + match[3] + " ";
  1347. }
  1348. return match.slice( 0, 4 );
  1349. },
  1350. "CHILD": function( match ) {
  1351. /* matches from matchExpr["CHILD"]
  1352. 1 type (only|nth|...)
  1353. 2 what (child|of-type)
  1354. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  1355. 4 xn-component of xn+y argument ([+-]?\d*n|)
  1356. 5 sign of xn-component
  1357. 6 x of xn-component
  1358. 7 sign of y-component
  1359. 8 y of y-component
  1360. */
  1361. match[1] = match[1].toLowerCase();
  1362. if ( match[1].slice( 0, 3 ) === "nth" ) {
  1363. // nth-* requires argument
  1364. if ( !match[3] ) {
  1365. Sizzle.error( match[0] );
  1366. }
  1367. // numeric x and y parameters for Expr.filter.CHILD
  1368. // remember that false/true cast respectively to 0/1
  1369. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  1370. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  1371. // other types prohibit arguments
  1372. } else if ( match[3] ) {
  1373. Sizzle.error( match[0] );
  1374. }
  1375. return match;
  1376. },
  1377. "PSEUDO": function( match ) {
  1378. var excess,
  1379. unquoted = !match[6] && match[2];
  1380. if ( matchExpr["CHILD"].test( match[0] ) ) {
  1381. return null;
  1382. }
  1383. // Accept quoted arguments as-is
  1384. if ( match[3] ) {
  1385. match[2] = match[4] || match[5] || "";
  1386. // Strip excess characters from unquoted arguments
  1387. } else if ( unquoted && rpseudo.test( unquoted ) &&
  1388. // Get excess from tokenize (recursively)
  1389. (excess = tokenize( unquoted, true )) &&
  1390. // advance to the next closing parenthesis
  1391. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  1392. // excess is a negative index
  1393. match[0] = match[0].slice( 0, excess );
  1394. match[2] = unquoted.slice( 0, excess );
  1395. }
  1396. // Return only captures needed by the pseudo filter method (type and argument)
  1397. return match.slice( 0, 3 );
  1398. }
  1399. },
  1400. filter: {
  1401. "TAG": function( nodeNameSelector ) {
  1402. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  1403. return nodeNameSelector === "*" ?
  1404. function() { return true; } :
  1405. function( elem ) {
  1406. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  1407. };
  1408. },
  1409. "CLASS": function( className ) {
  1410. var pattern = classCache[ className + " " ];
  1411. return pattern ||
  1412. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  1413. classCache( className, function( elem ) {
  1414. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  1415. });
  1416. },
  1417. "ATTR": function( name, operator, check ) {
  1418. return function( elem ) {
  1419. var result = Sizzle.attr( elem, name );
  1420. if ( result == null ) {
  1421. return operator === "!=";
  1422. }
  1423. if ( !operator ) {
  1424. return true;
  1425. }
  1426. result += "";
  1427. return operator === "=" ? result === check :
  1428. operator === "!=" ? result !== check :
  1429. operator === "^=" ? check && result.indexOf( check ) === 0 :
  1430. operator === "*=" ? check && result.indexOf( check ) > -1 :
  1431. operator === "$=" ? check && result.slice( -check.length ) === check :
  1432. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  1433. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  1434. false;
  1435. };
  1436. },
  1437. "CHILD": function( type, what, argument, first, last ) {
  1438. var simple = type.slice( 0, 3 ) !== "nth",
  1439. forward = type.slice( -4 ) !== "last",
  1440. ofType = what === "of-type";
  1441. return first === 1 && last === 0 ?
  1442. // Shortcut for :nth-*(n)
  1443. function( elem ) {
  1444. return !!elem.parentNode;
  1445. } :
  1446. function( elem, context, xml ) {
  1447. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  1448. dir = simple !== forward ? "nextSibling" : "previousSibling",
  1449. parent = elem.parentNode,
  1450. name = ofType && elem.nodeName.toLowerCase(),
  1451. useCache = !xml && !ofType,
  1452. diff = false;
  1453. if ( parent ) {
  1454. // :(first|last|only)-(child|of-type)
  1455. if ( simple ) {
  1456. while ( dir ) {
  1457. node = elem;
  1458. while ( (node = node[ dir ]) ) {
  1459. if ( ofType ?
  1460. node.nodeName.toLowerCase() === name :
  1461. node.nodeType === 1 ) {
  1462. return false;
  1463. }
  1464. }
  1465. // Reverse direction for :only-* (if we haven't yet done so)
  1466. start = dir = type === "only" && !start && "nextSibling";
  1467. }
  1468. return true;
  1469. }
  1470. start = [ forward ? parent.firstChild : parent.lastChild ];
  1471. // non-xml :nth-child(...) stores cache data on `parent`
  1472. if ( forward && useCache ) {
  1473. // Seek `elem` from a previously-cached index
  1474. // ...in a gzip-friendly way
  1475. node = parent;
  1476. outerCache = node[ expando ] || (node[ expando ] = {});
  1477. // Support: IE <9 only
  1478. // Defend against cloned attroperties (jQuery gh-1709)
  1479. uniqueCache = outerCache[ node.uniqueID ] ||
  1480. (outerCache[ node.uniqueID ] = {});
  1481. cache = uniqueCache[ type ] || [];
  1482. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1483. diff = nodeIndex && cache[ 2 ];
  1484. node = nodeIndex && parent.childNodes[ nodeIndex ];
  1485. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1486. // Fallback to seeking `elem` from the start
  1487. (diff = nodeIndex = 0) || start.pop()) ) {
  1488. // When found, cache indexes on `parent` and break
  1489. if ( node.nodeType === 1 && ++diff && node === elem ) {
  1490. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  1491. break;
  1492. }
  1493. }
  1494. } else {
  1495. // Use previously-cached element index if available
  1496. if ( useCache ) {
  1497. // ...in a gzip-friendly way
  1498. node = elem;
  1499. outerCache = node[ expando ] || (node[ expando ] = {});
  1500. // Support: IE <9 only
  1501. // Defend against cloned attroperties (jQuery gh-1709)
  1502. uniqueCache = outerCache[ node.uniqueID ] ||
  1503. (outerCache[ node.uniqueID ] = {});
  1504. cache = uniqueCache[ type ] || [];
  1505. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1506. diff = nodeIndex;
  1507. }
  1508. // xml :nth-child(...)
  1509. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  1510. if ( diff === false ) {
  1511. // Use the same loop as above to seek `elem` from the start
  1512. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1513. (diff = nodeIndex = 0) || start.pop()) ) {
  1514. if ( ( ofType ?
  1515. node.nodeName.toLowerCase() === name :
  1516. node.nodeType === 1 ) &&
  1517. ++diff ) {
  1518. // Cache the index of each encountered element
  1519. if ( useCache ) {
  1520. outerCache = node[ expando ] || (node[ expando ] = {});
  1521. // Support: IE <9 only
  1522. // Defend against cloned attroperties (jQuery gh-1709)
  1523. uniqueCache = outerCache[ node.uniqueID ] ||
  1524. (outerCache[ node.uniqueID ] = {});
  1525. uniqueCache[ type ] = [ dirruns, diff ];
  1526. }
  1527. if ( node === elem ) {
  1528. break;
  1529. }
  1530. }
  1531. }
  1532. }
  1533. }
  1534. // Incorporate the offset, then check against cycle size
  1535. diff -= last;
  1536. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  1537. }
  1538. };
  1539. },
  1540. "PSEUDO": function( pseudo, argument ) {
  1541. // pseudo-class names are case-insensitive
  1542. // http://www.w3.org/TR/selectors/#pseudo-classes
  1543. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  1544. // Remember that setFilters inherits from pseudos
  1545. var args,
  1546. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  1547. Sizzle.error( "unsupported pseudo: " + pseudo );
  1548. // The user may use createPseudo to indicate that
  1549. // arguments are needed to create the filter function
  1550. // just as Sizzle does
  1551. if ( fn[ expando ] ) {
  1552. return fn( argument );
  1553. }
  1554. // But maintain support for old signatures
  1555. if ( fn.length > 1 ) {
  1556. args = [ pseudo, pseudo, "", argument ];
  1557. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  1558. markFunction(function( seed, matches ) {
  1559. var idx,
  1560. matched = fn( seed, argument ),
  1561. i = matched.length;
  1562. while ( i-- ) {
  1563. idx = indexOf( seed, matched[i] );
  1564. seed[ idx ] = !( matches[ idx ] = matched[i] );
  1565. }
  1566. }) :
  1567. function( elem ) {
  1568. return fn( elem, 0, args );
  1569. };
  1570. }
  1571. return fn;
  1572. }
  1573. },
  1574. pseudos: {
  1575. // Potentially complex pseudos
  1576. "not": markFunction(function( selector ) {
  1577. // Trim the selector passed to compile
  1578. // to avoid treating leading and trailing
  1579. // spaces as combinators
  1580. var input = [],
  1581. results = [],
  1582. matcher = compile( selector.replace( rtrim, "$1" ) );
  1583. return matcher[ expando ] ?
  1584. markFunction(function( seed, matches, context, xml ) {
  1585. var elem,
  1586. unmatched = matcher( seed, null, xml, [] ),
  1587. i = seed.length;
  1588. // Match elements unmatched by `matcher`
  1589. while ( i-- ) {
  1590. if ( (elem = unmatched[i]) ) {
  1591. seed[i] = !(matches[i] = elem);
  1592. }
  1593. }
  1594. }) :
  1595. function( elem, context, xml ) {
  1596. input[0] = elem;
  1597. matcher( input, null, xml, results );
  1598. // Don't keep the element (issue #299)
  1599. input[0] = null;
  1600. return !results.pop();
  1601. };
  1602. }),
  1603. "has": markFunction(function( selector ) {
  1604. return function( elem ) {
  1605. return Sizzle( selector, elem ).length > 0;
  1606. };
  1607. }),
  1608. "contains": markFunction(function( text ) {
  1609. text = text.replace( runescape, funescape );
  1610. return function( elem ) {
  1611. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  1612. };
  1613. }),
  1614. // "Whether an element is represented by a :lang() selector
  1615. // is based solely on the element's language value
  1616. // being equal to the identifier C,
  1617. // or beginning with the identifier C immediately followed by "-".
  1618. // The matching of C against the element's language value is performed case-insensitively.
  1619. // The identifier C does not have to be a valid language name."
  1620. // http://www.w3.org/TR/selectors/#lang-pseudo
  1621. "lang": markFunction( function( lang ) {
  1622. // lang value must be a valid identifier
  1623. if ( !ridentifier.test(lang || "") ) {
  1624. Sizzle.error( "unsupported lang: " + lang );
  1625. }
  1626. lang = lang.replace( runescape, funescape ).toLowerCase();
  1627. return function( elem ) {
  1628. var elemLang;
  1629. do {
  1630. if ( (elemLang = documentIsHTML ?
  1631. elem.lang :
  1632. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  1633. elemLang = elemLang.toLowerCase();
  1634. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  1635. }
  1636. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  1637. return false;
  1638. };
  1639. }),
  1640. // Miscellaneous
  1641. "target": function( elem ) {
  1642. var hash = window.location && window.location.hash;
  1643. return hash && hash.slice( 1 ) === elem.id;
  1644. },
  1645. "root": function( elem ) {
  1646. return elem === docElem;
  1647. },
  1648. "focus": function( elem ) {
  1649. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  1650. },
  1651. // Boolean properties
  1652. "enabled": createDisabledPseudo( false ),
  1653. "disabled": createDisabledPseudo( true ),
  1654. "checked": function( elem ) {
  1655. // In CSS3, :checked should return both checked and selected elements
  1656. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1657. var nodeName = elem.nodeName.toLowerCase();
  1658. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  1659. },
  1660. "selected": function( elem ) {
  1661. // Accessing this property makes selected-by-default
  1662. // options in Safari work properly
  1663. if ( elem.parentNode ) {
  1664. elem.parentNode.selectedIndex;
  1665. }
  1666. return elem.selected === true;
  1667. },
  1668. // Contents
  1669. "empty": function( elem ) {
  1670. // http://www.w3.org/TR/selectors/#empty-pseudo
  1671. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  1672. // but not by others (comment: 8; processing instruction: 7; etc.)
  1673. // nodeType < 6 works because attributes (2) do not appear as children
  1674. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1675. if ( elem.nodeType < 6 ) {
  1676. return false;
  1677. }
  1678. }
  1679. return true;
  1680. },
  1681. "parent": function( elem ) {
  1682. return !Expr.pseudos["empty"]( elem );
  1683. },
  1684. // Element/input types
  1685. "header": function( elem ) {
  1686. return rheader.test( elem.nodeName );
  1687. },
  1688. "input": function( elem ) {
  1689. return rinputs.test( elem.nodeName );
  1690. },
  1691. "button": function( elem ) {
  1692. var name = elem.nodeName.toLowerCase();
  1693. return name === "input" && elem.type === "button" || name === "button";
  1694. },
  1695. "text": function( elem ) {
  1696. var attr;
  1697. return elem.nodeName.toLowerCase() === "input" &&
  1698. elem.type === "text" &&
  1699. // Support: IE<8
  1700. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  1701. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  1702. },
  1703. // Position-in-collection
  1704. "first": createPositionalPseudo(function() {
  1705. return [ 0 ];
  1706. }),
  1707. "last": createPositionalPseudo(function( matchIndexes, length ) {
  1708. return [ length - 1 ];
  1709. }),
  1710. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1711. return [ argument < 0 ? argument + length : argument ];
  1712. }),
  1713. "even": createPositionalPseudo(function( matchIndexes, length ) {
  1714. var i = 0;
  1715. for ( ; i < length; i += 2 ) {
  1716. matchIndexes.push( i );
  1717. }
  1718. return matchIndexes;
  1719. }),
  1720. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  1721. var i = 1;
  1722. for ( ; i < length; i += 2 ) {
  1723. matchIndexes.push( i );
  1724. }
  1725. return matchIndexes;
  1726. }),
  1727. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1728. var i = argument < 0 ? argument + length : argument;
  1729. for ( ; --i >= 0; ) {
  1730. matchIndexes.push( i );
  1731. }
  1732. return matchIndexes;
  1733. }),
  1734. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1735. var i = argument < 0 ? argument + length : argument;
  1736. for ( ; ++i < length; ) {
  1737. matchIndexes.push( i );
  1738. }
  1739. return matchIndexes;
  1740. })
  1741. }
  1742. };
  1743. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  1744. // Add button/input type pseudos
  1745. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  1746. Expr.pseudos[ i ] = createInputPseudo( i );
  1747. }
  1748. for ( i in { submit: true, reset: true } ) {
  1749. Expr.pseudos[ i ] = createButtonPseudo( i );
  1750. }
  1751. // Easy API for creating new setFilters
  1752. function setFilters() {}
  1753. setFilters.prototype = Expr.filters = Expr.pseudos;
  1754. Expr.setFilters = new setFilters();
  1755. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  1756. var matched, match, tokens, type,
  1757. soFar, groups, preFilters,
  1758. cached = tokenCache[ selector + " " ];
  1759. if ( cached ) {
  1760. return parseOnly ? 0 : cached.slice( 0 );
  1761. }
  1762. soFar = selector;
  1763. groups = [];
  1764. preFilters = Expr.preFilter;
  1765. while ( soFar ) {
  1766. // Comma and first run
  1767. if ( !matched || (match = rcomma.exec( soFar )) ) {
  1768. if ( match ) {
  1769. // Don't consume trailing commas as valid
  1770. soFar = soFar.slice( match[0].length ) || soFar;
  1771. }
  1772. groups.push( (tokens = []) );
  1773. }
  1774. matched = false;
  1775. // Combinators
  1776. if ( (match = rcombinators.exec( soFar )) ) {
  1777. matched = match.shift();
  1778. tokens.push({
  1779. value: matched,
  1780. // Cast descendant combinators to space
  1781. type: match[0].replace( rtrim, " " )
  1782. });
  1783. soFar = soFar.slice( matched.length );
  1784. }
  1785. // Filters
  1786. for ( type in Expr.filter ) {
  1787. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  1788. (match = preFilters[ type ]( match ))) ) {
  1789. matched = match.shift();
  1790. tokens.push({
  1791. value: matched,
  1792. type: type,
  1793. matches: match
  1794. });
  1795. soFar = soFar.slice( matched.length );
  1796. }
  1797. }
  1798. if ( !matched ) {
  1799. break;
  1800. }
  1801. }
  1802. // Return the length of the invalid excess
  1803. // if we're just parsing
  1804. // Otherwise, throw an error or return tokens
  1805. return parseOnly ?
  1806. soFar.length :
  1807. soFar ?
  1808. Sizzle.error( selector ) :
  1809. // Cache the tokens
  1810. tokenCache( selector, groups ).slice( 0 );
  1811. };
  1812. function toSelector( tokens ) {
  1813. var i = 0,
  1814. len = tokens.length,
  1815. selector = "";
  1816. for ( ; i < len; i++ ) {
  1817. selector += tokens[i].value;
  1818. }
  1819. return selector;
  1820. }
  1821. function addCombinator( matcher, combinator, base ) {
  1822. var dir = combinator.dir,
  1823. skip = combinator.next,
  1824. key = skip || dir,
  1825. checkNonElements = base && key === "parentNode",
  1826. doneName = done++;
  1827. return combinator.first ?
  1828. // Check against closest ancestor/preceding element
  1829. function( elem, context, xml ) {
  1830. while ( (elem = elem[ dir ]) ) {
  1831. if ( elem.nodeType === 1 || checkNonElements ) {
  1832. return matcher( elem, context, xml );
  1833. }
  1834. }
  1835. return false;
  1836. } :
  1837. // Check against all ancestor/preceding elements
  1838. function( elem, context, xml ) {
  1839. var oldCache, uniqueCache, outerCache,
  1840. newCache = [ dirruns, doneName ];
  1841. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  1842. if ( xml ) {
  1843. while ( (elem = elem[ dir ]) ) {
  1844. if ( elem.nodeType === 1 || checkNonElements ) {
  1845. if ( matcher( elem, context, xml ) ) {
  1846. return true;
  1847. }
  1848. }
  1849. }
  1850. } else {
  1851. while ( (elem = elem[ dir ]) ) {
  1852. if ( elem.nodeType === 1 || checkNonElements ) {
  1853. outerCache = elem[ expando ] || (elem[ expando ] = {});
  1854. // Support: IE <9 only
  1855. // Defend against cloned attroperties (jQuery gh-1709)
  1856. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  1857. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  1858. elem = elem[ dir ] || elem;
  1859. } else if ( (oldCache = uniqueCache[ key ]) &&
  1860. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  1861. // Assign to newCache so results back-propagate to previous elements
  1862. return (newCache[ 2 ] = oldCache[ 2 ]);
  1863. } else {
  1864. // Reuse newcache so results back-propagate to previous elements
  1865. uniqueCache[ key ] = newCache;
  1866. // A match means we're done; a fail means we have to keep checking
  1867. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  1868. return true;
  1869. }
  1870. }
  1871. }
  1872. }
  1873. }
  1874. return false;
  1875. };
  1876. }
  1877. function elementMatcher( matchers ) {
  1878. return matchers.length > 1 ?
  1879. function( elem, context, xml ) {
  1880. var i = matchers.length;
  1881. while ( i-- ) {
  1882. if ( !matchers[i]( elem, context, xml ) ) {
  1883. return false;
  1884. }
  1885. }
  1886. return true;
  1887. } :
  1888. matchers[0];
  1889. }
  1890. function multipleContexts( selector, contexts, results ) {
  1891. var i = 0,
  1892. len = contexts.length;
  1893. for ( ; i < len; i++ ) {
  1894. Sizzle( selector, contexts[i], results );
  1895. }
  1896. return results;
  1897. }
  1898. function condense( unmatched, map, filter, context, xml ) {
  1899. var elem,
  1900. newUnmatched = [],
  1901. i = 0,
  1902. len = unmatched.length,
  1903. mapped = map != null;
  1904. for ( ; i < len; i++ ) {
  1905. if ( (elem = unmatched[i]) ) {
  1906. if ( !filter || filter( elem, context, xml ) ) {
  1907. newUnmatched.push( elem );
  1908. if ( mapped ) {
  1909. map.push( i );
  1910. }
  1911. }
  1912. }
  1913. }
  1914. return newUnmatched;
  1915. }
  1916. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  1917. if ( postFilter && !postFilter[ expando ] ) {
  1918. postFilter = setMatcher( postFilter );
  1919. }
  1920. if ( postFinder && !postFinder[ expando ] ) {
  1921. postFinder = setMatcher( postFinder, postSelector );
  1922. }
  1923. return markFunction(function( seed, results, context, xml ) {
  1924. var temp, i, elem,
  1925. preMap = [],
  1926. postMap = [],
  1927. preexisting = results.length,
  1928. // Get initial elements from seed or context
  1929. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  1930. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  1931. matcherIn = preFilter && ( seed || !selector ) ?
  1932. condense( elems, preMap, preFilter, context, xml ) :
  1933. elems,
  1934. matcherOut = matcher ?
  1935. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  1936. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  1937. // ...intermediate processing is necessary
  1938. [] :
  1939. // ...otherwise use results directly
  1940. results :
  1941. matcherIn;
  1942. // Find primary matches
  1943. if ( matcher ) {
  1944. matcher( matcherIn, matcherOut, context, xml );
  1945. }
  1946. // Apply postFilter
  1947. if ( postFilter ) {
  1948. temp = condense( matcherOut, postMap );
  1949. postFilter( temp, [], context, xml );
  1950. // Un-match failing elements by moving them back to matcherIn
  1951. i = temp.length;
  1952. while ( i-- ) {
  1953. if ( (elem = temp[i]) ) {
  1954. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  1955. }
  1956. }
  1957. }
  1958. if ( seed ) {
  1959. if ( postFinder || preFilter ) {
  1960. if ( postFinder ) {
  1961. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  1962. temp = [];
  1963. i = matcherOut.length;
  1964. while ( i-- ) {
  1965. if ( (elem = matcherOut[i]) ) {
  1966. // Restore matcherIn since elem is not yet a final match
  1967. temp.push( (matcherIn[i] = elem) );
  1968. }
  1969. }
  1970. postFinder( null, (matcherOut = []), temp, xml );
  1971. }
  1972. // Move matched elements from seed to results to keep them synchronized
  1973. i = matcherOut.length;
  1974. while ( i-- ) {
  1975. if ( (elem = matcherOut[i]) &&
  1976. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  1977. seed[temp] = !(results[temp] = elem);
  1978. }
  1979. }
  1980. }
  1981. // Add elements to results, through postFinder if defined
  1982. } else {
  1983. matcherOut = condense(
  1984. matcherOut === results ?
  1985. matcherOut.splice( preexisting, matcherOut.length ) :
  1986. matcherOut
  1987. );
  1988. if ( postFinder ) {
  1989. postFinder( null, results, matcherOut, xml );
  1990. } else {
  1991. push.apply( results, matcherOut );
  1992. }
  1993. }
  1994. });
  1995. }
  1996. function matcherFromTokens( tokens ) {
  1997. var checkContext, matcher, j,
  1998. len = tokens.length,
  1999. leadingRelative = Expr.relative[ tokens[0].type ],
  2000. implicitRelative = leadingRelative || Expr.relative[" "],
  2001. i = leadingRelative ? 1 : 0,
  2002. // The foundational matcher ensures that elements are reachable from top-level context(s)
  2003. matchContext = addCombinator( function( elem ) {
  2004. return elem === checkContext;
  2005. }, implicitRelative, true ),
  2006. matchAnyContext = addCombinator( function( elem ) {
  2007. return indexOf( checkContext, elem ) > -1;
  2008. }, implicitRelative, true ),
  2009. matchers = [ function( elem, context, xml ) {
  2010. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  2011. (checkContext = context).nodeType ?
  2012. matchContext( elem, context, xml ) :
  2013. matchAnyContext( elem, context, xml ) );
  2014. // Avoid hanging onto element (issue #299)
  2015. checkContext = null;
  2016. return ret;
  2017. } ];
  2018. for ( ; i < len; i++ ) {
  2019. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  2020. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  2021. } else {
  2022. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  2023. // Return special upon seeing a positional matcher
  2024. if ( matcher[ expando ] ) {
  2025. // Find the next relative operator (if any) for proper handling
  2026. j = ++i;
  2027. for ( ; j < len; j++ ) {
  2028. if ( Expr.relative[ tokens[j].type ] ) {
  2029. break;
  2030. }
  2031. }
  2032. return setMatcher(
  2033. i > 1 && elementMatcher( matchers ),
  2034. i > 1 && toSelector(
  2035. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2036. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  2037. ).replace( rtrim, "$1" ),
  2038. matcher,
  2039. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  2040. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  2041. j < len && toSelector( tokens )
  2042. );
  2043. }
  2044. matchers.push( matcher );
  2045. }
  2046. }
  2047. return elementMatcher( matchers );
  2048. }
  2049. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  2050. var bySet = setMatchers.length > 0,
  2051. byElement = elementMatchers.length > 0,
  2052. superMatcher = function( seed, context, xml, results, outermost ) {
  2053. var elem, j, matcher,
  2054. matchedCount = 0,
  2055. i = "0",
  2056. unmatched = seed && [],
  2057. setMatched = [],
  2058. contextBackup = outermostContext,
  2059. // We must always have either seed elements or outermost context
  2060. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  2061. // Use integer dirruns iff this is the outermost matcher
  2062. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  2063. len = elems.length;
  2064. if ( outermost ) {
  2065. outermostContext = context === document || context || outermost;
  2066. }
  2067. // Add elements passing elementMatchers directly to results
  2068. // Support: IE<9, Safari
  2069. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  2070. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  2071. if ( byElement && elem ) {
  2072. j = 0;
  2073. if ( !context && elem.ownerDocument !== document ) {
  2074. setDocument( elem );
  2075. xml = !documentIsHTML;
  2076. }
  2077. while ( (matcher = elementMatchers[j++]) ) {
  2078. if ( matcher( elem, context || document, xml) ) {
  2079. results.push( elem );
  2080. break;
  2081. }
  2082. }
  2083. if ( outermost ) {
  2084. dirruns = dirrunsUnique;
  2085. }
  2086. }
  2087. // Track unmatched elements for set filters
  2088. if ( bySet ) {
  2089. // They will have gone through all possible matchers
  2090. if ( (elem = !matcher && elem) ) {
  2091. matchedCount--;
  2092. }
  2093. // Lengthen the array for every element, matched or not
  2094. if ( seed ) {
  2095. unmatched.push( elem );
  2096. }
  2097. }
  2098. }
  2099. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  2100. // makes the latter nonnegative.
  2101. matchedCount += i;
  2102. // Apply set filters to unmatched elements
  2103. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  2104. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  2105. // no element matchers and no seed.
  2106. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  2107. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  2108. // numerically zero.
  2109. if ( bySet && i !== matchedCount ) {
  2110. j = 0;
  2111. while ( (matcher = setMatchers[j++]) ) {
  2112. matcher( unmatched, setMatched, context, xml );
  2113. }
  2114. if ( seed ) {
  2115. // Reintegrate element matches to eliminate the need for sorting
  2116. if ( matchedCount > 0 ) {
  2117. while ( i-- ) {
  2118. if ( !(unmatched[i] || setMatched[i]) ) {
  2119. setMatched[i] = pop.call( results );
  2120. }
  2121. }
  2122. }
  2123. // Discard index placeholder values to get only actual matches
  2124. setMatched = condense( setMatched );
  2125. }
  2126. // Add matches to results
  2127. push.apply( results, setMatched );
  2128. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2129. if ( outermost && !seed && setMatched.length > 0 &&
  2130. ( matchedCount + setMatchers.length ) > 1 ) {
  2131. Sizzle.uniqueSort( results );
  2132. }
  2133. }
  2134. // Override manipulation of globals by nested matchers
  2135. if ( outermost ) {
  2136. dirruns = dirrunsUnique;
  2137. outermostContext = contextBackup;
  2138. }
  2139. return unmatched;
  2140. };
  2141. return bySet ?
  2142. markFunction( superMatcher ) :
  2143. superMatcher;
  2144. }
  2145. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  2146. var i,
  2147. setMatchers = [],
  2148. elementMatchers = [],
  2149. cached = compilerCache[ selector + " " ];
  2150. if ( !cached ) {
  2151. // Generate a function of recursive functions that can be used to check each element
  2152. if ( !match ) {
  2153. match = tokenize( selector );
  2154. }
  2155. i = match.length;
  2156. while ( i-- ) {
  2157. cached = matcherFromTokens( match[i] );
  2158. if ( cached[ expando ] ) {
  2159. setMatchers.push( cached );
  2160. } else {
  2161. elementMatchers.push( cached );
  2162. }
  2163. }
  2164. // Cache the compiled function
  2165. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  2166. // Save selector and tokenization
  2167. cached.selector = selector;
  2168. }
  2169. return cached;
  2170. };
  2171. /**
  2172. * A low-level selection function that works with Sizzle's compiled
  2173. * selector functions
  2174. * @param {String|Function} selector A selector or a pre-compiled
  2175. * selector function built with Sizzle.compile
  2176. * @param {Element} context
  2177. * @param {Array} [results]
  2178. * @param {Array} [seed] A set of elements to match against
  2179. */
  2180. select = Sizzle.select = function( selector, context, results, seed ) {
  2181. var i, tokens, token, type, find,
  2182. compiled = typeof selector === "function" && selector,
  2183. match = !seed && tokenize( (selector = compiled.selector || selector) );
  2184. results = results || [];
  2185. // Try to minimize operations if there is only one selector in the list and no seed
  2186. // (the latter of which guarantees us context)
  2187. if ( match.length === 1 ) {
  2188. // Reduce context if the leading compound selector is an ID
  2189. tokens = match[0] = match[0].slice( 0 );
  2190. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  2191. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  2192. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  2193. if ( !context ) {
  2194. return results;
  2195. // Precompiled matchers will still verify ancestry, so step up a level
  2196. } else if ( compiled ) {
  2197. context = context.parentNode;
  2198. }
  2199. selector = selector.slice( tokens.shift().value.length );
  2200. }
  2201. // Fetch a seed set for right-to-left matching
  2202. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  2203. while ( i-- ) {
  2204. token = tokens[i];
  2205. // Abort if we hit a combinator
  2206. if ( Expr.relative[ (type = token.type) ] ) {
  2207. break;
  2208. }
  2209. if ( (find = Expr.find[ type ]) ) {
  2210. // Search, expanding context for leading sibling combinators
  2211. if ( (seed = find(
  2212. token.matches[0].replace( runescape, funescape ),
  2213. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  2214. )) ) {
  2215. // If seed is empty or no tokens remain, we can return early
  2216. tokens.splice( i, 1 );
  2217. selector = seed.length && toSelector( tokens );
  2218. if ( !selector ) {
  2219. push.apply( results, seed );
  2220. return results;
  2221. }
  2222. break;
  2223. }
  2224. }
  2225. }
  2226. }
  2227. // Compile and execute a filtering function if one is not provided
  2228. // Provide `match` to avoid retokenization if we modified the selector above
  2229. ( compiled || compile( selector, match ) )(
  2230. seed,
  2231. context,
  2232. !documentIsHTML,
  2233. results,
  2234. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  2235. );
  2236. return results;
  2237. };
  2238. // One-time assignments
  2239. // Sort stability
  2240. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  2241. // Support: Chrome 14-35+
  2242. // Always assume duplicates if they aren't passed to the comparison function
  2243. support.detectDuplicates = !!hasDuplicate;
  2244. // Initialize against the default document
  2245. setDocument();
  2246. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  2247. // Detached nodes confoundingly follow *each other*
  2248. support.sortDetached = assert(function( el ) {
  2249. // Should return 1, but returns 4 (following)
  2250. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  2251. });
  2252. // Support: IE<8
  2253. // Prevent attribute/property "interpolation"
  2254. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  2255. if ( !assert(function( el ) {
  2256. el.innerHTML = "<a href='#'></a>";
  2257. return el.firstChild.getAttribute("href") === "#" ;
  2258. }) ) {
  2259. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  2260. if ( !isXML ) {
  2261. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  2262. }
  2263. });
  2264. }
  2265. // Support: IE<9
  2266. // Use defaultValue in place of getAttribute("value")
  2267. if ( !support.attributes || !assert(function( el ) {
  2268. el.innerHTML = "<input/>";
  2269. el.firstChild.setAttribute( "value", "" );
  2270. return el.firstChild.getAttribute( "value" ) === "";
  2271. }) ) {
  2272. addHandle( "value", function( elem, name, isXML ) {
  2273. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  2274. return elem.defaultValue;
  2275. }
  2276. });
  2277. }
  2278. // Support: IE<9
  2279. // Use getAttributeNode to fetch booleans when getAttribute lies
  2280. if ( !assert(function( el ) {
  2281. return el.getAttribute("disabled") == null;
  2282. }) ) {
  2283. addHandle( booleans, function( elem, name, isXML ) {
  2284. var val;
  2285. if ( !isXML ) {
  2286. return elem[ name ] === true ? name.toLowerCase() :
  2287. (val = elem.getAttributeNode( name )) && val.specified ?
  2288. val.value :
  2289. null;
  2290. }
  2291. });
  2292. }
  2293. return Sizzle;
  2294. })( window );
  2295. jQuery.find = Sizzle;
  2296. jQuery.expr = Sizzle.selectors;
  2297. // Deprecated
  2298. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  2299. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  2300. jQuery.text = Sizzle.getText;
  2301. jQuery.isXMLDoc = Sizzle.isXML;
  2302. jQuery.contains = Sizzle.contains;
  2303. jQuery.escapeSelector = Sizzle.escape;
  2304. var dir = function( elem, dir, until ) {
  2305. var matched = [],
  2306. truncate = until !== undefined;
  2307. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  2308. if ( elem.nodeType === 1 ) {
  2309. if ( truncate && jQuery( elem ).is( until ) ) {
  2310. break;
  2311. }
  2312. matched.push( elem );
  2313. }
  2314. }
  2315. return matched;
  2316. };
  2317. var siblings = function( n, elem ) {
  2318. var matched = [];
  2319. for ( ; n; n = n.nextSibling ) {
  2320. if ( n.nodeType === 1 && n !== elem ) {
  2321. matched.push( n );
  2322. }
  2323. }
  2324. return matched;
  2325. };
  2326. var rneedsContext = jQuery.expr.match.needsContext;
  2327. function nodeName( elem, name ) {
  2328. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  2329. };
  2330. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  2331. // Implement the identical functionality for filter and not
  2332. function winnow( elements, qualifier, not ) {
  2333. if ( isFunction( qualifier ) ) {
  2334. return jQuery.grep( elements, function( elem, i ) {
  2335. return !!qualifier.call( elem, i, elem ) !== not;
  2336. } );
  2337. }
  2338. // Single element
  2339. if ( qualifier.nodeType ) {
  2340. return jQuery.grep( elements, function( elem ) {
  2341. return ( elem === qualifier ) !== not;
  2342. } );
  2343. }
  2344. // Arraylike of elements (jQuery, arguments, Array)
  2345. if ( typeof qualifier !== "string" ) {
  2346. return jQuery.grep( elements, function( elem ) {
  2347. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  2348. } );
  2349. }
  2350. // Filtered directly for both simple and complex selectors
  2351. return jQuery.filter( qualifier, elements, not );
  2352. }
  2353. jQuery.filter = function( expr, elems, not ) {
  2354. var elem = elems[ 0 ];
  2355. if ( not ) {
  2356. expr = ":not(" + expr + ")";
  2357. }
  2358. if ( elems.length === 1 && elem.nodeType === 1 ) {
  2359. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  2360. }
  2361. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  2362. return elem.nodeType === 1;
  2363. } ) );
  2364. };
  2365. jQuery.fn.extend( {
  2366. find: function( selector ) {
  2367. var i, ret,
  2368. len = this.length,
  2369. self = this;
  2370. if ( typeof selector !== "string" ) {
  2371. return this.pushStack( jQuery( selector ).filter( function() {
  2372. for ( i = 0; i < len; i++ ) {
  2373. if ( jQuery.contains( self[ i ], this ) ) {
  2374. return true;
  2375. }
  2376. }
  2377. } ) );
  2378. }
  2379. ret = this.pushStack( [] );
  2380. for ( i = 0; i < len; i++ ) {
  2381. jQuery.find( selector, self[ i ], ret );
  2382. }
  2383. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  2384. },
  2385. filter: function( selector ) {
  2386. return this.pushStack( winnow( this, selector || [], false ) );
  2387. },
  2388. not: function( selector ) {
  2389. return this.pushStack( winnow( this, selector || [], true ) );
  2390. },
  2391. is: function( selector ) {
  2392. return !!winnow(
  2393. this,
  2394. // If this is a positional/relative selector, check membership in the returned set
  2395. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  2396. typeof selector === "string" && rneedsContext.test( selector ) ?
  2397. jQuery( selector ) :
  2398. selector || [],
  2399. false
  2400. ).length;
  2401. }
  2402. } );
  2403. // Initialize a jQuery object
  2404. // A central reference to the root jQuery(document)
  2405. var rootjQuery,
  2406. // A simple way to check for HTML strings
  2407. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  2408. // Strict HTML recognition (#11290: must start with <)
  2409. // Shortcut simple #id case for speed
  2410. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  2411. init = jQuery.fn.init = function( selector, context, root ) {
  2412. var match, elem;
  2413. // HANDLE: $(""), $(null), $(undefined), $(false)
  2414. if ( !selector ) {
  2415. return this;
  2416. }
  2417. // Method init() accepts an alternate rootjQuery
  2418. // so migrate can support jQuery.sub (gh-2101)
  2419. root = root || rootjQuery;
  2420. // Handle HTML strings
  2421. if ( typeof selector === "string" ) {
  2422. if ( selector[ 0 ] === "<" &&
  2423. selector[ selector.length - 1 ] === ">" &&
  2424. selector.length >= 3 ) {
  2425. // Assume that strings that start and end with <> are HTML and skip the regex check
  2426. match = [ null, selector, null ];
  2427. } else {
  2428. match = rquickExpr.exec( selector );
  2429. }
  2430. // Match html or make sure no context is specified for #id
  2431. if ( match && ( match[ 1 ] || !context ) ) {
  2432. // HANDLE: $(html) -> $(array)
  2433. if ( match[ 1 ] ) {
  2434. context = context instanceof jQuery ? context[ 0 ] : context;
  2435. // Option to run scripts is true for back-compat
  2436. // Intentionally let the error be thrown if parseHTML is not present
  2437. jQuery.merge( this, jQuery.parseHTML(
  2438. match[ 1 ],
  2439. context && context.nodeType ? context.ownerDocument || context : document,
  2440. true
  2441. ) );
  2442. // HANDLE: $(html, props)
  2443. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  2444. for ( match in context ) {
  2445. // Properties of context are called as methods if possible
  2446. if ( isFunction( this[ match ] ) ) {
  2447. this[ match ]( context[ match ] );
  2448. // ...and otherwise set as attributes
  2449. } else {
  2450. this.attr( match, context[ match ] );
  2451. }
  2452. }
  2453. }
  2454. return this;
  2455. // HANDLE: $(#id)
  2456. } else {
  2457. elem = document.getElementById( match[ 2 ] );
  2458. if ( elem ) {
  2459. // Inject the element directly into the jQuery object
  2460. this[ 0 ] = elem;
  2461. this.length = 1;
  2462. }
  2463. return this;
  2464. }
  2465. // HANDLE: $(expr, $(...))
  2466. } else if ( !context || context.jquery ) {
  2467. return ( context || root ).find( selector );
  2468. // HANDLE: $(expr, context)
  2469. // (which is just equivalent to: $(context).find(expr)
  2470. } else {
  2471. return this.constructor( context ).find( selector );
  2472. }
  2473. // HANDLE: $(DOMElement)
  2474. } else if ( selector.nodeType ) {
  2475. this[ 0 ] = selector;
  2476. this.length = 1;
  2477. return this;
  2478. // HANDLE: $(function)
  2479. // Shortcut for document ready
  2480. } else if ( isFunction( selector ) ) {
  2481. return root.ready !== undefined ?
  2482. root.ready( selector ) :
  2483. // Execute immediately if ready is not present
  2484. selector( jQuery );
  2485. }
  2486. return jQuery.makeArray( selector, this );
  2487. };
  2488. // Give the init function the jQuery prototype for later instantiation
  2489. init.prototype = jQuery.fn;
  2490. // Initialize central reference
  2491. rootjQuery = jQuery( document );
  2492. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  2493. // Methods guaranteed to produce a unique set when starting from a unique set
  2494. guaranteedUnique = {
  2495. children: true,
  2496. contents: true,
  2497. next: true,
  2498. prev: true
  2499. };
  2500. jQuery.fn.extend( {
  2501. has: function( target ) {
  2502. var targets = jQuery( target, this ),
  2503. l = targets.length;
  2504. return this.filter( function() {
  2505. var i = 0;
  2506. for ( ; i < l; i++ ) {
  2507. if ( jQuery.contains( this, targets[ i ] ) ) {
  2508. return true;
  2509. }
  2510. }
  2511. } );
  2512. },
  2513. closest: function( selectors, context ) {
  2514. var cur,
  2515. i = 0,
  2516. l = this.length,
  2517. matched = [],
  2518. targets = typeof selectors !== "string" && jQuery( selectors );
  2519. // Positional selectors never match, since there's no _selection_ context
  2520. if ( !rneedsContext.test( selectors ) ) {
  2521. for ( ; i < l; i++ ) {
  2522. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  2523. // Always skip document fragments
  2524. if ( cur.nodeType < 11 && ( targets ?
  2525. targets.index( cur ) > -1 :
  2526. // Don't pass non-elements to Sizzle
  2527. cur.nodeType === 1 &&
  2528. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  2529. matched.push( cur );
  2530. break;
  2531. }
  2532. }
  2533. }
  2534. }
  2535. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  2536. },
  2537. // Determine the position of an element within the set
  2538. index: function( elem ) {
  2539. // No argument, return index in parent
  2540. if ( !elem ) {
  2541. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  2542. }
  2543. // Index in selector
  2544. if ( typeof elem === "string" ) {
  2545. return indexOf.call( jQuery( elem ), this[ 0 ] );
  2546. }
  2547. // Locate the position of the desired element
  2548. return indexOf.call( this,
  2549. // If it receives a jQuery object, the first element is used
  2550. elem.jquery ? elem[ 0 ] : elem
  2551. );
  2552. },
  2553. add: function( selector, context ) {
  2554. return this.pushStack(
  2555. jQuery.uniqueSort(
  2556. jQuery.merge( this.get(), jQuery( selector, context ) )
  2557. )
  2558. );
  2559. },
  2560. addBack: function( selector ) {
  2561. return this.add( selector == null ?
  2562. this.prevObject : this.prevObject.filter( selector )
  2563. );
  2564. }
  2565. } );
  2566. function sibling( cur, dir ) {
  2567. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  2568. return cur;
  2569. }
  2570. jQuery.each( {
  2571. parent: function( elem ) {
  2572. var parent = elem.parentNode;
  2573. return parent && parent.nodeType !== 11 ? parent : null;
  2574. },
  2575. parents: function( elem ) {
  2576. return dir( elem, "parentNode" );
  2577. },
  2578. parentsUntil: function( elem, i, until ) {
  2579. return dir( elem, "parentNode", until );
  2580. },
  2581. next: function( elem ) {
  2582. return sibling( elem, "nextSibling" );
  2583. },
  2584. prev: function( elem ) {
  2585. return sibling( elem, "previousSibling" );
  2586. },
  2587. nextAll: function( elem ) {
  2588. return dir( elem, "nextSibling" );
  2589. },
  2590. prevAll: function( elem ) {
  2591. return dir( elem, "previousSibling" );
  2592. },
  2593. nextUntil: function( elem, i, until ) {
  2594. return dir( elem, "nextSibling", until );
  2595. },
  2596. prevUntil: function( elem, i, until ) {
  2597. return dir( elem, "previousSibling", until );
  2598. },
  2599. siblings: function( elem ) {
  2600. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  2601. },
  2602. children: function( elem ) {
  2603. return siblings( elem.firstChild );
  2604. },
  2605. contents: function( elem ) {
  2606. if ( nodeName( elem, "iframe" ) ) {
  2607. return elem.contentDocument;
  2608. }
  2609. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  2610. // Treat the template element as a regular one in browsers that
  2611. // don't support it.
  2612. if ( nodeName( elem, "template" ) ) {
  2613. elem = elem.content || elem;
  2614. }
  2615. return jQuery.merge( [], elem.childNodes );
  2616. }
  2617. }, function( name, fn ) {
  2618. jQuery.fn[ name ] = function( until, selector ) {
  2619. var matched = jQuery.map( this, fn, until );
  2620. if ( name.slice( -5 ) !== "Until" ) {
  2621. selector = until;
  2622. }
  2623. if ( selector && typeof selector === "string" ) {
  2624. matched = jQuery.filter( selector, matched );
  2625. }
  2626. if ( this.length > 1 ) {
  2627. // Remove duplicates
  2628. if ( !guaranteedUnique[ name ] ) {
  2629. jQuery.uniqueSort( matched );
  2630. }
  2631. // Reverse order for parents* and prev-derivatives
  2632. if ( rparentsprev.test( name ) ) {
  2633. matched.reverse();
  2634. }
  2635. }
  2636. return this.pushStack( matched );
  2637. };
  2638. } );
  2639. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  2640. // Convert String-formatted options into Object-formatted ones
  2641. function createOptions( options ) {
  2642. var object = {};
  2643. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  2644. object[ flag ] = true;
  2645. } );
  2646. return object;
  2647. }
  2648. /*
  2649. * Create a callback list using the following parameters:
  2650. *
  2651. * options: an optional list of space-separated options that will change how
  2652. * the callback list behaves or a more traditional option object
  2653. *
  2654. * By default a callback list will act like an event callback list and can be
  2655. * "fired" multiple times.
  2656. *
  2657. * Possible options:
  2658. *
  2659. * once: will ensure the callback list can only be fired once (like a Deferred)
  2660. *
  2661. * memory: will keep track of previous values and will call any callback added
  2662. * after the list has been fired right away with the latest "memorized"
  2663. * values (like a Deferred)
  2664. *
  2665. * unique: will ensure a callback can only be added once (no duplicate in the list)
  2666. *
  2667. * stopOnFalse: interrupt callings when a callback returns false
  2668. *
  2669. */
  2670. jQuery.Callbacks = function( options ) {
  2671. // Convert options from String-formatted to Object-formatted if needed
  2672. // (we check in cache first)
  2673. options = typeof options === "string" ?
  2674. createOptions( options ) :
  2675. jQuery.extend( {}, options );
  2676. var // Flag to know if list is currently firing
  2677. firing,
  2678. // Last fire value for non-forgettable lists
  2679. memory,
  2680. // Flag to know if list was already fired
  2681. fired,
  2682. // Flag to prevent firing
  2683. locked,
  2684. // Actual callback list
  2685. list = [],
  2686. // Queue of execution data for repeatable lists
  2687. queue = [],
  2688. // Index of currently firing callback (modified by add/remove as needed)
  2689. firingIndex = -1,
  2690. // Fire callbacks
  2691. fire = function() {
  2692. // Enforce single-firing
  2693. locked = locked || options.once;
  2694. // Execute callbacks for all pending executions,
  2695. // respecting firingIndex overrides and runtime changes
  2696. fired = firing = true;
  2697. for ( ; queue.length; firingIndex = -1 ) {
  2698. memory = queue.shift();
  2699. while ( ++firingIndex < list.length ) {
  2700. // Run callback and check for early termination
  2701. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  2702. options.stopOnFalse ) {
  2703. // Jump to end and forget the data so .add doesn't re-fire
  2704. firingIndex = list.length;
  2705. memory = false;
  2706. }
  2707. }
  2708. }
  2709. // Forget the data if we're done with it
  2710. if ( !options.memory ) {
  2711. memory = false;
  2712. }
  2713. firing = false;
  2714. // Clean up if we're done firing for good
  2715. if ( locked ) {
  2716. // Keep an empty list if we have data for future add calls
  2717. if ( memory ) {
  2718. list = [];
  2719. // Otherwise, this object is spent
  2720. } else {
  2721. list = "";
  2722. }
  2723. }
  2724. },
  2725. // Actual Callbacks object
  2726. self = {
  2727. // Add a callback or a collection of callbacks to the list
  2728. add: function() {
  2729. if ( list ) {
  2730. // If we have memory from a past run, we should fire after adding
  2731. if ( memory && !firing ) {
  2732. firingIndex = list.length - 1;
  2733. queue.push( memory );
  2734. }
  2735. ( function add( args ) {
  2736. jQuery.each( args, function( _, arg ) {
  2737. if ( isFunction( arg ) ) {
  2738. if ( !options.unique || !self.has( arg ) ) {
  2739. list.push( arg );
  2740. }
  2741. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  2742. // Inspect recursively
  2743. add( arg );
  2744. }
  2745. } );
  2746. } )( arguments );
  2747. if ( memory && !firing ) {
  2748. fire();
  2749. }
  2750. }
  2751. return this;
  2752. },
  2753. // Remove a callback from the list
  2754. remove: function() {
  2755. jQuery.each( arguments, function( _, arg ) {
  2756. var index;
  2757. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  2758. list.splice( index, 1 );
  2759. // Handle firing indexes
  2760. if ( index <= firingIndex ) {
  2761. firingIndex--;
  2762. }
  2763. }
  2764. } );
  2765. return this;
  2766. },
  2767. // Check if a given callback is in the list.
  2768. // If no argument is given, return whether or not list has callbacks attached.
  2769. has: function( fn ) {
  2770. return fn ?
  2771. jQuery.inArray( fn, list ) > -1 :
  2772. list.length > 0;
  2773. },
  2774. // Remove all callbacks from the list
  2775. empty: function() {
  2776. if ( list ) {
  2777. list = [];
  2778. }
  2779. return this;
  2780. },
  2781. // Disable .fire and .add
  2782. // Abort any current/pending executions
  2783. // Clear all callbacks and values
  2784. disable: function() {
  2785. locked = queue = [];
  2786. list = memory = "";
  2787. return this;
  2788. },
  2789. disabled: function() {
  2790. return !list;
  2791. },
  2792. // Disable .fire
  2793. // Also disable .add unless we have memory (since it would have no effect)
  2794. // Abort any pending executions
  2795. lock: function() {
  2796. locked = queue = [];
  2797. if ( !memory && !firing ) {
  2798. list = memory = "";
  2799. }
  2800. return this;
  2801. },
  2802. locked: function() {
  2803. return !!locked;
  2804. },
  2805. // Call all callbacks with the given context and arguments
  2806. fireWith: function( context, args ) {
  2807. if ( !locked ) {
  2808. args = args || [];
  2809. args = [ context, args.slice ? args.slice() : args ];
  2810. queue.push( args );
  2811. if ( !firing ) {
  2812. fire();
  2813. }
  2814. }
  2815. return this;
  2816. },
  2817. // Call all the callbacks with the given arguments
  2818. fire: function() {
  2819. self.fireWith( this, arguments );
  2820. return this;
  2821. },
  2822. // To know if the callbacks have already been called at least once
  2823. fired: function() {
  2824. return !!fired;
  2825. }
  2826. };
  2827. return self;
  2828. };
  2829. function Identity( v ) {
  2830. return v;
  2831. }
  2832. function Thrower( ex ) {
  2833. throw ex;
  2834. }
  2835. function adoptValue( value, resolve, reject, noValue ) {
  2836. var method;
  2837. try {
  2838. // Check for promise aspect first to privilege synchronous behavior
  2839. if ( value && isFunction( ( method = value.promise ) ) ) {
  2840. method.call( value ).done( resolve ).fail( reject );
  2841. // Other thenables
  2842. } else if ( value && isFunction( ( method = value.then ) ) ) {
  2843. method.call( value, resolve, reject );
  2844. // Other non-thenables
  2845. } else {
  2846. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  2847. // * false: [ value ].slice( 0 ) => resolve( value )
  2848. // * true: [ value ].slice( 1 ) => resolve()
  2849. resolve.apply( undefined, [ value ].slice( noValue ) );
  2850. }
  2851. // For Promises/A+, convert exceptions into rejections
  2852. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  2853. // Deferred#then to conditionally suppress rejection.
  2854. } catch ( value ) {
  2855. // Support: Android 4.0 only
  2856. // Strict mode functions invoked without .call/.apply get global-object context
  2857. reject.apply( undefined, [ value ] );
  2858. }
  2859. }
  2860. jQuery.extend( {
  2861. Deferred: function( func ) {
  2862. var tuples = [
  2863. // action, add listener, callbacks,
  2864. // ... .then handlers, argument index, [final state]
  2865. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  2866. jQuery.Callbacks( "memory" ), 2 ],
  2867. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  2868. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  2869. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  2870. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  2871. ],
  2872. state = "pending",
  2873. promise = {
  2874. state: function() {
  2875. return state;
  2876. },
  2877. always: function() {
  2878. deferred.done( arguments ).fail( arguments );
  2879. return this;
  2880. },
  2881. "catch": function( fn ) {
  2882. return promise.then( null, fn );
  2883. },
  2884. // Keep pipe for back-compat
  2885. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  2886. var fns = arguments;
  2887. return jQuery.Deferred( function( newDefer ) {
  2888. jQuery.each( tuples, function( i, tuple ) {
  2889. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  2890. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  2891. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  2892. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  2893. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  2894. deferred[ tuple[ 1 ] ]( function() {
  2895. var returned = fn && fn.apply( this, arguments );
  2896. if ( returned && isFunction( returned.promise ) ) {
  2897. returned.promise()
  2898. .progress( newDefer.notify )
  2899. .done( newDefer.resolve )
  2900. .fail( newDefer.reject );
  2901. } else {
  2902. newDefer[ tuple[ 0 ] + "With" ](
  2903. this,
  2904. fn ? [ returned ] : arguments
  2905. );
  2906. }
  2907. } );
  2908. } );
  2909. fns = null;
  2910. } ).promise();
  2911. },
  2912. then: function( onFulfilled, onRejected, onProgress ) {
  2913. var maxDepth = 0;
  2914. function resolve( depth, deferred, handler, special ) {
  2915. return function() {
  2916. var that = this,
  2917. args = arguments,
  2918. mightThrow = function() {
  2919. var returned, then;
  2920. // Support: Promises/A+ section 2.3.3.3.3
  2921. // https://promisesaplus.com/#point-59
  2922. // Ignore double-resolution attempts
  2923. if ( depth < maxDepth ) {
  2924. return;
  2925. }
  2926. returned = handler.apply( that, args );
  2927. // Support: Promises/A+ section 2.3.1
  2928. // https://promisesaplus.com/#point-48
  2929. if ( returned === deferred.promise() ) {
  2930. throw new TypeError( "Thenable self-resolution" );
  2931. }
  2932. // Support: Promises/A+ sections 2.3.3.1, 3.5
  2933. // https://promisesaplus.com/#point-54
  2934. // https://promisesaplus.com/#point-75
  2935. // Retrieve `then` only once
  2936. then = returned &&
  2937. // Support: Promises/A+ section 2.3.4
  2938. // https://promisesaplus.com/#point-64
  2939. // Only check objects and functions for thenability
  2940. ( typeof returned === "object" ||
  2941. typeof returned === "function" ) &&
  2942. returned.then;
  2943. // Handle a returned thenable
  2944. if ( isFunction( then ) ) {
  2945. // Special processors (notify) just wait for resolution
  2946. if ( special ) {
  2947. then.call(
  2948. returned,
  2949. resolve( maxDepth, deferred, Identity, special ),
  2950. resolve( maxDepth, deferred, Thrower, special )
  2951. );
  2952. // Normal processors (resolve) also hook into progress
  2953. } else {
  2954. // ...and disregard older resolution values
  2955. maxDepth++;
  2956. then.call(
  2957. returned,
  2958. resolve( maxDepth, deferred, Identity, special ),
  2959. resolve( maxDepth, deferred, Thrower, special ),
  2960. resolve( maxDepth, deferred, Identity,
  2961. deferred.notifyWith )
  2962. );
  2963. }
  2964. // Handle all other returned values
  2965. } else {
  2966. // Only substitute handlers pass on context
  2967. // and multiple values (non-spec behavior)
  2968. if ( handler !== Identity ) {
  2969. that = undefined;
  2970. args = [ returned ];
  2971. }
  2972. // Process the value(s)
  2973. // Default process is resolve
  2974. ( special || deferred.resolveWith )( that, args );
  2975. }
  2976. },
  2977. // Only normal processors (resolve) catch and reject exceptions
  2978. process = special ?
  2979. mightThrow :
  2980. function() {
  2981. try {
  2982. mightThrow();
  2983. } catch ( e ) {
  2984. if ( jQuery.Deferred.exceptionHook ) {
  2985. jQuery.Deferred.exceptionHook( e,
  2986. process.stackTrace );
  2987. }
  2988. // Support: Promises/A+ section 2.3.3.3.4.1
  2989. // https://promisesaplus.com/#point-61
  2990. // Ignore post-resolution exceptions
  2991. if ( depth + 1 >= maxDepth ) {
  2992. // Only substitute handlers pass on context
  2993. // and multiple values (non-spec behavior)
  2994. if ( handler !== Thrower ) {
  2995. that = undefined;
  2996. args = [ e ];
  2997. }
  2998. deferred.rejectWith( that, args );
  2999. }
  3000. }
  3001. };
  3002. // Support: Promises/A+ section 2.3.3.3.1
  3003. // https://promisesaplus.com/#point-57
  3004. // Re-resolve promises immediately to dodge false rejection from
  3005. // subsequent errors
  3006. if ( depth ) {
  3007. process();
  3008. } else {
  3009. // Call an optional hook to record the stack, in case of exception
  3010. // since it's otherwise lost when execution goes async
  3011. if ( jQuery.Deferred.getStackHook ) {
  3012. process.stackTrace = jQuery.Deferred.getStackHook();
  3013. }
  3014. window.setTimeout( process );
  3015. }
  3016. };
  3017. }
  3018. return jQuery.Deferred( function( newDefer ) {
  3019. // progress_handlers.add( ... )
  3020. tuples[ 0 ][ 3 ].add(
  3021. resolve(
  3022. 0,
  3023. newDefer,
  3024. isFunction( onProgress ) ?
  3025. onProgress :
  3026. Identity,
  3027. newDefer.notifyWith
  3028. )
  3029. );
  3030. // fulfilled_handlers.add( ... )
  3031. tuples[ 1 ][ 3 ].add(
  3032. resolve(
  3033. 0,
  3034. newDefer,
  3035. isFunction( onFulfilled ) ?
  3036. onFulfilled :
  3037. Identity
  3038. )
  3039. );
  3040. // rejected_handlers.add( ... )
  3041. tuples[ 2 ][ 3 ].add(
  3042. resolve(
  3043. 0,
  3044. newDefer,
  3045. isFunction( onRejected ) ?
  3046. onRejected :
  3047. Thrower
  3048. )
  3049. );
  3050. } ).promise();
  3051. },
  3052. // Get a promise for this deferred
  3053. // If obj is provided, the promise aspect is added to the object
  3054. promise: function( obj ) {
  3055. return obj != null ? jQuery.extend( obj, promise ) : promise;
  3056. }
  3057. },
  3058. deferred = {};
  3059. // Add list-specific methods
  3060. jQuery.each( tuples, function( i, tuple ) {
  3061. var list = tuple[ 2 ],
  3062. stateString = tuple[ 5 ];
  3063. // promise.progress = list.add
  3064. // promise.done = list.add
  3065. // promise.fail = list.add
  3066. promise[ tuple[ 1 ] ] = list.add;
  3067. // Handle state
  3068. if ( stateString ) {
  3069. list.add(
  3070. function() {
  3071. // state = "resolved" (i.e., fulfilled)
  3072. // state = "rejected"
  3073. state = stateString;
  3074. },
  3075. // rejected_callbacks.disable
  3076. // fulfilled_callbacks.disable
  3077. tuples[ 3 - i ][ 2 ].disable,
  3078. // rejected_handlers.disable
  3079. // fulfilled_handlers.disable
  3080. tuples[ 3 - i ][ 3 ].disable,
  3081. // progress_callbacks.lock
  3082. tuples[ 0 ][ 2 ].lock,
  3083. // progress_handlers.lock
  3084. tuples[ 0 ][ 3 ].lock
  3085. );
  3086. }
  3087. // progress_handlers.fire
  3088. // fulfilled_handlers.fire
  3089. // rejected_handlers.fire
  3090. list.add( tuple[ 3 ].fire );
  3091. // deferred.notify = function() { deferred.notifyWith(...) }
  3092. // deferred.resolve = function() { deferred.resolveWith(...) }
  3093. // deferred.reject = function() { deferred.rejectWith(...) }
  3094. deferred[ tuple[ 0 ] ] = function() {
  3095. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  3096. return this;
  3097. };
  3098. // deferred.notifyWith = list.fireWith
  3099. // deferred.resolveWith = list.fireWith
  3100. // deferred.rejectWith = list.fireWith
  3101. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  3102. } );
  3103. // Make the deferred a promise
  3104. promise.promise( deferred );
  3105. // Call given func if any
  3106. if ( func ) {
  3107. func.call( deferred, deferred );
  3108. }
  3109. // All done!
  3110. return deferred;
  3111. },
  3112. // Deferred helper
  3113. when: function( singleValue ) {
  3114. var
  3115. // count of uncompleted subordinates
  3116. remaining = arguments.length,
  3117. // count of unprocessed arguments
  3118. i = remaining,
  3119. // subordinate fulfillment data
  3120. resolveContexts = Array( i ),
  3121. resolveValues = slice.call( arguments ),
  3122. // the master Deferred
  3123. master = jQuery.Deferred(),
  3124. // subordinate callback factory
  3125. updateFunc = function( i ) {
  3126. return function( value ) {
  3127. resolveContexts[ i ] = this;
  3128. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  3129. if ( !( --remaining ) ) {
  3130. master.resolveWith( resolveContexts, resolveValues );
  3131. }
  3132. };
  3133. };
  3134. // Single- and empty arguments are adopted like Promise.resolve
  3135. if ( remaining <= 1 ) {
  3136. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  3137. !remaining );
  3138. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  3139. if ( master.state() === "pending" ||
  3140. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  3141. return master.then();
  3142. }
  3143. }
  3144. // Multiple arguments are aggregated like Promise.all array elements
  3145. while ( i-- ) {
  3146. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  3147. }
  3148. return master.promise();
  3149. }
  3150. } );
  3151. // These usually indicate a programmer mistake during development,
  3152. // warn about them ASAP rather than swallowing them by default.
  3153. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  3154. jQuery.Deferred.exceptionHook = function( error, stack ) {
  3155. // Support: IE 8 - 9 only
  3156. // Console exists when dev tools are open, which can happen at any time
  3157. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  3158. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  3159. }
  3160. };
  3161. jQuery.readyException = function( error ) {
  3162. window.setTimeout( function() {
  3163. throw error;
  3164. } );
  3165. };
  3166. // The deferred used on DOM ready
  3167. var readyList = jQuery.Deferred();
  3168. jQuery.fn.ready = function( fn ) {
  3169. readyList
  3170. .then( fn )
  3171. // Wrap jQuery.readyException in a function so that the lookup
  3172. // happens at the time of error handling instead of callback
  3173. // registration.
  3174. .catch( function( error ) {
  3175. jQuery.readyException( error );
  3176. } );
  3177. return this;
  3178. };
  3179. jQuery.extend( {
  3180. // Is the DOM ready to be used? Set to true once it occurs.
  3181. isReady: false,
  3182. // A counter to track how many items to wait for before
  3183. // the ready event fires. See #6781
  3184. readyWait: 1,
  3185. // Handle when the DOM is ready
  3186. ready: function( wait ) {
  3187. // Abort if there are pending holds or we're already ready
  3188. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  3189. return;
  3190. }
  3191. // Remember that the DOM is ready
  3192. jQuery.isReady = true;
  3193. // If a normal DOM Ready event fired, decrement, and wait if need be
  3194. if ( wait !== true && --jQuery.readyWait > 0 ) {
  3195. return;
  3196. }
  3197. // If there are functions bound, to execute
  3198. readyList.resolveWith( document, [ jQuery ] );
  3199. }
  3200. } );
  3201. jQuery.ready.then = readyList.then;
  3202. // The ready event handler and self cleanup method
  3203. function completed() {
  3204. document.removeEventListener( "DOMContentLoaded", completed );
  3205. window.removeEventListener( "load", completed );
  3206. jQuery.ready();
  3207. }
  3208. // Catch cases where $(document).ready() is called
  3209. // after the browser event has already occurred.
  3210. // Support: IE <=9 - 10 only
  3211. // Older IE sometimes signals "interactive" too soon
  3212. if ( document.readyState === "complete" ||
  3213. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  3214. // Handle it asynchronously to allow scripts the opportunity to delay ready
  3215. window.setTimeout( jQuery.ready );
  3216. } else {
  3217. // Use the handy event callback
  3218. document.addEventListener( "DOMContentLoaded", completed );
  3219. // A fallback to window.onload, that will always work
  3220. window.addEventListener( "load", completed );
  3221. }
  3222. // Multifunctional method to get and set values of a collection
  3223. // The value/s can optionally be executed if it's a function
  3224. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  3225. var i = 0,
  3226. len = elems.length,
  3227. bulk = key == null;
  3228. // Sets many values
  3229. if ( toType( key ) === "object" ) {
  3230. chainable = true;
  3231. for ( i in key ) {
  3232. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  3233. }
  3234. // Sets one value
  3235. } else if ( value !== undefined ) {
  3236. chainable = true;
  3237. if ( !isFunction( value ) ) {
  3238. raw = true;
  3239. }
  3240. if ( bulk ) {
  3241. // Bulk operations run against the entire set
  3242. if ( raw ) {
  3243. fn.call( elems, value );
  3244. fn = null;
  3245. // ...except when executing function values
  3246. } else {
  3247. bulk = fn;
  3248. fn = function( elem, key, value ) {
  3249. return bulk.call( jQuery( elem ), value );
  3250. };
  3251. }
  3252. }
  3253. if ( fn ) {
  3254. for ( ; i < len; i++ ) {
  3255. fn(
  3256. elems[ i ], key, raw ?
  3257. value :
  3258. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  3259. );
  3260. }
  3261. }
  3262. }
  3263. if ( chainable ) {
  3264. return elems;
  3265. }
  3266. // Gets
  3267. if ( bulk ) {
  3268. return fn.call( elems );
  3269. }
  3270. return len ? fn( elems[ 0 ], key ) : emptyGet;
  3271. };
  3272. // Matches dashed string for camelizing
  3273. var rmsPrefix = /^-ms-/,
  3274. rdashAlpha = /-([a-z])/g;
  3275. // Used by camelCase as callback to replace()
  3276. function fcamelCase( all, letter ) {
  3277. return letter.toUpperCase();
  3278. }
  3279. // Convert dashed to camelCase; used by the css and data modules
  3280. // Support: IE <=9 - 11, Edge 12 - 15
  3281. // Microsoft forgot to hump their vendor prefix (#9572)
  3282. function camelCase( string ) {
  3283. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  3284. }
  3285. var acceptData = function( owner ) {
  3286. // Accepts only:
  3287. // - Node
  3288. // - Node.ELEMENT_NODE
  3289. // - Node.DOCUMENT_NODE
  3290. // - Object
  3291. // - Any
  3292. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  3293. };
  3294. function Data() {
  3295. this.expando = jQuery.expando + Data.uid++;
  3296. }
  3297. Data.uid = 1;
  3298. Data.prototype = {
  3299. cache: function( owner ) {
  3300. // Check if the owner object already has a cache
  3301. var value = owner[ this.expando ];
  3302. // If not, create one
  3303. if ( !value ) {
  3304. value = {};
  3305. // We can accept data for non-element nodes in modern browsers,
  3306. // but we should not, see #8335.
  3307. // Always return an empty object.
  3308. if ( acceptData( owner ) ) {
  3309. // If it is a node unlikely to be stringify-ed or looped over
  3310. // use plain assignment
  3311. if ( owner.nodeType ) {
  3312. owner[ this.expando ] = value;
  3313. // Otherwise secure it in a non-enumerable property
  3314. // configurable must be true to allow the property to be
  3315. // deleted when data is removed
  3316. } else {
  3317. Object.defineProperty( owner, this.expando, {
  3318. value: value,
  3319. configurable: true
  3320. } );
  3321. }
  3322. }
  3323. }
  3324. return value;
  3325. },
  3326. set: function( owner, data, value ) {
  3327. var prop,
  3328. cache = this.cache( owner );
  3329. // Handle: [ owner, key, value ] args
  3330. // Always use camelCase key (gh-2257)
  3331. if ( typeof data === "string" ) {
  3332. cache[ camelCase( data ) ] = value;
  3333. // Handle: [ owner, { properties } ] args
  3334. } else {
  3335. // Copy the properties one-by-one to the cache object
  3336. for ( prop in data ) {
  3337. cache[ camelCase( prop ) ] = data[ prop ];
  3338. }
  3339. }
  3340. return cache;
  3341. },
  3342. get: function( owner, key ) {
  3343. return key === undefined ?
  3344. this.cache( owner ) :
  3345. // Always use camelCase key (gh-2257)
  3346. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  3347. },
  3348. access: function( owner, key, value ) {
  3349. // In cases where either:
  3350. //
  3351. // 1. No key was specified
  3352. // 2. A string key was specified, but no value provided
  3353. //
  3354. // Take the "read" path and allow the get method to determine
  3355. // which value to return, respectively either:
  3356. //
  3357. // 1. The entire cache object
  3358. // 2. The data stored at the key
  3359. //
  3360. if ( key === undefined ||
  3361. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  3362. return this.get( owner, key );
  3363. }
  3364. // When the key is not a string, or both a key and value
  3365. // are specified, set or extend (existing objects) with either:
  3366. //
  3367. // 1. An object of properties
  3368. // 2. A key and value
  3369. //
  3370. this.set( owner, key, value );
  3371. // Since the "set" path can have two possible entry points
  3372. // return the expected data based on which path was taken[*]
  3373. return value !== undefined ? value : key;
  3374. },
  3375. remove: function( owner, key ) {
  3376. var i,
  3377. cache = owner[ this.expando ];
  3378. if ( cache === undefined ) {
  3379. return;
  3380. }
  3381. if ( key !== undefined ) {
  3382. // Support array or space separated string of keys
  3383. if ( Array.isArray( key ) ) {
  3384. // If key is an array of keys...
  3385. // We always set camelCase keys, so remove that.
  3386. key = key.map( camelCase );
  3387. } else {
  3388. key = camelCase( key );
  3389. // If a key with the spaces exists, use it.
  3390. // Otherwise, create an array by matching non-whitespace
  3391. key = key in cache ?
  3392. [ key ] :
  3393. ( key.match( rnothtmlwhite ) || [] );
  3394. }
  3395. i = key.length;
  3396. while ( i-- ) {
  3397. delete cache[ key[ i ] ];
  3398. }
  3399. }
  3400. // Remove the expando if there's no more data
  3401. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  3402. // Support: Chrome <=35 - 45
  3403. // Webkit & Blink performance suffers when deleting properties
  3404. // from DOM nodes, so set to undefined instead
  3405. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  3406. if ( owner.nodeType ) {
  3407. owner[ this.expando ] = undefined;
  3408. } else {
  3409. delete owner[ this.expando ];
  3410. }
  3411. }
  3412. },
  3413. hasData: function( owner ) {
  3414. var cache = owner[ this.expando ];
  3415. return cache !== undefined && !jQuery.isEmptyObject( cache );
  3416. }
  3417. };
  3418. var dataPriv = new Data();
  3419. var dataUser = new Data();
  3420. // Implementation Summary
  3421. //
  3422. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  3423. // 2. Improve the module's maintainability by reducing the storage
  3424. // paths to a single mechanism.
  3425. // 3. Use the same single mechanism to support "private" and "user" data.
  3426. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  3427. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  3428. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  3429. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  3430. rmultiDash = /[A-Z]/g;
  3431. function getData( data ) {
  3432. if ( data === "true" ) {
  3433. return true;
  3434. }
  3435. if ( data === "false" ) {
  3436. return false;
  3437. }
  3438. if ( data === "null" ) {
  3439. return null;
  3440. }
  3441. // Only convert to a number if it doesn't change the string
  3442. if ( data === +data + "" ) {
  3443. return +data;
  3444. }
  3445. if ( rbrace.test( data ) ) {
  3446. return JSON.parse( data );
  3447. }
  3448. return data;
  3449. }
  3450. function dataAttr( elem, key, data ) {
  3451. var name;
  3452. // If nothing was found internally, try to fetch any
  3453. // data from the HTML5 data-* attribute
  3454. if ( data === undefined && elem.nodeType === 1 ) {
  3455. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  3456. data = elem.getAttribute( name );
  3457. if ( typeof data === "string" ) {
  3458. try {
  3459. data = getData( data );
  3460. } catch ( e ) {}
  3461. // Make sure we set the data so it isn't changed later
  3462. dataUser.set( elem, key, data );
  3463. } else {
  3464. data = undefined;
  3465. }
  3466. }
  3467. return data;
  3468. }
  3469. jQuery.extend( {
  3470. hasData: function( elem ) {
  3471. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  3472. },
  3473. data: function( elem, name, data ) {
  3474. return dataUser.access( elem, name, data );
  3475. },
  3476. removeData: function( elem, name ) {
  3477. dataUser.remove( elem, name );
  3478. },
  3479. // TODO: Now that all calls to _data and _removeData have been replaced
  3480. // with direct calls to dataPriv methods, these can be deprecated.
  3481. _data: function( elem, name, data ) {
  3482. return dataPriv.access( elem, name, data );
  3483. },
  3484. _removeData: function( elem, name ) {
  3485. dataPriv.remove( elem, name );
  3486. }
  3487. } );
  3488. jQuery.fn.extend( {
  3489. data: function( key, value ) {
  3490. var i, name, data,
  3491. elem = this[ 0 ],
  3492. attrs = elem && elem.attributes;
  3493. // Gets all values
  3494. if ( key === undefined ) {
  3495. if ( this.length ) {
  3496. data = dataUser.get( elem );
  3497. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  3498. i = attrs.length;
  3499. while ( i-- ) {
  3500. // Support: IE 11 only
  3501. // The attrs elements can be null (#14894)
  3502. if ( attrs[ i ] ) {
  3503. name = attrs[ i ].name;
  3504. if ( name.indexOf( "data-" ) === 0 ) {
  3505. name = camelCase( name.slice( 5 ) );
  3506. dataAttr( elem, name, data[ name ] );
  3507. }
  3508. }
  3509. }
  3510. dataPriv.set( elem, "hasDataAttrs", true );
  3511. }
  3512. }
  3513. return data;
  3514. }
  3515. // Sets multiple values
  3516. if ( typeof key === "object" ) {
  3517. return this.each( function() {
  3518. dataUser.set( this, key );
  3519. } );
  3520. }
  3521. return access( this, function( value ) {
  3522. var data;
  3523. // The calling jQuery object (element matches) is not empty
  3524. // (and therefore has an element appears at this[ 0 ]) and the
  3525. // `value` parameter was not undefined. An empty jQuery object
  3526. // will result in `undefined` for elem = this[ 0 ] which will
  3527. // throw an exception if an attempt to read a data cache is made.
  3528. if ( elem && value === undefined ) {
  3529. // Attempt to get data from the cache
  3530. // The key will always be camelCased in Data
  3531. data = dataUser.get( elem, key );
  3532. if ( data !== undefined ) {
  3533. return data;
  3534. }
  3535. // Attempt to "discover" the data in
  3536. // HTML5 custom data-* attrs
  3537. data = dataAttr( elem, key );
  3538. if ( data !== undefined ) {
  3539. return data;
  3540. }
  3541. // We tried really hard, but the data doesn't exist.
  3542. return;
  3543. }
  3544. // Set the data...
  3545. this.each( function() {
  3546. // We always store the camelCased key
  3547. dataUser.set( this, key, value );
  3548. } );
  3549. }, null, value, arguments.length > 1, null, true );
  3550. },
  3551. removeData: function( key ) {
  3552. return this.each( function() {
  3553. dataUser.remove( this, key );
  3554. } );
  3555. }
  3556. } );
  3557. jQuery.extend( {
  3558. queue: function( elem, type, data ) {
  3559. var queue;
  3560. if ( elem ) {
  3561. type = ( type || "fx" ) + "queue";
  3562. queue = dataPriv.get( elem, type );
  3563. // Speed up dequeue by getting out quickly if this is just a lookup
  3564. if ( data ) {
  3565. if ( !queue || Array.isArray( data ) ) {
  3566. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  3567. } else {
  3568. queue.push( data );
  3569. }
  3570. }
  3571. return queue || [];
  3572. }
  3573. },
  3574. dequeue: function( elem, type ) {
  3575. type = type || "fx";
  3576. var queue = jQuery.queue( elem, type ),
  3577. startLength = queue.length,
  3578. fn = queue.shift(),
  3579. hooks = jQuery._queueHooks( elem, type ),
  3580. next = function() {
  3581. jQuery.dequeue( elem, type );
  3582. };
  3583. // If the fx queue is dequeued, always remove the progress sentinel
  3584. if ( fn === "inprogress" ) {
  3585. fn = queue.shift();
  3586. startLength--;
  3587. }
  3588. if ( fn ) {
  3589. // Add a progress sentinel to prevent the fx queue from being
  3590. // automatically dequeued
  3591. if ( type === "fx" ) {
  3592. queue.unshift( "inprogress" );
  3593. }
  3594. // Clear up the last queue stop function
  3595. delete hooks.stop;
  3596. fn.call( elem, next, hooks );
  3597. }
  3598. if ( !startLength && hooks ) {
  3599. hooks.empty.fire();
  3600. }
  3601. },
  3602. // Not public - generate a queueHooks object, or return the current one
  3603. _queueHooks: function( elem, type ) {
  3604. var key = type + "queueHooks";
  3605. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  3606. empty: jQuery.Callbacks( "once memory" ).add( function() {
  3607. dataPriv.remove( elem, [ type + "queue", key ] );
  3608. } )
  3609. } );
  3610. }
  3611. } );
  3612. jQuery.fn.extend( {
  3613. queue: function( type, data ) {
  3614. var setter = 2;
  3615. if ( typeof type !== "string" ) {
  3616. data = type;
  3617. type = "fx";
  3618. setter--;
  3619. }
  3620. if ( arguments.length < setter ) {
  3621. return jQuery.queue( this[ 0 ], type );
  3622. }
  3623. return data === undefined ?
  3624. this :
  3625. this.each( function() {
  3626. var queue = jQuery.queue( this, type, data );
  3627. // Ensure a hooks for this queue
  3628. jQuery._queueHooks( this, type );
  3629. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  3630. jQuery.dequeue( this, type );
  3631. }
  3632. } );
  3633. },
  3634. dequeue: function( type ) {
  3635. return this.each( function() {
  3636. jQuery.dequeue( this, type );
  3637. } );
  3638. },
  3639. clearQueue: function( type ) {
  3640. return this.queue( type || "fx", [] );
  3641. },
  3642. // Get a promise resolved when queues of a certain type
  3643. // are emptied (fx is the type by default)
  3644. promise: function( type, obj ) {
  3645. var tmp,
  3646. count = 1,
  3647. defer = jQuery.Deferred(),
  3648. elements = this,
  3649. i = this.length,
  3650. resolve = function() {
  3651. if ( !( --count ) ) {
  3652. defer.resolveWith( elements, [ elements ] );
  3653. }
  3654. };
  3655. if ( typeof type !== "string" ) {
  3656. obj = type;
  3657. type = undefined;
  3658. }
  3659. type = type || "fx";
  3660. while ( i-- ) {
  3661. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  3662. if ( tmp && tmp.empty ) {
  3663. count++;
  3664. tmp.empty.add( resolve );
  3665. }
  3666. }
  3667. resolve();
  3668. return defer.promise( obj );
  3669. }
  3670. } );
  3671. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  3672. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  3673. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  3674. var isHiddenWithinTree = function( elem, el ) {
  3675. // isHiddenWithinTree might be called from jQuery#filter function;
  3676. // in that case, element will be second argument
  3677. elem = el || elem;
  3678. // Inline style trumps all
  3679. return elem.style.display === "none" ||
  3680. elem.style.display === "" &&
  3681. // Otherwise, check computed style
  3682. // Support: Firefox <=43 - 45
  3683. // Disconnected elements can have computed display: none, so first confirm that elem is
  3684. // in the document.
  3685. jQuery.contains( elem.ownerDocument, elem ) &&
  3686. jQuery.css( elem, "display" ) === "none";
  3687. };
  3688. var swap = function( elem, options, callback, args ) {
  3689. var ret, name,
  3690. old = {};
  3691. // Remember the old values, and insert the new ones
  3692. for ( name in options ) {
  3693. old[ name ] = elem.style[ name ];
  3694. elem.style[ name ] = options[ name ];
  3695. }
  3696. ret = callback.apply( elem, args || [] );
  3697. // Revert the old values
  3698. for ( name in options ) {
  3699. elem.style[ name ] = old[ name ];
  3700. }
  3701. return ret;
  3702. };
  3703. function adjustCSS( elem, prop, valueParts, tween ) {
  3704. var adjusted, scale,
  3705. maxIterations = 20,
  3706. currentValue = tween ?
  3707. function() {
  3708. return tween.cur();
  3709. } :
  3710. function() {
  3711. return jQuery.css( elem, prop, "" );
  3712. },
  3713. initial = currentValue(),
  3714. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  3715. // Starting value computation is required for potential unit mismatches
  3716. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  3717. rcssNum.exec( jQuery.css( elem, prop ) );
  3718. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  3719. // Support: Firefox <=54
  3720. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  3721. initial = initial / 2;
  3722. // Trust units reported by jQuery.css
  3723. unit = unit || initialInUnit[ 3 ];
  3724. // Iteratively approximate from a nonzero starting point
  3725. initialInUnit = +initial || 1;
  3726. while ( maxIterations-- ) {
  3727. // Evaluate and update our best guess (doubling guesses that zero out).
  3728. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  3729. jQuery.style( elem, prop, initialInUnit + unit );
  3730. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  3731. maxIterations = 0;
  3732. }
  3733. initialInUnit = initialInUnit / scale;
  3734. }
  3735. initialInUnit = initialInUnit * 2;
  3736. jQuery.style( elem, prop, initialInUnit + unit );
  3737. // Make sure we update the tween properties later on
  3738. valueParts = valueParts || [];
  3739. }
  3740. if ( valueParts ) {
  3741. initialInUnit = +initialInUnit || +initial || 0;
  3742. // Apply relative offset (+=/-=) if specified
  3743. adjusted = valueParts[ 1 ] ?
  3744. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  3745. +valueParts[ 2 ];
  3746. if ( tween ) {
  3747. tween.unit = unit;
  3748. tween.start = initialInUnit;
  3749. tween.end = adjusted;
  3750. }
  3751. }
  3752. return adjusted;
  3753. }
  3754. var defaultDisplayMap = {};
  3755. function getDefaultDisplay( elem ) {
  3756. var temp,
  3757. doc = elem.ownerDocument,
  3758. nodeName = elem.nodeName,
  3759. display = defaultDisplayMap[ nodeName ];
  3760. if ( display ) {
  3761. return display;
  3762. }
  3763. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  3764. display = jQuery.css( temp, "display" );
  3765. temp.parentNode.removeChild( temp );
  3766. if ( display === "none" ) {
  3767. display = "block";
  3768. }
  3769. defaultDisplayMap[ nodeName ] = display;
  3770. return display;
  3771. }
  3772. function showHide( elements, show ) {
  3773. var display, elem,
  3774. values = [],
  3775. index = 0,
  3776. length = elements.length;
  3777. // Determine new display value for elements that need to change
  3778. for ( ; index < length; index++ ) {
  3779. elem = elements[ index ];
  3780. if ( !elem.style ) {
  3781. continue;
  3782. }
  3783. display = elem.style.display;
  3784. if ( show ) {
  3785. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  3786. // check is required in this first loop unless we have a nonempty display value (either
  3787. // inline or about-to-be-restored)
  3788. if ( display === "none" ) {
  3789. values[ index ] = dataPriv.get( elem, "display" ) || null;
  3790. if ( !values[ index ] ) {
  3791. elem.style.display = "";
  3792. }
  3793. }
  3794. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  3795. values[ index ] = getDefaultDisplay( elem );
  3796. }
  3797. } else {
  3798. if ( display !== "none" ) {
  3799. values[ index ] = "none";
  3800. // Remember what we're overwriting
  3801. dataPriv.set( elem, "display", display );
  3802. }
  3803. }
  3804. }
  3805. // Set the display of the elements in a second loop to avoid constant reflow
  3806. for ( index = 0; index < length; index++ ) {
  3807. if ( values[ index ] != null ) {
  3808. elements[ index ].style.display = values[ index ];
  3809. }
  3810. }
  3811. return elements;
  3812. }
  3813. jQuery.fn.extend( {
  3814. show: function() {
  3815. return showHide( this, true );
  3816. },
  3817. hide: function() {
  3818. return showHide( this );
  3819. },
  3820. toggle: function( state ) {
  3821. if ( typeof state === "boolean" ) {
  3822. return state ? this.show() : this.hide();
  3823. }
  3824. return this.each( function() {
  3825. if ( isHiddenWithinTree( this ) ) {
  3826. jQuery( this ).show();
  3827. } else {
  3828. jQuery( this ).hide();
  3829. }
  3830. } );
  3831. }
  3832. } );
  3833. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  3834. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  3835. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  3836. // We have to close these tags to support XHTML (#13200)
  3837. var wrapMap = {
  3838. // Support: IE <=9 only
  3839. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  3840. // XHTML parsers do not magically insert elements in the
  3841. // same way that tag soup parsers do. So we cannot shorten
  3842. // this by omitting <tbody> or other required elements.
  3843. thead: [ 1, "<table>", "</table>" ],
  3844. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  3845. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  3846. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  3847. _default: [ 0, "", "" ]
  3848. };
  3849. // Support: IE <=9 only
  3850. wrapMap.optgroup = wrapMap.option;
  3851. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  3852. wrapMap.th = wrapMap.td;
  3853. function getAll( context, tag ) {
  3854. // Support: IE <=9 - 11 only
  3855. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  3856. var ret;
  3857. if ( typeof context.getElementsByTagName !== "undefined" ) {
  3858. ret = context.getElementsByTagName( tag || "*" );
  3859. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  3860. ret = context.querySelectorAll( tag || "*" );
  3861. } else {
  3862. ret = [];
  3863. }
  3864. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  3865. return jQuery.merge( [ context ], ret );
  3866. }
  3867. return ret;
  3868. }
  3869. // Mark scripts as having already been evaluated
  3870. function setGlobalEval( elems, refElements ) {
  3871. var i = 0,
  3872. l = elems.length;
  3873. for ( ; i < l; i++ ) {
  3874. dataPriv.set(
  3875. elems[ i ],
  3876. "globalEval",
  3877. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  3878. );
  3879. }
  3880. }
  3881. var rhtml = /<|&#?\w+;/;
  3882. function buildFragment( elems, context, scripts, selection, ignored ) {
  3883. var elem, tmp, tag, wrap, contains, j,
  3884. fragment = context.createDocumentFragment(),
  3885. nodes = [],
  3886. i = 0,
  3887. l = elems.length;
  3888. for ( ; i < l; i++ ) {
  3889. elem = elems[ i ];
  3890. if ( elem || elem === 0 ) {
  3891. // Add nodes directly
  3892. if ( toType( elem ) === "object" ) {
  3893. // Support: Android <=4.0 only, PhantomJS 1 only
  3894. // push.apply(_, arraylike) throws on ancient WebKit
  3895. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  3896. // Convert non-html into a text node
  3897. } else if ( !rhtml.test( elem ) ) {
  3898. nodes.push( context.createTextNode( elem ) );
  3899. // Convert html into DOM nodes
  3900. } else {
  3901. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  3902. // Deserialize a standard representation
  3903. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  3904. wrap = wrapMap[ tag ] || wrapMap._default;
  3905. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  3906. // Descend through wrappers to the right content
  3907. j = wrap[ 0 ];
  3908. while ( j-- ) {
  3909. tmp = tmp.lastChild;
  3910. }
  3911. // Support: Android <=4.0 only, PhantomJS 1 only
  3912. // push.apply(_, arraylike) throws on ancient WebKit
  3913. jQuery.merge( nodes, tmp.childNodes );
  3914. // Remember the top-level container
  3915. tmp = fragment.firstChild;
  3916. // Ensure the created nodes are orphaned (#12392)
  3917. tmp.textContent = "";
  3918. }
  3919. }
  3920. }
  3921. // Remove wrapper from fragment
  3922. fragment.textContent = "";
  3923. i = 0;
  3924. while ( ( elem = nodes[ i++ ] ) ) {
  3925. // Skip elements already in the context collection (trac-4087)
  3926. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  3927. if ( ignored ) {
  3928. ignored.push( elem );
  3929. }
  3930. continue;
  3931. }
  3932. contains = jQuery.contains( elem.ownerDocument, elem );
  3933. // Append to fragment
  3934. tmp = getAll( fragment.appendChild( elem ), "script" );
  3935. // Preserve script evaluation history
  3936. if ( contains ) {
  3937. setGlobalEval( tmp );
  3938. }
  3939. // Capture executables
  3940. if ( scripts ) {
  3941. j = 0;
  3942. while ( ( elem = tmp[ j++ ] ) ) {
  3943. if ( rscriptType.test( elem.type || "" ) ) {
  3944. scripts.push( elem );
  3945. }
  3946. }
  3947. }
  3948. }
  3949. return fragment;
  3950. }
  3951. ( function() {
  3952. var fragment = document.createDocumentFragment(),
  3953. div = fragment.appendChild( document.createElement( "div" ) ),
  3954. input = document.createElement( "input" );
  3955. // Support: Android 4.0 - 4.3 only
  3956. // Check state lost if the name is set (#11217)
  3957. // Support: Windows Web Apps (WWA)
  3958. // `name` and `type` must use .setAttribute for WWA (#14901)
  3959. input.setAttribute( "type", "radio" );
  3960. input.setAttribute( "checked", "checked" );
  3961. input.setAttribute( "name", "t" );
  3962. div.appendChild( input );
  3963. // Support: Android <=4.1 only
  3964. // Older WebKit doesn't clone checked state correctly in fragments
  3965. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  3966. // Support: IE <=11 only
  3967. // Make sure textarea (and checkbox) defaultValue is properly cloned
  3968. div.innerHTML = "<textarea>x</textarea>";
  3969. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  3970. } )();
  3971. var documentElement = document.documentElement;
  3972. var
  3973. rkeyEvent = /^key/,
  3974. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  3975. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  3976. function returnTrue() {
  3977. return true;
  3978. }
  3979. function returnFalse() {
  3980. return false;
  3981. }
  3982. // Support: IE <=9 only
  3983. // See #13393 for more info
  3984. function safeActiveElement() {
  3985. try {
  3986. return document.activeElement;
  3987. } catch ( err ) { }
  3988. }
  3989. function on( elem, types, selector, data, fn, one ) {
  3990. var origFn, type;
  3991. // Types can be a map of types/handlers
  3992. if ( typeof types === "object" ) {
  3993. // ( types-Object, selector, data )
  3994. if ( typeof selector !== "string" ) {
  3995. // ( types-Object, data )
  3996. data = data || selector;
  3997. selector = undefined;
  3998. }
  3999. for ( type in types ) {
  4000. on( elem, type, selector, data, types[ type ], one );
  4001. }
  4002. return elem;
  4003. }
  4004. if ( data == null && fn == null ) {
  4005. // ( types, fn )
  4006. fn = selector;
  4007. data = selector = undefined;
  4008. } else if ( fn == null ) {
  4009. if ( typeof selector === "string" ) {
  4010. // ( types, selector, fn )
  4011. fn = data;
  4012. data = undefined;
  4013. } else {
  4014. // ( types, data, fn )
  4015. fn = data;
  4016. data = selector;
  4017. selector = undefined;
  4018. }
  4019. }
  4020. if ( fn === false ) {
  4021. fn = returnFalse;
  4022. } else if ( !fn ) {
  4023. return elem;
  4024. }
  4025. if ( one === 1 ) {
  4026. origFn = fn;
  4027. fn = function( event ) {
  4028. // Can use an empty set, since event contains the info
  4029. jQuery().off( event );
  4030. return origFn.apply( this, arguments );
  4031. };
  4032. // Use same guid so caller can remove using origFn
  4033. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  4034. }
  4035. return elem.each( function() {
  4036. jQuery.event.add( this, types, fn, data, selector );
  4037. } );
  4038. }
  4039. /*
  4040. * Helper functions for managing events -- not part of the public interface.
  4041. * Props to Dean Edwards' addEvent library for many of the ideas.
  4042. */
  4043. jQuery.event = {
  4044. global: {},
  4045. add: function( elem, types, handler, data, selector ) {
  4046. var handleObjIn, eventHandle, tmp,
  4047. events, t, handleObj,
  4048. special, handlers, type, namespaces, origType,
  4049. elemData = dataPriv.get( elem );
  4050. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  4051. if ( !elemData ) {
  4052. return;
  4053. }
  4054. // Caller can pass in an object of custom data in lieu of the handler
  4055. if ( handler.handler ) {
  4056. handleObjIn = handler;
  4057. handler = handleObjIn.handler;
  4058. selector = handleObjIn.selector;
  4059. }
  4060. // Ensure that invalid selectors throw exceptions at attach time
  4061. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  4062. if ( selector ) {
  4063. jQuery.find.matchesSelector( documentElement, selector );
  4064. }
  4065. // Make sure that the handler has a unique ID, used to find/remove it later
  4066. if ( !handler.guid ) {
  4067. handler.guid = jQuery.guid++;
  4068. }
  4069. // Init the element's event structure and main handler, if this is the first
  4070. if ( !( events = elemData.events ) ) {
  4071. events = elemData.events = {};
  4072. }
  4073. if ( !( eventHandle = elemData.handle ) ) {
  4074. eventHandle = elemData.handle = function( e ) {
  4075. // Discard the second event of a jQuery.event.trigger() and
  4076. // when an event is called after a page has unloaded
  4077. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  4078. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  4079. };
  4080. }
  4081. // Handle multiple events separated by a space
  4082. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4083. t = types.length;
  4084. while ( t-- ) {
  4085. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4086. type = origType = tmp[ 1 ];
  4087. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4088. // There *must* be a type, no attaching namespace-only handlers
  4089. if ( !type ) {
  4090. continue;
  4091. }
  4092. // If event changes its type, use the special event handlers for the changed type
  4093. special = jQuery.event.special[ type ] || {};
  4094. // If selector defined, determine special event api type, otherwise given type
  4095. type = ( selector ? special.delegateType : special.bindType ) || type;
  4096. // Update special based on newly reset type
  4097. special = jQuery.event.special[ type ] || {};
  4098. // handleObj is passed to all event handlers
  4099. handleObj = jQuery.extend( {
  4100. type: type,
  4101. origType: origType,
  4102. data: data,
  4103. handler: handler,
  4104. guid: handler.guid,
  4105. selector: selector,
  4106. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  4107. namespace: namespaces.join( "." )
  4108. }, handleObjIn );
  4109. // Init the event handler queue if we're the first
  4110. if ( !( handlers = events[ type ] ) ) {
  4111. handlers = events[ type ] = [];
  4112. handlers.delegateCount = 0;
  4113. // Only use addEventListener if the special events handler returns false
  4114. if ( !special.setup ||
  4115. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  4116. if ( elem.addEventListener ) {
  4117. elem.addEventListener( type, eventHandle );
  4118. }
  4119. }
  4120. }
  4121. if ( special.add ) {
  4122. special.add.call( elem, handleObj );
  4123. if ( !handleObj.handler.guid ) {
  4124. handleObj.handler.guid = handler.guid;
  4125. }
  4126. }
  4127. // Add to the element's handler list, delegates in front
  4128. if ( selector ) {
  4129. handlers.splice( handlers.delegateCount++, 0, handleObj );
  4130. } else {
  4131. handlers.push( handleObj );
  4132. }
  4133. // Keep track of which events have ever been used, for event optimization
  4134. jQuery.event.global[ type ] = true;
  4135. }
  4136. },
  4137. // Detach an event or set of events from an element
  4138. remove: function( elem, types, handler, selector, mappedTypes ) {
  4139. var j, origCount, tmp,
  4140. events, t, handleObj,
  4141. special, handlers, type, namespaces, origType,
  4142. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  4143. if ( !elemData || !( events = elemData.events ) ) {
  4144. return;
  4145. }
  4146. // Once for each type.namespace in types; type may be omitted
  4147. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4148. t = types.length;
  4149. while ( t-- ) {
  4150. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4151. type = origType = tmp[ 1 ];
  4152. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4153. // Unbind all events (on this namespace, if provided) for the element
  4154. if ( !type ) {
  4155. for ( type in events ) {
  4156. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  4157. }
  4158. continue;
  4159. }
  4160. special = jQuery.event.special[ type ] || {};
  4161. type = ( selector ? special.delegateType : special.bindType ) || type;
  4162. handlers = events[ type ] || [];
  4163. tmp = tmp[ 2 ] &&
  4164. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  4165. // Remove matching events
  4166. origCount = j = handlers.length;
  4167. while ( j-- ) {
  4168. handleObj = handlers[ j ];
  4169. if ( ( mappedTypes || origType === handleObj.origType ) &&
  4170. ( !handler || handler.guid === handleObj.guid ) &&
  4171. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  4172. ( !selector || selector === handleObj.selector ||
  4173. selector === "**" && handleObj.selector ) ) {
  4174. handlers.splice( j, 1 );
  4175. if ( handleObj.selector ) {
  4176. handlers.delegateCount--;
  4177. }
  4178. if ( special.remove ) {
  4179. special.remove.call( elem, handleObj );
  4180. }
  4181. }
  4182. }
  4183. // Remove generic event handler if we removed something and no more handlers exist
  4184. // (avoids potential for endless recursion during removal of special event handlers)
  4185. if ( origCount && !handlers.length ) {
  4186. if ( !special.teardown ||
  4187. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  4188. jQuery.removeEvent( elem, type, elemData.handle );
  4189. }
  4190. delete events[ type ];
  4191. }
  4192. }
  4193. // Remove data and the expando if it's no longer used
  4194. if ( jQuery.isEmptyObject( events ) ) {
  4195. dataPriv.remove( elem, "handle events" );
  4196. }
  4197. },
  4198. dispatch: function( nativeEvent ) {
  4199. // Make a writable jQuery.Event from the native event object
  4200. var event = jQuery.event.fix( nativeEvent );
  4201. var i, j, ret, matched, handleObj, handlerQueue,
  4202. args = new Array( arguments.length ),
  4203. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  4204. special = jQuery.event.special[ event.type ] || {};
  4205. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  4206. args[ 0 ] = event;
  4207. for ( i = 1; i < arguments.length; i++ ) {
  4208. args[ i ] = arguments[ i ];
  4209. }
  4210. event.delegateTarget = this;
  4211. // Call the preDispatch hook for the mapped type, and let it bail if desired
  4212. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  4213. return;
  4214. }
  4215. // Determine handlers
  4216. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  4217. // Run delegates first; they may want to stop propagation beneath us
  4218. i = 0;
  4219. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  4220. event.currentTarget = matched.elem;
  4221. j = 0;
  4222. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  4223. !event.isImmediatePropagationStopped() ) {
  4224. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  4225. // a subset or equal to those in the bound event (both can have no namespace).
  4226. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  4227. event.handleObj = handleObj;
  4228. event.data = handleObj.data;
  4229. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  4230. handleObj.handler ).apply( matched.elem, args );
  4231. if ( ret !== undefined ) {
  4232. if ( ( event.result = ret ) === false ) {
  4233. event.preventDefault();
  4234. event.stopPropagation();
  4235. }
  4236. }
  4237. }
  4238. }
  4239. }
  4240. // Call the postDispatch hook for the mapped type
  4241. if ( special.postDispatch ) {
  4242. special.postDispatch.call( this, event );
  4243. }
  4244. return event.result;
  4245. },
  4246. handlers: function( event, handlers ) {
  4247. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  4248. handlerQueue = [],
  4249. delegateCount = handlers.delegateCount,
  4250. cur = event.target;
  4251. // Find delegate handlers
  4252. if ( delegateCount &&
  4253. // Support: IE <=9
  4254. // Black-hole SVG <use> instance trees (trac-13180)
  4255. cur.nodeType &&
  4256. // Support: Firefox <=42
  4257. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  4258. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  4259. // Support: IE 11 only
  4260. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  4261. !( event.type === "click" && event.button >= 1 ) ) {
  4262. for ( ; cur !== this; cur = cur.parentNode || this ) {
  4263. // Don't check non-elements (#13208)
  4264. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  4265. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  4266. matchedHandlers = [];
  4267. matchedSelectors = {};
  4268. for ( i = 0; i < delegateCount; i++ ) {
  4269. handleObj = handlers[ i ];
  4270. // Don't conflict with Object.prototype properties (#13203)
  4271. sel = handleObj.selector + " ";
  4272. if ( matchedSelectors[ sel ] === undefined ) {
  4273. matchedSelectors[ sel ] = handleObj.needsContext ?
  4274. jQuery( sel, this ).index( cur ) > -1 :
  4275. jQuery.find( sel, this, null, [ cur ] ).length;
  4276. }
  4277. if ( matchedSelectors[ sel ] ) {
  4278. matchedHandlers.push( handleObj );
  4279. }
  4280. }
  4281. if ( matchedHandlers.length ) {
  4282. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  4283. }
  4284. }
  4285. }
  4286. }
  4287. // Add the remaining (directly-bound) handlers
  4288. cur = this;
  4289. if ( delegateCount < handlers.length ) {
  4290. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  4291. }
  4292. return handlerQueue;
  4293. },
  4294. addProp: function( name, hook ) {
  4295. Object.defineProperty( jQuery.Event.prototype, name, {
  4296. enumerable: true,
  4297. configurable: true,
  4298. get: isFunction( hook ) ?
  4299. function() {
  4300. if ( this.originalEvent ) {
  4301. return hook( this.originalEvent );
  4302. }
  4303. } :
  4304. function() {
  4305. if ( this.originalEvent ) {
  4306. return this.originalEvent[ name ];
  4307. }
  4308. },
  4309. set: function( value ) {
  4310. Object.defineProperty( this, name, {
  4311. enumerable: true,
  4312. configurable: true,
  4313. writable: true,
  4314. value: value
  4315. } );
  4316. }
  4317. } );
  4318. },
  4319. fix: function( originalEvent ) {
  4320. return originalEvent[ jQuery.expando ] ?
  4321. originalEvent :
  4322. new jQuery.Event( originalEvent );
  4323. },
  4324. special: {
  4325. load: {
  4326. // Prevent triggered image.load events from bubbling to window.load
  4327. noBubble: true
  4328. },
  4329. focus: {
  4330. // Fire native event if possible so blur/focus sequence is correct
  4331. trigger: function() {
  4332. if ( this !== safeActiveElement() && this.focus ) {
  4333. this.focus();
  4334. return false;
  4335. }
  4336. },
  4337. delegateType: "focusin"
  4338. },
  4339. blur: {
  4340. trigger: function() {
  4341. if ( this === safeActiveElement() && this.blur ) {
  4342. this.blur();
  4343. return false;
  4344. }
  4345. },
  4346. delegateType: "focusout"
  4347. },
  4348. click: {
  4349. // For checkbox, fire native event so checked state will be right
  4350. trigger: function() {
  4351. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  4352. this.click();
  4353. return false;
  4354. }
  4355. },
  4356. // For cross-browser consistency, don't fire native .click() on links
  4357. _default: function( event ) {
  4358. return nodeName( event.target, "a" );
  4359. }
  4360. },
  4361. beforeunload: {
  4362. postDispatch: function( event ) {
  4363. // Support: Firefox 20+
  4364. // Firefox doesn't alert if the returnValue field is not set.
  4365. if ( event.result !== undefined && event.originalEvent ) {
  4366. event.originalEvent.returnValue = event.result;
  4367. }
  4368. }
  4369. }
  4370. }
  4371. };
  4372. jQuery.removeEvent = function( elem, type, handle ) {
  4373. // This "if" is needed for plain objects
  4374. if ( elem.removeEventListener ) {
  4375. elem.removeEventListener( type, handle );
  4376. }
  4377. };
  4378. jQuery.Event = function( src, props ) {
  4379. // Allow instantiation without the 'new' keyword
  4380. if ( !( this instanceof jQuery.Event ) ) {
  4381. return new jQuery.Event( src, props );
  4382. }
  4383. // Event object
  4384. if ( src && src.type ) {
  4385. this.originalEvent = src;
  4386. this.type = src.type;
  4387. // Events bubbling up the document may have been marked as prevented
  4388. // by a handler lower down the tree; reflect the correct value.
  4389. this.isDefaultPrevented = src.defaultPrevented ||
  4390. src.defaultPrevented === undefined &&
  4391. // Support: Android <=2.3 only
  4392. src.returnValue === false ?
  4393. returnTrue :
  4394. returnFalse;
  4395. // Create target properties
  4396. // Support: Safari <=6 - 7 only
  4397. // Target should not be a text node (#504, #13143)
  4398. this.target = ( src.target && src.target.nodeType === 3 ) ?
  4399. src.target.parentNode :
  4400. src.target;
  4401. this.currentTarget = src.currentTarget;
  4402. this.relatedTarget = src.relatedTarget;
  4403. // Event type
  4404. } else {
  4405. this.type = src;
  4406. }
  4407. // Put explicitly provided properties onto the event object
  4408. if ( props ) {
  4409. jQuery.extend( this, props );
  4410. }
  4411. // Create a timestamp if incoming event doesn't have one
  4412. this.timeStamp = src && src.timeStamp || Date.now();
  4413. // Mark it as fixed
  4414. this[ jQuery.expando ] = true;
  4415. };
  4416. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  4417. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  4418. jQuery.Event.prototype = {
  4419. constructor: jQuery.Event,
  4420. isDefaultPrevented: returnFalse,
  4421. isPropagationStopped: returnFalse,
  4422. isImmediatePropagationStopped: returnFalse,
  4423. isSimulated: false,
  4424. preventDefault: function() {
  4425. var e = this.originalEvent;
  4426. this.isDefaultPrevented = returnTrue;
  4427. if ( e && !this.isSimulated ) {
  4428. e.preventDefault();
  4429. }
  4430. },
  4431. stopPropagation: function() {
  4432. var e = this.originalEvent;
  4433. this.isPropagationStopped = returnTrue;
  4434. if ( e && !this.isSimulated ) {
  4435. e.stopPropagation();
  4436. }
  4437. },
  4438. stopImmediatePropagation: function() {
  4439. var e = this.originalEvent;
  4440. this.isImmediatePropagationStopped = returnTrue;
  4441. if ( e && !this.isSimulated ) {
  4442. e.stopImmediatePropagation();
  4443. }
  4444. this.stopPropagation();
  4445. }
  4446. };
  4447. // Includes all common event props including KeyEvent and MouseEvent specific props
  4448. jQuery.each( {
  4449. altKey: true,
  4450. bubbles: true,
  4451. cancelable: true,
  4452. changedTouches: true,
  4453. ctrlKey: true,
  4454. detail: true,
  4455. eventPhase: true,
  4456. metaKey: true,
  4457. pageX: true,
  4458. pageY: true,
  4459. shiftKey: true,
  4460. view: true,
  4461. "char": true,
  4462. charCode: true,
  4463. key: true,
  4464. keyCode: true,
  4465. button: true,
  4466. buttons: true,
  4467. clientX: true,
  4468. clientY: true,
  4469. offsetX: true,
  4470. offsetY: true,
  4471. pointerId: true,
  4472. pointerType: true,
  4473. screenX: true,
  4474. screenY: true,
  4475. targetTouches: true,
  4476. toElement: true,
  4477. touches: true,
  4478. which: function( event ) {
  4479. var button = event.button;
  4480. // Add which for key events
  4481. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  4482. return event.charCode != null ? event.charCode : event.keyCode;
  4483. }
  4484. // Add which for click: 1 === left; 2 === middle; 3 === right
  4485. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  4486. if ( button & 1 ) {
  4487. return 1;
  4488. }
  4489. if ( button & 2 ) {
  4490. return 3;
  4491. }
  4492. if ( button & 4 ) {
  4493. return 2;
  4494. }
  4495. return 0;
  4496. }
  4497. return event.which;
  4498. }
  4499. }, jQuery.event.addProp );
  4500. // Create mouseenter/leave events using mouseover/out and event-time checks
  4501. // so that event delegation works in jQuery.
  4502. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  4503. //
  4504. // Support: Safari 7 only
  4505. // Safari sends mouseenter too often; see:
  4506. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  4507. // for the description of the bug (it existed in older Chrome versions as well).
  4508. jQuery.each( {
  4509. mouseenter: "mouseover",
  4510. mouseleave: "mouseout",
  4511. pointerenter: "pointerover",
  4512. pointerleave: "pointerout"
  4513. }, function( orig, fix ) {
  4514. jQuery.event.special[ orig ] = {
  4515. delegateType: fix,
  4516. bindType: fix,
  4517. handle: function( event ) {
  4518. var ret,
  4519. target = this,
  4520. related = event.relatedTarget,
  4521. handleObj = event.handleObj;
  4522. // For mouseenter/leave call the handler if related is outside the target.
  4523. // NB: No relatedTarget if the mouse left/entered the browser window
  4524. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  4525. event.type = handleObj.origType;
  4526. ret = handleObj.handler.apply( this, arguments );
  4527. event.type = fix;
  4528. }
  4529. return ret;
  4530. }
  4531. };
  4532. } );
  4533. jQuery.fn.extend( {
  4534. on: function( types, selector, data, fn ) {
  4535. return on( this, types, selector, data, fn );
  4536. },
  4537. one: function( types, selector, data, fn ) {
  4538. return on( this, types, selector, data, fn, 1 );
  4539. },
  4540. off: function( types, selector, fn ) {
  4541. var handleObj, type;
  4542. if ( types && types.preventDefault && types.handleObj ) {
  4543. // ( event ) dispatched jQuery.Event
  4544. handleObj = types.handleObj;
  4545. jQuery( types.delegateTarget ).off(
  4546. handleObj.namespace ?
  4547. handleObj.origType + "." + handleObj.namespace :
  4548. handleObj.origType,
  4549. handleObj.selector,
  4550. handleObj.handler
  4551. );
  4552. return this;
  4553. }
  4554. if ( typeof types === "object" ) {
  4555. // ( types-object [, selector] )
  4556. for ( type in types ) {
  4557. this.off( type, selector, types[ type ] );
  4558. }
  4559. return this;
  4560. }
  4561. if ( selector === false || typeof selector === "function" ) {
  4562. // ( types [, fn] )
  4563. fn = selector;
  4564. selector = undefined;
  4565. }
  4566. if ( fn === false ) {
  4567. fn = returnFalse;
  4568. }
  4569. return this.each( function() {
  4570. jQuery.event.remove( this, types, fn, selector );
  4571. } );
  4572. }
  4573. } );
  4574. var
  4575. /* eslint-disable max-len */
  4576. // See https://github.com/eslint/eslint/issues/3229
  4577. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  4578. /* eslint-enable */
  4579. // Support: IE <=10 - 11, Edge 12 - 13 only
  4580. // In IE/Edge using regex groups here causes severe slowdowns.
  4581. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  4582. rnoInnerhtml = /<script|<style|<link/i,
  4583. // checked="checked" or checked
  4584. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  4585. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  4586. // Prefer a tbody over its parent table for containing new rows
  4587. function manipulationTarget( elem, content ) {
  4588. if ( nodeName( elem, "table" ) &&
  4589. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  4590. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  4591. }
  4592. return elem;
  4593. }
  4594. // Replace/restore the type attribute of script elements for safe DOM manipulation
  4595. function disableScript( elem ) {
  4596. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  4597. return elem;
  4598. }
  4599. function restoreScript( elem ) {
  4600. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  4601. elem.type = elem.type.slice( 5 );
  4602. } else {
  4603. elem.removeAttribute( "type" );
  4604. }
  4605. return elem;
  4606. }
  4607. function cloneCopyEvent( src, dest ) {
  4608. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  4609. if ( dest.nodeType !== 1 ) {
  4610. return;
  4611. }
  4612. // 1. Copy private data: events, handlers, etc.
  4613. if ( dataPriv.hasData( src ) ) {
  4614. pdataOld = dataPriv.access( src );
  4615. pdataCur = dataPriv.set( dest, pdataOld );
  4616. events = pdataOld.events;
  4617. if ( events ) {
  4618. delete pdataCur.handle;
  4619. pdataCur.events = {};
  4620. for ( type in events ) {
  4621. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  4622. jQuery.event.add( dest, type, events[ type ][ i ] );
  4623. }
  4624. }
  4625. }
  4626. }
  4627. // 2. Copy user data
  4628. if ( dataUser.hasData( src ) ) {
  4629. udataOld = dataUser.access( src );
  4630. udataCur = jQuery.extend( {}, udataOld );
  4631. dataUser.set( dest, udataCur );
  4632. }
  4633. }
  4634. // Fix IE bugs, see support tests
  4635. function fixInput( src, dest ) {
  4636. var nodeName = dest.nodeName.toLowerCase();
  4637. // Fails to persist the checked state of a cloned checkbox or radio button.
  4638. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  4639. dest.checked = src.checked;
  4640. // Fails to return the selected option to the default selected state when cloning options
  4641. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  4642. dest.defaultValue = src.defaultValue;
  4643. }
  4644. }
  4645. function domManip( collection, args, callback, ignored ) {
  4646. // Flatten any nested arrays
  4647. args = concat.apply( [], args );
  4648. var fragment, first, scripts, hasScripts, node, doc,
  4649. i = 0,
  4650. l = collection.length,
  4651. iNoClone = l - 1,
  4652. value = args[ 0 ],
  4653. valueIsFunction = isFunction( value );
  4654. // We can't cloneNode fragments that contain checked, in WebKit
  4655. if ( valueIsFunction ||
  4656. ( l > 1 && typeof value === "string" &&
  4657. !support.checkClone && rchecked.test( value ) ) ) {
  4658. return collection.each( function( index ) {
  4659. var self = collection.eq( index );
  4660. if ( valueIsFunction ) {
  4661. args[ 0 ] = value.call( this, index, self.html() );
  4662. }
  4663. domManip( self, args, callback, ignored );
  4664. } );
  4665. }
  4666. if ( l ) {
  4667. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  4668. first = fragment.firstChild;
  4669. if ( fragment.childNodes.length === 1 ) {
  4670. fragment = first;
  4671. }
  4672. // Require either new content or an interest in ignored elements to invoke the callback
  4673. if ( first || ignored ) {
  4674. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  4675. hasScripts = scripts.length;
  4676. // Use the original fragment for the last item
  4677. // instead of the first because it can end up
  4678. // being emptied incorrectly in certain situations (#8070).
  4679. for ( ; i < l; i++ ) {
  4680. node = fragment;
  4681. if ( i !== iNoClone ) {
  4682. node = jQuery.clone( node, true, true );
  4683. // Keep references to cloned scripts for later restoration
  4684. if ( hasScripts ) {
  4685. // Support: Android <=4.0 only, PhantomJS 1 only
  4686. // push.apply(_, arraylike) throws on ancient WebKit
  4687. jQuery.merge( scripts, getAll( node, "script" ) );
  4688. }
  4689. }
  4690. callback.call( collection[ i ], node, i );
  4691. }
  4692. if ( hasScripts ) {
  4693. doc = scripts[ scripts.length - 1 ].ownerDocument;
  4694. // Reenable scripts
  4695. jQuery.map( scripts, restoreScript );
  4696. // Evaluate executable scripts on first document insertion
  4697. for ( i = 0; i < hasScripts; i++ ) {
  4698. node = scripts[ i ];
  4699. if ( rscriptType.test( node.type || "" ) &&
  4700. !dataPriv.access( node, "globalEval" ) &&
  4701. jQuery.contains( doc, node ) ) {
  4702. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  4703. // Optional AJAX dependency, but won't run scripts if not present
  4704. if ( jQuery._evalUrl ) {
  4705. jQuery._evalUrl( node.src );
  4706. }
  4707. } else {
  4708. DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
  4709. }
  4710. }
  4711. }
  4712. }
  4713. }
  4714. }
  4715. return collection;
  4716. }
  4717. function remove( elem, selector, keepData ) {
  4718. var node,
  4719. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  4720. i = 0;
  4721. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  4722. if ( !keepData && node.nodeType === 1 ) {
  4723. jQuery.cleanData( getAll( node ) );
  4724. }
  4725. if ( node.parentNode ) {
  4726. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  4727. setGlobalEval( getAll( node, "script" ) );
  4728. }
  4729. node.parentNode.removeChild( node );
  4730. }
  4731. }
  4732. return elem;
  4733. }
  4734. jQuery.extend( {
  4735. htmlPrefilter: function( html ) {
  4736. return html.replace( rxhtmlTag, "<$1></$2>" );
  4737. },
  4738. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  4739. var i, l, srcElements, destElements,
  4740. clone = elem.cloneNode( true ),
  4741. inPage = jQuery.contains( elem.ownerDocument, elem );
  4742. // Fix IE cloning issues
  4743. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  4744. !jQuery.isXMLDoc( elem ) ) {
  4745. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  4746. destElements = getAll( clone );
  4747. srcElements = getAll( elem );
  4748. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  4749. fixInput( srcElements[ i ], destElements[ i ] );
  4750. }
  4751. }
  4752. // Copy the events from the original to the clone
  4753. if ( dataAndEvents ) {
  4754. if ( deepDataAndEvents ) {
  4755. srcElements = srcElements || getAll( elem );
  4756. destElements = destElements || getAll( clone );
  4757. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  4758. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  4759. }
  4760. } else {
  4761. cloneCopyEvent( elem, clone );
  4762. }
  4763. }
  4764. // Preserve script evaluation history
  4765. destElements = getAll( clone, "script" );
  4766. if ( destElements.length > 0 ) {
  4767. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  4768. }
  4769. // Return the cloned set
  4770. return clone;
  4771. },
  4772. cleanData: function( elems ) {
  4773. var data, elem, type,
  4774. special = jQuery.event.special,
  4775. i = 0;
  4776. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  4777. if ( acceptData( elem ) ) {
  4778. if ( ( data = elem[ dataPriv.expando ] ) ) {
  4779. if ( data.events ) {
  4780. for ( type in data.events ) {
  4781. if ( special[ type ] ) {
  4782. jQuery.event.remove( elem, type );
  4783. // This is a shortcut to avoid jQuery.event.remove's overhead
  4784. } else {
  4785. jQuery.removeEvent( elem, type, data.handle );
  4786. }
  4787. }
  4788. }
  4789. // Support: Chrome <=35 - 45+
  4790. // Assign undefined instead of using delete, see Data#remove
  4791. elem[ dataPriv.expando ] = undefined;
  4792. }
  4793. if ( elem[ dataUser.expando ] ) {
  4794. // Support: Chrome <=35 - 45+
  4795. // Assign undefined instead of using delete, see Data#remove
  4796. elem[ dataUser.expando ] = undefined;
  4797. }
  4798. }
  4799. }
  4800. }
  4801. } );
  4802. jQuery.fn.extend( {
  4803. detach: function( selector ) {
  4804. return remove( this, selector, true );
  4805. },
  4806. remove: function( selector ) {
  4807. return remove( this, selector );
  4808. },
  4809. text: function( value ) {
  4810. return access( this, function( value ) {
  4811. return value === undefined ?
  4812. jQuery.text( this ) :
  4813. this.empty().each( function() {
  4814. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4815. this.textContent = value;
  4816. }
  4817. } );
  4818. }, null, value, arguments.length );
  4819. },
  4820. append: function() {
  4821. return domManip( this, arguments, function( elem ) {
  4822. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4823. var target = manipulationTarget( this, elem );
  4824. target.appendChild( elem );
  4825. }
  4826. } );
  4827. },
  4828. prepend: function() {
  4829. return domManip( this, arguments, function( elem ) {
  4830. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4831. var target = manipulationTarget( this, elem );
  4832. target.insertBefore( elem, target.firstChild );
  4833. }
  4834. } );
  4835. },
  4836. before: function() {
  4837. return domManip( this, arguments, function( elem ) {
  4838. if ( this.parentNode ) {
  4839. this.parentNode.insertBefore( elem, this );
  4840. }
  4841. } );
  4842. },
  4843. after: function() {
  4844. return domManip( this, arguments, function( elem ) {
  4845. if ( this.parentNode ) {
  4846. this.parentNode.insertBefore( elem, this.nextSibling );
  4847. }
  4848. } );
  4849. },
  4850. empty: function() {
  4851. var elem,
  4852. i = 0;
  4853. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  4854. if ( elem.nodeType === 1 ) {
  4855. // Prevent memory leaks
  4856. jQuery.cleanData( getAll( elem, false ) );
  4857. // Remove any remaining nodes
  4858. elem.textContent = "";
  4859. }
  4860. }
  4861. return this;
  4862. },
  4863. clone: function( dataAndEvents, deepDataAndEvents ) {
  4864. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  4865. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  4866. return this.map( function() {
  4867. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  4868. } );
  4869. },
  4870. html: function( value ) {
  4871. return access( this, function( value ) {
  4872. var elem = this[ 0 ] || {},
  4873. i = 0,
  4874. l = this.length;
  4875. if ( value === undefined && elem.nodeType === 1 ) {
  4876. return elem.innerHTML;
  4877. }
  4878. // See if we can take a shortcut and just use innerHTML
  4879. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  4880. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  4881. value = jQuery.htmlPrefilter( value );
  4882. try {
  4883. for ( ; i < l; i++ ) {
  4884. elem = this[ i ] || {};
  4885. // Remove element nodes and prevent memory leaks
  4886. if ( elem.nodeType === 1 ) {
  4887. jQuery.cleanData( getAll( elem, false ) );
  4888. elem.innerHTML = value;
  4889. }
  4890. }
  4891. elem = 0;
  4892. // If using innerHTML throws an exception, use the fallback method
  4893. } catch ( e ) {}
  4894. }
  4895. if ( elem ) {
  4896. this.empty().append( value );
  4897. }
  4898. }, null, value, arguments.length );
  4899. },
  4900. replaceWith: function() {
  4901. var ignored = [];
  4902. // Make the changes, replacing each non-ignored context element with the new content
  4903. return domManip( this, arguments, function( elem ) {
  4904. var parent = this.parentNode;
  4905. if ( jQuery.inArray( this, ignored ) < 0 ) {
  4906. jQuery.cleanData( getAll( this ) );
  4907. if ( parent ) {
  4908. parent.replaceChild( elem, this );
  4909. }
  4910. }
  4911. // Force callback invocation
  4912. }, ignored );
  4913. }
  4914. } );
  4915. jQuery.each( {
  4916. appendTo: "append",
  4917. prependTo: "prepend",
  4918. insertBefore: "before",
  4919. insertAfter: "after",
  4920. replaceAll: "replaceWith"
  4921. }, function( name, original ) {
  4922. jQuery.fn[ name ] = function( selector ) {
  4923. var elems,
  4924. ret = [],
  4925. insert = jQuery( selector ),
  4926. last = insert.length - 1,
  4927. i = 0;
  4928. for ( ; i <= last; i++ ) {
  4929. elems = i === last ? this : this.clone( true );
  4930. jQuery( insert[ i ] )[ original ]( elems );
  4931. // Support: Android <=4.0 only, PhantomJS 1 only
  4932. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  4933. push.apply( ret, elems.get() );
  4934. }
  4935. return this.pushStack( ret );
  4936. };
  4937. } );
  4938. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  4939. var getStyles = function( elem ) {
  4940. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  4941. // IE throws on elements created in popups
  4942. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  4943. var view = elem.ownerDocument.defaultView;
  4944. if ( !view || !view.opener ) {
  4945. view = window;
  4946. }
  4947. return view.getComputedStyle( elem );
  4948. };
  4949. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  4950. ( function() {
  4951. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  4952. // so they're executed at the same time to save the second computation.
  4953. function computeStyleTests() {
  4954. // This is a singleton, we need to execute it only once
  4955. if ( !div ) {
  4956. return;
  4957. }
  4958. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  4959. "margin-top:1px;padding:0;border:0";
  4960. div.style.cssText =
  4961. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  4962. "margin:auto;border:1px;padding:1px;" +
  4963. "width:60%;top:1%";
  4964. documentElement.appendChild( container ).appendChild( div );
  4965. var divStyle = window.getComputedStyle( div );
  4966. pixelPositionVal = divStyle.top !== "1%";
  4967. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  4968. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  4969. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  4970. // Some styles come back with percentage values, even though they shouldn't
  4971. div.style.right = "60%";
  4972. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  4973. // Support: IE 9 - 11 only
  4974. // Detect misreporting of content dimensions for box-sizing:border-box elements
  4975. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  4976. // Support: IE 9 only
  4977. // Detect overflow:scroll screwiness (gh-3699)
  4978. div.style.position = "absolute";
  4979. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  4980. documentElement.removeChild( container );
  4981. // Nullify the div so it wouldn't be stored in the memory and
  4982. // it will also be a sign that checks already performed
  4983. div = null;
  4984. }
  4985. function roundPixelMeasures( measure ) {
  4986. return Math.round( parseFloat( measure ) );
  4987. }
  4988. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  4989. reliableMarginLeftVal,
  4990. container = document.createElement( "div" ),
  4991. div = document.createElement( "div" );
  4992. // Finish early in limited (non-browser) environments
  4993. if ( !div.style ) {
  4994. return;
  4995. }
  4996. // Support: IE <=9 - 11 only
  4997. // Style of cloned element affects source element cloned (#8908)
  4998. div.style.backgroundClip = "content-box";
  4999. div.cloneNode( true ).style.backgroundClip = "";
  5000. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  5001. jQuery.extend( support, {
  5002. boxSizingReliable: function() {
  5003. computeStyleTests();
  5004. return boxSizingReliableVal;
  5005. },
  5006. pixelBoxStyles: function() {
  5007. computeStyleTests();
  5008. return pixelBoxStylesVal;
  5009. },
  5010. pixelPosition: function() {
  5011. computeStyleTests();
  5012. return pixelPositionVal;
  5013. },
  5014. reliableMarginLeft: function() {
  5015. computeStyleTests();
  5016. return reliableMarginLeftVal;
  5017. },
  5018. scrollboxSize: function() {
  5019. computeStyleTests();
  5020. return scrollboxSizeVal;
  5021. }
  5022. } );
  5023. } )();
  5024. function curCSS( elem, name, computed ) {
  5025. var width, minWidth, maxWidth, ret,
  5026. // Support: Firefox 51+
  5027. // Retrieving style before computed somehow
  5028. // fixes an issue with getting wrong values
  5029. // on detached elements
  5030. style = elem.style;
  5031. computed = computed || getStyles( elem );
  5032. // getPropertyValue is needed for:
  5033. // .css('filter') (IE 9 only, #12537)
  5034. // .css('--customProperty) (#3144)
  5035. if ( computed ) {
  5036. ret = computed.getPropertyValue( name ) || computed[ name ];
  5037. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  5038. ret = jQuery.style( elem, name );
  5039. }
  5040. // A tribute to the "awesome hack by Dean Edwards"
  5041. // Android Browser returns percentage for some values,
  5042. // but width seems to be reliably pixels.
  5043. // This is against the CSSOM draft spec:
  5044. // https://drafts.csswg.org/cssom/#resolved-values
  5045. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  5046. // Remember the original values
  5047. width = style.width;
  5048. minWidth = style.minWidth;
  5049. maxWidth = style.maxWidth;
  5050. // Put in the new values to get a computed value out
  5051. style.minWidth = style.maxWidth = style.width = ret;
  5052. ret = computed.width;
  5053. // Revert the changed values
  5054. style.width = width;
  5055. style.minWidth = minWidth;
  5056. style.maxWidth = maxWidth;
  5057. }
  5058. }
  5059. return ret !== undefined ?
  5060. // Support: IE <=9 - 11 only
  5061. // IE returns zIndex value as an integer.
  5062. ret + "" :
  5063. ret;
  5064. }
  5065. function addGetHookIf( conditionFn, hookFn ) {
  5066. // Define the hook, we'll check on the first run if it's really needed.
  5067. return {
  5068. get: function() {
  5069. if ( conditionFn() ) {
  5070. // Hook not needed (or it's not possible to use it due
  5071. // to missing dependency), remove it.
  5072. delete this.get;
  5073. return;
  5074. }
  5075. // Hook needed; redefine it so that the support test is not executed again.
  5076. return ( this.get = hookFn ).apply( this, arguments );
  5077. }
  5078. };
  5079. }
  5080. var
  5081. // Swappable if display is none or starts with table
  5082. // except "table", "table-cell", or "table-caption"
  5083. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  5084. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  5085. rcustomProp = /^--/,
  5086. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  5087. cssNormalTransform = {
  5088. letterSpacing: "0",
  5089. fontWeight: "400"
  5090. },
  5091. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  5092. emptyStyle = document.createElement( "div" ).style;
  5093. // Return a css property mapped to a potentially vendor prefixed property
  5094. function vendorPropName( name ) {
  5095. // Shortcut for names that are not vendor prefixed
  5096. if ( name in emptyStyle ) {
  5097. return name;
  5098. }
  5099. // Check for vendor prefixed names
  5100. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  5101. i = cssPrefixes.length;
  5102. while ( i-- ) {
  5103. name = cssPrefixes[ i ] + capName;
  5104. if ( name in emptyStyle ) {
  5105. return name;
  5106. }
  5107. }
  5108. }
  5109. // Return a property mapped along what jQuery.cssProps suggests or to
  5110. // a vendor prefixed property.
  5111. function finalPropName( name ) {
  5112. var ret = jQuery.cssProps[ name ];
  5113. if ( !ret ) {
  5114. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  5115. }
  5116. return ret;
  5117. }
  5118. function setPositiveNumber( elem, value, subtract ) {
  5119. // Any relative (+/-) values have already been
  5120. // normalized at this point
  5121. var matches = rcssNum.exec( value );
  5122. return matches ?
  5123. // Guard against undefined "subtract", e.g., when used as in cssHooks
  5124. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  5125. value;
  5126. }
  5127. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  5128. var i = dimension === "width" ? 1 : 0,
  5129. extra = 0,
  5130. delta = 0;
  5131. // Adjustment may not be necessary
  5132. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  5133. return 0;
  5134. }
  5135. for ( ; i < 4; i += 2 ) {
  5136. // Both box models exclude margin
  5137. if ( box === "margin" ) {
  5138. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  5139. }
  5140. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  5141. if ( !isBorderBox ) {
  5142. // Add padding
  5143. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5144. // For "border" or "margin", add border
  5145. if ( box !== "padding" ) {
  5146. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5147. // But still keep track of it otherwise
  5148. } else {
  5149. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5150. }
  5151. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  5152. // "padding" or "margin"
  5153. } else {
  5154. // For "content", subtract padding
  5155. if ( box === "content" ) {
  5156. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5157. }
  5158. // For "content" or "padding", subtract border
  5159. if ( box !== "margin" ) {
  5160. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5161. }
  5162. }
  5163. }
  5164. // Account for positive content-box scroll gutter when requested by providing computedVal
  5165. if ( !isBorderBox && computedVal >= 0 ) {
  5166. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  5167. // Assuming integer scroll gutter, subtract the rest and round down
  5168. delta += Math.max( 0, Math.ceil(
  5169. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  5170. computedVal -
  5171. delta -
  5172. extra -
  5173. 0.5
  5174. ) );
  5175. }
  5176. return delta;
  5177. }
  5178. function getWidthOrHeight( elem, dimension, extra ) {
  5179. // Start with computed style
  5180. var styles = getStyles( elem ),
  5181. val = curCSS( elem, dimension, styles ),
  5182. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  5183. valueIsBorderBox = isBorderBox;
  5184. // Support: Firefox <=54
  5185. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  5186. if ( rnumnonpx.test( val ) ) {
  5187. if ( !extra ) {
  5188. return val;
  5189. }
  5190. val = "auto";
  5191. }
  5192. // Check for style in case a browser which returns unreliable values
  5193. // for getComputedStyle silently falls back to the reliable elem.style
  5194. valueIsBorderBox = valueIsBorderBox &&
  5195. ( support.boxSizingReliable() || val === elem.style[ dimension ] );
  5196. // Fall back to offsetWidth/offsetHeight when value is "auto"
  5197. // This happens for inline elements with no explicit setting (gh-3571)
  5198. // Support: Android <=4.1 - 4.3 only
  5199. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  5200. if ( val === "auto" ||
  5201. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
  5202. val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
  5203. // offsetWidth/offsetHeight provide border-box values
  5204. valueIsBorderBox = true;
  5205. }
  5206. // Normalize "" and auto
  5207. val = parseFloat( val ) || 0;
  5208. // Adjust for the element's box model
  5209. return ( val +
  5210. boxModelAdjustment(
  5211. elem,
  5212. dimension,
  5213. extra || ( isBorderBox ? "border" : "content" ),
  5214. valueIsBorderBox,
  5215. styles,
  5216. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  5217. val
  5218. )
  5219. ) + "px";
  5220. }
  5221. jQuery.extend( {
  5222. // Add in style property hooks for overriding the default
  5223. // behavior of getting and setting a style property
  5224. cssHooks: {
  5225. opacity: {
  5226. get: function( elem, computed ) {
  5227. if ( computed ) {
  5228. // We should always get a number back from opacity
  5229. var ret = curCSS( elem, "opacity" );
  5230. return ret === "" ? "1" : ret;
  5231. }
  5232. }
  5233. }
  5234. },
  5235. // Don't automatically add "px" to these possibly-unitless properties
  5236. cssNumber: {
  5237. "animationIterationCount": true,
  5238. "columnCount": true,
  5239. "fillOpacity": true,
  5240. "flexGrow": true,
  5241. "flexShrink": true,
  5242. "fontWeight": true,
  5243. "lineHeight": true,
  5244. "opacity": true,
  5245. "order": true,
  5246. "orphans": true,
  5247. "widows": true,
  5248. "zIndex": true,
  5249. "zoom": true
  5250. },
  5251. // Add in properties whose names you wish to fix before
  5252. // setting or getting the value
  5253. cssProps: {},
  5254. // Get and set the style property on a DOM Node
  5255. style: function( elem, name, value, extra ) {
  5256. // Don't set styles on text and comment nodes
  5257. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  5258. return;
  5259. }
  5260. // Make sure that we're working with the right name
  5261. var ret, type, hooks,
  5262. origName = camelCase( name ),
  5263. isCustomProp = rcustomProp.test( name ),
  5264. style = elem.style;
  5265. // Make sure that we're working with the right name. We don't
  5266. // want to query the value if it is a CSS custom property
  5267. // since they are user-defined.
  5268. if ( !isCustomProp ) {
  5269. name = finalPropName( origName );
  5270. }
  5271. // Gets hook for the prefixed version, then unprefixed version
  5272. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5273. // Check if we're setting a value
  5274. if ( value !== undefined ) {
  5275. type = typeof value;
  5276. // Convert "+=" or "-=" to relative numbers (#7345)
  5277. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  5278. value = adjustCSS( elem, name, ret );
  5279. // Fixes bug #9237
  5280. type = "number";
  5281. }
  5282. // Make sure that null and NaN values aren't set (#7116)
  5283. if ( value == null || value !== value ) {
  5284. return;
  5285. }
  5286. // If a number was passed in, add the unit (except for certain CSS properties)
  5287. if ( type === "number" ) {
  5288. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  5289. }
  5290. // background-* props affect original clone's values
  5291. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  5292. style[ name ] = "inherit";
  5293. }
  5294. // If a hook was provided, use that value, otherwise just set the specified value
  5295. if ( !hooks || !( "set" in hooks ) ||
  5296. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  5297. if ( isCustomProp ) {
  5298. style.setProperty( name, value );
  5299. } else {
  5300. style[ name ] = value;
  5301. }
  5302. }
  5303. } else {
  5304. // If a hook was provided get the non-computed value from there
  5305. if ( hooks && "get" in hooks &&
  5306. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  5307. return ret;
  5308. }
  5309. // Otherwise just get the value from the style object
  5310. return style[ name ];
  5311. }
  5312. },
  5313. css: function( elem, name, extra, styles ) {
  5314. var val, num, hooks,
  5315. origName = camelCase( name ),
  5316. isCustomProp = rcustomProp.test( name );
  5317. // Make sure that we're working with the right name. We don't
  5318. // want to modify the value if it is a CSS custom property
  5319. // since they are user-defined.
  5320. if ( !isCustomProp ) {
  5321. name = finalPropName( origName );
  5322. }
  5323. // Try prefixed name followed by the unprefixed name
  5324. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5325. // If a hook was provided get the computed value from there
  5326. if ( hooks && "get" in hooks ) {
  5327. val = hooks.get( elem, true, extra );
  5328. }
  5329. // Otherwise, if a way to get the computed value exists, use that
  5330. if ( val === undefined ) {
  5331. val = curCSS( elem, name, styles );
  5332. }
  5333. // Convert "normal" to computed value
  5334. if ( val === "normal" && name in cssNormalTransform ) {
  5335. val = cssNormalTransform[ name ];
  5336. }
  5337. // Make numeric if forced or a qualifier was provided and val looks numeric
  5338. if ( extra === "" || extra ) {
  5339. num = parseFloat( val );
  5340. return extra === true || isFinite( num ) ? num || 0 : val;
  5341. }
  5342. return val;
  5343. }
  5344. } );
  5345. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  5346. jQuery.cssHooks[ dimension ] = {
  5347. get: function( elem, computed, extra ) {
  5348. if ( computed ) {
  5349. // Certain elements can have dimension info if we invisibly show them
  5350. // but it must have a current display style that would benefit
  5351. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  5352. // Support: Safari 8+
  5353. // Table columns in Safari have non-zero offsetWidth & zero
  5354. // getBoundingClientRect().width unless display is changed.
  5355. // Support: IE <=11 only
  5356. // Running getBoundingClientRect on a disconnected node
  5357. // in IE throws an error.
  5358. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  5359. swap( elem, cssShow, function() {
  5360. return getWidthOrHeight( elem, dimension, extra );
  5361. } ) :
  5362. getWidthOrHeight( elem, dimension, extra );
  5363. }
  5364. },
  5365. set: function( elem, value, extra ) {
  5366. var matches,
  5367. styles = getStyles( elem ),
  5368. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  5369. subtract = extra && boxModelAdjustment(
  5370. elem,
  5371. dimension,
  5372. extra,
  5373. isBorderBox,
  5374. styles
  5375. );
  5376. // Account for unreliable border-box dimensions by comparing offset* to computed and
  5377. // faking a content-box to get border and padding (gh-3699)
  5378. if ( isBorderBox && support.scrollboxSize() === styles.position ) {
  5379. subtract -= Math.ceil(
  5380. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  5381. parseFloat( styles[ dimension ] ) -
  5382. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  5383. 0.5
  5384. );
  5385. }
  5386. // Convert to pixels if value adjustment is needed
  5387. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  5388. ( matches[ 3 ] || "px" ) !== "px" ) {
  5389. elem.style[ dimension ] = value;
  5390. value = jQuery.css( elem, dimension );
  5391. }
  5392. return setPositiveNumber( elem, value, subtract );
  5393. }
  5394. };
  5395. } );
  5396. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  5397. function( elem, computed ) {
  5398. if ( computed ) {
  5399. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  5400. elem.getBoundingClientRect().left -
  5401. swap( elem, { marginLeft: 0 }, function() {
  5402. return elem.getBoundingClientRect().left;
  5403. } )
  5404. ) + "px";
  5405. }
  5406. }
  5407. );
  5408. // These hooks are used by animate to expand properties
  5409. jQuery.each( {
  5410. margin: "",
  5411. padding: "",
  5412. border: "Width"
  5413. }, function( prefix, suffix ) {
  5414. jQuery.cssHooks[ prefix + suffix ] = {
  5415. expand: function( value ) {
  5416. var i = 0,
  5417. expanded = {},
  5418. // Assumes a single number if not a string
  5419. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  5420. for ( ; i < 4; i++ ) {
  5421. expanded[ prefix + cssExpand[ i ] + suffix ] =
  5422. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  5423. }
  5424. return expanded;
  5425. }
  5426. };
  5427. if ( prefix !== "margin" ) {
  5428. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  5429. }
  5430. } );
  5431. jQuery.fn.extend( {
  5432. css: function( name, value ) {
  5433. return access( this, function( elem, name, value ) {
  5434. var styles, len,
  5435. map = {},
  5436. i = 0;
  5437. if ( Array.isArray( name ) ) {
  5438. styles = getStyles( elem );
  5439. len = name.length;
  5440. for ( ; i < len; i++ ) {
  5441. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  5442. }
  5443. return map;
  5444. }
  5445. return value !== undefined ?
  5446. jQuery.style( elem, name, value ) :
  5447. jQuery.css( elem, name );
  5448. }, name, value, arguments.length > 1 );
  5449. }
  5450. } );
  5451. function Tween( elem, options, prop, end, easing ) {
  5452. return new Tween.prototype.init( elem, options, prop, end, easing );
  5453. }
  5454. jQuery.Tween = Tween;
  5455. Tween.prototype = {
  5456. constructor: Tween,
  5457. init: function( elem, options, prop, end, easing, unit ) {
  5458. this.elem = elem;
  5459. this.prop = prop;
  5460. this.easing = easing || jQuery.easing._default;
  5461. this.options = options;
  5462. this.start = this.now = this.cur();
  5463. this.end = end;
  5464. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  5465. },
  5466. cur: function() {
  5467. var hooks = Tween.propHooks[ this.prop ];
  5468. return hooks && hooks.get ?
  5469. hooks.get( this ) :
  5470. Tween.propHooks._default.get( this );
  5471. },
  5472. run: function( percent ) {
  5473. var eased,
  5474. hooks = Tween.propHooks[ this.prop ];
  5475. if ( this.options.duration ) {
  5476. this.pos = eased = jQuery.easing[ this.easing ](
  5477. percent, this.options.duration * percent, 0, 1, this.options.duration
  5478. );
  5479. } else {
  5480. this.pos = eased = percent;
  5481. }
  5482. this.now = ( this.end - this.start ) * eased + this.start;
  5483. if ( this.options.step ) {
  5484. this.options.step.call( this.elem, this.now, this );
  5485. }
  5486. if ( hooks && hooks.set ) {
  5487. hooks.set( this );
  5488. } else {
  5489. Tween.propHooks._default.set( this );
  5490. }
  5491. return this;
  5492. }
  5493. };
  5494. Tween.prototype.init.prototype = Tween.prototype;
  5495. Tween.propHooks = {
  5496. _default: {
  5497. get: function( tween ) {
  5498. var result;
  5499. // Use a property on the element directly when it is not a DOM element,
  5500. // or when there is no matching style property that exists.
  5501. if ( tween.elem.nodeType !== 1 ||
  5502. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  5503. return tween.elem[ tween.prop ];
  5504. }
  5505. // Passing an empty string as a 3rd parameter to .css will automatically
  5506. // attempt a parseFloat and fallback to a string if the parse fails.
  5507. // Simple values such as "10px" are parsed to Float;
  5508. // complex values such as "rotate(1rad)" are returned as-is.
  5509. result = jQuery.css( tween.elem, tween.prop, "" );
  5510. // Empty strings, null, undefined and "auto" are converted to 0.
  5511. return !result || result === "auto" ? 0 : result;
  5512. },
  5513. set: function( tween ) {
  5514. // Use step hook for back compat.
  5515. // Use cssHook if its there.
  5516. // Use .style if available and use plain properties where available.
  5517. if ( jQuery.fx.step[ tween.prop ] ) {
  5518. jQuery.fx.step[ tween.prop ]( tween );
  5519. } else if ( tween.elem.nodeType === 1 &&
  5520. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  5521. jQuery.cssHooks[ tween.prop ] ) ) {
  5522. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  5523. } else {
  5524. tween.elem[ tween.prop ] = tween.now;
  5525. }
  5526. }
  5527. }
  5528. };
  5529. // Support: IE <=9 only
  5530. // Panic based approach to setting things on disconnected nodes
  5531. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  5532. set: function( tween ) {
  5533. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  5534. tween.elem[ tween.prop ] = tween.now;
  5535. }
  5536. }
  5537. };
  5538. jQuery.easing = {
  5539. linear: function( p ) {
  5540. return p;
  5541. },
  5542. swing: function( p ) {
  5543. return 0.5 - Math.cos( p * Math.PI ) / 2;
  5544. },
  5545. _default: "swing"
  5546. };
  5547. jQuery.fx = Tween.prototype.init;
  5548. // Back compat <1.8 extension point
  5549. jQuery.fx.step = {};
  5550. var
  5551. fxNow, inProgress,
  5552. rfxtypes = /^(?:toggle|show|hide)$/,
  5553. rrun = /queueHooks$/;
  5554. function schedule() {
  5555. if ( inProgress ) {
  5556. if ( document.hidden === false && window.requestAnimationFrame ) {
  5557. window.requestAnimationFrame( schedule );
  5558. } else {
  5559. window.setTimeout( schedule, jQuery.fx.interval );
  5560. }
  5561. jQuery.fx.tick();
  5562. }
  5563. }
  5564. // Animations created synchronously will run synchronously
  5565. function createFxNow() {
  5566. window.setTimeout( function() {
  5567. fxNow = undefined;
  5568. } );
  5569. return ( fxNow = Date.now() );
  5570. }
  5571. // Generate parameters to create a standard animation
  5572. function genFx( type, includeWidth ) {
  5573. var which,
  5574. i = 0,
  5575. attrs = { height: type };
  5576. // If we include width, step value is 1 to do all cssExpand values,
  5577. // otherwise step value is 2 to skip over Left and Right
  5578. includeWidth = includeWidth ? 1 : 0;
  5579. for ( ; i < 4; i += 2 - includeWidth ) {
  5580. which = cssExpand[ i ];
  5581. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  5582. }
  5583. if ( includeWidth ) {
  5584. attrs.opacity = attrs.width = type;
  5585. }
  5586. return attrs;
  5587. }
  5588. function createTween( value, prop, animation ) {
  5589. var tween,
  5590. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  5591. index = 0,
  5592. length = collection.length;
  5593. for ( ; index < length; index++ ) {
  5594. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  5595. // We're done with this property
  5596. return tween;
  5597. }
  5598. }
  5599. }
  5600. function defaultPrefilter( elem, props, opts ) {
  5601. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  5602. isBox = "width" in props || "height" in props,
  5603. anim = this,
  5604. orig = {},
  5605. style = elem.style,
  5606. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  5607. dataShow = dataPriv.get( elem, "fxshow" );
  5608. // Queue-skipping animations hijack the fx hooks
  5609. if ( !opts.queue ) {
  5610. hooks = jQuery._queueHooks( elem, "fx" );
  5611. if ( hooks.unqueued == null ) {
  5612. hooks.unqueued = 0;
  5613. oldfire = hooks.empty.fire;
  5614. hooks.empty.fire = function() {
  5615. if ( !hooks.unqueued ) {
  5616. oldfire();
  5617. }
  5618. };
  5619. }
  5620. hooks.unqueued++;
  5621. anim.always( function() {
  5622. // Ensure the complete handler is called before this completes
  5623. anim.always( function() {
  5624. hooks.unqueued--;
  5625. if ( !jQuery.queue( elem, "fx" ).length ) {
  5626. hooks.empty.fire();
  5627. }
  5628. } );
  5629. } );
  5630. }
  5631. // Detect show/hide animations
  5632. for ( prop in props ) {
  5633. value = props[ prop ];
  5634. if ( rfxtypes.test( value ) ) {
  5635. delete props[ prop ];
  5636. toggle = toggle || value === "toggle";
  5637. if ( value === ( hidden ? "hide" : "show" ) ) {
  5638. // Pretend to be hidden if this is a "show" and
  5639. // there is still data from a stopped show/hide
  5640. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  5641. hidden = true;
  5642. // Ignore all other no-op show/hide data
  5643. } else {
  5644. continue;
  5645. }
  5646. }
  5647. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  5648. }
  5649. }
  5650. // Bail out if this is a no-op like .hide().hide()
  5651. propTween = !jQuery.isEmptyObject( props );
  5652. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  5653. return;
  5654. }
  5655. // Restrict "overflow" and "display" styles during box animations
  5656. if ( isBox && elem.nodeType === 1 ) {
  5657. // Support: IE <=9 - 11, Edge 12 - 15
  5658. // Record all 3 overflow attributes because IE does not infer the shorthand
  5659. // from identically-valued overflowX and overflowY and Edge just mirrors
  5660. // the overflowX value there.
  5661. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  5662. // Identify a display type, preferring old show/hide data over the CSS cascade
  5663. restoreDisplay = dataShow && dataShow.display;
  5664. if ( restoreDisplay == null ) {
  5665. restoreDisplay = dataPriv.get( elem, "display" );
  5666. }
  5667. display = jQuery.css( elem, "display" );
  5668. if ( display === "none" ) {
  5669. if ( restoreDisplay ) {
  5670. display = restoreDisplay;
  5671. } else {
  5672. // Get nonempty value(s) by temporarily forcing visibility
  5673. showHide( [ elem ], true );
  5674. restoreDisplay = elem.style.display || restoreDisplay;
  5675. display = jQuery.css( elem, "display" );
  5676. showHide( [ elem ] );
  5677. }
  5678. }
  5679. // Animate inline elements as inline-block
  5680. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  5681. if ( jQuery.css( elem, "float" ) === "none" ) {
  5682. // Restore the original display value at the end of pure show/hide animations
  5683. if ( !propTween ) {
  5684. anim.done( function() {
  5685. style.display = restoreDisplay;
  5686. } );
  5687. if ( restoreDisplay == null ) {
  5688. display = style.display;
  5689. restoreDisplay = display === "none" ? "" : display;
  5690. }
  5691. }
  5692. style.display = "inline-block";
  5693. }
  5694. }
  5695. }
  5696. if ( opts.overflow ) {
  5697. style.overflow = "hidden";
  5698. anim.always( function() {
  5699. style.overflow = opts.overflow[ 0 ];
  5700. style.overflowX = opts.overflow[ 1 ];
  5701. style.overflowY = opts.overflow[ 2 ];
  5702. } );
  5703. }
  5704. // Implement show/hide animations
  5705. propTween = false;
  5706. for ( prop in orig ) {
  5707. // General show/hide setup for this element animation
  5708. if ( !propTween ) {
  5709. if ( dataShow ) {
  5710. if ( "hidden" in dataShow ) {
  5711. hidden = dataShow.hidden;
  5712. }
  5713. } else {
  5714. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  5715. }
  5716. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  5717. if ( toggle ) {
  5718. dataShow.hidden = !hidden;
  5719. }
  5720. // Show elements before animating them
  5721. if ( hidden ) {
  5722. showHide( [ elem ], true );
  5723. }
  5724. /* eslint-disable no-loop-func */
  5725. anim.done( function() {
  5726. /* eslint-enable no-loop-func */
  5727. // The final step of a "hide" animation is actually hiding the element
  5728. if ( !hidden ) {
  5729. showHide( [ elem ] );
  5730. }
  5731. dataPriv.remove( elem, "fxshow" );
  5732. for ( prop in orig ) {
  5733. jQuery.style( elem, prop, orig[ prop ] );
  5734. }
  5735. } );
  5736. }
  5737. // Per-property setup
  5738. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  5739. if ( !( prop in dataShow ) ) {
  5740. dataShow[ prop ] = propTween.start;
  5741. if ( hidden ) {
  5742. propTween.end = propTween.start;
  5743. propTween.start = 0;
  5744. }
  5745. }
  5746. }
  5747. }
  5748. function propFilter( props, specialEasing ) {
  5749. var index, name, easing, value, hooks;
  5750. // camelCase, specialEasing and expand cssHook pass
  5751. for ( index in props ) {
  5752. name = camelCase( index );
  5753. easing = specialEasing[ name ];
  5754. value = props[ index ];
  5755. if ( Array.isArray( value ) ) {
  5756. easing = value[ 1 ];
  5757. value = props[ index ] = value[ 0 ];
  5758. }
  5759. if ( index !== name ) {
  5760. props[ name ] = value;
  5761. delete props[ index ];
  5762. }
  5763. hooks = jQuery.cssHooks[ name ];
  5764. if ( hooks && "expand" in hooks ) {
  5765. value = hooks.expand( value );
  5766. delete props[ name ];
  5767. // Not quite $.extend, this won't overwrite existing keys.
  5768. // Reusing 'index' because we have the correct "name"
  5769. for ( index in value ) {
  5770. if ( !( index in props ) ) {
  5771. props[ index ] = value[ index ];
  5772. specialEasing[ index ] = easing;
  5773. }
  5774. }
  5775. } else {
  5776. specialEasing[ name ] = easing;
  5777. }
  5778. }
  5779. }
  5780. function Animation( elem, properties, options ) {
  5781. var result,
  5782. stopped,
  5783. index = 0,
  5784. length = Animation.prefilters.length,
  5785. deferred = jQuery.Deferred().always( function() {
  5786. // Don't match elem in the :animated selector
  5787. delete tick.elem;
  5788. } ),
  5789. tick = function() {
  5790. if ( stopped ) {
  5791. return false;
  5792. }
  5793. var currentTime = fxNow || createFxNow(),
  5794. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  5795. // Support: Android 2.3 only
  5796. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  5797. temp = remaining / animation.duration || 0,
  5798. percent = 1 - temp,
  5799. index = 0,
  5800. length = animation.tweens.length;
  5801. for ( ; index < length; index++ ) {
  5802. animation.tweens[ index ].run( percent );
  5803. }
  5804. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  5805. // If there's more to do, yield
  5806. if ( percent < 1 && length ) {
  5807. return remaining;
  5808. }
  5809. // If this was an empty animation, synthesize a final progress notification
  5810. if ( !length ) {
  5811. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  5812. }
  5813. // Resolve the animation and report its conclusion
  5814. deferred.resolveWith( elem, [ animation ] );
  5815. return false;
  5816. },
  5817. animation = deferred.promise( {
  5818. elem: elem,
  5819. props: jQuery.extend( {}, properties ),
  5820. opts: jQuery.extend( true, {
  5821. specialEasing: {},
  5822. easing: jQuery.easing._default
  5823. }, options ),
  5824. originalProperties: properties,
  5825. originalOptions: options,
  5826. startTime: fxNow || createFxNow(),
  5827. duration: options.duration,
  5828. tweens: [],
  5829. createTween: function( prop, end ) {
  5830. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  5831. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  5832. animation.tweens.push( tween );
  5833. return tween;
  5834. },
  5835. stop: function( gotoEnd ) {
  5836. var index = 0,
  5837. // If we are going to the end, we want to run all the tweens
  5838. // otherwise we skip this part
  5839. length = gotoEnd ? animation.tweens.length : 0;
  5840. if ( stopped ) {
  5841. return this;
  5842. }
  5843. stopped = true;
  5844. for ( ; index < length; index++ ) {
  5845. animation.tweens[ index ].run( 1 );
  5846. }
  5847. // Resolve when we played the last frame; otherwise, reject
  5848. if ( gotoEnd ) {
  5849. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  5850. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  5851. } else {
  5852. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  5853. }
  5854. return this;
  5855. }
  5856. } ),
  5857. props = animation.props;
  5858. propFilter( props, animation.opts.specialEasing );
  5859. for ( ; index < length; index++ ) {
  5860. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  5861. if ( result ) {
  5862. if ( isFunction( result.stop ) ) {
  5863. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  5864. result.stop.bind( result );
  5865. }
  5866. return result;
  5867. }
  5868. }
  5869. jQuery.map( props, createTween, animation );
  5870. if ( isFunction( animation.opts.start ) ) {
  5871. animation.opts.start.call( elem, animation );
  5872. }
  5873. // Attach callbacks from options
  5874. animation
  5875. .progress( animation.opts.progress )
  5876. .done( animation.opts.done, animation.opts.complete )
  5877. .fail( animation.opts.fail )
  5878. .always( animation.opts.always );
  5879. jQuery.fx.timer(
  5880. jQuery.extend( tick, {
  5881. elem: elem,
  5882. anim: animation,
  5883. queue: animation.opts.queue
  5884. } )
  5885. );
  5886. return animation;
  5887. }
  5888. jQuery.Animation = jQuery.extend( Animation, {
  5889. tweeners: {
  5890. "*": [ function( prop, value ) {
  5891. var tween = this.createTween( prop, value );
  5892. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  5893. return tween;
  5894. } ]
  5895. },
  5896. tweener: function( props, callback ) {
  5897. if ( isFunction( props ) ) {
  5898. callback = props;
  5899. props = [ "*" ];
  5900. } else {
  5901. props = props.match( rnothtmlwhite );
  5902. }
  5903. var prop,
  5904. index = 0,
  5905. length = props.length;
  5906. for ( ; index < length; index++ ) {
  5907. prop = props[ index ];
  5908. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  5909. Animation.tweeners[ prop ].unshift( callback );
  5910. }
  5911. },
  5912. prefilters: [ defaultPrefilter ],
  5913. prefilter: function( callback, prepend ) {
  5914. if ( prepend ) {
  5915. Animation.prefilters.unshift( callback );
  5916. } else {
  5917. Animation.prefilters.push( callback );
  5918. }
  5919. }
  5920. } );
  5921. jQuery.speed = function( speed, easing, fn ) {
  5922. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  5923. complete: fn || !fn && easing ||
  5924. isFunction( speed ) && speed,
  5925. duration: speed,
  5926. easing: fn && easing || easing && !isFunction( easing ) && easing
  5927. };
  5928. // Go to the end state if fx are off
  5929. if ( jQuery.fx.off ) {
  5930. opt.duration = 0;
  5931. } else {
  5932. if ( typeof opt.duration !== "number" ) {
  5933. if ( opt.duration in jQuery.fx.speeds ) {
  5934. opt.duration = jQuery.fx.speeds[ opt.duration ];
  5935. } else {
  5936. opt.duration = jQuery.fx.speeds._default;
  5937. }
  5938. }
  5939. }
  5940. // Normalize opt.queue - true/undefined/null -> "fx"
  5941. if ( opt.queue == null || opt.queue === true ) {
  5942. opt.queue = "fx";
  5943. }
  5944. // Queueing
  5945. opt.old = opt.complete;
  5946. opt.complete = function() {
  5947. if ( isFunction( opt.old ) ) {
  5948. opt.old.call( this );
  5949. }
  5950. if ( opt.queue ) {
  5951. jQuery.dequeue( this, opt.queue );
  5952. }
  5953. };
  5954. return opt;
  5955. };
  5956. jQuery.fn.extend( {
  5957. fadeTo: function( speed, to, easing, callback ) {
  5958. // Show any hidden elements after setting opacity to 0
  5959. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  5960. // Animate to the value specified
  5961. .end().animate( { opacity: to }, speed, easing, callback );
  5962. },
  5963. animate: function( prop, speed, easing, callback ) {
  5964. var empty = jQuery.isEmptyObject( prop ),
  5965. optall = jQuery.speed( speed, easing, callback ),
  5966. doAnimation = function() {
  5967. // Operate on a copy of prop so per-property easing won't be lost
  5968. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  5969. // Empty animations, or finishing resolves immediately
  5970. if ( empty || dataPriv.get( this, "finish" ) ) {
  5971. anim.stop( true );
  5972. }
  5973. };
  5974. doAnimation.finish = doAnimation;
  5975. return empty || optall.queue === false ?
  5976. this.each( doAnimation ) :
  5977. this.queue( optall.queue, doAnimation );
  5978. },
  5979. stop: function( type, clearQueue, gotoEnd ) {
  5980. var stopQueue = function( hooks ) {
  5981. var stop = hooks.stop;
  5982. delete hooks.stop;
  5983. stop( gotoEnd );
  5984. };
  5985. if ( typeof type !== "string" ) {
  5986. gotoEnd = clearQueue;
  5987. clearQueue = type;
  5988. type = undefined;
  5989. }
  5990. if ( clearQueue && type !== false ) {
  5991. this.queue( type || "fx", [] );
  5992. }
  5993. return this.each( function() {
  5994. var dequeue = true,
  5995. index = type != null && type + "queueHooks",
  5996. timers = jQuery.timers,
  5997. data = dataPriv.get( this );
  5998. if ( index ) {
  5999. if ( data[ index ] && data[ index ].stop ) {
  6000. stopQueue( data[ index ] );
  6001. }
  6002. } else {
  6003. for ( index in data ) {
  6004. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  6005. stopQueue( data[ index ] );
  6006. }
  6007. }
  6008. }
  6009. for ( index = timers.length; index--; ) {
  6010. if ( timers[ index ].elem === this &&
  6011. ( type == null || timers[ index ].queue === type ) ) {
  6012. timers[ index ].anim.stop( gotoEnd );
  6013. dequeue = false;
  6014. timers.splice( index, 1 );
  6015. }
  6016. }
  6017. // Start the next in the queue if the last step wasn't forced.
  6018. // Timers currently will call their complete callbacks, which
  6019. // will dequeue but only if they were gotoEnd.
  6020. if ( dequeue || !gotoEnd ) {
  6021. jQuery.dequeue( this, type );
  6022. }
  6023. } );
  6024. },
  6025. finish: function( type ) {
  6026. if ( type !== false ) {
  6027. type = type || "fx";
  6028. }
  6029. return this.each( function() {
  6030. var index,
  6031. data = dataPriv.get( this ),
  6032. queue = data[ type + "queue" ],
  6033. hooks = data[ type + "queueHooks" ],
  6034. timers = jQuery.timers,
  6035. length = queue ? queue.length : 0;
  6036. // Enable finishing flag on private data
  6037. data.finish = true;
  6038. // Empty the queue first
  6039. jQuery.queue( this, type, [] );
  6040. if ( hooks && hooks.stop ) {
  6041. hooks.stop.call( this, true );
  6042. }
  6043. // Look for any active animations, and finish them
  6044. for ( index = timers.length; index--; ) {
  6045. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  6046. timers[ index ].anim.stop( true );
  6047. timers.splice( index, 1 );
  6048. }
  6049. }
  6050. // Look for any animations in the old queue and finish them
  6051. for ( index = 0; index < length; index++ ) {
  6052. if ( queue[ index ] && queue[ index ].finish ) {
  6053. queue[ index ].finish.call( this );
  6054. }
  6055. }
  6056. // Turn off finishing flag
  6057. delete data.finish;
  6058. } );
  6059. }
  6060. } );
  6061. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  6062. var cssFn = jQuery.fn[ name ];
  6063. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6064. return speed == null || typeof speed === "boolean" ?
  6065. cssFn.apply( this, arguments ) :
  6066. this.animate( genFx( name, true ), speed, easing, callback );
  6067. };
  6068. } );
  6069. // Generate shortcuts for custom animations
  6070. jQuery.each( {
  6071. slideDown: genFx( "show" ),
  6072. slideUp: genFx( "hide" ),
  6073. slideToggle: genFx( "toggle" ),
  6074. fadeIn: { opacity: "show" },
  6075. fadeOut: { opacity: "hide" },
  6076. fadeToggle: { opacity: "toggle" }
  6077. }, function( name, props ) {
  6078. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6079. return this.animate( props, speed, easing, callback );
  6080. };
  6081. } );
  6082. jQuery.timers = [];
  6083. jQuery.fx.tick = function() {
  6084. var timer,
  6085. i = 0,
  6086. timers = jQuery.timers;
  6087. fxNow = Date.now();
  6088. for ( ; i < timers.length; i++ ) {
  6089. timer = timers[ i ];
  6090. // Run the timer and safely remove it when done (allowing for external removal)
  6091. if ( !timer() && timers[ i ] === timer ) {
  6092. timers.splice( i--, 1 );
  6093. }
  6094. }
  6095. if ( !timers.length ) {
  6096. jQuery.fx.stop();
  6097. }
  6098. fxNow = undefined;
  6099. };
  6100. jQuery.fx.timer = function( timer ) {
  6101. jQuery.timers.push( timer );
  6102. jQuery.fx.start();
  6103. };
  6104. jQuery.fx.interval = 13;
  6105. jQuery.fx.start = function() {
  6106. if ( inProgress ) {
  6107. return;
  6108. }
  6109. inProgress = true;
  6110. schedule();
  6111. };
  6112. jQuery.fx.stop = function() {
  6113. inProgress = null;
  6114. };
  6115. jQuery.fx.speeds = {
  6116. slow: 600,
  6117. fast: 200,
  6118. // Default speed
  6119. _default: 400
  6120. };
  6121. // Based off of the plugin by Clint Helfers, with permission.
  6122. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  6123. jQuery.fn.delay = function( time, type ) {
  6124. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  6125. type = type || "fx";
  6126. return this.queue( type, function( next, hooks ) {
  6127. var timeout = window.setTimeout( next, time );
  6128. hooks.stop = function() {
  6129. window.clearTimeout( timeout );
  6130. };
  6131. } );
  6132. };
  6133. ( function() {
  6134. var input = document.createElement( "input" ),
  6135. select = document.createElement( "select" ),
  6136. opt = select.appendChild( document.createElement( "option" ) );
  6137. input.type = "checkbox";
  6138. // Support: Android <=4.3 only
  6139. // Default value for a checkbox should be "on"
  6140. support.checkOn = input.value !== "";
  6141. // Support: IE <=11 only
  6142. // Must access selectedIndex to make default options select
  6143. support.optSelected = opt.selected;
  6144. // Support: IE <=11 only
  6145. // An input loses its value after becoming a radio
  6146. input = document.createElement( "input" );
  6147. input.value = "t";
  6148. input.type = "radio";
  6149. support.radioValue = input.value === "t";
  6150. } )();
  6151. var boolHook,
  6152. attrHandle = jQuery.expr.attrHandle;
  6153. jQuery.fn.extend( {
  6154. attr: function( name, value ) {
  6155. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  6156. },
  6157. removeAttr: function( name ) {
  6158. return this.each( function() {
  6159. jQuery.removeAttr( this, name );
  6160. } );
  6161. }
  6162. } );
  6163. jQuery.extend( {
  6164. attr: function( elem, name, value ) {
  6165. var ret, hooks,
  6166. nType = elem.nodeType;
  6167. // Don't get/set attributes on text, comment and attribute nodes
  6168. if ( nType === 3 || nType === 8 || nType === 2 ) {
  6169. return;
  6170. }
  6171. // Fallback to prop when attributes are not supported
  6172. if ( typeof elem.getAttribute === "undefined" ) {
  6173. return jQuery.prop( elem, name, value );
  6174. }
  6175. // Attribute hooks are determined by the lowercase version
  6176. // Grab necessary hook if one is defined
  6177. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  6178. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  6179. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  6180. }
  6181. if ( value !== undefined ) {
  6182. if ( value === null ) {
  6183. jQuery.removeAttr( elem, name );
  6184. return;
  6185. }
  6186. if ( hooks && "set" in hooks &&
  6187. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  6188. return ret;
  6189. }
  6190. elem.setAttribute( name, value + "" );
  6191. return value;
  6192. }
  6193. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  6194. return ret;
  6195. }
  6196. ret = jQuery.find.attr( elem, name );
  6197. // Non-existent attributes return null, we normalize to undefined
  6198. return ret == null ? undefined : ret;
  6199. },
  6200. attrHooks: {
  6201. type: {
  6202. set: function( elem, value ) {
  6203. if ( !support.radioValue && value === "radio" &&
  6204. nodeName( elem, "input" ) ) {
  6205. var val = elem.value;
  6206. elem.setAttribute( "type", value );
  6207. if ( val ) {
  6208. elem.value = val;
  6209. }
  6210. return value;
  6211. }
  6212. }
  6213. }
  6214. },
  6215. removeAttr: function( elem, value ) {
  6216. var name,
  6217. i = 0,
  6218. // Attribute names can contain non-HTML whitespace characters
  6219. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  6220. attrNames = value && value.match( rnothtmlwhite );
  6221. if ( attrNames && elem.nodeType === 1 ) {
  6222. while ( ( name = attrNames[ i++ ] ) ) {
  6223. elem.removeAttribute( name );
  6224. }
  6225. }
  6226. }
  6227. } );
  6228. // Hooks for boolean attributes
  6229. boolHook = {
  6230. set: function( elem, value, name ) {
  6231. if ( value === false ) {
  6232. // Remove boolean attributes when set to false
  6233. jQuery.removeAttr( elem, name );
  6234. } else {
  6235. elem.setAttribute( name, name );
  6236. }
  6237. return name;
  6238. }
  6239. };
  6240. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  6241. var getter = attrHandle[ name ] || jQuery.find.attr;
  6242. attrHandle[ name ] = function( elem, name, isXML ) {
  6243. var ret, handle,
  6244. lowercaseName = name.toLowerCase();
  6245. if ( !isXML ) {
  6246. // Avoid an infinite loop by temporarily removing this function from the getter
  6247. handle = attrHandle[ lowercaseName ];
  6248. attrHandle[ lowercaseName ] = ret;
  6249. ret = getter( elem, name, isXML ) != null ?
  6250. lowercaseName :
  6251. null;
  6252. attrHandle[ lowercaseName ] = handle;
  6253. }
  6254. return ret;
  6255. };
  6256. } );
  6257. var rfocusable = /^(?:input|select|textarea|button)$/i,
  6258. rclickable = /^(?:a|area)$/i;
  6259. jQuery.fn.extend( {
  6260. prop: function( name, value ) {
  6261. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  6262. },
  6263. removeProp: function( name ) {
  6264. return this.each( function() {
  6265. delete this[ jQuery.propFix[ name ] || name ];
  6266. } );
  6267. }
  6268. } );
  6269. jQuery.extend( {
  6270. prop: function( elem, name, value ) {
  6271. var ret, hooks,
  6272. nType = elem.nodeType;
  6273. // Don't get/set properties on text, comment and attribute nodes
  6274. if ( nType === 3 || nType === 8 || nType === 2 ) {
  6275. return;
  6276. }
  6277. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  6278. // Fix name and attach hooks
  6279. name = jQuery.propFix[ name ] || name;
  6280. hooks = jQuery.propHooks[ name ];
  6281. }
  6282. if ( value !== undefined ) {
  6283. if ( hooks && "set" in hooks &&
  6284. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  6285. return ret;
  6286. }
  6287. return ( elem[ name ] = value );
  6288. }
  6289. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  6290. return ret;
  6291. }
  6292. return elem[ name ];
  6293. },
  6294. propHooks: {
  6295. tabIndex: {
  6296. get: function( elem ) {
  6297. // Support: IE <=9 - 11 only
  6298. // elem.tabIndex doesn't always return the
  6299. // correct value when it hasn't been explicitly set
  6300. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  6301. // Use proper attribute retrieval(#12072)
  6302. var tabindex = jQuery.find.attr( elem, "tabindex" );
  6303. if ( tabindex ) {
  6304. return parseInt( tabindex, 10 );
  6305. }
  6306. if (
  6307. rfocusable.test( elem.nodeName ) ||
  6308. rclickable.test( elem.nodeName ) &&
  6309. elem.href
  6310. ) {
  6311. return 0;
  6312. }
  6313. return -1;
  6314. }
  6315. }
  6316. },
  6317. propFix: {
  6318. "for": "htmlFor",
  6319. "class": "className"
  6320. }
  6321. } );
  6322. // Support: IE <=11 only
  6323. // Accessing the selectedIndex property
  6324. // forces the browser to respect setting selected
  6325. // on the option
  6326. // The getter ensures a default option is selected
  6327. // when in an optgroup
  6328. // eslint rule "no-unused-expressions" is disabled for this code
  6329. // since it considers such accessions noop
  6330. if ( !support.optSelected ) {
  6331. jQuery.propHooks.selected = {
  6332. get: function( elem ) {
  6333. /* eslint no-unused-expressions: "off" */
  6334. var parent = elem.parentNode;
  6335. if ( parent && parent.parentNode ) {
  6336. parent.parentNode.selectedIndex;
  6337. }
  6338. return null;
  6339. },
  6340. set: function( elem ) {
  6341. /* eslint no-unused-expressions: "off" */
  6342. var parent = elem.parentNode;
  6343. if ( parent ) {
  6344. parent.selectedIndex;
  6345. if ( parent.parentNode ) {
  6346. parent.parentNode.selectedIndex;
  6347. }
  6348. }
  6349. }
  6350. };
  6351. }
  6352. jQuery.each( [
  6353. "tabIndex",
  6354. "readOnly",
  6355. "maxLength",
  6356. "cellSpacing",
  6357. "cellPadding",
  6358. "rowSpan",
  6359. "colSpan",
  6360. "useMap",
  6361. "frameBorder",
  6362. "contentEditable"
  6363. ], function() {
  6364. jQuery.propFix[ this.toLowerCase() ] = this;
  6365. } );
  6366. // Strip and collapse whitespace according to HTML spec
  6367. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  6368. function stripAndCollapse( value ) {
  6369. var tokens = value.match( rnothtmlwhite ) || [];
  6370. return tokens.join( " " );
  6371. }
  6372. function getClass( elem ) {
  6373. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  6374. }
  6375. function classesToArray( value ) {
  6376. if ( Array.isArray( value ) ) {
  6377. return value;
  6378. }
  6379. if ( typeof value === "string" ) {
  6380. return value.match( rnothtmlwhite ) || [];
  6381. }
  6382. return [];
  6383. }
  6384. jQuery.fn.extend( {
  6385. addClass: function( value ) {
  6386. var classes, elem, cur, curValue, clazz, j, finalValue,
  6387. i = 0;
  6388. if ( isFunction( value ) ) {
  6389. return this.each( function( j ) {
  6390. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  6391. } );
  6392. }
  6393. classes = classesToArray( value );
  6394. if ( classes.length ) {
  6395. while ( ( elem = this[ i++ ] ) ) {
  6396. curValue = getClass( elem );
  6397. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  6398. if ( cur ) {
  6399. j = 0;
  6400. while ( ( clazz = classes[ j++ ] ) ) {
  6401. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  6402. cur += clazz + " ";
  6403. }
  6404. }
  6405. // Only assign if different to avoid unneeded rendering.
  6406. finalValue = stripAndCollapse( cur );
  6407. if ( curValue !== finalValue ) {
  6408. elem.setAttribute( "class", finalValue );
  6409. }
  6410. }
  6411. }
  6412. }
  6413. return this;
  6414. },
  6415. removeClass: function( value ) {
  6416. var classes, elem, cur, curValue, clazz, j, finalValue,
  6417. i = 0;
  6418. if ( isFunction( value ) ) {
  6419. return this.each( function( j ) {
  6420. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  6421. } );
  6422. }
  6423. if ( !arguments.length ) {
  6424. return this.attr( "class", "" );
  6425. }
  6426. classes = classesToArray( value );
  6427. if ( classes.length ) {
  6428. while ( ( elem = this[ i++ ] ) ) {
  6429. curValue = getClass( elem );
  6430. // This expression is here for better compressibility (see addClass)
  6431. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  6432. if ( cur ) {
  6433. j = 0;
  6434. while ( ( clazz = classes[ j++ ] ) ) {
  6435. // Remove *all* instances
  6436. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  6437. cur = cur.replace( " " + clazz + " ", " " );
  6438. }
  6439. }
  6440. // Only assign if different to avoid unneeded rendering.
  6441. finalValue = stripAndCollapse( cur );
  6442. if ( curValue !== finalValue ) {
  6443. elem.setAttribute( "class", finalValue );
  6444. }
  6445. }
  6446. }
  6447. }
  6448. return this;
  6449. },
  6450. toggleClass: function( value, stateVal ) {
  6451. var type = typeof value,
  6452. isValidValue = type === "string" || Array.isArray( value );
  6453. if ( typeof stateVal === "boolean" && isValidValue ) {
  6454. return stateVal ? this.addClass( value ) : this.removeClass( value );
  6455. }
  6456. if ( isFunction( value ) ) {
  6457. return this.each( function( i ) {
  6458. jQuery( this ).toggleClass(
  6459. value.call( this, i, getClass( this ), stateVal ),
  6460. stateVal
  6461. );
  6462. } );
  6463. }
  6464. return this.each( function() {
  6465. var className, i, self, classNames;
  6466. if ( isValidValue ) {
  6467. // Toggle individual class names
  6468. i = 0;
  6469. self = jQuery( this );
  6470. classNames = classesToArray( value );
  6471. while ( ( className = classNames[ i++ ] ) ) {
  6472. // Check each className given, space separated list
  6473. if ( self.hasClass( className ) ) {
  6474. self.removeClass( className );
  6475. } else {
  6476. self.addClass( className );
  6477. }
  6478. }
  6479. // Toggle whole class name
  6480. } else if ( value === undefined || type === "boolean" ) {
  6481. className = getClass( this );
  6482. if ( className ) {
  6483. // Store className if set
  6484. dataPriv.set( this, "__className__", className );
  6485. }
  6486. // If the element has a class name or if we're passed `false`,
  6487. // then remove the whole classname (if there was one, the above saved it).
  6488. // Otherwise bring back whatever was previously saved (if anything),
  6489. // falling back to the empty string if nothing was stored.
  6490. if ( this.setAttribute ) {
  6491. this.setAttribute( "class",
  6492. className || value === false ?
  6493. "" :
  6494. dataPriv.get( this, "__className__" ) || ""
  6495. );
  6496. }
  6497. }
  6498. } );
  6499. },
  6500. hasClass: function( selector ) {
  6501. var className, elem,
  6502. i = 0;
  6503. className = " " + selector + " ";
  6504. while ( ( elem = this[ i++ ] ) ) {
  6505. if ( elem.nodeType === 1 &&
  6506. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  6507. return true;
  6508. }
  6509. }
  6510. return false;
  6511. }
  6512. } );
  6513. var rreturn = /\r/g;
  6514. jQuery.fn.extend( {
  6515. val: function( value ) {
  6516. var hooks, ret, valueIsFunction,
  6517. elem = this[ 0 ];
  6518. if ( !arguments.length ) {
  6519. if ( elem ) {
  6520. hooks = jQuery.valHooks[ elem.type ] ||
  6521. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  6522. if ( hooks &&
  6523. "get" in hooks &&
  6524. ( ret = hooks.get( elem, "value" ) ) !== undefined
  6525. ) {
  6526. return ret;
  6527. }
  6528. ret = elem.value;
  6529. // Handle most common string cases
  6530. if ( typeof ret === "string" ) {
  6531. return ret.replace( rreturn, "" );
  6532. }
  6533. // Handle cases where value is null/undef or number
  6534. return ret == null ? "" : ret;
  6535. }
  6536. return;
  6537. }
  6538. valueIsFunction = isFunction( value );
  6539. return this.each( function( i ) {
  6540. var val;
  6541. if ( this.nodeType !== 1 ) {
  6542. return;
  6543. }
  6544. if ( valueIsFunction ) {
  6545. val = value.call( this, i, jQuery( this ).val() );
  6546. } else {
  6547. val = value;
  6548. }
  6549. // Treat null/undefined as ""; convert numbers to string
  6550. if ( val == null ) {
  6551. val = "";
  6552. } else if ( typeof val === "number" ) {
  6553. val += "";
  6554. } else if ( Array.isArray( val ) ) {
  6555. val = jQuery.map( val, function( value ) {
  6556. return value == null ? "" : value + "";
  6557. } );
  6558. }
  6559. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  6560. // If set returns undefined, fall back to normal setting
  6561. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  6562. this.value = val;
  6563. }
  6564. } );
  6565. }
  6566. } );
  6567. jQuery.extend( {
  6568. valHooks: {
  6569. option: {
  6570. get: function( elem ) {
  6571. var val = jQuery.find.attr( elem, "value" );
  6572. return val != null ?
  6573. val :
  6574. // Support: IE <=10 - 11 only
  6575. // option.text throws exceptions (#14686, #14858)
  6576. // Strip and collapse whitespace
  6577. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  6578. stripAndCollapse( jQuery.text( elem ) );
  6579. }
  6580. },
  6581. select: {
  6582. get: function( elem ) {
  6583. var value, option, i,
  6584. options = elem.options,
  6585. index = elem.selectedIndex,
  6586. one = elem.type === "select-one",
  6587. values = one ? null : [],
  6588. max = one ? index + 1 : options.length;
  6589. if ( index < 0 ) {
  6590. i = max;
  6591. } else {
  6592. i = one ? index : 0;
  6593. }
  6594. // Loop through all the selected options
  6595. for ( ; i < max; i++ ) {
  6596. option = options[ i ];
  6597. // Support: IE <=9 only
  6598. // IE8-9 doesn't update selected after form reset (#2551)
  6599. if ( ( option.selected || i === index ) &&
  6600. // Don't return options that are disabled or in a disabled optgroup
  6601. !option.disabled &&
  6602. ( !option.parentNode.disabled ||
  6603. !nodeName( option.parentNode, "optgroup" ) ) ) {
  6604. // Get the specific value for the option
  6605. value = jQuery( option ).val();
  6606. // We don't need an array for one selects
  6607. if ( one ) {
  6608. return value;
  6609. }
  6610. // Multi-Selects return an array
  6611. values.push( value );
  6612. }
  6613. }
  6614. return values;
  6615. },
  6616. set: function( elem, value ) {
  6617. var optionSet, option,
  6618. options = elem.options,
  6619. values = jQuery.makeArray( value ),
  6620. i = options.length;
  6621. while ( i-- ) {
  6622. option = options[ i ];
  6623. /* eslint-disable no-cond-assign */
  6624. if ( option.selected =
  6625. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  6626. ) {
  6627. optionSet = true;
  6628. }
  6629. /* eslint-enable no-cond-assign */
  6630. }
  6631. // Force browsers to behave consistently when non-matching value is set
  6632. if ( !optionSet ) {
  6633. elem.selectedIndex = -1;
  6634. }
  6635. return values;
  6636. }
  6637. }
  6638. }
  6639. } );
  6640. // Radios and checkboxes getter/setter
  6641. jQuery.each( [ "radio", "checkbox" ], function() {
  6642. jQuery.valHooks[ this ] = {
  6643. set: function( elem, value ) {
  6644. if ( Array.isArray( value ) ) {
  6645. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  6646. }
  6647. }
  6648. };
  6649. if ( !support.checkOn ) {
  6650. jQuery.valHooks[ this ].get = function( elem ) {
  6651. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  6652. };
  6653. }
  6654. } );
  6655. // Return jQuery for attributes-only inclusion
  6656. support.focusin = "onfocusin" in window;
  6657. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  6658. stopPropagationCallback = function( e ) {
  6659. e.stopPropagation();
  6660. };
  6661. jQuery.extend( jQuery.event, {
  6662. trigger: function( event, data, elem, onlyHandlers ) {
  6663. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  6664. eventPath = [ elem || document ],
  6665. type = hasOwn.call( event, "type" ) ? event.type : event,
  6666. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  6667. cur = lastElement = tmp = elem = elem || document;
  6668. // Don't do events on text and comment nodes
  6669. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  6670. return;
  6671. }
  6672. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  6673. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  6674. return;
  6675. }
  6676. if ( type.indexOf( "." ) > -1 ) {
  6677. // Namespaced trigger; create a regexp to match event type in handle()
  6678. namespaces = type.split( "." );
  6679. type = namespaces.shift();
  6680. namespaces.sort();
  6681. }
  6682. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  6683. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  6684. event = event[ jQuery.expando ] ?
  6685. event :
  6686. new jQuery.Event( type, typeof event === "object" && event );
  6687. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  6688. event.isTrigger = onlyHandlers ? 2 : 3;
  6689. event.namespace = namespaces.join( "." );
  6690. event.rnamespace = event.namespace ?
  6691. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  6692. null;
  6693. // Clean up the event in case it is being reused
  6694. event.result = undefined;
  6695. if ( !event.target ) {
  6696. event.target = elem;
  6697. }
  6698. // Clone any incoming data and prepend the event, creating the handler arg list
  6699. data = data == null ?
  6700. [ event ] :
  6701. jQuery.makeArray( data, [ event ] );
  6702. // Allow special events to draw outside the lines
  6703. special = jQuery.event.special[ type ] || {};
  6704. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  6705. return;
  6706. }
  6707. // Determine event propagation path in advance, per W3C events spec (#9951)
  6708. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  6709. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  6710. bubbleType = special.delegateType || type;
  6711. if ( !rfocusMorph.test( bubbleType + type ) ) {
  6712. cur = cur.parentNode;
  6713. }
  6714. for ( ; cur; cur = cur.parentNode ) {
  6715. eventPath.push( cur );
  6716. tmp = cur;
  6717. }
  6718. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  6719. if ( tmp === ( elem.ownerDocument || document ) ) {
  6720. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  6721. }
  6722. }
  6723. // Fire handlers on the event path
  6724. i = 0;
  6725. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  6726. lastElement = cur;
  6727. event.type = i > 1 ?
  6728. bubbleType :
  6729. special.bindType || type;
  6730. // jQuery handler
  6731. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  6732. dataPriv.get( cur, "handle" );
  6733. if ( handle ) {
  6734. handle.apply( cur, data );
  6735. }
  6736. // Native handler
  6737. handle = ontype && cur[ ontype ];
  6738. if ( handle && handle.apply && acceptData( cur ) ) {
  6739. event.result = handle.apply( cur, data );
  6740. if ( event.result === false ) {
  6741. event.preventDefault();
  6742. }
  6743. }
  6744. }
  6745. event.type = type;
  6746. // If nobody prevented the default action, do it now
  6747. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  6748. if ( ( !special._default ||
  6749. special._default.apply( eventPath.pop(), data ) === false ) &&
  6750. acceptData( elem ) ) {
  6751. // Call a native DOM method on the target with the same name as the event.
  6752. // Don't do default actions on window, that's where global variables be (#6170)
  6753. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  6754. // Don't re-trigger an onFOO event when we call its FOO() method
  6755. tmp = elem[ ontype ];
  6756. if ( tmp ) {
  6757. elem[ ontype ] = null;
  6758. }
  6759. // Prevent re-triggering of the same event, since we already bubbled it above
  6760. jQuery.event.triggered = type;
  6761. if ( event.isPropagationStopped() ) {
  6762. lastElement.addEventListener( type, stopPropagationCallback );
  6763. }
  6764. elem[ type ]();
  6765. if ( event.isPropagationStopped() ) {
  6766. lastElement.removeEventListener( type, stopPropagationCallback );
  6767. }
  6768. jQuery.event.triggered = undefined;
  6769. if ( tmp ) {
  6770. elem[ ontype ] = tmp;
  6771. }
  6772. }
  6773. }
  6774. }
  6775. return event.result;
  6776. },
  6777. // Piggyback on a donor event to simulate a different one
  6778. // Used only for `focus(in | out)` events
  6779. simulate: function( type, elem, event ) {
  6780. var e = jQuery.extend(
  6781. new jQuery.Event(),
  6782. event,
  6783. {
  6784. type: type,
  6785. isSimulated: true
  6786. }
  6787. );
  6788. jQuery.event.trigger( e, null, elem );
  6789. }
  6790. } );
  6791. jQuery.fn.extend( {
  6792. trigger: function( type, data ) {
  6793. return this.each( function() {
  6794. jQuery.event.trigger( type, data, this );
  6795. } );
  6796. },
  6797. triggerHandler: function( type, data ) {
  6798. var elem = this[ 0 ];
  6799. if ( elem ) {
  6800. return jQuery.event.trigger( type, data, elem, true );
  6801. }
  6802. }
  6803. } );
  6804. // Support: Firefox <=44
  6805. // Firefox doesn't have focus(in | out) events
  6806. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  6807. //
  6808. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  6809. // focus(in | out) events fire after focus & blur events,
  6810. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  6811. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  6812. if ( !support.focusin ) {
  6813. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  6814. // Attach a single capturing handler on the document while someone wants focusin/focusout
  6815. var handler = function( event ) {
  6816. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  6817. };
  6818. jQuery.event.special[ fix ] = {
  6819. setup: function() {
  6820. var doc = this.ownerDocument || this,
  6821. attaches = dataPriv.access( doc, fix );
  6822. if ( !attaches ) {
  6823. doc.addEventListener( orig, handler, true );
  6824. }
  6825. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  6826. },
  6827. teardown: function() {
  6828. var doc = this.ownerDocument || this,
  6829. attaches = dataPriv.access( doc, fix ) - 1;
  6830. if ( !attaches ) {
  6831. doc.removeEventListener( orig, handler, true );
  6832. dataPriv.remove( doc, fix );
  6833. } else {
  6834. dataPriv.access( doc, fix, attaches );
  6835. }
  6836. }
  6837. };
  6838. } );
  6839. }
  6840. var location = window.location;
  6841. var nonce = Date.now();
  6842. var rquery = ( /\?/ );
  6843. // Cross-browser xml parsing
  6844. jQuery.parseXML = function( data ) {
  6845. var xml;
  6846. if ( !data || typeof data !== "string" ) {
  6847. return null;
  6848. }
  6849. // Support: IE 9 - 11 only
  6850. // IE throws on parseFromString with invalid input.
  6851. try {
  6852. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  6853. } catch ( e ) {
  6854. xml = undefined;
  6855. }
  6856. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  6857. jQuery.error( "Invalid XML: " + data );
  6858. }
  6859. return xml;
  6860. };
  6861. var
  6862. rbracket = /\[\]$/,
  6863. rCRLF = /\r?\n/g,
  6864. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  6865. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  6866. function buildParams( prefix, obj, traditional, add ) {
  6867. var name;
  6868. if ( Array.isArray( obj ) ) {
  6869. // Serialize array item.
  6870. jQuery.each( obj, function( i, v ) {
  6871. if ( traditional || rbracket.test( prefix ) ) {
  6872. // Treat each array item as a scalar.
  6873. add( prefix, v );
  6874. } else {
  6875. // Item is non-scalar (array or object), encode its numeric index.
  6876. buildParams(
  6877. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  6878. v,
  6879. traditional,
  6880. add
  6881. );
  6882. }
  6883. } );
  6884. } else if ( !traditional && toType( obj ) === "object" ) {
  6885. // Serialize object item.
  6886. for ( name in obj ) {
  6887. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  6888. }
  6889. } else {
  6890. // Serialize scalar item.
  6891. add( prefix, obj );
  6892. }
  6893. }
  6894. // Serialize an array of form elements or a set of
  6895. // key/values into a query string
  6896. jQuery.param = function( a, traditional ) {
  6897. var prefix,
  6898. s = [],
  6899. add = function( key, valueOrFunction ) {
  6900. // If value is a function, invoke it and use its return value
  6901. var value = isFunction( valueOrFunction ) ?
  6902. valueOrFunction() :
  6903. valueOrFunction;
  6904. s[ s.length ] = encodeURIComponent( key ) + "=" +
  6905. encodeURIComponent( value == null ? "" : value );
  6906. };
  6907. // If an array was passed in, assume that it is an array of form elements.
  6908. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  6909. // Serialize the form elements
  6910. jQuery.each( a, function() {
  6911. add( this.name, this.value );
  6912. } );
  6913. } else {
  6914. // If traditional, encode the "old" way (the way 1.3.2 or older
  6915. // did it), otherwise encode params recursively.
  6916. for ( prefix in a ) {
  6917. buildParams( prefix, a[ prefix ], traditional, add );
  6918. }
  6919. }
  6920. // Return the resulting serialization
  6921. return s.join( "&" );
  6922. };
  6923. jQuery.fn.extend( {
  6924. serialize: function() {
  6925. return jQuery.param( this.serializeArray() );
  6926. },
  6927. serializeArray: function() {
  6928. return this.map( function() {
  6929. // Can add propHook for "elements" to filter or add form elements
  6930. var elements = jQuery.prop( this, "elements" );
  6931. return elements ? jQuery.makeArray( elements ) : this;
  6932. } )
  6933. .filter( function() {
  6934. var type = this.type;
  6935. // Use .is( ":disabled" ) so that fieldset[disabled] works
  6936. return this.name && !jQuery( this ).is( ":disabled" ) &&
  6937. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  6938. ( this.checked || !rcheckableType.test( type ) );
  6939. } )
  6940. .map( function( i, elem ) {
  6941. var val = jQuery( this ).val();
  6942. if ( val == null ) {
  6943. return null;
  6944. }
  6945. if ( Array.isArray( val ) ) {
  6946. return jQuery.map( val, function( val ) {
  6947. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  6948. } );
  6949. }
  6950. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  6951. } ).get();
  6952. }
  6953. } );
  6954. var
  6955. r20 = /%20/g,
  6956. rhash = /#.*$/,
  6957. rantiCache = /([?&])_=[^&]*/,
  6958. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  6959. // #7653, #8125, #8152: local protocol detection
  6960. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  6961. rnoContent = /^(?:GET|HEAD)$/,
  6962. rprotocol = /^\/\//,
  6963. /* Prefilters
  6964. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  6965. * 2) These are called:
  6966. * - BEFORE asking for a transport
  6967. * - AFTER param serialization (s.data is a string if s.processData is true)
  6968. * 3) key is the dataType
  6969. * 4) the catchall symbol "*" can be used
  6970. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  6971. */
  6972. prefilters = {},
  6973. /* Transports bindings
  6974. * 1) key is the dataType
  6975. * 2) the catchall symbol "*" can be used
  6976. * 3) selection will start with transport dataType and THEN go to "*" if needed
  6977. */
  6978. transports = {},
  6979. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  6980. allTypes = "*/".concat( "*" ),
  6981. // Anchor tag for parsing the document origin
  6982. originAnchor = document.createElement( "a" );
  6983. originAnchor.href = location.href;
  6984. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  6985. function addToPrefiltersOrTransports( structure ) {
  6986. // dataTypeExpression is optional and defaults to "*"
  6987. return function( dataTypeExpression, func ) {
  6988. if ( typeof dataTypeExpression !== "string" ) {
  6989. func = dataTypeExpression;
  6990. dataTypeExpression = "*";
  6991. }
  6992. var dataType,
  6993. i = 0,
  6994. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  6995. if ( isFunction( func ) ) {
  6996. // For each dataType in the dataTypeExpression
  6997. while ( ( dataType = dataTypes[ i++ ] ) ) {
  6998. // Prepend if requested
  6999. if ( dataType[ 0 ] === "+" ) {
  7000. dataType = dataType.slice( 1 ) || "*";
  7001. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  7002. // Otherwise append
  7003. } else {
  7004. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  7005. }
  7006. }
  7007. }
  7008. };
  7009. }
  7010. // Base inspection function for prefilters and transports
  7011. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  7012. var inspected = {},
  7013. seekingTransport = ( structure === transports );
  7014. function inspect( dataType ) {
  7015. var selected;
  7016. inspected[ dataType ] = true;
  7017. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  7018. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  7019. if ( typeof dataTypeOrTransport === "string" &&
  7020. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  7021. options.dataTypes.unshift( dataTypeOrTransport );
  7022. inspect( dataTypeOrTransport );
  7023. return false;
  7024. } else if ( seekingTransport ) {
  7025. return !( selected = dataTypeOrTransport );
  7026. }
  7027. } );
  7028. return selected;
  7029. }
  7030. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  7031. }
  7032. // A special extend for ajax options
  7033. // that takes "flat" options (not to be deep extended)
  7034. // Fixes #9887
  7035. function ajaxExtend( target, src ) {
  7036. var key, deep,
  7037. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  7038. for ( key in src ) {
  7039. if ( src[ key ] !== undefined ) {
  7040. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  7041. }
  7042. }
  7043. if ( deep ) {
  7044. jQuery.extend( true, target, deep );
  7045. }
  7046. return target;
  7047. }
  7048. /* Handles responses to an ajax request:
  7049. * - finds the right dataType (mediates between content-type and expected dataType)
  7050. * - returns the corresponding response
  7051. */
  7052. function ajaxHandleResponses( s, jqXHR, responses ) {
  7053. var ct, type, finalDataType, firstDataType,
  7054. contents = s.contents,
  7055. dataTypes = s.dataTypes;
  7056. // Remove auto dataType and get content-type in the process
  7057. while ( dataTypes[ 0 ] === "*" ) {
  7058. dataTypes.shift();
  7059. if ( ct === undefined ) {
  7060. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  7061. }
  7062. }
  7063. // Check if we're dealing with a known content-type
  7064. if ( ct ) {
  7065. for ( type in contents ) {
  7066. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  7067. dataTypes.unshift( type );
  7068. break;
  7069. }
  7070. }
  7071. }
  7072. // Check to see if we have a response for the expected dataType
  7073. if ( dataTypes[ 0 ] in responses ) {
  7074. finalDataType = dataTypes[ 0 ];
  7075. } else {
  7076. // Try convertible dataTypes
  7077. for ( type in responses ) {
  7078. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  7079. finalDataType = type;
  7080. break;
  7081. }
  7082. if ( !firstDataType ) {
  7083. firstDataType = type;
  7084. }
  7085. }
  7086. // Or just use first one
  7087. finalDataType = finalDataType || firstDataType;
  7088. }
  7089. // If we found a dataType
  7090. // We add the dataType to the list if needed
  7091. // and return the corresponding response
  7092. if ( finalDataType ) {
  7093. if ( finalDataType !== dataTypes[ 0 ] ) {
  7094. dataTypes.unshift( finalDataType );
  7095. }
  7096. return responses[ finalDataType ];
  7097. }
  7098. }
  7099. /* Chain conversions given the request and the original response
  7100. * Also sets the responseXXX fields on the jqXHR instance
  7101. */
  7102. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  7103. var conv2, current, conv, tmp, prev,
  7104. converters = {},
  7105. // Work with a copy of dataTypes in case we need to modify it for conversion
  7106. dataTypes = s.dataTypes.slice();
  7107. // Create converters map with lowercased keys
  7108. if ( dataTypes[ 1 ] ) {
  7109. for ( conv in s.converters ) {
  7110. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  7111. }
  7112. }
  7113. current = dataTypes.shift();
  7114. // Convert to each sequential dataType
  7115. while ( current ) {
  7116. if ( s.responseFields[ current ] ) {
  7117. jqXHR[ s.responseFields[ current ] ] = response;
  7118. }
  7119. // Apply the dataFilter if provided
  7120. if ( !prev && isSuccess && s.dataFilter ) {
  7121. response = s.dataFilter( response, s.dataType );
  7122. }
  7123. prev = current;
  7124. current = dataTypes.shift();
  7125. if ( current ) {
  7126. // There's only work to do if current dataType is non-auto
  7127. if ( current === "*" ) {
  7128. current = prev;
  7129. // Convert response if prev dataType is non-auto and differs from current
  7130. } else if ( prev !== "*" && prev !== current ) {
  7131. // Seek a direct converter
  7132. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  7133. // If none found, seek a pair
  7134. if ( !conv ) {
  7135. for ( conv2 in converters ) {
  7136. // If conv2 outputs current
  7137. tmp = conv2.split( " " );
  7138. if ( tmp[ 1 ] === current ) {
  7139. // If prev can be converted to accepted input
  7140. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  7141. converters[ "* " + tmp[ 0 ] ];
  7142. if ( conv ) {
  7143. // Condense equivalence converters
  7144. if ( conv === true ) {
  7145. conv = converters[ conv2 ];
  7146. // Otherwise, insert the intermediate dataType
  7147. } else if ( converters[ conv2 ] !== true ) {
  7148. current = tmp[ 0 ];
  7149. dataTypes.unshift( tmp[ 1 ] );
  7150. }
  7151. break;
  7152. }
  7153. }
  7154. }
  7155. }
  7156. // Apply converter (if not an equivalence)
  7157. if ( conv !== true ) {
  7158. // Unless errors are allowed to bubble, catch and return them
  7159. if ( conv && s.throws ) {
  7160. response = conv( response );
  7161. } else {
  7162. try {
  7163. response = conv( response );
  7164. } catch ( e ) {
  7165. return {
  7166. state: "parsererror",
  7167. error: conv ? e : "No conversion from " + prev + " to " + current
  7168. };
  7169. }
  7170. }
  7171. }
  7172. }
  7173. }
  7174. }
  7175. return { state: "success", data: response };
  7176. }
  7177. jQuery.extend( {
  7178. // Counter for holding the number of active queries
  7179. active: 0,
  7180. // Last-Modified header cache for next request
  7181. lastModified: {},
  7182. etag: {},
  7183. ajaxSettings: {
  7184. url: location.href,
  7185. type: "GET",
  7186. isLocal: rlocalProtocol.test( location.protocol ),
  7187. global: true,
  7188. processData: true,
  7189. async: true,
  7190. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  7191. /*
  7192. timeout: 0,
  7193. data: null,
  7194. dataType: null,
  7195. username: null,
  7196. password: null,
  7197. cache: null,
  7198. throws: false,
  7199. traditional: false,
  7200. headers: {},
  7201. */
  7202. accepts: {
  7203. "*": allTypes,
  7204. text: "text/plain",
  7205. html: "text/html",
  7206. xml: "application/xml, text/xml",
  7207. json: "application/json, text/javascript"
  7208. },
  7209. contents: {
  7210. xml: /\bxml\b/,
  7211. html: /\bhtml/,
  7212. json: /\bjson\b/
  7213. },
  7214. responseFields: {
  7215. xml: "responseXML",
  7216. text: "responseText",
  7217. json: "responseJSON"
  7218. },
  7219. // Data converters
  7220. // Keys separate source (or catchall "*") and destination types with a single space
  7221. converters: {
  7222. // Convert anything to text
  7223. "* text": String,
  7224. // Text to html (true = no transformation)
  7225. "text html": true,
  7226. // Evaluate text as a json expression
  7227. "text json": JSON.parse,
  7228. // Parse text as xml
  7229. "text xml": jQuery.parseXML
  7230. },
  7231. // For options that shouldn't be deep extended:
  7232. // you can add your own custom options here if
  7233. // and when you create one that shouldn't be
  7234. // deep extended (see ajaxExtend)
  7235. flatOptions: {
  7236. url: true,
  7237. context: true
  7238. }
  7239. },
  7240. // Creates a full fledged settings object into target
  7241. // with both ajaxSettings and settings fields.
  7242. // If target is omitted, writes into ajaxSettings.
  7243. ajaxSetup: function( target, settings ) {
  7244. return settings ?
  7245. // Building a settings object
  7246. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  7247. // Extending ajaxSettings
  7248. ajaxExtend( jQuery.ajaxSettings, target );
  7249. },
  7250. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  7251. ajaxTransport: addToPrefiltersOrTransports( transports ),
  7252. // Main method
  7253. ajax: function( url, options ) {
  7254. // If url is an object, simulate pre-1.5 signature
  7255. if ( typeof url === "object" ) {
  7256. options = url;
  7257. url = undefined;
  7258. }
  7259. // Force options to be an object
  7260. options = options || {};
  7261. var transport,
  7262. // URL without anti-cache param
  7263. cacheURL,
  7264. // Response headers
  7265. responseHeadersString,
  7266. responseHeaders,
  7267. // timeout handle
  7268. timeoutTimer,
  7269. // Url cleanup var
  7270. urlAnchor,
  7271. // Request state (becomes false upon send and true upon completion)
  7272. completed,
  7273. // To know if global events are to be dispatched
  7274. fireGlobals,
  7275. // Loop variable
  7276. i,
  7277. // uncached part of the url
  7278. uncached,
  7279. // Create the final options object
  7280. s = jQuery.ajaxSetup( {}, options ),
  7281. // Callbacks context
  7282. callbackContext = s.context || s,
  7283. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  7284. globalEventContext = s.context &&
  7285. ( callbackContext.nodeType || callbackContext.jquery ) ?
  7286. jQuery( callbackContext ) :
  7287. jQuery.event,
  7288. // Deferreds
  7289. deferred = jQuery.Deferred(),
  7290. completeDeferred = jQuery.Callbacks( "once memory" ),
  7291. // Status-dependent callbacks
  7292. statusCode = s.statusCode || {},
  7293. // Headers (they are sent all at once)
  7294. requestHeaders = {},
  7295. requestHeadersNames = {},
  7296. // Default abort message
  7297. strAbort = "canceled",
  7298. // Fake xhr
  7299. jqXHR = {
  7300. readyState: 0,
  7301. // Builds headers hashtable if needed
  7302. getResponseHeader: function( key ) {
  7303. var match;
  7304. if ( completed ) {
  7305. if ( !responseHeaders ) {
  7306. responseHeaders = {};
  7307. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  7308. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  7309. }
  7310. }
  7311. match = responseHeaders[ key.toLowerCase() ];
  7312. }
  7313. return match == null ? null : match;
  7314. },
  7315. // Raw string
  7316. getAllResponseHeaders: function() {
  7317. return completed ? responseHeadersString : null;
  7318. },
  7319. // Caches the header
  7320. setRequestHeader: function( name, value ) {
  7321. if ( completed == null ) {
  7322. name = requestHeadersNames[ name.toLowerCase() ] =
  7323. requestHeadersNames[ name.toLowerCase() ] || name;
  7324. requestHeaders[ name ] = value;
  7325. }
  7326. return this;
  7327. },
  7328. // Overrides response content-type header
  7329. overrideMimeType: function( type ) {
  7330. if ( completed == null ) {
  7331. s.mimeType = type;
  7332. }
  7333. return this;
  7334. },
  7335. // Status-dependent callbacks
  7336. statusCode: function( map ) {
  7337. var code;
  7338. if ( map ) {
  7339. if ( completed ) {
  7340. // Execute the appropriate callbacks
  7341. jqXHR.always( map[ jqXHR.status ] );
  7342. } else {
  7343. // Lazy-add the new callbacks in a way that preserves old ones
  7344. for ( code in map ) {
  7345. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  7346. }
  7347. }
  7348. }
  7349. return this;
  7350. },
  7351. // Cancel the request
  7352. abort: function( statusText ) {
  7353. var finalText = statusText || strAbort;
  7354. if ( transport ) {
  7355. transport.abort( finalText );
  7356. }
  7357. done( 0, finalText );
  7358. return this;
  7359. }
  7360. };
  7361. // Attach deferreds
  7362. deferred.promise( jqXHR );
  7363. // Add protocol if not provided (prefilters might expect it)
  7364. // Handle falsy url in the settings object (#10093: consistency with old signature)
  7365. // We also use the url parameter if available
  7366. s.url = ( ( url || s.url || location.href ) + "" )
  7367. .replace( rprotocol, location.protocol + "//" );
  7368. // Alias method option to type as per ticket #12004
  7369. s.type = options.method || options.type || s.method || s.type;
  7370. // Extract dataTypes list
  7371. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  7372. // A cross-domain request is in order when the origin doesn't match the current origin.
  7373. if ( s.crossDomain == null ) {
  7374. urlAnchor = document.createElement( "a" );
  7375. // Support: IE <=8 - 11, Edge 12 - 15
  7376. // IE throws exception on accessing the href property if url is malformed,
  7377. // e.g. http://example.com:80x/
  7378. try {
  7379. urlAnchor.href = s.url;
  7380. // Support: IE <=8 - 11 only
  7381. // Anchor's host property isn't correctly set when s.url is relative
  7382. urlAnchor.href = urlAnchor.href;
  7383. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  7384. urlAnchor.protocol + "//" + urlAnchor.host;
  7385. } catch ( e ) {
  7386. // If there is an error parsing the URL, assume it is crossDomain,
  7387. // it can be rejected by the transport if it is invalid
  7388. s.crossDomain = true;
  7389. }
  7390. }
  7391. // Convert data if not already a string
  7392. if ( s.data && s.processData && typeof s.data !== "string" ) {
  7393. s.data = jQuery.param( s.data, s.traditional );
  7394. }
  7395. // Apply prefilters
  7396. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  7397. // If request was aborted inside a prefilter, stop there
  7398. if ( completed ) {
  7399. return jqXHR;
  7400. }
  7401. // We can fire global events as of now if asked to
  7402. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  7403. fireGlobals = jQuery.event && s.global;
  7404. // Watch for a new set of requests
  7405. if ( fireGlobals && jQuery.active++ === 0 ) {
  7406. jQuery.event.trigger( "ajaxStart" );
  7407. }
  7408. // Uppercase the type
  7409. s.type = s.type.toUpperCase();
  7410. // Determine if request has content
  7411. s.hasContent = !rnoContent.test( s.type );
  7412. // Save the URL in case we're toying with the If-Modified-Since
  7413. // and/or If-None-Match header later on
  7414. // Remove hash to simplify url manipulation
  7415. cacheURL = s.url.replace( rhash, "" );
  7416. // More options handling for requests with no content
  7417. if ( !s.hasContent ) {
  7418. // Remember the hash so we can put it back
  7419. uncached = s.url.slice( cacheURL.length );
  7420. // If data is available and should be processed, append data to url
  7421. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  7422. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  7423. // #9682: remove data so that it's not used in an eventual retry
  7424. delete s.data;
  7425. }
  7426. // Add or update anti-cache param if needed
  7427. if ( s.cache === false ) {
  7428. cacheURL = cacheURL.replace( rantiCache, "$1" );
  7429. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  7430. }
  7431. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  7432. s.url = cacheURL + uncached;
  7433. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  7434. } else if ( s.data && s.processData &&
  7435. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  7436. s.data = s.data.replace( r20, "+" );
  7437. }
  7438. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  7439. if ( s.ifModified ) {
  7440. if ( jQuery.lastModified[ cacheURL ] ) {
  7441. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  7442. }
  7443. if ( jQuery.etag[ cacheURL ] ) {
  7444. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  7445. }
  7446. }
  7447. // Set the correct header, if data is being sent
  7448. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  7449. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  7450. }
  7451. // Set the Accepts header for the server, depending on the dataType
  7452. jqXHR.setRequestHeader(
  7453. "Accept",
  7454. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  7455. s.accepts[ s.dataTypes[ 0 ] ] +
  7456. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  7457. s.accepts[ "*" ]
  7458. );
  7459. // Check for headers option
  7460. for ( i in s.headers ) {
  7461. jqXHR.setRequestHeader( i, s.headers[ i ] );
  7462. }
  7463. // Allow custom headers/mimetypes and early abort
  7464. if ( s.beforeSend &&
  7465. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  7466. // Abort if not done already and return
  7467. return jqXHR.abort();
  7468. }
  7469. // Aborting is no longer a cancellation
  7470. strAbort = "abort";
  7471. // Install callbacks on deferreds
  7472. completeDeferred.add( s.complete );
  7473. jqXHR.done( s.success );
  7474. jqXHR.fail( s.error );
  7475. // Get transport
  7476. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  7477. // If no transport, we auto-abort
  7478. if ( !transport ) {
  7479. done( -1, "No Transport" );
  7480. } else {
  7481. jqXHR.readyState = 1;
  7482. // Send global event
  7483. if ( fireGlobals ) {
  7484. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  7485. }
  7486. // If request was aborted inside ajaxSend, stop there
  7487. if ( completed ) {
  7488. return jqXHR;
  7489. }
  7490. // Timeout
  7491. if ( s.async && s.timeout > 0 ) {
  7492. timeoutTimer = window.setTimeout( function() {
  7493. jqXHR.abort( "timeout" );
  7494. }, s.timeout );
  7495. }
  7496. try {
  7497. completed = false;
  7498. transport.send( requestHeaders, done );
  7499. } catch ( e ) {
  7500. // Rethrow post-completion exceptions
  7501. if ( completed ) {
  7502. throw e;
  7503. }
  7504. // Propagate others as results
  7505. done( -1, e );
  7506. }
  7507. }
  7508. // Callback for when everything is done
  7509. function done( status, nativeStatusText, responses, headers ) {
  7510. var isSuccess, success, error, response, modified,
  7511. statusText = nativeStatusText;
  7512. // Ignore repeat invocations
  7513. if ( completed ) {
  7514. return;
  7515. }
  7516. completed = true;
  7517. // Clear timeout if it exists
  7518. if ( timeoutTimer ) {
  7519. window.clearTimeout( timeoutTimer );
  7520. }
  7521. // Dereference transport for early garbage collection
  7522. // (no matter how long the jqXHR object will be used)
  7523. transport = undefined;
  7524. // Cache response headers
  7525. responseHeadersString = headers || "";
  7526. // Set readyState
  7527. jqXHR.readyState = status > 0 ? 4 : 0;
  7528. // Determine if successful
  7529. isSuccess = status >= 200 && status < 300 || status === 304;
  7530. // Get response data
  7531. if ( responses ) {
  7532. response = ajaxHandleResponses( s, jqXHR, responses );
  7533. }
  7534. // Convert no matter what (that way responseXXX fields are always set)
  7535. response = ajaxConvert( s, response, jqXHR, isSuccess );
  7536. // If successful, handle type chaining
  7537. if ( isSuccess ) {
  7538. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  7539. if ( s.ifModified ) {
  7540. modified = jqXHR.getResponseHeader( "Last-Modified" );
  7541. if ( modified ) {
  7542. jQuery.lastModified[ cacheURL ] = modified;
  7543. }
  7544. modified = jqXHR.getResponseHeader( "etag" );
  7545. if ( modified ) {
  7546. jQuery.etag[ cacheURL ] = modified;
  7547. }
  7548. }
  7549. // if no content
  7550. if ( status === 204 || s.type === "HEAD" ) {
  7551. statusText = "nocontent";
  7552. // if not modified
  7553. } else if ( status === 304 ) {
  7554. statusText = "notmodified";
  7555. // If we have data, let's convert it
  7556. } else {
  7557. statusText = response.state;
  7558. success = response.data;
  7559. error = response.error;
  7560. isSuccess = !error;
  7561. }
  7562. } else {
  7563. // Extract error from statusText and normalize for non-aborts
  7564. error = statusText;
  7565. if ( status || !statusText ) {
  7566. statusText = "error";
  7567. if ( status < 0 ) {
  7568. status = 0;
  7569. }
  7570. }
  7571. }
  7572. // Set data for the fake xhr object
  7573. jqXHR.status = status;
  7574. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  7575. // Success/Error
  7576. if ( isSuccess ) {
  7577. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  7578. } else {
  7579. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  7580. }
  7581. // Status-dependent callbacks
  7582. jqXHR.statusCode( statusCode );
  7583. statusCode = undefined;
  7584. if ( fireGlobals ) {
  7585. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  7586. [ jqXHR, s, isSuccess ? success : error ] );
  7587. }
  7588. // Complete
  7589. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  7590. if ( fireGlobals ) {
  7591. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  7592. // Handle the global AJAX counter
  7593. if ( !( --jQuery.active ) ) {
  7594. jQuery.event.trigger( "ajaxStop" );
  7595. }
  7596. }
  7597. }
  7598. return jqXHR;
  7599. },
  7600. getJSON: function( url, data, callback ) {
  7601. return jQuery.get( url, data, callback, "json" );
  7602. },
  7603. getScript: function( url, callback ) {
  7604. return jQuery.get( url, undefined, callback, "script" );
  7605. }
  7606. } );
  7607. jQuery.each( [ "get", "post" ], function( i, method ) {
  7608. jQuery[ method ] = function( url, data, callback, type ) {
  7609. // Shift arguments if data argument was omitted
  7610. if ( isFunction( data ) ) {
  7611. type = type || callback;
  7612. callback = data;
  7613. data = undefined;
  7614. }
  7615. // The url can be an options object (which then must have .url)
  7616. return jQuery.ajax( jQuery.extend( {
  7617. url: url,
  7618. type: method,
  7619. dataType: type,
  7620. data: data,
  7621. success: callback
  7622. }, jQuery.isPlainObject( url ) && url ) );
  7623. };
  7624. } );
  7625. jQuery._evalUrl = function( url ) {
  7626. return jQuery.ajax( {
  7627. url: url,
  7628. // Make this explicit, since user can override this through ajaxSetup (#11264)
  7629. type: "GET",
  7630. dataType: "script",
  7631. cache: true,
  7632. async: false,
  7633. global: false,
  7634. "throws": true
  7635. } );
  7636. };
  7637. jQuery.fn.extend( {
  7638. wrapAll: function( html ) {
  7639. var wrap;
  7640. if ( this[ 0 ] ) {
  7641. if ( isFunction( html ) ) {
  7642. html = html.call( this[ 0 ] );
  7643. }
  7644. // The elements to wrap the target around
  7645. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  7646. if ( this[ 0 ].parentNode ) {
  7647. wrap.insertBefore( this[ 0 ] );
  7648. }
  7649. wrap.map( function() {
  7650. var elem = this;
  7651. while ( elem.firstElementChild ) {
  7652. elem = elem.firstElementChild;
  7653. }
  7654. return elem;
  7655. } ).append( this );
  7656. }
  7657. return this;
  7658. },
  7659. wrapInner: function( html ) {
  7660. if ( isFunction( html ) ) {
  7661. return this.each( function( i ) {
  7662. jQuery( this ).wrapInner( html.call( this, i ) );
  7663. } );
  7664. }
  7665. return this.each( function() {
  7666. var self = jQuery( this ),
  7667. contents = self.contents();
  7668. if ( contents.length ) {
  7669. contents.wrapAll( html );
  7670. } else {
  7671. self.append( html );
  7672. }
  7673. } );
  7674. },
  7675. wrap: function( html ) {
  7676. var htmlIsFunction = isFunction( html );
  7677. return this.each( function( i ) {
  7678. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  7679. } );
  7680. },
  7681. unwrap: function( selector ) {
  7682. this.parent( selector ).not( "body" ).each( function() {
  7683. jQuery( this ).replaceWith( this.childNodes );
  7684. } );
  7685. return this;
  7686. }
  7687. } );
  7688. jQuery.expr.pseudos.hidden = function( elem ) {
  7689. return !jQuery.expr.pseudos.visible( elem );
  7690. };
  7691. jQuery.expr.pseudos.visible = function( elem ) {
  7692. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  7693. };
  7694. jQuery.ajaxSettings.xhr = function() {
  7695. try {
  7696. return new window.XMLHttpRequest();
  7697. } catch ( e ) {}
  7698. };
  7699. var xhrSuccessStatus = {
  7700. // File protocol always yields status code 0, assume 200
  7701. 0: 200,
  7702. // Support: IE <=9 only
  7703. // #1450: sometimes IE returns 1223 when it should be 204
  7704. 1223: 204
  7705. },
  7706. xhrSupported = jQuery.ajaxSettings.xhr();
  7707. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  7708. support.ajax = xhrSupported = !!xhrSupported;
  7709. jQuery.ajaxTransport( function( options ) {
  7710. var callback, errorCallback;
  7711. // Cross domain only allowed if supported through XMLHttpRequest
  7712. if ( support.cors || xhrSupported && !options.crossDomain ) {
  7713. return {
  7714. send: function( headers, complete ) {
  7715. var i,
  7716. xhr = options.xhr();
  7717. xhr.open(
  7718. options.type,
  7719. options.url,
  7720. options.async,
  7721. options.username,
  7722. options.password
  7723. );
  7724. // Apply custom fields if provided
  7725. if ( options.xhrFields ) {
  7726. for ( i in options.xhrFields ) {
  7727. xhr[ i ] = options.xhrFields[ i ];
  7728. }
  7729. }
  7730. // Override mime type if needed
  7731. if ( options.mimeType && xhr.overrideMimeType ) {
  7732. xhr.overrideMimeType( options.mimeType );
  7733. }
  7734. // X-Requested-With header
  7735. // For cross-domain requests, seeing as conditions for a preflight are
  7736. // akin to a jigsaw puzzle, we simply never set it to be sure.
  7737. // (it can always be set on a per-request basis or even using ajaxSetup)
  7738. // For same-domain requests, won't change header if already provided.
  7739. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  7740. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  7741. }
  7742. // Set headers
  7743. for ( i in headers ) {
  7744. xhr.setRequestHeader( i, headers[ i ] );
  7745. }
  7746. // Callback
  7747. callback = function( type ) {
  7748. return function() {
  7749. if ( callback ) {
  7750. callback = errorCallback = xhr.onload =
  7751. xhr.onerror = xhr.onabort = xhr.ontimeout =
  7752. xhr.onreadystatechange = null;
  7753. if ( type === "abort" ) {
  7754. xhr.abort();
  7755. } else if ( type === "error" ) {
  7756. // Support: IE <=9 only
  7757. // On a manual native abort, IE9 throws
  7758. // errors on any property access that is not readyState
  7759. if ( typeof xhr.status !== "number" ) {
  7760. complete( 0, "error" );
  7761. } else {
  7762. complete(
  7763. // File: protocol always yields status 0; see #8605, #14207
  7764. xhr.status,
  7765. xhr.statusText
  7766. );
  7767. }
  7768. } else {
  7769. complete(
  7770. xhrSuccessStatus[ xhr.status ] || xhr.status,
  7771. xhr.statusText,
  7772. // Support: IE <=9 only
  7773. // IE9 has no XHR2 but throws on binary (trac-11426)
  7774. // For XHR2 non-text, let the caller handle it (gh-2498)
  7775. ( xhr.responseType || "text" ) !== "text" ||
  7776. typeof xhr.responseText !== "string" ?
  7777. { binary: xhr.response } :
  7778. { text: xhr.responseText },
  7779. xhr.getAllResponseHeaders()
  7780. );
  7781. }
  7782. }
  7783. };
  7784. };
  7785. // Listen to events
  7786. xhr.onload = callback();
  7787. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  7788. // Support: IE 9 only
  7789. // Use onreadystatechange to replace onabort
  7790. // to handle uncaught aborts
  7791. if ( xhr.onabort !== undefined ) {
  7792. xhr.onabort = errorCallback;
  7793. } else {
  7794. xhr.onreadystatechange = function() {
  7795. // Check readyState before timeout as it changes
  7796. if ( xhr.readyState === 4 ) {
  7797. // Allow onerror to be called first,
  7798. // but that will not handle a native abort
  7799. // Also, save errorCallback to a variable
  7800. // as xhr.onerror cannot be accessed
  7801. window.setTimeout( function() {
  7802. if ( callback ) {
  7803. errorCallback();
  7804. }
  7805. } );
  7806. }
  7807. };
  7808. }
  7809. // Create the abort callback
  7810. callback = callback( "abort" );
  7811. try {
  7812. // Do send the request (this may raise an exception)
  7813. xhr.send( options.hasContent && options.data || null );
  7814. } catch ( e ) {
  7815. // #14683: Only rethrow if this hasn't been notified as an error yet
  7816. if ( callback ) {
  7817. throw e;
  7818. }
  7819. }
  7820. },
  7821. abort: function() {
  7822. if ( callback ) {
  7823. callback();
  7824. }
  7825. }
  7826. };
  7827. }
  7828. } );
  7829. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  7830. jQuery.ajaxPrefilter( function( s ) {
  7831. if ( s.crossDomain ) {
  7832. s.contents.script = false;
  7833. }
  7834. } );
  7835. // Install script dataType
  7836. jQuery.ajaxSetup( {
  7837. accepts: {
  7838. script: "text/javascript, application/javascript, " +
  7839. "application/ecmascript, application/x-ecmascript"
  7840. },
  7841. contents: {
  7842. script: /\b(?:java|ecma)script\b/
  7843. },
  7844. converters: {
  7845. "text script": function( text ) {
  7846. jQuery.globalEval( text );
  7847. return text;
  7848. }
  7849. }
  7850. } );
  7851. // Handle cache's special case and crossDomain
  7852. jQuery.ajaxPrefilter( "script", function( s ) {
  7853. if ( s.cache === undefined ) {
  7854. s.cache = false;
  7855. }
  7856. if ( s.crossDomain ) {
  7857. s.type = "GET";
  7858. }
  7859. } );
  7860. // Bind script tag hack transport
  7861. jQuery.ajaxTransport( "script", function( s ) {
  7862. // This transport only deals with cross domain requests
  7863. if ( s.crossDomain ) {
  7864. var script, callback;
  7865. return {
  7866. send: function( _, complete ) {
  7867. script = jQuery( "<script>" ).prop( {
  7868. charset: s.scriptCharset,
  7869. src: s.url
  7870. } ).on(
  7871. "load error",
  7872. callback = function( evt ) {
  7873. script.remove();
  7874. callback = null;
  7875. if ( evt ) {
  7876. complete( evt.type === "error" ? 404 : 200, evt.type );
  7877. }
  7878. }
  7879. );
  7880. // Use native DOM manipulation to avoid our domManip AJAX trickery
  7881. document.head.appendChild( script[ 0 ] );
  7882. },
  7883. abort: function() {
  7884. if ( callback ) {
  7885. callback();
  7886. }
  7887. }
  7888. };
  7889. }
  7890. } );
  7891. var oldCallbacks = [],
  7892. rjsonp = /(=)\?(?=&|$)|\?\?/;
  7893. // Default jsonp settings
  7894. jQuery.ajaxSetup( {
  7895. jsonp: "callback",
  7896. jsonpCallback: function() {
  7897. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  7898. this[ callback ] = true;
  7899. return callback;
  7900. }
  7901. } );
  7902. // Detect, normalize options and install callbacks for jsonp requests
  7903. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  7904. var callbackName, overwritten, responseContainer,
  7905. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  7906. "url" :
  7907. typeof s.data === "string" &&
  7908. ( s.contentType || "" )
  7909. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  7910. rjsonp.test( s.data ) && "data"
  7911. );
  7912. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  7913. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  7914. // Get callback name, remembering preexisting value associated with it
  7915. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  7916. s.jsonpCallback() :
  7917. s.jsonpCallback;
  7918. // Insert callback into url or form data
  7919. if ( jsonProp ) {
  7920. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  7921. } else if ( s.jsonp !== false ) {
  7922. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  7923. }
  7924. // Use data converter to retrieve json after script execution
  7925. s.converters[ "script json" ] = function() {
  7926. if ( !responseContainer ) {
  7927. jQuery.error( callbackName + " was not called" );
  7928. }
  7929. return responseContainer[ 0 ];
  7930. };
  7931. // Force json dataType
  7932. s.dataTypes[ 0 ] = "json";
  7933. // Install callback
  7934. overwritten = window[ callbackName ];
  7935. window[ callbackName ] = function() {
  7936. responseContainer = arguments;
  7937. };
  7938. // Clean-up function (fires after converters)
  7939. jqXHR.always( function() {
  7940. // If previous value didn't exist - remove it
  7941. if ( overwritten === undefined ) {
  7942. jQuery( window ).removeProp( callbackName );
  7943. // Otherwise restore preexisting value
  7944. } else {
  7945. window[ callbackName ] = overwritten;
  7946. }
  7947. // Save back as free
  7948. if ( s[ callbackName ] ) {
  7949. // Make sure that re-using the options doesn't screw things around
  7950. s.jsonpCallback = originalSettings.jsonpCallback;
  7951. // Save the callback name for future use
  7952. oldCallbacks.push( callbackName );
  7953. }
  7954. // Call if it was a function and we have a response
  7955. if ( responseContainer && isFunction( overwritten ) ) {
  7956. overwritten( responseContainer[ 0 ] );
  7957. }
  7958. responseContainer = overwritten = undefined;
  7959. } );
  7960. // Delegate to script
  7961. return "script";
  7962. }
  7963. } );
  7964. // Support: Safari 8 only
  7965. // In Safari 8 documents created via document.implementation.createHTMLDocument
  7966. // collapse sibling forms: the second one becomes a child of the first one.
  7967. // Because of that, this security measure has to be disabled in Safari 8.
  7968. // https://bugs.webkit.org/show_bug.cgi?id=137337
  7969. support.createHTMLDocument = ( function() {
  7970. var body = document.implementation.createHTMLDocument( "" ).body;
  7971. body.innerHTML = "<form></form><form></form>";
  7972. return body.childNodes.length === 2;
  7973. } )();
  7974. // Argument "data" should be string of html
  7975. // context (optional): If specified, the fragment will be created in this context,
  7976. // defaults to document
  7977. // keepScripts (optional): If true, will include scripts passed in the html string
  7978. jQuery.parseHTML = function( data, context, keepScripts ) {
  7979. if ( typeof data !== "string" ) {
  7980. return [];
  7981. }
  7982. if ( typeof context === "boolean" ) {
  7983. keepScripts = context;
  7984. context = false;
  7985. }
  7986. var base, parsed, scripts;
  7987. if ( !context ) {
  7988. // Stop scripts or inline event handlers from being executed immediately
  7989. // by using document.implementation
  7990. if ( support.createHTMLDocument ) {
  7991. context = document.implementation.createHTMLDocument( "" );
  7992. // Set the base href for the created document
  7993. // so any parsed elements with URLs
  7994. // are based on the document's URL (gh-2965)
  7995. base = context.createElement( "base" );
  7996. base.href = document.location.href;
  7997. context.head.appendChild( base );
  7998. } else {
  7999. context = document;
  8000. }
  8001. }
  8002. parsed = rsingleTag.exec( data );
  8003. scripts = !keepScripts && [];
  8004. // Single tag
  8005. if ( parsed ) {
  8006. return [ context.createElement( parsed[ 1 ] ) ];
  8007. }
  8008. parsed = buildFragment( [ data ], context, scripts );
  8009. if ( scripts && scripts.length ) {
  8010. jQuery( scripts ).remove();
  8011. }
  8012. return jQuery.merge( [], parsed.childNodes );
  8013. };
  8014. /**
  8015. * Load a url into a page
  8016. */
  8017. jQuery.fn.load = function( url, params, callback ) {
  8018. var selector, type, response,
  8019. self = this,
  8020. off = url.indexOf( " " );
  8021. if ( off > -1 ) {
  8022. selector = stripAndCollapse( url.slice( off ) );
  8023. url = url.slice( 0, off );
  8024. }
  8025. // If it's a function
  8026. if ( isFunction( params ) ) {
  8027. // We assume that it's the callback
  8028. callback = params;
  8029. params = undefined;
  8030. // Otherwise, build a param string
  8031. } else if ( params && typeof params === "object" ) {
  8032. type = "POST";
  8033. }
  8034. // If we have elements to modify, make the request
  8035. if ( self.length > 0 ) {
  8036. jQuery.ajax( {
  8037. url: url,
  8038. // If "type" variable is undefined, then "GET" method will be used.
  8039. // Make value of this field explicit since
  8040. // user can override it through ajaxSetup method
  8041. type: type || "GET",
  8042. dataType: "html",
  8043. data: params
  8044. } ).done( function( responseText ) {
  8045. // Save response for use in complete callback
  8046. response = arguments;
  8047. self.html( selector ?
  8048. // If a selector was specified, locate the right elements in a dummy div
  8049. // Exclude scripts to avoid IE 'Permission Denied' errors
  8050. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  8051. // Otherwise use the full result
  8052. responseText );
  8053. // If the request succeeds, this function gets "data", "status", "jqXHR"
  8054. // but they are ignored because response was set above.
  8055. // If it fails, this function gets "jqXHR", "status", "error"
  8056. } ).always( callback && function( jqXHR, status ) {
  8057. self.each( function() {
  8058. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  8059. } );
  8060. } );
  8061. }
  8062. return this;
  8063. };
  8064. // Attach a bunch of functions for handling common AJAX events
  8065. jQuery.each( [
  8066. "ajaxStart",
  8067. "ajaxStop",
  8068. "ajaxComplete",
  8069. "ajaxError",
  8070. "ajaxSuccess",
  8071. "ajaxSend"
  8072. ], function( i, type ) {
  8073. jQuery.fn[ type ] = function( fn ) {
  8074. return this.on( type, fn );
  8075. };
  8076. } );
  8077. jQuery.expr.pseudos.animated = function( elem ) {
  8078. return jQuery.grep( jQuery.timers, function( fn ) {
  8079. return elem === fn.elem;
  8080. } ).length;
  8081. };
  8082. jQuery.offset = {
  8083. setOffset: function( elem, options, i ) {
  8084. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  8085. position = jQuery.css( elem, "position" ),
  8086. curElem = jQuery( elem ),
  8087. props = {};
  8088. // Set position first, in-case top/left are set even on static elem
  8089. if ( position === "static" ) {
  8090. elem.style.position = "relative";
  8091. }
  8092. curOffset = curElem.offset();
  8093. curCSSTop = jQuery.css( elem, "top" );
  8094. curCSSLeft = jQuery.css( elem, "left" );
  8095. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  8096. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  8097. // Need to be able to calculate position if either
  8098. // top or left is auto and position is either absolute or fixed
  8099. if ( calculatePosition ) {
  8100. curPosition = curElem.position();
  8101. curTop = curPosition.top;
  8102. curLeft = curPosition.left;
  8103. } else {
  8104. curTop = parseFloat( curCSSTop ) || 0;
  8105. curLeft = parseFloat( curCSSLeft ) || 0;
  8106. }
  8107. if ( isFunction( options ) ) {
  8108. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  8109. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  8110. }
  8111. if ( options.top != null ) {
  8112. props.top = ( options.top - curOffset.top ) + curTop;
  8113. }
  8114. if ( options.left != null ) {
  8115. props.left = ( options.left - curOffset.left ) + curLeft;
  8116. }
  8117. if ( "using" in options ) {
  8118. options.using.call( elem, props );
  8119. } else {
  8120. curElem.css( props );
  8121. }
  8122. }
  8123. };
  8124. jQuery.fn.extend( {
  8125. // offset() relates an element's border box to the document origin
  8126. offset: function( options ) {
  8127. // Preserve chaining for setter
  8128. if ( arguments.length ) {
  8129. return options === undefined ?
  8130. this :
  8131. this.each( function( i ) {
  8132. jQuery.offset.setOffset( this, options, i );
  8133. } );
  8134. }
  8135. var rect, win,
  8136. elem = this[ 0 ];
  8137. if ( !elem ) {
  8138. return;
  8139. }
  8140. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  8141. // Support: IE <=11 only
  8142. // Running getBoundingClientRect on a
  8143. // disconnected node in IE throws an error
  8144. if ( !elem.getClientRects().length ) {
  8145. return { top: 0, left: 0 };
  8146. }
  8147. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  8148. rect = elem.getBoundingClientRect();
  8149. win = elem.ownerDocument.defaultView;
  8150. return {
  8151. top: rect.top + win.pageYOffset,
  8152. left: rect.left + win.pageXOffset
  8153. };
  8154. },
  8155. // position() relates an element's margin box to its offset parent's padding box
  8156. // This corresponds to the behavior of CSS absolute positioning
  8157. position: function() {
  8158. if ( !this[ 0 ] ) {
  8159. return;
  8160. }
  8161. var offsetParent, offset, doc,
  8162. elem = this[ 0 ],
  8163. parentOffset = { top: 0, left: 0 };
  8164. // position:fixed elements are offset from the viewport, which itself always has zero offset
  8165. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  8166. // Assume position:fixed implies availability of getBoundingClientRect
  8167. offset = elem.getBoundingClientRect();
  8168. } else {
  8169. offset = this.offset();
  8170. // Account for the *real* offset parent, which can be the document or its root element
  8171. // when a statically positioned element is identified
  8172. doc = elem.ownerDocument;
  8173. offsetParent = elem.offsetParent || doc.documentElement;
  8174. while ( offsetParent &&
  8175. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  8176. jQuery.css( offsetParent, "position" ) === "static" ) {
  8177. offsetParent = offsetParent.parentNode;
  8178. }
  8179. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  8180. // Incorporate borders into its offset, since they are outside its content origin
  8181. parentOffset = jQuery( offsetParent ).offset();
  8182. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  8183. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  8184. }
  8185. }
  8186. // Subtract parent offsets and element margins
  8187. return {
  8188. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  8189. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  8190. };
  8191. },
  8192. // This method will return documentElement in the following cases:
  8193. // 1) For the element inside the iframe without offsetParent, this method will return
  8194. // documentElement of the parent window
  8195. // 2) For the hidden or detached element
  8196. // 3) For body or html element, i.e. in case of the html node - it will return itself
  8197. //
  8198. // but those exceptions were never presented as a real life use-cases
  8199. // and might be considered as more preferable results.
  8200. //
  8201. // This logic, however, is not guaranteed and can change at any point in the future
  8202. offsetParent: function() {
  8203. return this.map( function() {
  8204. var offsetParent = this.offsetParent;
  8205. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  8206. offsetParent = offsetParent.offsetParent;
  8207. }
  8208. return offsetParent || documentElement;
  8209. } );
  8210. }
  8211. } );
  8212. // Create scrollLeft and scrollTop methods
  8213. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  8214. var top = "pageYOffset" === prop;
  8215. jQuery.fn[ method ] = function( val ) {
  8216. return access( this, function( elem, method, val ) {
  8217. // Coalesce documents and windows
  8218. var win;
  8219. if ( isWindow( elem ) ) {
  8220. win = elem;
  8221. } else if ( elem.nodeType === 9 ) {
  8222. win = elem.defaultView;
  8223. }
  8224. if ( val === undefined ) {
  8225. return win ? win[ prop ] : elem[ method ];
  8226. }
  8227. if ( win ) {
  8228. win.scrollTo(
  8229. !top ? val : win.pageXOffset,
  8230. top ? val : win.pageYOffset
  8231. );
  8232. } else {
  8233. elem[ method ] = val;
  8234. }
  8235. }, method, val, arguments.length );
  8236. };
  8237. } );
  8238. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  8239. // Add the top/left cssHooks using jQuery.fn.position
  8240. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  8241. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  8242. // getComputedStyle returns percent when specified for top/left/bottom/right;
  8243. // rather than make the css module depend on the offset module, just check for it here
  8244. jQuery.each( [ "top", "left" ], function( i, prop ) {
  8245. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  8246. function( elem, computed ) {
  8247. if ( computed ) {
  8248. computed = curCSS( elem, prop );
  8249. // If curCSS returns percentage, fallback to offset
  8250. return rnumnonpx.test( computed ) ?
  8251. jQuery( elem ).position()[ prop ] + "px" :
  8252. computed;
  8253. }
  8254. }
  8255. );
  8256. } );
  8257. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  8258. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  8259. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  8260. function( defaultExtra, funcName ) {
  8261. // Margin is only for outerHeight, outerWidth
  8262. jQuery.fn[ funcName ] = function( margin, value ) {
  8263. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  8264. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  8265. return access( this, function( elem, type, value ) {
  8266. var doc;
  8267. if ( isWindow( elem ) ) {
  8268. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  8269. return funcName.indexOf( "outer" ) === 0 ?
  8270. elem[ "inner" + name ] :
  8271. elem.document.documentElement[ "client" + name ];
  8272. }
  8273. // Get document width or height
  8274. if ( elem.nodeType === 9 ) {
  8275. doc = elem.documentElement;
  8276. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  8277. // whichever is greatest
  8278. return Math.max(
  8279. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  8280. elem.body[ "offset" + name ], doc[ "offset" + name ],
  8281. doc[ "client" + name ]
  8282. );
  8283. }
  8284. return value === undefined ?
  8285. // Get width or height on the element, requesting but not forcing parseFloat
  8286. jQuery.css( elem, type, extra ) :
  8287. // Set width or height on the element
  8288. jQuery.style( elem, type, value, extra );
  8289. }, type, chainable ? margin : undefined, chainable );
  8290. };
  8291. } );
  8292. } );
  8293. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  8294. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  8295. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  8296. function( i, name ) {
  8297. // Handle event binding
  8298. jQuery.fn[ name ] = function( data, fn ) {
  8299. return arguments.length > 0 ?
  8300. this.on( name, null, data, fn ) :
  8301. this.trigger( name );
  8302. };
  8303. } );
  8304. jQuery.fn.extend( {
  8305. hover: function( fnOver, fnOut ) {
  8306. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  8307. }
  8308. } );
  8309. jQuery.fn.extend( {
  8310. bind: function( types, data, fn ) {
  8311. return this.on( types, null, data, fn );
  8312. },
  8313. unbind: function( types, fn ) {
  8314. return this.off( types, null, fn );
  8315. },
  8316. delegate: function( selector, types, data, fn ) {
  8317. return this.on( types, selector, data, fn );
  8318. },
  8319. undelegate: function( selector, types, fn ) {
  8320. // ( namespace ) or ( selector, types [, fn] )
  8321. return arguments.length === 1 ?
  8322. this.off( selector, "**" ) :
  8323. this.off( types, selector || "**", fn );
  8324. }
  8325. } );
  8326. // Bind a function to a context, optionally partially applying any
  8327. // arguments.
  8328. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  8329. // However, it is not slated for removal any time soon
  8330. jQuery.proxy = function( fn, context ) {
  8331. var tmp, args, proxy;
  8332. if ( typeof context === "string" ) {
  8333. tmp = fn[ context ];
  8334. context = fn;
  8335. fn = tmp;
  8336. }
  8337. // Quick check to determine if target is callable, in the spec
  8338. // this throws a TypeError, but we will just return undefined.
  8339. if ( !isFunction( fn ) ) {
  8340. return undefined;
  8341. }
  8342. // Simulated bind
  8343. args = slice.call( arguments, 2 );
  8344. proxy = function() {
  8345. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  8346. };
  8347. // Set the guid of unique handler to the same of original handler, so it can be removed
  8348. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  8349. return proxy;
  8350. };
  8351. jQuery.holdReady = function( hold ) {
  8352. if ( hold ) {
  8353. jQuery.readyWait++;
  8354. } else {
  8355. jQuery.ready( true );
  8356. }
  8357. };
  8358. jQuery.isArray = Array.isArray;
  8359. jQuery.parseJSON = JSON.parse;
  8360. jQuery.nodeName = nodeName;
  8361. jQuery.isFunction = isFunction;
  8362. jQuery.isWindow = isWindow;
  8363. jQuery.camelCase = camelCase;
  8364. jQuery.type = toType;
  8365. jQuery.now = Date.now;
  8366. jQuery.isNumeric = function( obj ) {
  8367. // As of jQuery 3.0, isNumeric is limited to
  8368. // strings and numbers (primitives or objects)
  8369. // that can be coerced to finite numbers (gh-2662)
  8370. var type = jQuery.type( obj );
  8371. return ( type === "number" || type === "string" ) &&
  8372. // parseFloat NaNs numeric-cast false positives ("")
  8373. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  8374. // subtraction forces infinities to NaN
  8375. !isNaN( obj - parseFloat( obj ) );
  8376. };
  8377. // Register as a named AMD module, since jQuery can be concatenated with other
  8378. // files that may use define, but not via a proper concatenation script that
  8379. // understands anonymous AMD modules. A named AMD is safest and most robust
  8380. // way to register. Lowercase jquery is used because AMD module names are
  8381. // derived from file names, and jQuery is normally delivered in a lowercase
  8382. // file name. Do this after creating the global so that if an AMD module wants
  8383. // to call noConflict to hide this version of jQuery, it will work.
  8384. // Note that for maximum portability, libraries that are not jQuery should
  8385. // declare themselves as anonymous modules, and avoid setting a global if an
  8386. // AMD loader is present. jQuery is a special case. For more information, see
  8387. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  8388. if ( typeof define === "function" && define.amd ) {
  8389. define( "jquery", [], function() {
  8390. return jQuery;
  8391. } );
  8392. }
  8393. var
  8394. // Map over jQuery in case of overwrite
  8395. _jQuery = window.jQuery,
  8396. // Map over the $ in case of overwrite
  8397. _$ = window.$;
  8398. jQuery.noConflict = function( deep ) {
  8399. if ( window.$ === jQuery ) {
  8400. window.$ = _$;
  8401. }
  8402. if ( deep && window.jQuery === jQuery ) {
  8403. window.jQuery = _jQuery;
  8404. }
  8405. return jQuery;
  8406. };
  8407. // Expose jQuery and $ identifiers, even in AMD
  8408. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  8409. // and CommonJS for browser emulators (#13566)
  8410. if ( !noGlobal ) {
  8411. window.jQuery = window.$ = jQuery;
  8412. }
  8413. return jQuery;
  8414. } );