jquery.slim.js 226 KB

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