select2.full.js 445 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619
  1. window.$ = window.$ || {};(function() { if ($ && $.fn && $.fn.select2 && $.fn.select2.amd) { define = $.fn.select2.amd.define; require = $.fn.select2.amd.require; }/**
  2. * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
  3. * Available via the MIT or new BSD license.
  4. * see: http://github.com/jrburke/almond for details
  5. */
  6. //Going sloppy to avoid 'use strict' string cost, but strict practices should
  7. //be followed.
  8. /*jslint sloppy: true */
  9. /*global setTimeout: false */
  10. var requirejs, require, define;
  11. (function (undef) {
  12. var main, req, makeMap, handlers,
  13. defined = {},
  14. waiting = {},
  15. config = {},
  16. defining = {},
  17. hasOwn = Object.prototype.hasOwnProperty,
  18. aps = [].slice,
  19. jsSuffixRegExp = /\.js$/;
  20. function hasProp(obj, prop) {
  21. return hasOwn.call(obj, prop);
  22. }
  23. /**
  24. * Given a relative module name, like ./something, normalize it to
  25. * a real name that can be mapped to a path.
  26. * @param {String} name the relative name
  27. * @param {String} baseName a real name that the name arg is relative
  28. * to.
  29. * @returns {String} normalized name
  30. */
  31. function normalize(name, baseName) {
  32. var nameParts, nameSegment, mapValue, foundMap, lastIndex,
  33. foundI, foundStarMap, starI, i, j, part,
  34. baseParts = baseName && baseName.split("/"),
  35. map = config.map,
  36. starMap = (map && map['*']) || {};
  37. //Adjust any relative paths.
  38. if (name && name.charAt(0) === ".") {
  39. //If have a base name, try to normalize against it,
  40. //otherwise, assume it is a top-level require that will
  41. //be relative to baseUrl in the end.
  42. if (baseName) {
  43. //Convert baseName to array, and lop off the last part,
  44. //so that . matches that "directory" and not name of the baseName's
  45. //module. For instance, baseName of "one/two/three", maps to
  46. //"one/two/three.js", but we want the directory, "one/two" for
  47. //this normalization.
  48. baseParts = baseParts.slice(0, baseParts.length - 1);
  49. name = name.split('/');
  50. lastIndex = name.length - 1;
  51. // Node .js allowance:
  52. if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
  53. name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
  54. }
  55. name = baseParts.concat(name);
  56. //start trimDots
  57. for (i = 0; i < name.length; i += 1) {
  58. part = name[i];
  59. if (part === ".") {
  60. name.splice(i, 1);
  61. i -= 1;
  62. } else if (part === "..") {
  63. if (i === 1 && (name[2] === '..' || name[0] === '..')) {
  64. //End of the line. Keep at least one non-dot
  65. //path segment at the front so it can be mapped
  66. //correctly to disk. Otherwise, there is likely
  67. //no path mapping for a path starting with '..'.
  68. //This can still fail, but catches the most reasonable
  69. //uses of ..
  70. break;
  71. } else if (i > 0) {
  72. name.splice(i - 1, 2);
  73. i -= 2;
  74. }
  75. }
  76. }
  77. //end trimDots
  78. name = name.join("/");
  79. } else if (name.indexOf('./') === 0) {
  80. // No baseName, so this is ID is resolved relative
  81. // to baseUrl, pull off the leading dot.
  82. name = name.substring(2);
  83. }
  84. }
  85. //Apply map config if available.
  86. if ((baseParts || starMap) && map) {
  87. nameParts = name.split('/');
  88. for (i = nameParts.length; i > 0; i -= 1) {
  89. nameSegment = nameParts.slice(0, i).join("/");
  90. if (baseParts) {
  91. //Find the longest baseName segment match in the config.
  92. //So, do joins on the biggest to smallest lengths of baseParts.
  93. for (j = baseParts.length; j > 0; j -= 1) {
  94. mapValue = map[baseParts.slice(0, j).join('/')];
  95. //baseName segment has config, find if it has one for
  96. //this name.
  97. if (mapValue) {
  98. mapValue = mapValue[nameSegment];
  99. if (mapValue) {
  100. //Match, update name to the new value.
  101. foundMap = mapValue;
  102. foundI = i;
  103. break;
  104. }
  105. }
  106. }
  107. }
  108. if (foundMap) {
  109. break;
  110. }
  111. //Check for a star map match, but just hold on to it,
  112. //if there is a shorter segment match later in a matching
  113. //config, then favor over this star map.
  114. if (!foundStarMap && starMap && starMap[nameSegment]) {
  115. foundStarMap = starMap[nameSegment];
  116. starI = i;
  117. }
  118. }
  119. if (!foundMap && foundStarMap) {
  120. foundMap = foundStarMap;
  121. foundI = starI;
  122. }
  123. if (foundMap) {
  124. nameParts.splice(0, foundI, foundMap);
  125. name = nameParts.join('/');
  126. }
  127. }
  128. return name;
  129. }
  130. function makeRequire(relName, forceSync) {
  131. return function () {
  132. //A version of a require function that passes a moduleName
  133. //value for items that may need to
  134. //look up paths relative to the moduleName
  135. return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync]));
  136. };
  137. }
  138. function makeNormalize(relName) {
  139. return function (name) {
  140. return normalize(name, relName);
  141. };
  142. }
  143. function makeLoad(depName) {
  144. return function (value) {
  145. defined[depName] = value;
  146. };
  147. }
  148. function callDep(name) {
  149. if (hasProp(waiting, name)) {
  150. var args = waiting[name];
  151. delete waiting[name];
  152. defining[name] = true;
  153. main.apply(undef, args);
  154. }
  155. if (!hasProp(defined, name) && !hasProp(defining, name)) {
  156. throw new Error('No ' + name);
  157. }
  158. return defined[name];
  159. }
  160. //Turns a plugin!resource to [plugin, resource]
  161. //with the plugin being undefined if the name
  162. //did not have a plugin prefix.
  163. function splitPrefix(name) {
  164. var prefix,
  165. index = name ? name.indexOf('!') : -1;
  166. if (index > -1) {
  167. prefix = name.substring(0, index);
  168. name = name.substring(index + 1, name.length);
  169. }
  170. return [prefix, name];
  171. }
  172. /**
  173. * Makes a name map, normalizing the name, and using a plugin
  174. * for normalization if necessary. Grabs a ref to plugin
  175. * too, as an optimization.
  176. */
  177. makeMap = function (name, relName) {
  178. var plugin,
  179. parts = splitPrefix(name),
  180. prefix = parts[0];
  181. name = parts[1];
  182. if (prefix) {
  183. prefix = normalize(prefix, relName);
  184. plugin = callDep(prefix);
  185. }
  186. //Normalize according
  187. if (prefix) {
  188. if (plugin && plugin.normalize) {
  189. name = plugin.normalize(name, makeNormalize(relName));
  190. } else {
  191. name = normalize(name, relName);
  192. }
  193. } else {
  194. name = normalize(name, relName);
  195. parts = splitPrefix(name);
  196. prefix = parts[0];
  197. name = parts[1];
  198. if (prefix) {
  199. plugin = callDep(prefix);
  200. }
  201. }
  202. //Using ridiculous property names for space reasons
  203. return {
  204. f: prefix ? prefix + '!' + name : name, //fullName
  205. n: name,
  206. pr: prefix,
  207. p: plugin
  208. };
  209. };
  210. function makeConfig(name) {
  211. return function () {
  212. return (config && config.config && config.config[name]) || {};
  213. };
  214. }
  215. handlers = {
  216. require: function (name) {
  217. return makeRequire(name);
  218. },
  219. exports: function (name) {
  220. var e = defined[name];
  221. if (typeof e !== 'undefined') {
  222. return e;
  223. } else {
  224. return (defined[name] = {});
  225. }
  226. },
  227. module: function (name) {
  228. return {
  229. id: name,
  230. uri: '',
  231. exports: defined[name],
  232. config: makeConfig(name)
  233. };
  234. }
  235. };
  236. main = function (name, deps, callback, relName) {
  237. var cjsModule, depName, ret, map, i,
  238. args = [],
  239. callbackType = typeof callback,
  240. usingExports;
  241. //Use name if no relName
  242. relName = relName || name;
  243. //Call the callback to define the module, if necessary.
  244. if (callbackType === 'undefined' || callbackType === 'function') {
  245. //Pull out the defined dependencies and pass the ordered
  246. //values to the callback.
  247. //Default to [require, exports, module] if no deps
  248. deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
  249. for (i = 0; i < deps.length; i += 1) {
  250. map = makeMap(deps[i], relName);
  251. depName = map.f;
  252. //Fast path CommonJS standard dependencies.
  253. if (depName === "require") {
  254. args[i] = handlers.require(name);
  255. } else if (depName === "exports") {
  256. //CommonJS module spec 1.1
  257. args[i] = handlers.exports(name);
  258. usingExports = true;
  259. } else if (depName === "module") {
  260. //CommonJS module spec 1.1
  261. cjsModule = args[i] = handlers.module(name);
  262. } else if (hasProp(defined, depName) ||
  263. hasProp(waiting, depName) ||
  264. hasProp(defining, depName)) {
  265. args[i] = callDep(depName);
  266. } else if (map.p) {
  267. map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
  268. args[i] = defined[depName];
  269. } else {
  270. throw new Error(name + ' missing ' + depName);
  271. }
  272. }
  273. ret = callback ? callback.apply(defined[name], args) : undefined;
  274. if (name) {
  275. //If setting exports via "module" is in play,
  276. //favor that over return value and exports. After that,
  277. //favor a non-undefined return value over exports use.
  278. if (cjsModule && cjsModule.exports !== undef &&
  279. cjsModule.exports !== defined[name]) {
  280. defined[name] = cjsModule.exports;
  281. } else if (ret !== undef || !usingExports) {
  282. //Use the return value from the function.
  283. defined[name] = ret;
  284. }
  285. }
  286. } else if (name) {
  287. //May just be an object definition for the module. Only
  288. //worry about defining if have a module name.
  289. defined[name] = callback;
  290. }
  291. };
  292. requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
  293. if (typeof deps === "string") {
  294. if (handlers[deps]) {
  295. //callback in this case is really relName
  296. return handlers[deps](callback);
  297. }
  298. //Just return the module wanted. In this scenario, the
  299. //deps arg is the module name, and second arg (if passed)
  300. //is just the relName.
  301. //Normalize module name, if it contains . or ..
  302. return callDep(makeMap(deps, callback).f);
  303. } else if (!deps.splice) {
  304. //deps is a config object, not an array.
  305. config = deps;
  306. if (config.deps) {
  307. req(config.deps, config.callback);
  308. }
  309. if (!callback) {
  310. return;
  311. }
  312. if (callback.splice) {
  313. //callback is an array, which means it is a dependency list.
  314. //Adjust args if there are dependencies
  315. deps = callback;
  316. callback = relName;
  317. relName = null;
  318. } else {
  319. deps = undef;
  320. }
  321. }
  322. //Support require(['a'])
  323. callback = callback || function () {};
  324. //If relName is a function, it is an errback handler,
  325. //so remove it.
  326. if (typeof relName === 'function') {
  327. relName = forceSync;
  328. forceSync = alt;
  329. }
  330. //Simulate async callback;
  331. if (forceSync) {
  332. main(undef, deps, callback, relName);
  333. } else {
  334. //Using a non-zero value because of concern for what old browsers
  335. //do, and latest browsers "upgrade" to 4 if lower value is used:
  336. //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
  337. //If want a value immediately, use require('id') instead -- something
  338. //that works in almond on the global level, but not guaranteed and
  339. //unlikely to work in other AMD implementations.
  340. setTimeout(function () {
  341. main(undef, deps, callback, relName);
  342. }, 4);
  343. }
  344. return req;
  345. };
  346. /**
  347. * Just drops the config on the floor, but returns req in case
  348. * the config return value is used.
  349. */
  350. req.config = function (cfg) {
  351. return req(cfg);
  352. };
  353. /**
  354. * Expose module registry for debugging and tooling
  355. */
  356. requirejs._defined = defined;
  357. define = function (name, deps, callback) {
  358. //This module may not have dependencies
  359. if (!deps.splice) {
  360. //deps is not an array, so probably means
  361. //an object literal or factory function for
  362. //the value. Adjust args.
  363. callback = deps;
  364. deps = [];
  365. }
  366. if (!hasProp(defined, name) && !hasProp(waiting, name)) {
  367. waiting[name] = [name, deps, callback];
  368. }
  369. };
  370. define.amd = {
  371. jQuery: true
  372. };
  373. }());
  374. define("almond", function(){});
  375. /*!
  376. * jQuery JavaScript Library v2.1.0
  377. * http://jquery.com/
  378. *
  379. * Includes Sizzle.js
  380. * http://sizzlejs.com/
  381. *
  382. * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
  383. * Released under the MIT license
  384. * http://jquery.org/license
  385. *
  386. * Date: 2014-01-23T21:10Z
  387. */
  388. (function( global, factory ) {
  389. if ( typeof module === "object" && typeof module.exports === "object" ) {
  390. // For CommonJS and CommonJS-like environments where a proper window is present,
  391. // execute the factory and get jQuery
  392. // For environments that do not inherently posses a window with a document
  393. // (such as Node.js), expose a jQuery-making factory as module.exports
  394. // This accentuates the need for the creation of a real window
  395. // e.g. var jQuery = require("jquery")(window);
  396. // See ticket #14549 for more info
  397. module.exports = global.document ?
  398. factory( global, true ) :
  399. function( w ) {
  400. if ( !w.document ) {
  401. throw new Error( "jQuery requires a window with a document" );
  402. }
  403. return factory( w );
  404. };
  405. } else {
  406. factory( global );
  407. }
  408. // Pass this if window is not defined yet
  409. }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  410. // Can't do this because several apps including ASP.NET trace
  411. // the stack via arguments.caller.callee and Firefox dies if
  412. // you try to trace through "use strict" call chains. (#13335)
  413. // Support: Firefox 18+
  414. //
  415. var arr = [];
  416. var slice = arr.slice;
  417. var concat = arr.concat;
  418. var push = arr.push;
  419. var indexOf = arr.indexOf;
  420. var class2type = {};
  421. var toString = class2type.toString;
  422. var hasOwn = class2type.hasOwnProperty;
  423. var trim = "".trim;
  424. var support = {};
  425. var
  426. // Use the correct document accordingly with window argument (sandbox)
  427. document = window.document,
  428. version = "2.1.0",
  429. // Define a local copy of jQuery
  430. jQuery = function( selector, context ) {
  431. // The jQuery object is actually just the init constructor 'enhanced'
  432. // Need init if jQuery is called (just allow error to be thrown if not included)
  433. return new jQuery.fn.init( selector, context );
  434. },
  435. // Matches dashed string for camelizing
  436. rmsPrefix = /^-ms-/,
  437. rdashAlpha = /-([\da-z])/gi,
  438. // Used by jQuery.camelCase as callback to replace()
  439. fcamelCase = function( all, letter ) {
  440. return letter.toUpperCase();
  441. };
  442. jQuery.fn = jQuery.prototype = {
  443. // The current version of jQuery being used
  444. jquery: version,
  445. constructor: jQuery,
  446. // Start with an empty selector
  447. selector: "",
  448. // The default length of a jQuery object is 0
  449. length: 0,
  450. toArray: function() {
  451. return slice.call( this );
  452. },
  453. // Get the Nth element in the matched element set OR
  454. // Get the whole matched element set as a clean array
  455. get: function( num ) {
  456. return num != null ?
  457. // Return a 'clean' array
  458. ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
  459. // Return just the object
  460. slice.call( this );
  461. },
  462. // Take an array of elements and push it onto the stack
  463. // (returning the new matched element set)
  464. pushStack: function( elems ) {
  465. // Build a new jQuery matched element set
  466. var ret = jQuery.merge( this.constructor(), elems );
  467. // Add the old object onto the stack (as a reference)
  468. ret.prevObject = this;
  469. ret.context = this.context;
  470. // Return the newly-formed element set
  471. return ret;
  472. },
  473. // Execute a callback for every element in the matched set.
  474. // (You can seed the arguments with an array of args, but this is
  475. // only used internally.)
  476. each: function( callback, args ) {
  477. return jQuery.each( this, callback, args );
  478. },
  479. map: function( callback ) {
  480. return this.pushStack( jQuery.map(this, function( elem, i ) {
  481. return callback.call( elem, i, elem );
  482. }));
  483. },
  484. slice: function() {
  485. return this.pushStack( slice.apply( this, arguments ) );
  486. },
  487. first: function() {
  488. return this.eq( 0 );
  489. },
  490. last: function() {
  491. return this.eq( -1 );
  492. },
  493. eq: function( i ) {
  494. var len = this.length,
  495. j = +i + ( i < 0 ? len : 0 );
  496. return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
  497. },
  498. end: function() {
  499. return this.prevObject || this.constructor(null);
  500. },
  501. // For internal use only.
  502. // Behaves like an Array's method, not like a jQuery method.
  503. push: push,
  504. sort: arr.sort,
  505. splice: arr.splice
  506. };
  507. jQuery.extend = jQuery.fn.extend = function() {
  508. var options, name, src, copy, copyIsArray, clone,
  509. target = arguments[0] || {},
  510. i = 1,
  511. length = arguments.length,
  512. deep = false;
  513. // Handle a deep copy situation
  514. if ( typeof target === "boolean" ) {
  515. deep = target;
  516. // skip the boolean and the target
  517. target = arguments[ i ] || {};
  518. i++;
  519. }
  520. // Handle case when target is a string or something (possible in deep copy)
  521. if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
  522. target = {};
  523. }
  524. // extend jQuery itself if only one argument is passed
  525. if ( i === length ) {
  526. target = this;
  527. i--;
  528. }
  529. for ( ; i < length; i++ ) {
  530. // Only deal with non-null/undefined values
  531. if ( (options = arguments[ i ]) != null ) {
  532. // Extend the base object
  533. for ( name in options ) {
  534. src = target[ name ];
  535. copy = options[ name ];
  536. // Prevent never-ending loop
  537. if ( target === copy ) {
  538. continue;
  539. }
  540. // Recurse if we're merging plain objects or arrays
  541. if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
  542. if ( copyIsArray ) {
  543. copyIsArray = false;
  544. clone = src && jQuery.isArray(src) ? src : [];
  545. } else {
  546. clone = src && jQuery.isPlainObject(src) ? src : {};
  547. }
  548. // Never move original objects, clone them
  549. target[ name ] = jQuery.extend( deep, clone, copy );
  550. // Don't bring in undefined values
  551. } else if ( copy !== undefined ) {
  552. target[ name ] = copy;
  553. }
  554. }
  555. }
  556. }
  557. // Return the modified object
  558. return target;
  559. };
  560. jQuery.extend({
  561. // Unique for each copy of jQuery on the page
  562. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  563. // Assume jQuery is ready without the ready module
  564. isReady: true,
  565. error: function( msg ) {
  566. throw new Error( msg );
  567. },
  568. noop: function() {},
  569. // See test/unit/core.js for details concerning isFunction.
  570. // Since version 1.3, DOM methods and functions like alert
  571. // aren't supported. They return false on IE (#2968).
  572. isFunction: function( obj ) {
  573. return jQuery.type(obj) === "function";
  574. },
  575. isArray: Array.isArray,
  576. isWindow: function( obj ) {
  577. return obj != null && obj === obj.window;
  578. },
  579. isNumeric: function( obj ) {
  580. // parseFloat NaNs numeric-cast false positives (null|true|false|"")
  581. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  582. // subtraction forces infinities to NaN
  583. return obj - parseFloat( obj ) >= 0;
  584. },
  585. isPlainObject: function( obj ) {
  586. // Not plain objects:
  587. // - Any object or value whose internal [[Class]] property is not "[object Object]"
  588. // - DOM nodes
  589. // - window
  590. if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
  591. return false;
  592. }
  593. // Support: Firefox <20
  594. // The try/catch suppresses exceptions thrown when attempting to access
  595. // the "constructor" property of certain host objects, ie. |window.location|
  596. // https://bugzilla.mozilla.org/show_bug.cgi?id=814622
  597. try {
  598. if ( obj.constructor &&
  599. !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
  600. return false;
  601. }
  602. } catch ( e ) {
  603. return false;
  604. }
  605. // If the function hasn't returned already, we're confident that
  606. // |obj| is a plain object, created by {} or constructed with new Object
  607. return true;
  608. },
  609. isEmptyObject: function( obj ) {
  610. var name;
  611. for ( name in obj ) {
  612. return false;
  613. }
  614. return true;
  615. },
  616. type: function( obj ) {
  617. if ( obj == null ) {
  618. return obj + "";
  619. }
  620. // Support: Android < 4.0, iOS < 6 (functionish RegExp)
  621. return typeof obj === "object" || typeof obj === "function" ?
  622. class2type[ toString.call(obj) ] || "object" :
  623. typeof obj;
  624. },
  625. // Evaluates a script in a global context
  626. globalEval: function( code ) {
  627. var script,
  628. indirect = eval;
  629. code = jQuery.trim( code );
  630. if ( code ) {
  631. // If the code includes a valid, prologue position
  632. // strict mode pragma, execute code by injecting a
  633. // script tag into the document.
  634. if ( code.indexOf("use strict") === 1 ) {
  635. script = document.createElement("script");
  636. script.text = code;
  637. document.head.appendChild( script ).parentNode.removeChild( script );
  638. } else {
  639. // Otherwise, avoid the DOM node creation, insertion
  640. // and removal by using an indirect global eval
  641. indirect( code );
  642. }
  643. }
  644. },
  645. // Convert dashed to camelCase; used by the css and data modules
  646. // Microsoft forgot to hump their vendor prefix (#9572)
  647. camelCase: function( string ) {
  648. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  649. },
  650. nodeName: function( elem, name ) {
  651. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  652. },
  653. // args is for internal usage only
  654. each: function( obj, callback, args ) {
  655. var value,
  656. i = 0,
  657. length = obj.length,
  658. isArray = isArraylike( obj );
  659. if ( args ) {
  660. if ( isArray ) {
  661. for ( ; i < length; i++ ) {
  662. value = callback.apply( obj[ i ], args );
  663. if ( value === false ) {
  664. break;
  665. }
  666. }
  667. } else {
  668. for ( i in obj ) {
  669. value = callback.apply( obj[ i ], args );
  670. if ( value === false ) {
  671. break;
  672. }
  673. }
  674. }
  675. // A special, fast, case for the most common use of each
  676. } else {
  677. if ( isArray ) {
  678. for ( ; i < length; i++ ) {
  679. value = callback.call( obj[ i ], i, obj[ i ] );
  680. if ( value === false ) {
  681. break;
  682. }
  683. }
  684. } else {
  685. for ( i in obj ) {
  686. value = callback.call( obj[ i ], i, obj[ i ] );
  687. if ( value === false ) {
  688. break;
  689. }
  690. }
  691. }
  692. }
  693. return obj;
  694. },
  695. trim: function( text ) {
  696. return text == null ? "" : trim.call( text );
  697. },
  698. // results is for internal usage only
  699. makeArray: function( arr, results ) {
  700. var ret = results || [];
  701. if ( arr != null ) {
  702. if ( isArraylike( Object(arr) ) ) {
  703. jQuery.merge( ret,
  704. typeof arr === "string" ?
  705. [ arr ] : arr
  706. );
  707. } else {
  708. push.call( ret, arr );
  709. }
  710. }
  711. return ret;
  712. },
  713. inArray: function( elem, arr, i ) {
  714. return arr == null ? -1 : indexOf.call( arr, elem, i );
  715. },
  716. merge: function( first, second ) {
  717. var len = +second.length,
  718. j = 0,
  719. i = first.length;
  720. for ( ; j < len; j++ ) {
  721. first[ i++ ] = second[ j ];
  722. }
  723. first.length = i;
  724. return first;
  725. },
  726. grep: function( elems, callback, invert ) {
  727. var callbackInverse,
  728. matches = [],
  729. i = 0,
  730. length = elems.length,
  731. callbackExpect = !invert;
  732. // Go through the array, only saving the items
  733. // that pass the validator function
  734. for ( ; i < length; i++ ) {
  735. callbackInverse = !callback( elems[ i ], i );
  736. if ( callbackInverse !== callbackExpect ) {
  737. matches.push( elems[ i ] );
  738. }
  739. }
  740. return matches;
  741. },
  742. // arg is for internal usage only
  743. map: function( elems, callback, arg ) {
  744. var value,
  745. i = 0,
  746. length = elems.length,
  747. isArray = isArraylike( elems ),
  748. ret = [];
  749. // Go through the array, translating each of the items to their new values
  750. if ( isArray ) {
  751. for ( ; i < length; i++ ) {
  752. value = callback( elems[ i ], i, arg );
  753. if ( value != null ) {
  754. ret.push( value );
  755. }
  756. }
  757. // Go through every key on the object,
  758. } else {
  759. for ( i in elems ) {
  760. value = callback( elems[ i ], i, arg );
  761. if ( value != null ) {
  762. ret.push( value );
  763. }
  764. }
  765. }
  766. // Flatten any nested arrays
  767. return concat.apply( [], ret );
  768. },
  769. // A global GUID counter for objects
  770. guid: 1,
  771. // Bind a function to a context, optionally partially applying any
  772. // arguments.
  773. proxy: function( fn, context ) {
  774. var tmp, args, proxy;
  775. if ( typeof context === "string" ) {
  776. tmp = fn[ context ];
  777. context = fn;
  778. fn = tmp;
  779. }
  780. // Quick check to determine if target is callable, in the spec
  781. // this throws a TypeError, but we will just return undefined.
  782. if ( !jQuery.isFunction( fn ) ) {
  783. return undefined;
  784. }
  785. // Simulated bind
  786. args = slice.call( arguments, 2 );
  787. proxy = function() {
  788. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  789. };
  790. // Set the guid of unique handler to the same of original handler, so it can be removed
  791. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  792. return proxy;
  793. },
  794. now: Date.now,
  795. // jQuery.support is not used in Core but other projects attach their
  796. // properties to it so it needs to exist.
  797. support: support
  798. });
  799. // Populate the class2type map
  800. jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
  801. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  802. });
  803. function isArraylike( obj ) {
  804. var length = obj.length,
  805. type = jQuery.type( obj );
  806. if ( type === "function" || jQuery.isWindow( obj ) ) {
  807. return false;
  808. }
  809. if ( obj.nodeType === 1 && length ) {
  810. return true;
  811. }
  812. return type === "array" || length === 0 ||
  813. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  814. }
  815. var Sizzle =
  816. /*!
  817. * Sizzle CSS Selector Engine v1.10.16
  818. * http://sizzlejs.com/
  819. *
  820. * Copyright 2013 jQuery Foundation, Inc. and other contributors
  821. * Released under the MIT license
  822. * http://jquery.org/license
  823. *
  824. * Date: 2014-01-13
  825. */
  826. (function( window ) {
  827. var i,
  828. support,
  829. Expr,
  830. getText,
  831. isXML,
  832. compile,
  833. outermostContext,
  834. sortInput,
  835. hasDuplicate,
  836. // Local document vars
  837. setDocument,
  838. document,
  839. docElem,
  840. documentIsHTML,
  841. rbuggyQSA,
  842. rbuggyMatches,
  843. matches,
  844. contains,
  845. // Instance-specific data
  846. expando = "sizzle" + -(new Date()),
  847. preferredDoc = window.document,
  848. dirruns = 0,
  849. done = 0,
  850. classCache = createCache(),
  851. tokenCache = createCache(),
  852. compilerCache = createCache(),
  853. sortOrder = function( a, b ) {
  854. if ( a === b ) {
  855. hasDuplicate = true;
  856. }
  857. return 0;
  858. },
  859. // General-purpose constants
  860. strundefined = typeof undefined,
  861. MAX_NEGATIVE = 1 << 31,
  862. // Instance methods
  863. hasOwn = ({}).hasOwnProperty,
  864. arr = [],
  865. pop = arr.pop,
  866. push_native = arr.push,
  867. push = arr.push,
  868. slice = arr.slice,
  869. // Use a stripped-down indexOf if we can't use a native one
  870. indexOf = arr.indexOf || function( elem ) {
  871. var i = 0,
  872. len = this.length;
  873. for ( ; i < len; i++ ) {
  874. if ( this[i] === elem ) {
  875. return i;
  876. }
  877. }
  878. return -1;
  879. },
  880. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  881. // Regular expressions
  882. // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
  883. whitespace = "[\\x20\\t\\r\\n\\f]",
  884. // http://www.w3.org/TR/css3-syntax/#characters
  885. characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
  886. // Loosely modeled on CSS identifier characters
  887. // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
  888. // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  889. identifier = characterEncoding.replace( "w", "w#" ),
  890. // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
  891. attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
  892. "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
  893. // Prefer arguments quoted,
  894. // then not containing pseudos/brackets,
  895. // then attribute selectors/non-parenthetical expressions,
  896. // then anything else
  897. // These preferences are here to reduce the number of selectors
  898. // needing tokenize in the PSEUDO preFilter
  899. pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
  900. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  901. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  902. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  903. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  904. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  905. rpseudo = new RegExp( pseudos ),
  906. ridentifier = new RegExp( "^" + identifier + "$" ),
  907. matchExpr = {
  908. "ID": new RegExp( "^#(" + characterEncoding + ")" ),
  909. "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
  910. "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
  911. "ATTR": new RegExp( "^" + attributes ),
  912. "PSEUDO": new RegExp( "^" + pseudos ),
  913. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  914. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  915. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  916. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  917. // For use in libraries implementing .is()
  918. // We use this for POS matching in `select`
  919. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  920. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  921. },
  922. rinputs = /^(?:input|select|textarea|button)$/i,
  923. rheader = /^h\d$/i,
  924. rnative = /^[^{]+\{\s*\[native \w/,
  925. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  926. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  927. rsibling = /[+~]/,
  928. rescape = /'|\\/g,
  929. // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  930. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  931. funescape = function( _, escaped, escapedWhitespace ) {
  932. var high = "0x" + escaped - 0x10000;
  933. // NaN means non-codepoint
  934. // Support: Firefox
  935. // Workaround erroneous numeric interpretation of +"0x"
  936. return high !== high || escapedWhitespace ?
  937. escaped :
  938. high < 0 ?
  939. // BMP codepoint
  940. String.fromCharCode( high + 0x10000 ) :
  941. // Supplemental Plane codepoint (surrogate pair)
  942. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  943. };
  944. // Optimize for push.apply( _, NodeList )
  945. try {
  946. push.apply(
  947. (arr = slice.call( preferredDoc.childNodes )),
  948. preferredDoc.childNodes
  949. );
  950. // Support: Android<4.0
  951. // Detect silently failing push.apply
  952. arr[ preferredDoc.childNodes.length ].nodeType;
  953. } catch ( e ) {
  954. push = { apply: arr.length ?
  955. // Leverage slice if possible
  956. function( target, els ) {
  957. push_native.apply( target, slice.call(els) );
  958. } :
  959. // Support: IE<9
  960. // Otherwise append directly
  961. function( target, els ) {
  962. var j = target.length,
  963. i = 0;
  964. // Can't trust NodeList.length
  965. while ( (target[j++] = els[i++]) ) {}
  966. target.length = j - 1;
  967. }
  968. };
  969. }
  970. function Sizzle( selector, context, results, seed ) {
  971. var match, elem, m, nodeType,
  972. // QSA vars
  973. i, groups, old, nid, newContext, newSelector;
  974. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  975. setDocument( context );
  976. }
  977. context = context || document;
  978. results = results || [];
  979. if ( !selector || typeof selector !== "string" ) {
  980. return results;
  981. }
  982. if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
  983. return [];
  984. }
  985. if ( documentIsHTML && !seed ) {
  986. // Shortcuts
  987. if ( (match = rquickExpr.exec( selector )) ) {
  988. // Speed-up: Sizzle("#ID")
  989. if ( (m = match[1]) ) {
  990. if ( nodeType === 9 ) {
  991. elem = context.getElementById( m );
  992. // Check parentNode to catch when Blackberry 4.6 returns
  993. // nodes that are no longer in the document (jQuery #6963)
  994. if ( elem && elem.parentNode ) {
  995. // Handle the case where IE, Opera, and Webkit return items
  996. // by name instead of ID
  997. if ( elem.id === m ) {
  998. results.push( elem );
  999. return results;
  1000. }
  1001. } else {
  1002. return results;
  1003. }
  1004. } else {
  1005. // Context is not a document
  1006. if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
  1007. contains( context, elem ) && elem.id === m ) {
  1008. results.push( elem );
  1009. return results;
  1010. }
  1011. }
  1012. // Speed-up: Sizzle("TAG")
  1013. } else if ( match[2] ) {
  1014. push.apply( results, context.getElementsByTagName( selector ) );
  1015. return results;
  1016. // Speed-up: Sizzle(".CLASS")
  1017. } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
  1018. push.apply( results, context.getElementsByClassName( m ) );
  1019. return results;
  1020. }
  1021. }
  1022. // QSA path
  1023. if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  1024. nid = old = expando;
  1025. newContext = context;
  1026. newSelector = nodeType === 9 && selector;
  1027. // qSA works strangely on Element-rooted queries
  1028. // We can work around this by specifying an extra ID on the root
  1029. // and working up from there (Thanks to Andrew Dupont for the technique)
  1030. // IE 8 doesn't work on object elements
  1031. if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
  1032. groups = tokenize( selector );
  1033. if ( (old = context.getAttribute("id")) ) {
  1034. nid = old.replace( rescape, "\\$&" );
  1035. } else {
  1036. context.setAttribute( "id", nid );
  1037. }
  1038. nid = "[id='" + nid + "'] ";
  1039. i = groups.length;
  1040. while ( i-- ) {
  1041. groups[i] = nid + toSelector( groups[i] );
  1042. }
  1043. newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
  1044. newSelector = groups.join(",");
  1045. }
  1046. if ( newSelector ) {
  1047. try {
  1048. push.apply( results,
  1049. newContext.querySelectorAll( newSelector )
  1050. );
  1051. return results;
  1052. } catch(qsaError) {
  1053. } finally {
  1054. if ( !old ) {
  1055. context.removeAttribute("id");
  1056. }
  1057. }
  1058. }
  1059. }
  1060. }
  1061. // All others
  1062. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  1063. }
  1064. /**
  1065. * Create key-value caches of limited size
  1066. * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
  1067. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  1068. * deleting the oldest entry
  1069. */
  1070. function createCache() {
  1071. var keys = [];
  1072. function cache( key, value ) {
  1073. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  1074. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  1075. // Only keep the most recent entries
  1076. delete cache[ keys.shift() ];
  1077. }
  1078. return (cache[ key + " " ] = value);
  1079. }
  1080. return cache;
  1081. }
  1082. /**
  1083. * Mark a function for special use by Sizzle
  1084. * @param {Function} fn The function to mark
  1085. */
  1086. function markFunction( fn ) {
  1087. fn[ expando ] = true;
  1088. return fn;
  1089. }
  1090. /**
  1091. * Support testing using an element
  1092. * @param {Function} fn Passed the created div and expects a boolean result
  1093. */
  1094. function assert( fn ) {
  1095. var div = document.createElement("div");
  1096. try {
  1097. return !!fn( div );
  1098. } catch (e) {
  1099. return false;
  1100. } finally {
  1101. // Remove from its parent by default
  1102. if ( div.parentNode ) {
  1103. div.parentNode.removeChild( div );
  1104. }
  1105. // release memory in IE
  1106. div = null;
  1107. }
  1108. }
  1109. /**
  1110. * Adds the same handler for all of the specified attrs
  1111. * @param {String} attrs Pipe-separated list of attributes
  1112. * @param {Function} handler The method that will be applied
  1113. */
  1114. function addHandle( attrs, handler ) {
  1115. var arr = attrs.split("|"),
  1116. i = attrs.length;
  1117. while ( i-- ) {
  1118. Expr.attrHandle[ arr[i] ] = handler;
  1119. }
  1120. }
  1121. /**
  1122. * Checks document order of two siblings
  1123. * @param {Element} a
  1124. * @param {Element} b
  1125. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  1126. */
  1127. function siblingCheck( a, b ) {
  1128. var cur = b && a,
  1129. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  1130. ( ~b.sourceIndex || MAX_NEGATIVE ) -
  1131. ( ~a.sourceIndex || MAX_NEGATIVE );
  1132. // Use IE sourceIndex if available on both nodes
  1133. if ( diff ) {
  1134. return diff;
  1135. }
  1136. // Check if b follows a
  1137. if ( cur ) {
  1138. while ( (cur = cur.nextSibling) ) {
  1139. if ( cur === b ) {
  1140. return -1;
  1141. }
  1142. }
  1143. }
  1144. return a ? 1 : -1;
  1145. }
  1146. /**
  1147. * Returns a function to use in pseudos for input types
  1148. * @param {String} type
  1149. */
  1150. function createInputPseudo( type ) {
  1151. return function( elem ) {
  1152. var name = elem.nodeName.toLowerCase();
  1153. return name === "input" && elem.type === type;
  1154. };
  1155. }
  1156. /**
  1157. * Returns a function to use in pseudos for buttons
  1158. * @param {String} type
  1159. */
  1160. function createButtonPseudo( type ) {
  1161. return function( elem ) {
  1162. var name = elem.nodeName.toLowerCase();
  1163. return (name === "input" || name === "button") && elem.type === type;
  1164. };
  1165. }
  1166. /**
  1167. * Returns a function to use in pseudos for positionals
  1168. * @param {Function} fn
  1169. */
  1170. function createPositionalPseudo( fn ) {
  1171. return markFunction(function( argument ) {
  1172. argument = +argument;
  1173. return markFunction(function( seed, matches ) {
  1174. var j,
  1175. matchIndexes = fn( [], seed.length, argument ),
  1176. i = matchIndexes.length;
  1177. // Match elements found at the specified indexes
  1178. while ( i-- ) {
  1179. if ( seed[ (j = matchIndexes[i]) ] ) {
  1180. seed[j] = !(matches[j] = seed[j]);
  1181. }
  1182. }
  1183. });
  1184. });
  1185. }
  1186. /**
  1187. * Checks a node for validity as a Sizzle context
  1188. * @param {Element|Object=} context
  1189. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  1190. */
  1191. function testContext( context ) {
  1192. return context && typeof context.getElementsByTagName !== strundefined && context;
  1193. }
  1194. // Expose support vars for convenience
  1195. support = Sizzle.support = {};
  1196. /**
  1197. * Detects XML nodes
  1198. * @param {Element|Object} elem An element or a document
  1199. * @returns {Boolean} True iff elem is a non-HTML XML node
  1200. */
  1201. isXML = Sizzle.isXML = function( elem ) {
  1202. // documentElement is verified for cases where it doesn't yet exist
  1203. // (such as loading iframes in IE - #4833)
  1204. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  1205. return documentElement ? documentElement.nodeName !== "HTML" : false;
  1206. };
  1207. /**
  1208. * Sets document-related variables once based on the current document
  1209. * @param {Element|Object} [doc] An element or document object to use to set the document
  1210. * @returns {Object} Returns the current document
  1211. */
  1212. setDocument = Sizzle.setDocument = function( node ) {
  1213. var hasCompare,
  1214. doc = node ? node.ownerDocument || node : preferredDoc,
  1215. parent = doc.defaultView;
  1216. // If no document and documentElement is available, return
  1217. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  1218. return document;
  1219. }
  1220. // Set our document
  1221. document = doc;
  1222. docElem = doc.documentElement;
  1223. // Support tests
  1224. documentIsHTML = !isXML( doc );
  1225. // Support: IE>8
  1226. // If iframe document is assigned to "document" variable and if iframe has been reloaded,
  1227. // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
  1228. // IE6-8 do not support the defaultView property so parent will be undefined
  1229. if ( parent && parent !== parent.top ) {
  1230. // IE11 does not have attachEvent, so all must suffer
  1231. if ( parent.addEventListener ) {
  1232. parent.addEventListener( "unload", function() {
  1233. setDocument();
  1234. }, false );
  1235. } else if ( parent.attachEvent ) {
  1236. parent.attachEvent( "onunload", function() {
  1237. setDocument();
  1238. });
  1239. }
  1240. }
  1241. /* Attributes
  1242. ---------------------------------------------------------------------- */
  1243. // Support: IE<8
  1244. // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
  1245. support.attributes = assert(function( div ) {
  1246. div.className = "i";
  1247. return !div.getAttribute("className");
  1248. });
  1249. /* getElement(s)By*
  1250. ---------------------------------------------------------------------- */
  1251. // Check if getElementsByTagName("*") returns only elements
  1252. support.getElementsByTagName = assert(function( div ) {
  1253. div.appendChild( doc.createComment("") );
  1254. return !div.getElementsByTagName("*").length;
  1255. });
  1256. // Check if getElementsByClassName can be trusted
  1257. support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) {
  1258. div.innerHTML = "<div class='a'></div><div class='a i'></div>";
  1259. // Support: Safari<4
  1260. // Catch class over-caching
  1261. div.firstChild.className = "i";
  1262. // Support: Opera<10
  1263. // Catch gEBCN failure to find non-leading classes
  1264. return div.getElementsByClassName("i").length === 2;
  1265. });
  1266. // Support: IE<10
  1267. // Check if getElementById returns elements by name
  1268. // The broken getElementById methods don't pick up programatically-set names,
  1269. // so use a roundabout getElementsByName test
  1270. support.getById = assert(function( div ) {
  1271. docElem.appendChild( div ).id = expando;
  1272. return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
  1273. });
  1274. // ID find and filter
  1275. if ( support.getById ) {
  1276. Expr.find["ID"] = function( id, context ) {
  1277. if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
  1278. var m = context.getElementById( id );
  1279. // Check parentNode to catch when Blackberry 4.6 returns
  1280. // nodes that are no longer in the document #6963
  1281. return m && m.parentNode ? [m] : [];
  1282. }
  1283. };
  1284. Expr.filter["ID"] = function( id ) {
  1285. var attrId = id.replace( runescape, funescape );
  1286. return function( elem ) {
  1287. return elem.getAttribute("id") === attrId;
  1288. };
  1289. };
  1290. } else {
  1291. // Support: IE6/7
  1292. // getElementById is not reliable as a find shortcut
  1293. delete Expr.find["ID"];
  1294. Expr.filter["ID"] = function( id ) {
  1295. var attrId = id.replace( runescape, funescape );
  1296. return function( elem ) {
  1297. var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
  1298. return node && node.value === attrId;
  1299. };
  1300. };
  1301. }
  1302. // Tag
  1303. Expr.find["TAG"] = support.getElementsByTagName ?
  1304. function( tag, context ) {
  1305. if ( typeof context.getElementsByTagName !== strundefined ) {
  1306. return context.getElementsByTagName( tag );
  1307. }
  1308. } :
  1309. function( tag, context ) {
  1310. var elem,
  1311. tmp = [],
  1312. i = 0,
  1313. results = context.getElementsByTagName( tag );
  1314. // Filter out possible comments
  1315. if ( tag === "*" ) {
  1316. while ( (elem = results[i++]) ) {
  1317. if ( elem.nodeType === 1 ) {
  1318. tmp.push( elem );
  1319. }
  1320. }
  1321. return tmp;
  1322. }
  1323. return results;
  1324. };
  1325. // Class
  1326. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  1327. if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
  1328. return context.getElementsByClassName( className );
  1329. }
  1330. };
  1331. /* QSA/matchesSelector
  1332. ---------------------------------------------------------------------- */
  1333. // QSA and matchesSelector support
  1334. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  1335. rbuggyMatches = [];
  1336. // qSa(:focus) reports false when true (Chrome 21)
  1337. // We allow this because of a bug in IE8/9 that throws an error
  1338. // whenever `document.activeElement` is accessed on an iframe
  1339. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  1340. // See http://bugs.jquery.com/ticket/13378
  1341. rbuggyQSA = [];
  1342. if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
  1343. // Build QSA regex
  1344. // Regex strategy adopted from Diego Perini
  1345. assert(function( div ) {
  1346. // Select is set to empty string on purpose
  1347. // This is to test IE's treatment of not explicitly
  1348. // setting a boolean content attribute,
  1349. // since its presence should be enough
  1350. // http://bugs.jquery.com/ticket/12359
  1351. div.innerHTML = "<select t=''><option selected=''></option></select>";
  1352. // Support: IE8, Opera 10-12
  1353. // Nothing should be selected when empty strings follow ^= or $= or *=
  1354. if ( div.querySelectorAll("[t^='']").length ) {
  1355. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  1356. }
  1357. // Support: IE8
  1358. // Boolean attributes and "value" are not treated correctly
  1359. if ( !div.querySelectorAll("[selected]").length ) {
  1360. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1361. }
  1362. // Webkit/Opera - :checked should return selected option elements
  1363. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1364. // IE8 throws error here and will not see later tests
  1365. if ( !div.querySelectorAll(":checked").length ) {
  1366. rbuggyQSA.push(":checked");
  1367. }
  1368. });
  1369. assert(function( div ) {
  1370. // Support: Windows 8 Native Apps
  1371. // The type and name attributes are restricted during .innerHTML assignment
  1372. var input = doc.createElement("input");
  1373. input.setAttribute( "type", "hidden" );
  1374. div.appendChild( input ).setAttribute( "name", "D" );
  1375. // Support: IE8
  1376. // Enforce case-sensitivity of name attribute
  1377. if ( div.querySelectorAll("[name=d]").length ) {
  1378. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1379. }
  1380. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1381. // IE8 throws error here and will not see later tests
  1382. if ( !div.querySelectorAll(":enabled").length ) {
  1383. rbuggyQSA.push( ":enabled", ":disabled" );
  1384. }
  1385. // Opera 10-11 does not throw on post-comma invalid pseudos
  1386. div.querySelectorAll("*,:x");
  1387. rbuggyQSA.push(",.*:");
  1388. });
  1389. }
  1390. if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector ||
  1391. docElem.mozMatchesSelector ||
  1392. docElem.oMatchesSelector ||
  1393. docElem.msMatchesSelector) )) ) {
  1394. assert(function( div ) {
  1395. // Check to see if it's possible to do matchesSelector
  1396. // on a disconnected node (IE 9)
  1397. support.disconnectedMatch = matches.call( div, "div" );
  1398. // This should fail with an exception
  1399. // Gecko does not error, returns false instead
  1400. matches.call( div, "[s!='']:x" );
  1401. rbuggyMatches.push( "!=", pseudos );
  1402. });
  1403. }
  1404. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  1405. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  1406. /* Contains
  1407. ---------------------------------------------------------------------- */
  1408. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1409. // Element contains another
  1410. // Purposefully does not implement inclusive descendent
  1411. // As in, an element does not contain itself
  1412. contains = hasCompare || rnative.test( docElem.contains ) ?
  1413. function( a, b ) {
  1414. var adown = a.nodeType === 9 ? a.documentElement : a,
  1415. bup = b && b.parentNode;
  1416. return a === bup || !!( bup && bup.nodeType === 1 && (
  1417. adown.contains ?
  1418. adown.contains( bup ) :
  1419. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1420. ));
  1421. } :
  1422. function( a, b ) {
  1423. if ( b ) {
  1424. while ( (b = b.parentNode) ) {
  1425. if ( b === a ) {
  1426. return true;
  1427. }
  1428. }
  1429. }
  1430. return false;
  1431. };
  1432. /* Sorting
  1433. ---------------------------------------------------------------------- */
  1434. // Document order sorting
  1435. sortOrder = hasCompare ?
  1436. function( a, b ) {
  1437. // Flag for duplicate removal
  1438. if ( a === b ) {
  1439. hasDuplicate = true;
  1440. return 0;
  1441. }
  1442. // Sort on method existence if only one input has compareDocumentPosition
  1443. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1444. if ( compare ) {
  1445. return compare;
  1446. }
  1447. // Calculate position if both inputs belong to the same document
  1448. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  1449. a.compareDocumentPosition( b ) :
  1450. // Otherwise we know they are disconnected
  1451. 1;
  1452. // Disconnected nodes
  1453. if ( compare & 1 ||
  1454. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  1455. // Choose the first element that is related to our preferred document
  1456. if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  1457. return -1;
  1458. }
  1459. if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  1460. return 1;
  1461. }
  1462. // Maintain original order
  1463. return sortInput ?
  1464. ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
  1465. 0;
  1466. }
  1467. return compare & 4 ? -1 : 1;
  1468. } :
  1469. function( a, b ) {
  1470. // Exit early if the nodes are identical
  1471. if ( a === b ) {
  1472. hasDuplicate = true;
  1473. return 0;
  1474. }
  1475. var cur,
  1476. i = 0,
  1477. aup = a.parentNode,
  1478. bup = b.parentNode,
  1479. ap = [ a ],
  1480. bp = [ b ];
  1481. // Parentless nodes are either documents or disconnected
  1482. if ( !aup || !bup ) {
  1483. return a === doc ? -1 :
  1484. b === doc ? 1 :
  1485. aup ? -1 :
  1486. bup ? 1 :
  1487. sortInput ?
  1488. ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
  1489. 0;
  1490. // If the nodes are siblings, we can do a quick check
  1491. } else if ( aup === bup ) {
  1492. return siblingCheck( a, b );
  1493. }
  1494. // Otherwise we need full lists of their ancestors for comparison
  1495. cur = a;
  1496. while ( (cur = cur.parentNode) ) {
  1497. ap.unshift( cur );
  1498. }
  1499. cur = b;
  1500. while ( (cur = cur.parentNode) ) {
  1501. bp.unshift( cur );
  1502. }
  1503. // Walk down the tree looking for a discrepancy
  1504. while ( ap[i] === bp[i] ) {
  1505. i++;
  1506. }
  1507. return i ?
  1508. // Do a sibling check if the nodes have a common ancestor
  1509. siblingCheck( ap[i], bp[i] ) :
  1510. // Otherwise nodes in our document sort first
  1511. ap[i] === preferredDoc ? -1 :
  1512. bp[i] === preferredDoc ? 1 :
  1513. 0;
  1514. };
  1515. return doc;
  1516. };
  1517. Sizzle.matches = function( expr, elements ) {
  1518. return Sizzle( expr, null, null, elements );
  1519. };
  1520. Sizzle.matchesSelector = function( elem, expr ) {
  1521. // Set document vars if needed
  1522. if ( ( elem.ownerDocument || elem ) !== document ) {
  1523. setDocument( elem );
  1524. }
  1525. // Make sure that attribute selectors are quoted
  1526. expr = expr.replace( rattributeQuotes, "='$1']" );
  1527. if ( support.matchesSelector && documentIsHTML &&
  1528. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  1529. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  1530. try {
  1531. var ret = matches.call( elem, expr );
  1532. // IE 9's matchesSelector returns false on disconnected nodes
  1533. if ( ret || support.disconnectedMatch ||
  1534. // As well, disconnected nodes are said to be in a document
  1535. // fragment in IE 9
  1536. elem.document && elem.document.nodeType !== 11 ) {
  1537. return ret;
  1538. }
  1539. } catch(e) {}
  1540. }
  1541. return Sizzle( expr, document, null, [elem] ).length > 0;
  1542. };
  1543. Sizzle.contains = function( context, elem ) {
  1544. // Set document vars if needed
  1545. if ( ( context.ownerDocument || context ) !== document ) {
  1546. setDocument( context );
  1547. }
  1548. return contains( context, elem );
  1549. };
  1550. Sizzle.attr = function( elem, name ) {
  1551. // Set document vars if needed
  1552. if ( ( elem.ownerDocument || elem ) !== document ) {
  1553. setDocument( elem );
  1554. }
  1555. var fn = Expr.attrHandle[ name.toLowerCase() ],
  1556. // Don't get fooled by Object.prototype properties (jQuery #13807)
  1557. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  1558. fn( elem, name, !documentIsHTML ) :
  1559. undefined;
  1560. return val !== undefined ?
  1561. val :
  1562. support.attributes || !documentIsHTML ?
  1563. elem.getAttribute( name ) :
  1564. (val = elem.getAttributeNode(name)) && val.specified ?
  1565. val.value :
  1566. null;
  1567. };
  1568. Sizzle.error = function( msg ) {
  1569. throw new Error( "Syntax error, unrecognized expression: " + msg );
  1570. };
  1571. /**
  1572. * Document sorting and removing duplicates
  1573. * @param {ArrayLike} results
  1574. */
  1575. Sizzle.uniqueSort = function( results ) {
  1576. var elem,
  1577. duplicates = [],
  1578. j = 0,
  1579. i = 0;
  1580. // Unless we *know* we can detect duplicates, assume their presence
  1581. hasDuplicate = !support.detectDuplicates;
  1582. sortInput = !support.sortStable && results.slice( 0 );
  1583. results.sort( sortOrder );
  1584. if ( hasDuplicate ) {
  1585. while ( (elem = results[i++]) ) {
  1586. if ( elem === results[ i ] ) {
  1587. j = duplicates.push( i );
  1588. }
  1589. }
  1590. while ( j-- ) {
  1591. results.splice( duplicates[ j ], 1 );
  1592. }
  1593. }
  1594. // Clear input after sorting to release objects
  1595. // See https://github.com/jquery/sizzle/pull/225
  1596. sortInput = null;
  1597. return results;
  1598. };
  1599. /**
  1600. * Utility function for retrieving the text value of an array of DOM nodes
  1601. * @param {Array|Element} elem
  1602. */
  1603. getText = Sizzle.getText = function( elem ) {
  1604. var node,
  1605. ret = "",
  1606. i = 0,
  1607. nodeType = elem.nodeType;
  1608. if ( !nodeType ) {
  1609. // If no nodeType, this is expected to be an array
  1610. while ( (node = elem[i++]) ) {
  1611. // Do not traverse comment nodes
  1612. ret += getText( node );
  1613. }
  1614. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  1615. // Use textContent for elements
  1616. // innerText usage removed for consistency of new lines (jQuery #11153)
  1617. if ( typeof elem.textContent === "string" ) {
  1618. return elem.textContent;
  1619. } else {
  1620. // Traverse its children
  1621. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1622. ret += getText( elem );
  1623. }
  1624. }
  1625. } else if ( nodeType === 3 || nodeType === 4 ) {
  1626. return elem.nodeValue;
  1627. }
  1628. // Do not include comment or processing instruction nodes
  1629. return ret;
  1630. };
  1631. Expr = Sizzle.selectors = {
  1632. // Can be adjusted by the user
  1633. cacheLength: 50,
  1634. createPseudo: markFunction,
  1635. match: matchExpr,
  1636. attrHandle: {},
  1637. find: {},
  1638. relative: {
  1639. ">": { dir: "parentNode", first: true },
  1640. " ": { dir: "parentNode" },
  1641. "+": { dir: "previousSibling", first: true },
  1642. "~": { dir: "previousSibling" }
  1643. },
  1644. preFilter: {
  1645. "ATTR": function( match ) {
  1646. match[1] = match[1].replace( runescape, funescape );
  1647. // Move the given value to match[3] whether quoted or unquoted
  1648. match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
  1649. if ( match[2] === "~=" ) {
  1650. match[3] = " " + match[3] + " ";
  1651. }
  1652. return match.slice( 0, 4 );
  1653. },
  1654. "CHILD": function( match ) {
  1655. /* matches from matchExpr["CHILD"]
  1656. 1 type (only|nth|...)
  1657. 2 what (child|of-type)
  1658. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  1659. 4 xn-component of xn+y argument ([+-]?\d*n|)
  1660. 5 sign of xn-component
  1661. 6 x of xn-component
  1662. 7 sign of y-component
  1663. 8 y of y-component
  1664. */
  1665. match[1] = match[1].toLowerCase();
  1666. if ( match[1].slice( 0, 3 ) === "nth" ) {
  1667. // nth-* requires argument
  1668. if ( !match[3] ) {
  1669. Sizzle.error( match[0] );
  1670. }
  1671. // numeric x and y parameters for Expr.filter.CHILD
  1672. // remember that false/true cast respectively to 0/1
  1673. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  1674. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  1675. // other types prohibit arguments
  1676. } else if ( match[3] ) {
  1677. Sizzle.error( match[0] );
  1678. }
  1679. return match;
  1680. },
  1681. "PSEUDO": function( match ) {
  1682. var excess,
  1683. unquoted = !match[5] && match[2];
  1684. if ( matchExpr["CHILD"].test( match[0] ) ) {
  1685. return null;
  1686. }
  1687. // Accept quoted arguments as-is
  1688. if ( match[3] && match[4] !== undefined ) {
  1689. match[2] = match[4];
  1690. // Strip excess characters from unquoted arguments
  1691. } else if ( unquoted && rpseudo.test( unquoted ) &&
  1692. // Get excess from tokenize (recursively)
  1693. (excess = tokenize( unquoted, true )) &&
  1694. // advance to the next closing parenthesis
  1695. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  1696. // excess is a negative index
  1697. match[0] = match[0].slice( 0, excess );
  1698. match[2] = unquoted.slice( 0, excess );
  1699. }
  1700. // Return only captures needed by the pseudo filter method (type and argument)
  1701. return match.slice( 0, 3 );
  1702. }
  1703. },
  1704. filter: {
  1705. "TAG": function( nodeNameSelector ) {
  1706. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  1707. return nodeNameSelector === "*" ?
  1708. function() { return true; } :
  1709. function( elem ) {
  1710. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  1711. };
  1712. },
  1713. "CLASS": function( className ) {
  1714. var pattern = classCache[ className + " " ];
  1715. return pattern ||
  1716. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  1717. classCache( className, function( elem ) {
  1718. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
  1719. });
  1720. },
  1721. "ATTR": function( name, operator, check ) {
  1722. return function( elem ) {
  1723. var result = Sizzle.attr( elem, name );
  1724. if ( result == null ) {
  1725. return operator === "!=";
  1726. }
  1727. if ( !operator ) {
  1728. return true;
  1729. }
  1730. result += "";
  1731. return operator === "=" ? result === check :
  1732. operator === "!=" ? result !== check :
  1733. operator === "^=" ? check && result.indexOf( check ) === 0 :
  1734. operator === "*=" ? check && result.indexOf( check ) > -1 :
  1735. operator === "$=" ? check && result.slice( -check.length ) === check :
  1736. operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
  1737. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  1738. false;
  1739. };
  1740. },
  1741. "CHILD": function( type, what, argument, first, last ) {
  1742. var simple = type.slice( 0, 3 ) !== "nth",
  1743. forward = type.slice( -4 ) !== "last",
  1744. ofType = what === "of-type";
  1745. return first === 1 && last === 0 ?
  1746. // Shortcut for :nth-*(n)
  1747. function( elem ) {
  1748. return !!elem.parentNode;
  1749. } :
  1750. function( elem, context, xml ) {
  1751. var cache, outerCache, node, diff, nodeIndex, start,
  1752. dir = simple !== forward ? "nextSibling" : "previousSibling",
  1753. parent = elem.parentNode,
  1754. name = ofType && elem.nodeName.toLowerCase(),
  1755. useCache = !xml && !ofType;
  1756. if ( parent ) {
  1757. // :(first|last|only)-(child|of-type)
  1758. if ( simple ) {
  1759. while ( dir ) {
  1760. node = elem;
  1761. while ( (node = node[ dir ]) ) {
  1762. if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
  1763. return false;
  1764. }
  1765. }
  1766. // Reverse direction for :only-* (if we haven't yet done so)
  1767. start = dir = type === "only" && !start && "nextSibling";
  1768. }
  1769. return true;
  1770. }
  1771. start = [ forward ? parent.firstChild : parent.lastChild ];
  1772. // non-xml :nth-child(...) stores cache data on `parent`
  1773. if ( forward && useCache ) {
  1774. // Seek `elem` from a previously-cached index
  1775. outerCache = parent[ expando ] || (parent[ expando ] = {});
  1776. cache = outerCache[ type ] || [];
  1777. nodeIndex = cache[0] === dirruns && cache[1];
  1778. diff = cache[0] === dirruns && cache[2];
  1779. node = nodeIndex && parent.childNodes[ nodeIndex ];
  1780. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1781. // Fallback to seeking `elem` from the start
  1782. (diff = nodeIndex = 0) || start.pop()) ) {
  1783. // When found, cache indexes on `parent` and break
  1784. if ( node.nodeType === 1 && ++diff && node === elem ) {
  1785. outerCache[ type ] = [ dirruns, nodeIndex, diff ];
  1786. break;
  1787. }
  1788. }
  1789. // Use previously-cached element index if available
  1790. } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
  1791. diff = cache[1];
  1792. // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
  1793. } else {
  1794. // Use the same loop as above to seek `elem` from the start
  1795. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1796. (diff = nodeIndex = 0) || start.pop()) ) {
  1797. if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
  1798. // Cache the index of each encountered element
  1799. if ( useCache ) {
  1800. (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
  1801. }
  1802. if ( node === elem ) {
  1803. break;
  1804. }
  1805. }
  1806. }
  1807. }
  1808. // Incorporate the offset, then check against cycle size
  1809. diff -= last;
  1810. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  1811. }
  1812. };
  1813. },
  1814. "PSEUDO": function( pseudo, argument ) {
  1815. // pseudo-class names are case-insensitive
  1816. // http://www.w3.org/TR/selectors/#pseudo-classes
  1817. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  1818. // Remember that setFilters inherits from pseudos
  1819. var args,
  1820. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  1821. Sizzle.error( "unsupported pseudo: " + pseudo );
  1822. // The user may use createPseudo to indicate that
  1823. // arguments are needed to create the filter function
  1824. // just as Sizzle does
  1825. if ( fn[ expando ] ) {
  1826. return fn( argument );
  1827. }
  1828. // But maintain support for old signatures
  1829. if ( fn.length > 1 ) {
  1830. args = [ pseudo, pseudo, "", argument ];
  1831. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  1832. markFunction(function( seed, matches ) {
  1833. var idx,
  1834. matched = fn( seed, argument ),
  1835. i = matched.length;
  1836. while ( i-- ) {
  1837. idx = indexOf.call( seed, matched[i] );
  1838. seed[ idx ] = !( matches[ idx ] = matched[i] );
  1839. }
  1840. }) :
  1841. function( elem ) {
  1842. return fn( elem, 0, args );
  1843. };
  1844. }
  1845. return fn;
  1846. }
  1847. },
  1848. pseudos: {
  1849. // Potentially complex pseudos
  1850. "not": markFunction(function( selector ) {
  1851. // Trim the selector passed to compile
  1852. // to avoid treating leading and trailing
  1853. // spaces as combinators
  1854. var input = [],
  1855. results = [],
  1856. matcher = compile( selector.replace( rtrim, "$1" ) );
  1857. return matcher[ expando ] ?
  1858. markFunction(function( seed, matches, context, xml ) {
  1859. var elem,
  1860. unmatched = matcher( seed, null, xml, [] ),
  1861. i = seed.length;
  1862. // Match elements unmatched by `matcher`
  1863. while ( i-- ) {
  1864. if ( (elem = unmatched[i]) ) {
  1865. seed[i] = !(matches[i] = elem);
  1866. }
  1867. }
  1868. }) :
  1869. function( elem, context, xml ) {
  1870. input[0] = elem;
  1871. matcher( input, null, xml, results );
  1872. return !results.pop();
  1873. };
  1874. }),
  1875. "has": markFunction(function( selector ) {
  1876. return function( elem ) {
  1877. return Sizzle( selector, elem ).length > 0;
  1878. };
  1879. }),
  1880. "contains": markFunction(function( text ) {
  1881. return function( elem ) {
  1882. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  1883. };
  1884. }),
  1885. // "Whether an element is represented by a :lang() selector
  1886. // is based solely on the element's language value
  1887. // being equal to the identifier C,
  1888. // or beginning with the identifier C immediately followed by "-".
  1889. // The matching of C against the element's language value is performed case-insensitively.
  1890. // The identifier C does not have to be a valid language name."
  1891. // http://www.w3.org/TR/selectors/#lang-pseudo
  1892. "lang": markFunction( function( lang ) {
  1893. // lang value must be a valid identifier
  1894. if ( !ridentifier.test(lang || "") ) {
  1895. Sizzle.error( "unsupported lang: " + lang );
  1896. }
  1897. lang = lang.replace( runescape, funescape ).toLowerCase();
  1898. return function( elem ) {
  1899. var elemLang;
  1900. do {
  1901. if ( (elemLang = documentIsHTML ?
  1902. elem.lang :
  1903. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  1904. elemLang = elemLang.toLowerCase();
  1905. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  1906. }
  1907. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  1908. return false;
  1909. };
  1910. }),
  1911. // Miscellaneous
  1912. "target": function( elem ) {
  1913. var hash = window.location && window.location.hash;
  1914. return hash && hash.slice( 1 ) === elem.id;
  1915. },
  1916. "root": function( elem ) {
  1917. return elem === docElem;
  1918. },
  1919. "focus": function( elem ) {
  1920. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  1921. },
  1922. // Boolean properties
  1923. "enabled": function( elem ) {
  1924. return elem.disabled === false;
  1925. },
  1926. "disabled": function( elem ) {
  1927. return elem.disabled === true;
  1928. },
  1929. "checked": function( elem ) {
  1930. // In CSS3, :checked should return both checked and selected elements
  1931. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1932. var nodeName = elem.nodeName.toLowerCase();
  1933. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  1934. },
  1935. "selected": function( elem ) {
  1936. // Accessing this property makes selected-by-default
  1937. // options in Safari work properly
  1938. if ( elem.parentNode ) {
  1939. elem.parentNode.selectedIndex;
  1940. }
  1941. return elem.selected === true;
  1942. },
  1943. // Contents
  1944. "empty": function( elem ) {
  1945. // http://www.w3.org/TR/selectors/#empty-pseudo
  1946. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  1947. // but not by others (comment: 8; processing instruction: 7; etc.)
  1948. // nodeType < 6 works because attributes (2) do not appear as children
  1949. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1950. if ( elem.nodeType < 6 ) {
  1951. return false;
  1952. }
  1953. }
  1954. return true;
  1955. },
  1956. "parent": function( elem ) {
  1957. return !Expr.pseudos["empty"]( elem );
  1958. },
  1959. // Element/input types
  1960. "header": function( elem ) {
  1961. return rheader.test( elem.nodeName );
  1962. },
  1963. "input": function( elem ) {
  1964. return rinputs.test( elem.nodeName );
  1965. },
  1966. "button": function( elem ) {
  1967. var name = elem.nodeName.toLowerCase();
  1968. return name === "input" && elem.type === "button" || name === "button";
  1969. },
  1970. "text": function( elem ) {
  1971. var attr;
  1972. return elem.nodeName.toLowerCase() === "input" &&
  1973. elem.type === "text" &&
  1974. // Support: IE<8
  1975. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  1976. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  1977. },
  1978. // Position-in-collection
  1979. "first": createPositionalPseudo(function() {
  1980. return [ 0 ];
  1981. }),
  1982. "last": createPositionalPseudo(function( matchIndexes, length ) {
  1983. return [ length - 1 ];
  1984. }),
  1985. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1986. return [ argument < 0 ? argument + length : argument ];
  1987. }),
  1988. "even": createPositionalPseudo(function( matchIndexes, length ) {
  1989. var i = 0;
  1990. for ( ; i < length; i += 2 ) {
  1991. matchIndexes.push( i );
  1992. }
  1993. return matchIndexes;
  1994. }),
  1995. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  1996. var i = 1;
  1997. for ( ; i < length; i += 2 ) {
  1998. matchIndexes.push( i );
  1999. }
  2000. return matchIndexes;
  2001. }),
  2002. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2003. var i = argument < 0 ? argument + length : argument;
  2004. for ( ; --i >= 0; ) {
  2005. matchIndexes.push( i );
  2006. }
  2007. return matchIndexes;
  2008. }),
  2009. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2010. var i = argument < 0 ? argument + length : argument;
  2011. for ( ; ++i < length; ) {
  2012. matchIndexes.push( i );
  2013. }
  2014. return matchIndexes;
  2015. })
  2016. }
  2017. };
  2018. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  2019. // Add button/input type pseudos
  2020. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  2021. Expr.pseudos[ i ] = createInputPseudo( i );
  2022. }
  2023. for ( i in { submit: true, reset: true } ) {
  2024. Expr.pseudos[ i ] = createButtonPseudo( i );
  2025. }
  2026. // Easy API for creating new setFilters
  2027. function setFilters() {}
  2028. setFilters.prototype = Expr.filters = Expr.pseudos;
  2029. Expr.setFilters = new setFilters();
  2030. function tokenize( selector, parseOnly ) {
  2031. var matched, match, tokens, type,
  2032. soFar, groups, preFilters,
  2033. cached = tokenCache[ selector + " " ];
  2034. if ( cached ) {
  2035. return parseOnly ? 0 : cached.slice( 0 );
  2036. }
  2037. soFar = selector;
  2038. groups = [];
  2039. preFilters = Expr.preFilter;
  2040. while ( soFar ) {
  2041. // Comma and first run
  2042. if ( !matched || (match = rcomma.exec( soFar )) ) {
  2043. if ( match ) {
  2044. // Don't consume trailing commas as valid
  2045. soFar = soFar.slice( match[0].length ) || soFar;
  2046. }
  2047. groups.push( (tokens = []) );
  2048. }
  2049. matched = false;
  2050. // Combinators
  2051. if ( (match = rcombinators.exec( soFar )) ) {
  2052. matched = match.shift();
  2053. tokens.push({
  2054. value: matched,
  2055. // Cast descendant combinators to space
  2056. type: match[0].replace( rtrim, " " )
  2057. });
  2058. soFar = soFar.slice( matched.length );
  2059. }
  2060. // Filters
  2061. for ( type in Expr.filter ) {
  2062. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  2063. (match = preFilters[ type ]( match ))) ) {
  2064. matched = match.shift();
  2065. tokens.push({
  2066. value: matched,
  2067. type: type,
  2068. matches: match
  2069. });
  2070. soFar = soFar.slice( matched.length );
  2071. }
  2072. }
  2073. if ( !matched ) {
  2074. break;
  2075. }
  2076. }
  2077. // Return the length of the invalid excess
  2078. // if we're just parsing
  2079. // Otherwise, throw an error or return tokens
  2080. return parseOnly ?
  2081. soFar.length :
  2082. soFar ?
  2083. Sizzle.error( selector ) :
  2084. // Cache the tokens
  2085. tokenCache( selector, groups ).slice( 0 );
  2086. }
  2087. function toSelector( tokens ) {
  2088. var i = 0,
  2089. len = tokens.length,
  2090. selector = "";
  2091. for ( ; i < len; i++ ) {
  2092. selector += tokens[i].value;
  2093. }
  2094. return selector;
  2095. }
  2096. function addCombinator( matcher, combinator, base ) {
  2097. var dir = combinator.dir,
  2098. checkNonElements = base && dir === "parentNode",
  2099. doneName = done++;
  2100. return combinator.first ?
  2101. // Check against closest ancestor/preceding element
  2102. function( elem, context, xml ) {
  2103. while ( (elem = elem[ dir ]) ) {
  2104. if ( elem.nodeType === 1 || checkNonElements ) {
  2105. return matcher( elem, context, xml );
  2106. }
  2107. }
  2108. } :
  2109. // Check against all ancestor/preceding elements
  2110. function( elem, context, xml ) {
  2111. var oldCache, outerCache,
  2112. newCache = [ dirruns, doneName ];
  2113. // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
  2114. if ( xml ) {
  2115. while ( (elem = elem[ dir ]) ) {
  2116. if ( elem.nodeType === 1 || checkNonElements ) {
  2117. if ( matcher( elem, context, xml ) ) {
  2118. return true;
  2119. }
  2120. }
  2121. }
  2122. } else {
  2123. while ( (elem = elem[ dir ]) ) {
  2124. if ( elem.nodeType === 1 || checkNonElements ) {
  2125. outerCache = elem[ expando ] || (elem[ expando ] = {});
  2126. if ( (oldCache = outerCache[ dir ]) &&
  2127. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  2128. // Assign to newCache so results back-propagate to previous elements
  2129. return (newCache[ 2 ] = oldCache[ 2 ]);
  2130. } else {
  2131. // Reuse newcache so results back-propagate to previous elements
  2132. outerCache[ dir ] = newCache;
  2133. // A match means we're done; a fail means we have to keep checking
  2134. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  2135. return true;
  2136. }
  2137. }
  2138. }
  2139. }
  2140. }
  2141. };
  2142. }
  2143. function elementMatcher( matchers ) {
  2144. return matchers.length > 1 ?
  2145. function( elem, context, xml ) {
  2146. var i = matchers.length;
  2147. while ( i-- ) {
  2148. if ( !matchers[i]( elem, context, xml ) ) {
  2149. return false;
  2150. }
  2151. }
  2152. return true;
  2153. } :
  2154. matchers[0];
  2155. }
  2156. function condense( unmatched, map, filter, context, xml ) {
  2157. var elem,
  2158. newUnmatched = [],
  2159. i = 0,
  2160. len = unmatched.length,
  2161. mapped = map != null;
  2162. for ( ; i < len; i++ ) {
  2163. if ( (elem = unmatched[i]) ) {
  2164. if ( !filter || filter( elem, context, xml ) ) {
  2165. newUnmatched.push( elem );
  2166. if ( mapped ) {
  2167. map.push( i );
  2168. }
  2169. }
  2170. }
  2171. }
  2172. return newUnmatched;
  2173. }
  2174. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  2175. if ( postFilter && !postFilter[ expando ] ) {
  2176. postFilter = setMatcher( postFilter );
  2177. }
  2178. if ( postFinder && !postFinder[ expando ] ) {
  2179. postFinder = setMatcher( postFinder, postSelector );
  2180. }
  2181. return markFunction(function( seed, results, context, xml ) {
  2182. var temp, i, elem,
  2183. preMap = [],
  2184. postMap = [],
  2185. preexisting = results.length,
  2186. // Get initial elements from seed or context
  2187. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  2188. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  2189. matcherIn = preFilter && ( seed || !selector ) ?
  2190. condense( elems, preMap, preFilter, context, xml ) :
  2191. elems,
  2192. matcherOut = matcher ?
  2193. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  2194. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  2195. // ...intermediate processing is necessary
  2196. [] :
  2197. // ...otherwise use results directly
  2198. results :
  2199. matcherIn;
  2200. // Find primary matches
  2201. if ( matcher ) {
  2202. matcher( matcherIn, matcherOut, context, xml );
  2203. }
  2204. // Apply postFilter
  2205. if ( postFilter ) {
  2206. temp = condense( matcherOut, postMap );
  2207. postFilter( temp, [], context, xml );
  2208. // Un-match failing elements by moving them back to matcherIn
  2209. i = temp.length;
  2210. while ( i-- ) {
  2211. if ( (elem = temp[i]) ) {
  2212. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  2213. }
  2214. }
  2215. }
  2216. if ( seed ) {
  2217. if ( postFinder || preFilter ) {
  2218. if ( postFinder ) {
  2219. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  2220. temp = [];
  2221. i = matcherOut.length;
  2222. while ( i-- ) {
  2223. if ( (elem = matcherOut[i]) ) {
  2224. // Restore matcherIn since elem is not yet a final match
  2225. temp.push( (matcherIn[i] = elem) );
  2226. }
  2227. }
  2228. postFinder( null, (matcherOut = []), temp, xml );
  2229. }
  2230. // Move matched elements from seed to results to keep them synchronized
  2231. i = matcherOut.length;
  2232. while ( i-- ) {
  2233. if ( (elem = matcherOut[i]) &&
  2234. (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
  2235. seed[temp] = !(results[temp] = elem);
  2236. }
  2237. }
  2238. }
  2239. // Add elements to results, through postFinder if defined
  2240. } else {
  2241. matcherOut = condense(
  2242. matcherOut === results ?
  2243. matcherOut.splice( preexisting, matcherOut.length ) :
  2244. matcherOut
  2245. );
  2246. if ( postFinder ) {
  2247. postFinder( null, results, matcherOut, xml );
  2248. } else {
  2249. push.apply( results, matcherOut );
  2250. }
  2251. }
  2252. });
  2253. }
  2254. function matcherFromTokens( tokens ) {
  2255. var checkContext, matcher, j,
  2256. len = tokens.length,
  2257. leadingRelative = Expr.relative[ tokens[0].type ],
  2258. implicitRelative = leadingRelative || Expr.relative[" "],
  2259. i = leadingRelative ? 1 : 0,
  2260. // The foundational matcher ensures that elements are reachable from top-level context(s)
  2261. matchContext = addCombinator( function( elem ) {
  2262. return elem === checkContext;
  2263. }, implicitRelative, true ),
  2264. matchAnyContext = addCombinator( function( elem ) {
  2265. return indexOf.call( checkContext, elem ) > -1;
  2266. }, implicitRelative, true ),
  2267. matchers = [ function( elem, context, xml ) {
  2268. return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  2269. (checkContext = context).nodeType ?
  2270. matchContext( elem, context, xml ) :
  2271. matchAnyContext( elem, context, xml ) );
  2272. } ];
  2273. for ( ; i < len; i++ ) {
  2274. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  2275. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  2276. } else {
  2277. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  2278. // Return special upon seeing a positional matcher
  2279. if ( matcher[ expando ] ) {
  2280. // Find the next relative operator (if any) for proper handling
  2281. j = ++i;
  2282. for ( ; j < len; j++ ) {
  2283. if ( Expr.relative[ tokens[j].type ] ) {
  2284. break;
  2285. }
  2286. }
  2287. return setMatcher(
  2288. i > 1 && elementMatcher( matchers ),
  2289. i > 1 && toSelector(
  2290. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2291. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  2292. ).replace( rtrim, "$1" ),
  2293. matcher,
  2294. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  2295. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  2296. j < len && toSelector( tokens )
  2297. );
  2298. }
  2299. matchers.push( matcher );
  2300. }
  2301. }
  2302. return elementMatcher( matchers );
  2303. }
  2304. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  2305. var bySet = setMatchers.length > 0,
  2306. byElement = elementMatchers.length > 0,
  2307. superMatcher = function( seed, context, xml, results, outermost ) {
  2308. var elem, j, matcher,
  2309. matchedCount = 0,
  2310. i = "0",
  2311. unmatched = seed && [],
  2312. setMatched = [],
  2313. contextBackup = outermostContext,
  2314. // We must always have either seed elements or outermost context
  2315. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  2316. // Use integer dirruns iff this is the outermost matcher
  2317. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  2318. len = elems.length;
  2319. if ( outermost ) {
  2320. outermostContext = context !== document && context;
  2321. }
  2322. // Add elements passing elementMatchers directly to results
  2323. // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
  2324. // Support: IE<9, Safari
  2325. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  2326. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  2327. if ( byElement && elem ) {
  2328. j = 0;
  2329. while ( (matcher = elementMatchers[j++]) ) {
  2330. if ( matcher( elem, context, xml ) ) {
  2331. results.push( elem );
  2332. break;
  2333. }
  2334. }
  2335. if ( outermost ) {
  2336. dirruns = dirrunsUnique;
  2337. }
  2338. }
  2339. // Track unmatched elements for set filters
  2340. if ( bySet ) {
  2341. // They will have gone through all possible matchers
  2342. if ( (elem = !matcher && elem) ) {
  2343. matchedCount--;
  2344. }
  2345. // Lengthen the array for every element, matched or not
  2346. if ( seed ) {
  2347. unmatched.push( elem );
  2348. }
  2349. }
  2350. }
  2351. // Apply set filters to unmatched elements
  2352. matchedCount += i;
  2353. if ( bySet && i !== matchedCount ) {
  2354. j = 0;
  2355. while ( (matcher = setMatchers[j++]) ) {
  2356. matcher( unmatched, setMatched, context, xml );
  2357. }
  2358. if ( seed ) {
  2359. // Reintegrate element matches to eliminate the need for sorting
  2360. if ( matchedCount > 0 ) {
  2361. while ( i-- ) {
  2362. if ( !(unmatched[i] || setMatched[i]) ) {
  2363. setMatched[i] = pop.call( results );
  2364. }
  2365. }
  2366. }
  2367. // Discard index placeholder values to get only actual matches
  2368. setMatched = condense( setMatched );
  2369. }
  2370. // Add matches to results
  2371. push.apply( results, setMatched );
  2372. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2373. if ( outermost && !seed && setMatched.length > 0 &&
  2374. ( matchedCount + setMatchers.length ) > 1 ) {
  2375. Sizzle.uniqueSort( results );
  2376. }
  2377. }
  2378. // Override manipulation of globals by nested matchers
  2379. if ( outermost ) {
  2380. dirruns = dirrunsUnique;
  2381. outermostContext = contextBackup;
  2382. }
  2383. return unmatched;
  2384. };
  2385. return bySet ?
  2386. markFunction( superMatcher ) :
  2387. superMatcher;
  2388. }
  2389. compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
  2390. var i,
  2391. setMatchers = [],
  2392. elementMatchers = [],
  2393. cached = compilerCache[ selector + " " ];
  2394. if ( !cached ) {
  2395. // Generate a function of recursive functions that can be used to check each element
  2396. if ( !group ) {
  2397. group = tokenize( selector );
  2398. }
  2399. i = group.length;
  2400. while ( i-- ) {
  2401. cached = matcherFromTokens( group[i] );
  2402. if ( cached[ expando ] ) {
  2403. setMatchers.push( cached );
  2404. } else {
  2405. elementMatchers.push( cached );
  2406. }
  2407. }
  2408. // Cache the compiled function
  2409. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  2410. }
  2411. return cached;
  2412. };
  2413. function multipleContexts( selector, contexts, results ) {
  2414. var i = 0,
  2415. len = contexts.length;
  2416. for ( ; i < len; i++ ) {
  2417. Sizzle( selector, contexts[i], results );
  2418. }
  2419. return results;
  2420. }
  2421. function select( selector, context, results, seed ) {
  2422. var i, tokens, token, type, find,
  2423. match = tokenize( selector );
  2424. if ( !seed ) {
  2425. // Try to minimize operations if there is only one group
  2426. if ( match.length === 1 ) {
  2427. // Take a shortcut and set the context if the root selector is an ID
  2428. tokens = match[0] = match[0].slice( 0 );
  2429. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  2430. support.getById && context.nodeType === 9 && documentIsHTML &&
  2431. Expr.relative[ tokens[1].type ] ) {
  2432. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  2433. if ( !context ) {
  2434. return results;
  2435. }
  2436. selector = selector.slice( tokens.shift().value.length );
  2437. }
  2438. // Fetch a seed set for right-to-left matching
  2439. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  2440. while ( i-- ) {
  2441. token = tokens[i];
  2442. // Abort if we hit a combinator
  2443. if ( Expr.relative[ (type = token.type) ] ) {
  2444. break;
  2445. }
  2446. if ( (find = Expr.find[ type ]) ) {
  2447. // Search, expanding context for leading sibling combinators
  2448. if ( (seed = find(
  2449. token.matches[0].replace( runescape, funescape ),
  2450. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  2451. )) ) {
  2452. // If seed is empty or no tokens remain, we can return early
  2453. tokens.splice( i, 1 );
  2454. selector = seed.length && toSelector( tokens );
  2455. if ( !selector ) {
  2456. push.apply( results, seed );
  2457. return results;
  2458. }
  2459. break;
  2460. }
  2461. }
  2462. }
  2463. }
  2464. }
  2465. // Compile and execute a filtering function
  2466. // Provide `match` to avoid retokenization if we modified the selector above
  2467. compile( selector, match )(
  2468. seed,
  2469. context,
  2470. !documentIsHTML,
  2471. results,
  2472. rsibling.test( selector ) && testContext( context.parentNode ) || context
  2473. );
  2474. return results;
  2475. }
  2476. // One-time assignments
  2477. // Sort stability
  2478. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  2479. // Support: Chrome<14
  2480. // Always assume duplicates if they aren't passed to the comparison function
  2481. support.detectDuplicates = !!hasDuplicate;
  2482. // Initialize against the default document
  2483. setDocument();
  2484. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  2485. // Detached nodes confoundingly follow *each other*
  2486. support.sortDetached = assert(function( div1 ) {
  2487. // Should return 1, but returns 4 (following)
  2488. return div1.compareDocumentPosition( document.createElement("div") ) & 1;
  2489. });
  2490. // Support: IE<8
  2491. // Prevent attribute/property "interpolation"
  2492. // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  2493. if ( !assert(function( div ) {
  2494. div.innerHTML = "<a href='#'></a>";
  2495. return div.firstChild.getAttribute("href") === "#" ;
  2496. }) ) {
  2497. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  2498. if ( !isXML ) {
  2499. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  2500. }
  2501. });
  2502. }
  2503. // Support: IE<9
  2504. // Use defaultValue in place of getAttribute("value")
  2505. if ( !support.attributes || !assert(function( div ) {
  2506. div.innerHTML = "<input/>";
  2507. div.firstChild.setAttribute( "value", "" );
  2508. return div.firstChild.getAttribute( "value" ) === "";
  2509. }) ) {
  2510. addHandle( "value", function( elem, name, isXML ) {
  2511. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  2512. return elem.defaultValue;
  2513. }
  2514. });
  2515. }
  2516. // Support: IE<9
  2517. // Use getAttributeNode to fetch booleans when getAttribute lies
  2518. if ( !assert(function( div ) {
  2519. return div.getAttribute("disabled") == null;
  2520. }) ) {
  2521. addHandle( booleans, function( elem, name, isXML ) {
  2522. var val;
  2523. if ( !isXML ) {
  2524. return elem[ name ] === true ? name.toLowerCase() :
  2525. (val = elem.getAttributeNode( name )) && val.specified ?
  2526. val.value :
  2527. null;
  2528. }
  2529. });
  2530. }
  2531. return Sizzle;
  2532. })( window );
  2533. jQuery.find = Sizzle;
  2534. jQuery.expr = Sizzle.selectors;
  2535. jQuery.expr[":"] = jQuery.expr.pseudos;
  2536. jQuery.unique = Sizzle.uniqueSort;
  2537. jQuery.text = Sizzle.getText;
  2538. jQuery.isXMLDoc = Sizzle.isXML;
  2539. jQuery.contains = Sizzle.contains;
  2540. var rneedsContext = jQuery.expr.match.needsContext;
  2541. var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
  2542. var risSimple = /^.[^:#\[\.,]*$/;
  2543. // Implement the identical functionality for filter and not
  2544. function winnow( elements, qualifier, not ) {
  2545. if ( jQuery.isFunction( qualifier ) ) {
  2546. return jQuery.grep( elements, function( elem, i ) {
  2547. /* jshint -W018 */
  2548. return !!qualifier.call( elem, i, elem ) !== not;
  2549. });
  2550. }
  2551. if ( qualifier.nodeType ) {
  2552. return jQuery.grep( elements, function( elem ) {
  2553. return ( elem === qualifier ) !== not;
  2554. });
  2555. }
  2556. if ( typeof qualifier === "string" ) {
  2557. if ( risSimple.test( qualifier ) ) {
  2558. return jQuery.filter( qualifier, elements, not );
  2559. }
  2560. qualifier = jQuery.filter( qualifier, elements );
  2561. }
  2562. return jQuery.grep( elements, function( elem ) {
  2563. return ( indexOf.call( qualifier, elem ) >= 0 ) !== not;
  2564. });
  2565. }
  2566. jQuery.filter = function( expr, elems, not ) {
  2567. var elem = elems[ 0 ];
  2568. if ( not ) {
  2569. expr = ":not(" + expr + ")";
  2570. }
  2571. return elems.length === 1 && elem.nodeType === 1 ?
  2572. jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
  2573. jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  2574. return elem.nodeType === 1;
  2575. }));
  2576. };
  2577. jQuery.fn.extend({
  2578. find: function( selector ) {
  2579. var i,
  2580. len = this.length,
  2581. ret = [],
  2582. self = this;
  2583. if ( typeof selector !== "string" ) {
  2584. return this.pushStack( jQuery( selector ).filter(function() {
  2585. for ( i = 0; i < len; i++ ) {
  2586. if ( jQuery.contains( self[ i ], this ) ) {
  2587. return true;
  2588. }
  2589. }
  2590. }) );
  2591. }
  2592. for ( i = 0; i < len; i++ ) {
  2593. jQuery.find( selector, self[ i ], ret );
  2594. }
  2595. // Needed because $( selector, context ) becomes $( context ).find( selector )
  2596. ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
  2597. ret.selector = this.selector ? this.selector + " " + selector : selector;
  2598. return ret;
  2599. },
  2600. filter: function( selector ) {
  2601. return this.pushStack( winnow(this, selector || [], false) );
  2602. },
  2603. not: function( selector ) {
  2604. return this.pushStack( winnow(this, selector || [], true) );
  2605. },
  2606. is: function( selector ) {
  2607. return !!winnow(
  2608. this,
  2609. // If this is a positional/relative selector, check membership in the returned set
  2610. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  2611. typeof selector === "string" && rneedsContext.test( selector ) ?
  2612. jQuery( selector ) :
  2613. selector || [],
  2614. false
  2615. ).length;
  2616. }
  2617. });
  2618. // Initialize a jQuery object
  2619. // A central reference to the root jQuery(document)
  2620. var rootjQuery,
  2621. // A simple way to check for HTML strings
  2622. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  2623. // Strict HTML recognition (#11290: must start with <)
  2624. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
  2625. init = jQuery.fn.init = function( selector, context ) {
  2626. var match, elem;
  2627. // HANDLE: $(""), $(null), $(undefined), $(false)
  2628. if ( !selector ) {
  2629. return this;
  2630. }
  2631. // Handle HTML strings
  2632. if ( typeof selector === "string" ) {
  2633. if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) {
  2634. // Assume that strings that start and end with <> are HTML and skip the regex check
  2635. match = [ null, selector, null ];
  2636. } else {
  2637. match = rquickExpr.exec( selector );
  2638. }
  2639. // Match html or make sure no context is specified for #id
  2640. if ( match && (match[1] || !context) ) {
  2641. // HANDLE: $(html) -> $(array)
  2642. if ( match[1] ) {
  2643. context = context instanceof jQuery ? context[0] : context;
  2644. // scripts is true for back-compat
  2645. // Intentionally let the error be thrown if parseHTML is not present
  2646. jQuery.merge( this, jQuery.parseHTML(
  2647. match[1],
  2648. context && context.nodeType ? context.ownerDocument || context : document,
  2649. true
  2650. ) );
  2651. // HANDLE: $(html, props)
  2652. if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
  2653. for ( match in context ) {
  2654. // Properties of context are called as methods if possible
  2655. if ( jQuery.isFunction( this[ match ] ) ) {
  2656. this[ match ]( context[ match ] );
  2657. // ...and otherwise set as attributes
  2658. } else {
  2659. this.attr( match, context[ match ] );
  2660. }
  2661. }
  2662. }
  2663. return this;
  2664. // HANDLE: $(#id)
  2665. } else {
  2666. elem = document.getElementById( match[2] );
  2667. // Check parentNode to catch when Blackberry 4.6 returns
  2668. // nodes that are no longer in the document #6963
  2669. if ( elem && elem.parentNode ) {
  2670. // Inject the element directly into the jQuery object
  2671. this.length = 1;
  2672. this[0] = elem;
  2673. }
  2674. this.context = document;
  2675. this.selector = selector;
  2676. return this;
  2677. }
  2678. // HANDLE: $(expr, $(...))
  2679. } else if ( !context || context.jquery ) {
  2680. return ( context || rootjQuery ).find( selector );
  2681. // HANDLE: $(expr, context)
  2682. // (which is just equivalent to: $(context).find(expr)
  2683. } else {
  2684. return this.constructor( context ).find( selector );
  2685. }
  2686. // HANDLE: $(DOMElement)
  2687. } else if ( selector.nodeType ) {
  2688. this.context = this[0] = selector;
  2689. this.length = 1;
  2690. return this;
  2691. // HANDLE: $(function)
  2692. // Shortcut for document ready
  2693. } else if ( jQuery.isFunction( selector ) ) {
  2694. return typeof rootjQuery.ready !== "undefined" ?
  2695. rootjQuery.ready( selector ) :
  2696. // Execute immediately if ready is not present
  2697. selector( jQuery );
  2698. }
  2699. if ( selector.selector !== undefined ) {
  2700. this.selector = selector.selector;
  2701. this.context = selector.context;
  2702. }
  2703. return jQuery.makeArray( selector, this );
  2704. };
  2705. // Give the init function the jQuery prototype for later instantiation
  2706. init.prototype = jQuery.fn;
  2707. // Initialize central reference
  2708. rootjQuery = jQuery( document );
  2709. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  2710. // methods guaranteed to produce a unique set when starting from a unique set
  2711. guaranteedUnique = {
  2712. children: true,
  2713. contents: true,
  2714. next: true,
  2715. prev: true
  2716. };
  2717. jQuery.extend({
  2718. dir: function( elem, dir, until ) {
  2719. var matched = [],
  2720. truncate = until !== undefined;
  2721. while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
  2722. if ( elem.nodeType === 1 ) {
  2723. if ( truncate && jQuery( elem ).is( until ) ) {
  2724. break;
  2725. }
  2726. matched.push( elem );
  2727. }
  2728. }
  2729. return matched;
  2730. },
  2731. sibling: function( n, elem ) {
  2732. var matched = [];
  2733. for ( ; n; n = n.nextSibling ) {
  2734. if ( n.nodeType === 1 && n !== elem ) {
  2735. matched.push( n );
  2736. }
  2737. }
  2738. return matched;
  2739. }
  2740. });
  2741. jQuery.fn.extend({
  2742. has: function( target ) {
  2743. var targets = jQuery( target, this ),
  2744. l = targets.length;
  2745. return this.filter(function() {
  2746. var i = 0;
  2747. for ( ; i < l; i++ ) {
  2748. if ( jQuery.contains( this, targets[i] ) ) {
  2749. return true;
  2750. }
  2751. }
  2752. });
  2753. },
  2754. closest: function( selectors, context ) {
  2755. var cur,
  2756. i = 0,
  2757. l = this.length,
  2758. matched = [],
  2759. pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
  2760. jQuery( selectors, context || this.context ) :
  2761. 0;
  2762. for ( ; i < l; i++ ) {
  2763. for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
  2764. // Always skip document fragments
  2765. if ( cur.nodeType < 11 && (pos ?
  2766. pos.index(cur) > -1 :
  2767. // Don't pass non-elements to Sizzle
  2768. cur.nodeType === 1 &&
  2769. jQuery.find.matchesSelector(cur, selectors)) ) {
  2770. matched.push( cur );
  2771. break;
  2772. }
  2773. }
  2774. }
  2775. return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
  2776. },
  2777. // Determine the position of an element within
  2778. // the matched set of elements
  2779. index: function( elem ) {
  2780. // No argument, return index in parent
  2781. if ( !elem ) {
  2782. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  2783. }
  2784. // index in selector
  2785. if ( typeof elem === "string" ) {
  2786. return indexOf.call( jQuery( elem ), this[ 0 ] );
  2787. }
  2788. // Locate the position of the desired element
  2789. return indexOf.call( this,
  2790. // If it receives a jQuery object, the first element is used
  2791. elem.jquery ? elem[ 0 ] : elem
  2792. );
  2793. },
  2794. add: function( selector, context ) {
  2795. return this.pushStack(
  2796. jQuery.unique(
  2797. jQuery.merge( this.get(), jQuery( selector, context ) )
  2798. )
  2799. );
  2800. },
  2801. addBack: function( selector ) {
  2802. return this.add( selector == null ?
  2803. this.prevObject : this.prevObject.filter(selector)
  2804. );
  2805. }
  2806. });
  2807. function sibling( cur, dir ) {
  2808. while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
  2809. return cur;
  2810. }
  2811. jQuery.each({
  2812. parent: function( elem ) {
  2813. var parent = elem.parentNode;
  2814. return parent && parent.nodeType !== 11 ? parent : null;
  2815. },
  2816. parents: function( elem ) {
  2817. return jQuery.dir( elem, "parentNode" );
  2818. },
  2819. parentsUntil: function( elem, i, until ) {
  2820. return jQuery.dir( elem, "parentNode", until );
  2821. },
  2822. next: function( elem ) {
  2823. return sibling( elem, "nextSibling" );
  2824. },
  2825. prev: function( elem ) {
  2826. return sibling( elem, "previousSibling" );
  2827. },
  2828. nextAll: function( elem ) {
  2829. return jQuery.dir( elem, "nextSibling" );
  2830. },
  2831. prevAll: function( elem ) {
  2832. return jQuery.dir( elem, "previousSibling" );
  2833. },
  2834. nextUntil: function( elem, i, until ) {
  2835. return jQuery.dir( elem, "nextSibling", until );
  2836. },
  2837. prevUntil: function( elem, i, until ) {
  2838. return jQuery.dir( elem, "previousSibling", until );
  2839. },
  2840. siblings: function( elem ) {
  2841. return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
  2842. },
  2843. children: function( elem ) {
  2844. return jQuery.sibling( elem.firstChild );
  2845. },
  2846. contents: function( elem ) {
  2847. return elem.contentDocument || jQuery.merge( [], elem.childNodes );
  2848. }
  2849. }, function( name, fn ) {
  2850. jQuery.fn[ name ] = function( until, selector ) {
  2851. var matched = jQuery.map( this, fn, until );
  2852. if ( name.slice( -5 ) !== "Until" ) {
  2853. selector = until;
  2854. }
  2855. if ( selector && typeof selector === "string" ) {
  2856. matched = jQuery.filter( selector, matched );
  2857. }
  2858. if ( this.length > 1 ) {
  2859. // Remove duplicates
  2860. if ( !guaranteedUnique[ name ] ) {
  2861. jQuery.unique( matched );
  2862. }
  2863. // Reverse order for parents* and prev-derivatives
  2864. if ( rparentsprev.test( name ) ) {
  2865. matched.reverse();
  2866. }
  2867. }
  2868. return this.pushStack( matched );
  2869. };
  2870. });
  2871. var rnotwhite = (/\S+/g);
  2872. // String to Object options format cache
  2873. var optionsCache = {};
  2874. // Convert String-formatted options into Object-formatted ones and store in cache
  2875. function createOptions( options ) {
  2876. var object = optionsCache[ options ] = {};
  2877. jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
  2878. object[ flag ] = true;
  2879. });
  2880. return object;
  2881. }
  2882. /*
  2883. * Create a callback list using the following parameters:
  2884. *
  2885. * options: an optional list of space-separated options that will change how
  2886. * the callback list behaves or a more traditional option object
  2887. *
  2888. * By default a callback list will act like an event callback list and can be
  2889. * "fired" multiple times.
  2890. *
  2891. * Possible options:
  2892. *
  2893. * once: will ensure the callback list can only be fired once (like a Deferred)
  2894. *
  2895. * memory: will keep track of previous values and will call any callback added
  2896. * after the list has been fired right away with the latest "memorized"
  2897. * values (like a Deferred)
  2898. *
  2899. * unique: will ensure a callback can only be added once (no duplicate in the list)
  2900. *
  2901. * stopOnFalse: interrupt callings when a callback returns false
  2902. *
  2903. */
  2904. jQuery.Callbacks = function( options ) {
  2905. // Convert options from String-formatted to Object-formatted if needed
  2906. // (we check in cache first)
  2907. options = typeof options === "string" ?
  2908. ( optionsCache[ options ] || createOptions( options ) ) :
  2909. jQuery.extend( {}, options );
  2910. var // Last fire value (for non-forgettable lists)
  2911. memory,
  2912. // Flag to know if list was already fired
  2913. fired,
  2914. // Flag to know if list is currently firing
  2915. firing,
  2916. // First callback to fire (used internally by add and fireWith)
  2917. firingStart,
  2918. // End of the loop when firing
  2919. firingLength,
  2920. // Index of currently firing callback (modified by remove if needed)
  2921. firingIndex,
  2922. // Actual callback list
  2923. list = [],
  2924. // Stack of fire calls for repeatable lists
  2925. stack = !options.once && [],
  2926. // Fire callbacks
  2927. fire = function( data ) {
  2928. memory = options.memory && data;
  2929. fired = true;
  2930. firingIndex = firingStart || 0;
  2931. firingStart = 0;
  2932. firingLength = list.length;
  2933. firing = true;
  2934. for ( ; list && firingIndex < firingLength; firingIndex++ ) {
  2935. if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
  2936. memory = false; // To prevent further calls using add
  2937. break;
  2938. }
  2939. }
  2940. firing = false;
  2941. if ( list ) {
  2942. if ( stack ) {
  2943. if ( stack.length ) {
  2944. fire( stack.shift() );
  2945. }
  2946. } else if ( memory ) {
  2947. list = [];
  2948. } else {
  2949. self.disable();
  2950. }
  2951. }
  2952. },
  2953. // Actual Callbacks object
  2954. self = {
  2955. // Add a callback or a collection of callbacks to the list
  2956. add: function() {
  2957. if ( list ) {
  2958. // First, we save the current length
  2959. var start = list.length;
  2960. (function add( args ) {
  2961. jQuery.each( args, function( _, arg ) {
  2962. var type = jQuery.type( arg );
  2963. if ( type === "function" ) {
  2964. if ( !options.unique || !self.has( arg ) ) {
  2965. list.push( arg );
  2966. }
  2967. } else if ( arg && arg.length && type !== "string" ) {
  2968. // Inspect recursively
  2969. add( arg );
  2970. }
  2971. });
  2972. })( arguments );
  2973. // Do we need to add the callbacks to the
  2974. // current firing batch?
  2975. if ( firing ) {
  2976. firingLength = list.length;
  2977. // With memory, if we're not firing then
  2978. // we should call right away
  2979. } else if ( memory ) {
  2980. firingStart = start;
  2981. fire( memory );
  2982. }
  2983. }
  2984. return this;
  2985. },
  2986. // Remove a callback from the list
  2987. remove: function() {
  2988. if ( list ) {
  2989. jQuery.each( arguments, function( _, arg ) {
  2990. var index;
  2991. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  2992. list.splice( index, 1 );
  2993. // Handle firing indexes
  2994. if ( firing ) {
  2995. if ( index <= firingLength ) {
  2996. firingLength--;
  2997. }
  2998. if ( index <= firingIndex ) {
  2999. firingIndex--;
  3000. }
  3001. }
  3002. }
  3003. });
  3004. }
  3005. return this;
  3006. },
  3007. // Check if a given callback is in the list.
  3008. // If no argument is given, return whether or not list has callbacks attached.
  3009. has: function( fn ) {
  3010. return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
  3011. },
  3012. // Remove all callbacks from the list
  3013. empty: function() {
  3014. list = [];
  3015. firingLength = 0;
  3016. return this;
  3017. },
  3018. // Have the list do nothing anymore
  3019. disable: function() {
  3020. list = stack = memory = undefined;
  3021. return this;
  3022. },
  3023. // Is it disabled?
  3024. disabled: function() {
  3025. return !list;
  3026. },
  3027. // Lock the list in its current state
  3028. lock: function() {
  3029. stack = undefined;
  3030. if ( !memory ) {
  3031. self.disable();
  3032. }
  3033. return this;
  3034. },
  3035. // Is it locked?
  3036. locked: function() {
  3037. return !stack;
  3038. },
  3039. // Call all callbacks with the given context and arguments
  3040. fireWith: function( context, args ) {
  3041. if ( list && ( !fired || stack ) ) {
  3042. args = args || [];
  3043. args = [ context, args.slice ? args.slice() : args ];
  3044. if ( firing ) {
  3045. stack.push( args );
  3046. } else {
  3047. fire( args );
  3048. }
  3049. }
  3050. return this;
  3051. },
  3052. // Call all the callbacks with the given arguments
  3053. fire: function() {
  3054. self.fireWith( this, arguments );
  3055. return this;
  3056. },
  3057. // To know if the callbacks have already been called at least once
  3058. fired: function() {
  3059. return !!fired;
  3060. }
  3061. };
  3062. return self;
  3063. };
  3064. jQuery.extend({
  3065. Deferred: function( func ) {
  3066. var tuples = [
  3067. // action, add listener, listener list, final state
  3068. [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
  3069. [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
  3070. [ "notify", "progress", jQuery.Callbacks("memory") ]
  3071. ],
  3072. state = "pending",
  3073. promise = {
  3074. state: function() {
  3075. return state;
  3076. },
  3077. always: function() {
  3078. deferred.done( arguments ).fail( arguments );
  3079. return this;
  3080. },
  3081. then: function( /* fnDone, fnFail, fnProgress */ ) {
  3082. var fns = arguments;
  3083. return jQuery.Deferred(function( newDefer ) {
  3084. jQuery.each( tuples, function( i, tuple ) {
  3085. var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
  3086. // deferred[ done | fail | progress ] for forwarding actions to newDefer
  3087. deferred[ tuple[1] ](function() {
  3088. var returned = fn && fn.apply( this, arguments );
  3089. if ( returned && jQuery.isFunction( returned.promise ) ) {
  3090. returned.promise()
  3091. .done( newDefer.resolve )
  3092. .fail( newDefer.reject )
  3093. .progress( newDefer.notify );
  3094. } else {
  3095. newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
  3096. }
  3097. });
  3098. });
  3099. fns = null;
  3100. }).promise();
  3101. },
  3102. // Get a promise for this deferred
  3103. // If obj is provided, the promise aspect is added to the object
  3104. promise: function( obj ) {
  3105. return obj != null ? jQuery.extend( obj, promise ) : promise;
  3106. }
  3107. },
  3108. deferred = {};
  3109. // Keep pipe for back-compat
  3110. promise.pipe = promise.then;
  3111. // Add list-specific methods
  3112. jQuery.each( tuples, function( i, tuple ) {
  3113. var list = tuple[ 2 ],
  3114. stateString = tuple[ 3 ];
  3115. // promise[ done | fail | progress ] = list.add
  3116. promise[ tuple[1] ] = list.add;
  3117. // Handle state
  3118. if ( stateString ) {
  3119. list.add(function() {
  3120. // state = [ resolved | rejected ]
  3121. state = stateString;
  3122. // [ reject_list | resolve_list ].disable; progress_list.lock
  3123. }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
  3124. }
  3125. // deferred[ resolve | reject | notify ]
  3126. deferred[ tuple[0] ] = function() {
  3127. deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
  3128. return this;
  3129. };
  3130. deferred[ tuple[0] + "With" ] = list.fireWith;
  3131. });
  3132. // Make the deferred a promise
  3133. promise.promise( deferred );
  3134. // Call given func if any
  3135. if ( func ) {
  3136. func.call( deferred, deferred );
  3137. }
  3138. // All done!
  3139. return deferred;
  3140. },
  3141. // Deferred helper
  3142. when: function( subordinate /* , ..., subordinateN */ ) {
  3143. var i = 0,
  3144. resolveValues = slice.call( arguments ),
  3145. length = resolveValues.length,
  3146. // the count of uncompleted subordinates
  3147. remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
  3148. // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
  3149. deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
  3150. // Update function for both resolve and progress values
  3151. updateFunc = function( i, contexts, values ) {
  3152. return function( value ) {
  3153. contexts[ i ] = this;
  3154. values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  3155. if ( values === progressValues ) {
  3156. deferred.notifyWith( contexts, values );
  3157. } else if ( !( --remaining ) ) {
  3158. deferred.resolveWith( contexts, values );
  3159. }
  3160. };
  3161. },
  3162. progressValues, progressContexts, resolveContexts;
  3163. // add listeners to Deferred subordinates; treat others as resolved
  3164. if ( length > 1 ) {
  3165. progressValues = new Array( length );
  3166. progressContexts = new Array( length );
  3167. resolveContexts = new Array( length );
  3168. for ( ; i < length; i++ ) {
  3169. if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
  3170. resolveValues[ i ].promise()
  3171. .done( updateFunc( i, resolveContexts, resolveValues ) )
  3172. .fail( deferred.reject )
  3173. .progress( updateFunc( i, progressContexts, progressValues ) );
  3174. } else {
  3175. --remaining;
  3176. }
  3177. }
  3178. }
  3179. // if we're not waiting on anything, resolve the master
  3180. if ( !remaining ) {
  3181. deferred.resolveWith( resolveContexts, resolveValues );
  3182. }
  3183. return deferred.promise();
  3184. }
  3185. });
  3186. // The deferred used on DOM ready
  3187. var readyList;
  3188. jQuery.fn.ready = function( fn ) {
  3189. // Add the callback
  3190. jQuery.ready.promise().done( fn );
  3191. return this;
  3192. };
  3193. jQuery.extend({
  3194. // Is the DOM ready to be used? Set to true once it occurs.
  3195. isReady: false,
  3196. // A counter to track how many items to wait for before
  3197. // the ready event fires. See #6781
  3198. readyWait: 1,
  3199. // Hold (or release) the ready event
  3200. holdReady: function( hold ) {
  3201. if ( hold ) {
  3202. jQuery.readyWait++;
  3203. } else {
  3204. jQuery.ready( true );
  3205. }
  3206. },
  3207. // Handle when the DOM is ready
  3208. ready: function( wait ) {
  3209. // Abort if there are pending holds or we're already ready
  3210. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  3211. return;
  3212. }
  3213. // Remember that the DOM is ready
  3214. jQuery.isReady = true;
  3215. // If a normal DOM Ready event fired, decrement, and wait if need be
  3216. if ( wait !== true && --jQuery.readyWait > 0 ) {
  3217. return;
  3218. }
  3219. // If there are functions bound, to execute
  3220. readyList.resolveWith( document, [ jQuery ] );
  3221. // Trigger any bound ready events
  3222. if ( jQuery.fn.trigger ) {
  3223. jQuery( document ).trigger("ready").off("ready");
  3224. }
  3225. }
  3226. });
  3227. /**
  3228. * The ready event handler and self cleanup method
  3229. */
  3230. function completed() {
  3231. document.removeEventListener( "DOMContentLoaded", completed, false );
  3232. window.removeEventListener( "load", completed, false );
  3233. jQuery.ready();
  3234. }
  3235. jQuery.ready.promise = function( obj ) {
  3236. if ( !readyList ) {
  3237. readyList = jQuery.Deferred();
  3238. // Catch cases where $(document).ready() is called after the browser event has already occurred.
  3239. // we once tried to use readyState "interactive" here, but it caused issues like the one
  3240. // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
  3241. if ( document.readyState === "complete" ) {
  3242. // Handle it asynchronously to allow scripts the opportunity to delay ready
  3243. setTimeout( jQuery.ready );
  3244. } else {
  3245. // Use the handy event callback
  3246. document.addEventListener( "DOMContentLoaded", completed, false );
  3247. // A fallback to window.onload, that will always work
  3248. window.addEventListener( "load", completed, false );
  3249. }
  3250. }
  3251. return readyList.promise( obj );
  3252. };
  3253. // Kick off the DOM ready check even if the user does not
  3254. jQuery.ready.promise();
  3255. // Multifunctional method to get and set values of a collection
  3256. // The value/s can optionally be executed if it's a function
  3257. var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  3258. var i = 0,
  3259. len = elems.length,
  3260. bulk = key == null;
  3261. // Sets many values
  3262. if ( jQuery.type( key ) === "object" ) {
  3263. chainable = true;
  3264. for ( i in key ) {
  3265. jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
  3266. }
  3267. // Sets one value
  3268. } else if ( value !== undefined ) {
  3269. chainable = true;
  3270. if ( !jQuery.isFunction( value ) ) {
  3271. raw = true;
  3272. }
  3273. if ( bulk ) {
  3274. // Bulk operations run against the entire set
  3275. if ( raw ) {
  3276. fn.call( elems, value );
  3277. fn = null;
  3278. // ...except when executing function values
  3279. } else {
  3280. bulk = fn;
  3281. fn = function( elem, key, value ) {
  3282. return bulk.call( jQuery( elem ), value );
  3283. };
  3284. }
  3285. }
  3286. if ( fn ) {
  3287. for ( ; i < len; i++ ) {
  3288. fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
  3289. }
  3290. }
  3291. }
  3292. return chainable ?
  3293. elems :
  3294. // Gets
  3295. bulk ?
  3296. fn.call( elems ) :
  3297. len ? fn( elems[0], key ) : emptyGet;
  3298. };
  3299. /**
  3300. * Determines whether an object can have data
  3301. */
  3302. jQuery.acceptData = function( owner ) {
  3303. // Accepts only:
  3304. // - Node
  3305. // - Node.ELEMENT_NODE
  3306. // - Node.DOCUMENT_NODE
  3307. // - Object
  3308. // - Any
  3309. /* jshint -W018 */
  3310. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  3311. };
  3312. function Data() {
  3313. // Support: Android < 4,
  3314. // Old WebKit does not have Object.preventExtensions/freeze method,
  3315. // return new empty object instead with no [[set]] accessor
  3316. Object.defineProperty( this.cache = {}, 0, {
  3317. get: function() {
  3318. return {};
  3319. }
  3320. });
  3321. this.expando = jQuery.expando + Math.random();
  3322. }
  3323. Data.uid = 1;
  3324. Data.accepts = jQuery.acceptData;
  3325. Data.prototype = {
  3326. key: function( owner ) {
  3327. // We can accept data for non-element nodes in modern browsers,
  3328. // but we should not, see #8335.
  3329. // Always return the key for a frozen object.
  3330. if ( !Data.accepts( owner ) ) {
  3331. return 0;
  3332. }
  3333. var descriptor = {},
  3334. // Check if the owner object already has a cache key
  3335. unlock = owner[ this.expando ];
  3336. // If not, create one
  3337. if ( !unlock ) {
  3338. unlock = Data.uid++;
  3339. // Secure it in a non-enumerable, non-writable property
  3340. try {
  3341. descriptor[ this.expando ] = { value: unlock };
  3342. Object.defineProperties( owner, descriptor );
  3343. // Support: Android < 4
  3344. // Fallback to a less secure definition
  3345. } catch ( e ) {
  3346. descriptor[ this.expando ] = unlock;
  3347. jQuery.extend( owner, descriptor );
  3348. }
  3349. }
  3350. // Ensure the cache object
  3351. if ( !this.cache[ unlock ] ) {
  3352. this.cache[ unlock ] = {};
  3353. }
  3354. return unlock;
  3355. },
  3356. set: function( owner, data, value ) {
  3357. var prop,
  3358. // There may be an unlock assigned to this node,
  3359. // if there is no entry for this "owner", create one inline
  3360. // and set the unlock as though an owner entry had always existed
  3361. unlock = this.key( owner ),
  3362. cache = this.cache[ unlock ];
  3363. // Handle: [ owner, key, value ] args
  3364. if ( typeof data === "string" ) {
  3365. cache[ data ] = value;
  3366. // Handle: [ owner, { properties } ] args
  3367. } else {
  3368. // Fresh assignments by object are shallow copied
  3369. if ( jQuery.isEmptyObject( cache ) ) {
  3370. jQuery.extend( this.cache[ unlock ], data );
  3371. // Otherwise, copy the properties one-by-one to the cache object
  3372. } else {
  3373. for ( prop in data ) {
  3374. cache[ prop ] = data[ prop ];
  3375. }
  3376. }
  3377. }
  3378. return cache;
  3379. },
  3380. get: function( owner, key ) {
  3381. // Either a valid cache is found, or will be created.
  3382. // New caches will be created and the unlock returned,
  3383. // allowing direct access to the newly created
  3384. // empty data object. A valid owner object must be provided.
  3385. var cache = this.cache[ this.key( owner ) ];
  3386. return key === undefined ?
  3387. cache : cache[ key ];
  3388. },
  3389. access: function( owner, key, value ) {
  3390. var stored;
  3391. // In cases where either:
  3392. //
  3393. // 1. No key was specified
  3394. // 2. A string key was specified, but no value provided
  3395. //
  3396. // Take the "read" path and allow the get method to determine
  3397. // which value to return, respectively either:
  3398. //
  3399. // 1. The entire cache object
  3400. // 2. The data stored at the key
  3401. //
  3402. if ( key === undefined ||
  3403. ((key && typeof key === "string") && value === undefined) ) {
  3404. stored = this.get( owner, key );
  3405. return stored !== undefined ?
  3406. stored : this.get( owner, jQuery.camelCase(key) );
  3407. }
  3408. // [*]When the key is not a string, or both a key and value
  3409. // are specified, set or extend (existing objects) with either:
  3410. //
  3411. // 1. An object of properties
  3412. // 2. A key and value
  3413. //
  3414. this.set( owner, key, value );
  3415. // Since the "set" path can have two possible entry points
  3416. // return the expected data based on which path was taken[*]
  3417. return value !== undefined ? value : key;
  3418. },
  3419. remove: function( owner, key ) {
  3420. var i, name, camel,
  3421. unlock = this.key( owner ),
  3422. cache = this.cache[ unlock ];
  3423. if ( key === undefined ) {
  3424. this.cache[ unlock ] = {};
  3425. } else {
  3426. // Support array or space separated string of keys
  3427. if ( jQuery.isArray( key ) ) {
  3428. // If "name" is an array of keys...
  3429. // When data is initially created, via ("key", "val") signature,
  3430. // keys will be converted to camelCase.
  3431. // Since there is no way to tell _how_ a key was added, remove
  3432. // both plain key and camelCase key. #12786
  3433. // This will only penalize the array argument path.
  3434. name = key.concat( key.map( jQuery.camelCase ) );
  3435. } else {
  3436. camel = jQuery.camelCase( key );
  3437. // Try the string as a key before any manipulation
  3438. if ( key in cache ) {
  3439. name = [ key, camel ];
  3440. } else {
  3441. // If a key with the spaces exists, use it.
  3442. // Otherwise, create an array by matching non-whitespace
  3443. name = camel;
  3444. name = name in cache ?
  3445. [ name ] : ( name.match( rnotwhite ) || [] );
  3446. }
  3447. }
  3448. i = name.length;
  3449. while ( i-- ) {
  3450. delete cache[ name[ i ] ];
  3451. }
  3452. }
  3453. },
  3454. hasData: function( owner ) {
  3455. return !jQuery.isEmptyObject(
  3456. this.cache[ owner[ this.expando ] ] || {}
  3457. );
  3458. },
  3459. discard: function( owner ) {
  3460. if ( owner[ this.expando ] ) {
  3461. delete this.cache[ owner[ this.expando ] ];
  3462. }
  3463. }
  3464. };
  3465. var data_priv = new Data();
  3466. var data_user = new Data();
  3467. /*
  3468. Implementation Summary
  3469. 1. Enforce API surface and semantic compatibility with 1.9.x branch
  3470. 2. Improve the module's maintainability by reducing the storage
  3471. paths to a single mechanism.
  3472. 3. Use the same single mechanism to support "private" and "user" data.
  3473. 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  3474. 5. Avoid exposing implementation details on user objects (eg. expando properties)
  3475. 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  3476. */
  3477. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  3478. rmultiDash = /([A-Z])/g;
  3479. function dataAttr( elem, key, data ) {
  3480. var name;
  3481. // If nothing was found internally, try to fetch any
  3482. // data from the HTML5 data-* attribute
  3483. if ( data === undefined && elem.nodeType === 1 ) {
  3484. name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
  3485. data = elem.getAttribute( name );
  3486. if ( typeof data === "string" ) {
  3487. try {
  3488. data = data === "true" ? true :
  3489. data === "false" ? false :
  3490. data === "null" ? null :
  3491. // Only convert to a number if it doesn't change the string
  3492. +data + "" === data ? +data :
  3493. rbrace.test( data ) ? jQuery.parseJSON( data ) :
  3494. data;
  3495. } catch( e ) {}
  3496. // Make sure we set the data so it isn't changed later
  3497. data_user.set( elem, key, data );
  3498. } else {
  3499. data = undefined;
  3500. }
  3501. }
  3502. return data;
  3503. }
  3504. jQuery.extend({
  3505. hasData: function( elem ) {
  3506. return data_user.hasData( elem ) || data_priv.hasData( elem );
  3507. },
  3508. data: function( elem, name, data ) {
  3509. return data_user.access( elem, name, data );
  3510. },
  3511. removeData: function( elem, name ) {
  3512. data_user.remove( elem, name );
  3513. },
  3514. // TODO: Now that all calls to _data and _removeData have been replaced
  3515. // with direct calls to data_priv methods, these can be deprecated.
  3516. _data: function( elem, name, data ) {
  3517. return data_priv.access( elem, name, data );
  3518. },
  3519. _removeData: function( elem, name ) {
  3520. data_priv.remove( elem, name );
  3521. }
  3522. });
  3523. jQuery.fn.extend({
  3524. data: function( key, value ) {
  3525. var i, name, data,
  3526. elem = this[ 0 ],
  3527. attrs = elem && elem.attributes;
  3528. // Gets all values
  3529. if ( key === undefined ) {
  3530. if ( this.length ) {
  3531. data = data_user.get( elem );
  3532. if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
  3533. i = attrs.length;
  3534. while ( i-- ) {
  3535. name = attrs[ i ].name;
  3536. if ( name.indexOf( "data-" ) === 0 ) {
  3537. name = jQuery.camelCase( name.slice(5) );
  3538. dataAttr( elem, name, data[ name ] );
  3539. }
  3540. }
  3541. data_priv.set( elem, "hasDataAttrs", true );
  3542. }
  3543. }
  3544. return data;
  3545. }
  3546. // Sets multiple values
  3547. if ( typeof key === "object" ) {
  3548. return this.each(function() {
  3549. data_user.set( this, key );
  3550. });
  3551. }
  3552. return access( this, function( value ) {
  3553. var data,
  3554. camelKey = jQuery.camelCase( key );
  3555. // The calling jQuery object (element matches) is not empty
  3556. // (and therefore has an element appears at this[ 0 ]) and the
  3557. // `value` parameter was not undefined. An empty jQuery object
  3558. // will result in `undefined` for elem = this[ 0 ] which will
  3559. // throw an exception if an attempt to read a data cache is made.
  3560. if ( elem && value === undefined ) {
  3561. // Attempt to get data from the cache
  3562. // with the key as-is
  3563. data = data_user.get( elem, key );
  3564. if ( data !== undefined ) {
  3565. return data;
  3566. }
  3567. // Attempt to get data from the cache
  3568. // with the key camelized
  3569. data = data_user.get( elem, camelKey );
  3570. if ( data !== undefined ) {
  3571. return data;
  3572. }
  3573. // Attempt to "discover" the data in
  3574. // HTML5 custom data-* attrs
  3575. data = dataAttr( elem, camelKey, undefined );
  3576. if ( data !== undefined ) {
  3577. return data;
  3578. }
  3579. // We tried really hard, but the data doesn't exist.
  3580. return;
  3581. }
  3582. // Set the data...
  3583. this.each(function() {
  3584. // First, attempt to store a copy or reference of any
  3585. // data that might've been store with a camelCased key.
  3586. var data = data_user.get( this, camelKey );
  3587. // For HTML5 data-* attribute interop, we have to
  3588. // store property names with dashes in a camelCase form.
  3589. // This might not apply to all properties...*
  3590. data_user.set( this, camelKey, value );
  3591. // *... In the case of properties that might _actually_
  3592. // have dashes, we need to also store a copy of that
  3593. // unchanged property.
  3594. if ( key.indexOf("-") !== -1 && data !== undefined ) {
  3595. data_user.set( this, key, value );
  3596. }
  3597. });
  3598. }, null, value, arguments.length > 1, null, true );
  3599. },
  3600. removeData: function( key ) {
  3601. return this.each(function() {
  3602. data_user.remove( this, key );
  3603. });
  3604. }
  3605. });
  3606. jQuery.extend({
  3607. queue: function( elem, type, data ) {
  3608. var queue;
  3609. if ( elem ) {
  3610. type = ( type || "fx" ) + "queue";
  3611. queue = data_priv.get( elem, type );
  3612. // Speed up dequeue by getting out quickly if this is just a lookup
  3613. if ( data ) {
  3614. if ( !queue || jQuery.isArray( data ) ) {
  3615. queue = data_priv.access( elem, type, jQuery.makeArray(data) );
  3616. } else {
  3617. queue.push( data );
  3618. }
  3619. }
  3620. return queue || [];
  3621. }
  3622. },
  3623. dequeue: function( elem, type ) {
  3624. type = type || "fx";
  3625. var queue = jQuery.queue( elem, type ),
  3626. startLength = queue.length,
  3627. fn = queue.shift(),
  3628. hooks = jQuery._queueHooks( elem, type ),
  3629. next = function() {
  3630. jQuery.dequeue( elem, type );
  3631. };
  3632. // If the fx queue is dequeued, always remove the progress sentinel
  3633. if ( fn === "inprogress" ) {
  3634. fn = queue.shift();
  3635. startLength--;
  3636. }
  3637. if ( fn ) {
  3638. // Add a progress sentinel to prevent the fx queue from being
  3639. // automatically dequeued
  3640. if ( type === "fx" ) {
  3641. queue.unshift( "inprogress" );
  3642. }
  3643. // clear up the last queue stop function
  3644. delete hooks.stop;
  3645. fn.call( elem, next, hooks );
  3646. }
  3647. if ( !startLength && hooks ) {
  3648. hooks.empty.fire();
  3649. }
  3650. },
  3651. // not intended for public consumption - generates a queueHooks object, or returns the current one
  3652. _queueHooks: function( elem, type ) {
  3653. var key = type + "queueHooks";
  3654. return data_priv.get( elem, key ) || data_priv.access( elem, key, {
  3655. empty: jQuery.Callbacks("once memory").add(function() {
  3656. data_priv.remove( elem, [ type + "queue", key ] );
  3657. })
  3658. });
  3659. }
  3660. });
  3661. jQuery.fn.extend({
  3662. queue: function( type, data ) {
  3663. var setter = 2;
  3664. if ( typeof type !== "string" ) {
  3665. data = type;
  3666. type = "fx";
  3667. setter--;
  3668. }
  3669. if ( arguments.length < setter ) {
  3670. return jQuery.queue( this[0], type );
  3671. }
  3672. return data === undefined ?
  3673. this :
  3674. this.each(function() {
  3675. var queue = jQuery.queue( this, type, data );
  3676. // ensure a hooks for this queue
  3677. jQuery._queueHooks( this, type );
  3678. if ( type === "fx" && queue[0] !== "inprogress" ) {
  3679. jQuery.dequeue( this, type );
  3680. }
  3681. });
  3682. },
  3683. dequeue: function( type ) {
  3684. return this.each(function() {
  3685. jQuery.dequeue( this, type );
  3686. });
  3687. },
  3688. clearQueue: function( type ) {
  3689. return this.queue( type || "fx", [] );
  3690. },
  3691. // Get a promise resolved when queues of a certain type
  3692. // are emptied (fx is the type by default)
  3693. promise: function( type, obj ) {
  3694. var tmp,
  3695. count = 1,
  3696. defer = jQuery.Deferred(),
  3697. elements = this,
  3698. i = this.length,
  3699. resolve = function() {
  3700. if ( !( --count ) ) {
  3701. defer.resolveWith( elements, [ elements ] );
  3702. }
  3703. };
  3704. if ( typeof type !== "string" ) {
  3705. obj = type;
  3706. type = undefined;
  3707. }
  3708. type = type || "fx";
  3709. while ( i-- ) {
  3710. tmp = data_priv.get( elements[ i ], type + "queueHooks" );
  3711. if ( tmp && tmp.empty ) {
  3712. count++;
  3713. tmp.empty.add( resolve );
  3714. }
  3715. }
  3716. resolve();
  3717. return defer.promise( obj );
  3718. }
  3719. });
  3720. var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
  3721. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  3722. var isHidden = function( elem, el ) {
  3723. // isHidden might be called from jQuery#filter function;
  3724. // in that case, element will be second argument
  3725. elem = el || elem;
  3726. return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
  3727. };
  3728. var rcheckableType = (/^(?:checkbox|radio)$/i);
  3729. (function() {
  3730. var fragment = document.createDocumentFragment(),
  3731. div = fragment.appendChild( document.createElement( "div" ) );
  3732. // #11217 - WebKit loses check when the name is after the checked attribute
  3733. div.innerHTML = "<input type='radio' checked='checked' name='t'/>";
  3734. // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
  3735. // old WebKit doesn't clone checked state correctly in fragments
  3736. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  3737. // Make sure textarea (and checkbox) defaultValue is properly cloned
  3738. // Support: IE9-IE11+
  3739. div.innerHTML = "<textarea>x</textarea>";
  3740. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  3741. })();
  3742. var strundefined = typeof undefined;
  3743. support.focusinBubbles = "onfocusin" in window;
  3744. var
  3745. rkeyEvent = /^key/,
  3746. rmouseEvent = /^(?:mouse|contextmenu)|click/,
  3747. rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  3748. rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
  3749. function returnTrue() {
  3750. return true;
  3751. }
  3752. function returnFalse() {
  3753. return false;
  3754. }
  3755. function safeActiveElement() {
  3756. try {
  3757. return document.activeElement;
  3758. } catch ( err ) { }
  3759. }
  3760. /*
  3761. * Helper functions for managing events -- not part of the public interface.
  3762. * Props to Dean Edwards' addEvent library for many of the ideas.
  3763. */
  3764. jQuery.event = {
  3765. global: {},
  3766. add: function( elem, types, handler, data, selector ) {
  3767. var handleObjIn, eventHandle, tmp,
  3768. events, t, handleObj,
  3769. special, handlers, type, namespaces, origType,
  3770. elemData = data_priv.get( elem );
  3771. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  3772. if ( !elemData ) {
  3773. return;
  3774. }
  3775. // Caller can pass in an object of custom data in lieu of the handler
  3776. if ( handler.handler ) {
  3777. handleObjIn = handler;
  3778. handler = handleObjIn.handler;
  3779. selector = handleObjIn.selector;
  3780. }
  3781. // Make sure that the handler has a unique ID, used to find/remove it later
  3782. if ( !handler.guid ) {
  3783. handler.guid = jQuery.guid++;
  3784. }
  3785. // Init the element's event structure and main handler, if this is the first
  3786. if ( !(events = elemData.events) ) {
  3787. events = elemData.events = {};
  3788. }
  3789. if ( !(eventHandle = elemData.handle) ) {
  3790. eventHandle = elemData.handle = function( e ) {
  3791. // Discard the second event of a jQuery.event.trigger() and
  3792. // when an event is called after a page has unloaded
  3793. return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
  3794. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  3795. };
  3796. }
  3797. // Handle multiple events separated by a space
  3798. types = ( types || "" ).match( rnotwhite ) || [ "" ];
  3799. t = types.length;
  3800. while ( t-- ) {
  3801. tmp = rtypenamespace.exec( types[t] ) || [];
  3802. type = origType = tmp[1];
  3803. namespaces = ( tmp[2] || "" ).split( "." ).sort();
  3804. // There *must* be a type, no attaching namespace-only handlers
  3805. if ( !type ) {
  3806. continue;
  3807. }
  3808. // If event changes its type, use the special event handlers for the changed type
  3809. special = jQuery.event.special[ type ] || {};
  3810. // If selector defined, determine special event api type, otherwise given type
  3811. type = ( selector ? special.delegateType : special.bindType ) || type;
  3812. // Update special based on newly reset type
  3813. special = jQuery.event.special[ type ] || {};
  3814. // handleObj is passed to all event handlers
  3815. handleObj = jQuery.extend({
  3816. type: type,
  3817. origType: origType,
  3818. data: data,
  3819. handler: handler,
  3820. guid: handler.guid,
  3821. selector: selector,
  3822. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  3823. namespace: namespaces.join(".")
  3824. }, handleObjIn );
  3825. // Init the event handler queue if we're the first
  3826. if ( !(handlers = events[ type ]) ) {
  3827. handlers = events[ type ] = [];
  3828. handlers.delegateCount = 0;
  3829. // Only use addEventListener if the special events handler returns false
  3830. if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  3831. if ( elem.addEventListener ) {
  3832. elem.addEventListener( type, eventHandle, false );
  3833. }
  3834. }
  3835. }
  3836. if ( special.add ) {
  3837. special.add.call( elem, handleObj );
  3838. if ( !handleObj.handler.guid ) {
  3839. handleObj.handler.guid = handler.guid;
  3840. }
  3841. }
  3842. // Add to the element's handler list, delegates in front
  3843. if ( selector ) {
  3844. handlers.splice( handlers.delegateCount++, 0, handleObj );
  3845. } else {
  3846. handlers.push( handleObj );
  3847. }
  3848. // Keep track of which events have ever been used, for event optimization
  3849. jQuery.event.global[ type ] = true;
  3850. }
  3851. },
  3852. // Detach an event or set of events from an element
  3853. remove: function( elem, types, handler, selector, mappedTypes ) {
  3854. var j, origCount, tmp,
  3855. events, t, handleObj,
  3856. special, handlers, type, namespaces, origType,
  3857. elemData = data_priv.hasData( elem ) && data_priv.get( elem );
  3858. if ( !elemData || !(events = elemData.events) ) {
  3859. return;
  3860. }
  3861. // Once for each type.namespace in types; type may be omitted
  3862. types = ( types || "" ).match( rnotwhite ) || [ "" ];
  3863. t = types.length;
  3864. while ( t-- ) {
  3865. tmp = rtypenamespace.exec( types[t] ) || [];
  3866. type = origType = tmp[1];
  3867. namespaces = ( tmp[2] || "" ).split( "." ).sort();
  3868. // Unbind all events (on this namespace, if provided) for the element
  3869. if ( !type ) {
  3870. for ( type in events ) {
  3871. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  3872. }
  3873. continue;
  3874. }
  3875. special = jQuery.event.special[ type ] || {};
  3876. type = ( selector ? special.delegateType : special.bindType ) || type;
  3877. handlers = events[ type ] || [];
  3878. tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
  3879. // Remove matching events
  3880. origCount = j = handlers.length;
  3881. while ( j-- ) {
  3882. handleObj = handlers[ j ];
  3883. if ( ( mappedTypes || origType === handleObj.origType ) &&
  3884. ( !handler || handler.guid === handleObj.guid ) &&
  3885. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  3886. ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
  3887. handlers.splice( j, 1 );
  3888. if ( handleObj.selector ) {
  3889. handlers.delegateCount--;
  3890. }
  3891. if ( special.remove ) {
  3892. special.remove.call( elem, handleObj );
  3893. }
  3894. }
  3895. }
  3896. // Remove generic event handler if we removed something and no more handlers exist
  3897. // (avoids potential for endless recursion during removal of special event handlers)
  3898. if ( origCount && !handlers.length ) {
  3899. if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  3900. jQuery.removeEvent( elem, type, elemData.handle );
  3901. }
  3902. delete events[ type ];
  3903. }
  3904. }
  3905. // Remove the expando if it's no longer used
  3906. if ( jQuery.isEmptyObject( events ) ) {
  3907. delete elemData.handle;
  3908. data_priv.remove( elem, "events" );
  3909. }
  3910. },
  3911. trigger: function( event, data, elem, onlyHandlers ) {
  3912. var i, cur, tmp, bubbleType, ontype, handle, special,
  3913. eventPath = [ elem || document ],
  3914. type = hasOwn.call( event, "type" ) ? event.type : event,
  3915. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
  3916. cur = tmp = elem = elem || document;
  3917. // Don't do events on text and comment nodes
  3918. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  3919. return;
  3920. }
  3921. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  3922. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  3923. return;
  3924. }
  3925. if ( type.indexOf(".") >= 0 ) {
  3926. // Namespaced trigger; create a regexp to match event type in handle()
  3927. namespaces = type.split(".");
  3928. type = namespaces.shift();
  3929. namespaces.sort();
  3930. }
  3931. ontype = type.indexOf(":") < 0 && "on" + type;
  3932. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  3933. event = event[ jQuery.expando ] ?
  3934. event :
  3935. new jQuery.Event( type, typeof event === "object" && event );
  3936. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  3937. event.isTrigger = onlyHandlers ? 2 : 3;
  3938. event.namespace = namespaces.join(".");
  3939. event.namespace_re = event.namespace ?
  3940. new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
  3941. null;
  3942. // Clean up the event in case it is being reused
  3943. event.result = undefined;
  3944. if ( !event.target ) {
  3945. event.target = elem;
  3946. }
  3947. // Clone any incoming data and prepend the event, creating the handler arg list
  3948. data = data == null ?
  3949. [ event ] :
  3950. jQuery.makeArray( data, [ event ] );
  3951. // Allow special events to draw outside the lines
  3952. special = jQuery.event.special[ type ] || {};
  3953. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  3954. return;
  3955. }
  3956. // Determine event propagation path in advance, per W3C events spec (#9951)
  3957. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  3958. if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
  3959. bubbleType = special.delegateType || type;
  3960. if ( !rfocusMorph.test( bubbleType + type ) ) {
  3961. cur = cur.parentNode;
  3962. }
  3963. for ( ; cur; cur = cur.parentNode ) {
  3964. eventPath.push( cur );
  3965. tmp = cur;
  3966. }
  3967. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  3968. if ( tmp === (elem.ownerDocument || document) ) {
  3969. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  3970. }
  3971. }
  3972. // Fire handlers on the event path
  3973. i = 0;
  3974. while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
  3975. event.type = i > 1 ?
  3976. bubbleType :
  3977. special.bindType || type;
  3978. // jQuery handler
  3979. handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
  3980. if ( handle ) {
  3981. handle.apply( cur, data );
  3982. }
  3983. // Native handler
  3984. handle = ontype && cur[ ontype ];
  3985. if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
  3986. event.result = handle.apply( cur, data );
  3987. if ( event.result === false ) {
  3988. event.preventDefault();
  3989. }
  3990. }
  3991. }
  3992. event.type = type;
  3993. // If nobody prevented the default action, do it now
  3994. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  3995. if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
  3996. jQuery.acceptData( elem ) ) {
  3997. // Call a native DOM method on the target with the same name name as the event.
  3998. // Don't do default actions on window, that's where global variables be (#6170)
  3999. if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
  4000. // Don't re-trigger an onFOO event when we call its FOO() method
  4001. tmp = elem[ ontype ];
  4002. if ( tmp ) {
  4003. elem[ ontype ] = null;
  4004. }
  4005. // Prevent re-triggering of the same event, since we already bubbled it above
  4006. jQuery.event.triggered = type;
  4007. elem[ type ]();
  4008. jQuery.event.triggered = undefined;
  4009. if ( tmp ) {
  4010. elem[ ontype ] = tmp;
  4011. }
  4012. }
  4013. }
  4014. }
  4015. return event.result;
  4016. },
  4017. dispatch: function( event ) {
  4018. // Make a writable jQuery.Event from the native event object
  4019. event = jQuery.event.fix( event );
  4020. var i, j, ret, matched, handleObj,
  4021. handlerQueue = [],
  4022. args = slice.call( arguments ),
  4023. handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
  4024. special = jQuery.event.special[ event.type ] || {};
  4025. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  4026. args[0] = event;
  4027. event.delegateTarget = this;
  4028. // Call the preDispatch hook for the mapped type, and let it bail if desired
  4029. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  4030. return;
  4031. }
  4032. // Determine handlers
  4033. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  4034. // Run delegates first; they may want to stop propagation beneath us
  4035. i = 0;
  4036. while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
  4037. event.currentTarget = matched.elem;
  4038. j = 0;
  4039. while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
  4040. // Triggered event must either 1) have no namespace, or
  4041. // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
  4042. if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
  4043. event.handleObj = handleObj;
  4044. event.data = handleObj.data;
  4045. ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
  4046. .apply( matched.elem, args );
  4047. if ( ret !== undefined ) {
  4048. if ( (event.result = ret) === false ) {
  4049. event.preventDefault();
  4050. event.stopPropagation();
  4051. }
  4052. }
  4053. }
  4054. }
  4055. }
  4056. // Call the postDispatch hook for the mapped type
  4057. if ( special.postDispatch ) {
  4058. special.postDispatch.call( this, event );
  4059. }
  4060. return event.result;
  4061. },
  4062. handlers: function( event, handlers ) {
  4063. var i, matches, sel, handleObj,
  4064. handlerQueue = [],
  4065. delegateCount = handlers.delegateCount,
  4066. cur = event.target;
  4067. // Find delegate handlers
  4068. // Black-hole SVG <use> instance trees (#13180)
  4069. // Avoid non-left-click bubbling in Firefox (#3861)
  4070. if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
  4071. for ( ; cur !== this; cur = cur.parentNode || this ) {
  4072. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  4073. if ( cur.disabled !== true || event.type !== "click" ) {
  4074. matches = [];
  4075. for ( i = 0; i < delegateCount; i++ ) {
  4076. handleObj = handlers[ i ];
  4077. // Don't conflict with Object.prototype properties (#13203)
  4078. sel = handleObj.selector + " ";
  4079. if ( matches[ sel ] === undefined ) {
  4080. matches[ sel ] = handleObj.needsContext ?
  4081. jQuery( sel, this ).index( cur ) >= 0 :
  4082. jQuery.find( sel, this, null, [ cur ] ).length;
  4083. }
  4084. if ( matches[ sel ] ) {
  4085. matches.push( handleObj );
  4086. }
  4087. }
  4088. if ( matches.length ) {
  4089. handlerQueue.push({ elem: cur, handlers: matches });
  4090. }
  4091. }
  4092. }
  4093. }
  4094. // Add the remaining (directly-bound) handlers
  4095. if ( delegateCount < handlers.length ) {
  4096. handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
  4097. }
  4098. return handlerQueue;
  4099. },
  4100. // Includes some event props shared by KeyEvent and MouseEvent
  4101. props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
  4102. fixHooks: {},
  4103. keyHooks: {
  4104. props: "char charCode key keyCode".split(" "),
  4105. filter: function( event, original ) {
  4106. // Add which for key events
  4107. if ( event.which == null ) {
  4108. event.which = original.charCode != null ? original.charCode : original.keyCode;
  4109. }
  4110. return event;
  4111. }
  4112. },
  4113. mouseHooks: {
  4114. props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
  4115. filter: function( event, original ) {
  4116. var eventDoc, doc, body,
  4117. button = original.button;
  4118. // Calculate pageX/Y if missing and clientX/Y available
  4119. if ( event.pageX == null && original.clientX != null ) {
  4120. eventDoc = event.target.ownerDocument || document;
  4121. doc = eventDoc.documentElement;
  4122. body = eventDoc.body;
  4123. event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
  4124. event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
  4125. }
  4126. // Add which for click: 1 === left; 2 === middle; 3 === right
  4127. // Note: button is not normalized, so don't use it
  4128. if ( !event.which && button !== undefined ) {
  4129. event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
  4130. }
  4131. return event;
  4132. }
  4133. },
  4134. fix: function( event ) {
  4135. if ( event[ jQuery.expando ] ) {
  4136. return event;
  4137. }
  4138. // Create a writable copy of the event object and normalize some properties
  4139. var i, prop, copy,
  4140. type = event.type,
  4141. originalEvent = event,
  4142. fixHook = this.fixHooks[ type ];
  4143. if ( !fixHook ) {
  4144. this.fixHooks[ type ] = fixHook =
  4145. rmouseEvent.test( type ) ? this.mouseHooks :
  4146. rkeyEvent.test( type ) ? this.keyHooks :
  4147. {};
  4148. }
  4149. copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
  4150. event = new jQuery.Event( originalEvent );
  4151. i = copy.length;
  4152. while ( i-- ) {
  4153. prop = copy[ i ];
  4154. event[ prop ] = originalEvent[ prop ];
  4155. }
  4156. // Support: Cordova 2.5 (WebKit) (#13255)
  4157. // All events should have a target; Cordova deviceready doesn't
  4158. if ( !event.target ) {
  4159. event.target = document;
  4160. }
  4161. // Support: Safari 6.0+, Chrome < 28
  4162. // Target should not be a text node (#504, #13143)
  4163. if ( event.target.nodeType === 3 ) {
  4164. event.target = event.target.parentNode;
  4165. }
  4166. return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
  4167. },
  4168. special: {
  4169. load: {
  4170. // Prevent triggered image.load events from bubbling to window.load
  4171. noBubble: true
  4172. },
  4173. focus: {
  4174. // Fire native event if possible so blur/focus sequence is correct
  4175. trigger: function() {
  4176. if ( this !== safeActiveElement() && this.focus ) {
  4177. this.focus();
  4178. return false;
  4179. }
  4180. },
  4181. delegateType: "focusin"
  4182. },
  4183. blur: {
  4184. trigger: function() {
  4185. if ( this === safeActiveElement() && this.blur ) {
  4186. this.blur();
  4187. return false;
  4188. }
  4189. },
  4190. delegateType: "focusout"
  4191. },
  4192. click: {
  4193. // For checkbox, fire native event so checked state will be right
  4194. trigger: function() {
  4195. if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
  4196. this.click();
  4197. return false;
  4198. }
  4199. },
  4200. // For cross-browser consistency, don't fire native .click() on links
  4201. _default: function( event ) {
  4202. return jQuery.nodeName( event.target, "a" );
  4203. }
  4204. },
  4205. beforeunload: {
  4206. postDispatch: function( event ) {
  4207. // Support: Firefox 20+
  4208. // Firefox doesn't alert if the returnValue field is not set.
  4209. if ( event.result !== undefined ) {
  4210. event.originalEvent.returnValue = event.result;
  4211. }
  4212. }
  4213. }
  4214. },
  4215. simulate: function( type, elem, event, bubble ) {
  4216. // Piggyback on a donor event to simulate a different one.
  4217. // Fake originalEvent to avoid donor's stopPropagation, but if the
  4218. // simulated event prevents default then we do the same on the donor.
  4219. var e = jQuery.extend(
  4220. new jQuery.Event(),
  4221. event,
  4222. {
  4223. type: type,
  4224. isSimulated: true,
  4225. originalEvent: {}
  4226. }
  4227. );
  4228. if ( bubble ) {
  4229. jQuery.event.trigger( e, null, elem );
  4230. } else {
  4231. jQuery.event.dispatch.call( elem, e );
  4232. }
  4233. if ( e.isDefaultPrevented() ) {
  4234. event.preventDefault();
  4235. }
  4236. }
  4237. };
  4238. jQuery.removeEvent = function( elem, type, handle ) {
  4239. if ( elem.removeEventListener ) {
  4240. elem.removeEventListener( type, handle, false );
  4241. }
  4242. };
  4243. jQuery.Event = function( src, props ) {
  4244. // Allow instantiation without the 'new' keyword
  4245. if ( !(this instanceof jQuery.Event) ) {
  4246. return new jQuery.Event( src, props );
  4247. }
  4248. // Event object
  4249. if ( src && src.type ) {
  4250. this.originalEvent = src;
  4251. this.type = src.type;
  4252. // Events bubbling up the document may have been marked as prevented
  4253. // by a handler lower down the tree; reflect the correct value.
  4254. this.isDefaultPrevented = src.defaultPrevented ||
  4255. // Support: Android < 4.0
  4256. src.defaultPrevented === undefined &&
  4257. src.getPreventDefault && src.getPreventDefault() ?
  4258. returnTrue :
  4259. returnFalse;
  4260. // Event type
  4261. } else {
  4262. this.type = src;
  4263. }
  4264. // Put explicitly provided properties onto the event object
  4265. if ( props ) {
  4266. jQuery.extend( this, props );
  4267. }
  4268. // Create a timestamp if incoming event doesn't have one
  4269. this.timeStamp = src && src.timeStamp || jQuery.now();
  4270. // Mark it as fixed
  4271. this[ jQuery.expando ] = true;
  4272. };
  4273. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  4274. // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  4275. jQuery.Event.prototype = {
  4276. isDefaultPrevented: returnFalse,
  4277. isPropagationStopped: returnFalse,
  4278. isImmediatePropagationStopped: returnFalse,
  4279. preventDefault: function() {
  4280. var e = this.originalEvent;
  4281. this.isDefaultPrevented = returnTrue;
  4282. if ( e && e.preventDefault ) {
  4283. e.preventDefault();
  4284. }
  4285. },
  4286. stopPropagation: function() {
  4287. var e = this.originalEvent;
  4288. this.isPropagationStopped = returnTrue;
  4289. if ( e && e.stopPropagation ) {
  4290. e.stopPropagation();
  4291. }
  4292. },
  4293. stopImmediatePropagation: function() {
  4294. this.isImmediatePropagationStopped = returnTrue;
  4295. this.stopPropagation();
  4296. }
  4297. };
  4298. // Create mouseenter/leave events using mouseover/out and event-time checks
  4299. // Support: Chrome 15+
  4300. jQuery.each({
  4301. mouseenter: "mouseover",
  4302. mouseleave: "mouseout"
  4303. }, function( orig, fix ) {
  4304. jQuery.event.special[ orig ] = {
  4305. delegateType: fix,
  4306. bindType: fix,
  4307. handle: function( event ) {
  4308. var ret,
  4309. target = this,
  4310. related = event.relatedTarget,
  4311. handleObj = event.handleObj;
  4312. // For mousenter/leave call the handler if related is outside the target.
  4313. // NB: No relatedTarget if the mouse left/entered the browser window
  4314. if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
  4315. event.type = handleObj.origType;
  4316. ret = handleObj.handler.apply( this, arguments );
  4317. event.type = fix;
  4318. }
  4319. return ret;
  4320. }
  4321. };
  4322. });
  4323. // Create "bubbling" focus and blur events
  4324. // Support: Firefox, Chrome, Safari
  4325. if ( !support.focusinBubbles ) {
  4326. jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  4327. // Attach a single capturing handler on the document while someone wants focusin/focusout
  4328. var handler = function( event ) {
  4329. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
  4330. };
  4331. jQuery.event.special[ fix ] = {
  4332. setup: function() {
  4333. var doc = this.ownerDocument || this,
  4334. attaches = data_priv.access( doc, fix );
  4335. if ( !attaches ) {
  4336. doc.addEventListener( orig, handler, true );
  4337. }
  4338. data_priv.access( doc, fix, ( attaches || 0 ) + 1 );
  4339. },
  4340. teardown: function() {
  4341. var doc = this.ownerDocument || this,
  4342. attaches = data_priv.access( doc, fix ) - 1;
  4343. if ( !attaches ) {
  4344. doc.removeEventListener( orig, handler, true );
  4345. data_priv.remove( doc, fix );
  4346. } else {
  4347. data_priv.access( doc, fix, attaches );
  4348. }
  4349. }
  4350. };
  4351. });
  4352. }
  4353. jQuery.fn.extend({
  4354. on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
  4355. var origFn, type;
  4356. // Types can be a map of types/handlers
  4357. if ( typeof types === "object" ) {
  4358. // ( types-Object, selector, data )
  4359. if ( typeof selector !== "string" ) {
  4360. // ( types-Object, data )
  4361. data = data || selector;
  4362. selector = undefined;
  4363. }
  4364. for ( type in types ) {
  4365. this.on( type, selector, data, types[ type ], one );
  4366. }
  4367. return this;
  4368. }
  4369. if ( data == null && fn == null ) {
  4370. // ( types, fn )
  4371. fn = selector;
  4372. data = selector = undefined;
  4373. } else if ( fn == null ) {
  4374. if ( typeof selector === "string" ) {
  4375. // ( types, selector, fn )
  4376. fn = data;
  4377. data = undefined;
  4378. } else {
  4379. // ( types, data, fn )
  4380. fn = data;
  4381. data = selector;
  4382. selector = undefined;
  4383. }
  4384. }
  4385. if ( fn === false ) {
  4386. fn = returnFalse;
  4387. } else if ( !fn ) {
  4388. return this;
  4389. }
  4390. if ( one === 1 ) {
  4391. origFn = fn;
  4392. fn = function( event ) {
  4393. // Can use an empty set, since event contains the info
  4394. jQuery().off( event );
  4395. return origFn.apply( this, arguments );
  4396. };
  4397. // Use same guid so caller can remove using origFn
  4398. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  4399. }
  4400. return this.each( function() {
  4401. jQuery.event.add( this, types, fn, data, selector );
  4402. });
  4403. },
  4404. one: function( types, selector, data, fn ) {
  4405. return this.on( types, selector, data, fn, 1 );
  4406. },
  4407. off: function( types, selector, fn ) {
  4408. var handleObj, type;
  4409. if ( types && types.preventDefault && types.handleObj ) {
  4410. // ( event ) dispatched jQuery.Event
  4411. handleObj = types.handleObj;
  4412. jQuery( types.delegateTarget ).off(
  4413. handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
  4414. handleObj.selector,
  4415. handleObj.handler
  4416. );
  4417. return this;
  4418. }
  4419. if ( typeof types === "object" ) {
  4420. // ( types-object [, selector] )
  4421. for ( type in types ) {
  4422. this.off( type, selector, types[ type ] );
  4423. }
  4424. return this;
  4425. }
  4426. if ( selector === false || typeof selector === "function" ) {
  4427. // ( types [, fn] )
  4428. fn = selector;
  4429. selector = undefined;
  4430. }
  4431. if ( fn === false ) {
  4432. fn = returnFalse;
  4433. }
  4434. return this.each(function() {
  4435. jQuery.event.remove( this, types, fn, selector );
  4436. });
  4437. },
  4438. trigger: function( type, data ) {
  4439. return this.each(function() {
  4440. jQuery.event.trigger( type, data, this );
  4441. });
  4442. },
  4443. triggerHandler: function( type, data ) {
  4444. var elem = this[0];
  4445. if ( elem ) {
  4446. return jQuery.event.trigger( type, data, elem, true );
  4447. }
  4448. }
  4449. });
  4450. var
  4451. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
  4452. rtagName = /<([\w:]+)/,
  4453. rhtml = /<|&#?\w+;/,
  4454. rnoInnerhtml = /<(?:script|style|link)/i,
  4455. // checked="checked" or checked
  4456. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  4457. rscriptType = /^$|\/(?:java|ecma)script/i,
  4458. rscriptTypeMasked = /^true\/(.*)/,
  4459. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
  4460. // We have to close these tags to support XHTML (#13200)
  4461. wrapMap = {
  4462. // Support: IE 9
  4463. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  4464. thead: [ 1, "<table>", "</table>" ],
  4465. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  4466. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  4467. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  4468. _default: [ 0, "", "" ]
  4469. };
  4470. // Support: IE 9
  4471. wrapMap.optgroup = wrapMap.option;
  4472. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  4473. wrapMap.th = wrapMap.td;
  4474. // Support: 1.x compatibility
  4475. // Manipulating tables requires a tbody
  4476. function manipulationTarget( elem, content ) {
  4477. return jQuery.nodeName( elem, "table" ) &&
  4478. jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
  4479. elem.getElementsByTagName("tbody")[0] ||
  4480. elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
  4481. elem;
  4482. }
  4483. // Replace/restore the type attribute of script elements for safe DOM manipulation
  4484. function disableScript( elem ) {
  4485. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  4486. return elem;
  4487. }
  4488. function restoreScript( elem ) {
  4489. var match = rscriptTypeMasked.exec( elem.type );
  4490. if ( match ) {
  4491. elem.type = match[ 1 ];
  4492. } else {
  4493. elem.removeAttribute("type");
  4494. }
  4495. return elem;
  4496. }
  4497. // Mark scripts as having already been evaluated
  4498. function setGlobalEval( elems, refElements ) {
  4499. var i = 0,
  4500. l = elems.length;
  4501. for ( ; i < l; i++ ) {
  4502. data_priv.set(
  4503. elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" )
  4504. );
  4505. }
  4506. }
  4507. function cloneCopyEvent( src, dest ) {
  4508. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  4509. if ( dest.nodeType !== 1 ) {
  4510. return;
  4511. }
  4512. // 1. Copy private data: events, handlers, etc.
  4513. if ( data_priv.hasData( src ) ) {
  4514. pdataOld = data_priv.access( src );
  4515. pdataCur = data_priv.set( dest, pdataOld );
  4516. events = pdataOld.events;
  4517. if ( events ) {
  4518. delete pdataCur.handle;
  4519. pdataCur.events = {};
  4520. for ( type in events ) {
  4521. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  4522. jQuery.event.add( dest, type, events[ type ][ i ] );
  4523. }
  4524. }
  4525. }
  4526. }
  4527. // 2. Copy user data
  4528. if ( data_user.hasData( src ) ) {
  4529. udataOld = data_user.access( src );
  4530. udataCur = jQuery.extend( {}, udataOld );
  4531. data_user.set( dest, udataCur );
  4532. }
  4533. }
  4534. function getAll( context, tag ) {
  4535. var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
  4536. context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
  4537. [];
  4538. return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
  4539. jQuery.merge( [ context ], ret ) :
  4540. ret;
  4541. }
  4542. // Support: IE >= 9
  4543. function fixInput( src, dest ) {
  4544. var nodeName = dest.nodeName.toLowerCase();
  4545. // Fails to persist the checked state of a cloned checkbox or radio button.
  4546. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  4547. dest.checked = src.checked;
  4548. // Fails to return the selected option to the default selected state when cloning options
  4549. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  4550. dest.defaultValue = src.defaultValue;
  4551. }
  4552. }
  4553. jQuery.extend({
  4554. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  4555. var i, l, srcElements, destElements,
  4556. clone = elem.cloneNode( true ),
  4557. inPage = jQuery.contains( elem.ownerDocument, elem );
  4558. // Support: IE >= 9
  4559. // Fix Cloning issues
  4560. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  4561. !jQuery.isXMLDoc( elem ) ) {
  4562. // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
  4563. destElements = getAll( clone );
  4564. srcElements = getAll( elem );
  4565. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  4566. fixInput( srcElements[ i ], destElements[ i ] );
  4567. }
  4568. }
  4569. // Copy the events from the original to the clone
  4570. if ( dataAndEvents ) {
  4571. if ( deepDataAndEvents ) {
  4572. srcElements = srcElements || getAll( elem );
  4573. destElements = destElements || getAll( clone );
  4574. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  4575. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  4576. }
  4577. } else {
  4578. cloneCopyEvent( elem, clone );
  4579. }
  4580. }
  4581. // Preserve script evaluation history
  4582. destElements = getAll( clone, "script" );
  4583. if ( destElements.length > 0 ) {
  4584. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  4585. }
  4586. // Return the cloned set
  4587. return clone;
  4588. },
  4589. buildFragment: function( elems, context, scripts, selection ) {
  4590. var elem, tmp, tag, wrap, contains, j,
  4591. fragment = context.createDocumentFragment(),
  4592. nodes = [],
  4593. i = 0,
  4594. l = elems.length;
  4595. for ( ; i < l; i++ ) {
  4596. elem = elems[ i ];
  4597. if ( elem || elem === 0 ) {
  4598. // Add nodes directly
  4599. if ( jQuery.type( elem ) === "object" ) {
  4600. // Support: QtWebKit
  4601. // jQuery.merge because push.apply(_, arraylike) throws
  4602. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  4603. // Convert non-html into a text node
  4604. } else if ( !rhtml.test( elem ) ) {
  4605. nodes.push( context.createTextNode( elem ) );
  4606. // Convert html into DOM nodes
  4607. } else {
  4608. tmp = tmp || fragment.appendChild( context.createElement("div") );
  4609. // Deserialize a standard representation
  4610. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  4611. wrap = wrapMap[ tag ] || wrapMap._default;
  4612. tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
  4613. // Descend through wrappers to the right content
  4614. j = wrap[ 0 ];
  4615. while ( j-- ) {
  4616. tmp = tmp.lastChild;
  4617. }
  4618. // Support: QtWebKit
  4619. // jQuery.merge because push.apply(_, arraylike) throws
  4620. jQuery.merge( nodes, tmp.childNodes );
  4621. // Remember the top-level container
  4622. tmp = fragment.firstChild;
  4623. // Fixes #12346
  4624. // Support: Webkit, IE
  4625. tmp.textContent = "";
  4626. }
  4627. }
  4628. }
  4629. // Remove wrapper from fragment
  4630. fragment.textContent = "";
  4631. i = 0;
  4632. while ( (elem = nodes[ i++ ]) ) {
  4633. // #4087 - If origin and destination elements are the same, and this is
  4634. // that element, do not do anything
  4635. if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
  4636. continue;
  4637. }
  4638. contains = jQuery.contains( elem.ownerDocument, elem );
  4639. // Append to fragment
  4640. tmp = getAll( fragment.appendChild( elem ), "script" );
  4641. // Preserve script evaluation history
  4642. if ( contains ) {
  4643. setGlobalEval( tmp );
  4644. }
  4645. // Capture executables
  4646. if ( scripts ) {
  4647. j = 0;
  4648. while ( (elem = tmp[ j++ ]) ) {
  4649. if ( rscriptType.test( elem.type || "" ) ) {
  4650. scripts.push( elem );
  4651. }
  4652. }
  4653. }
  4654. }
  4655. return fragment;
  4656. },
  4657. cleanData: function( elems ) {
  4658. var data, elem, events, type, key, j,
  4659. special = jQuery.event.special,
  4660. i = 0;
  4661. for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
  4662. if ( jQuery.acceptData( elem ) ) {
  4663. key = elem[ data_priv.expando ];
  4664. if ( key && (data = data_priv.cache[ key ]) ) {
  4665. events = Object.keys( data.events || {} );
  4666. if ( events.length ) {
  4667. for ( j = 0; (type = events[j]) !== undefined; j++ ) {
  4668. if ( special[ type ] ) {
  4669. jQuery.event.remove( elem, type );
  4670. // This is a shortcut to avoid jQuery.event.remove's overhead
  4671. } else {
  4672. jQuery.removeEvent( elem, type, data.handle );
  4673. }
  4674. }
  4675. }
  4676. if ( data_priv.cache[ key ] ) {
  4677. // Discard any remaining `private` data
  4678. delete data_priv.cache[ key ];
  4679. }
  4680. }
  4681. }
  4682. // Discard any remaining `user` data
  4683. delete data_user.cache[ elem[ data_user.expando ] ];
  4684. }
  4685. }
  4686. });
  4687. jQuery.fn.extend({
  4688. text: function( value ) {
  4689. return access( this, function( value ) {
  4690. return value === undefined ?
  4691. jQuery.text( this ) :
  4692. this.empty().each(function() {
  4693. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4694. this.textContent = value;
  4695. }
  4696. });
  4697. }, null, value, arguments.length );
  4698. },
  4699. append: function() {
  4700. return this.domManip( arguments, function( elem ) {
  4701. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4702. var target = manipulationTarget( this, elem );
  4703. target.appendChild( elem );
  4704. }
  4705. });
  4706. },
  4707. prepend: function() {
  4708. return this.domManip( arguments, function( elem ) {
  4709. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4710. var target = manipulationTarget( this, elem );
  4711. target.insertBefore( elem, target.firstChild );
  4712. }
  4713. });
  4714. },
  4715. before: function() {
  4716. return this.domManip( arguments, function( elem ) {
  4717. if ( this.parentNode ) {
  4718. this.parentNode.insertBefore( elem, this );
  4719. }
  4720. });
  4721. },
  4722. after: function() {
  4723. return this.domManip( arguments, function( elem ) {
  4724. if ( this.parentNode ) {
  4725. this.parentNode.insertBefore( elem, this.nextSibling );
  4726. }
  4727. });
  4728. },
  4729. remove: function( selector, keepData /* Internal Use Only */ ) {
  4730. var elem,
  4731. elems = selector ? jQuery.filter( selector, this ) : this,
  4732. i = 0;
  4733. for ( ; (elem = elems[i]) != null; i++ ) {
  4734. if ( !keepData && elem.nodeType === 1 ) {
  4735. jQuery.cleanData( getAll( elem ) );
  4736. }
  4737. if ( elem.parentNode ) {
  4738. if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
  4739. setGlobalEval( getAll( elem, "script" ) );
  4740. }
  4741. elem.parentNode.removeChild( elem );
  4742. }
  4743. }
  4744. return this;
  4745. },
  4746. empty: function() {
  4747. var elem,
  4748. i = 0;
  4749. for ( ; (elem = this[i]) != null; i++ ) {
  4750. if ( elem.nodeType === 1 ) {
  4751. // Prevent memory leaks
  4752. jQuery.cleanData( getAll( elem, false ) );
  4753. // Remove any remaining nodes
  4754. elem.textContent = "";
  4755. }
  4756. }
  4757. return this;
  4758. },
  4759. clone: function( dataAndEvents, deepDataAndEvents ) {
  4760. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  4761. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  4762. return this.map(function() {
  4763. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  4764. });
  4765. },
  4766. html: function( value ) {
  4767. return access( this, function( value ) {
  4768. var elem = this[ 0 ] || {},
  4769. i = 0,
  4770. l = this.length;
  4771. if ( value === undefined && elem.nodeType === 1 ) {
  4772. return elem.innerHTML;
  4773. }
  4774. // See if we can take a shortcut and just use innerHTML
  4775. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  4776. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  4777. value = value.replace( rxhtmlTag, "<$1></$2>" );
  4778. try {
  4779. for ( ; i < l; i++ ) {
  4780. elem = this[ i ] || {};
  4781. // Remove element nodes and prevent memory leaks
  4782. if ( elem.nodeType === 1 ) {
  4783. jQuery.cleanData( getAll( elem, false ) );
  4784. elem.innerHTML = value;
  4785. }
  4786. }
  4787. elem = 0;
  4788. // If using innerHTML throws an exception, use the fallback method
  4789. } catch( e ) {}
  4790. }
  4791. if ( elem ) {
  4792. this.empty().append( value );
  4793. }
  4794. }, null, value, arguments.length );
  4795. },
  4796. replaceWith: function() {
  4797. var arg = arguments[ 0 ];
  4798. // Make the changes, replacing each context element with the new content
  4799. this.domManip( arguments, function( elem ) {
  4800. arg = this.parentNode;
  4801. jQuery.cleanData( getAll( this ) );
  4802. if ( arg ) {
  4803. arg.replaceChild( elem, this );
  4804. }
  4805. });
  4806. // Force removal if there was no new content (e.g., from empty arguments)
  4807. return arg && (arg.length || arg.nodeType) ? this : this.remove();
  4808. },
  4809. detach: function( selector ) {
  4810. return this.remove( selector, true );
  4811. },
  4812. domManip: function( args, callback ) {
  4813. // Flatten any nested arrays
  4814. args = concat.apply( [], args );
  4815. var fragment, first, scripts, hasScripts, node, doc,
  4816. i = 0,
  4817. l = this.length,
  4818. set = this,
  4819. iNoClone = l - 1,
  4820. value = args[ 0 ],
  4821. isFunction = jQuery.isFunction( value );
  4822. // We can't cloneNode fragments that contain checked, in WebKit
  4823. if ( isFunction ||
  4824. ( l > 1 && typeof value === "string" &&
  4825. !support.checkClone && rchecked.test( value ) ) ) {
  4826. return this.each(function( index ) {
  4827. var self = set.eq( index );
  4828. if ( isFunction ) {
  4829. args[ 0 ] = value.call( this, index, self.html() );
  4830. }
  4831. self.domManip( args, callback );
  4832. });
  4833. }
  4834. if ( l ) {
  4835. fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
  4836. first = fragment.firstChild;
  4837. if ( fragment.childNodes.length === 1 ) {
  4838. fragment = first;
  4839. }
  4840. if ( first ) {
  4841. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  4842. hasScripts = scripts.length;
  4843. // Use the original fragment for the last item instead of the first because it can end up
  4844. // being emptied incorrectly in certain situations (#8070).
  4845. for ( ; i < l; i++ ) {
  4846. node = fragment;
  4847. if ( i !== iNoClone ) {
  4848. node = jQuery.clone( node, true, true );
  4849. // Keep references to cloned scripts for later restoration
  4850. if ( hasScripts ) {
  4851. // Support: QtWebKit
  4852. // jQuery.merge because push.apply(_, arraylike) throws
  4853. jQuery.merge( scripts, getAll( node, "script" ) );
  4854. }
  4855. }
  4856. callback.call( this[ i ], node, i );
  4857. }
  4858. if ( hasScripts ) {
  4859. doc = scripts[ scripts.length - 1 ].ownerDocument;
  4860. // Reenable scripts
  4861. jQuery.map( scripts, restoreScript );
  4862. // Evaluate executable scripts on first document insertion
  4863. for ( i = 0; i < hasScripts; i++ ) {
  4864. node = scripts[ i ];
  4865. if ( rscriptType.test( node.type || "" ) &&
  4866. !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
  4867. if ( node.src ) {
  4868. // Optional AJAX dependency, but won't run scripts if not present
  4869. if ( jQuery._evalUrl ) {
  4870. jQuery._evalUrl( node.src );
  4871. }
  4872. } else {
  4873. jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
  4874. }
  4875. }
  4876. }
  4877. }
  4878. }
  4879. }
  4880. return this;
  4881. }
  4882. });
  4883. jQuery.each({
  4884. appendTo: "append",
  4885. prependTo: "prepend",
  4886. insertBefore: "before",
  4887. insertAfter: "after",
  4888. replaceAll: "replaceWith"
  4889. }, function( name, original ) {
  4890. jQuery.fn[ name ] = function( selector ) {
  4891. var elems,
  4892. ret = [],
  4893. insert = jQuery( selector ),
  4894. last = insert.length - 1,
  4895. i = 0;
  4896. for ( ; i <= last; i++ ) {
  4897. elems = i === last ? this : this.clone( true );
  4898. jQuery( insert[ i ] )[ original ]( elems );
  4899. // Support: QtWebKit
  4900. // .get() because push.apply(_, arraylike) throws
  4901. push.apply( ret, elems.get() );
  4902. }
  4903. return this.pushStack( ret );
  4904. };
  4905. });
  4906. var iframe,
  4907. elemdisplay = {};
  4908. /**
  4909. * Retrieve the actual display of a element
  4910. * @param {String} name nodeName of the element
  4911. * @param {Object} doc Document object
  4912. */
  4913. // Called only from within defaultDisplay
  4914. function actualDisplay( name, doc ) {
  4915. var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
  4916. // getDefaultComputedStyle might be reliably used only on attached element
  4917. display = window.getDefaultComputedStyle ?
  4918. // Use of this method is a temporary fix (more like optmization) until something better comes along,
  4919. // since it was removed from specification and supported only in FF
  4920. window.getDefaultComputedStyle( elem[ 0 ] ).display : jQuery.css( elem[ 0 ], "display" );
  4921. // We don't have any data stored on the element,
  4922. // so use "detach" method as fast way to get rid of the element
  4923. elem.detach();
  4924. return display;
  4925. }
  4926. /**
  4927. * Try to determine the default display value of an element
  4928. * @param {String} nodeName
  4929. */
  4930. function defaultDisplay( nodeName ) {
  4931. var doc = document,
  4932. display = elemdisplay[ nodeName ];
  4933. if ( !display ) {
  4934. display = actualDisplay( nodeName, doc );
  4935. // If the simple way fails, read from inside an iframe
  4936. if ( display === "none" || !display ) {
  4937. // Use the already-created iframe if possible
  4938. iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
  4939. // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
  4940. doc = iframe[ 0 ].contentDocument;
  4941. // Support: IE
  4942. doc.write();
  4943. doc.close();
  4944. display = actualDisplay( nodeName, doc );
  4945. iframe.detach();
  4946. }
  4947. // Store the correct default display
  4948. elemdisplay[ nodeName ] = display;
  4949. }
  4950. return display;
  4951. }
  4952. var rmargin = (/^margin/);
  4953. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  4954. var getStyles = function( elem ) {
  4955. return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
  4956. };
  4957. function curCSS( elem, name, computed ) {
  4958. var width, minWidth, maxWidth, ret,
  4959. style = elem.style;
  4960. computed = computed || getStyles( elem );
  4961. // Support: IE9
  4962. // getPropertyValue is only needed for .css('filter') in IE9, see #12537
  4963. if ( computed ) {
  4964. ret = computed.getPropertyValue( name ) || computed[ name ];
  4965. }
  4966. if ( computed ) {
  4967. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  4968. ret = jQuery.style( elem, name );
  4969. }
  4970. // Support: iOS < 6
  4971. // A tribute to the "awesome hack by Dean Edwards"
  4972. // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
  4973. // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
  4974. if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
  4975. // Remember the original values
  4976. width = style.width;
  4977. minWidth = style.minWidth;
  4978. maxWidth = style.maxWidth;
  4979. // Put in the new values to get a computed value out
  4980. style.minWidth = style.maxWidth = style.width = ret;
  4981. ret = computed.width;
  4982. // Revert the changed values
  4983. style.width = width;
  4984. style.minWidth = minWidth;
  4985. style.maxWidth = maxWidth;
  4986. }
  4987. }
  4988. return ret !== undefined ?
  4989. // Support: IE
  4990. // IE returns zIndex value as an integer.
  4991. ret + "" :
  4992. ret;
  4993. }
  4994. function addGetHookIf( conditionFn, hookFn ) {
  4995. // Define the hook, we'll check on the first run if it's really needed.
  4996. return {
  4997. get: function() {
  4998. if ( conditionFn() ) {
  4999. // Hook not needed (or it's not possible to use it due to missing dependency),
  5000. // remove it.
  5001. // Since there are no other hooks for marginRight, remove the whole object.
  5002. delete this.get;
  5003. return;
  5004. }
  5005. // Hook needed; redefine it so that the support test is not executed again.
  5006. return (this.get = hookFn).apply( this, arguments );
  5007. }
  5008. };
  5009. }
  5010. (function() {
  5011. var pixelPositionVal, boxSizingReliableVal,
  5012. // Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
  5013. divReset = "padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;" +
  5014. "-moz-box-sizing:content-box;box-sizing:content-box",
  5015. docElem = document.documentElement,
  5016. container = document.createElement( "div" ),
  5017. div = document.createElement( "div" );
  5018. div.style.backgroundClip = "content-box";
  5019. div.cloneNode( true ).style.backgroundClip = "";
  5020. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  5021. container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;" +
  5022. "margin-top:1px";
  5023. container.appendChild( div );
  5024. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  5025. // so they're executed at the same time to save the second computation.
  5026. function computePixelPositionAndBoxSizingReliable() {
  5027. // Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
  5028. div.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
  5029. "box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;" +
  5030. "position:absolute;top:1%";
  5031. docElem.appendChild( container );
  5032. var divStyle = window.getComputedStyle( div, null );
  5033. pixelPositionVal = divStyle.top !== "1%";
  5034. boxSizingReliableVal = divStyle.width === "4px";
  5035. docElem.removeChild( container );
  5036. }
  5037. // Use window.getComputedStyle because jsdom on node.js will break without it.
  5038. if ( window.getComputedStyle ) {
  5039. jQuery.extend(support, {
  5040. pixelPosition: function() {
  5041. // This test is executed only once but we still do memoizing
  5042. // since we can use the boxSizingReliable pre-computing.
  5043. // No need to check if the test was already performed, though.
  5044. computePixelPositionAndBoxSizingReliable();
  5045. return pixelPositionVal;
  5046. },
  5047. boxSizingReliable: function() {
  5048. if ( boxSizingReliableVal == null ) {
  5049. computePixelPositionAndBoxSizingReliable();
  5050. }
  5051. return boxSizingReliableVal;
  5052. },
  5053. reliableMarginRight: function() {
  5054. // Support: Android 2.3
  5055. // Check if div with explicit width and no margin-right incorrectly
  5056. // gets computed margin-right based on width of container. (#3333)
  5057. // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
  5058. // This support function is only executed once so no memoizing is needed.
  5059. var ret,
  5060. marginDiv = div.appendChild( document.createElement( "div" ) );
  5061. marginDiv.style.cssText = div.style.cssText = divReset;
  5062. marginDiv.style.marginRight = marginDiv.style.width = "0";
  5063. div.style.width = "1px";
  5064. docElem.appendChild( container );
  5065. ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
  5066. docElem.removeChild( container );
  5067. // Clean up the div for other support tests.
  5068. div.innerHTML = "";
  5069. return ret;
  5070. }
  5071. });
  5072. }
  5073. })();
  5074. // A method for quickly swapping in/out CSS properties to get correct calculations.
  5075. jQuery.swap = function( elem, options, callback, args ) {
  5076. var ret, name,
  5077. old = {};
  5078. // Remember the old values, and insert the new ones
  5079. for ( name in options ) {
  5080. old[ name ] = elem.style[ name ];
  5081. elem.style[ name ] = options[ name ];
  5082. }
  5083. ret = callback.apply( elem, args || [] );
  5084. // Revert the old values
  5085. for ( name in options ) {
  5086. elem.style[ name ] = old[ name ];
  5087. }
  5088. return ret;
  5089. };
  5090. var
  5091. // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
  5092. // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  5093. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  5094. rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
  5095. rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
  5096. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  5097. cssNormalTransform = {
  5098. letterSpacing: 0,
  5099. fontWeight: 400
  5100. },
  5101. cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
  5102. // return a css property mapped to a potentially vendor prefixed property
  5103. function vendorPropName( style, name ) {
  5104. // shortcut for names that are not vendor prefixed
  5105. if ( name in style ) {
  5106. return name;
  5107. }
  5108. // check for vendor prefixed names
  5109. var capName = name[0].toUpperCase() + name.slice(1),
  5110. origName = name,
  5111. i = cssPrefixes.length;
  5112. while ( i-- ) {
  5113. name = cssPrefixes[ i ] + capName;
  5114. if ( name in style ) {
  5115. return name;
  5116. }
  5117. }
  5118. return origName;
  5119. }
  5120. function setPositiveNumber( elem, value, subtract ) {
  5121. var matches = rnumsplit.exec( value );
  5122. return matches ?
  5123. // Guard against undefined "subtract", e.g., when used as in cssHooks
  5124. Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
  5125. value;
  5126. }
  5127. function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
  5128. var i = extra === ( isBorderBox ? "border" : "content" ) ?
  5129. // If we already have the right measurement, avoid augmentation
  5130. 4 :
  5131. // Otherwise initialize for horizontal or vertical properties
  5132. name === "width" ? 1 : 0,
  5133. val = 0;
  5134. for ( ; i < 4; i += 2 ) {
  5135. // both box models exclude margin, so add it if we want it
  5136. if ( extra === "margin" ) {
  5137. val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
  5138. }
  5139. if ( isBorderBox ) {
  5140. // border-box includes padding, so remove it if we want content
  5141. if ( extra === "content" ) {
  5142. val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5143. }
  5144. // at this point, extra isn't border nor margin, so remove border
  5145. if ( extra !== "margin" ) {
  5146. val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5147. }
  5148. } else {
  5149. // at this point, extra isn't content, so add padding
  5150. val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5151. // at this point, extra isn't content nor padding, so add border
  5152. if ( extra !== "padding" ) {
  5153. val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5154. }
  5155. }
  5156. }
  5157. return val;
  5158. }
  5159. function getWidthOrHeight( elem, name, extra ) {
  5160. // Start with offset property, which is equivalent to the border-box value
  5161. var valueIsBorderBox = true,
  5162. val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
  5163. styles = getStyles( elem ),
  5164. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  5165. // some non-html elements return undefined for offsetWidth, so check for null/undefined
  5166. // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
  5167. // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
  5168. if ( val <= 0 || val == null ) {
  5169. // Fall back to computed then uncomputed css if necessary
  5170. val = curCSS( elem, name, styles );
  5171. if ( val < 0 || val == null ) {
  5172. val = elem.style[ name ];
  5173. }
  5174. // Computed unit is not pixels. Stop here and return.
  5175. if ( rnumnonpx.test(val) ) {
  5176. return val;
  5177. }
  5178. // we need the check for style in case a browser which returns unreliable values
  5179. // for getComputedStyle silently falls back to the reliable elem.style
  5180. valueIsBorderBox = isBorderBox &&
  5181. ( support.boxSizingReliable() || val === elem.style[ name ] );
  5182. // Normalize "", auto, and prepare for extra
  5183. val = parseFloat( val ) || 0;
  5184. }
  5185. // use the active box-sizing model to add/subtract irrelevant styles
  5186. return ( val +
  5187. augmentWidthOrHeight(
  5188. elem,
  5189. name,
  5190. extra || ( isBorderBox ? "border" : "content" ),
  5191. valueIsBorderBox,
  5192. styles
  5193. )
  5194. ) + "px";
  5195. }
  5196. function showHide( elements, show ) {
  5197. var display, elem, hidden,
  5198. values = [],
  5199. index = 0,
  5200. length = elements.length;
  5201. for ( ; index < length; index++ ) {
  5202. elem = elements[ index ];
  5203. if ( !elem.style ) {
  5204. continue;
  5205. }
  5206. values[ index ] = data_priv.get( elem, "olddisplay" );
  5207. display = elem.style.display;
  5208. if ( show ) {
  5209. // Reset the inline display of this element to learn if it is
  5210. // being hidden by cascaded rules or not
  5211. if ( !values[ index ] && display === "none" ) {
  5212. elem.style.display = "";
  5213. }
  5214. // Set elements which have been overridden with display: none
  5215. // in a stylesheet to whatever the default browser style is
  5216. // for such an element
  5217. if ( elem.style.display === "" && isHidden( elem ) ) {
  5218. values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) );
  5219. }
  5220. } else {
  5221. if ( !values[ index ] ) {
  5222. hidden = isHidden( elem );
  5223. if ( display && display !== "none" || !hidden ) {
  5224. data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css(elem, "display") );
  5225. }
  5226. }
  5227. }
  5228. }
  5229. // Set the display of most of the elements in a second loop
  5230. // to avoid the constant reflow
  5231. for ( index = 0; index < length; index++ ) {
  5232. elem = elements[ index ];
  5233. if ( !elem.style ) {
  5234. continue;
  5235. }
  5236. if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
  5237. elem.style.display = show ? values[ index ] || "" : "none";
  5238. }
  5239. }
  5240. return elements;
  5241. }
  5242. jQuery.extend({
  5243. // Add in style property hooks for overriding the default
  5244. // behavior of getting and setting a style property
  5245. cssHooks: {
  5246. opacity: {
  5247. get: function( elem, computed ) {
  5248. if ( computed ) {
  5249. // We should always get a number back from opacity
  5250. var ret = curCSS( elem, "opacity" );
  5251. return ret === "" ? "1" : ret;
  5252. }
  5253. }
  5254. }
  5255. },
  5256. // Don't automatically add "px" to these possibly-unitless properties
  5257. cssNumber: {
  5258. "columnCount": true,
  5259. "fillOpacity": true,
  5260. "fontWeight": true,
  5261. "lineHeight": true,
  5262. "opacity": true,
  5263. "order": true,
  5264. "orphans": true,
  5265. "widows": true,
  5266. "zIndex": true,
  5267. "zoom": true
  5268. },
  5269. // Add in properties whose names you wish to fix before
  5270. // setting or getting the value
  5271. cssProps: {
  5272. // normalize float css property
  5273. "float": "cssFloat"
  5274. },
  5275. // Get and set the style property on a DOM Node
  5276. style: function( elem, name, value, extra ) {
  5277. // Don't set styles on text and comment nodes
  5278. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  5279. return;
  5280. }
  5281. // Make sure that we're working with the right name
  5282. var ret, type, hooks,
  5283. origName = jQuery.camelCase( name ),
  5284. style = elem.style;
  5285. name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
  5286. // gets hook for the prefixed version
  5287. // followed by the unprefixed version
  5288. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5289. // Check if we're setting a value
  5290. if ( value !== undefined ) {
  5291. type = typeof value;
  5292. // convert relative number strings (+= or -=) to relative numbers. #7345
  5293. if ( type === "string" && (ret = rrelNum.exec( value )) ) {
  5294. value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
  5295. // Fixes bug #9237
  5296. type = "number";
  5297. }
  5298. // Make sure that null and NaN values aren't set. See: #7116
  5299. if ( value == null || value !== value ) {
  5300. return;
  5301. }
  5302. // If a number was passed in, add 'px' to the (except for certain CSS properties)
  5303. if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
  5304. value += "px";
  5305. }
  5306. // Fixes #8908, it can be done more correctly by specifying setters in cssHooks,
  5307. // but it would mean to define eight (for every problematic property) identical functions
  5308. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  5309. style[ name ] = "inherit";
  5310. }
  5311. // If a hook was provided, use that value, otherwise just set the specified value
  5312. if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
  5313. // Support: Chrome, Safari
  5314. // Setting style to blank string required to delete "style: x !important;"
  5315. style[ name ] = "";
  5316. style[ name ] = value;
  5317. }
  5318. } else {
  5319. // If a hook was provided get the non-computed value from there
  5320. if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
  5321. return ret;
  5322. }
  5323. // Otherwise just get the value from the style object
  5324. return style[ name ];
  5325. }
  5326. },
  5327. css: function( elem, name, extra, styles ) {
  5328. var val, num, hooks,
  5329. origName = jQuery.camelCase( name );
  5330. // Make sure that we're working with the right name
  5331. name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
  5332. // gets hook for the prefixed version
  5333. // followed by the unprefixed version
  5334. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5335. // If a hook was provided get the computed value from there
  5336. if ( hooks && "get" in hooks ) {
  5337. val = hooks.get( elem, true, extra );
  5338. }
  5339. // Otherwise, if a way to get the computed value exists, use that
  5340. if ( val === undefined ) {
  5341. val = curCSS( elem, name, styles );
  5342. }
  5343. //convert "normal" to computed value
  5344. if ( val === "normal" && name in cssNormalTransform ) {
  5345. val = cssNormalTransform[ name ];
  5346. }
  5347. // Return, converting to number if forced or a qualifier was provided and val looks numeric
  5348. if ( extra === "" || extra ) {
  5349. num = parseFloat( val );
  5350. return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
  5351. }
  5352. return val;
  5353. }
  5354. });
  5355. jQuery.each([ "height", "width" ], function( i, name ) {
  5356. jQuery.cssHooks[ name ] = {
  5357. get: function( elem, computed, extra ) {
  5358. if ( computed ) {
  5359. // certain elements can have dimension info if we invisibly show them
  5360. // however, it must have a current display style that would benefit from this
  5361. return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
  5362. jQuery.swap( elem, cssShow, function() {
  5363. return getWidthOrHeight( elem, name, extra );
  5364. }) :
  5365. getWidthOrHeight( elem, name, extra );
  5366. }
  5367. },
  5368. set: function( elem, value, extra ) {
  5369. var styles = extra && getStyles( elem );
  5370. return setPositiveNumber( elem, value, extra ?
  5371. augmentWidthOrHeight(
  5372. elem,
  5373. name,
  5374. extra,
  5375. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  5376. styles
  5377. ) : 0
  5378. );
  5379. }
  5380. };
  5381. });
  5382. // Support: Android 2.3
  5383. jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
  5384. function( elem, computed ) {
  5385. if ( computed ) {
  5386. // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
  5387. // Work around by temporarily setting element display to inline-block
  5388. return jQuery.swap( elem, { "display": "inline-block" },
  5389. curCSS, [ elem, "marginRight" ] );
  5390. }
  5391. }
  5392. );
  5393. // These hooks are used by animate to expand properties
  5394. jQuery.each({
  5395. margin: "",
  5396. padding: "",
  5397. border: "Width"
  5398. }, function( prefix, suffix ) {
  5399. jQuery.cssHooks[ prefix + suffix ] = {
  5400. expand: function( value ) {
  5401. var i = 0,
  5402. expanded = {},
  5403. // assumes a single number if not a string
  5404. parts = typeof value === "string" ? value.split(" ") : [ value ];
  5405. for ( ; i < 4; i++ ) {
  5406. expanded[ prefix + cssExpand[ i ] + suffix ] =
  5407. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  5408. }
  5409. return expanded;
  5410. }
  5411. };
  5412. if ( !rmargin.test( prefix ) ) {
  5413. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  5414. }
  5415. });
  5416. jQuery.fn.extend({
  5417. css: function( name, value ) {
  5418. return access( this, function( elem, name, value ) {
  5419. var styles, len,
  5420. map = {},
  5421. i = 0;
  5422. if ( jQuery.isArray( name ) ) {
  5423. styles = getStyles( elem );
  5424. len = name.length;
  5425. for ( ; i < len; i++ ) {
  5426. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  5427. }
  5428. return map;
  5429. }
  5430. return value !== undefined ?
  5431. jQuery.style( elem, name, value ) :
  5432. jQuery.css( elem, name );
  5433. }, name, value, arguments.length > 1 );
  5434. },
  5435. show: function() {
  5436. return showHide( this, true );
  5437. },
  5438. hide: function() {
  5439. return showHide( this );
  5440. },
  5441. toggle: function( state ) {
  5442. if ( typeof state === "boolean" ) {
  5443. return state ? this.show() : this.hide();
  5444. }
  5445. return this.each(function() {
  5446. if ( isHidden( this ) ) {
  5447. jQuery( this ).show();
  5448. } else {
  5449. jQuery( this ).hide();
  5450. }
  5451. });
  5452. }
  5453. });
  5454. function Tween( elem, options, prop, end, easing ) {
  5455. return new Tween.prototype.init( elem, options, prop, end, easing );
  5456. }
  5457. jQuery.Tween = Tween;
  5458. Tween.prototype = {
  5459. constructor: Tween,
  5460. init: function( elem, options, prop, end, easing, unit ) {
  5461. this.elem = elem;
  5462. this.prop = prop;
  5463. this.easing = easing || "swing";
  5464. this.options = options;
  5465. this.start = this.now = this.cur();
  5466. this.end = end;
  5467. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  5468. },
  5469. cur: function() {
  5470. var hooks = Tween.propHooks[ this.prop ];
  5471. return hooks && hooks.get ?
  5472. hooks.get( this ) :
  5473. Tween.propHooks._default.get( this );
  5474. },
  5475. run: function( percent ) {
  5476. var eased,
  5477. hooks = Tween.propHooks[ this.prop ];
  5478. if ( this.options.duration ) {
  5479. this.pos = eased = jQuery.easing[ this.easing ](
  5480. percent, this.options.duration * percent, 0, 1, this.options.duration
  5481. );
  5482. } else {
  5483. this.pos = eased = percent;
  5484. }
  5485. this.now = ( this.end - this.start ) * eased + this.start;
  5486. if ( this.options.step ) {
  5487. this.options.step.call( this.elem, this.now, this );
  5488. }
  5489. if ( hooks && hooks.set ) {
  5490. hooks.set( this );
  5491. } else {
  5492. Tween.propHooks._default.set( this );
  5493. }
  5494. return this;
  5495. }
  5496. };
  5497. Tween.prototype.init.prototype = Tween.prototype;
  5498. Tween.propHooks = {
  5499. _default: {
  5500. get: function( tween ) {
  5501. var result;
  5502. if ( tween.elem[ tween.prop ] != null &&
  5503. (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
  5504. return tween.elem[ tween.prop ];
  5505. }
  5506. // passing an empty string as a 3rd parameter to .css will automatically
  5507. // attempt a parseFloat and fallback to a string if the parse fails
  5508. // so, simple values such as "10px" are parsed to Float.
  5509. // complex values such as "rotate(1rad)" are returned as is.
  5510. result = jQuery.css( tween.elem, tween.prop, "" );
  5511. // Empty strings, null, undefined and "auto" are converted to 0.
  5512. return !result || result === "auto" ? 0 : result;
  5513. },
  5514. set: function( tween ) {
  5515. // use step hook for back compat - use cssHook if its there - use .style if its
  5516. // available and use plain properties where available
  5517. if ( jQuery.fx.step[ tween.prop ] ) {
  5518. jQuery.fx.step[ tween.prop ]( tween );
  5519. } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
  5520. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  5521. } else {
  5522. tween.elem[ tween.prop ] = tween.now;
  5523. }
  5524. }
  5525. }
  5526. };
  5527. // Support: IE9
  5528. // Panic based approach to setting things on disconnected nodes
  5529. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  5530. set: function( tween ) {
  5531. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  5532. tween.elem[ tween.prop ] = tween.now;
  5533. }
  5534. }
  5535. };
  5536. jQuery.easing = {
  5537. linear: function( p ) {
  5538. return p;
  5539. },
  5540. swing: function( p ) {
  5541. return 0.5 - Math.cos( p * Math.PI ) / 2;
  5542. }
  5543. };
  5544. jQuery.fx = Tween.prototype.init;
  5545. // Back Compat <1.8 extension point
  5546. jQuery.fx.step = {};
  5547. var
  5548. fxNow, timerId,
  5549. rfxtypes = /^(?:toggle|show|hide)$/,
  5550. rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
  5551. rrun = /queueHooks$/,
  5552. animationPrefilters = [ defaultPrefilter ],
  5553. tweeners = {
  5554. "*": [ function( prop, value ) {
  5555. var tween = this.createTween( prop, value ),
  5556. target = tween.cur(),
  5557. parts = rfxnum.exec( value ),
  5558. unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  5559. // Starting value computation is required for potential unit mismatches
  5560. start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
  5561. rfxnum.exec( jQuery.css( tween.elem, prop ) ),
  5562. scale = 1,
  5563. maxIterations = 20;
  5564. if ( start && start[ 3 ] !== unit ) {
  5565. // Trust units reported by jQuery.css
  5566. unit = unit || start[ 3 ];
  5567. // Make sure we update the tween properties later on
  5568. parts = parts || [];
  5569. // Iteratively approximate from a nonzero starting point
  5570. start = +target || 1;
  5571. do {
  5572. // If previous iteration zeroed out, double until we get *something*
  5573. // Use a string for doubling factor so we don't accidentally see scale as unchanged below
  5574. scale = scale || ".5";
  5575. // Adjust and apply
  5576. start = start / scale;
  5577. jQuery.style( tween.elem, prop, start + unit );
  5578. // Update scale, tolerating zero or NaN from tween.cur()
  5579. // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
  5580. } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
  5581. }
  5582. // Update tween properties
  5583. if ( parts ) {
  5584. start = tween.start = +start || +target || 0;
  5585. tween.unit = unit;
  5586. // If a +=/-= token was provided, we're doing a relative animation
  5587. tween.end = parts[ 1 ] ?
  5588. start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
  5589. +parts[ 2 ];
  5590. }
  5591. return tween;
  5592. } ]
  5593. };
  5594. // Animations created synchronously will run synchronously
  5595. function createFxNow() {
  5596. setTimeout(function() {
  5597. fxNow = undefined;
  5598. });
  5599. return ( fxNow = jQuery.now() );
  5600. }
  5601. // Generate parameters to create a standard animation
  5602. function genFx( type, includeWidth ) {
  5603. var which,
  5604. i = 0,
  5605. attrs = { height: type };
  5606. // if we include width, step value is 1 to do all cssExpand values,
  5607. // if we don't include width, step value is 2 to skip over Left and Right
  5608. includeWidth = includeWidth ? 1 : 0;
  5609. for ( ; i < 4 ; i += 2 - includeWidth ) {
  5610. which = cssExpand[ i ];
  5611. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  5612. }
  5613. if ( includeWidth ) {
  5614. attrs.opacity = attrs.width = type;
  5615. }
  5616. return attrs;
  5617. }
  5618. function createTween( value, prop, animation ) {
  5619. var tween,
  5620. collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
  5621. index = 0,
  5622. length = collection.length;
  5623. for ( ; index < length; index++ ) {
  5624. if ( (tween = collection[ index ].call( animation, prop, value )) ) {
  5625. // we're done with this property
  5626. return tween;
  5627. }
  5628. }
  5629. }
  5630. function defaultPrefilter( elem, props, opts ) {
  5631. /* jshint validthis: true */
  5632. var prop, value, toggle, tween, hooks, oldfire, display,
  5633. anim = this,
  5634. orig = {},
  5635. style = elem.style,
  5636. hidden = elem.nodeType && isHidden( elem ),
  5637. dataShow = data_priv.get( elem, "fxshow" );
  5638. // handle queue: false promises
  5639. if ( !opts.queue ) {
  5640. hooks = jQuery._queueHooks( elem, "fx" );
  5641. if ( hooks.unqueued == null ) {
  5642. hooks.unqueued = 0;
  5643. oldfire = hooks.empty.fire;
  5644. hooks.empty.fire = function() {
  5645. if ( !hooks.unqueued ) {
  5646. oldfire();
  5647. }
  5648. };
  5649. }
  5650. hooks.unqueued++;
  5651. anim.always(function() {
  5652. // doing this makes sure that the complete handler will be called
  5653. // before this completes
  5654. anim.always(function() {
  5655. hooks.unqueued--;
  5656. if ( !jQuery.queue( elem, "fx" ).length ) {
  5657. hooks.empty.fire();
  5658. }
  5659. });
  5660. });
  5661. }
  5662. // height/width overflow pass
  5663. if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
  5664. // Make sure that nothing sneaks out
  5665. // Record all 3 overflow attributes because IE9-10 do not
  5666. // change the overflow attribute when overflowX and
  5667. // overflowY are set to the same value
  5668. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  5669. // Set display property to inline-block for height/width
  5670. // animations on inline elements that are having width/height animated
  5671. display = jQuery.css( elem, "display" );
  5672. // Get default display if display is currently "none"
  5673. if ( display === "none" ) {
  5674. display = defaultDisplay( elem.nodeName );
  5675. }
  5676. if ( display === "inline" &&
  5677. jQuery.css( elem, "float" ) === "none" ) {
  5678. style.display = "inline-block";
  5679. }
  5680. }
  5681. if ( opts.overflow ) {
  5682. style.overflow = "hidden";
  5683. anim.always(function() {
  5684. style.overflow = opts.overflow[ 0 ];
  5685. style.overflowX = opts.overflow[ 1 ];
  5686. style.overflowY = opts.overflow[ 2 ];
  5687. });
  5688. }
  5689. // show/hide pass
  5690. for ( prop in props ) {
  5691. value = props[ prop ];
  5692. if ( rfxtypes.exec( value ) ) {
  5693. delete props[ prop ];
  5694. toggle = toggle || value === "toggle";
  5695. if ( value === ( hidden ? "hide" : "show" ) ) {
  5696. // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden
  5697. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  5698. hidden = true;
  5699. } else {
  5700. continue;
  5701. }
  5702. }
  5703. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  5704. }
  5705. }
  5706. if ( !jQuery.isEmptyObject( orig ) ) {
  5707. if ( dataShow ) {
  5708. if ( "hidden" in dataShow ) {
  5709. hidden = dataShow.hidden;
  5710. }
  5711. } else {
  5712. dataShow = data_priv.access( elem, "fxshow", {} );
  5713. }
  5714. // store state if its toggle - enables .stop().toggle() to "reverse"
  5715. if ( toggle ) {
  5716. dataShow.hidden = !hidden;
  5717. }
  5718. if ( hidden ) {
  5719. jQuery( elem ).show();
  5720. } else {
  5721. anim.done(function() {
  5722. jQuery( elem ).hide();
  5723. });
  5724. }
  5725. anim.done(function() {
  5726. var prop;
  5727. data_priv.remove( elem, "fxshow" );
  5728. for ( prop in orig ) {
  5729. jQuery.style( elem, prop, orig[ prop ] );
  5730. }
  5731. });
  5732. for ( prop in orig ) {
  5733. tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  5734. if ( !( prop in dataShow ) ) {
  5735. dataShow[ prop ] = tween.start;
  5736. if ( hidden ) {
  5737. tween.end = tween.start;
  5738. tween.start = prop === "width" || prop === "height" ? 1 : 0;
  5739. }
  5740. }
  5741. }
  5742. }
  5743. }
  5744. function propFilter( props, specialEasing ) {
  5745. var index, name, easing, value, hooks;
  5746. // camelCase, specialEasing and expand cssHook pass
  5747. for ( index in props ) {
  5748. name = jQuery.camelCase( index );
  5749. easing = specialEasing[ name ];
  5750. value = props[ index ];
  5751. if ( jQuery.isArray( value ) ) {
  5752. easing = value[ 1 ];
  5753. value = props[ index ] = value[ 0 ];
  5754. }
  5755. if ( index !== name ) {
  5756. props[ name ] = value;
  5757. delete props[ index ];
  5758. }
  5759. hooks = jQuery.cssHooks[ name ];
  5760. if ( hooks && "expand" in hooks ) {
  5761. value = hooks.expand( value );
  5762. delete props[ name ];
  5763. // not quite $.extend, this wont overwrite keys already present.
  5764. // also - reusing 'index' from above because we have the correct "name"
  5765. for ( index in value ) {
  5766. if ( !( index in props ) ) {
  5767. props[ index ] = value[ index ];
  5768. specialEasing[ index ] = easing;
  5769. }
  5770. }
  5771. } else {
  5772. specialEasing[ name ] = easing;
  5773. }
  5774. }
  5775. }
  5776. function Animation( elem, properties, options ) {
  5777. var result,
  5778. stopped,
  5779. index = 0,
  5780. length = animationPrefilters.length,
  5781. deferred = jQuery.Deferred().always( function() {
  5782. // don't match elem in the :animated selector
  5783. delete tick.elem;
  5784. }),
  5785. tick = function() {
  5786. if ( stopped ) {
  5787. return false;
  5788. }
  5789. var currentTime = fxNow || createFxNow(),
  5790. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  5791. // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
  5792. temp = remaining / animation.duration || 0,
  5793. percent = 1 - temp,
  5794. index = 0,
  5795. length = animation.tweens.length;
  5796. for ( ; index < length ; index++ ) {
  5797. animation.tweens[ index ].run( percent );
  5798. }
  5799. deferred.notifyWith( elem, [ animation, percent, remaining ]);
  5800. if ( percent < 1 && length ) {
  5801. return remaining;
  5802. } else {
  5803. deferred.resolveWith( elem, [ animation ] );
  5804. return false;
  5805. }
  5806. },
  5807. animation = deferred.promise({
  5808. elem: elem,
  5809. props: jQuery.extend( {}, properties ),
  5810. opts: jQuery.extend( true, { specialEasing: {} }, options ),
  5811. originalProperties: properties,
  5812. originalOptions: options,
  5813. startTime: fxNow || createFxNow(),
  5814. duration: options.duration,
  5815. tweens: [],
  5816. createTween: function( prop, end ) {
  5817. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  5818. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  5819. animation.tweens.push( tween );
  5820. return tween;
  5821. },
  5822. stop: function( gotoEnd ) {
  5823. var index = 0,
  5824. // if we are going to the end, we want to run all the tweens
  5825. // otherwise we skip this part
  5826. length = gotoEnd ? animation.tweens.length : 0;
  5827. if ( stopped ) {
  5828. return this;
  5829. }
  5830. stopped = true;
  5831. for ( ; index < length ; index++ ) {
  5832. animation.tweens[ index ].run( 1 );
  5833. }
  5834. // resolve when we played the last frame
  5835. // otherwise, reject
  5836. if ( gotoEnd ) {
  5837. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  5838. } else {
  5839. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  5840. }
  5841. return this;
  5842. }
  5843. }),
  5844. props = animation.props;
  5845. propFilter( props, animation.opts.specialEasing );
  5846. for ( ; index < length ; index++ ) {
  5847. result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
  5848. if ( result ) {
  5849. return result;
  5850. }
  5851. }
  5852. jQuery.map( props, createTween, animation );
  5853. if ( jQuery.isFunction( animation.opts.start ) ) {
  5854. animation.opts.start.call( elem, animation );
  5855. }
  5856. jQuery.fx.timer(
  5857. jQuery.extend( tick, {
  5858. elem: elem,
  5859. anim: animation,
  5860. queue: animation.opts.queue
  5861. })
  5862. );
  5863. // attach callbacks from options
  5864. return animation.progress( animation.opts.progress )
  5865. .done( animation.opts.done, animation.opts.complete )
  5866. .fail( animation.opts.fail )
  5867. .always( animation.opts.always );
  5868. }
  5869. jQuery.Animation = jQuery.extend( Animation, {
  5870. tweener: function( props, callback ) {
  5871. if ( jQuery.isFunction( props ) ) {
  5872. callback = props;
  5873. props = [ "*" ];
  5874. } else {
  5875. props = props.split(" ");
  5876. }
  5877. var prop,
  5878. index = 0,
  5879. length = props.length;
  5880. for ( ; index < length ; index++ ) {
  5881. prop = props[ index ];
  5882. tweeners[ prop ] = tweeners[ prop ] || [];
  5883. tweeners[ prop ].unshift( callback );
  5884. }
  5885. },
  5886. prefilter: function( callback, prepend ) {
  5887. if ( prepend ) {
  5888. animationPrefilters.unshift( callback );
  5889. } else {
  5890. animationPrefilters.push( callback );
  5891. }
  5892. }
  5893. });
  5894. jQuery.speed = function( speed, easing, fn ) {
  5895. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  5896. complete: fn || !fn && easing ||
  5897. jQuery.isFunction( speed ) && speed,
  5898. duration: speed,
  5899. easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
  5900. };
  5901. opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
  5902. opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
  5903. // normalize opt.queue - true/undefined/null -> "fx"
  5904. if ( opt.queue == null || opt.queue === true ) {
  5905. opt.queue = "fx";
  5906. }
  5907. // Queueing
  5908. opt.old = opt.complete;
  5909. opt.complete = function() {
  5910. if ( jQuery.isFunction( opt.old ) ) {
  5911. opt.old.call( this );
  5912. }
  5913. if ( opt.queue ) {
  5914. jQuery.dequeue( this, opt.queue );
  5915. }
  5916. };
  5917. return opt;
  5918. };
  5919. jQuery.fn.extend({
  5920. fadeTo: function( speed, to, easing, callback ) {
  5921. // show any hidden elements after setting opacity to 0
  5922. return this.filter( isHidden ).css( "opacity", 0 ).show()
  5923. // animate to the value specified
  5924. .end().animate({ opacity: to }, speed, easing, callback );
  5925. },
  5926. animate: function( prop, speed, easing, callback ) {
  5927. var empty = jQuery.isEmptyObject( prop ),
  5928. optall = jQuery.speed( speed, easing, callback ),
  5929. doAnimation = function() {
  5930. // Operate on a copy of prop so per-property easing won't be lost
  5931. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  5932. // Empty animations, or finishing resolves immediately
  5933. if ( empty || data_priv.get( this, "finish" ) ) {
  5934. anim.stop( true );
  5935. }
  5936. };
  5937. doAnimation.finish = doAnimation;
  5938. return empty || optall.queue === false ?
  5939. this.each( doAnimation ) :
  5940. this.queue( optall.queue, doAnimation );
  5941. },
  5942. stop: function( type, clearQueue, gotoEnd ) {
  5943. var stopQueue = function( hooks ) {
  5944. var stop = hooks.stop;
  5945. delete hooks.stop;
  5946. stop( gotoEnd );
  5947. };
  5948. if ( typeof type !== "string" ) {
  5949. gotoEnd = clearQueue;
  5950. clearQueue = type;
  5951. type = undefined;
  5952. }
  5953. if ( clearQueue && type !== false ) {
  5954. this.queue( type || "fx", [] );
  5955. }
  5956. return this.each(function() {
  5957. var dequeue = true,
  5958. index = type != null && type + "queueHooks",
  5959. timers = jQuery.timers,
  5960. data = data_priv.get( this );
  5961. if ( index ) {
  5962. if ( data[ index ] && data[ index ].stop ) {
  5963. stopQueue( data[ index ] );
  5964. }
  5965. } else {
  5966. for ( index in data ) {
  5967. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  5968. stopQueue( data[ index ] );
  5969. }
  5970. }
  5971. }
  5972. for ( index = timers.length; index--; ) {
  5973. if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
  5974. timers[ index ].anim.stop( gotoEnd );
  5975. dequeue = false;
  5976. timers.splice( index, 1 );
  5977. }
  5978. }
  5979. // start the next in the queue if the last step wasn't forced
  5980. // timers currently will call their complete callbacks, which will dequeue
  5981. // but only if they were gotoEnd
  5982. if ( dequeue || !gotoEnd ) {
  5983. jQuery.dequeue( this, type );
  5984. }
  5985. });
  5986. },
  5987. finish: function( type ) {
  5988. if ( type !== false ) {
  5989. type = type || "fx";
  5990. }
  5991. return this.each(function() {
  5992. var index,
  5993. data = data_priv.get( this ),
  5994. queue = data[ type + "queue" ],
  5995. hooks = data[ type + "queueHooks" ],
  5996. timers = jQuery.timers,
  5997. length = queue ? queue.length : 0;
  5998. // enable finishing flag on private data
  5999. data.finish = true;
  6000. // empty the queue first
  6001. jQuery.queue( this, type, [] );
  6002. if ( hooks && hooks.stop ) {
  6003. hooks.stop.call( this, true );
  6004. }
  6005. // look for any active animations, and finish them
  6006. for ( index = timers.length; index--; ) {
  6007. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  6008. timers[ index ].anim.stop( true );
  6009. timers.splice( index, 1 );
  6010. }
  6011. }
  6012. // look for any animations in the old queue and finish them
  6013. for ( index = 0; index < length; index++ ) {
  6014. if ( queue[ index ] && queue[ index ].finish ) {
  6015. queue[ index ].finish.call( this );
  6016. }
  6017. }
  6018. // turn off finishing flag
  6019. delete data.finish;
  6020. });
  6021. }
  6022. });
  6023. jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
  6024. var cssFn = jQuery.fn[ name ];
  6025. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6026. return speed == null || typeof speed === "boolean" ?
  6027. cssFn.apply( this, arguments ) :
  6028. this.animate( genFx( name, true ), speed, easing, callback );
  6029. };
  6030. });
  6031. // Generate shortcuts for custom animations
  6032. jQuery.each({
  6033. slideDown: genFx("show"),
  6034. slideUp: genFx("hide"),
  6035. slideToggle: genFx("toggle"),
  6036. fadeIn: { opacity: "show" },
  6037. fadeOut: { opacity: "hide" },
  6038. fadeToggle: { opacity: "toggle" }
  6039. }, function( name, props ) {
  6040. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6041. return this.animate( props, speed, easing, callback );
  6042. };
  6043. });
  6044. jQuery.timers = [];
  6045. jQuery.fx.tick = function() {
  6046. var timer,
  6047. i = 0,
  6048. timers = jQuery.timers;
  6049. fxNow = jQuery.now();
  6050. for ( ; i < timers.length; i++ ) {
  6051. timer = timers[ i ];
  6052. // Checks the timer has not already been removed
  6053. if ( !timer() && timers[ i ] === timer ) {
  6054. timers.splice( i--, 1 );
  6055. }
  6056. }
  6057. if ( !timers.length ) {
  6058. jQuery.fx.stop();
  6059. }
  6060. fxNow = undefined;
  6061. };
  6062. jQuery.fx.timer = function( timer ) {
  6063. jQuery.timers.push( timer );
  6064. if ( timer() ) {
  6065. jQuery.fx.start();
  6066. } else {
  6067. jQuery.timers.pop();
  6068. }
  6069. };
  6070. jQuery.fx.interval = 13;
  6071. jQuery.fx.start = function() {
  6072. if ( !timerId ) {
  6073. timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
  6074. }
  6075. };
  6076. jQuery.fx.stop = function() {
  6077. clearInterval( timerId );
  6078. timerId = null;
  6079. };
  6080. jQuery.fx.speeds = {
  6081. slow: 600,
  6082. fast: 200,
  6083. // Default speed
  6084. _default: 400
  6085. };
  6086. // Based off of the plugin by Clint Helfers, with permission.
  6087. // http://blindsignals.com/index.php/2009/07/jquery-delay/
  6088. jQuery.fn.delay = function( time, type ) {
  6089. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  6090. type = type || "fx";
  6091. return this.queue( type, function( next, hooks ) {
  6092. var timeout = setTimeout( next, time );
  6093. hooks.stop = function() {
  6094. clearTimeout( timeout );
  6095. };
  6096. });
  6097. };
  6098. (function() {
  6099. var input = document.createElement( "input" ),
  6100. select = document.createElement( "select" ),
  6101. opt = select.appendChild( document.createElement( "option" ) );
  6102. input.type = "checkbox";
  6103. // Support: iOS 5.1, Android 4.x, Android 2.3
  6104. // Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere)
  6105. support.checkOn = input.value !== "";
  6106. // Must access the parent to make an option select properly
  6107. // Support: IE9, IE10
  6108. support.optSelected = opt.selected;
  6109. // Make sure that the options inside disabled selects aren't marked as disabled
  6110. // (WebKit marks them as disabled)
  6111. select.disabled = true;
  6112. support.optDisabled = !opt.disabled;
  6113. // Check if an input maintains its value after becoming a radio
  6114. // Support: IE9, IE10
  6115. input = document.createElement( "input" );
  6116. input.value = "t";
  6117. input.type = "radio";
  6118. support.radioValue = input.value === "t";
  6119. })();
  6120. var nodeHook, boolHook,
  6121. attrHandle = jQuery.expr.attrHandle;
  6122. jQuery.fn.extend({
  6123. attr: function( name, value ) {
  6124. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  6125. },
  6126. removeAttr: function( name ) {
  6127. return this.each(function() {
  6128. jQuery.removeAttr( this, name );
  6129. });
  6130. }
  6131. });
  6132. jQuery.extend({
  6133. attr: function( elem, name, value ) {
  6134. var hooks, ret,
  6135. nType = elem.nodeType;
  6136. // don't get/set attributes on text, comment and attribute nodes
  6137. if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
  6138. return;
  6139. }
  6140. // Fallback to prop when attributes are not supported
  6141. if ( typeof elem.getAttribute === strundefined ) {
  6142. return jQuery.prop( elem, name, value );
  6143. }
  6144. // All attributes are lowercase
  6145. // Grab necessary hook if one is defined
  6146. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  6147. name = name.toLowerCase();
  6148. hooks = jQuery.attrHooks[ name ] ||
  6149. ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
  6150. }
  6151. if ( value !== undefined ) {
  6152. if ( value === null ) {
  6153. jQuery.removeAttr( elem, name );
  6154. } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
  6155. return ret;
  6156. } else {
  6157. elem.setAttribute( name, value + "" );
  6158. return value;
  6159. }
  6160. } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
  6161. return ret;
  6162. } else {
  6163. ret = jQuery.find.attr( elem, name );
  6164. // Non-existent attributes return null, we normalize to undefined
  6165. return ret == null ?
  6166. undefined :
  6167. ret;
  6168. }
  6169. },
  6170. removeAttr: function( elem, value ) {
  6171. var name, propName,
  6172. i = 0,
  6173. attrNames = value && value.match( rnotwhite );
  6174. if ( attrNames && elem.nodeType === 1 ) {
  6175. while ( (name = attrNames[i++]) ) {
  6176. propName = jQuery.propFix[ name ] || name;
  6177. // Boolean attributes get special treatment (#10870)
  6178. if ( jQuery.expr.match.bool.test( name ) ) {
  6179. // Set corresponding property to false
  6180. elem[ propName ] = false;
  6181. }
  6182. elem.removeAttribute( name );
  6183. }
  6184. }
  6185. },
  6186. attrHooks: {
  6187. type: {
  6188. set: function( elem, value ) {
  6189. if ( !support.radioValue && value === "radio" &&
  6190. jQuery.nodeName( elem, "input" ) ) {
  6191. // Setting the type on a radio button after the value resets the value in IE6-9
  6192. // Reset value to default in case type is set after value during creation
  6193. var val = elem.value;
  6194. elem.setAttribute( "type", value );
  6195. if ( val ) {
  6196. elem.value = val;
  6197. }
  6198. return value;
  6199. }
  6200. }
  6201. }
  6202. }
  6203. });
  6204. // Hooks for boolean attributes
  6205. boolHook = {
  6206. set: function( elem, value, name ) {
  6207. if ( value === false ) {
  6208. // Remove boolean attributes when set to false
  6209. jQuery.removeAttr( elem, name );
  6210. } else {
  6211. elem.setAttribute( name, name );
  6212. }
  6213. return name;
  6214. }
  6215. };
  6216. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  6217. var getter = attrHandle[ name ] || jQuery.find.attr;
  6218. attrHandle[ name ] = function( elem, name, isXML ) {
  6219. var ret, handle;
  6220. if ( !isXML ) {
  6221. // Avoid an infinite loop by temporarily removing this function from the getter
  6222. handle = attrHandle[ name ];
  6223. attrHandle[ name ] = ret;
  6224. ret = getter( elem, name, isXML ) != null ?
  6225. name.toLowerCase() :
  6226. null;
  6227. attrHandle[ name ] = handle;
  6228. }
  6229. return ret;
  6230. };
  6231. });
  6232. var rfocusable = /^(?:input|select|textarea|button)$/i;
  6233. jQuery.fn.extend({
  6234. prop: function( name, value ) {
  6235. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  6236. },
  6237. removeProp: function( name ) {
  6238. return this.each(function() {
  6239. delete this[ jQuery.propFix[ name ] || name ];
  6240. });
  6241. }
  6242. });
  6243. jQuery.extend({
  6244. propFix: {
  6245. "for": "htmlFor",
  6246. "class": "className"
  6247. },
  6248. prop: function( elem, name, value ) {
  6249. var ret, hooks, notxml,
  6250. nType = elem.nodeType;
  6251. // don't get/set properties on text, comment and attribute nodes
  6252. if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
  6253. return;
  6254. }
  6255. notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
  6256. if ( notxml ) {
  6257. // Fix name and attach hooks
  6258. name = jQuery.propFix[ name ] || name;
  6259. hooks = jQuery.propHooks[ name ];
  6260. }
  6261. if ( value !== undefined ) {
  6262. return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
  6263. ret :
  6264. ( elem[ name ] = value );
  6265. } else {
  6266. return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
  6267. ret :
  6268. elem[ name ];
  6269. }
  6270. },
  6271. propHooks: {
  6272. tabIndex: {
  6273. get: function( elem ) {
  6274. return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
  6275. elem.tabIndex :
  6276. -1;
  6277. }
  6278. }
  6279. }
  6280. });
  6281. // Support: IE9+
  6282. // Selectedness for an option in an optgroup can be inaccurate
  6283. if ( !support.optSelected ) {
  6284. jQuery.propHooks.selected = {
  6285. get: function( elem ) {
  6286. var parent = elem.parentNode;
  6287. if ( parent && parent.parentNode ) {
  6288. parent.parentNode.selectedIndex;
  6289. }
  6290. return null;
  6291. }
  6292. };
  6293. }
  6294. jQuery.each([
  6295. "tabIndex",
  6296. "readOnly",
  6297. "maxLength",
  6298. "cellSpacing",
  6299. "cellPadding",
  6300. "rowSpan",
  6301. "colSpan",
  6302. "useMap",
  6303. "frameBorder",
  6304. "contentEditable"
  6305. ], function() {
  6306. jQuery.propFix[ this.toLowerCase() ] = this;
  6307. });
  6308. var rclass = /[\t\r\n\f]/g;
  6309. jQuery.fn.extend({
  6310. addClass: function( value ) {
  6311. var classes, elem, cur, clazz, j, finalValue,
  6312. proceed = typeof value === "string" && value,
  6313. i = 0,
  6314. len = this.length;
  6315. if ( jQuery.isFunction( value ) ) {
  6316. return this.each(function( j ) {
  6317. jQuery( this ).addClass( value.call( this, j, this.className ) );
  6318. });
  6319. }
  6320. if ( proceed ) {
  6321. // The disjunction here is for better compressibility (see removeClass)
  6322. classes = ( value || "" ).match( rnotwhite ) || [];
  6323. for ( ; i < len; i++ ) {
  6324. elem = this[ i ];
  6325. cur = elem.nodeType === 1 && ( elem.className ?
  6326. ( " " + elem.className + " " ).replace( rclass, " " ) :
  6327. " "
  6328. );
  6329. if ( cur ) {
  6330. j = 0;
  6331. while ( (clazz = classes[j++]) ) {
  6332. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  6333. cur += clazz + " ";
  6334. }
  6335. }
  6336. // only assign if different to avoid unneeded rendering.
  6337. finalValue = jQuery.trim( cur );
  6338. if ( elem.className !== finalValue ) {
  6339. elem.className = finalValue;
  6340. }
  6341. }
  6342. }
  6343. }
  6344. return this;
  6345. },
  6346. removeClass: function( value ) {
  6347. var classes, elem, cur, clazz, j, finalValue,
  6348. proceed = arguments.length === 0 || typeof value === "string" && value,
  6349. i = 0,
  6350. len = this.length;
  6351. if ( jQuery.isFunction( value ) ) {
  6352. return this.each(function( j ) {
  6353. jQuery( this ).removeClass( value.call( this, j, this.className ) );
  6354. });
  6355. }
  6356. if ( proceed ) {
  6357. classes = ( value || "" ).match( rnotwhite ) || [];
  6358. for ( ; i < len; i++ ) {
  6359. elem = this[ i ];
  6360. // This expression is here for better compressibility (see addClass)
  6361. cur = elem.nodeType === 1 && ( elem.className ?
  6362. ( " " + elem.className + " " ).replace( rclass, " " ) :
  6363. ""
  6364. );
  6365. if ( cur ) {
  6366. j = 0;
  6367. while ( (clazz = classes[j++]) ) {
  6368. // Remove *all* instances
  6369. while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
  6370. cur = cur.replace( " " + clazz + " ", " " );
  6371. }
  6372. }
  6373. // only assign if different to avoid unneeded rendering.
  6374. finalValue = value ? jQuery.trim( cur ) : "";
  6375. if ( elem.className !== finalValue ) {
  6376. elem.className = finalValue;
  6377. }
  6378. }
  6379. }
  6380. }
  6381. return this;
  6382. },
  6383. toggleClass: function( value, stateVal ) {
  6384. var type = typeof value;
  6385. if ( typeof stateVal === "boolean" && type === "string" ) {
  6386. return stateVal ? this.addClass( value ) : this.removeClass( value );
  6387. }
  6388. if ( jQuery.isFunction( value ) ) {
  6389. return this.each(function( i ) {
  6390. jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
  6391. });
  6392. }
  6393. return this.each(function() {
  6394. if ( type === "string" ) {
  6395. // toggle individual class names
  6396. var className,
  6397. i = 0,
  6398. self = jQuery( this ),
  6399. classNames = value.match( rnotwhite ) || [];
  6400. while ( (className = classNames[ i++ ]) ) {
  6401. // check each className given, space separated list
  6402. if ( self.hasClass( className ) ) {
  6403. self.removeClass( className );
  6404. } else {
  6405. self.addClass( className );
  6406. }
  6407. }
  6408. // Toggle whole class name
  6409. } else if ( type === strundefined || type === "boolean" ) {
  6410. if ( this.className ) {
  6411. // store className if set
  6412. data_priv.set( this, "__className__", this.className );
  6413. }
  6414. // If the element has a class name or if we're passed "false",
  6415. // then remove the whole classname (if there was one, the above saved it).
  6416. // Otherwise bring back whatever was previously saved (if anything),
  6417. // falling back to the empty string if nothing was stored.
  6418. this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
  6419. }
  6420. });
  6421. },
  6422. hasClass: function( selector ) {
  6423. var className = " " + selector + " ",
  6424. i = 0,
  6425. l = this.length;
  6426. for ( ; i < l; i++ ) {
  6427. if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
  6428. return true;
  6429. }
  6430. }
  6431. return false;
  6432. }
  6433. });
  6434. var rreturn = /\r/g;
  6435. jQuery.fn.extend({
  6436. val: function( value ) {
  6437. var hooks, ret, isFunction,
  6438. elem = this[0];
  6439. if ( !arguments.length ) {
  6440. if ( elem ) {
  6441. hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  6442. if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
  6443. return ret;
  6444. }
  6445. ret = elem.value;
  6446. return typeof ret === "string" ?
  6447. // handle most common string cases
  6448. ret.replace(rreturn, "") :
  6449. // handle cases where value is null/undef or number
  6450. ret == null ? "" : ret;
  6451. }
  6452. return;
  6453. }
  6454. isFunction = jQuery.isFunction( value );
  6455. return this.each(function( i ) {
  6456. var val;
  6457. if ( this.nodeType !== 1 ) {
  6458. return;
  6459. }
  6460. if ( isFunction ) {
  6461. val = value.call( this, i, jQuery( this ).val() );
  6462. } else {
  6463. val = value;
  6464. }
  6465. // Treat null/undefined as ""; convert numbers to string
  6466. if ( val == null ) {
  6467. val = "";
  6468. } else if ( typeof val === "number" ) {
  6469. val += "";
  6470. } else if ( jQuery.isArray( val ) ) {
  6471. val = jQuery.map( val, function( value ) {
  6472. return value == null ? "" : value + "";
  6473. });
  6474. }
  6475. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  6476. // If set returns undefined, fall back to normal setting
  6477. if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
  6478. this.value = val;
  6479. }
  6480. });
  6481. }
  6482. });
  6483. jQuery.extend({
  6484. valHooks: {
  6485. select: {
  6486. get: function( elem ) {
  6487. var value, option,
  6488. options = elem.options,
  6489. index = elem.selectedIndex,
  6490. one = elem.type === "select-one" || index < 0,
  6491. values = one ? null : [],
  6492. max = one ? index + 1 : options.length,
  6493. i = index < 0 ?
  6494. max :
  6495. one ? index : 0;
  6496. // Loop through all the selected options
  6497. for ( ; i < max; i++ ) {
  6498. option = options[ i ];
  6499. // IE6-9 doesn't update selected after form reset (#2551)
  6500. if ( ( option.selected || i === index ) &&
  6501. // Don't return options that are disabled or in a disabled optgroup
  6502. ( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
  6503. ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
  6504. // Get the specific value for the option
  6505. value = jQuery( option ).val();
  6506. // We don't need an array for one selects
  6507. if ( one ) {
  6508. return value;
  6509. }
  6510. // Multi-Selects return an array
  6511. values.push( value );
  6512. }
  6513. }
  6514. return values;
  6515. },
  6516. set: function( elem, value ) {
  6517. var optionSet, option,
  6518. options = elem.options,
  6519. values = jQuery.makeArray( value ),
  6520. i = options.length;
  6521. while ( i-- ) {
  6522. option = options[ i ];
  6523. if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) {
  6524. optionSet = true;
  6525. }
  6526. }
  6527. // force browsers to behave consistently when non-matching value is set
  6528. if ( !optionSet ) {
  6529. elem.selectedIndex = -1;
  6530. }
  6531. return values;
  6532. }
  6533. }
  6534. }
  6535. });
  6536. // Radios and checkboxes getter/setter
  6537. jQuery.each([ "radio", "checkbox" ], function() {
  6538. jQuery.valHooks[ this ] = {
  6539. set: function( elem, value ) {
  6540. if ( jQuery.isArray( value ) ) {
  6541. return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
  6542. }
  6543. }
  6544. };
  6545. if ( !support.checkOn ) {
  6546. jQuery.valHooks[ this ].get = function( elem ) {
  6547. // Support: Webkit
  6548. // "" is returned instead of "on" if a value isn't specified
  6549. return elem.getAttribute("value") === null ? "on" : elem.value;
  6550. };
  6551. }
  6552. });
  6553. // Return jQuery for attributes-only inclusion
  6554. jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
  6555. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  6556. "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
  6557. // Handle event binding
  6558. jQuery.fn[ name ] = function( data, fn ) {
  6559. return arguments.length > 0 ?
  6560. this.on( name, null, data, fn ) :
  6561. this.trigger( name );
  6562. };
  6563. });
  6564. jQuery.fn.extend({
  6565. hover: function( fnOver, fnOut ) {
  6566. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  6567. },
  6568. bind: function( types, data, fn ) {
  6569. return this.on( types, null, data, fn );
  6570. },
  6571. unbind: function( types, fn ) {
  6572. return this.off( types, null, fn );
  6573. },
  6574. delegate: function( selector, types, data, fn ) {
  6575. return this.on( types, selector, data, fn );
  6576. },
  6577. undelegate: function( selector, types, fn ) {
  6578. // ( namespace ) or ( selector, types [, fn] )
  6579. return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
  6580. }
  6581. });
  6582. var nonce = jQuery.now();
  6583. var rquery = (/\?/);
  6584. // Support: Android 2.3
  6585. // Workaround failure to string-cast null input
  6586. jQuery.parseJSON = function( data ) {
  6587. return JSON.parse( data + "" );
  6588. };
  6589. // Cross-browser xml parsing
  6590. jQuery.parseXML = function( data ) {
  6591. var xml, tmp;
  6592. if ( !data || typeof data !== "string" ) {
  6593. return null;
  6594. }
  6595. // Support: IE9
  6596. try {
  6597. tmp = new DOMParser();
  6598. xml = tmp.parseFromString( data, "text/xml" );
  6599. } catch ( e ) {
  6600. xml = undefined;
  6601. }
  6602. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  6603. jQuery.error( "Invalid XML: " + data );
  6604. }
  6605. return xml;
  6606. };
  6607. var
  6608. // Document location
  6609. ajaxLocParts,
  6610. ajaxLocation,
  6611. rhash = /#.*$/,
  6612. rts = /([?&])_=[^&]*/,
  6613. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  6614. // #7653, #8125, #8152: local protocol detection
  6615. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  6616. rnoContent = /^(?:GET|HEAD)$/,
  6617. rprotocol = /^\/\//,
  6618. rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
  6619. /* Prefilters
  6620. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  6621. * 2) These are called:
  6622. * - BEFORE asking for a transport
  6623. * - AFTER param serialization (s.data is a string if s.processData is true)
  6624. * 3) key is the dataType
  6625. * 4) the catchall symbol "*" can be used
  6626. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  6627. */
  6628. prefilters = {},
  6629. /* Transports bindings
  6630. * 1) key is the dataType
  6631. * 2) the catchall symbol "*" can be used
  6632. * 3) selection will start with transport dataType and THEN go to "*" if needed
  6633. */
  6634. transports = {},
  6635. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  6636. allTypes = "*/".concat("*");
  6637. // #8138, IE may throw an exception when accessing
  6638. // a field from window.location if document.domain has been set
  6639. try {
  6640. ajaxLocation = location.href;
  6641. } catch( e ) {
  6642. // Use the href attribute of an A element
  6643. // since IE will modify it given document.location
  6644. ajaxLocation = document.createElement( "a" );
  6645. ajaxLocation.href = "";
  6646. ajaxLocation = ajaxLocation.href;
  6647. }
  6648. // Segment location into parts
  6649. ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
  6650. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  6651. function addToPrefiltersOrTransports( structure ) {
  6652. // dataTypeExpression is optional and defaults to "*"
  6653. return function( dataTypeExpression, func ) {
  6654. if ( typeof dataTypeExpression !== "string" ) {
  6655. func = dataTypeExpression;
  6656. dataTypeExpression = "*";
  6657. }
  6658. var dataType,
  6659. i = 0,
  6660. dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
  6661. if ( jQuery.isFunction( func ) ) {
  6662. // For each dataType in the dataTypeExpression
  6663. while ( (dataType = dataTypes[i++]) ) {
  6664. // Prepend if requested
  6665. if ( dataType[0] === "+" ) {
  6666. dataType = dataType.slice( 1 ) || "*";
  6667. (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
  6668. // Otherwise append
  6669. } else {
  6670. (structure[ dataType ] = structure[ dataType ] || []).push( func );
  6671. }
  6672. }
  6673. }
  6674. };
  6675. }
  6676. // Base inspection function for prefilters and transports
  6677. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  6678. var inspected = {},
  6679. seekingTransport = ( structure === transports );
  6680. function inspect( dataType ) {
  6681. var selected;
  6682. inspected[ dataType ] = true;
  6683. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  6684. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  6685. if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  6686. options.dataTypes.unshift( dataTypeOrTransport );
  6687. inspect( dataTypeOrTransport );
  6688. return false;
  6689. } else if ( seekingTransport ) {
  6690. return !( selected = dataTypeOrTransport );
  6691. }
  6692. });
  6693. return selected;
  6694. }
  6695. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  6696. }
  6697. // A special extend for ajax options
  6698. // that takes "flat" options (not to be deep extended)
  6699. // Fixes #9887
  6700. function ajaxExtend( target, src ) {
  6701. var key, deep,
  6702. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  6703. for ( key in src ) {
  6704. if ( src[ key ] !== undefined ) {
  6705. ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
  6706. }
  6707. }
  6708. if ( deep ) {
  6709. jQuery.extend( true, target, deep );
  6710. }
  6711. return target;
  6712. }
  6713. /* Handles responses to an ajax request:
  6714. * - finds the right dataType (mediates between content-type and expected dataType)
  6715. * - returns the corresponding response
  6716. */
  6717. function ajaxHandleResponses( s, jqXHR, responses ) {
  6718. var ct, type, finalDataType, firstDataType,
  6719. contents = s.contents,
  6720. dataTypes = s.dataTypes;
  6721. // Remove auto dataType and get content-type in the process
  6722. while ( dataTypes[ 0 ] === "*" ) {
  6723. dataTypes.shift();
  6724. if ( ct === undefined ) {
  6725. ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  6726. }
  6727. }
  6728. // Check if we're dealing with a known content-type
  6729. if ( ct ) {
  6730. for ( type in contents ) {
  6731. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  6732. dataTypes.unshift( type );
  6733. break;
  6734. }
  6735. }
  6736. }
  6737. // Check to see if we have a response for the expected dataType
  6738. if ( dataTypes[ 0 ] in responses ) {
  6739. finalDataType = dataTypes[ 0 ];
  6740. } else {
  6741. // Try convertible dataTypes
  6742. for ( type in responses ) {
  6743. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
  6744. finalDataType = type;
  6745. break;
  6746. }
  6747. if ( !firstDataType ) {
  6748. firstDataType = type;
  6749. }
  6750. }
  6751. // Or just use first one
  6752. finalDataType = finalDataType || firstDataType;
  6753. }
  6754. // If we found a dataType
  6755. // We add the dataType to the list if needed
  6756. // and return the corresponding response
  6757. if ( finalDataType ) {
  6758. if ( finalDataType !== dataTypes[ 0 ] ) {
  6759. dataTypes.unshift( finalDataType );
  6760. }
  6761. return responses[ finalDataType ];
  6762. }
  6763. }
  6764. /* Chain conversions given the request and the original response
  6765. * Also sets the responseXXX fields on the jqXHR instance
  6766. */
  6767. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  6768. var conv2, current, conv, tmp, prev,
  6769. converters = {},
  6770. // Work with a copy of dataTypes in case we need to modify it for conversion
  6771. dataTypes = s.dataTypes.slice();
  6772. // Create converters map with lowercased keys
  6773. if ( dataTypes[ 1 ] ) {
  6774. for ( conv in s.converters ) {
  6775. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  6776. }
  6777. }
  6778. current = dataTypes.shift();
  6779. // Convert to each sequential dataType
  6780. while ( current ) {
  6781. if ( s.responseFields[ current ] ) {
  6782. jqXHR[ s.responseFields[ current ] ] = response;
  6783. }
  6784. // Apply the dataFilter if provided
  6785. if ( !prev && isSuccess && s.dataFilter ) {
  6786. response = s.dataFilter( response, s.dataType );
  6787. }
  6788. prev = current;
  6789. current = dataTypes.shift();
  6790. if ( current ) {
  6791. // There's only work to do if current dataType is non-auto
  6792. if ( current === "*" ) {
  6793. current = prev;
  6794. // Convert response if prev dataType is non-auto and differs from current
  6795. } else if ( prev !== "*" && prev !== current ) {
  6796. // Seek a direct converter
  6797. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  6798. // If none found, seek a pair
  6799. if ( !conv ) {
  6800. for ( conv2 in converters ) {
  6801. // If conv2 outputs current
  6802. tmp = conv2.split( " " );
  6803. if ( tmp[ 1 ] === current ) {
  6804. // If prev can be converted to accepted input
  6805. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  6806. converters[ "* " + tmp[ 0 ] ];
  6807. if ( conv ) {
  6808. // Condense equivalence converters
  6809. if ( conv === true ) {
  6810. conv = converters[ conv2 ];
  6811. // Otherwise, insert the intermediate dataType
  6812. } else if ( converters[ conv2 ] !== true ) {
  6813. current = tmp[ 0 ];
  6814. dataTypes.unshift( tmp[ 1 ] );
  6815. }
  6816. break;
  6817. }
  6818. }
  6819. }
  6820. }
  6821. // Apply converter (if not an equivalence)
  6822. if ( conv !== true ) {
  6823. // Unless errors are allowed to bubble, catch and return them
  6824. if ( conv && s[ "throws" ] ) {
  6825. response = conv( response );
  6826. } else {
  6827. try {
  6828. response = conv( response );
  6829. } catch ( e ) {
  6830. return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
  6831. }
  6832. }
  6833. }
  6834. }
  6835. }
  6836. }
  6837. return { state: "success", data: response };
  6838. }
  6839. jQuery.extend({
  6840. // Counter for holding the number of active queries
  6841. active: 0,
  6842. // Last-Modified header cache for next request
  6843. lastModified: {},
  6844. etag: {},
  6845. ajaxSettings: {
  6846. url: ajaxLocation,
  6847. type: "GET",
  6848. isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
  6849. global: true,
  6850. processData: true,
  6851. async: true,
  6852. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  6853. /*
  6854. timeout: 0,
  6855. data: null,
  6856. dataType: null,
  6857. username: null,
  6858. password: null,
  6859. cache: null,
  6860. throws: false,
  6861. traditional: false,
  6862. headers: {},
  6863. */
  6864. accepts: {
  6865. "*": allTypes,
  6866. text: "text/plain",
  6867. html: "text/html",
  6868. xml: "application/xml, text/xml",
  6869. json: "application/json, text/javascript"
  6870. },
  6871. contents: {
  6872. xml: /xml/,
  6873. html: /html/,
  6874. json: /json/
  6875. },
  6876. responseFields: {
  6877. xml: "responseXML",
  6878. text: "responseText",
  6879. json: "responseJSON"
  6880. },
  6881. // Data converters
  6882. // Keys separate source (or catchall "*") and destination types with a single space
  6883. converters: {
  6884. // Convert anything to text
  6885. "* text": String,
  6886. // Text to html (true = no transformation)
  6887. "text html": true,
  6888. // Evaluate text as a json expression
  6889. "text json": jQuery.parseJSON,
  6890. // Parse text as xml
  6891. "text xml": jQuery.parseXML
  6892. },
  6893. // For options that shouldn't be deep extended:
  6894. // you can add your own custom options here if
  6895. // and when you create one that shouldn't be
  6896. // deep extended (see ajaxExtend)
  6897. flatOptions: {
  6898. url: true,
  6899. context: true
  6900. }
  6901. },
  6902. // Creates a full fledged settings object into target
  6903. // with both ajaxSettings and settings fields.
  6904. // If target is omitted, writes into ajaxSettings.
  6905. ajaxSetup: function( target, settings ) {
  6906. return settings ?
  6907. // Building a settings object
  6908. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  6909. // Extending ajaxSettings
  6910. ajaxExtend( jQuery.ajaxSettings, target );
  6911. },
  6912. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  6913. ajaxTransport: addToPrefiltersOrTransports( transports ),
  6914. // Main method
  6915. ajax: function( url, options ) {
  6916. // If url is an object, simulate pre-1.5 signature
  6917. if ( typeof url === "object" ) {
  6918. options = url;
  6919. url = undefined;
  6920. }
  6921. // Force options to be an object
  6922. options = options || {};
  6923. var transport,
  6924. // URL without anti-cache param
  6925. cacheURL,
  6926. // Response headers
  6927. responseHeadersString,
  6928. responseHeaders,
  6929. // timeout handle
  6930. timeoutTimer,
  6931. // Cross-domain detection vars
  6932. parts,
  6933. // To know if global events are to be dispatched
  6934. fireGlobals,
  6935. // Loop variable
  6936. i,
  6937. // Create the final options object
  6938. s = jQuery.ajaxSetup( {}, options ),
  6939. // Callbacks context
  6940. callbackContext = s.context || s,
  6941. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  6942. globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
  6943. jQuery( callbackContext ) :
  6944. jQuery.event,
  6945. // Deferreds
  6946. deferred = jQuery.Deferred(),
  6947. completeDeferred = jQuery.Callbacks("once memory"),
  6948. // Status-dependent callbacks
  6949. statusCode = s.statusCode || {},
  6950. // Headers (they are sent all at once)
  6951. requestHeaders = {},
  6952. requestHeadersNames = {},
  6953. // The jqXHR state
  6954. state = 0,
  6955. // Default abort message
  6956. strAbort = "canceled",
  6957. // Fake xhr
  6958. jqXHR = {
  6959. readyState: 0,
  6960. // Builds headers hashtable if needed
  6961. getResponseHeader: function( key ) {
  6962. var match;
  6963. if ( state === 2 ) {
  6964. if ( !responseHeaders ) {
  6965. responseHeaders = {};
  6966. while ( (match = rheaders.exec( responseHeadersString )) ) {
  6967. responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
  6968. }
  6969. }
  6970. match = responseHeaders[ key.toLowerCase() ];
  6971. }
  6972. return match == null ? null : match;
  6973. },
  6974. // Raw string
  6975. getAllResponseHeaders: function() {
  6976. return state === 2 ? responseHeadersString : null;
  6977. },
  6978. // Caches the header
  6979. setRequestHeader: function( name, value ) {
  6980. var lname = name.toLowerCase();
  6981. if ( !state ) {
  6982. name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
  6983. requestHeaders[ name ] = value;
  6984. }
  6985. return this;
  6986. },
  6987. // Overrides response content-type header
  6988. overrideMimeType: function( type ) {
  6989. if ( !state ) {
  6990. s.mimeType = type;
  6991. }
  6992. return this;
  6993. },
  6994. // Status-dependent callbacks
  6995. statusCode: function( map ) {
  6996. var code;
  6997. if ( map ) {
  6998. if ( state < 2 ) {
  6999. for ( code in map ) {
  7000. // Lazy-add the new callback in a way that preserves old ones
  7001. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  7002. }
  7003. } else {
  7004. // Execute the appropriate callbacks
  7005. jqXHR.always( map[ jqXHR.status ] );
  7006. }
  7007. }
  7008. return this;
  7009. },
  7010. // Cancel the request
  7011. abort: function( statusText ) {
  7012. var finalText = statusText || strAbort;
  7013. if ( transport ) {
  7014. transport.abort( finalText );
  7015. }
  7016. done( 0, finalText );
  7017. return this;
  7018. }
  7019. };
  7020. // Attach deferreds
  7021. deferred.promise( jqXHR ).complete = completeDeferred.add;
  7022. jqXHR.success = jqXHR.done;
  7023. jqXHR.error = jqXHR.fail;
  7024. // Remove hash character (#7531: and string promotion)
  7025. // Add protocol if not provided (prefilters might expect it)
  7026. // Handle falsy url in the settings object (#10093: consistency with old signature)
  7027. // We also use the url parameter if available
  7028. s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
  7029. .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
  7030. // Alias method option to type as per ticket #12004
  7031. s.type = options.method || options.type || s.method || s.type;
  7032. // Extract dataTypes list
  7033. s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
  7034. // A cross-domain request is in order when we have a protocol:host:port mismatch
  7035. if ( s.crossDomain == null ) {
  7036. parts = rurl.exec( s.url.toLowerCase() );
  7037. s.crossDomain = !!( parts &&
  7038. ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
  7039. ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
  7040. ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
  7041. );
  7042. }
  7043. // Convert data if not already a string
  7044. if ( s.data && s.processData && typeof s.data !== "string" ) {
  7045. s.data = jQuery.param( s.data, s.traditional );
  7046. }
  7047. // Apply prefilters
  7048. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  7049. // If request was aborted inside a prefilter, stop there
  7050. if ( state === 2 ) {
  7051. return jqXHR;
  7052. }
  7053. // We can fire global events as of now if asked to
  7054. fireGlobals = s.global;
  7055. // Watch for a new set of requests
  7056. if ( fireGlobals && jQuery.active++ === 0 ) {
  7057. jQuery.event.trigger("ajaxStart");
  7058. }
  7059. // Uppercase the type
  7060. s.type = s.type.toUpperCase();
  7061. // Determine if request has content
  7062. s.hasContent = !rnoContent.test( s.type );
  7063. // Save the URL in case we're toying with the If-Modified-Since
  7064. // and/or If-None-Match header later on
  7065. cacheURL = s.url;
  7066. // More options handling for requests with no content
  7067. if ( !s.hasContent ) {
  7068. // If data is available, append data to url
  7069. if ( s.data ) {
  7070. cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
  7071. // #9682: remove data so that it's not used in an eventual retry
  7072. delete s.data;
  7073. }
  7074. // Add anti-cache in url if needed
  7075. if ( s.cache === false ) {
  7076. s.url = rts.test( cacheURL ) ?
  7077. // If there is already a '_' parameter, set its value
  7078. cacheURL.replace( rts, "$1_=" + nonce++ ) :
  7079. // Otherwise add one to the end
  7080. cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
  7081. }
  7082. }
  7083. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  7084. if ( s.ifModified ) {
  7085. if ( jQuery.lastModified[ cacheURL ] ) {
  7086. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  7087. }
  7088. if ( jQuery.etag[ cacheURL ] ) {
  7089. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  7090. }
  7091. }
  7092. // Set the correct header, if data is being sent
  7093. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  7094. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  7095. }
  7096. // Set the Accepts header for the server, depending on the dataType
  7097. jqXHR.setRequestHeader(
  7098. "Accept",
  7099. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
  7100. s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  7101. s.accepts[ "*" ]
  7102. );
  7103. // Check for headers option
  7104. for ( i in s.headers ) {
  7105. jqXHR.setRequestHeader( i, s.headers[ i ] );
  7106. }
  7107. // Allow custom headers/mimetypes and early abort
  7108. if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
  7109. // Abort if not done already and return
  7110. return jqXHR.abort();
  7111. }
  7112. // aborting is no longer a cancellation
  7113. strAbort = "abort";
  7114. // Install callbacks on deferreds
  7115. for ( i in { success: 1, error: 1, complete: 1 } ) {
  7116. jqXHR[ i ]( s[ i ] );
  7117. }
  7118. // Get transport
  7119. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  7120. // If no transport, we auto-abort
  7121. if ( !transport ) {
  7122. done( -1, "No Transport" );
  7123. } else {
  7124. jqXHR.readyState = 1;
  7125. // Send global event
  7126. if ( fireGlobals ) {
  7127. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  7128. }
  7129. // Timeout
  7130. if ( s.async && s.timeout > 0 ) {
  7131. timeoutTimer = setTimeout(function() {
  7132. jqXHR.abort("timeout");
  7133. }, s.timeout );
  7134. }
  7135. try {
  7136. state = 1;
  7137. transport.send( requestHeaders, done );
  7138. } catch ( e ) {
  7139. // Propagate exception as error if not done
  7140. if ( state < 2 ) {
  7141. done( -1, e );
  7142. // Simply rethrow otherwise
  7143. } else {
  7144. throw e;
  7145. }
  7146. }
  7147. }
  7148. // Callback for when everything is done
  7149. function done( status, nativeStatusText, responses, headers ) {
  7150. var isSuccess, success, error, response, modified,
  7151. statusText = nativeStatusText;
  7152. // Called once
  7153. if ( state === 2 ) {
  7154. return;
  7155. }
  7156. // State is "done" now
  7157. state = 2;
  7158. // Clear timeout if it exists
  7159. if ( timeoutTimer ) {
  7160. clearTimeout( timeoutTimer );
  7161. }
  7162. // Dereference transport for early garbage collection
  7163. // (no matter how long the jqXHR object will be used)
  7164. transport = undefined;
  7165. // Cache response headers
  7166. responseHeadersString = headers || "";
  7167. // Set readyState
  7168. jqXHR.readyState = status > 0 ? 4 : 0;
  7169. // Determine if successful
  7170. isSuccess = status >= 200 && status < 300 || status === 304;
  7171. // Get response data
  7172. if ( responses ) {
  7173. response = ajaxHandleResponses( s, jqXHR, responses );
  7174. }
  7175. // Convert no matter what (that way responseXXX fields are always set)
  7176. response = ajaxConvert( s, response, jqXHR, isSuccess );
  7177. // If successful, handle type chaining
  7178. if ( isSuccess ) {
  7179. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  7180. if ( s.ifModified ) {
  7181. modified = jqXHR.getResponseHeader("Last-Modified");
  7182. if ( modified ) {
  7183. jQuery.lastModified[ cacheURL ] = modified;
  7184. }
  7185. modified = jqXHR.getResponseHeader("etag");
  7186. if ( modified ) {
  7187. jQuery.etag[ cacheURL ] = modified;
  7188. }
  7189. }
  7190. // if no content
  7191. if ( status === 204 || s.type === "HEAD" ) {
  7192. statusText = "nocontent";
  7193. // if not modified
  7194. } else if ( status === 304 ) {
  7195. statusText = "notmodified";
  7196. // If we have data, let's convert it
  7197. } else {
  7198. statusText = response.state;
  7199. success = response.data;
  7200. error = response.error;
  7201. isSuccess = !error;
  7202. }
  7203. } else {
  7204. // We extract error from statusText
  7205. // then normalize statusText and status for non-aborts
  7206. error = statusText;
  7207. if ( status || !statusText ) {
  7208. statusText = "error";
  7209. if ( status < 0 ) {
  7210. status = 0;
  7211. }
  7212. }
  7213. }
  7214. // Set data for the fake xhr object
  7215. jqXHR.status = status;
  7216. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  7217. // Success/Error
  7218. if ( isSuccess ) {
  7219. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  7220. } else {
  7221. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  7222. }
  7223. // Status-dependent callbacks
  7224. jqXHR.statusCode( statusCode );
  7225. statusCode = undefined;
  7226. if ( fireGlobals ) {
  7227. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  7228. [ jqXHR, s, isSuccess ? success : error ] );
  7229. }
  7230. // Complete
  7231. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  7232. if ( fireGlobals ) {
  7233. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  7234. // Handle the global AJAX counter
  7235. if ( !( --jQuery.active ) ) {
  7236. jQuery.event.trigger("ajaxStop");
  7237. }
  7238. }
  7239. }
  7240. return jqXHR;
  7241. },
  7242. getJSON: function( url, data, callback ) {
  7243. return jQuery.get( url, data, callback, "json" );
  7244. },
  7245. getScript: function( url, callback ) {
  7246. return jQuery.get( url, undefined, callback, "script" );
  7247. }
  7248. });
  7249. jQuery.each( [ "get", "post" ], function( i, method ) {
  7250. jQuery[ method ] = function( url, data, callback, type ) {
  7251. // shift arguments if data argument was omitted
  7252. if ( jQuery.isFunction( data ) ) {
  7253. type = type || callback;
  7254. callback = data;
  7255. data = undefined;
  7256. }
  7257. return jQuery.ajax({
  7258. url: url,
  7259. type: method,
  7260. dataType: type,
  7261. data: data,
  7262. success: callback
  7263. });
  7264. };
  7265. });
  7266. // Attach a bunch of functions for handling common AJAX events
  7267. jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
  7268. jQuery.fn[ type ] = function( fn ) {
  7269. return this.on( type, fn );
  7270. };
  7271. });
  7272. jQuery._evalUrl = function( url ) {
  7273. return jQuery.ajax({
  7274. url: url,
  7275. type: "GET",
  7276. dataType: "script",
  7277. async: false,
  7278. global: false,
  7279. "throws": true
  7280. });
  7281. };
  7282. jQuery.fn.extend({
  7283. wrapAll: function( html ) {
  7284. var wrap;
  7285. if ( jQuery.isFunction( html ) ) {
  7286. return this.each(function( i ) {
  7287. jQuery( this ).wrapAll( html.call(this, i) );
  7288. });
  7289. }
  7290. if ( this[ 0 ] ) {
  7291. // The elements to wrap the target around
  7292. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  7293. if ( this[ 0 ].parentNode ) {
  7294. wrap.insertBefore( this[ 0 ] );
  7295. }
  7296. wrap.map(function() {
  7297. var elem = this;
  7298. while ( elem.firstElementChild ) {
  7299. elem = elem.firstElementChild;
  7300. }
  7301. return elem;
  7302. }).append( this );
  7303. }
  7304. return this;
  7305. },
  7306. wrapInner: function( html ) {
  7307. if ( jQuery.isFunction( html ) ) {
  7308. return this.each(function( i ) {
  7309. jQuery( this ).wrapInner( html.call(this, i) );
  7310. });
  7311. }
  7312. return this.each(function() {
  7313. var self = jQuery( this ),
  7314. contents = self.contents();
  7315. if ( contents.length ) {
  7316. contents.wrapAll( html );
  7317. } else {
  7318. self.append( html );
  7319. }
  7320. });
  7321. },
  7322. wrap: function( html ) {
  7323. var isFunction = jQuery.isFunction( html );
  7324. return this.each(function( i ) {
  7325. jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
  7326. });
  7327. },
  7328. unwrap: function() {
  7329. return this.parent().each(function() {
  7330. if ( !jQuery.nodeName( this, "body" ) ) {
  7331. jQuery( this ).replaceWith( this.childNodes );
  7332. }
  7333. }).end();
  7334. }
  7335. });
  7336. jQuery.expr.filters.hidden = function( elem ) {
  7337. // Support: Opera <= 12.12
  7338. // Opera reports offsetWidths and offsetHeights less than zero on some elements
  7339. return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
  7340. };
  7341. jQuery.expr.filters.visible = function( elem ) {
  7342. return !jQuery.expr.filters.hidden( elem );
  7343. };
  7344. var r20 = /%20/g,
  7345. rbracket = /\[\]$/,
  7346. rCRLF = /\r?\n/g,
  7347. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  7348. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  7349. function buildParams( prefix, obj, traditional, add ) {
  7350. var name;
  7351. if ( jQuery.isArray( obj ) ) {
  7352. // Serialize array item.
  7353. jQuery.each( obj, function( i, v ) {
  7354. if ( traditional || rbracket.test( prefix ) ) {
  7355. // Treat each array item as a scalar.
  7356. add( prefix, v );
  7357. } else {
  7358. // Item is non-scalar (array or object), encode its numeric index.
  7359. buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
  7360. }
  7361. });
  7362. } else if ( !traditional && jQuery.type( obj ) === "object" ) {
  7363. // Serialize object item.
  7364. for ( name in obj ) {
  7365. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  7366. }
  7367. } else {
  7368. // Serialize scalar item.
  7369. add( prefix, obj );
  7370. }
  7371. }
  7372. // Serialize an array of form elements or a set of
  7373. // key/values into a query string
  7374. jQuery.param = function( a, traditional ) {
  7375. var prefix,
  7376. s = [],
  7377. add = function( key, value ) {
  7378. // If value is a function, invoke it and return its value
  7379. value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
  7380. s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
  7381. };
  7382. // Set traditional to true for jQuery <= 1.3.2 behavior.
  7383. if ( traditional === undefined ) {
  7384. traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
  7385. }
  7386. // If an array was passed in, assume that it is an array of form elements.
  7387. if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  7388. // Serialize the form elements
  7389. jQuery.each( a, function() {
  7390. add( this.name, this.value );
  7391. });
  7392. } else {
  7393. // If traditional, encode the "old" way (the way 1.3.2 or older
  7394. // did it), otherwise encode params recursively.
  7395. for ( prefix in a ) {
  7396. buildParams( prefix, a[ prefix ], traditional, add );
  7397. }
  7398. }
  7399. // Return the resulting serialization
  7400. return s.join( "&" ).replace( r20, "+" );
  7401. };
  7402. jQuery.fn.extend({
  7403. serialize: function() {
  7404. return jQuery.param( this.serializeArray() );
  7405. },
  7406. serializeArray: function() {
  7407. return this.map(function() {
  7408. // Can add propHook for "elements" to filter or add form elements
  7409. var elements = jQuery.prop( this, "elements" );
  7410. return elements ? jQuery.makeArray( elements ) : this;
  7411. })
  7412. .filter(function() {
  7413. var type = this.type;
  7414. // Use .is( ":disabled" ) so that fieldset[disabled] works
  7415. return this.name && !jQuery( this ).is( ":disabled" ) &&
  7416. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  7417. ( this.checked || !rcheckableType.test( type ) );
  7418. })
  7419. .map(function( i, elem ) {
  7420. var val = jQuery( this ).val();
  7421. return val == null ?
  7422. null :
  7423. jQuery.isArray( val ) ?
  7424. jQuery.map( val, function( val ) {
  7425. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  7426. }) :
  7427. { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  7428. }).get();
  7429. }
  7430. });
  7431. jQuery.ajaxSettings.xhr = function() {
  7432. try {
  7433. return new XMLHttpRequest();
  7434. } catch( e ) {}
  7435. };
  7436. var xhrId = 0,
  7437. xhrCallbacks = {},
  7438. xhrSuccessStatus = {
  7439. // file protocol always yields status code 0, assume 200
  7440. 0: 200,
  7441. // Support: IE9
  7442. // #1450: sometimes IE returns 1223 when it should be 204
  7443. 1223: 204
  7444. },
  7445. xhrSupported = jQuery.ajaxSettings.xhr();
  7446. // Support: IE9
  7447. // Open requests must be manually aborted on unload (#5280)
  7448. if ( window.ActiveXObject ) {
  7449. jQuery( window ).on( "unload", function() {
  7450. for ( var key in xhrCallbacks ) {
  7451. xhrCallbacks[ key ]();
  7452. }
  7453. });
  7454. }
  7455. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  7456. support.ajax = xhrSupported = !!xhrSupported;
  7457. jQuery.ajaxTransport(function( options ) {
  7458. var callback;
  7459. // Cross domain only allowed if supported through XMLHttpRequest
  7460. if ( support.cors || xhrSupported && !options.crossDomain ) {
  7461. return {
  7462. send: function( headers, complete ) {
  7463. var i,
  7464. xhr = options.xhr(),
  7465. id = ++xhrId;
  7466. xhr.open( options.type, options.url, options.async, options.username, options.password );
  7467. // Apply custom fields if provided
  7468. if ( options.xhrFields ) {
  7469. for ( i in options.xhrFields ) {
  7470. xhr[ i ] = options.xhrFields[ i ];
  7471. }
  7472. }
  7473. // Override mime type if needed
  7474. if ( options.mimeType && xhr.overrideMimeType ) {
  7475. xhr.overrideMimeType( options.mimeType );
  7476. }
  7477. // X-Requested-With header
  7478. // For cross-domain requests, seeing as conditions for a preflight are
  7479. // akin to a jigsaw puzzle, we simply never set it to be sure.
  7480. // (it can always be set on a per-request basis or even using ajaxSetup)
  7481. // For same-domain requests, won't change header if already provided.
  7482. if ( !options.crossDomain && !headers["X-Requested-With"] ) {
  7483. headers["X-Requested-With"] = "XMLHttpRequest";
  7484. }
  7485. // Set headers
  7486. for ( i in headers ) {
  7487. xhr.setRequestHeader( i, headers[ i ] );
  7488. }
  7489. // Callback
  7490. callback = function( type ) {
  7491. return function() {
  7492. if ( callback ) {
  7493. delete xhrCallbacks[ id ];
  7494. callback = xhr.onload = xhr.onerror = null;
  7495. if ( type === "abort" ) {
  7496. xhr.abort();
  7497. } else if ( type === "error" ) {
  7498. complete(
  7499. // file: protocol always yields status 0; see #8605, #14207
  7500. xhr.status,
  7501. xhr.statusText
  7502. );
  7503. } else {
  7504. complete(
  7505. xhrSuccessStatus[ xhr.status ] || xhr.status,
  7506. xhr.statusText,
  7507. // Support: IE9
  7508. // Accessing binary-data responseText throws an exception
  7509. // (#11426)
  7510. typeof xhr.responseText === "string" ? {
  7511. text: xhr.responseText
  7512. } : undefined,
  7513. xhr.getAllResponseHeaders()
  7514. );
  7515. }
  7516. }
  7517. };
  7518. };
  7519. // Listen to events
  7520. xhr.onload = callback();
  7521. xhr.onerror = callback("error");
  7522. // Create the abort callback
  7523. callback = xhrCallbacks[ id ] = callback("abort");
  7524. // Do send the request
  7525. // This may raise an exception which is actually
  7526. // handled in jQuery.ajax (so no try/catch here)
  7527. xhr.send( options.hasContent && options.data || null );
  7528. },
  7529. abort: function() {
  7530. if ( callback ) {
  7531. callback();
  7532. }
  7533. }
  7534. };
  7535. }
  7536. });
  7537. // Install script dataType
  7538. jQuery.ajaxSetup({
  7539. accepts: {
  7540. script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
  7541. },
  7542. contents: {
  7543. script: /(?:java|ecma)script/
  7544. },
  7545. converters: {
  7546. "text script": function( text ) {
  7547. jQuery.globalEval( text );
  7548. return text;
  7549. }
  7550. }
  7551. });
  7552. // Handle cache's special case and crossDomain
  7553. jQuery.ajaxPrefilter( "script", function( s ) {
  7554. if ( s.cache === undefined ) {
  7555. s.cache = false;
  7556. }
  7557. if ( s.crossDomain ) {
  7558. s.type = "GET";
  7559. }
  7560. });
  7561. // Bind script tag hack transport
  7562. jQuery.ajaxTransport( "script", function( s ) {
  7563. // This transport only deals with cross domain requests
  7564. if ( s.crossDomain ) {
  7565. var script, callback;
  7566. return {
  7567. send: function( _, complete ) {
  7568. script = jQuery("<script>").prop({
  7569. async: true,
  7570. charset: s.scriptCharset,
  7571. src: s.url
  7572. }).on(
  7573. "load error",
  7574. callback = function( evt ) {
  7575. script.remove();
  7576. callback = null;
  7577. if ( evt ) {
  7578. complete( evt.type === "error" ? 404 : 200, evt.type );
  7579. }
  7580. }
  7581. );
  7582. document.head.appendChild( script[ 0 ] );
  7583. },
  7584. abort: function() {
  7585. if ( callback ) {
  7586. callback();
  7587. }
  7588. }
  7589. };
  7590. }
  7591. });
  7592. var oldCallbacks = [],
  7593. rjsonp = /(=)\?(?=&|$)|\?\?/;
  7594. // Default jsonp settings
  7595. jQuery.ajaxSetup({
  7596. jsonp: "callback",
  7597. jsonpCallback: function() {
  7598. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  7599. this[ callback ] = true;
  7600. return callback;
  7601. }
  7602. });
  7603. // Detect, normalize options and install callbacks for jsonp requests
  7604. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  7605. var callbackName, overwritten, responseContainer,
  7606. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  7607. "url" :
  7608. typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
  7609. );
  7610. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  7611. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  7612. // Get callback name, remembering preexisting value associated with it
  7613. callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
  7614. s.jsonpCallback() :
  7615. s.jsonpCallback;
  7616. // Insert callback into url or form data
  7617. if ( jsonProp ) {
  7618. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  7619. } else if ( s.jsonp !== false ) {
  7620. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  7621. }
  7622. // Use data converter to retrieve json after script execution
  7623. s.converters["script json"] = function() {
  7624. if ( !responseContainer ) {
  7625. jQuery.error( callbackName + " was not called" );
  7626. }
  7627. return responseContainer[ 0 ];
  7628. };
  7629. // force json dataType
  7630. s.dataTypes[ 0 ] = "json";
  7631. // Install callback
  7632. overwritten = window[ callbackName ];
  7633. window[ callbackName ] = function() {
  7634. responseContainer = arguments;
  7635. };
  7636. // Clean-up function (fires after converters)
  7637. jqXHR.always(function() {
  7638. // Restore preexisting value
  7639. window[ callbackName ] = overwritten;
  7640. // Save back as free
  7641. if ( s[ callbackName ] ) {
  7642. // make sure that re-using the options doesn't screw things around
  7643. s.jsonpCallback = originalSettings.jsonpCallback;
  7644. // save the callback name for future use
  7645. oldCallbacks.push( callbackName );
  7646. }
  7647. // Call if it was a function and we have a response
  7648. if ( responseContainer && jQuery.isFunction( overwritten ) ) {
  7649. overwritten( responseContainer[ 0 ] );
  7650. }
  7651. responseContainer = overwritten = undefined;
  7652. });
  7653. // Delegate to script
  7654. return "script";
  7655. }
  7656. });
  7657. // data: string of html
  7658. // context (optional): If specified, the fragment will be created in this context, defaults to document
  7659. // keepScripts (optional): If true, will include scripts passed in the html string
  7660. jQuery.parseHTML = function( data, context, keepScripts ) {
  7661. if ( !data || typeof data !== "string" ) {
  7662. return null;
  7663. }
  7664. if ( typeof context === "boolean" ) {
  7665. keepScripts = context;
  7666. context = false;
  7667. }
  7668. context = context || document;
  7669. var parsed = rsingleTag.exec( data ),
  7670. scripts = !keepScripts && [];
  7671. // Single tag
  7672. if ( parsed ) {
  7673. return [ context.createElement( parsed[1] ) ];
  7674. }
  7675. parsed = jQuery.buildFragment( [ data ], context, scripts );
  7676. if ( scripts && scripts.length ) {
  7677. jQuery( scripts ).remove();
  7678. }
  7679. return jQuery.merge( [], parsed.childNodes );
  7680. };
  7681. // Keep a copy of the old load method
  7682. var _load = jQuery.fn.load;
  7683. /**
  7684. * Load a url into a page
  7685. */
  7686. jQuery.fn.load = function( url, params, callback ) {
  7687. if ( typeof url !== "string" && _load ) {
  7688. return _load.apply( this, arguments );
  7689. }
  7690. var selector, type, response,
  7691. self = this,
  7692. off = url.indexOf(" ");
  7693. if ( off >= 0 ) {
  7694. selector = url.slice( off );
  7695. url = url.slice( 0, off );
  7696. }
  7697. // If it's a function
  7698. if ( jQuery.isFunction( params ) ) {
  7699. // We assume that it's the callback
  7700. callback = params;
  7701. params = undefined;
  7702. // Otherwise, build a param string
  7703. } else if ( params && typeof params === "object" ) {
  7704. type = "POST";
  7705. }
  7706. // If we have elements to modify, make the request
  7707. if ( self.length > 0 ) {
  7708. jQuery.ajax({
  7709. url: url,
  7710. // if "type" variable is undefined, then "GET" method will be used
  7711. type: type,
  7712. dataType: "html",
  7713. data: params
  7714. }).done(function( responseText ) {
  7715. // Save response for use in complete callback
  7716. response = arguments;
  7717. self.html( selector ?
  7718. // If a selector was specified, locate the right elements in a dummy div
  7719. // Exclude scripts to avoid IE 'Permission Denied' errors
  7720. jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
  7721. // Otherwise use the full result
  7722. responseText );
  7723. }).complete( callback && function( jqXHR, status ) {
  7724. self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
  7725. });
  7726. }
  7727. return this;
  7728. };
  7729. jQuery.expr.filters.animated = function( elem ) {
  7730. return jQuery.grep(jQuery.timers, function( fn ) {
  7731. return elem === fn.elem;
  7732. }).length;
  7733. };
  7734. var docElem = window.document.documentElement;
  7735. /**
  7736. * Gets a window from an element
  7737. */
  7738. function getWindow( elem ) {
  7739. return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
  7740. }
  7741. jQuery.offset = {
  7742. setOffset: function( elem, options, i ) {
  7743. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  7744. position = jQuery.css( elem, "position" ),
  7745. curElem = jQuery( elem ),
  7746. props = {};
  7747. // Set position first, in-case top/left are set even on static elem
  7748. if ( position === "static" ) {
  7749. elem.style.position = "relative";
  7750. }
  7751. curOffset = curElem.offset();
  7752. curCSSTop = jQuery.css( elem, "top" );
  7753. curCSSLeft = jQuery.css( elem, "left" );
  7754. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  7755. ( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
  7756. // Need to be able to calculate position if either top or left is auto and position is either absolute or fixed
  7757. if ( calculatePosition ) {
  7758. curPosition = curElem.position();
  7759. curTop = curPosition.top;
  7760. curLeft = curPosition.left;
  7761. } else {
  7762. curTop = parseFloat( curCSSTop ) || 0;
  7763. curLeft = parseFloat( curCSSLeft ) || 0;
  7764. }
  7765. if ( jQuery.isFunction( options ) ) {
  7766. options = options.call( elem, i, curOffset );
  7767. }
  7768. if ( options.top != null ) {
  7769. props.top = ( options.top - curOffset.top ) + curTop;
  7770. }
  7771. if ( options.left != null ) {
  7772. props.left = ( options.left - curOffset.left ) + curLeft;
  7773. }
  7774. if ( "using" in options ) {
  7775. options.using.call( elem, props );
  7776. } else {
  7777. curElem.css( props );
  7778. }
  7779. }
  7780. };
  7781. jQuery.fn.extend({
  7782. offset: function( options ) {
  7783. if ( arguments.length ) {
  7784. return options === undefined ?
  7785. this :
  7786. this.each(function( i ) {
  7787. jQuery.offset.setOffset( this, options, i );
  7788. });
  7789. }
  7790. var docElem, win,
  7791. elem = this[ 0 ],
  7792. box = { top: 0, left: 0 },
  7793. doc = elem && elem.ownerDocument;
  7794. if ( !doc ) {
  7795. return;
  7796. }
  7797. docElem = doc.documentElement;
  7798. // Make sure it's not a disconnected DOM node
  7799. if ( !jQuery.contains( docElem, elem ) ) {
  7800. return box;
  7801. }
  7802. // If we don't have gBCR, just use 0,0 rather than error
  7803. // BlackBerry 5, iOS 3 (original iPhone)
  7804. if ( typeof elem.getBoundingClientRect !== strundefined ) {
  7805. box = elem.getBoundingClientRect();
  7806. }
  7807. win = getWindow( doc );
  7808. return {
  7809. top: box.top + win.pageYOffset - docElem.clientTop,
  7810. left: box.left + win.pageXOffset - docElem.clientLeft
  7811. };
  7812. },
  7813. position: function() {
  7814. if ( !this[ 0 ] ) {
  7815. return;
  7816. }
  7817. var offsetParent, offset,
  7818. elem = this[ 0 ],
  7819. parentOffset = { top: 0, left: 0 };
  7820. // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
  7821. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  7822. // We assume that getBoundingClientRect is available when computed position is fixed
  7823. offset = elem.getBoundingClientRect();
  7824. } else {
  7825. // Get *real* offsetParent
  7826. offsetParent = this.offsetParent();
  7827. // Get correct offsets
  7828. offset = this.offset();
  7829. if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
  7830. parentOffset = offsetParent.offset();
  7831. }
  7832. // Add offsetParent borders
  7833. parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
  7834. parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
  7835. }
  7836. // Subtract parent offsets and element margins
  7837. return {
  7838. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  7839. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  7840. };
  7841. },
  7842. offsetParent: function() {
  7843. return this.map(function() {
  7844. var offsetParent = this.offsetParent || docElem;
  7845. while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
  7846. offsetParent = offsetParent.offsetParent;
  7847. }
  7848. return offsetParent || docElem;
  7849. });
  7850. }
  7851. });
  7852. // Create scrollLeft and scrollTop methods
  7853. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  7854. var top = "pageYOffset" === prop;
  7855. jQuery.fn[ method ] = function( val ) {
  7856. return access( this, function( elem, method, val ) {
  7857. var win = getWindow( elem );
  7858. if ( val === undefined ) {
  7859. return win ? win[ prop ] : elem[ method ];
  7860. }
  7861. if ( win ) {
  7862. win.scrollTo(
  7863. !top ? val : window.pageXOffset,
  7864. top ? val : window.pageYOffset
  7865. );
  7866. } else {
  7867. elem[ method ] = val;
  7868. }
  7869. }, method, val, arguments.length, null );
  7870. };
  7871. });
  7872. // Add the top/left cssHooks using jQuery.fn.position
  7873. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  7874. // getComputedStyle returns percent when specified for top/left/bottom/right
  7875. // rather than make the css module depend on the offset module, we just check for it here
  7876. jQuery.each( [ "top", "left" ], function( i, prop ) {
  7877. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  7878. function( elem, computed ) {
  7879. if ( computed ) {
  7880. computed = curCSS( elem, prop );
  7881. // if curCSS returns percentage, fallback to offset
  7882. return rnumnonpx.test( computed ) ?
  7883. jQuery( elem ).position()[ prop ] + "px" :
  7884. computed;
  7885. }
  7886. }
  7887. );
  7888. });
  7889. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  7890. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  7891. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
  7892. // margin is only for outerHeight, outerWidth
  7893. jQuery.fn[ funcName ] = function( margin, value ) {
  7894. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  7895. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  7896. return access( this, function( elem, type, value ) {
  7897. var doc;
  7898. if ( jQuery.isWindow( elem ) ) {
  7899. // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
  7900. // isn't a whole lot we can do. See pull request at this URL for discussion:
  7901. // https://github.com/jquery/jquery/pull/764
  7902. return elem.document.documentElement[ "client" + name ];
  7903. }
  7904. // Get document width or height
  7905. if ( elem.nodeType === 9 ) {
  7906. doc = elem.documentElement;
  7907. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  7908. // whichever is greatest
  7909. return Math.max(
  7910. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  7911. elem.body[ "offset" + name ], doc[ "offset" + name ],
  7912. doc[ "client" + name ]
  7913. );
  7914. }
  7915. return value === undefined ?
  7916. // Get width or height on the element, requesting but not forcing parseFloat
  7917. jQuery.css( elem, type, extra ) :
  7918. // Set width or height on the element
  7919. jQuery.style( elem, type, value, extra );
  7920. }, type, chainable ? margin : undefined, chainable, null );
  7921. };
  7922. });
  7923. });
  7924. // The number of elements contained in the matched element set
  7925. jQuery.fn.size = function() {
  7926. return this.length;
  7927. };
  7928. jQuery.fn.andSelf = jQuery.fn.addBack;
  7929. // Register as a named AMD module, since jQuery can be concatenated with other
  7930. // files that may use define, but not via a proper concatenation script that
  7931. // understands anonymous AMD modules. A named AMD is safest and most robust
  7932. // way to register. Lowercase jquery is used because AMD module names are
  7933. // derived from file names, and jQuery is normally delivered in a lowercase
  7934. // file name. Do this after creating the global so that if an AMD module wants
  7935. // to call noConflict to hide this version of jQuery, it will work.
  7936. if ( typeof define === "function" && define.amd ) {
  7937. define( "jquery", [], function() {
  7938. return jQuery;
  7939. });
  7940. }
  7941. var
  7942. // Map over jQuery in case of overwrite
  7943. _jQuery = window.jQuery,
  7944. // Map over the $ in case of overwrite
  7945. _$ = window.$;
  7946. jQuery.noConflict = function( deep ) {
  7947. if ( window.$ === jQuery ) {
  7948. window.$ = _$;
  7949. }
  7950. if ( deep && window.jQuery === jQuery ) {
  7951. window.jQuery = _jQuery;
  7952. }
  7953. return jQuery;
  7954. };
  7955. // Expose jQuery and $ identifiers, even in
  7956. // AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  7957. // and CommonJS for browser emulators (#13566)
  7958. if ( typeof noGlobal === strundefined ) {
  7959. window.jQuery = window.$ = jQuery;
  7960. }
  7961. return jQuery;
  7962. }));
  7963. define('select2/utils',[], function () {
  7964. var Utils = {};
  7965. Utils.Extend = function (ChildClass, SuperClass) {
  7966. var __hasProp = {}.hasOwnProperty;
  7967. function BaseConstructor () {
  7968. this.constructor = ChildClass;
  7969. }
  7970. for (var key in SuperClass) {
  7971. if (__hasProp.call(SuperClass, key)) {
  7972. ChildClass[key] = SuperClass[key];
  7973. }
  7974. }
  7975. BaseConstructor.prototype = SuperClass.prototype;
  7976. ChildClass.prototype = new BaseConstructor();
  7977. ChildClass.__super__ = SuperClass.prototype;
  7978. return ChildClass;
  7979. };
  7980. function getMethods (theClass) {
  7981. var proto = theClass.prototype;
  7982. var methods = [];
  7983. for (var methodName in proto) {
  7984. var m = proto[methodName];
  7985. if (typeof m !== 'function') {
  7986. continue;
  7987. }
  7988. if (methodName === 'constructor') {
  7989. continue;
  7990. }
  7991. methods.push(methodName);
  7992. }
  7993. return methods;
  7994. }
  7995. Utils.Decorate = function (SuperClass, DecoratorClass) {
  7996. var decoratedMethods = getMethods(DecoratorClass);
  7997. var superMethods = getMethods(SuperClass);
  7998. function DecoratedClass () {
  7999. var unshift = Array.prototype.unshift;
  8000. var argCount = DecoratorClass.prototype.constructor.length;
  8001. var calledConstructor = SuperClass.prototype.constructor;
  8002. if (argCount > 0) {
  8003. unshift.call(arguments, SuperClass.prototype.constructor);
  8004. calledConstructor = DecoratorClass.prototype.constructor;
  8005. }
  8006. calledConstructor.apply(this, arguments);
  8007. }
  8008. DecoratorClass.displayName = SuperClass.displayName;
  8009. function ctr () {
  8010. this.constructor = DecoratedClass;
  8011. }
  8012. DecoratedClass.prototype = new ctr();
  8013. for (var m = 0; m < superMethods.length; m++) {
  8014. var superMethod = superMethods[m];
  8015. DecoratedClass.prototype[superMethod] =
  8016. SuperClass.prototype[superMethod];
  8017. }
  8018. var calledMethod = function (methodName) {
  8019. // Stub out the original method if it's not decorating an actual method
  8020. var originalMethod = function () {};
  8021. if (methodName in DecoratedClass.prototype) {
  8022. originalMethod = DecoratedClass.prototype[methodName];
  8023. }
  8024. var decoratedMethod = DecoratorClass.prototype[methodName];
  8025. return function () {
  8026. var unshift = Array.prototype.unshift;
  8027. unshift.call(arguments, originalMethod);
  8028. return decoratedMethod.apply(this, arguments);
  8029. };
  8030. };
  8031. for (var d = 0; d < decoratedMethods.length; d++) {
  8032. var decoratedMethod = decoratedMethods[d];
  8033. DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
  8034. }
  8035. return DecoratedClass;
  8036. };
  8037. var Observable = function () {
  8038. this.listeners = {};
  8039. };
  8040. Observable.prototype.on = function (event, callback) {
  8041. this.listeners = this.listeners || {};
  8042. if (event in this.listeners) {
  8043. this.listeners[event].push(callback);
  8044. } else {
  8045. this.listeners[event] = [callback];
  8046. }
  8047. };
  8048. Observable.prototype.trigger = function (event) {
  8049. var slice = Array.prototype.slice;
  8050. this.listeners = this.listeners || {};
  8051. if (event in this.listeners) {
  8052. this.invoke(this.listeners[event], slice.call(arguments, 1));
  8053. }
  8054. if ('*' in this.listeners) {
  8055. this.invoke(this.listeners['*'], arguments);
  8056. }
  8057. };
  8058. Observable.prototype.invoke = function (listeners, params) {
  8059. for (var i = 0, len = listeners.length; i < len; i++) {
  8060. listeners[i].apply(this, params);
  8061. }
  8062. };
  8063. Utils.Observable = Observable;
  8064. Utils.generateChars = function (length) {
  8065. var chars = '';
  8066. for (var i = 0; i < length; i++) {
  8067. var randomChar = Math.floor(Math.random() * 36);
  8068. chars += randomChar.toString(36);
  8069. }
  8070. return chars;
  8071. };
  8072. Utils.bind = function (func, context) {
  8073. return function () {
  8074. func.apply(context, arguments);
  8075. };
  8076. };
  8077. return Utils;
  8078. });
  8079. define('select2/results',[
  8080. './utils'
  8081. ], function (Utils) {
  8082. function Results ($element, options, dataAdapter) {
  8083. this.$element = $element;
  8084. this.data = dataAdapter;
  8085. this.options = options;
  8086. Results.__super__.constructor.call(this);
  8087. }
  8088. Utils.Extend(Results, Utils.Observable);
  8089. Results.prototype.render = function () {
  8090. var $results = $(
  8091. '<ul class="select2-results__options" role="tree"></ul>'
  8092. );
  8093. if (this.options.get('multiple')) {
  8094. $results.attr('aria-multiselectable', 'true');
  8095. }
  8096. this.$results = $results;
  8097. return $results;
  8098. };
  8099. Results.prototype.clear = function () {
  8100. this.$results.empty();
  8101. };
  8102. Results.prototype.displayMessage = function (params) {
  8103. this.clear();
  8104. this.hideLoading();
  8105. var $message = $(
  8106. '<li role="treeitem" class="select2-results__option"></li>'
  8107. );
  8108. var message = this.options.get('translations').get(params.message);
  8109. $message.text(message(params.args));
  8110. this.$results.append($message);
  8111. };
  8112. Results.prototype.append = function (data) {
  8113. this.hideLoading();
  8114. var $options = [];
  8115. if (data.length === 0) {
  8116. if (this.$results.children().length === 0) {
  8117. this.trigger('results:message', {
  8118. message: 'noResults'
  8119. });
  8120. }
  8121. return;
  8122. }
  8123. data = this.sort(data);
  8124. for (var d = 0; d < data.length; d++) {
  8125. var item = data[d];
  8126. var $option = this.option(item);
  8127. $options.push($option);
  8128. }
  8129. this.$results.append($options);
  8130. };
  8131. Results.prototype.position = function ($results, $dropdown) {
  8132. var $resultsContainer = $dropdown.find('.select2-results');
  8133. $resultsContainer.append($results);
  8134. };
  8135. Results.prototype.sort = function (data) {
  8136. var sorter = this.options.get('sorter');
  8137. return sorter(data);
  8138. };
  8139. Results.prototype.setClasses = function () {
  8140. var self = this;
  8141. this.data.current(function (selected) {
  8142. var selectedIds = $.map(selected, function (s) {
  8143. return s.id.toString();
  8144. });
  8145. var $options = self.$results
  8146. .find('.select2-results__option[aria-selected]');
  8147. $options.each(function () {
  8148. var $option = $(this);
  8149. var item = $.data(this, 'data');
  8150. if (item.id != null && selectedIds.indexOf(item.id.toString()) > -1) {
  8151. $option.attr('aria-selected', 'true');
  8152. } else {
  8153. $option.attr('aria-selected', 'false');
  8154. }
  8155. });
  8156. var $selected = $options.filter('[aria-selected=true]');
  8157. // Check if there are any selected options
  8158. if ($selected.length > 0) {
  8159. // If there are selected options, highlight the first
  8160. $selected.first().trigger('mouseenter');
  8161. } else {
  8162. // If there are no selected options, highlight the first option
  8163. // in the dropdown
  8164. $options.first().trigger('mouseenter');
  8165. }
  8166. });
  8167. };
  8168. Results.prototype.showLoading = function (params) {
  8169. this.hideLoading();
  8170. var loadingMore = this.options.get('translations').get('searching');
  8171. var loading = {
  8172. disabled: true,
  8173. loading: true,
  8174. text: loadingMore(params)
  8175. };
  8176. var $loading = this.option(loading);
  8177. $loading.className += ' loading-results';
  8178. this.$results.prepend($loading);
  8179. };
  8180. Results.prototype.hideLoading = function () {
  8181. this.$results.find('.loading-results').remove();
  8182. };
  8183. Results.prototype.option = function (data) {
  8184. var option = document.createElement('li');
  8185. option.className = 'select2-results__option';
  8186. var attrs = {
  8187. 'role': 'treeitem',
  8188. 'aria-selected': 'false'
  8189. };
  8190. if (data.disabled) {
  8191. delete attrs['aria-selected'];
  8192. attrs['aria-disabled'] = 'true';
  8193. }
  8194. if (data.id == null) {
  8195. delete attrs['aria-selected'];
  8196. }
  8197. if (data._resultId != null) {
  8198. option.id = data._resultId;
  8199. }
  8200. if (data.children) {
  8201. attrs.role = 'group';
  8202. attrs['aria-label'] = data.text;
  8203. delete attrs['aria-selected'];
  8204. }
  8205. for (var attr in attrs) {
  8206. var val = attrs[attr];
  8207. option.setAttribute(attr, val);
  8208. }
  8209. if (data.children) {
  8210. var $option = $(option);
  8211. var label = document.createElement('strong');
  8212. label.className = 'select2-results__group';
  8213. var $label = $(label);
  8214. this.template(data, label);
  8215. var $children = [];
  8216. for (var c = 0; c < data.children.length; c++) {
  8217. var child = data.children[c];
  8218. var $child = this.option(child);
  8219. $children.push($child);
  8220. }
  8221. var $childrenContainer = $('<ul></ul>', {
  8222. 'class': 'select2-results__options select2-results__options--nested'
  8223. });
  8224. $childrenContainer.append($children);
  8225. $option.append(label);
  8226. $option.append($childrenContainer);
  8227. } else {
  8228. this.template(data, option);
  8229. }
  8230. $.data(option, 'data', data);
  8231. return option;
  8232. };
  8233. Results.prototype.bind = function (container, $container) {
  8234. var self = this;
  8235. var id = container.id + '-results';
  8236. this.$results.attr('id', id);
  8237. container.on('results:all', function (params) {
  8238. self.clear();
  8239. self.append(params.data);
  8240. if (container.isOpen()) {
  8241. self.setClasses();
  8242. }
  8243. });
  8244. container.on('results:append', function (params) {
  8245. self.append(params.data);
  8246. if (container.isOpen()) {
  8247. self.setClasses();
  8248. }
  8249. });
  8250. container.on('query', function (params) {
  8251. self.showLoading(params);
  8252. });
  8253. container.on('select', function () {
  8254. if (!container.isOpen()) {
  8255. return;
  8256. }
  8257. self.setClasses();
  8258. });
  8259. container.on('unselect', function () {
  8260. if (!container.isOpen()) {
  8261. return;
  8262. }
  8263. self.setClasses();
  8264. });
  8265. container.on('open', function () {
  8266. // When the dropdown is open, aria-expended="true"
  8267. self.$results.attr('aria-expanded', 'true');
  8268. self.$results.attr('aria-hidden', 'false');
  8269. self.setClasses();
  8270. self.ensureHighlightVisible();
  8271. });
  8272. container.on('close', function () {
  8273. // When the dropdown is closed, aria-expended="false"
  8274. self.$results.attr('aria-expanded', 'false');
  8275. self.$results.attr('aria-hidden', 'true');
  8276. self.$results.removeAttr('aria-activedescendant');
  8277. });
  8278. container.on('results:select', function () {
  8279. var $highlighted = self.getHighlightedResults();
  8280. if ($highlighted.length === 0) {
  8281. return;
  8282. }
  8283. var data = $highlighted.data('data');
  8284. if ($highlighted.attr('aria-selected') == 'true') {
  8285. self.trigger('unselected', {
  8286. data: data
  8287. });
  8288. } else {
  8289. self.trigger('selected', {
  8290. data: data
  8291. });
  8292. }
  8293. });
  8294. container.on('results:previous', function () {
  8295. var $highlighted = self.getHighlightedResults();
  8296. var $options = self.$results.find('[aria-selected]');
  8297. var currentIndex = $options.index($highlighted);
  8298. // If we are already at te top, don't move further
  8299. if (currentIndex === 0) {
  8300. return;
  8301. }
  8302. var nextIndex = currentIndex - 1;
  8303. // If none are highlighted, highlight the first
  8304. if ($highlighted.length === 0) {
  8305. nextIndex = 0;
  8306. }
  8307. var $next = $options.eq(nextIndex);
  8308. $next.trigger('mouseenter');
  8309. var currentOffset = self.$results.offset().top;
  8310. var nextTop = $next.offset().top;
  8311. var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
  8312. if (nextIndex === 0) {
  8313. self.$results.scrollTop(0);
  8314. } else if (nextTop - currentOffset < 0) {
  8315. self.$results.scrollTop(nextOffset);
  8316. }
  8317. });
  8318. container.on('results:next', function () {
  8319. var $highlighted = self.getHighlightedResults();
  8320. var $options = self.$results.find('[aria-selected]');
  8321. var currentIndex = $options.index($highlighted);
  8322. var nextIndex = currentIndex + 1;
  8323. // If we are at the last option, stay there
  8324. if (nextIndex >= $options.length) {
  8325. return;
  8326. }
  8327. var $next = $options.eq(nextIndex);
  8328. $next.trigger('mouseenter');
  8329. var currentOffset = self.$results.offset().top +
  8330. self.$results.outerHeight(false);
  8331. var nextBottom = $next.offset().top + $next.outerHeight(false);
  8332. var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
  8333. if (nextIndex === 0) {
  8334. self.$results.scrollTop(0);
  8335. } else if (nextBottom > currentOffset) {
  8336. self.$results.scrollTop(nextOffset);
  8337. }
  8338. });
  8339. container.on('results:focus', function (params) {
  8340. params.element.addClass('select2-results__option--highlighted');
  8341. });
  8342. container.on('results:message', function (params) {
  8343. self.trigger('results:message', params);
  8344. });
  8345. this.on('results:message', function (params) {
  8346. self.displayMessage(params);
  8347. });
  8348. this.$results.on('mouseup', '.select2-results__option[aria-selected]',
  8349. function (evt) {
  8350. var $this = $(this);
  8351. var data = $this.data('data');
  8352. if ($this.attr('aria-selected') === 'true') {
  8353. self.trigger('unselected', {
  8354. originalEvent: evt,
  8355. data: data
  8356. });
  8357. return;
  8358. }
  8359. self.trigger('selected', {
  8360. originalEvent: evt,
  8361. data: data
  8362. });
  8363. });
  8364. this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
  8365. function (evt) {
  8366. var data = $(this).data('data');
  8367. self.getHighlightedResults()
  8368. .removeClass('select2-results__option--highlighted');
  8369. self.trigger('results:focus', {
  8370. data: data,
  8371. element: $(this)
  8372. });
  8373. });
  8374. };
  8375. Results.prototype.getHighlightedResults = function () {
  8376. var $highlighted = this.$results
  8377. .find('.select2-results__option--highlighted');
  8378. return $highlighted;
  8379. };
  8380. Results.prototype.destroy = function () {
  8381. this.$results.remove();
  8382. };
  8383. Results.prototype.ensureHighlightVisible = function () {
  8384. var $highlighted = this.getHighlightedResults();
  8385. if ($highlighted.length === 0) {
  8386. return;
  8387. }
  8388. var $options = this.$results.find('[aria-selected]');
  8389. var currentIndex = $options.index($highlighted);
  8390. var currentOffset = this.$results.offset().top;
  8391. var nextTop = $highlighted.offset().top;
  8392. var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
  8393. var offsetDelta = nextTop - currentOffset;
  8394. nextOffset -= $highlighted.outerHeight(false) * 2;
  8395. if (currentIndex <= 2) {
  8396. this.$results.scrollTop(0);
  8397. } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
  8398. this.$results.scrollTop(nextOffset);
  8399. }
  8400. };
  8401. Results.prototype.template = function (result, container) {
  8402. var template = this.options.get('templateResult');
  8403. container.innerHTML = template(result);
  8404. };
  8405. return Results;
  8406. });
  8407. define('select2/keys',[
  8408. ], function () {
  8409. var KEYS = {
  8410. BACKSPACE: 8,
  8411. TAB: 9,
  8412. ENTER: 13,
  8413. SHIFT: 16,
  8414. CTRL: 17,
  8415. ALT: 18,
  8416. ESC: 27,
  8417. SPACE: 32,
  8418. PAGE_UP: 33,
  8419. PAGE_DOWN: 34,
  8420. END: 35,
  8421. HOME: 36,
  8422. LEFT: 37,
  8423. UP: 38,
  8424. RIGHT: 39,
  8425. DOWN: 40,
  8426. DELETE: 46,
  8427. isArrow: function (k) {
  8428. k = k.which ? k.which : k;
  8429. switch (k) {
  8430. case KEY.LEFT:
  8431. case KEY.RIGHT:
  8432. case KEY.UP:
  8433. case KEY.DOWN:
  8434. return true;
  8435. }
  8436. return false;
  8437. }
  8438. };
  8439. return KEYS;
  8440. });
  8441. define('select2/selection/base',[
  8442. '../utils',
  8443. '../keys'
  8444. ], function (Utils, KEYS) {
  8445. function BaseSelection ($element, options) {
  8446. this.$element = $element;
  8447. this.options = options;
  8448. BaseSelection.__super__.constructor.call(this);
  8449. }
  8450. Utils.Extend(BaseSelection, Utils.Observable);
  8451. BaseSelection.prototype.render = function () {
  8452. throw new Error('The `render` method must be defined in child classes.');
  8453. };
  8454. BaseSelection.prototype.bind = function (container, $container) {
  8455. var self = this;
  8456. var id = container.id + '-container';
  8457. var resultsId = container.id + '-results';
  8458. this.container = container;
  8459. this.$selection.attr('aria-owns', resultsId);
  8460. this.$selection.on('keydown', function (evt) {
  8461. self.trigger('keypress', evt);
  8462. if (evt.which === KEYS.SPACE) {
  8463. evt.preventDefault();
  8464. }
  8465. });
  8466. container.on('results:focus', function (params) {
  8467. self.$selection.attr('aria-activedescendant', params.data._resultId);
  8468. });
  8469. container.on('selection:update', function (params) {
  8470. self.update(params.data);
  8471. });
  8472. container.on('open', function () {
  8473. // When the dropdown is open, aria-expanded="true"
  8474. self.$selection.attr('aria-expanded', 'true');
  8475. self._attachCloseHandler(container);
  8476. });
  8477. container.on('close', function () {
  8478. // When the dropdown is closed, aria-expanded="false"
  8479. self.$selection.attr('aria-expanded', 'false');
  8480. self.$selection.removeAttr('aria-activedescendant');
  8481. self.$selection.focus();
  8482. self._detachCloseHandler(container);
  8483. });
  8484. };
  8485. BaseSelection.prototype._attachCloseHandler = function (container) {
  8486. var self = this;
  8487. $(document.body).on('mousedown.select2.' + container.id, function (e) {
  8488. var $target = $(e.target);
  8489. var $select = $target.closest('.select2');
  8490. var $all = $('.select2.select2-container--open');
  8491. $all.each(function () {
  8492. var $this = $(this);
  8493. if (this == $select[0]) {
  8494. return;
  8495. }
  8496. var $element = $this.data('element');
  8497. $element.select2('close');
  8498. });
  8499. });
  8500. $(window).on('scroll.select2.' + container.id, function (e) {
  8501. self.trigger('close');
  8502. });
  8503. };
  8504. BaseSelection.prototype._detachCloseHandler = function (container) {
  8505. $(document.body).off('mousedown.select2.' + container.id);
  8506. $(window).off('scroll.select2.' + container.id);
  8507. };
  8508. BaseSelection.prototype.position = function ($selection, $container) {
  8509. var $selectionContainer = $container.find('.selection');
  8510. $selectionContainer.append($selection);
  8511. };
  8512. BaseSelection.prototype.destroy = function () {
  8513. this._detachCloseHandler(this.container);
  8514. };
  8515. BaseSelection.prototype.update = function (data) {
  8516. throw new Error('The `update` method must be defined in child classes.');
  8517. };
  8518. return BaseSelection;
  8519. });
  8520. define('select2/selection/single',[
  8521. './base',
  8522. '../utils',
  8523. '../keys'
  8524. ], function (BaseSelection, Utils, KEYS) {
  8525. function SingleSelection () {
  8526. SingleSelection.__super__.constructor.apply(this, arguments);
  8527. }
  8528. Utils.Extend(SingleSelection, BaseSelection);
  8529. SingleSelection.prototype.render = function () {
  8530. var $selection = $(
  8531. '<span class="select2-selection select2-selection--single" tabindex="0"' +
  8532. ' role="combobox" aria-autocomplete="list" aria-haspopup="true"' +
  8533. ' aria-expanded="false">' +
  8534. '<span class="select2-selection__rendered"></span>' +
  8535. '<span class="select2-selection__arrow" role="presentation">' +
  8536. '<b role="presentation"></b>' +
  8537. '</span>' +
  8538. '</span>'
  8539. );
  8540. $selection.attr('title', this.$element.attr('title'));
  8541. this.$selection = $selection;
  8542. return $selection;
  8543. };
  8544. SingleSelection.prototype.bind = function (container, $container) {
  8545. var self = this;
  8546. SingleSelection.__super__.bind.apply(this, arguments);
  8547. var id = container.id + '-container';
  8548. this.$selection.find('.select2-selection__rendered').attr('id', id);
  8549. this.$selection.attr('aria-labelledby', id);
  8550. this.$selection.on('mousedown', function (evt) {
  8551. // Only respond to left clicks
  8552. if (evt.which !== 1) {
  8553. return;
  8554. }
  8555. self.trigger('toggle', {
  8556. originalEvent: evt
  8557. });
  8558. });
  8559. this.$selection.on('focus', function (evt) {
  8560. // User focuses on the container
  8561. });
  8562. this.$selection.on('blur', function (evt) {
  8563. // User exits the container
  8564. });
  8565. container.on('enable', function () {
  8566. self.$selection.attr('tabindex', '0');
  8567. });
  8568. container.on('disable', function () {
  8569. self.$selection.attr('tabindex', '-1');
  8570. });
  8571. container.on('selection:update', function (params) {
  8572. self.update(params.data);
  8573. });
  8574. };
  8575. SingleSelection.prototype.clear = function () {
  8576. this.$selection.find('.select2-selection__rendered').empty();
  8577. };
  8578. SingleSelection.prototype.display = function (data) {
  8579. var template = this.options.get('templateSelection');
  8580. return template(data);
  8581. };
  8582. SingleSelection.prototype.selectionContainer = function () {
  8583. return $('<span></span>');
  8584. };
  8585. SingleSelection.prototype.update = function (data) {
  8586. if (data.length === 0) {
  8587. this.clear();
  8588. return;
  8589. }
  8590. var selection = data[0];
  8591. var formatted = this.display(selection);
  8592. this.$selection.find('.select2-selection__rendered').html(formatted);
  8593. };
  8594. return SingleSelection;
  8595. });
  8596. define('select2/selection/multiple',[
  8597. './base',
  8598. '../utils'
  8599. ], function (BaseSelection, Utils) {
  8600. function MultipleSelection ($element, options) {
  8601. MultipleSelection.__super__.constructor.apply(this, arguments);
  8602. }
  8603. Utils.Extend(MultipleSelection, BaseSelection);
  8604. MultipleSelection.prototype.render = function () {
  8605. var $selection = $(
  8606. '<span class="select2-selection select2-selection--multiple"' +
  8607. ' tabindex="0" role="combobox" aria-autocomplete="list"' +
  8608. ' aria-haspopup="true" aria-expanded="false">' +
  8609. '<ul class="select2-selection__rendered"></ul>' +
  8610. '</span>'
  8611. );
  8612. $selection.attr('title', this.$element.attr('title'));
  8613. this.$selection = $selection;
  8614. return $selection;
  8615. };
  8616. MultipleSelection.prototype.bind = function (container, $container) {
  8617. var self = this;
  8618. MultipleSelection.__super__.bind.apply(this, arguments);
  8619. this.$selection.on('click', function (evt) {
  8620. self.trigger('toggle', {
  8621. originalEvent: evt
  8622. });
  8623. });
  8624. this.$selection.on('click', '.select2-selection__choice__remove',
  8625. function (evt) {
  8626. var $remove = $(this);
  8627. var $selection = $remove.parent();
  8628. var data = $selection.data('data');
  8629. self.trigger('unselected', {
  8630. originalEvent: evt,
  8631. data: data
  8632. });
  8633. });
  8634. container.on('enable', function () {
  8635. self.$selection.attr('tabindex', '0');
  8636. });
  8637. container.on('disable', function () {
  8638. self.$selection.attr('tabindex', '-1');
  8639. });
  8640. };
  8641. MultipleSelection.prototype.clear = function () {
  8642. this.$selection.find('.select2-selection__rendered').empty();
  8643. };
  8644. MultipleSelection.prototype.display = function (data) {
  8645. var template = this.options.get('templateSelection');
  8646. return template(data);
  8647. };
  8648. MultipleSelection.prototype.selectionContainer = function () {
  8649. var $container = $(
  8650. '<li class="select2-selection__choice">' +
  8651. '<span class="select2-selection__choice__remove" role="presentation">' +
  8652. '&times;' +
  8653. '</span>' +
  8654. '</li>'
  8655. );
  8656. return $container;
  8657. };
  8658. MultipleSelection.prototype.update = function (data) {
  8659. this.clear();
  8660. if (data.length === 0) {
  8661. return;
  8662. }
  8663. var $selections = [];
  8664. for (var d = 0; d < data.length; d++) {
  8665. var selection = data[d];
  8666. var formatted = this.display(selection);
  8667. var $selection = this.selectionContainer();
  8668. $selection.append(formatted);
  8669. $selection.data('data', selection);
  8670. $selections.push($selection);
  8671. }
  8672. this.$selection.find('.select2-selection__rendered').append($selections);
  8673. };
  8674. return MultipleSelection;
  8675. });
  8676. define('select2/selection/placeholder',[
  8677. '../utils'
  8678. ], function (Utils) {
  8679. function Placeholder (decorated, $element, options) {
  8680. this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
  8681. decorated.call(this, $element, options);
  8682. }
  8683. Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
  8684. if (typeof placeholder === 'string') {
  8685. placeholder = {
  8686. id: '',
  8687. text: placeholder
  8688. };
  8689. }
  8690. return placeholder;
  8691. };
  8692. Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
  8693. var $placeholder = this.selectionContainer();
  8694. $placeholder.html(this.display(placeholder));
  8695. $placeholder.addClass('select2-selection__placeholder')
  8696. .removeClass('select2-selection__choice');
  8697. return $placeholder;
  8698. };
  8699. Placeholder.prototype.update = function (decorated, data) {
  8700. var singlePlaceholder = (
  8701. data.length == 1 && data[0].id != this.placeholder.id
  8702. );
  8703. var multipleSelections = data.length > 1;
  8704. if (multipleSelections || singlePlaceholder) {
  8705. return decorated.call(this, data);
  8706. }
  8707. this.clear();
  8708. var $placeholder = this.createPlaceholder(this.placeholder);
  8709. this.$selection.find('.select2-selection__rendered').append($placeholder);
  8710. };
  8711. return Placeholder;
  8712. });
  8713. define('select2/selection/allowClear',[
  8714. ], function () {
  8715. function AllowClear () { }
  8716. AllowClear.prototype.bind = function (decorated, container, $container) {
  8717. var self = this;
  8718. decorated.call(this, container, $container);
  8719. this.$selection.on('mousedown', '.select2-selection__clear',
  8720. function (evt) {
  8721. evt.stopPropagation();
  8722. self.$element.val(self.placeholder.id).trigger('change');
  8723. self.trigger('toggle');
  8724. });
  8725. };
  8726. AllowClear.prototype.update = function (decorated, data) {
  8727. decorated.call(this, data);
  8728. if (this.$selection.find('.select2-selection__placeholder').length > 0) {
  8729. return;
  8730. }
  8731. var $remove = $(
  8732. '<span class="select2-selection__clear">' +
  8733. '&times;' +
  8734. '</span>'
  8735. );
  8736. this.$selection.find('.select2-selection__rendered').append($remove);
  8737. };
  8738. return AllowClear;
  8739. });
  8740. define('select2/selection/search',[
  8741. '../utils',
  8742. '../keys'
  8743. ], function (Utils, KEYS) {
  8744. function Search (decorated, $element, options) {
  8745. decorated.call(this, $element, options);
  8746. }
  8747. Search.prototype.render = function (decorated) {
  8748. var $search = $(
  8749. '<li class="select2-search select2-search--inline">' +
  8750. '<input class="select2-search__field" type="search" tabindex="-1"' +
  8751. ' role="textbox" />' +
  8752. '</li>'
  8753. );
  8754. this.$searchContainer = $search;
  8755. this.$search = $search.find('input');
  8756. var $rendered = decorated.call(this);
  8757. return $rendered;
  8758. };
  8759. Search.prototype.bind = function (decorated, container, $container) {
  8760. var self = this;
  8761. decorated.call(this, container, $container);
  8762. container.on('open', function () {
  8763. self.$search.attr('tabindex', 0);
  8764. self.$search.focus();
  8765. });
  8766. container.on('close', function () {
  8767. self.$search.attr('tabindex', -1);
  8768. self.$search.val('');
  8769. });
  8770. container.on('enable', function () {
  8771. self.$search.prop('disabled', false);
  8772. });
  8773. container.on('disable', function () {
  8774. self.$search.prop('disabled', true);
  8775. });
  8776. this.$selection.on('keydown', '.select2-search--inline', function (evt) {
  8777. evt.stopPropagation();
  8778. self.trigger('keypress', evt);
  8779. self._keyUpPrevented = evt.isDefaultPrevented();
  8780. var key = evt.which;
  8781. if (key === KEYS.BACKSPACE && self.$search.val() === '') {
  8782. var $previousChoice = self.$searchContainer
  8783. .prev('.select2-selection__choice');
  8784. if ($previousChoice.length > 0) {
  8785. var item = $previousChoice.data('data');
  8786. self.searchRemoveChoice(item);
  8787. }
  8788. }
  8789. });
  8790. this.$selection.on('keyup', '.select2-search--inline', function (evt) {
  8791. self.handleSearch(evt);
  8792. });
  8793. };
  8794. Search.prototype.createPlaceholder = function (decorated, placeholder) {
  8795. this.$search.attr('placeholder', placeholder.text);
  8796. };
  8797. Search.prototype.update = function (decorated, data) {
  8798. this.$search.attr('placeholder', '');
  8799. decorated.call(this, data);
  8800. this.$selection.find('.select2-selection__rendered')
  8801. .append(this.$searchContainer);
  8802. this.resizeSearch();
  8803. };
  8804. Search.prototype.handleSearch = function () {
  8805. this.resizeSearch();
  8806. if (!this._keyUpPrevented) {
  8807. var input = this.$search.val();
  8808. this.trigger('query', {
  8809. term: input
  8810. });
  8811. }
  8812. this._keyUpPrevented = false;
  8813. };
  8814. Search.prototype.searchRemoveChoice = function (decorated, item) {
  8815. this.trigger('unselected', {
  8816. data: item
  8817. });
  8818. this.trigger('open');
  8819. this.$search.val(item.text + ' ');
  8820. };
  8821. Search.prototype.resizeSearch = function () {
  8822. this.$search.css('width', '25px');
  8823. var width = '';
  8824. if (this.$search.attr('placeholder') !== '') {
  8825. width = this.$selection.innerWidth();
  8826. width -= this.$selection.find('.select2-selection__rendered')
  8827. .innerWidth();
  8828. width = width + 'px';
  8829. } else {
  8830. var minimumWidth = this.$search.val().length + 1;
  8831. width = (minimumWidth * 0.75) + 'em';
  8832. }
  8833. this.$search.css('width', width);
  8834. };
  8835. return Search;
  8836. });
  8837. define('select2/translation',[
  8838. ], function () {
  8839. function Translation (dict) {
  8840. this.dict = dict || {};
  8841. }
  8842. Translation.prototype.all = function () {
  8843. return this.dict;
  8844. };
  8845. Translation.prototype.get = function (key) {
  8846. return this.dict[key];
  8847. };
  8848. Translation.prototype.extend = function (translation) {
  8849. this.dict = $.extend({}, translation.all(), this.dict);
  8850. };
  8851. // Static functions
  8852. Translation._cache = {};
  8853. Translation.loadPath = function (path) {
  8854. if (!(path in Translation._cache)) {
  8855. var translations = require(path);
  8856. Translation._cache[path] = translations;
  8857. }
  8858. return new Translation(Translation._cache[path]);
  8859. };
  8860. return Translation;
  8861. });
  8862. define('select2/diacritics',[
  8863. ], function () {
  8864. var diacritics = {
  8865. '\u24B6': 'A',
  8866. '\uFF21': 'A',
  8867. '\u00C0': 'A',
  8868. '\u00C1': 'A',
  8869. '\u00C2': 'A',
  8870. '\u1EA6': 'A',
  8871. '\u1EA4': 'A',
  8872. '\u1EAA': 'A',
  8873. '\u1EA8': 'A',
  8874. '\u00C3': 'A',
  8875. '\u0100': 'A',
  8876. '\u0102': 'A',
  8877. '\u1EB0': 'A',
  8878. '\u1EAE': 'A',
  8879. '\u1EB4': 'A',
  8880. '\u1EB2': 'A',
  8881. '\u0226': 'A',
  8882. '\u01E0': 'A',
  8883. '\u00C4': 'A',
  8884. '\u01DE': 'A',
  8885. '\u1EA2': 'A',
  8886. '\u00C5': 'A',
  8887. '\u01FA': 'A',
  8888. '\u01CD': 'A',
  8889. '\u0200': 'A',
  8890. '\u0202': 'A',
  8891. '\u1EA0': 'A',
  8892. '\u1EAC': 'A',
  8893. '\u1EB6': 'A',
  8894. '\u1E00': 'A',
  8895. '\u0104': 'A',
  8896. '\u023A': 'A',
  8897. '\u2C6F': 'A',
  8898. '\uA732': 'AA',
  8899. '\u00C6': 'AE',
  8900. '\u01FC': 'AE',
  8901. '\u01E2': 'AE',
  8902. '\uA734': 'AO',
  8903. '\uA736': 'AU',
  8904. '\uA738': 'AV',
  8905. '\uA73A': 'AV',
  8906. '\uA73C': 'AY',
  8907. '\u24B7': 'B',
  8908. '\uFF22': 'B',
  8909. '\u1E02': 'B',
  8910. '\u1E04': 'B',
  8911. '\u1E06': 'B',
  8912. '\u0243': 'B',
  8913. '\u0182': 'B',
  8914. '\u0181': 'B',
  8915. '\u24B8': 'C',
  8916. '\uFF23': 'C',
  8917. '\u0106': 'C',
  8918. '\u0108': 'C',
  8919. '\u010A': 'C',
  8920. '\u010C': 'C',
  8921. '\u00C7': 'C',
  8922. '\u1E08': 'C',
  8923. '\u0187': 'C',
  8924. '\u023B': 'C',
  8925. '\uA73E': 'C',
  8926. '\u24B9': 'D',
  8927. '\uFF24': 'D',
  8928. '\u1E0A': 'D',
  8929. '\u010E': 'D',
  8930. '\u1E0C': 'D',
  8931. '\u1E10': 'D',
  8932. '\u1E12': 'D',
  8933. '\u1E0E': 'D',
  8934. '\u0110': 'D',
  8935. '\u018B': 'D',
  8936. '\u018A': 'D',
  8937. '\u0189': 'D',
  8938. '\uA779': 'D',
  8939. '\u01F1': 'DZ',
  8940. '\u01C4': 'DZ',
  8941. '\u01F2': 'Dz',
  8942. '\u01C5': 'Dz',
  8943. '\u24BA': 'E',
  8944. '\uFF25': 'E',
  8945. '\u00C8': 'E',
  8946. '\u00C9': 'E',
  8947. '\u00CA': 'E',
  8948. '\u1EC0': 'E',
  8949. '\u1EBE': 'E',
  8950. '\u1EC4': 'E',
  8951. '\u1EC2': 'E',
  8952. '\u1EBC': 'E',
  8953. '\u0112': 'E',
  8954. '\u1E14': 'E',
  8955. '\u1E16': 'E',
  8956. '\u0114': 'E',
  8957. '\u0116': 'E',
  8958. '\u00CB': 'E',
  8959. '\u1EBA': 'E',
  8960. '\u011A': 'E',
  8961. '\u0204': 'E',
  8962. '\u0206': 'E',
  8963. '\u1EB8': 'E',
  8964. '\u1EC6': 'E',
  8965. '\u0228': 'E',
  8966. '\u1E1C': 'E',
  8967. '\u0118': 'E',
  8968. '\u1E18': 'E',
  8969. '\u1E1A': 'E',
  8970. '\u0190': 'E',
  8971. '\u018E': 'E',
  8972. '\u24BB': 'F',
  8973. '\uFF26': 'F',
  8974. '\u1E1E': 'F',
  8975. '\u0191': 'F',
  8976. '\uA77B': 'F',
  8977. '\u24BC': 'G',
  8978. '\uFF27': 'G',
  8979. '\u01F4': 'G',
  8980. '\u011C': 'G',
  8981. '\u1E20': 'G',
  8982. '\u011E': 'G',
  8983. '\u0120': 'G',
  8984. '\u01E6': 'G',
  8985. '\u0122': 'G',
  8986. '\u01E4': 'G',
  8987. '\u0193': 'G',
  8988. '\uA7A0': 'G',
  8989. '\uA77D': 'G',
  8990. '\uA77E': 'G',
  8991. '\u24BD': 'H',
  8992. '\uFF28': 'H',
  8993. '\u0124': 'H',
  8994. '\u1E22': 'H',
  8995. '\u1E26': 'H',
  8996. '\u021E': 'H',
  8997. '\u1E24': 'H',
  8998. '\u1E28': 'H',
  8999. '\u1E2A': 'H',
  9000. '\u0126': 'H',
  9001. '\u2C67': 'H',
  9002. '\u2C75': 'H',
  9003. '\uA78D': 'H',
  9004. '\u24BE': 'I',
  9005. '\uFF29': 'I',
  9006. '\u00CC': 'I',
  9007. '\u00CD': 'I',
  9008. '\u00CE': 'I',
  9009. '\u0128': 'I',
  9010. '\u012A': 'I',
  9011. '\u012C': 'I',
  9012. '\u0130': 'I',
  9013. '\u00CF': 'I',
  9014. '\u1E2E': 'I',
  9015. '\u1EC8': 'I',
  9016. '\u01CF': 'I',
  9017. '\u0208': 'I',
  9018. '\u020A': 'I',
  9019. '\u1ECA': 'I',
  9020. '\u012E': 'I',
  9021. '\u1E2C': 'I',
  9022. '\u0197': 'I',
  9023. '\u24BF': 'J',
  9024. '\uFF2A': 'J',
  9025. '\u0134': 'J',
  9026. '\u0248': 'J',
  9027. '\u24C0': 'K',
  9028. '\uFF2B': 'K',
  9029. '\u1E30': 'K',
  9030. '\u01E8': 'K',
  9031. '\u1E32': 'K',
  9032. '\u0136': 'K',
  9033. '\u1E34': 'K',
  9034. '\u0198': 'K',
  9035. '\u2C69': 'K',
  9036. '\uA740': 'K',
  9037. '\uA742': 'K',
  9038. '\uA744': 'K',
  9039. '\uA7A2': 'K',
  9040. '\u24C1': 'L',
  9041. '\uFF2C': 'L',
  9042. '\u013F': 'L',
  9043. '\u0139': 'L',
  9044. '\u013D': 'L',
  9045. '\u1E36': 'L',
  9046. '\u1E38': 'L',
  9047. '\u013B': 'L',
  9048. '\u1E3C': 'L',
  9049. '\u1E3A': 'L',
  9050. '\u0141': 'L',
  9051. '\u023D': 'L',
  9052. '\u2C62': 'L',
  9053. '\u2C60': 'L',
  9054. '\uA748': 'L',
  9055. '\uA746': 'L',
  9056. '\uA780': 'L',
  9057. '\u01C7': 'LJ',
  9058. '\u01C8': 'Lj',
  9059. '\u24C2': 'M',
  9060. '\uFF2D': 'M',
  9061. '\u1E3E': 'M',
  9062. '\u1E40': 'M',
  9063. '\u1E42': 'M',
  9064. '\u2C6E': 'M',
  9065. '\u019C': 'M',
  9066. '\u24C3': 'N',
  9067. '\uFF2E': 'N',
  9068. '\u01F8': 'N',
  9069. '\u0143': 'N',
  9070. '\u00D1': 'N',
  9071. '\u1E44': 'N',
  9072. '\u0147': 'N',
  9073. '\u1E46': 'N',
  9074. '\u0145': 'N',
  9075. '\u1E4A': 'N',
  9076. '\u1E48': 'N',
  9077. '\u0220': 'N',
  9078. '\u019D': 'N',
  9079. '\uA790': 'N',
  9080. '\uA7A4': 'N',
  9081. '\u01CA': 'NJ',
  9082. '\u01CB': 'Nj',
  9083. '\u24C4': 'O',
  9084. '\uFF2F': 'O',
  9085. '\u00D2': 'O',
  9086. '\u00D3': 'O',
  9087. '\u00D4': 'O',
  9088. '\u1ED2': 'O',
  9089. '\u1ED0': 'O',
  9090. '\u1ED6': 'O',
  9091. '\u1ED4': 'O',
  9092. '\u00D5': 'O',
  9093. '\u1E4C': 'O',
  9094. '\u022C': 'O',
  9095. '\u1E4E': 'O',
  9096. '\u014C': 'O',
  9097. '\u1E50': 'O',
  9098. '\u1E52': 'O',
  9099. '\u014E': 'O',
  9100. '\u022E': 'O',
  9101. '\u0230': 'O',
  9102. '\u00D6': 'O',
  9103. '\u022A': 'O',
  9104. '\u1ECE': 'O',
  9105. '\u0150': 'O',
  9106. '\u01D1': 'O',
  9107. '\u020C': 'O',
  9108. '\u020E': 'O',
  9109. '\u01A0': 'O',
  9110. '\u1EDC': 'O',
  9111. '\u1EDA': 'O',
  9112. '\u1EE0': 'O',
  9113. '\u1EDE': 'O',
  9114. '\u1EE2': 'O',
  9115. '\u1ECC': 'O',
  9116. '\u1ED8': 'O',
  9117. '\u01EA': 'O',
  9118. '\u01EC': 'O',
  9119. '\u00D8': 'O',
  9120. '\u01FE': 'O',
  9121. '\u0186': 'O',
  9122. '\u019F': 'O',
  9123. '\uA74A': 'O',
  9124. '\uA74C': 'O',
  9125. '\u01A2': 'OI',
  9126. '\uA74E': 'OO',
  9127. '\u0222': 'OU',
  9128. '\u24C5': 'P',
  9129. '\uFF30': 'P',
  9130. '\u1E54': 'P',
  9131. '\u1E56': 'P',
  9132. '\u01A4': 'P',
  9133. '\u2C63': 'P',
  9134. '\uA750': 'P',
  9135. '\uA752': 'P',
  9136. '\uA754': 'P',
  9137. '\u24C6': 'Q',
  9138. '\uFF31': 'Q',
  9139. '\uA756': 'Q',
  9140. '\uA758': 'Q',
  9141. '\u024A': 'Q',
  9142. '\u24C7': 'R',
  9143. '\uFF32': 'R',
  9144. '\u0154': 'R',
  9145. '\u1E58': 'R',
  9146. '\u0158': 'R',
  9147. '\u0210': 'R',
  9148. '\u0212': 'R',
  9149. '\u1E5A': 'R',
  9150. '\u1E5C': 'R',
  9151. '\u0156': 'R',
  9152. '\u1E5E': 'R',
  9153. '\u024C': 'R',
  9154. '\u2C64': 'R',
  9155. '\uA75A': 'R',
  9156. '\uA7A6': 'R',
  9157. '\uA782': 'R',
  9158. '\u24C8': 'S',
  9159. '\uFF33': 'S',
  9160. '\u1E9E': 'S',
  9161. '\u015A': 'S',
  9162. '\u1E64': 'S',
  9163. '\u015C': 'S',
  9164. '\u1E60': 'S',
  9165. '\u0160': 'S',
  9166. '\u1E66': 'S',
  9167. '\u1E62': 'S',
  9168. '\u1E68': 'S',
  9169. '\u0218': 'S',
  9170. '\u015E': 'S',
  9171. '\u2C7E': 'S',
  9172. '\uA7A8': 'S',
  9173. '\uA784': 'S',
  9174. '\u24C9': 'T',
  9175. '\uFF34': 'T',
  9176. '\u1E6A': 'T',
  9177. '\u0164': 'T',
  9178. '\u1E6C': 'T',
  9179. '\u021A': 'T',
  9180. '\u0162': 'T',
  9181. '\u1E70': 'T',
  9182. '\u1E6E': 'T',
  9183. '\u0166': 'T',
  9184. '\u01AC': 'T',
  9185. '\u01AE': 'T',
  9186. '\u023E': 'T',
  9187. '\uA786': 'T',
  9188. '\uA728': 'TZ',
  9189. '\u24CA': 'U',
  9190. '\uFF35': 'U',
  9191. '\u00D9': 'U',
  9192. '\u00DA': 'U',
  9193. '\u00DB': 'U',
  9194. '\u0168': 'U',
  9195. '\u1E78': 'U',
  9196. '\u016A': 'U',
  9197. '\u1E7A': 'U',
  9198. '\u016C': 'U',
  9199. '\u00DC': 'U',
  9200. '\u01DB': 'U',
  9201. '\u01D7': 'U',
  9202. '\u01D5': 'U',
  9203. '\u01D9': 'U',
  9204. '\u1EE6': 'U',
  9205. '\u016E': 'U',
  9206. '\u0170': 'U',
  9207. '\u01D3': 'U',
  9208. '\u0214': 'U',
  9209. '\u0216': 'U',
  9210. '\u01AF': 'U',
  9211. '\u1EEA': 'U',
  9212. '\u1EE8': 'U',
  9213. '\u1EEE': 'U',
  9214. '\u1EEC': 'U',
  9215. '\u1EF0': 'U',
  9216. '\u1EE4': 'U',
  9217. '\u1E72': 'U',
  9218. '\u0172': 'U',
  9219. '\u1E76': 'U',
  9220. '\u1E74': 'U',
  9221. '\u0244': 'U',
  9222. '\u24CB': 'V',
  9223. '\uFF36': 'V',
  9224. '\u1E7C': 'V',
  9225. '\u1E7E': 'V',
  9226. '\u01B2': 'V',
  9227. '\uA75E': 'V',
  9228. '\u0245': 'V',
  9229. '\uA760': 'VY',
  9230. '\u24CC': 'W',
  9231. '\uFF37': 'W',
  9232. '\u1E80': 'W',
  9233. '\u1E82': 'W',
  9234. '\u0174': 'W',
  9235. '\u1E86': 'W',
  9236. '\u1E84': 'W',
  9237. '\u1E88': 'W',
  9238. '\u2C72': 'W',
  9239. '\u24CD': 'X',
  9240. '\uFF38': 'X',
  9241. '\u1E8A': 'X',
  9242. '\u1E8C': 'X',
  9243. '\u24CE': 'Y',
  9244. '\uFF39': 'Y',
  9245. '\u1EF2': 'Y',
  9246. '\u00DD': 'Y',
  9247. '\u0176': 'Y',
  9248. '\u1EF8': 'Y',
  9249. '\u0232': 'Y',
  9250. '\u1E8E': 'Y',
  9251. '\u0178': 'Y',
  9252. '\u1EF6': 'Y',
  9253. '\u1EF4': 'Y',
  9254. '\u01B3': 'Y',
  9255. '\u024E': 'Y',
  9256. '\u1EFE': 'Y',
  9257. '\u24CF': 'Z',
  9258. '\uFF3A': 'Z',
  9259. '\u0179': 'Z',
  9260. '\u1E90': 'Z',
  9261. '\u017B': 'Z',
  9262. '\u017D': 'Z',
  9263. '\u1E92': 'Z',
  9264. '\u1E94': 'Z',
  9265. '\u01B5': 'Z',
  9266. '\u0224': 'Z',
  9267. '\u2C7F': 'Z',
  9268. '\u2C6B': 'Z',
  9269. '\uA762': 'Z',
  9270. '\u24D0': 'a',
  9271. '\uFF41': 'a',
  9272. '\u1E9A': 'a',
  9273. '\u00E0': 'a',
  9274. '\u00E1': 'a',
  9275. '\u00E2': 'a',
  9276. '\u1EA7': 'a',
  9277. '\u1EA5': 'a',
  9278. '\u1EAB': 'a',
  9279. '\u1EA9': 'a',
  9280. '\u00E3': 'a',
  9281. '\u0101': 'a',
  9282. '\u0103': 'a',
  9283. '\u1EB1': 'a',
  9284. '\u1EAF': 'a',
  9285. '\u1EB5': 'a',
  9286. '\u1EB3': 'a',
  9287. '\u0227': 'a',
  9288. '\u01E1': 'a',
  9289. '\u00E4': 'a',
  9290. '\u01DF': 'a',
  9291. '\u1EA3': 'a',
  9292. '\u00E5': 'a',
  9293. '\u01FB': 'a',
  9294. '\u01CE': 'a',
  9295. '\u0201': 'a',
  9296. '\u0203': 'a',
  9297. '\u1EA1': 'a',
  9298. '\u1EAD': 'a',
  9299. '\u1EB7': 'a',
  9300. '\u1E01': 'a',
  9301. '\u0105': 'a',
  9302. '\u2C65': 'a',
  9303. '\u0250': 'a',
  9304. '\uA733': 'aa',
  9305. '\u00E6': 'ae',
  9306. '\u01FD': 'ae',
  9307. '\u01E3': 'ae',
  9308. '\uA735': 'ao',
  9309. '\uA737': 'au',
  9310. '\uA739': 'av',
  9311. '\uA73B': 'av',
  9312. '\uA73D': 'ay',
  9313. '\u24D1': 'b',
  9314. '\uFF42': 'b',
  9315. '\u1E03': 'b',
  9316. '\u1E05': 'b',
  9317. '\u1E07': 'b',
  9318. '\u0180': 'b',
  9319. '\u0183': 'b',
  9320. '\u0253': 'b',
  9321. '\u24D2': 'c',
  9322. '\uFF43': 'c',
  9323. '\u0107': 'c',
  9324. '\u0109': 'c',
  9325. '\u010B': 'c',
  9326. '\u010D': 'c',
  9327. '\u00E7': 'c',
  9328. '\u1E09': 'c',
  9329. '\u0188': 'c',
  9330. '\u023C': 'c',
  9331. '\uA73F': 'c',
  9332. '\u2184': 'c',
  9333. '\u24D3': 'd',
  9334. '\uFF44': 'd',
  9335. '\u1E0B': 'd',
  9336. '\u010F': 'd',
  9337. '\u1E0D': 'd',
  9338. '\u1E11': 'd',
  9339. '\u1E13': 'd',
  9340. '\u1E0F': 'd',
  9341. '\u0111': 'd',
  9342. '\u018C': 'd',
  9343. '\u0256': 'd',
  9344. '\u0257': 'd',
  9345. '\uA77A': 'd',
  9346. '\u01F3': 'dz',
  9347. '\u01C6': 'dz',
  9348. '\u24D4': 'e',
  9349. '\uFF45': 'e',
  9350. '\u00E8': 'e',
  9351. '\u00E9': 'e',
  9352. '\u00EA': 'e',
  9353. '\u1EC1': 'e',
  9354. '\u1EBF': 'e',
  9355. '\u1EC5': 'e',
  9356. '\u1EC3': 'e',
  9357. '\u1EBD': 'e',
  9358. '\u0113': 'e',
  9359. '\u1E15': 'e',
  9360. '\u1E17': 'e',
  9361. '\u0115': 'e',
  9362. '\u0117': 'e',
  9363. '\u00EB': 'e',
  9364. '\u1EBB': 'e',
  9365. '\u011B': 'e',
  9366. '\u0205': 'e',
  9367. '\u0207': 'e',
  9368. '\u1EB9': 'e',
  9369. '\u1EC7': 'e',
  9370. '\u0229': 'e',
  9371. '\u1E1D': 'e',
  9372. '\u0119': 'e',
  9373. '\u1E19': 'e',
  9374. '\u1E1B': 'e',
  9375. '\u0247': 'e',
  9376. '\u025B': 'e',
  9377. '\u01DD': 'e',
  9378. '\u24D5': 'f',
  9379. '\uFF46': 'f',
  9380. '\u1E1F': 'f',
  9381. '\u0192': 'f',
  9382. '\uA77C': 'f',
  9383. '\u24D6': 'g',
  9384. '\uFF47': 'g',
  9385. '\u01F5': 'g',
  9386. '\u011D': 'g',
  9387. '\u1E21': 'g',
  9388. '\u011F': 'g',
  9389. '\u0121': 'g',
  9390. '\u01E7': 'g',
  9391. '\u0123': 'g',
  9392. '\u01E5': 'g',
  9393. '\u0260': 'g',
  9394. '\uA7A1': 'g',
  9395. '\u1D79': 'g',
  9396. '\uA77F': 'g',
  9397. '\u24D7': 'h',
  9398. '\uFF48': 'h',
  9399. '\u0125': 'h',
  9400. '\u1E23': 'h',
  9401. '\u1E27': 'h',
  9402. '\u021F': 'h',
  9403. '\u1E25': 'h',
  9404. '\u1E29': 'h',
  9405. '\u1E2B': 'h',
  9406. '\u1E96': 'h',
  9407. '\u0127': 'h',
  9408. '\u2C68': 'h',
  9409. '\u2C76': 'h',
  9410. '\u0265': 'h',
  9411. '\u0195': 'hv',
  9412. '\u24D8': 'i',
  9413. '\uFF49': 'i',
  9414. '\u00EC': 'i',
  9415. '\u00ED': 'i',
  9416. '\u00EE': 'i',
  9417. '\u0129': 'i',
  9418. '\u012B': 'i',
  9419. '\u012D': 'i',
  9420. '\u00EF': 'i',
  9421. '\u1E2F': 'i',
  9422. '\u1EC9': 'i',
  9423. '\u01D0': 'i',
  9424. '\u0209': 'i',
  9425. '\u020B': 'i',
  9426. '\u1ECB': 'i',
  9427. '\u012F': 'i',
  9428. '\u1E2D': 'i',
  9429. '\u0268': 'i',
  9430. '\u0131': 'i',
  9431. '\u24D9': 'j',
  9432. '\uFF4A': 'j',
  9433. '\u0135': 'j',
  9434. '\u01F0': 'j',
  9435. '\u0249': 'j',
  9436. '\u24DA': 'k',
  9437. '\uFF4B': 'k',
  9438. '\u1E31': 'k',
  9439. '\u01E9': 'k',
  9440. '\u1E33': 'k',
  9441. '\u0137': 'k',
  9442. '\u1E35': 'k',
  9443. '\u0199': 'k',
  9444. '\u2C6A': 'k',
  9445. '\uA741': 'k',
  9446. '\uA743': 'k',
  9447. '\uA745': 'k',
  9448. '\uA7A3': 'k',
  9449. '\u24DB': 'l',
  9450. '\uFF4C': 'l',
  9451. '\u0140': 'l',
  9452. '\u013A': 'l',
  9453. '\u013E': 'l',
  9454. '\u1E37': 'l',
  9455. '\u1E39': 'l',
  9456. '\u013C': 'l',
  9457. '\u1E3D': 'l',
  9458. '\u1E3B': 'l',
  9459. '\u017F': 'l',
  9460. '\u0142': 'l',
  9461. '\u019A': 'l',
  9462. '\u026B': 'l',
  9463. '\u2C61': 'l',
  9464. '\uA749': 'l',
  9465. '\uA781': 'l',
  9466. '\uA747': 'l',
  9467. '\u01C9': 'lj',
  9468. '\u24DC': 'm',
  9469. '\uFF4D': 'm',
  9470. '\u1E3F': 'm',
  9471. '\u1E41': 'm',
  9472. '\u1E43': 'm',
  9473. '\u0271': 'm',
  9474. '\u026F': 'm',
  9475. '\u24DD': 'n',
  9476. '\uFF4E': 'n',
  9477. '\u01F9': 'n',
  9478. '\u0144': 'n',
  9479. '\u00F1': 'n',
  9480. '\u1E45': 'n',
  9481. '\u0148': 'n',
  9482. '\u1E47': 'n',
  9483. '\u0146': 'n',
  9484. '\u1E4B': 'n',
  9485. '\u1E49': 'n',
  9486. '\u019E': 'n',
  9487. '\u0272': 'n',
  9488. '\u0149': 'n',
  9489. '\uA791': 'n',
  9490. '\uA7A5': 'n',
  9491. '\u01CC': 'nj',
  9492. '\u24DE': 'o',
  9493. '\uFF4F': 'o',
  9494. '\u00F2': 'o',
  9495. '\u00F3': 'o',
  9496. '\u00F4': 'o',
  9497. '\u1ED3': 'o',
  9498. '\u1ED1': 'o',
  9499. '\u1ED7': 'o',
  9500. '\u1ED5': 'o',
  9501. '\u00F5': 'o',
  9502. '\u1E4D': 'o',
  9503. '\u022D': 'o',
  9504. '\u1E4F': 'o',
  9505. '\u014D': 'o',
  9506. '\u1E51': 'o',
  9507. '\u1E53': 'o',
  9508. '\u014F': 'o',
  9509. '\u022F': 'o',
  9510. '\u0231': 'o',
  9511. '\u00F6': 'o',
  9512. '\u022B': 'o',
  9513. '\u1ECF': 'o',
  9514. '\u0151': 'o',
  9515. '\u01D2': 'o',
  9516. '\u020D': 'o',
  9517. '\u020F': 'o',
  9518. '\u01A1': 'o',
  9519. '\u1EDD': 'o',
  9520. '\u1EDB': 'o',
  9521. '\u1EE1': 'o',
  9522. '\u1EDF': 'o',
  9523. '\u1EE3': 'o',
  9524. '\u1ECD': 'o',
  9525. '\u1ED9': 'o',
  9526. '\u01EB': 'o',
  9527. '\u01ED': 'o',
  9528. '\u00F8': 'o',
  9529. '\u01FF': 'o',
  9530. '\u0254': 'o',
  9531. '\uA74B': 'o',
  9532. '\uA74D': 'o',
  9533. '\u0275': 'o',
  9534. '\u01A3': 'oi',
  9535. '\u0223': 'ou',
  9536. '\uA74F': 'oo',
  9537. '\u24DF': 'p',
  9538. '\uFF50': 'p',
  9539. '\u1E55': 'p',
  9540. '\u1E57': 'p',
  9541. '\u01A5': 'p',
  9542. '\u1D7D': 'p',
  9543. '\uA751': 'p',
  9544. '\uA753': 'p',
  9545. '\uA755': 'p',
  9546. '\u24E0': 'q',
  9547. '\uFF51': 'q',
  9548. '\u024B': 'q',
  9549. '\uA757': 'q',
  9550. '\uA759': 'q',
  9551. '\u24E1': 'r',
  9552. '\uFF52': 'r',
  9553. '\u0155': 'r',
  9554. '\u1E59': 'r',
  9555. '\u0159': 'r',
  9556. '\u0211': 'r',
  9557. '\u0213': 'r',
  9558. '\u1E5B': 'r',
  9559. '\u1E5D': 'r',
  9560. '\u0157': 'r',
  9561. '\u1E5F': 'r',
  9562. '\u024D': 'r',
  9563. '\u027D': 'r',
  9564. '\uA75B': 'r',
  9565. '\uA7A7': 'r',
  9566. '\uA783': 'r',
  9567. '\u24E2': 's',
  9568. '\uFF53': 's',
  9569. '\u00DF': 's',
  9570. '\u015B': 's',
  9571. '\u1E65': 's',
  9572. '\u015D': 's',
  9573. '\u1E61': 's',
  9574. '\u0161': 's',
  9575. '\u1E67': 's',
  9576. '\u1E63': 's',
  9577. '\u1E69': 's',
  9578. '\u0219': 's',
  9579. '\u015F': 's',
  9580. '\u023F': 's',
  9581. '\uA7A9': 's',
  9582. '\uA785': 's',
  9583. '\u1E9B': 's',
  9584. '\u24E3': 't',
  9585. '\uFF54': 't',
  9586. '\u1E6B': 't',
  9587. '\u1E97': 't',
  9588. '\u0165': 't',
  9589. '\u1E6D': 't',
  9590. '\u021B': 't',
  9591. '\u0163': 't',
  9592. '\u1E71': 't',
  9593. '\u1E6F': 't',
  9594. '\u0167': 't',
  9595. '\u01AD': 't',
  9596. '\u0288': 't',
  9597. '\u2C66': 't',
  9598. '\uA787': 't',
  9599. '\uA729': 'tz',
  9600. '\u24E4': 'u',
  9601. '\uFF55': 'u',
  9602. '\u00F9': 'u',
  9603. '\u00FA': 'u',
  9604. '\u00FB': 'u',
  9605. '\u0169': 'u',
  9606. '\u1E79': 'u',
  9607. '\u016B': 'u',
  9608. '\u1E7B': 'u',
  9609. '\u016D': 'u',
  9610. '\u00FC': 'u',
  9611. '\u01DC': 'u',
  9612. '\u01D8': 'u',
  9613. '\u01D6': 'u',
  9614. '\u01DA': 'u',
  9615. '\u1EE7': 'u',
  9616. '\u016F': 'u',
  9617. '\u0171': 'u',
  9618. '\u01D4': 'u',
  9619. '\u0215': 'u',
  9620. '\u0217': 'u',
  9621. '\u01B0': 'u',
  9622. '\u1EEB': 'u',
  9623. '\u1EE9': 'u',
  9624. '\u1EEF': 'u',
  9625. '\u1EED': 'u',
  9626. '\u1EF1': 'u',
  9627. '\u1EE5': 'u',
  9628. '\u1E73': 'u',
  9629. '\u0173': 'u',
  9630. '\u1E77': 'u',
  9631. '\u1E75': 'u',
  9632. '\u0289': 'u',
  9633. '\u24E5': 'v',
  9634. '\uFF56': 'v',
  9635. '\u1E7D': 'v',
  9636. '\u1E7F': 'v',
  9637. '\u028B': 'v',
  9638. '\uA75F': 'v',
  9639. '\u028C': 'v',
  9640. '\uA761': 'vy',
  9641. '\u24E6': 'w',
  9642. '\uFF57': 'w',
  9643. '\u1E81': 'w',
  9644. '\u1E83': 'w',
  9645. '\u0175': 'w',
  9646. '\u1E87': 'w',
  9647. '\u1E85': 'w',
  9648. '\u1E98': 'w',
  9649. '\u1E89': 'w',
  9650. '\u2C73': 'w',
  9651. '\u24E7': 'x',
  9652. '\uFF58': 'x',
  9653. '\u1E8B': 'x',
  9654. '\u1E8D': 'x',
  9655. '\u24E8': 'y',
  9656. '\uFF59': 'y',
  9657. '\u1EF3': 'y',
  9658. '\u00FD': 'y',
  9659. '\u0177': 'y',
  9660. '\u1EF9': 'y',
  9661. '\u0233': 'y',
  9662. '\u1E8F': 'y',
  9663. '\u00FF': 'y',
  9664. '\u1EF7': 'y',
  9665. '\u1E99': 'y',
  9666. '\u1EF5': 'y',
  9667. '\u01B4': 'y',
  9668. '\u024F': 'y',
  9669. '\u1EFF': 'y',
  9670. '\u24E9': 'z',
  9671. '\uFF5A': 'z',
  9672. '\u017A': 'z',
  9673. '\u1E91': 'z',
  9674. '\u017C': 'z',
  9675. '\u017E': 'z',
  9676. '\u1E93': 'z',
  9677. '\u1E95': 'z',
  9678. '\u01B6': 'z',
  9679. '\u0225': 'z',
  9680. '\u0240': 'z',
  9681. '\u2C6C': 'z',
  9682. '\uA763': 'z',
  9683. '\u0386': '\u0391',
  9684. '\u0388': '\u0395',
  9685. '\u0389': '\u0397',
  9686. '\u038A': '\u0399',
  9687. '\u03AA': '\u0399',
  9688. '\u038C': '\u039F',
  9689. '\u038E': '\u03A5',
  9690. '\u03AB': '\u03A5',
  9691. '\u038F': '\u03A9',
  9692. '\u03AC': '\u03B1',
  9693. '\u03AD': '\u03B5',
  9694. '\u03AE': '\u03B7',
  9695. '\u03AF': '\u03B9',
  9696. '\u03CA': '\u03B9',
  9697. '\u0390': '\u03B9',
  9698. '\u03CC': '\u03BF',
  9699. '\u03CD': '\u03C5',
  9700. '\u03CB': '\u03C5',
  9701. '\u03B0': '\u03C5',
  9702. '\u03C9': '\u03C9',
  9703. '\u03C2': '\u03C3'
  9704. };
  9705. return diacritics;
  9706. });
  9707. define('select2/data/base',[
  9708. '../utils'
  9709. ], function (Utils) {
  9710. function BaseAdapter ($element, options) {
  9711. BaseAdapter.__super__.constructor.call(this);
  9712. }
  9713. Utils.Extend(BaseAdapter, Utils.Observable);
  9714. BaseAdapter.prototype.current = function (callback) {
  9715. throw new Error('The `current` method must be defined in child classes.');
  9716. };
  9717. BaseAdapter.prototype.query = function (params, callback) {
  9718. throw new Error('The `query` method must be defined in child classes.');
  9719. };
  9720. BaseAdapter.prototype.bind = function (container, $container) {
  9721. // Can be implemented in subclasses
  9722. };
  9723. BaseAdapter.prototype.destroy = function () {
  9724. // Can be implemented in subclasses
  9725. };
  9726. BaseAdapter.prototype.generateResultId = function (container, data) {
  9727. var id = container.id + '-result-';
  9728. id += Utils.generateChars(4);
  9729. if (data.id != null) {
  9730. id += '-' + data.id.toString();
  9731. } else {
  9732. id += '-' + Utils.generateChars(4);
  9733. }
  9734. return id;
  9735. };
  9736. return BaseAdapter;
  9737. });
  9738. define('select2/data/select',[
  9739. './base',
  9740. '../utils',
  9741. 'jquery'
  9742. ], function (BaseAdapter, Utils, $) {
  9743. function SelectAdapter ($element, options) {
  9744. this.$element = $element;
  9745. this.options = options;
  9746. SelectAdapter.__super__.constructor.call(this);
  9747. }
  9748. Utils.Extend(SelectAdapter, BaseAdapter);
  9749. SelectAdapter.prototype.current = function (callback) {
  9750. var data = [];
  9751. var self = this;
  9752. this.$element.find(':selected').each(function () {
  9753. var $option = $(this);
  9754. var option = self.item($option);
  9755. data.push(option);
  9756. });
  9757. callback(data);
  9758. };
  9759. SelectAdapter.prototype.select = function (data) {
  9760. var self = this;
  9761. // If data.element is a DOM nose, use it instead
  9762. if ($(data.element).is('option')) {
  9763. data.element.selected = true;
  9764. this.$element.trigger('change');
  9765. return;
  9766. }
  9767. if (this.$element.prop('multiple')) {
  9768. this.current(function (currentData) {
  9769. var val = [];
  9770. data = [data];
  9771. data.push.apply(data, currentData);
  9772. for (var d = 0; d < data.length; d++) {
  9773. id = data[d].id;
  9774. if (val.indexOf(id) === -1) {
  9775. val.push(id);
  9776. }
  9777. }
  9778. self.$element.val(val);
  9779. self.$element.trigger('change');
  9780. });
  9781. } else {
  9782. var val = data.id;
  9783. this.$element.val(val);
  9784. this.$element.trigger('change');
  9785. }
  9786. };
  9787. SelectAdapter.prototype.unselect = function (data) {
  9788. var self = this;
  9789. if (!this.$element.prop('multiple')) {
  9790. return;
  9791. }
  9792. if ($(data.element).is('option')) {
  9793. data.element.selected = false;
  9794. this.$element.trigger('change');
  9795. return;
  9796. }
  9797. this.current(function (currentData) {
  9798. var val = [];
  9799. for (var d = 0; d < currentData.length; d++) {
  9800. id = currentData[d].id;
  9801. if (id !== data.id && val.indexOf(id) === -1) {
  9802. val.push(id);
  9803. }
  9804. }
  9805. self.$element.val(val);
  9806. self.$element.trigger('change');
  9807. });
  9808. };
  9809. SelectAdapter.prototype.bind = function (container, $container) {
  9810. var self = this;
  9811. this.container = container;
  9812. container.on('select', function (params) {
  9813. self.select(params.data);
  9814. });
  9815. container.on('unselect', function (params) {
  9816. self.unselect(params.data);
  9817. });
  9818. };
  9819. SelectAdapter.prototype.destroy = function () {
  9820. // Remove anything added to child elements
  9821. this.$element.find('*').each(function () {
  9822. // Remove any custom data set by Select2
  9823. $.removeData(this, 'data');
  9824. });
  9825. };
  9826. SelectAdapter.prototype.query = function (params, callback) {
  9827. var data = [];
  9828. var self = this;
  9829. var $options = this.$element.children();
  9830. $options.each(function () {
  9831. var $option = $(this);
  9832. if (!$option.is('option') && !$option.is('optgroup')) {
  9833. return;
  9834. }
  9835. var option = self.item($option);
  9836. var matches = self.matches(params, option);
  9837. if (matches !== null) {
  9838. data.push(matches);
  9839. }
  9840. });
  9841. callback(data);
  9842. };
  9843. SelectAdapter.prototype.option = function (data) {
  9844. var option = document.createElement('option');
  9845. option.value = data.id;
  9846. if (data.disabled) {
  9847. option.disabled = true;
  9848. }
  9849. if (data.selected) {
  9850. option.selected = true;
  9851. }
  9852. option.innerText = data.text;
  9853. var $option = $(option);
  9854. var normalizedData = this._normalizeItem(data);
  9855. normalizedData.element = option;
  9856. // Override the option's data with the combined data
  9857. $.data(option, 'data', normalizedData);
  9858. return $option;
  9859. };
  9860. SelectAdapter.prototype.item = function ($option) {
  9861. var data = {};
  9862. data = $.data($option[0], 'data');
  9863. if (data != null) {
  9864. return data;
  9865. }
  9866. if ($option.is('option')) {
  9867. data = {
  9868. id: $option.val(),
  9869. text: $option.html(),
  9870. disabled: $option.prop('disabled'),
  9871. selected: $option.prop('selected')
  9872. };
  9873. } else if ($option.is('optgroup')) {
  9874. data = {
  9875. text: $option.attr('label'),
  9876. children: []
  9877. };
  9878. var $children = $option.children('option');
  9879. var children = [];
  9880. for (var c = 0; c < $children.length; c++) {
  9881. var $child = $($children[c]);
  9882. var child = this.item($child);
  9883. children.push(child);
  9884. }
  9885. data.children = children;
  9886. }
  9887. data = this._normalizeItem(data);
  9888. data.element = $option[0];
  9889. $.data($option[0], 'data', data);
  9890. return data;
  9891. };
  9892. SelectAdapter.prototype._normalizeItem = function (item) {
  9893. if (!$.isPlainObject(item)) {
  9894. item = {
  9895. id: item,
  9896. text: item
  9897. };
  9898. }
  9899. item = $.extend({}, {
  9900. text: ''
  9901. }, item);
  9902. var defaults = {
  9903. selected: false,
  9904. disabled: false
  9905. };
  9906. if (item.id != null) {
  9907. item.id = item.id.toString();
  9908. }
  9909. if (item.text != null) {
  9910. item.text = item.text.toString();
  9911. }
  9912. if (item._resultId == null && item.id && this.container != null) {
  9913. item._resultId = this.generateResultId(this.container, item);
  9914. }
  9915. return $.extend({}, defaults, item);
  9916. };
  9917. SelectAdapter.prototype.matches = function (params, data) {
  9918. var matcher = this.options.get('matcher');
  9919. return matcher(params, data);
  9920. };
  9921. return SelectAdapter;
  9922. });
  9923. define('select2/data/array',[
  9924. './select',
  9925. '../utils',
  9926. 'jquery'
  9927. ], function (SelectAdapter, Utils, $) {
  9928. function ArrayAdapter ($element, options) {
  9929. var data = options.get('data');
  9930. ArrayAdapter.__super__.constructor.call(this, $element, options);
  9931. this.convertToOptions(data);
  9932. }
  9933. Utils.Extend(ArrayAdapter, SelectAdapter);
  9934. ArrayAdapter.prototype.select = function (data) {
  9935. var $option = this.$element.find('option[value="' + data.id + '"]');
  9936. if ($option.length === 0) {
  9937. $option = this.option(data);
  9938. this.$element.append($option);
  9939. }
  9940. ArrayAdapter.__super__.select.call(this, data);
  9941. };
  9942. ArrayAdapter.prototype.convertToOptions = function (data) {
  9943. var self = this;
  9944. var $existing = this.$element.find('option');
  9945. var existingIds = $existing.map(function () {
  9946. return self.item($(this)).id;
  9947. }).get();
  9948. // Filter out all items except for the one passed in the argument
  9949. function onlyItem (item) {
  9950. return function () {
  9951. return $(this).val() == item.id;
  9952. };
  9953. }
  9954. for (var d = 0; d < data.length; d++) {
  9955. var item = data[d];
  9956. item.id = item.id.toString();
  9957. // Skip items which were pre-loaded, only merge the data
  9958. if (existingIds.indexOf(item.id) >= 0) {
  9959. var $existingOption = $existing.filter(onlyItem(item));
  9960. var existingData = this.item($existingOption);
  9961. var newData = $.extend(true, {}, existingData, item);
  9962. var $newOption = this.option(existingData);
  9963. $existingOption.replaceWith($newOption);
  9964. continue;
  9965. }
  9966. var $option = this.option(item);
  9967. this.$element.append($option);
  9968. }
  9969. };
  9970. return ArrayAdapter;
  9971. });
  9972. define('select2/data/ajax',[
  9973. './array',
  9974. '../utils',
  9975. 'jquery'
  9976. ], function (ArrayAdapter, Utils, $) {
  9977. function AjaxAdapter ($element, options) {
  9978. this.ajaxOptions = options.get('ajax');
  9979. if (this.ajaxOptions.processResults != null) {
  9980. this.processResults = this.ajaxOptions.processResults;
  9981. }
  9982. ArrayAdapter.__super__.constructor.call(this, $element, options);
  9983. }
  9984. Utils.Extend(AjaxAdapter, ArrayAdapter);
  9985. AjaxAdapter.prototype.processResults = function (results) {
  9986. return results;
  9987. };
  9988. AjaxAdapter.prototype.query = function (params, callback) {
  9989. var matches = [];
  9990. var self = this;
  9991. if (this._request) {
  9992. this._request.abort();
  9993. this._request = null;
  9994. }
  9995. var options = $.extend({
  9996. type: 'GET'
  9997. }, this.ajaxOptions);
  9998. if (typeof options.url === 'function') {
  9999. options.url = options.url(params);
  10000. }
  10001. if (typeof options.data === 'function') {
  10002. options.data = options.data(params);
  10003. }
  10004. function request () {
  10005. var $request = $.ajax(options);
  10006. $request.success(function (data) {
  10007. var results = self.processResults(data);
  10008. callback(results);
  10009. });
  10010. self._request = $request;
  10011. }
  10012. if (this.ajaxOptions.delay && params.term !== '') {
  10013. if (this._queryTimeout) {
  10014. window.clearTimeout(this._queryTimeout);
  10015. }
  10016. this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
  10017. } else {
  10018. request();
  10019. }
  10020. };
  10021. return AjaxAdapter;
  10022. });
  10023. define('select2/data/tags',[
  10024. ], function () {
  10025. function Tags (decorated, $element, options) {
  10026. var tags = options.get('tags');
  10027. decorated.call(this, $element, options);
  10028. if ($.isArray(tags)) {
  10029. for (var t = 0; t < tags.length; t++) {
  10030. var tag = tags[t];
  10031. var item = this._normalizeItem(tag);
  10032. var $option = this.option(item);
  10033. this.$element.append($option);
  10034. }
  10035. }
  10036. }
  10037. Tags.prototype.query = function (decorated, params, callback) {
  10038. var self = this;
  10039. this._removeOldTags();
  10040. if (params.term == null || params.term === '' || params.page != null) {
  10041. decorated.call(this, params, callback);
  10042. return;
  10043. }
  10044. function wrapper (data, child) {
  10045. for (var i = 0; i < data.length; i++) {
  10046. var option = data[i];
  10047. var checkChildren = (
  10048. option.children != null && !wrapper(option.children, true)
  10049. );
  10050. var checkText = option.text === params.term;
  10051. if (checkText || checkChildren) {
  10052. if (child) {
  10053. return false;
  10054. }
  10055. callback(data);
  10056. return;
  10057. }
  10058. }
  10059. if (child) {
  10060. return true;
  10061. }
  10062. var tag = self.createTag(params);
  10063. if (tag != null) {
  10064. var $option = self.option(tag);
  10065. $option.attr('data-select2-tag', true);
  10066. self.$element.append($option);
  10067. self.insertTag(data, tag);
  10068. }
  10069. callback(data);
  10070. }
  10071. decorated.call(this, params, wrapper);
  10072. };
  10073. Tags.prototype.createTag = function (decorated, params) {
  10074. return {
  10075. id: params.term,
  10076. text: params.term
  10077. };
  10078. };
  10079. Tags.prototype.insertTag = function (_, data, tag) {
  10080. data.unshift(tag);
  10081. };
  10082. Tags.prototype._removeOldTags = function (_) {
  10083. var tag = this._lastTag;
  10084. var $options = this.$element.find('option[data-select2-tag]');
  10085. $options.each(function () {
  10086. if (this.selected) {
  10087. return;
  10088. }
  10089. $(this).remove();
  10090. });
  10091. };
  10092. return Tags;
  10093. });
  10094. define('select2/data/minimumInputLength',[
  10095. ], function () {
  10096. function MinimumInputLength (decorated, $e, options) {
  10097. this.minimumInputLength = options.get('minimumInputLength');
  10098. decorated.call(this, $e, options);
  10099. }
  10100. MinimumInputLength.prototype.query = function (decorated, params, callback) {
  10101. params.term = params.term || '';
  10102. if (params.term.length < this.minimumInputLength) {
  10103. this.trigger('results:message', {
  10104. message: 'inputTooShort',
  10105. args: {
  10106. minimum: this.minimumInputLength,
  10107. input: params.term,
  10108. params: params
  10109. }
  10110. });
  10111. return;
  10112. }
  10113. decorated.call(this, params, callback);
  10114. };
  10115. return MinimumInputLength;
  10116. });
  10117. define('select2/data/maximumInputLength',[
  10118. ], function () {
  10119. function MaximumInputLength (decorated, $e, options) {
  10120. this.maximumInputLength = options.get('maximumInputLength');
  10121. decorated.call(this, $e, options);
  10122. }
  10123. MaximumInputLength.prototype.query = function (decorated, params, callback) {
  10124. params.term = params.term || '';
  10125. if (this.maximumInputLength > 0 &&
  10126. params.term.length > this.maximumInputLength) {
  10127. this.trigger('results:message', {
  10128. message: 'inputTooLong',
  10129. args: {
  10130. minimum: this.maximumInputLength,
  10131. input: params.term,
  10132. params: params
  10133. }
  10134. });
  10135. return;
  10136. }
  10137. decorated.call(this, params, callback);
  10138. };
  10139. return MaximumInputLength;
  10140. });
  10141. define('select2/dropdown',[
  10142. './utils'
  10143. ], function (Utils) {
  10144. function Dropdown ($element, options) {
  10145. this.$element = $element;
  10146. this.options = options;
  10147. Dropdown.__super__.constructor.call(this);
  10148. }
  10149. Utils.Extend(Dropdown, Utils.Observable);
  10150. Dropdown.prototype.render = function () {
  10151. var $dropdown = $(
  10152. '<span class="select2-dropdown">' +
  10153. '<span class="select2-results"></span>' +
  10154. '</span>'
  10155. );
  10156. $dropdown.attr('dir', this.options.get('dir'));
  10157. this.$dropdown = $dropdown;
  10158. return $dropdown;
  10159. };
  10160. Dropdown.prototype.position = function ($dropdown, $container) {
  10161. // Should be implmented in subclasses
  10162. };
  10163. Dropdown.prototype.destroy = function () {
  10164. // Remove the dropdown from the DOM
  10165. this.$dropdown.remove();
  10166. };
  10167. Dropdown.prototype.bind = function (container, $container) {
  10168. // Can be implemented in subclasses
  10169. };
  10170. return Dropdown;
  10171. });
  10172. define('select2/dropdown/search',[
  10173. '../utils'
  10174. ], function (Utils) {
  10175. function Search () { }
  10176. Search.prototype.render = function (decorated) {
  10177. var $rendered = decorated.call(this);
  10178. var $search = $(
  10179. '<span class="select2-search select2-search--dropdown">' +
  10180. '<input class="select2-search__field" type="search" tabindex="-1"' +
  10181. ' role="textbox" />' +
  10182. '</span>'
  10183. );
  10184. this.$searchContainer = $search;
  10185. this.$search = $search.find('input');
  10186. $rendered.prepend($search);
  10187. return $rendered;
  10188. };
  10189. Search.prototype.bind = function (decorated, container, $container) {
  10190. var self = this;
  10191. decorated.call(this, container, $container);
  10192. this.$search.on('keydown', function (evt) {
  10193. self.trigger('keypress', evt);
  10194. self._keyUpPrevented = evt.isDefaultPrevented();
  10195. });
  10196. this.$search.on('keyup', function (evt) {
  10197. self.handleSearch(evt);
  10198. });
  10199. container.on('open', function () {
  10200. self.$search.attr('tabindex', 0);
  10201. self.$search.focus();
  10202. });
  10203. container.on('close', function () {
  10204. self.$search.attr('tabindex', -1);
  10205. self.$search.val('');
  10206. });
  10207. container.on('results:all', function (params) {
  10208. if (params.query.term == null || params.query.term === '') {
  10209. var showSearch = self.showSearch(params);
  10210. if (showSearch) {
  10211. self.$searchContainer.removeClass('select2-search--hide');
  10212. } else {
  10213. self.$searchContainer.addClass('select2-search--hide');
  10214. }
  10215. }
  10216. });
  10217. };
  10218. Search.prototype.handleSearch = function (evt) {
  10219. if (!this._keyUpPrevented) {
  10220. var input = this.$search.val();
  10221. this.trigger('query', {
  10222. term: input
  10223. });
  10224. }
  10225. this._keyUpPrevented = false;
  10226. };
  10227. Search.prototype.showSearch = function (_, params) {
  10228. return true;
  10229. };
  10230. return Search;
  10231. });
  10232. define('select2/dropdown/hidePlaceholder',[
  10233. ], function () {
  10234. function HidePlaceholder (decorated, $element, options, dataAdapter) {
  10235. this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
  10236. decorated.call(this, $element, options, dataAdapter);
  10237. }
  10238. HidePlaceholder.prototype.append = function (decorated, data) {
  10239. data = this.removePlaceholder(data);
  10240. decorated.call(this, data);
  10241. };
  10242. HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
  10243. if (typeof placeholder === 'string') {
  10244. placeholder = {
  10245. id: '',
  10246. text: placeholder
  10247. };
  10248. }
  10249. return placeholder;
  10250. };
  10251. HidePlaceholder.prototype.removePlaceholder = function (_, data) {
  10252. var modifiedData = data.slice(0);
  10253. for (var d = data.length - 1; d >= 0; d--) {
  10254. var item = data[d];
  10255. if (this.placeholder.id === item.id) {
  10256. modifiedData.splice(d, 1);
  10257. }
  10258. }
  10259. return modifiedData;
  10260. };
  10261. return HidePlaceholder;
  10262. });
  10263. define('select2/dropdown/infiniteScroll',[
  10264. 'jquery'
  10265. ], function ($) {
  10266. function InfiniteScroll (decorated, $element, options, dataAdapter) {
  10267. this.lastParams = {};
  10268. decorated.call(this, $element, options, dataAdapter);
  10269. this.$loadingMore = this.createLoadingMore();
  10270. this.loading = false;
  10271. }
  10272. InfiniteScroll.prototype.append = function (decorated, data) {
  10273. this.$loadingMore.remove();
  10274. decorated.call(this, data);
  10275. if (data.length > 0) {
  10276. this.$results.append(this.$loadingMore);
  10277. }
  10278. this.loading = false;
  10279. };
  10280. InfiniteScroll.prototype.bind = function (decorated, container, $container) {
  10281. var self = this;
  10282. decorated.call(this, container, $container);
  10283. container.on('query', function (params) {
  10284. self.lastParams = params;
  10285. self.loading = true;
  10286. });
  10287. container.on('query:append', function (params) {
  10288. self.lastParams = params;
  10289. self.loading = true;
  10290. });
  10291. this.$results.on('scroll', function () {
  10292. var loadMoreVisible = $.contains(
  10293. document.documentElement,
  10294. self.$loadingMore[0]
  10295. );
  10296. if (self.loading || !loadMoreVisible) {
  10297. return;
  10298. }
  10299. var currentOffset = self.$results.offset().top +
  10300. self.$results.outerHeight(false);
  10301. var loadingMoreOffset = self.$loadingMore.offset().top +
  10302. self.$loadingMore.outerHeight(false);
  10303. if (currentOffset + 50 >= loadingMoreOffset) {
  10304. self.loadMore();
  10305. }
  10306. });
  10307. };
  10308. InfiniteScroll.prototype.loadMore = function () {
  10309. this.loading = true;
  10310. var params = $.extend({}, {page: 1}, this.lastParams);
  10311. params.page++;
  10312. this.trigger('query:append', params);
  10313. };
  10314. InfiniteScroll.prototype.createLoadingMore = function () {
  10315. var $option = $(
  10316. '<li class="option load-more" role="treeitem"></li>'
  10317. );
  10318. var message = this.options.get('translations').get('loadingMore');
  10319. $option.html(message(this.lastParams));
  10320. return $option;
  10321. };
  10322. return InfiniteScroll;
  10323. });
  10324. define('select2/dropdown/attachBody',[
  10325. ], function () {
  10326. function AttachBody (decorated, $element, options) {
  10327. this.$dropdownParent = options.get('dropdownParent') || document.body;
  10328. decorated.call(this, $element, options);
  10329. }
  10330. AttachBody.prototype.bind = function (decorated, container, $container) {
  10331. var self = this;
  10332. var setupResultsEvents = false;
  10333. decorated.call(this, container, $container);
  10334. container.on('open', function () {
  10335. self._showDropdown();
  10336. if (!setupResultsEvents) {
  10337. setupResultsEvents = true;
  10338. container.on('results:all', function () {
  10339. self._positionDropdown();
  10340. });
  10341. container.on('results:append', function () {
  10342. self._positionDropdown();
  10343. });
  10344. }
  10345. });
  10346. container.on('close', function () {
  10347. self._hideDropdown();
  10348. });
  10349. this.$dropdownContainer.on('mousedown', function (evt) {
  10350. evt.stopPropagation();
  10351. });
  10352. };
  10353. AttachBody.prototype.position = function (decorated, $dropdown, $container) {
  10354. // Clone all of the container classes
  10355. $dropdown.attr('class', $container.attr('class'));
  10356. $dropdown.removeClass('select2');
  10357. $dropdown.addClass('select2-container--open');
  10358. $dropdown.css({
  10359. position: 'absolute'
  10360. });
  10361. $dropdown.width($container.outerWidth(false));
  10362. this.$container = $container;
  10363. };
  10364. AttachBody.prototype.render = function (decorated) {
  10365. var $container = $('<span></span>');
  10366. var $dropdown = decorated.call(this);
  10367. $container.append($dropdown);
  10368. this.$dropdownContainer = $container;
  10369. return $container;
  10370. };
  10371. AttachBody.prototype._hideDropdown = function (decorated) {
  10372. this.$dropdownContainer.detach();
  10373. };
  10374. AttachBody.prototype._positionDropdown = function () {
  10375. var $window = $(window);
  10376. var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
  10377. var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
  10378. var newDirection = null;
  10379. var position = this.$container.position();
  10380. var offset = this.$container.offset();
  10381. offset.bottom = offset.top + this.$container.outerHeight(false);
  10382. var container = {
  10383. height: this.$container.outerHeight(false)
  10384. };
  10385. container.top = offset.top;
  10386. container.bottom = offset.top + container.height;
  10387. var dropdown = {
  10388. height: this.$dropdown.outerHeight(false)
  10389. };
  10390. var viewport = {
  10391. top: $window.scrollTop(),
  10392. bottom: $window.scrollTop() + $window.height()
  10393. };
  10394. var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
  10395. var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
  10396. var css = {
  10397. left: offset.left,
  10398. top: container.bottom
  10399. };
  10400. if (!isCurrentlyAbove && !isCurrentlyBelow) {
  10401. newDirection = 'below';
  10402. }
  10403. if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
  10404. newDirection = 'above';
  10405. } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
  10406. newDirection = 'below';
  10407. }
  10408. if (newDirection == 'above' || isCurrentlyAbove) {
  10409. css.top = container.top - dropdown.height;
  10410. }
  10411. if (newDirection != null) {
  10412. this.$dropdown
  10413. .removeClass('select2-dropdown--below select2-dropdown--above')
  10414. .addClass('select2-dropdown--' + newDirection);
  10415. this.$container
  10416. .removeClass('select2-container--below select2-container--above')
  10417. .addClass('select2-container--' + newDirection);
  10418. }
  10419. this.$dropdownContainer.css(css);
  10420. };
  10421. AttachBody.prototype._showDropdown = function (decorated) {
  10422. this.$dropdownContainer.appendTo(this.$dropdownParent);
  10423. this._positionDropdown();
  10424. };
  10425. return AttachBody;
  10426. });
  10427. define('select2/dropdown/minimumResultsForSearch',[
  10428. ], function () {
  10429. function countResults (data) {
  10430. count = 0;
  10431. for (var d = 0; d < data.length; d++) {
  10432. var item = data[d];
  10433. if (item.children) {
  10434. count += countResults(item.children);
  10435. } else {
  10436. count++;
  10437. }
  10438. }
  10439. return count;
  10440. }
  10441. function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
  10442. this.minimumResultsForSearch = options.get('minimumResultsForSearch');
  10443. decorated.call(this, $element, options, dataAdapter);
  10444. }
  10445. MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
  10446. if (countResults(params.data) < this.minimumResultsForSearch) {
  10447. return false;
  10448. }
  10449. return decorated.call(this, params);
  10450. };
  10451. return MinimumResultsForSearch;
  10452. });
  10453. define('select2/i18n/en',[],function () {
  10454. return {
  10455. errorLoading: function () {
  10456. return 'The results could not be loaded.';
  10457. },
  10458. inputTooLong: function (args) {
  10459. var overChars = args.input.length - args.maximum;
  10460. var message = 'Please delete ' + overChars + ' character';
  10461. if (overChars != 1) {
  10462. message += 's';
  10463. }
  10464. return message;
  10465. },
  10466. inputTooShort: function (args) {
  10467. var remainingChars = args.minimum - args.input.length;
  10468. var message = 'Please enter ' + remainingChars + ' or more characters';
  10469. return message;
  10470. },
  10471. loadingMore: function () {
  10472. return 'Loading more results…';
  10473. },
  10474. maximumSelected: function (args) {
  10475. var message = 'You can only select ' + args.maximum + ' item';
  10476. if (args.maximum != 1) {
  10477. message += 's';
  10478. }
  10479. return message;
  10480. },
  10481. noResults: function () {
  10482. return 'No results found';
  10483. },
  10484. searching: function () {
  10485. return 'Searching…';
  10486. }
  10487. };
  10488. });
  10489. define('select2/defaults',[
  10490. 'jquery',
  10491. './results',
  10492. './selection/single',
  10493. './selection/multiple',
  10494. './selection/placeholder',
  10495. './selection/allowClear',
  10496. './selection/search',
  10497. './utils',
  10498. './translation',
  10499. './diacritics',
  10500. './data/select',
  10501. './data/array',
  10502. './data/ajax',
  10503. './data/tags',
  10504. './data/minimumInputLength',
  10505. './data/maximumInputLength',
  10506. './dropdown',
  10507. './dropdown/search',
  10508. './dropdown/hidePlaceholder',
  10509. './dropdown/infiniteScroll',
  10510. './dropdown/attachBody',
  10511. './dropdown/minimumResultsForSearch',
  10512. './i18n/en'
  10513. ], function ($, ResultsList,
  10514. SingleSelection, MultipleSelection, Placeholder, AllowClear,
  10515. SelectionSearch,
  10516. Utils, Translation, DIACRITICS,
  10517. SelectData, ArrayData, AjaxData, Tags,
  10518. MinimumInputLength, MaximumInputLength,
  10519. Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
  10520. AttachBody, MinimumResultsForSearch,
  10521. EnglishTranslation) {
  10522. function Defaults () {
  10523. this.reset();
  10524. }
  10525. Defaults.prototype.apply = function (options) {
  10526. options = $.extend({}, this.defaults, options);
  10527. if (options.dataAdapter == null) {
  10528. if (options.ajax != null) {
  10529. options.dataAdapter = AjaxData;
  10530. } else if (options.data != null) {
  10531. options.dataAdapter = ArrayData;
  10532. } else {
  10533. options.dataAdapter = SelectData;
  10534. }
  10535. if (options.minimumInputLength > 0) {
  10536. options.dataAdapter = Utils.Decorate(
  10537. options.dataAdapter,
  10538. MinimumInputLength
  10539. );
  10540. }
  10541. if (options.maximumInputLength > 0) {
  10542. options.dataAdapter = Utils.Decorate(
  10543. options.dataAdapter,
  10544. MaximumInputLength
  10545. );
  10546. }
  10547. if (options.tags != null) {
  10548. options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
  10549. }
  10550. }
  10551. if (options.resultsAdapter == null) {
  10552. options.resultsAdapter = ResultsList;
  10553. if (options.ajax != null) {
  10554. options.resultsAdapter = Utils.Decorate(
  10555. options.resultsAdapter,
  10556. InfiniteScroll
  10557. );
  10558. }
  10559. if (options.placeholder != null) {
  10560. options.resultsAdapter = Utils.Decorate(
  10561. options.resultsAdapter,
  10562. HidePlaceholder
  10563. );
  10564. }
  10565. }
  10566. if (options.dropdownAdapter == null) {
  10567. if (options.multiple) {
  10568. options.dropdownAdapter = Dropdown;
  10569. } else {
  10570. var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
  10571. options.dropdownAdapter = SearchableDropdown;
  10572. }
  10573. if (options.minimumResultsForSearch > 0) {
  10574. options.dropdownAdapter = Utils.Decorate(
  10575. options.dropdownAdapter,
  10576. MinimumResultsForSearch
  10577. );
  10578. }
  10579. options.dropdownAdapter = Utils.Decorate(
  10580. options.dropdownAdapter,
  10581. AttachBody
  10582. );
  10583. }
  10584. if (options.selectionAdapter == null) {
  10585. if (options.multiple) {
  10586. options.selectionAdapter = MultipleSelection;
  10587. } else {
  10588. options.selectionAdapter = SingleSelection;
  10589. }
  10590. // Add the placeholder mixin if a placeholder was specified
  10591. if (options.placeholder != null) {
  10592. options.selectionAdapter = Utils.Decorate(
  10593. options.selectionAdapter,
  10594. Placeholder
  10595. );
  10596. if (options.allowClear) {
  10597. options.selectionAdapter = Utils.Decorate(
  10598. options.selectionAdapter,
  10599. AllowClear
  10600. );
  10601. }
  10602. }
  10603. if (options.multiple) {
  10604. options.selectionAdapter = Utils.Decorate(
  10605. options.selectionAdapter,
  10606. SelectionSearch
  10607. );
  10608. }
  10609. }
  10610. if (typeof options.language === 'string') {
  10611. options.language = [options.language];
  10612. }
  10613. if ($.isArray(options.language)) {
  10614. var languages = new Translation();
  10615. options.language.push('en');
  10616. var languageNames = options.language;
  10617. for (var l = 0; l < languageNames.length; l++) {
  10618. var name = languageNames[l];
  10619. var language = {};
  10620. try {
  10621. // Try to load it with the original name
  10622. language = Translation.loadPath(name);
  10623. } catch (e) {
  10624. // If we couldn't load it, check if it wasn't the full path
  10625. name = 'select2/i18n/' + name;
  10626. language = Translation.loadPath(name);
  10627. }
  10628. languages.extend(language);
  10629. }
  10630. options.translations = languages;
  10631. } else {
  10632. options.translations = new Translation(options.language);
  10633. }
  10634. return options;
  10635. };
  10636. Defaults.prototype.reset = function () {
  10637. function stripDiacritics (text) {
  10638. // Used 'uni range + named function' from http://jsperf.com/diacritics/18
  10639. function match(a) {
  10640. return DIACRITICS[a] || a;
  10641. }
  10642. return text.replace(/[^\u0000-\u007E]/g, match);
  10643. }
  10644. function matcher (params, data) {
  10645. // Always return the object if there is nothing to compare
  10646. if ($.trim(params.term) === '') {
  10647. return data;
  10648. }
  10649. // Do a recursive check for options with children
  10650. if (data.children && data.children.length > 0) {
  10651. // Clone the data object if there are children
  10652. // This is required as we modify the object to remove any non-matches
  10653. var match = $.extend(true, {}, data);
  10654. // Check each child of the option
  10655. for (var c = data.children.length - 1; c >= 0; c--) {
  10656. var child = data.children[c];
  10657. var matches = matcher(params, child);
  10658. // If there wasn't a match, remove the object in the array
  10659. if (matches == null) {
  10660. match.children.splice(c, 1);
  10661. }
  10662. }
  10663. // If any children matched, return the new object
  10664. if (match.children.length > 0) {
  10665. return match;
  10666. }
  10667. // If there were no matching children, check just the plain object
  10668. return matcher(params, match);
  10669. }
  10670. var original = stripDiacritics(data.text).toUpperCase();
  10671. var term = stripDiacritics(params.term).toUpperCase();
  10672. // Check if the text contains the term
  10673. if (original.indexOf(term) > -1) {
  10674. return data;
  10675. }
  10676. // If it doesn't contain the term, don't return anything
  10677. return null;
  10678. }
  10679. this.defaults = {
  10680. language: EnglishTranslation,
  10681. matcher: matcher,
  10682. sorter: function (data) {
  10683. return data;
  10684. },
  10685. minimumInputLength: 0,
  10686. maximumInputLength: 0,
  10687. minimumResultsForSearch: 0,
  10688. templateResult: function (result) {
  10689. return result.text;
  10690. },
  10691. templateSelection: function (selection) {
  10692. return selection.text;
  10693. },
  10694. theme: 'default'
  10695. };
  10696. };
  10697. var defaults = new Defaults();
  10698. return defaults;
  10699. });
  10700. define('select2/options',[
  10701. 'jquery',
  10702. './defaults'
  10703. ], function ($, Defaults) {
  10704. function Options (options, $element) {
  10705. this.options = options;
  10706. if ($element != null) {
  10707. this.fromElement($element);
  10708. }
  10709. this.options = Defaults.apply(this.options);
  10710. }
  10711. Options.prototype.fromElement = function ($e) {
  10712. var excludedData = ['select2'];
  10713. if (this.options.multiple == null) {
  10714. this.options.multiple = $e.prop('multiple');
  10715. }
  10716. if (this.options.disabled == null) {
  10717. this.options.disabled = $e.prop('disabled');
  10718. }
  10719. if (this.options.language == null) {
  10720. if ($e.prop('lang')) {
  10721. this.options.language = $e.prop('lang').toLowerCase();
  10722. } else if ($e.closest('[lang]').prop('lang')) {
  10723. this.options.language = $e.closest('[lang]').prop('lang');
  10724. }
  10725. }
  10726. if (this.options.dir == null) {
  10727. if ($e.prop('dir')) {
  10728. this.options.dir = $e.prop('dir');
  10729. } else if ($e.closest('[dir]').prop('dir')) {
  10730. this.options.dir = $e.closest('[dir]').prop('dir');
  10731. } else {
  10732. this.options.dir = 'ltr';
  10733. }
  10734. }
  10735. $e.prop('disabled', this.options.disabled);
  10736. $e.prop('multiple', this.options.multiple);
  10737. if ($e.data('select2-tags')) {
  10738. if (console && console.warn) {
  10739. console.warn(
  10740. 'Select2: The `data-select2-tags` attribute has been changed to ' +
  10741. 'use the `data-data` and `data-tags="true"` attributes and will be ' +
  10742. 'removed in future versions of Select2.'
  10743. );
  10744. }
  10745. $e.data('data', $e.data('select2-tags'));
  10746. $e.data('tags', true);
  10747. }
  10748. if ($e.data('ajax-url')) {
  10749. if (console && console.warn) {
  10750. console.warn(
  10751. 'Select2: The `data-ajax-attribute` has been changed to ' +
  10752. '`data-ajax--url` and support for the old attribute will be removed' +
  10753. ' in future versions of Select2.'
  10754. );
  10755. }
  10756. $e.data('ajax--url', $e.data('ajax-url'));
  10757. }
  10758. var data = $e.data();
  10759. function convertData (data) {
  10760. for (var originalKey in data) {
  10761. var keys = originalKey.split('-');
  10762. var dataLevel = data;
  10763. if (keys.length === 1) {
  10764. continue;
  10765. }
  10766. for (var k = 0; k < keys.length; k++) {
  10767. var key = keys[k];
  10768. // Lowercase the first letter
  10769. // By default, dash-separated becomes camelCase
  10770. key = key.substring(0, 1).toLowerCase() + key.substring(1);
  10771. if (!(key in dataLevel)) {
  10772. dataLevel[key] = {};
  10773. }
  10774. if (k == keys.length - 1) {
  10775. dataLevel[key] = data[originalKey];
  10776. }
  10777. dataLevel = dataLevel[key];
  10778. }
  10779. delete data[originalKey];
  10780. }
  10781. return data;
  10782. }
  10783. data = convertData(data);
  10784. for (var key in data) {
  10785. if (excludedData.indexOf(key) > -1) {
  10786. continue;
  10787. }
  10788. if ($.isPlainObject(this.options[key])) {
  10789. $.extend(this.options[key], data[key]);
  10790. } else {
  10791. this.options[key] = data[key];
  10792. }
  10793. }
  10794. return this;
  10795. };
  10796. Options.prototype.get = function (key) {
  10797. return this.options[key];
  10798. };
  10799. Options.prototype.set = function (key, val) {
  10800. this.options[key] = val;
  10801. };
  10802. return Options;
  10803. });
  10804. define('select2/core',[
  10805. 'jquery',
  10806. './options',
  10807. './utils',
  10808. './keys'
  10809. ], function ($, Options, Utils, KEYS) {
  10810. var Select2 = function ($element, options) {
  10811. if ($element.data('select2') != null) {
  10812. $element.data('select2').destroy();
  10813. }
  10814. this.$element = $element;
  10815. this.id = this._generateId($element);
  10816. options = options || {};
  10817. this.options = new Options(options, $element);
  10818. Select2.__super__.constructor.call(this);
  10819. // Set up containers and adapters
  10820. var DataAdapter = this.options.get('dataAdapter');
  10821. this.data = new DataAdapter($element, this.options);
  10822. var $container = this.render();
  10823. this._placeContainer($container);
  10824. var SelectionAdapter = this.options.get('selectionAdapter');
  10825. this.selection = new SelectionAdapter($element, this.options);
  10826. this.$selection = this.selection.render();
  10827. this.selection.position(this.$selection, $container);
  10828. var DropdownAdapter = this.options.get('dropdownAdapter');
  10829. this.dropdown = new DropdownAdapter($element, this.options);
  10830. this.$dropdown = this.dropdown.render();
  10831. this.dropdown.position(this.$dropdown, $container);
  10832. var ResultsAdapter = this.options.get('resultsAdapter');
  10833. this.results = new ResultsAdapter($element, this.options, this.data);
  10834. this.$results = this.results.render();
  10835. this.results.position(this.$results, this.$dropdown);
  10836. // Bind events
  10837. var self = this;
  10838. // Bind the container to all of the adapters
  10839. this._bindAdapters();
  10840. // Register any DOM event handlers
  10841. this._registerDomEvents();
  10842. // Register any internal event handlers
  10843. this._registerDataEvents();
  10844. this._registerSelectionEvents();
  10845. this._registerDropdownEvents();
  10846. this._registerResultsEvents();
  10847. this._registerEvents();
  10848. // Set the initial state
  10849. this.data.current(function (initialData) {
  10850. self.trigger('selection:update', {
  10851. data: initialData
  10852. });
  10853. });
  10854. // Hide the original select
  10855. $element.hide();
  10856. // Synchronize any monitored attributes
  10857. this._syncAttributes();
  10858. this._tabindex = $element.attr('tabindex') || 0;
  10859. $element.attr('tabindex', '-1');
  10860. $element.data('select2', this);
  10861. };
  10862. Utils.Extend(Select2, Utils.Observable);
  10863. Select2.prototype._generateId = function ($element) {
  10864. var id = '';
  10865. if ($element.attr('id') != null) {
  10866. id = $element.attr('id');
  10867. } else if ($element.attr('name') != null) {
  10868. id = $element.attr('name') + '-' + Utils.generateChars(2);
  10869. } else {
  10870. id = Utils.generateChars(4);
  10871. }
  10872. id = 'select2-' + id;
  10873. return id;
  10874. };
  10875. Select2.prototype._placeContainer = function ($container) {
  10876. $container.insertAfter(this.$element);
  10877. $container.width(this.$element.outerWidth(false));
  10878. };
  10879. Select2.prototype._bindAdapters = function () {
  10880. this.data.bind(this, this.$container);
  10881. this.selection.bind(this, this.$container);
  10882. this.dropdown.bind(this, this.$container);
  10883. this.results.bind(this, this.$container);
  10884. };
  10885. Select2.prototype._registerDomEvents = function () {
  10886. var self = this;
  10887. this.$element.on('change.select2', function () {
  10888. self.data.current(function (data) {
  10889. self.trigger('selection:update', {
  10890. data: data
  10891. });
  10892. });
  10893. });
  10894. this._sync = Utils.bind(this._syncAttributes, this);
  10895. if (this.$element[0].attachEvent) {
  10896. this.$element[0].attachEvent('onpropertychange', this._sync);
  10897. }
  10898. var observer = window.MutationObserver ||
  10899. window.WebKitMutationObserver ||
  10900. window.MozMutationObserver
  10901. ;
  10902. if (observer != null) {
  10903. this._observer = new observer(function (mutations) {
  10904. $.each(mutations, self._sync);
  10905. });
  10906. this._observer.observe(this.$element[0], {
  10907. attributes: true,
  10908. subtree: false
  10909. });
  10910. }
  10911. };
  10912. Select2.prototype._registerDataEvents = function () {
  10913. var self = this;
  10914. this.data.on('results:message', function (params) {
  10915. self.trigger('results:message', params);
  10916. });
  10917. };
  10918. Select2.prototype._registerSelectionEvents = function () {
  10919. var self = this;
  10920. this.selection.on('open', function () {
  10921. self.open();
  10922. });
  10923. this.selection.on('close', function () {
  10924. self.close();
  10925. });
  10926. this.selection.on('toggle', function () {
  10927. self.toggleDropdown();
  10928. });
  10929. this.selection.on('results:select', function () {
  10930. self.trigger('results:select');
  10931. });
  10932. this.selection.on('results:previous', function () {
  10933. self.trigger('results:previous');
  10934. });
  10935. this.selection.on('results:next', function () {
  10936. self.trigger('results:next');
  10937. });
  10938. this.selection.on('unselected', function (params) {
  10939. self.trigger('unselect', params);
  10940. self.close();
  10941. });
  10942. this.selection.on('query', function (params) {
  10943. self.trigger('query', params);
  10944. });
  10945. this.selection.on('keypress', function (e) {
  10946. self.trigger('keypress', e);
  10947. });
  10948. };
  10949. Select2.prototype._registerDropdownEvents = function () {
  10950. var self = this;
  10951. this.dropdown.on('query', function (params) {
  10952. self.trigger('query', params);
  10953. });
  10954. this.dropdown.on('keypress', function (e) {
  10955. self.trigger('keypress', e);
  10956. });
  10957. };
  10958. Select2.prototype._registerResultsEvents = function () {
  10959. var self = this;
  10960. this.results.on('query:append', function (params) {
  10961. self.trigger('query:append', params);
  10962. });
  10963. this.results.on('selected', function (params) {
  10964. self.trigger('select', params);
  10965. self.close();
  10966. });
  10967. this.results.on('unselected', function (params) {
  10968. self.trigger('unselect', params);
  10969. self.close();
  10970. });
  10971. this.results.on('results:focus', function (params) {
  10972. self.trigger('results:focus', params);
  10973. });
  10974. };
  10975. Select2.prototype._registerEvents = function () {
  10976. var self = this;
  10977. this.on('open', function () {
  10978. self.$container.addClass('select2-container--open');
  10979. });
  10980. this.on('close', function () {
  10981. self.$container.removeClass('select2-container--open');
  10982. });
  10983. this.on('enable', function () {
  10984. self.$container.removeClass('select2-container--disabled');
  10985. });
  10986. this.on('disable', function () {
  10987. self.$container.addClass('select2-container--disabled');
  10988. });
  10989. this.on('query', function (params) {
  10990. this.data.query(params, function (data) {
  10991. self.trigger('results:all', {
  10992. data: data,
  10993. query: params
  10994. });
  10995. });
  10996. });
  10997. this.on('query:append', function (params) {
  10998. this.data.query(params, function (data) {
  10999. self.trigger('results:append', {
  11000. data: data,
  11001. query: params
  11002. });
  11003. });
  11004. });
  11005. this.on('keypress', function (evt) {
  11006. var key = evt.which;
  11007. if (self.isOpen()) {
  11008. if (key === KEYS.ENTER) {
  11009. self.trigger('results:select');
  11010. evt.preventDefault();
  11011. } else if (key === KEYS.UP) {
  11012. self.trigger('results:previous');
  11013. evt.preventDefault();
  11014. } else if (key === KEYS.DOWN) {
  11015. self.trigger('results:next');
  11016. evt.preventDefault();
  11017. } else if (key === KEYS.ESC || key === KEYS.TAB) {
  11018. self.close();
  11019. evt.preventDefault();
  11020. }
  11021. } else {
  11022. if (key === KEYS.ENTER || key === KEYS.SPACE ||
  11023. ((key === KEYS.DOWN || key === KEYS.UP) && evt.altKey)) {
  11024. self.open();
  11025. evt.preventDefault();
  11026. }
  11027. }
  11028. });
  11029. };
  11030. Select2.prototype._syncAttributes = function () {
  11031. this.options.set('disabled', this.$element.prop('disabled'));
  11032. if (this.options.get('disabled')) {
  11033. if (this.isOpen()) {
  11034. this.trigger('close');
  11035. }
  11036. this.trigger('disable');
  11037. } else {
  11038. this.trigger('enable');
  11039. }
  11040. };
  11041. Select2.prototype.toggleDropdown = function () {
  11042. if (this.options.get('disabled')) {
  11043. return;
  11044. }
  11045. if (this.isOpen()) {
  11046. this.close();
  11047. } else {
  11048. this.open();
  11049. }
  11050. };
  11051. Select2.prototype.open = function () {
  11052. if (this.isOpen()) {
  11053. return;
  11054. }
  11055. this.trigger('query', {});
  11056. this.trigger('open');
  11057. };
  11058. Select2.prototype.close = function () {
  11059. if (!this.isOpen()) {
  11060. return;
  11061. }
  11062. this.trigger('close');
  11063. };
  11064. Select2.prototype.isOpen = function () {
  11065. return this.$container.hasClass('select2-container--open');
  11066. };
  11067. Select2.prototype.enable = function (args) {
  11068. if (console && console.warn) {
  11069. console.warn(
  11070. 'Select2: The `select2("val")` method has been deprecated and will be' +
  11071. ' removed in later Select2 versions. Use $element.prop("disabled") ' +
  11072. 'instead.'
  11073. );
  11074. }
  11075. if (args.length === 0) {
  11076. args = [true];
  11077. }
  11078. var disabled = !args[0];
  11079. this.$element.prop('disabled', disabled);
  11080. };
  11081. Select2.prototype.val = function (args) {
  11082. if (console && console.warn) {
  11083. console.warn(
  11084. 'Select2: The `select2("val")` method has been deprecated and will be' +
  11085. ' removed in later Select2 versions. Use $element.val() instead.'
  11086. );
  11087. }
  11088. if (args.length === 0) {
  11089. return this.$element.val();
  11090. }
  11091. var newVal = args[0];
  11092. if ($.isArray(newVal)) {
  11093. newVal = $.map(newVal, function (obj) {
  11094. return obj.toString();
  11095. });
  11096. }
  11097. this.$element.val(newVal).trigger('change');
  11098. };
  11099. Select2.prototype.destroy = function () {
  11100. this.$container.remove();
  11101. if (this.$element[0].detachEvent) {
  11102. this.$element[0].detachEvent('onpropertychange', this._sync);
  11103. }
  11104. if (this._observer != null) {
  11105. this._observer.disconnect();
  11106. this._observer = null;
  11107. }
  11108. this._sync = null;
  11109. this.$element.off('.select2');
  11110. this.$element.attr('tabindex', this._tabindex);
  11111. this.$element.show();
  11112. this.$element.removeData('select2');
  11113. this.data.destroy();
  11114. this.selection.destroy();
  11115. this.dropdown.destroy();
  11116. this.results.destroy();
  11117. this.data = null;
  11118. this.selection = null;
  11119. this.dropdown = null;
  11120. this.results = null;
  11121. };
  11122. Select2.prototype.render = function () {
  11123. var $container = $(
  11124. '<span class="select2 select2-container">' +
  11125. '<span class="selection"></span>' +
  11126. '<span class="dropdown-wrapper" aria-hidden="true"></span>' +
  11127. '</span>'
  11128. );
  11129. $container.attr('dir', this.options.get('dir'));
  11130. this.$container = $container;
  11131. this.$container.addClass('select2-container--' + this.options.get('theme'));
  11132. $container.data('element', this.$element);
  11133. return $container;
  11134. };
  11135. return Select2;
  11136. });
  11137. define('select2/compat/matcher',[
  11138. ], function () {
  11139. function oldMatcher (matcher) {
  11140. function wrappedMatcher (params, data) {
  11141. var match = $.extend(true, {}, data);
  11142. if (params.term == null || $.trim(params.term) === '') {
  11143. return match;
  11144. }
  11145. if (data.children) {
  11146. for (var c = data.children.length - 1; c >= 0; c--) {
  11147. var child = data.children[c];
  11148. // Check if the child object matches
  11149. // The old matcher returned a boolean true or false
  11150. var doesMatch = matcher(params.term, child.text, child);
  11151. // If the child didn't match, pop it off
  11152. if (!doesMatch) {
  11153. match.children.splice(c, 1);
  11154. }
  11155. }
  11156. if (match.children.length > 0) {
  11157. return match;
  11158. }
  11159. }
  11160. if (matcher(params.term, data.text, data)) {
  11161. return match;
  11162. }
  11163. return null;
  11164. }
  11165. return wrappedMatcher;
  11166. }
  11167. return oldMatcher;
  11168. });
  11169. define('select2/dropdown/attachContainer',[
  11170. ], function () {
  11171. function AttachContainer (decorated, $element, options) {
  11172. decorated.call(this, $element, options);
  11173. }
  11174. AttachContainer.prototype.position =
  11175. function (decorated, $dropdown, $container) {
  11176. var $dropdownContainer = $container.find('.dropdown-wrapper');
  11177. $dropdownContainer.append($dropdown);
  11178. $dropdown.addClass('select2-dropdown--below');
  11179. $container.addClass('select2-container--below');
  11180. };
  11181. return AttachContainer;
  11182. });
  11183. define('jquery.select2',[
  11184. 'jquery',
  11185. 'select2/core'
  11186. ], function ($, Select2) {
  11187. if ($.fn.select2 == null) {
  11188. $.fn.select2 = function (options) {
  11189. options = options || {};
  11190. if (typeof options === 'object') {
  11191. this.each(function () {
  11192. var instance = new Select2($(this), options);
  11193. });
  11194. } else if (typeof options === 'string') {
  11195. var instance = this.data('select2');
  11196. var args = Array.prototype.slice.call(arguments, 1);
  11197. instance[options](args);
  11198. } else {
  11199. throw new Error('Invalid arguments for Select2: ' + options);
  11200. }
  11201. };
  11202. }
  11203. return Select2;
  11204. });
  11205. require('jquery.select2'); $.fn.select2.amd = { define: define, require: require };}());