require-backend.min.js 936 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382
  1. /*! jQuery v2.2.4 | (c) jQuery Foundation | jquery.org/license */
  2. !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="2.2.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isPlainObject:function(a){var b;if("object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype||{},"isPrototypeOf"))return!1;for(b in a);return void 0===b||k.call(a,b)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=d.createElement("script"),b.text=a,d.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:h.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(d=e.call(arguments,2),f=function(){return a.apply(b||this,d.concat(e.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=la(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=ma(b);function pa(){}pa.prototype=d.filters=d.pseudos,d.setFilters=new pa,g=fa.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=R.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=S.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(Q," ")}),h=h.slice(c.length));for(g in d.filter)!(e=W[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fa.error(a):z(a,i).slice(0)};function qa(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return h.call(b,a)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&f.parentNode&&(this.length=1,this[0]=f),this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?void 0!==c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?h.call(n(a),this[0]):h.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||n.uniqueSort(e),D.test(a)&&e.reverse()),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){n.each(b,function(b,c){n.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==n.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return n.each(arguments,function(a,b){var c;while((c=n.inArray(b,f,c))>-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.removeEventListener("DOMContentLoaded",J),a.removeEventListener("load",J),n.ready()}n.ready.promise=function(b){return I||(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(n.ready):(d.addEventListener("DOMContentLoaded",J),a.addEventListener("load",J))),I.promise(b)},n.ready.promise();var K=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)K(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},L=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function M(){this.expando=n.expando+M.uid++}M.uid=1,M.prototype={register:function(a,b){var c=b||{};return a.nodeType?a[this.expando]=c:Object.defineProperty(a,this.expando,{value:c,writable:!0,configurable:!0}),a[this.expando]},cache:function(a){if(!L(a))return{};var b=a[this.expando];return b||(b={},L(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[b]=c;else for(d in b)e[d]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=a[this.expando];if(void 0!==f){if(void 0===b)this.register(a);else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in f?d=[b,e]:(d=e,d=d in f?[d]:d.match(G)||[])),c=d.length;while(c--)delete f[d[c]]}(void 0===b||n.isEmptyObject(f))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!n.isEmptyObject(b)}};var N=new M,O=new M,P=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Q=/[A-Z]/g;function R(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Q,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:P.test(c)?n.parseJSON(c):c;
  3. }catch(e){}O.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return O.hasData(a)||N.hasData(a)},data:function(a,b,c){return O.access(a,b,c)},removeData:function(a,b){O.remove(a,b)},_data:function(a,b,c){return N.access(a,b,c)},_removeData:function(a,b){N.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=O.get(f),1===f.nodeType&&!N.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),R(f,d,e[d])));N.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){O.set(this,a)}):K(this,function(b){var c,d;if(f&&void 0===b){if(c=O.get(f,a)||O.get(f,a.replace(Q,"-$&").toLowerCase()),void 0!==c)return c;if(d=n.camelCase(a),c=O.get(f,d),void 0!==c)return c;if(c=R(f,d,void 0),void 0!==c)return c}else d=n.camelCase(a),this.each(function(){var c=O.get(this,d);O.set(this,d,b),a.indexOf("-")>-1&&void 0!==c&&O.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){O.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=N.get(a,b),c&&(!d||n.isArray(c)?d=N.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return N.get(a,c)||N.access(a,c,{empty:n.Callbacks("once memory").add(function(){N.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=N.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)};function W(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return n.css(a,b,"")},i=h(),j=c&&c[3]||(n.cssNumber[b]?"":"px"),k=(n.cssNumber[b]||"px"!==j&&+i)&&T.exec(n.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,n.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var X=/^(?:checkbox|radio)$/i,Y=/<([\w:-]+)/,Z=/^$|\/(?:java|ecma)script/i,$={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};$.optgroup=$.option,$.tbody=$.tfoot=$.colgroup=$.caption=$.thead,$.th=$.td;function _(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function aa(a,b){for(var c=0,d=a.length;d>c;c++)N.set(a[c],"globalEval",!b||N.get(b[c],"globalEval"))}var ba=/<|&#?\w+;/;function ca(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],o=0,p=a.length;p>o;o++)if(f=a[o],f||0===f)if("object"===n.type(f))n.merge(m,f.nodeType?[f]:f);else if(ba.test(f)){g=g||l.appendChild(b.createElement("div")),h=(Y.exec(f)||["",""])[1].toLowerCase(),i=$[h]||$._default,g.innerHTML=i[1]+n.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;n.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",o=0;while(f=m[o++])if(d&&n.inArray(f,d)>-1)e&&e.push(f);else if(j=n.contains(f.ownerDocument,f),g=_(l.appendChild(f),"script"),j&&aa(g),c){k=0;while(f=g[k++])Z.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var da=/^key/,ea=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,fa=/^([^.]*)(?:\.(.+)|)/;function ga(){return!0}function ha(){return!1}function ia(){try{return d.activeElement}catch(a){}}function ja(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ja(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ha;else if(!e)return a;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return"undefined"!=typeof n&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(G)||[""],j=b.length;while(j--)h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.hasData(a)&&N.get(a);if(r&&(i=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&N.remove(a,"handle events")}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(N.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())a.rnamespace&&!a.rnamespace.test(g.namespace)||(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!==this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,e,f,g=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||d,e=c.documentElement,f=c.body,a.pageX=b.clientX+(e&&e.scrollLeft||f&&f.scrollLeft||0)-(e&&e.clientLeft||f&&f.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||f&&f.scrollTop||0)-(e&&e.clientTop||f&&f.clientTop||0)),a.which||void 0===g||(a.which=1&g?1:2&g?3:4&g?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,e,f=a.type,g=a,h=this.fixHooks[f];h||(this.fixHooks[f]=h=ea.test(f)?this.mouseHooks:da.test(f)?this.keyHooks:{}),e=h.props?this.props.concat(h.props):this.props,a=new n.Event(g),b=e.length;while(b--)c=e[b],a[c]=g[c];return a.target||(a.target=d),3===a.target.nodeType&&(a.target=a.target.parentNode),h.filter?h.filter(a,g):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==ia()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===ia()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ga:ha):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={constructor:n.Event,isDefaultPrevented:ha,isPropagationStopped:ha,isImmediatePropagationStopped:ha,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ga,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ga,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ga,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||n.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),n.fn.extend({on:function(a,b,c,d){return ja(this,a,b,c,d)},one:function(a,b,c,d){return ja(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=ha),this.each(function(){n.event.remove(this,a,c,b)})}});var ka=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,la=/<script|<style|<link/i,ma=/checked\s*(?:[^=]|=\s*.checked.)/i,na=/^true\/(.*)/,oa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function pa(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function qa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function ra(a){var b=na.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function sa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(N.hasData(a)&&(f=N.access(a),g=N.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}O.hasData(a)&&(h=O.access(a),i=n.extend({},h),O.set(b,i))}}function ta(a,b){var c=b.nodeName.toLowerCase();"input"===c&&X.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function ua(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-1,q=b[0],r=n.isFunction(q);if(r||o>1&&"string"==typeof q&&!l.checkClone&&ma.test(q))return a.each(function(e){var f=a.eq(e);r&&(b[0]=q.call(this,e,f.html())),ua(f,b,c,d)});if(o&&(e=ca(b,a[0].ownerDocument,!1,a,d),g=e.firstChild,1===e.childNodes.length&&(e=g),g||d)){for(h=n.map(_(e,"script"),qa),i=h.length;o>m;m++)j=e,m!==p&&(j=n.clone(j,!0,!0),i&&n.merge(h,_(j,"script"))),c.call(a[m],j,m);if(i)for(k=h[h.length-1].ownerDocument,n.map(h,ra),m=0;i>m;m++)j=h[m],Z.test(j.type||"")&&!N.access(j,"globalEval")&&n.contains(k,j)&&(j.src?n._evalUrl&&n._evalUrl(j.src):n.globalEval(j.textContent.replace(oa,"")))}return a}function va(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||n.cleanData(_(d)),d.parentNode&&(c&&n.contains(d.ownerDocument,d)&&aa(_(d,"script")),d.parentNode.removeChild(d));return a}n.extend({htmlPrefilter:function(a){return a.replace(ka,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=_(h),f=_(a),d=0,e=f.length;e>d;d++)ta(f[d],g[d]);if(b)if(c)for(f=f||_(a),g=g||_(h),d=0,e=f.length;e>d;d++)sa(f[d],g[d]);else sa(a,h);return g=_(h,"script"),g.length>0&&aa(g,!i&&_(a,"script")),h},cleanData:function(a){for(var b,c,d,e=n.event.special,f=0;void 0!==(c=a[f]);f++)if(L(c)){if(b=c[N.expando]){if(b.events)for(d in b.events)e[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);c[N.expando]=void 0}c[O.expando]&&(c[O.expando]=void 0)}}}),n.fn.extend({domManip:ua,detach:function(a){return va(this,a,!0)},remove:function(a){return va(this,a)},text:function(a){return K(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.appendChild(a)}})},prepend:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(_(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return K(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!la.test(a)&&!$[(Y.exec(a)||["",""])[1].toLowerCase()]){a=n.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(_(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return ua(this,arguments,function(b){var c=this.parentNode;n.inArray(this,a)<0&&(n.cleanData(_(this)),c&&c.replaceChild(b,this))},a)}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),f=e.length-1,h=0;f>=h;h++)c=h===f?this:this.clone(!0),n(e[h])[b](c),g.apply(d,c.get());return this.pushStack(d)}});var wa,xa={HTML:"block",BODY:"block"};function ya(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[0],"display");return c.detach(),d}function za(a){var b=d,c=xa[a];return c||(c=ya(a,b),"none"!==c&&c||(wa=(wa||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=wa[0].contentDocument,b.write(),b.close(),c=ya(a,b),wa.detach()),xa[a]=c),c}var Aa=/^margin/,Ba=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ca=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)},Da=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e},Ea=d.documentElement;!function(){var b,c,e,f,g=d.createElement("div"),h=d.createElement("div");if(h.style){h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===h.style.backgroundClip,g.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",g.appendChild(h);function i(){h.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",h.innerHTML="",Ea.appendChild(g);var d=a.getComputedStyle(h);b="1%"!==d.top,f="2px"===d.marginLeft,c="4px"===d.width,h.style.marginRight="50%",e="4px"===d.marginRight,Ea.removeChild(g)}n.extend(l,{pixelPosition:function(){return i(),b},boxSizingReliable:function(){return null==c&&i(),c},pixelMarginRight:function(){return null==c&&i(),e},reliableMarginLeft:function(){return null==c&&i(),f},reliableMarginRight:function(){var b,c=h.appendChild(d.createElement("div"));return c.style.cssText=h.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",h.style.width="1px",Ea.appendChild(g),b=!parseFloat(a.getComputedStyle(c).marginRight),Ea.removeChild(g),h.removeChild(c),b}})}}();function Fa(a,b,c){var d,e,f,g,h=a.style;return c=c||Ca(a),g=c?c.getPropertyValue(b)||c[b]:void 0,""!==g&&void 0!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),c&&!l.pixelMarginRight()&&Ba.test(g)&&Aa.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f),void 0!==g?g+"":g}function Ga(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Ha=/^(none|table(?!-c[ea]).+)/,Ia={position:"absolute",visibility:"hidden",display:"block"},Ja={letterSpacing:"0",fontWeight:"400"},Ka=["Webkit","O","Moz","ms"],La=d.createElement("div").style;function Ma(a){if(a in La)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ka.length;while(c--)if(a=Ka[c]+b,a in La)return a}function Na(a,b,c){var d=T.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Oa(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+U[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+U[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+U[f]+"Width",!0,e))):(g+=n.css(a,"padding"+U[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+U[f]+"Width",!0,e)));return g}function Pa(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ca(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Fa(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ba.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Oa(a,b,c||(g?"border":"content"),d,f)+"px"}function Qa(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=N.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&V(d)&&(f[g]=N.access(d,"olddisplay",za(d.nodeName)))):(e=V(d),"none"===c&&e||N.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Fa(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Ma(h)||h),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=T.exec(c))&&e[1]&&(c=W(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(n.cssNumber[h]?"":"px")),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Ma(h)||h),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Fa(a,b,d)),"normal"===e&&b in Ja&&(e=Ja[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?Ha.test(n.css(a,"display"))&&0===a.offsetWidth?Da(a,Ia,function(){return Pa(a,b,d)}):Pa(a,b,d):void 0},set:function(a,c,d){var e,f=d&&Ca(a),g=d&&Oa(a,b,d,"border-box"===n.css(a,"boxSizing",!1,f),f);return g&&(e=T.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=n.css(a,b)),Na(a,c,g)}}}),n.cssHooks.marginLeft=Ga(l.reliableMarginLeft,function(a,b){return b?(parseFloat(Fa(a,"marginLeft"))||a.getBoundingClientRect().left-Da(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px":void 0}),n.cssHooks.marginRight=Ga(l.reliableMarginRight,function(a,b){return b?Da(a,{display:"inline-block"},Fa,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+U[d]+b]=f[d]||f[d-2]||f[0];return e}},Aa.test(a)||(n.cssHooks[a+b].set=Na)}),n.fn.extend({css:function(a,b){return K(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Ca(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Qa(this,!0)},hide:function(){return Qa(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){V(this)?n(this).show():n(this).hide()})}});function Ra(a,b,c,d,e){return new Ra.prototype.init(a,b,c,d,e)}n.Tween=Ra,Ra.prototype={constructor:Ra,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||n.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Ra.propHooks[this.prop];return a&&a.get?a.get(this):Ra.propHooks._default.get(this)},run:function(a){var b,c=Ra.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ra.propHooks._default.set(this),this}},Ra.prototype.init.prototype=Ra.prototype,Ra.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[n.cssProps[a.prop]]&&!n.cssHooks[a.prop]?a.elem[a.prop]=a.now:n.style(a.elem,a.prop,a.now+a.unit)}}},Ra.propHooks.scrollTop=Ra.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},n.fx=Ra.prototype.init,n.fx.step={};var Sa,Ta,Ua=/^(?:toggle|show|hide)$/,Va=/queueHooks$/;function Wa(){return a.setTimeout(function(){Sa=void 0}),Sa=n.now()}function Xa(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=U[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ya(a,b,c){for(var d,e=(_a.tweeners[b]||[]).concat(_a.tweeners["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Za(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&V(a),q=N.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?N.get(a,"olddisplay")||za(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Ua.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?za(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=N.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;N.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ya(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function $a(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function _a(a,b,c){var d,e,f=0,g=_a.prefilters.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Sa||Wa(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{},easing:n.easing._default},c),originalProperties:b,originalOptions:c,startTime:Sa||Wa(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for($a(k,j.opts.specialEasing);g>f;f++)if(d=_a.prefilters[f].call(j,a,k,j.opts))return n.isFunction(d.stop)&&(n._queueHooks(j.elem,j.opts.queue).stop=n.proxy(d.stop,d)),d;return n.map(k,Ya,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(_a,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return W(c.elem,a,T.exec(b),c),c}]},tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.match(G);for(var c,d=0,e=a.length;e>d;d++)c=a[d],_a.tweeners[c]=_a.tweeners[c]||[],_a.tweeners[c].unshift(b)},prefilters:[Za],prefilter:function(a,b){b?_a.prefilters.unshift(a):_a.prefilters.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,null!=d.queue&&d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(V).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=_a(this,n.extend({},a),f);(e||N.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=N.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Va.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=N.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Xa(b,!0),a,d,e)}}),n.each({slideDown:Xa("show"),slideUp:Xa("hide"),slideToggle:Xa("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Sa=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Sa=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Ta||(Ta=a.setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){a.clearInterval(Ta),Ta=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(b,c){return b=n.fx?n.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",l.checkOn=""!==a.value,l.optSelected=c.selected,b.disabled=!0,l.optDisabled=!c.disabled,a=d.createElement("input"),a.value="t",a.type="radio",l.radioValue="t"===a.value}();var ab,bb=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return K(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),e=n.attrHooks[b]||(n.expr.match.bool.test(b)?ab:void 0)),void 0!==c?null===c?void n.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=n.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(G);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)}}),ab={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=bb[b]||n.find.attr;bb[b]=function(a,b,d){var e,f;return d||(f=bb[b],bb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,bb[b]=f),e}});var cb=/^(?:input|select|textarea|button)$/i,db=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return K(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&n.isXMLDoc(a)||(b=n.propFix[b]||b,e=n.propHooks[b]),
  4. void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):cb.test(a.nodeName)||db.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var eb=/[\t\r\n\f]/g;function fb(a){return a.getAttribute&&a.getAttribute("class")||""}n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,fb(this)))});if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=fb(c),d=1===c.nodeType&&(" "+e+" ").replace(eb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=n.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,fb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=fb(c),d=1===c.nodeType&&(" "+e+" ").replace(eb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=n.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):n.isFunction(a)?this.each(function(c){n(this).toggleClass(a.call(this,c,fb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=n(this),f=a.match(G)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=fb(this),b&&N.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":N.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+fb(c)+" ").replace(eb," ").indexOf(b)>-1)return!0;return!1}});var gb=/\r/g,hb=/[\x20\t\r\n\f]+/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(gb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a)).replace(hb," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],(c.selected||i===e)&&(l.optDisabled?!c.disabled:null===c.getAttribute("disabled"))&&(!c.parentNode.disabled||!n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(n.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>-1:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var ib=/^(?:focusinfocus|focusoutblur)$/;n.extend(n.event,{trigger:function(b,c,e,f){var g,h,i,j,l,m,o,p=[e||d],q=k.call(b,"type")?b.type:b,r=k.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!ib.test(q+n.event.triggered)&&(q.indexOf(".")>-1&&(r=q.split("."),q=r.shift(),r.sort()),l=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=r.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},f||!o.trigger||o.trigger.apply(e,c)!==!1)){if(!f&&!o.noBubble&&!n.isWindow(e)){for(j=o.delegateType||q,ib.test(j+q)||(h=h.parentNode);h;h=h.parentNode)p.push(h),i=h;i===(e.ownerDocument||d)&&p.push(i.defaultView||i.parentWindow||a)}g=0;while((h=p[g++])&&!b.isPropagationStopped())b.type=g>1?j:o.bindType||q,m=(N.get(h,"events")||{})[b.type]&&N.get(h,"handle"),m&&m.apply(h,c),m=l&&h[l],m&&m.apply&&L(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=q,f||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!L(e)||l&&n.isFunction(e[q])&&!n.isWindow(e)&&(i=e[l],i&&(e[l]=null),n.event.triggered=q,e[q](),n.event.triggered=void 0,i&&(e[l]=i)),b.result}},simulate:function(a,b,c){var d=n.extend(new n.Event,c,{type:a,isSimulated:!0});n.event.trigger(d,null,b)}}),n.fn.extend({trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),l.focusin="onfocusin"in a,l.focusin||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a))};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=N.access(d,b);e||d.addEventListener(a,c,!0),N.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=N.access(d,b)-1;e?N.access(d,b,e):(d.removeEventListener(a,c,!0),N.remove(d,b))}}});var jb=a.location,kb=n.now(),lb=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var mb=/#.*$/,nb=/([?&])_=[^&]*/,ob=/^(.*?):[ \t]*([^\r\n]*)$/gm,pb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,qb=/^(?:GET|HEAD)$/,rb=/^\/\//,sb={},tb={},ub="*/".concat("*"),vb=d.createElement("a");vb.href=jb.href;function wb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(G)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function xb(a,b,c,d){var e={},f=a===tb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function yb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function zb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Ab(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:jb.href,type:"GET",isLocal:pb.test(jb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":ub,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?yb(yb(a,n.ajaxSettings),b):yb(n.ajaxSettings,a)},ajaxPrefilter:wb(sb),ajaxTransport:wb(tb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m=n.ajaxSetup({},c),o=m.context||m,p=m.context&&(o.nodeType||o.jquery)?n(o):n.event,q=n.Deferred(),r=n.Callbacks("once memory"),s=m.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,getResponseHeader:function(a){var b;if(2===v){if(!h){h={};while(b=ob.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===v?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return v||(a=u[c]=u[c]||a,t[a]=b),this},overrideMimeType:function(a){return v||(m.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>v)for(b in a)s[b]=[s[b],a[b]];else x.always(a[x.status]);return this},abort:function(a){var b=a||w;return e&&e.abort(b),z(0,b),this}};if(q.promise(x).complete=r.add,x.success=x.done,x.error=x.fail,m.url=((b||m.url||jb.href)+"").replace(mb,"").replace(rb,jb.protocol+"//"),m.type=c.method||c.type||m.method||m.type,m.dataTypes=n.trim(m.dataType||"*").toLowerCase().match(G)||[""],null==m.crossDomain){j=d.createElement("a");try{j.href=m.url,j.href=j.href,m.crossDomain=vb.protocol+"//"+vb.host!=j.protocol+"//"+j.host}catch(y){m.crossDomain=!0}}if(m.data&&m.processData&&"string"!=typeof m.data&&(m.data=n.param(m.data,m.traditional)),xb(sb,m,c,x),2===v)return x;k=n.event&&m.global,k&&0===n.active++&&n.event.trigger("ajaxStart"),m.type=m.type.toUpperCase(),m.hasContent=!qb.test(m.type),f=m.url,m.hasContent||(m.data&&(f=m.url+=(lb.test(f)?"&":"?")+m.data,delete m.data),m.cache===!1&&(m.url=nb.test(f)?f.replace(nb,"$1_="+kb++):f+(lb.test(f)?"&":"?")+"_="+kb++)),m.ifModified&&(n.lastModified[f]&&x.setRequestHeader("If-Modified-Since",n.lastModified[f]),n.etag[f]&&x.setRequestHeader("If-None-Match",n.etag[f])),(m.data&&m.hasContent&&m.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",m.contentType),x.setRequestHeader("Accept",m.dataTypes[0]&&m.accepts[m.dataTypes[0]]?m.accepts[m.dataTypes[0]]+("*"!==m.dataTypes[0]?", "+ub+"; q=0.01":""):m.accepts["*"]);for(l in m.headers)x.setRequestHeader(l,m.headers[l]);if(m.beforeSend&&(m.beforeSend.call(o,x,m)===!1||2===v))return x.abort();w="abort";for(l in{success:1,error:1,complete:1})x[l](m[l]);if(e=xb(tb,m,c,x)){if(x.readyState=1,k&&p.trigger("ajaxSend",[x,m]),2===v)return x;m.async&&m.timeout>0&&(i=a.setTimeout(function(){x.abort("timeout")},m.timeout));try{v=1,e.send(t,z)}catch(y){if(!(2>v))throw y;z(-1,y)}}else z(-1,"No Transport");function z(b,c,d,h){var j,l,t,u,w,y=c;2!==v&&(v=2,i&&a.clearTimeout(i),e=void 0,g=h||"",x.readyState=b>0?4:0,j=b>=200&&300>b||304===b,d&&(u=zb(m,x,d)),u=Ab(m,u,x,j),j?(m.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(n.lastModified[f]=w),w=x.getResponseHeader("etag"),w&&(n.etag[f]=w)),204===b||"HEAD"===m.type?y="nocontent":304===b?y="notmodified":(y=u.state,l=u.data,t=u.error,j=!t)):(t=y,!b&&y||(y="error",0>b&&(b=0))),x.status=b,x.statusText=(c||y)+"",j?q.resolveWith(o,[l,y,x]):q.rejectWith(o,[x,y,t]),x.statusCode(s),s=void 0,k&&p.trigger(j?"ajaxSuccess":"ajaxError",[x,m,j?l:t]),r.fireWith(o,[x,y]),k&&(p.trigger("ajaxComplete",[x,m]),--n.active||n.event.trigger("ajaxStop")))}return x},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax(n.extend({url:a,type:b,dataType:e,data:c,success:d},n.isPlainObject(a)&&a))}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return n.isFunction(a)?this.each(function(b){n(this).wrapInner(a.call(this,b))}):this.each(function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return!n.expr.filters.visible(a)},n.expr.filters.visible=function(a){return a.offsetWidth>0||a.offsetHeight>0||a.getClientRects().length>0};var Bb=/%20/g,Cb=/\[\]$/,Db=/\r?\n/g,Eb=/^(?:submit|button|image|reset|file)$/i,Fb=/^(?:input|select|textarea|keygen)/i;function Gb(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||Cb.test(a)?d(a,e):Gb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Gb(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Gb(c,a[c],b,e);return d.join("&").replace(Bb,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Fb.test(this.nodeName)&&!Eb.test(a)&&(this.checked||!X.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(Db,"\r\n")}}):{name:b.name,value:c.replace(Db,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Hb={0:200,1223:204},Ib=n.ajaxSettings.xhr();l.cors=!!Ib&&"withCredentials"in Ib,l.ajax=Ib=!!Ib,n.ajaxTransport(function(b){var c,d;return l.cors||Ib&&!b.crossDomain?{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Hb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=n("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Jb=[],Kb=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Jb.pop()||n.expando+"_"+kb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Kb.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Kb.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Kb,"$1"+e):b.jsonp!==!1&&(b.url+=(lb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?n(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Jb.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||d;var e=x.exec(a),f=!c&&[];return e?[b.createElement(e[1])]:(e=ca([a],b,f),f&&f.length&&n(f).remove(),n.merge([],e.childNodes))};var Lb=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Lb)return Lb.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};function Mb(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,n.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(e=d.getBoundingClientRect(),c=Mb(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Ea})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;n.fn[a]=function(d){return K(this,function(a,d,e){var f=Mb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Ga(l.pixelPosition,function(a,c){return c?(c=Fa(a,b),Ba.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return K(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)},size:function(){return this.length}}),n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Nb=a.jQuery,Ob=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Ob),b&&a.jQuery===n&&(a.jQuery=Nb),n},b||(a.jQuery=a.$=n),n});
  5. /*!
  6. * Bootstrap v3.3.7 (http://getbootstrap.com)
  7. * Copyright 2011-2016 Twitter, Inc.
  8. * Licensed under the MIT license
  9. */
  10. if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(a>this.$items.length-1||a<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.7",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.7",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",c).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){document===a.target||this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+e).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m<o.top?"bottom":"right"==h&&k.right+l>o.width?"left":"left"==h&&k.left-l<o.left?"right":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",q).emulateTransitionEnd(c.TRANSITION_DURATION):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);if(this.$element.trigger(g),!g.isDefaultPrevented())return f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=window.SVGElement&&c instanceof window.SVGElement,g=d?{top:0,left:0}:f?null:b.offset(),h={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},i=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,h,i,g)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.7",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){
  11. this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.7",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return e<c&&"top";if("bottom"==this.affixed)return null!=c?!(e+this.unpin<=f.top)&&"bottom":!(e+g<=a-d)&&"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&e<=c?"top":null!=d&&i+j>=a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
  12. define("bootstrap", ["jquery"], function(){});
  13. require.config({
  14. urlArgs: "v=" + requirejs.s.contexts._.config.config.site.version,
  15. packages: [{
  16. name: 'moment',
  17. location: '../libs/moment',
  18. main: 'moment'
  19. }
  20. ],
  21. //在打包压缩时将会把include中的模块合并到主文件中
  22. include: ['css', 'layer', 'toastr', 'fast', 'backend', 'backend-init', 'table', 'form', 'dragsort', 'drag', 'drop', 'addtabs', 'selectpage'],
  23. paths: {
  24. 'lang': "empty:",
  25. 'form': 'require-form',
  26. 'table': 'require-table',
  27. 'upload': 'require-upload',
  28. 'validator': 'require-validator',
  29. 'drag': 'jquery.drag.min',
  30. 'drop': 'jquery.drop.min',
  31. 'echarts': 'echarts.min',
  32. 'echarts-theme': 'echarts-theme',
  33. 'adminlte': 'adminlte',
  34. 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch',
  35. 'bootstrap-table-template': 'bootstrap-table-template',
  36. //
  37. // 以下的包从bower的libs目录加载
  38. 'jquery': '../libs/jquery/dist/jquery.min',
  39. 'bootstrap': '../libs/bootstrap/dist/js/bootstrap.min',
  40. 'bootstrap-datetimepicker': '../libs/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min',
  41. 'bootstrap-daterangepicker': '../libs/bootstrap-daterangepicker/daterangepicker',
  42. 'bootstrap-select': '../libs/bootstrap-select/dist/js/bootstrap-select.min',
  43. 'bootstrap-select-lang': '../libs/bootstrap-select/dist/js/i18n/defaults-zh_CN',
  44. 'bootstrap-table': '../libs/bootstrap-table/dist/bootstrap-table.min',
  45. 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
  46. 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
  47. 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
  48. 'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',
  49. 'dragsort': '../libs/fastadmin-dragsort/jquery.dragsort',
  50. 'sortable': '../libs/Sortable/Sortable.min',
  51. 'addtabs': '../libs/fastadmin-addtabs/jquery.addtabs',
  52. 'slimscroll': '../libs/jquery-slimscroll/jquery.slimscroll',
  53. 'validator-core': '../libs/nice-validator/dist/jquery.validator',
  54. 'validator-lang': '../libs/nice-validator/dist/local/zh-CN',
  55. 'plupload': '../libs/plupload/js/plupload.min',
  56. 'toastr': '../libs/toastr/toastr',
  57. 'jstree': '../libs/jstree/dist/jstree.min',
  58. 'layer': '../libs/layer/dist/layer',
  59. 'cookie': '../libs/jquery.cookie/jquery.cookie',
  60. 'cxselect': '../libs/fastadmin-cxselect/js/jquery.cxselect',
  61. 'template': '../libs/art-template/dist/template-native',
  62. 'selectpage': '../libs/fastadmin-selectpage/selectpage',
  63. 'citypicker': '../libs/city-picker/dist/js/city-picker.min',
  64. 'citypicker-data': '../libs/city-picker/dist/js/city-picker.data',
  65. },
  66. // shim依赖配置
  67. shim: {
  68. 'addons': ['backend'],
  69. 'bootstrap': ['jquery'],
  70. 'bootstrap-table': {
  71. deps: [
  72. 'bootstrap',
  73. // 'css!../libs/bootstrap-table/dist/bootstrap-table.min.css'
  74. ],
  75. exports: '$.fn.bootstrapTable'
  76. },
  77. 'bootstrap-table-lang': {
  78. deps: ['bootstrap-table'],
  79. exports: '$.fn.bootstrapTable.defaults'
  80. },
  81. 'bootstrap-table-export': {
  82. deps: ['bootstrap-table', 'tableexport'],
  83. exports: '$.fn.bootstrapTable.defaults'
  84. },
  85. 'bootstrap-table-mobile': {
  86. deps: ['bootstrap-table'],
  87. exports: '$.fn.bootstrapTable.defaults'
  88. },
  89. 'bootstrap-table-advancedsearch': {
  90. deps: ['bootstrap-table'],
  91. exports: '$.fn.bootstrapTable.defaults'
  92. },
  93. 'bootstrap-table-commonsearch': {
  94. deps: ['bootstrap-table'],
  95. exports: '$.fn.bootstrapTable.defaults'
  96. },
  97. 'bootstrap-table-template': {
  98. deps: ['bootstrap-table', 'template'],
  99. exports: '$.fn.bootstrapTable.defaults'
  100. },
  101. 'tableexport': {
  102. deps: ['jquery'],
  103. exports: '$.fn.extend'
  104. },
  105. 'slimscroll': {
  106. deps: ['jquery'],
  107. exports: '$.fn.extend'
  108. },
  109. 'adminlte': {
  110. deps: ['bootstrap', 'slimscroll'],
  111. exports: '$.AdminLTE'
  112. },
  113. 'bootstrap-datetimepicker': [
  114. 'moment/locale/zh-cn',
  115. // 'css!../libs/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css',
  116. ],
  117. 'bootstrap-select': ['css!../libs/bootstrap-select/dist/css/bootstrap-select.min.css', ],
  118. 'bootstrap-select-lang': ['bootstrap-select'],
  119. // 'toastr': ['css!../libs/toastr/toastr.min.css'],
  120. 'jstree': ['css!../libs/jstree/dist/themes/default/style.css', ],
  121. 'plupload': {
  122. deps: ['../libs/plupload/js/moxie.min'],
  123. exports: "plupload"
  124. },
  125. // 'layer': ['css!../libs/layer/dist/theme/default/layer.css'],
  126. // 'validator-core': ['css!../libs/nice-validator/dist/jquery.validator.css'],
  127. 'validator-lang': ['validator-core'],
  128. // 'selectpage': ['css!../libs/fastadmin-selectpage/selectpage.css'],
  129. 'citypicker': ['citypicker-data', 'css!../libs/city-picker/dist/css/city-picker.css']
  130. },
  131. baseUrl: requirejs.s.contexts._.config.config.site.cdnurl + '/assets/js/', //资源基础路径
  132. map: {
  133. '*': {
  134. 'css': '../libs/require-css/css.min'
  135. }
  136. },
  137. waitSeconds: 30,
  138. charset: 'utf-8' // 文件编码
  139. });
  140. require(['jquery', 'bootstrap'], function ($, undefined) {
  141. //初始配置
  142. var Config = requirejs.s.contexts._.config.config;
  143. //将Config渲染到全局
  144. window.Config = Config;
  145. // 配置语言包的路径
  146. var paths = {};
  147. paths['lang'] = Config.moduleurl + '/ajax/lang?callback=define&controllername=' + Config.controllername;
  148. // 避免目录冲突
  149. paths['backend/'] = 'backend/';
  150. require.config({paths: paths});
  151. // 初始化
  152. $(function () {
  153. require(['fast'], function (Fast) {
  154. require(['backend', 'backend-init', 'addons'], function (Backend, undefined, Addons) {
  155. //加载相应模块
  156. if (Config.jsname) {
  157. require([Config.jsname], function (Controller) {
  158. Controller[Config.actionname] != undefined && Controller[Config.actionname]();
  159. }, function (e) {
  160. console.error(e);
  161. // 这里可捕获模块加载的错误
  162. });
  163. }
  164. });
  165. });
  166. });
  167. });
  168. define("require-backend", function(){});
  169. define('../libs/require-css/css.min',[],function(){if("undefined"==typeof window)return{load:function(a,b,c){c()}};var a=document.getElementsByTagName("head")[0],b=window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)|AndroidWebKit\/([^ ;]*)/)||0,c=!1,d=!0;b[1]||b[7]?c=parseInt(b[1])<6||parseInt(b[7])<=9:b[2]||b[8]?d=!1:b[4]&&(c=parseInt(b[4])<18);var e={};e.pluginBuilder="./css-builder";var f,g,h,i=function(){f=document.createElement("style"),a.appendChild(f),g=f.styleSheet||f.sheet},j=0,k=[],l=function(a){g.addImport(a),f.onload=function(){m()},j++,31==j&&(i(),j=0)},m=function(){h();var a=k.shift();return a?(h=a[1],void l(a[0])):void(h=null)},n=function(a,b){if(g&&g.addImport||i(),g&&g.addImport)h?k.push([a,b]):(l(a),h=b);else{f.textContent='@import "'+a+'";';var c=setInterval(function(){try{f.sheet.cssRules,clearInterval(c),b()}catch(a){}},10)}},o=function(b,c){var e=document.createElement("link");if(e.type="text/css",e.rel="stylesheet",d)e.onload=function(){e.onload=function(){},setTimeout(c,7)};else var f=setInterval(function(){for(var a=0;a<document.styleSheets.length;a++){var b=document.styleSheets[a];if(b.href==e.href)return clearInterval(f),c()}},10);e.href=b,a.appendChild(e)};return e.normalize=function(a,b){return".css"==a.substr(a.length-4,4)&&(a=a.substr(0,a.length-4)),b(a)},e.load=function(a,b,d,e){(c?n:o)(b.toUrl(a+".css"),d)},e});
  170. /*! layer-v3.1.1 Web弹层组件 MIT License http://layer.layui.com/ By 贤心 */
  171. ;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(o.getStyle(document.getElementById(f),"width"))?i():setTimeout(u,100))}()}}},r={v:"3.1.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?t.creat():setTimeout(function(){t.creat()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"&#x4FE1;&#x606F;",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'<div class="layui-layer-title" style="'+(f?r.title[1]:"")+'">'+(f?r.title[0]:r.title)+"</div>":"";return r.zIndex=s,t([r.shade?'<div class="layui-layer-shade" id="layui-layer-shade'+a+'" times="'+a+'" style="'+("z-index:"+(s-1)+"; ")+'"></div>':"",'<div class="'+l[0]+(" layui-layer-"+o.type[r.type])+(0!=r.type&&2!=r.type||r.shade?"":" layui-layer-border")+" "+(r.skin||"")+'" id="'+l[0]+a+'" type="'+o.type[r.type]+'" times="'+a+'" showtime="'+r.time+'" conType="'+(e?"object":"string")+'" style="z-index: '+s+"; width:"+r.area[0]+";height:"+r.area[1]+(r.fixed?"":";position:absolute;")+'">'+(e&&2!=r.type?"":u)+'<div id="'+(r.id||"")+'" class="layui-layer-content'+(0==r.type&&r.icon!==-1?" layui-layer-padding":"")+(3==r.type?" layui-layer-loading"+r.icon:"")+'">'+(0==r.type&&r.icon!==-1?'<i class="layui-layer-ico layui-layer-ico'+r.icon+'"></i>':"")+(1==r.type&&e?"":r.content||"")+'</div><span class="layui-layer-setwin">'+function(){var e=c?'<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>':"";return r.closeBtn&&(e+='<a class="layui-layer-ico '+l[7]+" "+l[7]+(r.title?r.closeBtn:4==r.type?"1":"2")+'" href="javascript:;"></a>'),e}()+"</span>"+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t<i;t++)e+='<a class="'+l[6]+t+'">'+r.btn[t]+"</a>";return'<div class="'+l[6]+" layui-layer-btn-"+(r.btnAlign||"")+'">'+e+"</div>"}():"")+(r.resize?'<span class="layui-layer-resize"></span>':"")+"</div>"],u,i('<div class="layui-layer-move"></div>')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"http://layer.layui.com","auto"];t.content='<iframe scrolling="'+(t.content[1]||"auto")+'" allowtransparency="true" id="'+l[4]+a+'" name="'+l[4]+a+'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="'+t.content[0]+'"></iframe>';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'<i class="layui-layer-TipsG"></i>',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),i("#layui-layer-shade"+e.index).css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;a<c.stX&&(a=c.stX),a>f&&(a=f),o<c.stY&&(o=c.stY),o>u&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass("layer-anim "+a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'<textarea class="layui-layer-input"'+a+">"+(e.value||"")+"</textarea>":function(){return'<input type="'+(1==e.formType?"password":"text")+'" class="layui-layer-input" value="'+(e.value||"")+'">'}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(e){s=e.find(".layui-layer-input"),s.focus(),"function"==typeof f&&f(e)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("&#x6700;&#x591A;&#x8F93;&#x5165;"+(e.maxlength||500)+"&#x4E2A;&#x5B57;&#x6570;",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a='<span class="'+n+'">'+t[0].title+"</span>";i<e;i++)a+="<span>"+t[i].title+"</span>";return a}(),content:'<ul class="layui-layer-tabmain">'+function(){var e=t.length,i=1,a="";if(e>0)for(a='<li class="layui-layer-tabli '+n+'">'+(t[0].content||"no content")+"</li>";i<e;i++)a+='<li class="layui-layer-tabli">'+(t[i].content||"no content")+"</li>";return a}()+"</ul>",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("&#x6CA1;&#x6709;&#x56FE;&#x7247;")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]<r[1]&&(a[0]=a[0]/r[1],a[1]=a[1]/r[1])}return[a[0]+"px",a[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,isOutAnim:!1,skin:"layui-layer-photos"+c("photos"),content:'<div class="layui-layer-phimg"><img src="'+u[d].src+'" alt="'+(u[d].alt||"")+'" layer-pid="'+u[d].pid+'"><div class="layui-layer-imgsee">'+(u.length>1?'<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>':"")+'<div class="layui-layer-imgbar" style="display:'+(a?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(u[d].alt||"")+"</a><em>"+s.imgIndex+"/"+u.length+"</em></span></div></div></div>",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;",{time:3e4,btn:["&#x4E0B;&#x4E00;&#x5F20;","&#x4E0D;&#x770B;&#x4E86;"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define('layer',["jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window);
  172. /*
  173. * Toastr
  174. * Copyright 2012-2015
  175. * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
  176. * All Rights Reserved.
  177. * Use, reproduction, distribution, and modification of this code is subject to the terms and
  178. * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
  179. *
  180. * ARIA Support: Greta Krafsig
  181. *
  182. * Project: https://github.com/CodeSeven/toastr
  183. */
  184. /* global define */
  185. (function (define) {
  186. define('toastr',['jquery'], function ($) {
  187. return (function () {
  188. var $container;
  189. var listener;
  190. var toastId = 0;
  191. var toastType = {
  192. error: 'error',
  193. info: 'info',
  194. success: 'success',
  195. warning: 'warning'
  196. };
  197. var toastr = {
  198. clear: clear,
  199. remove: remove,
  200. error: error,
  201. getContainer: getContainer,
  202. info: info,
  203. options: {},
  204. subscribe: subscribe,
  205. success: success,
  206. version: '2.1.3',
  207. warning: warning
  208. };
  209. var previousToast;
  210. return toastr;
  211. ////////////////
  212. function error(message, title, optionsOverride) {
  213. return notify({
  214. type: toastType.error,
  215. iconClass: getOptions().iconClasses.error,
  216. message: message,
  217. optionsOverride: optionsOverride,
  218. title: title
  219. });
  220. }
  221. function getContainer(options, create) {
  222. if (!options) { options = getOptions(); }
  223. $container = $('#' + options.containerId);
  224. if ($container.length) {
  225. return $container;
  226. }
  227. if (create) {
  228. $container = createContainer(options);
  229. }
  230. return $container;
  231. }
  232. function info(message, title, optionsOverride) {
  233. return notify({
  234. type: toastType.info,
  235. iconClass: getOptions().iconClasses.info,
  236. message: message,
  237. optionsOverride: optionsOverride,
  238. title: title
  239. });
  240. }
  241. function subscribe(callback) {
  242. listener = callback;
  243. }
  244. function success(message, title, optionsOverride) {
  245. return notify({
  246. type: toastType.success,
  247. iconClass: getOptions().iconClasses.success,
  248. message: message,
  249. optionsOverride: optionsOverride,
  250. title: title
  251. });
  252. }
  253. function warning(message, title, optionsOverride) {
  254. return notify({
  255. type: toastType.warning,
  256. iconClass: getOptions().iconClasses.warning,
  257. message: message,
  258. optionsOverride: optionsOverride,
  259. title: title
  260. });
  261. }
  262. function clear($toastElement, clearOptions) {
  263. var options = getOptions();
  264. if (!$container) { getContainer(options); }
  265. if (!clearToast($toastElement, options, clearOptions)) {
  266. clearContainer(options);
  267. }
  268. }
  269. function remove($toastElement) {
  270. var options = getOptions();
  271. if (!$container) { getContainer(options); }
  272. if ($toastElement && $(':focus', $toastElement).length === 0) {
  273. removeToast($toastElement);
  274. return;
  275. }
  276. if ($container.children().length) {
  277. $container.remove();
  278. }
  279. }
  280. // internal functions
  281. function clearContainer (options) {
  282. var toastsToClear = $container.children();
  283. for (var i = toastsToClear.length - 1; i >= 0; i--) {
  284. clearToast($(toastsToClear[i]), options);
  285. }
  286. }
  287. function clearToast ($toastElement, options, clearOptions) {
  288. var force = clearOptions && clearOptions.force ? clearOptions.force : false;
  289. if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
  290. $toastElement[options.hideMethod]({
  291. duration: options.hideDuration,
  292. easing: options.hideEasing,
  293. complete: function () { removeToast($toastElement); }
  294. });
  295. return true;
  296. }
  297. return false;
  298. }
  299. function createContainer(options) {
  300. $container = $('<div/>')
  301. .attr('id', options.containerId)
  302. .addClass(options.positionClass);
  303. $container.appendTo($(options.target));
  304. return $container;
  305. }
  306. function getDefaults() {
  307. return {
  308. tapToDismiss: true,
  309. toastClass: 'toast',
  310. containerId: 'toast-container',
  311. debug: false,
  312. showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
  313. showDuration: 300,
  314. showEasing: 'swing', //swing and linear are built into jQuery
  315. onShown: undefined,
  316. hideMethod: 'fadeOut',
  317. hideDuration: 1000,
  318. hideEasing: 'swing',
  319. onHidden: undefined,
  320. closeMethod: false,
  321. closeDuration: false,
  322. closeEasing: false,
  323. closeOnHover: true,
  324. extendedTimeOut: 1000,
  325. iconClasses: {
  326. error: 'toast-error',
  327. info: 'toast-info',
  328. success: 'toast-success',
  329. warning: 'toast-warning'
  330. },
  331. iconClass: 'toast-info',
  332. positionClass: 'toast-top-right',
  333. timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
  334. titleClass: 'toast-title',
  335. messageClass: 'toast-message',
  336. escapeHtml: false,
  337. target: 'body',
  338. closeHtml: '<button type="button">&times;</button>',
  339. closeClass: 'toast-close-button',
  340. newestOnTop: true,
  341. preventDuplicates: false,
  342. progressBar: false,
  343. progressClass: 'toast-progress',
  344. rtl: false
  345. };
  346. }
  347. function publish(args) {
  348. if (!listener) { return; }
  349. listener(args);
  350. }
  351. function notify(map) {
  352. var options = getOptions();
  353. var iconClass = map.iconClass || options.iconClass;
  354. if (typeof (map.optionsOverride) !== 'undefined') {
  355. options = $.extend(options, map.optionsOverride);
  356. iconClass = map.optionsOverride.iconClass || iconClass;
  357. }
  358. if (shouldExit(options, map)) { return; }
  359. toastId++;
  360. $container = getContainer(options, true);
  361. var intervalId = null;
  362. var $toastElement = $('<div/>');
  363. var $titleElement = $('<div/>');
  364. var $messageElement = $('<div/>');
  365. var $progressElement = $('<div/>');
  366. var $closeElement = $(options.closeHtml);
  367. var progressBar = {
  368. intervalId: null,
  369. hideEta: null,
  370. maxHideTime: null
  371. };
  372. var response = {
  373. toastId: toastId,
  374. state: 'visible',
  375. startTime: new Date(),
  376. options: options,
  377. map: map
  378. };
  379. personalizeToast();
  380. displayToast();
  381. handleEvents();
  382. publish(response);
  383. if (options.debug && console) {
  384. console.log(response);
  385. }
  386. return $toastElement;
  387. function escapeHtml(source) {
  388. if (source == null) {
  389. source = '';
  390. }
  391. return source
  392. .replace(/&/g, '&amp;')
  393. .replace(/"/g, '&quot;')
  394. .replace(/'/g, '&#39;')
  395. .replace(/</g, '&lt;')
  396. .replace(/>/g, '&gt;');
  397. }
  398. function personalizeToast() {
  399. setIcon();
  400. setTitle();
  401. setMessage();
  402. setCloseButton();
  403. setProgressBar();
  404. setRTL();
  405. setSequence();
  406. setAria();
  407. }
  408. function setAria() {
  409. var ariaValue = '';
  410. switch (map.iconClass) {
  411. case 'toast-success':
  412. case 'toast-info':
  413. ariaValue = 'polite';
  414. break;
  415. default:
  416. ariaValue = 'assertive';
  417. }
  418. $toastElement.attr('aria-live', ariaValue);
  419. }
  420. function handleEvents() {
  421. if (options.closeOnHover) {
  422. $toastElement.hover(stickAround, delayedHideToast);
  423. }
  424. if (!options.onclick && options.tapToDismiss) {
  425. $toastElement.click(hideToast);
  426. }
  427. if (options.closeButton && $closeElement) {
  428. $closeElement.click(function (event) {
  429. if (event.stopPropagation) {
  430. event.stopPropagation();
  431. } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
  432. event.cancelBubble = true;
  433. }
  434. if (options.onCloseClick) {
  435. options.onCloseClick(event);
  436. }
  437. hideToast(true);
  438. });
  439. }
  440. if (options.onclick) {
  441. $toastElement.click(function (event) {
  442. options.onclick(event);
  443. hideToast();
  444. });
  445. }
  446. }
  447. function displayToast() {
  448. $toastElement.hide();
  449. $toastElement[options.showMethod](
  450. {duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
  451. );
  452. if (options.timeOut > 0) {
  453. intervalId = setTimeout(hideToast, options.timeOut);
  454. progressBar.maxHideTime = parseFloat(options.timeOut);
  455. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  456. if (options.progressBar) {
  457. progressBar.intervalId = setInterval(updateProgress, 10);
  458. }
  459. }
  460. }
  461. function setIcon() {
  462. if (map.iconClass) {
  463. $toastElement.addClass(options.toastClass).addClass(iconClass);
  464. }
  465. }
  466. function setSequence() {
  467. if (options.newestOnTop) {
  468. $container.prepend($toastElement);
  469. } else {
  470. $container.append($toastElement);
  471. }
  472. }
  473. function setTitle() {
  474. if (map.title) {
  475. var suffix = map.title;
  476. if (options.escapeHtml) {
  477. suffix = escapeHtml(map.title);
  478. }
  479. $titleElement.append(suffix).addClass(options.titleClass);
  480. $toastElement.append($titleElement);
  481. }
  482. }
  483. function setMessage() {
  484. if (map.message) {
  485. var suffix = map.message;
  486. if (options.escapeHtml) {
  487. suffix = escapeHtml(map.message);
  488. }
  489. $messageElement.append(suffix).addClass(options.messageClass);
  490. $toastElement.append($messageElement);
  491. }
  492. }
  493. function setCloseButton() {
  494. if (options.closeButton) {
  495. $closeElement.addClass(options.closeClass).attr('role', 'button');
  496. $toastElement.prepend($closeElement);
  497. }
  498. }
  499. function setProgressBar() {
  500. if (options.progressBar) {
  501. $progressElement.addClass(options.progressClass);
  502. $toastElement.prepend($progressElement);
  503. }
  504. }
  505. function setRTL() {
  506. if (options.rtl) {
  507. $toastElement.addClass('rtl');
  508. }
  509. }
  510. function shouldExit(options, map) {
  511. if (options.preventDuplicates) {
  512. if (map.message === previousToast) {
  513. return true;
  514. } else {
  515. previousToast = map.message;
  516. }
  517. }
  518. return false;
  519. }
  520. function hideToast(override) {
  521. var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
  522. var duration = override && options.closeDuration !== false ?
  523. options.closeDuration : options.hideDuration;
  524. var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
  525. if ($(':focus', $toastElement).length && !override) {
  526. return;
  527. }
  528. clearTimeout(progressBar.intervalId);
  529. return $toastElement[method]({
  530. duration: duration,
  531. easing: easing,
  532. complete: function () {
  533. removeToast($toastElement);
  534. clearTimeout(intervalId);
  535. if (options.onHidden && response.state !== 'hidden') {
  536. options.onHidden();
  537. }
  538. response.state = 'hidden';
  539. response.endTime = new Date();
  540. publish(response);
  541. }
  542. });
  543. }
  544. function delayedHideToast() {
  545. if (options.timeOut > 0 || options.extendedTimeOut > 0) {
  546. intervalId = setTimeout(hideToast, options.extendedTimeOut);
  547. progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
  548. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  549. }
  550. }
  551. function stickAround() {
  552. clearTimeout(intervalId);
  553. progressBar.hideEta = 0;
  554. $toastElement.stop(true, true)[options.showMethod](
  555. {duration: options.showDuration, easing: options.showEasing}
  556. );
  557. }
  558. function updateProgress() {
  559. var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
  560. $progressElement.width(percentage + '%');
  561. }
  562. }
  563. function getOptions() {
  564. return $.extend({}, getDefaults(), toastr.options);
  565. }
  566. function removeToast($toastElement) {
  567. if (!$container) { $container = getContainer(); }
  568. if ($toastElement.is(':visible')) {
  569. return;
  570. }
  571. $toastElement.remove();
  572. $toastElement = null;
  573. if ($container.children().length === 0) {
  574. $container.remove();
  575. previousToast = undefined;
  576. }
  577. }
  578. })();
  579. });
  580. }(typeof define === 'function' && define.amd ? define : function (deps, factory) {
  581. if (typeof module !== 'undefined' && module.exports) { //Node
  582. module.exports = factory(require('jquery'));
  583. } else {
  584. window.toastr = factory(window.jQuery);
  585. }
  586. }));
  587. define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) {
  588. var Fast = {
  589. config: {
  590. //toastr默认配置
  591. toastr: {
  592. "closeButton": true,
  593. "debug": false,
  594. "newestOnTop": false,
  595. "progressBar": false,
  596. "positionClass": "toast-top-center",
  597. "preventDuplicates": false,
  598. "onclick": null,
  599. "showDuration": "300",
  600. "hideDuration": "1000",
  601. "timeOut": "5000",
  602. "extendedTimeOut": "1000",
  603. "showEasing": "swing",
  604. "hideEasing": "linear",
  605. "showMethod": "fadeIn",
  606. "hideMethod": "fadeOut"
  607. }
  608. },
  609. events: {
  610. //请求成功的回调
  611. onAjaxSuccess: function (ret, onAjaxSuccess) {
  612. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  613. var msg = typeof ret.msg !== 'undefined' && ret.msg ? ret.msg : __('Operation completed');
  614. if (typeof onAjaxSuccess === 'function') {
  615. var result = onAjaxSuccess.call(this, data, ret);
  616. if (result === false)
  617. return;
  618. }
  619. Toastr.success(msg);
  620. },
  621. //请求错误的回调
  622. onAjaxError: function (ret, onAjaxError) {
  623. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  624. if (typeof onAjaxError === 'function') {
  625. var result = onAjaxError.call(this, data, ret);
  626. if (result === false) {
  627. return;
  628. }
  629. }
  630. Toastr.error(ret.msg);
  631. },
  632. //服务器响应数据后
  633. onAjaxResponse: function (response) {
  634. try {
  635. var ret = typeof response === 'object' ? response : JSON.parse(response);
  636. if (!ret.hasOwnProperty('code')) {
  637. $.extend(ret, {code: -2, msg: response, data: null});
  638. }
  639. } catch (e) {
  640. var ret = {code: -1, msg: e.message, data: null};
  641. }
  642. return ret;
  643. }
  644. },
  645. api: {
  646. //发送Ajax请求
  647. ajax: function (options, success, error) {
  648. options = typeof options === 'string' ? {url: options} : options;
  649. var index = Layer.load();
  650. options = $.extend({
  651. type: "POST",
  652. dataType: "json",
  653. success: function (ret) {
  654. Layer.close(index);
  655. ret = Fast.events.onAjaxResponse(ret);
  656. if (ret.code === 1) {
  657. Fast.events.onAjaxSuccess(ret, success);
  658. } else {
  659. Fast.events.onAjaxError(ret, error);
  660. }
  661. },
  662. error: function (xhr) {
  663. Layer.close(index);
  664. var ret = {code: xhr.status, msg: xhr.statusText, data: null};
  665. Fast.events.onAjaxError(ret, error);
  666. }
  667. }, options);
  668. $.ajax(options);
  669. },
  670. //修复URL
  671. fixurl: function (url) {
  672. if (url.substr(0, 1) !== "/") {
  673. var r = new RegExp('^(?:[a-z]+:)?//', 'i');
  674. if (!r.test(url)) {
  675. url = Config.moduleurl + "/" + url;
  676. }
  677. } else if (url.substr(0, 8) === "/addons/") {
  678. url = Config.__PUBLIC__.replace(/(\/*$)/g, "") + url;
  679. }
  680. return url;
  681. },
  682. //获取修复后可访问的cdn链接
  683. cdnurl: function (url) {
  684. return /^(?:[a-z]+:)?\/\//i.test(url) ? url : Config.upload.cdnurl + url;
  685. },
  686. //查询Url参数
  687. query: function (name, url) {
  688. if (!url) {
  689. url = window.location.href;
  690. }
  691. name = name.replace(/[\[\]]/g, "\\$&");
  692. var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
  693. results = regex.exec(url);
  694. if (!results)
  695. return null;
  696. if (!results[2])
  697. return '';
  698. return decodeURIComponent(results[2].replace(/\+/g, " "));
  699. },
  700. //打开一个弹出窗口
  701. open: function (url, title, options) {
  702. title = title ? title : "";
  703. url = Fast.api.fixurl(url);
  704. url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
  705. var area = [$(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%'];
  706. options = $.extend({
  707. type: 2,
  708. title: title,
  709. shadeClose: true,
  710. shade: false,
  711. maxmin: true,
  712. moveOut: true,
  713. area: area,
  714. content: url,
  715. zIndex: Layer.zIndex,
  716. success: function (layero, index) {
  717. var that = this;
  718. //存储callback事件
  719. $(layero).data("callback", that.callback);
  720. //$(layero).removeClass("layui-layer-border");
  721. Layer.setTop(layero);
  722. var frame = Layer.getChildFrame('html', index);
  723. var layerfooter = frame.find(".layer-footer");
  724. Fast.api.layerfooter(layero, index, that);
  725. //绑定事件
  726. if (layerfooter.size() > 0) {
  727. // 监听窗口内的元素及属性变化
  728. // Firefox和Chrome早期版本中带有前缀
  729. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver
  730. // 选择目标节点
  731. var target = layerfooter[0];
  732. // 创建观察者对象
  733. var observer = new MutationObserver(function (mutations) {
  734. Fast.api.layerfooter(layero, index, that);
  735. mutations.forEach(function (mutation) {
  736. });
  737. });
  738. // 配置观察选项:
  739. var config = {attributes: true, childList: true, characterData: true, subtree: true}
  740. // 传入目标节点和观察选项
  741. observer.observe(target, config);
  742. // 随后,你还可以停止观察
  743. // observer.disconnect();
  744. }
  745. }
  746. }, options ? options : {});
  747. if ($(window).width() < 480 || (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && top.$(".tab-pane.active").size() > 0)) {
  748. options.area = [top.$(".tab-pane.active").width() + "px", top.$(".tab-pane.active").height() + "px"];
  749. options.offset = [top.$(".tab-pane.active").scrollTop() + "px", "0px"];
  750. }
  751. return Layer.open(options);
  752. },
  753. //关闭窗口并回传数据
  754. close: function (data) {
  755. var index = parent.Layer.getFrameIndex(window.name);
  756. var callback = parent.$("#layui-layer" + index).data("callback");
  757. //再执行关闭
  758. parent.Layer.close(index);
  759. //再调用回传函数
  760. if (typeof callback === 'function') {
  761. callback.call(undefined, data);
  762. }
  763. },
  764. layerfooter: function (layero, index, that) {
  765. var frame = Layer.getChildFrame('html', index);
  766. var layerfooter = frame.find(".layer-footer");
  767. if (layerfooter.size() > 0) {
  768. $(".layui-layer-footer", layero).remove();
  769. var footer = $("<div />").addClass('layui-layer-btn layui-layer-footer');
  770. footer.html(layerfooter.html());
  771. if ($(".row", footer).size() === 0) {
  772. $(">", footer).wrapAll("<div class='row'></div>");
  773. }
  774. footer.insertAfter(layero.find('.layui-layer-content'));
  775. //绑定事件
  776. footer.on("click", ".btn", function () {
  777. if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
  778. return;
  779. }
  780. $(".btn:eq(" + $(this).index() + ")", layerfooter).trigger("click");
  781. });
  782. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  783. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  784. //重设iframe高度
  785. $("iframe", layero).height(layero.height() - titHeight - btnHeight);
  786. }
  787. //修复iOS下弹出窗口的高度和iOS下iframe无法滚动的BUG
  788. if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
  789. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  790. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  791. $("iframe", layero).parent().css("height", layero.height() - titHeight - btnHeight);
  792. $("iframe", layero).css("height", "100%");
  793. }
  794. },
  795. success: function (options, callback) {
  796. var type = typeof options === 'function';
  797. if (type) {
  798. callback = options;
  799. }
  800. return Layer.msg(__('Operation completed'), $.extend({
  801. offset: 0, icon: 1
  802. }, type ? {} : options), callback);
  803. },
  804. error: function (options, callback) {
  805. var type = typeof options === 'function';
  806. if (type) {
  807. callback = options;
  808. }
  809. return Layer.msg(__('Operation failed'), $.extend({
  810. offset: 0, icon: 2
  811. }, type ? {} : options), callback);
  812. },
  813. toastr: Toastr,
  814. layer: Layer
  815. },
  816. lang: function () {
  817. var args = arguments,
  818. string = args[0],
  819. i = 1;
  820. string = string.toLowerCase();
  821. //string = typeof Lang[string] != 'undefined' ? Lang[string] : string;
  822. if (typeof Lang[string] != 'undefined') {
  823. if (typeof Lang[string] == 'object')
  824. return Lang[string];
  825. string = Lang[string];
  826. } else if (string.indexOf('.') !== -1 && false) {
  827. var arr = string.split('.');
  828. var current = Lang[arr[0]];
  829. for (var i = 1; i < arr.length; i++) {
  830. current = typeof current[arr[i]] != 'undefined' ? current[arr[i]] : '';
  831. if (typeof current != 'object')
  832. break;
  833. }
  834. if (typeof current == 'object')
  835. return current;
  836. string = current;
  837. } else {
  838. string = args[0];
  839. }
  840. return string.replace(/%((%)|s|d)/g, function (m) {
  841. // m is the matched format, e.g. %s, %d
  842. var val = null;
  843. if (m[2]) {
  844. val = m[2];
  845. } else {
  846. val = args[i];
  847. // A switch statement so that the formatter can be extended. Default is %s
  848. switch (m) {
  849. case '%d':
  850. val = parseFloat(val);
  851. if (isNaN(val)) {
  852. val = 0;
  853. }
  854. break;
  855. }
  856. i++;
  857. }
  858. return val;
  859. });
  860. },
  861. init: function () {
  862. // 对相对地址进行处理
  863. $.ajaxSetup({
  864. beforeSend: function (xhr, setting) {
  865. setting.url = Fast.api.fixurl(setting.url);
  866. }
  867. });
  868. Layer.config({
  869. skin: 'layui-layer-fast'
  870. });
  871. // 绑定ESC关闭窗口事件
  872. $(window).keyup(function (e) {
  873. if (e.keyCode == 27) {
  874. if ($(".layui-layer").size() > 0) {
  875. var index = 0;
  876. $(".layui-layer").each(function () {
  877. index = Math.max(index, parseInt($(this).attr("times")));
  878. });
  879. if (index) {
  880. Layer.close(index);
  881. }
  882. }
  883. }
  884. });
  885. //公共代码
  886. //配置Toastr的参数
  887. Toastr.options = Fast.config.toastr;
  888. }
  889. };
  890. //将Layer暴露到全局中去
  891. window.Layer = Layer;
  892. //将Toastr暴露到全局中去
  893. window.Toastr = Toastr;
  894. //将语言方法暴露到全局中去
  895. window.__ = Fast.lang;
  896. //将Fast渲染至全局
  897. window.Fast = Fast;
  898. //默认初始化执行的代码
  899. Fast.init();
  900. return Fast;
  901. });
  902. //! moment.js
  903. //! version : 2.15.2
  904. //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
  905. //! license : MIT
  906. //! momentjs.com
  907. ;(function (global, factory) {
  908. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  909. typeof define === 'function' && define.amd ? define('moment/moment',factory) :
  910. global.moment = factory()
  911. }(this, function () { 'use strict';
  912. var hookCallback;
  913. function utils_hooks__hooks () {
  914. return hookCallback.apply(null, arguments);
  915. }
  916. // This is done to register the method called with moment()
  917. // without creating circular dependencies.
  918. function setHookCallback (callback) {
  919. hookCallback = callback;
  920. }
  921. function isArray(input) {
  922. return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
  923. }
  924. function isObject(input) {
  925. // IE8 will treat undefined and null as object if it wasn't for
  926. // input != null
  927. return input != null && Object.prototype.toString.call(input) === '[object Object]';
  928. }
  929. function isObjectEmpty(obj) {
  930. var k;
  931. for (k in obj) {
  932. // even if its not own property I'd still call it non-empty
  933. return false;
  934. }
  935. return true;
  936. }
  937. function isDate(input) {
  938. return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
  939. }
  940. function map(arr, fn) {
  941. var res = [], i;
  942. for (i = 0; i < arr.length; ++i) {
  943. res.push(fn(arr[i], i));
  944. }
  945. return res;
  946. }
  947. function hasOwnProp(a, b) {
  948. return Object.prototype.hasOwnProperty.call(a, b);
  949. }
  950. function extend(a, b) {
  951. for (var i in b) {
  952. if (hasOwnProp(b, i)) {
  953. a[i] = b[i];
  954. }
  955. }
  956. if (hasOwnProp(b, 'toString')) {
  957. a.toString = b.toString;
  958. }
  959. if (hasOwnProp(b, 'valueOf')) {
  960. a.valueOf = b.valueOf;
  961. }
  962. return a;
  963. }
  964. function create_utc__createUTC (input, format, locale, strict) {
  965. return createLocalOrUTC(input, format, locale, strict, true).utc();
  966. }
  967. function defaultParsingFlags() {
  968. // We need to deep clone this object.
  969. return {
  970. empty : false,
  971. unusedTokens : [],
  972. unusedInput : [],
  973. overflow : -2,
  974. charsLeftOver : 0,
  975. nullInput : false,
  976. invalidMonth : null,
  977. invalidFormat : false,
  978. userInvalidated : false,
  979. iso : false,
  980. parsedDateParts : [],
  981. meridiem : null
  982. };
  983. }
  984. function getParsingFlags(m) {
  985. if (m._pf == null) {
  986. m._pf = defaultParsingFlags();
  987. }
  988. return m._pf;
  989. }
  990. var some;
  991. if (Array.prototype.some) {
  992. some = Array.prototype.some;
  993. } else {
  994. some = function (fun) {
  995. var t = Object(this);
  996. var len = t.length >>> 0;
  997. for (var i = 0; i < len; i++) {
  998. if (i in t && fun.call(this, t[i], i, t)) {
  999. return true;
  1000. }
  1001. }
  1002. return false;
  1003. };
  1004. }
  1005. function valid__isValid(m) {
  1006. if (m._isValid == null) {
  1007. var flags = getParsingFlags(m);
  1008. var parsedParts = some.call(flags.parsedDateParts, function (i) {
  1009. return i != null;
  1010. });
  1011. var isNowValid = !isNaN(m._d.getTime()) &&
  1012. flags.overflow < 0 &&
  1013. !flags.empty &&
  1014. !flags.invalidMonth &&
  1015. !flags.invalidWeekday &&
  1016. !flags.nullInput &&
  1017. !flags.invalidFormat &&
  1018. !flags.userInvalidated &&
  1019. (!flags.meridiem || (flags.meridiem && parsedParts));
  1020. if (m._strict) {
  1021. isNowValid = isNowValid &&
  1022. flags.charsLeftOver === 0 &&
  1023. flags.unusedTokens.length === 0 &&
  1024. flags.bigHour === undefined;
  1025. }
  1026. if (Object.isFrozen == null || !Object.isFrozen(m)) {
  1027. m._isValid = isNowValid;
  1028. }
  1029. else {
  1030. return isNowValid;
  1031. }
  1032. }
  1033. return m._isValid;
  1034. }
  1035. function valid__createInvalid (flags) {
  1036. var m = create_utc__createUTC(NaN);
  1037. if (flags != null) {
  1038. extend(getParsingFlags(m), flags);
  1039. }
  1040. else {
  1041. getParsingFlags(m).userInvalidated = true;
  1042. }
  1043. return m;
  1044. }
  1045. function isUndefined(input) {
  1046. return input === void 0;
  1047. }
  1048. // Plugins that add properties should also add the key here (null value),
  1049. // so we can properly clone ourselves.
  1050. var momentProperties = utils_hooks__hooks.momentProperties = [];
  1051. function copyConfig(to, from) {
  1052. var i, prop, val;
  1053. if (!isUndefined(from._isAMomentObject)) {
  1054. to._isAMomentObject = from._isAMomentObject;
  1055. }
  1056. if (!isUndefined(from._i)) {
  1057. to._i = from._i;
  1058. }
  1059. if (!isUndefined(from._f)) {
  1060. to._f = from._f;
  1061. }
  1062. if (!isUndefined(from._l)) {
  1063. to._l = from._l;
  1064. }
  1065. if (!isUndefined(from._strict)) {
  1066. to._strict = from._strict;
  1067. }
  1068. if (!isUndefined(from._tzm)) {
  1069. to._tzm = from._tzm;
  1070. }
  1071. if (!isUndefined(from._isUTC)) {
  1072. to._isUTC = from._isUTC;
  1073. }
  1074. if (!isUndefined(from._offset)) {
  1075. to._offset = from._offset;
  1076. }
  1077. if (!isUndefined(from._pf)) {
  1078. to._pf = getParsingFlags(from);
  1079. }
  1080. if (!isUndefined(from._locale)) {
  1081. to._locale = from._locale;
  1082. }
  1083. if (momentProperties.length > 0) {
  1084. for (i in momentProperties) {
  1085. prop = momentProperties[i];
  1086. val = from[prop];
  1087. if (!isUndefined(val)) {
  1088. to[prop] = val;
  1089. }
  1090. }
  1091. }
  1092. return to;
  1093. }
  1094. var updateInProgress = false;
  1095. // Moment prototype object
  1096. function Moment(config) {
  1097. copyConfig(this, config);
  1098. this._d = new Date(config._d != null ? config._d.getTime() : NaN);
  1099. // Prevent infinite loop in case updateOffset creates new moment
  1100. // objects.
  1101. if (updateInProgress === false) {
  1102. updateInProgress = true;
  1103. utils_hooks__hooks.updateOffset(this);
  1104. updateInProgress = false;
  1105. }
  1106. }
  1107. function isMoment (obj) {
  1108. return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
  1109. }
  1110. function absFloor (number) {
  1111. if (number < 0) {
  1112. // -0 -> 0
  1113. return Math.ceil(number) || 0;
  1114. } else {
  1115. return Math.floor(number);
  1116. }
  1117. }
  1118. function toInt(argumentForCoercion) {
  1119. var coercedNumber = +argumentForCoercion,
  1120. value = 0;
  1121. if (coercedNumber !== 0 && isFinite(coercedNumber)) {
  1122. value = absFloor(coercedNumber);
  1123. }
  1124. return value;
  1125. }
  1126. // compare two arrays, return the number of differences
  1127. function compareArrays(array1, array2, dontConvert) {
  1128. var len = Math.min(array1.length, array2.length),
  1129. lengthDiff = Math.abs(array1.length - array2.length),
  1130. diffs = 0,
  1131. i;
  1132. for (i = 0; i < len; i++) {
  1133. if ((dontConvert && array1[i] !== array2[i]) ||
  1134. (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
  1135. diffs++;
  1136. }
  1137. }
  1138. return diffs + lengthDiff;
  1139. }
  1140. function warn(msg) {
  1141. if (utils_hooks__hooks.suppressDeprecationWarnings === false &&
  1142. (typeof console !== 'undefined') && console.warn) {
  1143. console.warn('Deprecation warning: ' + msg);
  1144. }
  1145. }
  1146. function deprecate(msg, fn) {
  1147. var firstTime = true;
  1148. return extend(function () {
  1149. if (utils_hooks__hooks.deprecationHandler != null) {
  1150. utils_hooks__hooks.deprecationHandler(null, msg);
  1151. }
  1152. if (firstTime) {
  1153. var args = [];
  1154. var arg;
  1155. for (var i = 0; i < arguments.length; i++) {
  1156. arg = '';
  1157. if (typeof arguments[i] === 'object') {
  1158. arg += '\n[' + i + '] ';
  1159. for (var key in arguments[0]) {
  1160. arg += key + ': ' + arguments[0][key] + ', ';
  1161. }
  1162. arg = arg.slice(0, -2); // Remove trailing comma and space
  1163. } else {
  1164. arg = arguments[i];
  1165. }
  1166. args.push(arg);
  1167. }
  1168. warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack);
  1169. firstTime = false;
  1170. }
  1171. return fn.apply(this, arguments);
  1172. }, fn);
  1173. }
  1174. var deprecations = {};
  1175. function deprecateSimple(name, msg) {
  1176. if (utils_hooks__hooks.deprecationHandler != null) {
  1177. utils_hooks__hooks.deprecationHandler(name, msg);
  1178. }
  1179. if (!deprecations[name]) {
  1180. warn(msg);
  1181. deprecations[name] = true;
  1182. }
  1183. }
  1184. utils_hooks__hooks.suppressDeprecationWarnings = false;
  1185. utils_hooks__hooks.deprecationHandler = null;
  1186. function isFunction(input) {
  1187. return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
  1188. }
  1189. function locale_set__set (config) {
  1190. var prop, i;
  1191. for (i in config) {
  1192. prop = config[i];
  1193. if (isFunction(prop)) {
  1194. this[i] = prop;
  1195. } else {
  1196. this['_' + i] = prop;
  1197. }
  1198. }
  1199. this._config = config;
  1200. // Lenient ordinal parsing accepts just a number in addition to
  1201. // number + (possibly) stuff coming from _ordinalParseLenient.
  1202. this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source);
  1203. }
  1204. function mergeConfigs(parentConfig, childConfig) {
  1205. var res = extend({}, parentConfig), prop;
  1206. for (prop in childConfig) {
  1207. if (hasOwnProp(childConfig, prop)) {
  1208. if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
  1209. res[prop] = {};
  1210. extend(res[prop], parentConfig[prop]);
  1211. extend(res[prop], childConfig[prop]);
  1212. } else if (childConfig[prop] != null) {
  1213. res[prop] = childConfig[prop];
  1214. } else {
  1215. delete res[prop];
  1216. }
  1217. }
  1218. }
  1219. for (prop in parentConfig) {
  1220. if (hasOwnProp(parentConfig, prop) &&
  1221. !hasOwnProp(childConfig, prop) &&
  1222. isObject(parentConfig[prop])) {
  1223. // make sure changes to properties don't modify parent config
  1224. res[prop] = extend({}, res[prop]);
  1225. }
  1226. }
  1227. return res;
  1228. }
  1229. function Locale(config) {
  1230. if (config != null) {
  1231. this.set(config);
  1232. }
  1233. }
  1234. var keys;
  1235. if (Object.keys) {
  1236. keys = Object.keys;
  1237. } else {
  1238. keys = function (obj) {
  1239. var i, res = [];
  1240. for (i in obj) {
  1241. if (hasOwnProp(obj, i)) {
  1242. res.push(i);
  1243. }
  1244. }
  1245. return res;
  1246. };
  1247. }
  1248. var defaultCalendar = {
  1249. sameDay : '[Today at] LT',
  1250. nextDay : '[Tomorrow at] LT',
  1251. nextWeek : 'dddd [at] LT',
  1252. lastDay : '[Yesterday at] LT',
  1253. lastWeek : '[Last] dddd [at] LT',
  1254. sameElse : 'L'
  1255. };
  1256. function locale_calendar__calendar (key, mom, now) {
  1257. var output = this._calendar[key] || this._calendar['sameElse'];
  1258. return isFunction(output) ? output.call(mom, now) : output;
  1259. }
  1260. var defaultLongDateFormat = {
  1261. LTS : 'h:mm:ss A',
  1262. LT : 'h:mm A',
  1263. L : 'MM/DD/YYYY',
  1264. LL : 'MMMM D, YYYY',
  1265. LLL : 'MMMM D, YYYY h:mm A',
  1266. LLLL : 'dddd, MMMM D, YYYY h:mm A'
  1267. };
  1268. function longDateFormat (key) {
  1269. var format = this._longDateFormat[key],
  1270. formatUpper = this._longDateFormat[key.toUpperCase()];
  1271. if (format || !formatUpper) {
  1272. return format;
  1273. }
  1274. this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
  1275. return val.slice(1);
  1276. });
  1277. return this._longDateFormat[key];
  1278. }
  1279. var defaultInvalidDate = 'Invalid date';
  1280. function invalidDate () {
  1281. return this._invalidDate;
  1282. }
  1283. var defaultOrdinal = '%d';
  1284. var defaultOrdinalParse = /\d{1,2}/;
  1285. function ordinal (number) {
  1286. return this._ordinal.replace('%d', number);
  1287. }
  1288. var defaultRelativeTime = {
  1289. future : 'in %s',
  1290. past : '%s ago',
  1291. s : 'a few seconds',
  1292. m : 'a minute',
  1293. mm : '%d minutes',
  1294. h : 'an hour',
  1295. hh : '%d hours',
  1296. d : 'a day',
  1297. dd : '%d days',
  1298. M : 'a month',
  1299. MM : '%d months',
  1300. y : 'a year',
  1301. yy : '%d years'
  1302. };
  1303. function relative__relativeTime (number, withoutSuffix, string, isFuture) {
  1304. var output = this._relativeTime[string];
  1305. return (isFunction(output)) ?
  1306. output(number, withoutSuffix, string, isFuture) :
  1307. output.replace(/%d/i, number);
  1308. }
  1309. function pastFuture (diff, output) {
  1310. var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
  1311. return isFunction(format) ? format(output) : format.replace(/%s/i, output);
  1312. }
  1313. var aliases = {};
  1314. function addUnitAlias (unit, shorthand) {
  1315. var lowerCase = unit.toLowerCase();
  1316. aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
  1317. }
  1318. function normalizeUnits(units) {
  1319. return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
  1320. }
  1321. function normalizeObjectUnits(inputObject) {
  1322. var normalizedInput = {},
  1323. normalizedProp,
  1324. prop;
  1325. for (prop in inputObject) {
  1326. if (hasOwnProp(inputObject, prop)) {
  1327. normalizedProp = normalizeUnits(prop);
  1328. if (normalizedProp) {
  1329. normalizedInput[normalizedProp] = inputObject[prop];
  1330. }
  1331. }
  1332. }
  1333. return normalizedInput;
  1334. }
  1335. var priorities = {};
  1336. function addUnitPriority(unit, priority) {
  1337. priorities[unit] = priority;
  1338. }
  1339. function getPrioritizedUnits(unitsObj) {
  1340. var units = [];
  1341. for (var u in unitsObj) {
  1342. units.push({unit: u, priority: priorities[u]});
  1343. }
  1344. units.sort(function (a, b) {
  1345. return a.priority - b.priority;
  1346. });
  1347. return units;
  1348. }
  1349. function makeGetSet (unit, keepTime) {
  1350. return function (value) {
  1351. if (value != null) {
  1352. get_set__set(this, unit, value);
  1353. utils_hooks__hooks.updateOffset(this, keepTime);
  1354. return this;
  1355. } else {
  1356. return get_set__get(this, unit);
  1357. }
  1358. };
  1359. }
  1360. function get_set__get (mom, unit) {
  1361. return mom.isValid() ?
  1362. mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
  1363. }
  1364. function get_set__set (mom, unit, value) {
  1365. if (mom.isValid()) {
  1366. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
  1367. }
  1368. }
  1369. // MOMENTS
  1370. function stringGet (units) {
  1371. units = normalizeUnits(units);
  1372. if (isFunction(this[units])) {
  1373. return this[units]();
  1374. }
  1375. return this;
  1376. }
  1377. function stringSet (units, value) {
  1378. if (typeof units === 'object') {
  1379. units = normalizeObjectUnits(units);
  1380. var prioritized = getPrioritizedUnits(units);
  1381. for (var i = 0; i < prioritized.length; i++) {
  1382. this[prioritized[i].unit](units[prioritized[i].unit]);
  1383. }
  1384. } else {
  1385. units = normalizeUnits(units);
  1386. if (isFunction(this[units])) {
  1387. return this[units](value);
  1388. }
  1389. }
  1390. return this;
  1391. }
  1392. function zeroFill(number, targetLength, forceSign) {
  1393. var absNumber = '' + Math.abs(number),
  1394. zerosToFill = targetLength - absNumber.length,
  1395. sign = number >= 0;
  1396. return (sign ? (forceSign ? '+' : '') : '-') +
  1397. Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
  1398. }
  1399. var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
  1400. var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
  1401. var formatFunctions = {};
  1402. var formatTokenFunctions = {};
  1403. // token: 'M'
  1404. // padded: ['MM', 2]
  1405. // ordinal: 'Mo'
  1406. // callback: function () { this.month() + 1 }
  1407. function addFormatToken (token, padded, ordinal, callback) {
  1408. var func = callback;
  1409. if (typeof callback === 'string') {
  1410. func = function () {
  1411. return this[callback]();
  1412. };
  1413. }
  1414. if (token) {
  1415. formatTokenFunctions[token] = func;
  1416. }
  1417. if (padded) {
  1418. formatTokenFunctions[padded[0]] = function () {
  1419. return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
  1420. };
  1421. }
  1422. if (ordinal) {
  1423. formatTokenFunctions[ordinal] = function () {
  1424. return this.localeData().ordinal(func.apply(this, arguments), token);
  1425. };
  1426. }
  1427. }
  1428. function removeFormattingTokens(input) {
  1429. if (input.match(/\[[\s\S]/)) {
  1430. return input.replace(/^\[|\]$/g, '');
  1431. }
  1432. return input.replace(/\\/g, '');
  1433. }
  1434. function makeFormatFunction(format) {
  1435. var array = format.match(formattingTokens), i, length;
  1436. for (i = 0, length = array.length; i < length; i++) {
  1437. if (formatTokenFunctions[array[i]]) {
  1438. array[i] = formatTokenFunctions[array[i]];
  1439. } else {
  1440. array[i] = removeFormattingTokens(array[i]);
  1441. }
  1442. }
  1443. return function (mom) {
  1444. var output = '', i;
  1445. for (i = 0; i < length; i++) {
  1446. output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
  1447. }
  1448. return output;
  1449. };
  1450. }
  1451. // format date using native date object
  1452. function formatMoment(m, format) {
  1453. if (!m.isValid()) {
  1454. return m.localeData().invalidDate();
  1455. }
  1456. format = expandFormat(format, m.localeData());
  1457. formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
  1458. return formatFunctions[format](m);
  1459. }
  1460. function expandFormat(format, locale) {
  1461. var i = 5;
  1462. function replaceLongDateFormatTokens(input) {
  1463. return locale.longDateFormat(input) || input;
  1464. }
  1465. localFormattingTokens.lastIndex = 0;
  1466. while (i >= 0 && localFormattingTokens.test(format)) {
  1467. format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
  1468. localFormattingTokens.lastIndex = 0;
  1469. i -= 1;
  1470. }
  1471. return format;
  1472. }
  1473. var match1 = /\d/; // 0 - 9
  1474. var match2 = /\d\d/; // 00 - 99
  1475. var match3 = /\d{3}/; // 000 - 999
  1476. var match4 = /\d{4}/; // 0000 - 9999
  1477. var match6 = /[+-]?\d{6}/; // -999999 - 999999
  1478. var match1to2 = /\d\d?/; // 0 - 99
  1479. var match3to4 = /\d\d\d\d?/; // 999 - 9999
  1480. var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
  1481. var match1to3 = /\d{1,3}/; // 0 - 999
  1482. var match1to4 = /\d{1,4}/; // 0 - 9999
  1483. var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
  1484. var matchUnsigned = /\d+/; // 0 - inf
  1485. var matchSigned = /[+-]?\d+/; // -inf - inf
  1486. var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
  1487. var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
  1488. var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
  1489. // any word (or two) characters or numbers including two/three word month in arabic.
  1490. // includes scottish gaelic two word and hyphenated months
  1491. var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
  1492. var regexes = {};
  1493. function addRegexToken (token, regex, strictRegex) {
  1494. regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
  1495. return (isStrict && strictRegex) ? strictRegex : regex;
  1496. };
  1497. }
  1498. function getParseRegexForToken (token, config) {
  1499. if (!hasOwnProp(regexes, token)) {
  1500. return new RegExp(unescapeFormat(token));
  1501. }
  1502. return regexes[token](config._strict, config._locale);
  1503. }
  1504. // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
  1505. function unescapeFormat(s) {
  1506. return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
  1507. return p1 || p2 || p3 || p4;
  1508. }));
  1509. }
  1510. function regexEscape(s) {
  1511. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  1512. }
  1513. var tokens = {};
  1514. function addParseToken (token, callback) {
  1515. var i, func = callback;
  1516. if (typeof token === 'string') {
  1517. token = [token];
  1518. }
  1519. if (typeof callback === 'number') {
  1520. func = function (input, array) {
  1521. array[callback] = toInt(input);
  1522. };
  1523. }
  1524. for (i = 0; i < token.length; i++) {
  1525. tokens[token[i]] = func;
  1526. }
  1527. }
  1528. function addWeekParseToken (token, callback) {
  1529. addParseToken(token, function (input, array, config, token) {
  1530. config._w = config._w || {};
  1531. callback(input, config._w, config, token);
  1532. });
  1533. }
  1534. function addTimeToArrayFromToken(token, input, config) {
  1535. if (input != null && hasOwnProp(tokens, token)) {
  1536. tokens[token](input, config._a, config, token);
  1537. }
  1538. }
  1539. var YEAR = 0;
  1540. var MONTH = 1;
  1541. var DATE = 2;
  1542. var HOUR = 3;
  1543. var MINUTE = 4;
  1544. var SECOND = 5;
  1545. var MILLISECOND = 6;
  1546. var WEEK = 7;
  1547. var WEEKDAY = 8;
  1548. var indexOf;
  1549. if (Array.prototype.indexOf) {
  1550. indexOf = Array.prototype.indexOf;
  1551. } else {
  1552. indexOf = function (o) {
  1553. // I know
  1554. var i;
  1555. for (i = 0; i < this.length; ++i) {
  1556. if (this[i] === o) {
  1557. return i;
  1558. }
  1559. }
  1560. return -1;
  1561. };
  1562. }
  1563. function daysInMonth(year, month) {
  1564. return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
  1565. }
  1566. // FORMATTING
  1567. addFormatToken('M', ['MM', 2], 'Mo', function () {
  1568. return this.month() + 1;
  1569. });
  1570. addFormatToken('MMM', 0, 0, function (format) {
  1571. return this.localeData().monthsShort(this, format);
  1572. });
  1573. addFormatToken('MMMM', 0, 0, function (format) {
  1574. return this.localeData().months(this, format);
  1575. });
  1576. // ALIASES
  1577. addUnitAlias('month', 'M');
  1578. // PRIORITY
  1579. addUnitPriority('month', 8);
  1580. // PARSING
  1581. addRegexToken('M', match1to2);
  1582. addRegexToken('MM', match1to2, match2);
  1583. addRegexToken('MMM', function (isStrict, locale) {
  1584. return locale.monthsShortRegex(isStrict);
  1585. });
  1586. addRegexToken('MMMM', function (isStrict, locale) {
  1587. return locale.monthsRegex(isStrict);
  1588. });
  1589. addParseToken(['M', 'MM'], function (input, array) {
  1590. array[MONTH] = toInt(input) - 1;
  1591. });
  1592. addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
  1593. var month = config._locale.monthsParse(input, token, config._strict);
  1594. // if we didn't find a month name, mark the date as invalid.
  1595. if (month != null) {
  1596. array[MONTH] = month;
  1597. } else {
  1598. getParsingFlags(config).invalidMonth = input;
  1599. }
  1600. });
  1601. // LOCALES
  1602. var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
  1603. var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
  1604. function localeMonths (m, format) {
  1605. if (!m) {
  1606. return this._months;
  1607. }
  1608. return isArray(this._months) ? this._months[m.month()] :
  1609. this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
  1610. }
  1611. var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
  1612. function localeMonthsShort (m, format) {
  1613. if (!m) {
  1614. return this._monthsShort;
  1615. }
  1616. return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
  1617. this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
  1618. }
  1619. function units_month__handleStrictParse(monthName, format, strict) {
  1620. var i, ii, mom, llc = monthName.toLocaleLowerCase();
  1621. if (!this._monthsParse) {
  1622. // this is not used
  1623. this._monthsParse = [];
  1624. this._longMonthsParse = [];
  1625. this._shortMonthsParse = [];
  1626. for (i = 0; i < 12; ++i) {
  1627. mom = create_utc__createUTC([2000, i]);
  1628. this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
  1629. this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
  1630. }
  1631. }
  1632. if (strict) {
  1633. if (format === 'MMM') {
  1634. ii = indexOf.call(this._shortMonthsParse, llc);
  1635. return ii !== -1 ? ii : null;
  1636. } else {
  1637. ii = indexOf.call(this._longMonthsParse, llc);
  1638. return ii !== -1 ? ii : null;
  1639. }
  1640. } else {
  1641. if (format === 'MMM') {
  1642. ii = indexOf.call(this._shortMonthsParse, llc);
  1643. if (ii !== -1) {
  1644. return ii;
  1645. }
  1646. ii = indexOf.call(this._longMonthsParse, llc);
  1647. return ii !== -1 ? ii : null;
  1648. } else {
  1649. ii = indexOf.call(this._longMonthsParse, llc);
  1650. if (ii !== -1) {
  1651. return ii;
  1652. }
  1653. ii = indexOf.call(this._shortMonthsParse, llc);
  1654. return ii !== -1 ? ii : null;
  1655. }
  1656. }
  1657. }
  1658. function localeMonthsParse (monthName, format, strict) {
  1659. var i, mom, regex;
  1660. if (this._monthsParseExact) {
  1661. return units_month__handleStrictParse.call(this, monthName, format, strict);
  1662. }
  1663. if (!this._monthsParse) {
  1664. this._monthsParse = [];
  1665. this._longMonthsParse = [];
  1666. this._shortMonthsParse = [];
  1667. }
  1668. // TODO: add sorting
  1669. // Sorting makes sure if one month (or abbr) is a prefix of another
  1670. // see sorting in computeMonthsParse
  1671. for (i = 0; i < 12; i++) {
  1672. // make the regex if we don't have it already
  1673. mom = create_utc__createUTC([2000, i]);
  1674. if (strict && !this._longMonthsParse[i]) {
  1675. this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
  1676. this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
  1677. }
  1678. if (!strict && !this._monthsParse[i]) {
  1679. regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
  1680. this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
  1681. }
  1682. // test the regex
  1683. if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
  1684. return i;
  1685. } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
  1686. return i;
  1687. } else if (!strict && this._monthsParse[i].test(monthName)) {
  1688. return i;
  1689. }
  1690. }
  1691. }
  1692. // MOMENTS
  1693. function setMonth (mom, value) {
  1694. var dayOfMonth;
  1695. if (!mom.isValid()) {
  1696. // No op
  1697. return mom;
  1698. }
  1699. if (typeof value === 'string') {
  1700. if (/^\d+$/.test(value)) {
  1701. value = toInt(value);
  1702. } else {
  1703. value = mom.localeData().monthsParse(value);
  1704. // TODO: Another silent failure?
  1705. if (typeof value !== 'number') {
  1706. return mom;
  1707. }
  1708. }
  1709. }
  1710. dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
  1711. mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
  1712. return mom;
  1713. }
  1714. function getSetMonth (value) {
  1715. if (value != null) {
  1716. setMonth(this, value);
  1717. utils_hooks__hooks.updateOffset(this, true);
  1718. return this;
  1719. } else {
  1720. return get_set__get(this, 'Month');
  1721. }
  1722. }
  1723. function getDaysInMonth () {
  1724. return daysInMonth(this.year(), this.month());
  1725. }
  1726. var defaultMonthsShortRegex = matchWord;
  1727. function monthsShortRegex (isStrict) {
  1728. if (this._monthsParseExact) {
  1729. if (!hasOwnProp(this, '_monthsRegex')) {
  1730. computeMonthsParse.call(this);
  1731. }
  1732. if (isStrict) {
  1733. return this._monthsShortStrictRegex;
  1734. } else {
  1735. return this._monthsShortRegex;
  1736. }
  1737. } else {
  1738. if (!hasOwnProp(this, '_monthsShortRegex')) {
  1739. this._monthsShortRegex = defaultMonthsShortRegex;
  1740. }
  1741. return this._monthsShortStrictRegex && isStrict ?
  1742. this._monthsShortStrictRegex : this._monthsShortRegex;
  1743. }
  1744. }
  1745. var defaultMonthsRegex = matchWord;
  1746. function monthsRegex (isStrict) {
  1747. if (this._monthsParseExact) {
  1748. if (!hasOwnProp(this, '_monthsRegex')) {
  1749. computeMonthsParse.call(this);
  1750. }
  1751. if (isStrict) {
  1752. return this._monthsStrictRegex;
  1753. } else {
  1754. return this._monthsRegex;
  1755. }
  1756. } else {
  1757. if (!hasOwnProp(this, '_monthsRegex')) {
  1758. this._monthsRegex = defaultMonthsRegex;
  1759. }
  1760. return this._monthsStrictRegex && isStrict ?
  1761. this._monthsStrictRegex : this._monthsRegex;
  1762. }
  1763. }
  1764. function computeMonthsParse () {
  1765. function cmpLenRev(a, b) {
  1766. return b.length - a.length;
  1767. }
  1768. var shortPieces = [], longPieces = [], mixedPieces = [],
  1769. i, mom;
  1770. for (i = 0; i < 12; i++) {
  1771. // make the regex if we don't have it already
  1772. mom = create_utc__createUTC([2000, i]);
  1773. shortPieces.push(this.monthsShort(mom, ''));
  1774. longPieces.push(this.months(mom, ''));
  1775. mixedPieces.push(this.months(mom, ''));
  1776. mixedPieces.push(this.monthsShort(mom, ''));
  1777. }
  1778. // Sorting makes sure if one month (or abbr) is a prefix of another it
  1779. // will match the longer piece.
  1780. shortPieces.sort(cmpLenRev);
  1781. longPieces.sort(cmpLenRev);
  1782. mixedPieces.sort(cmpLenRev);
  1783. for (i = 0; i < 12; i++) {
  1784. shortPieces[i] = regexEscape(shortPieces[i]);
  1785. longPieces[i] = regexEscape(longPieces[i]);
  1786. }
  1787. for (i = 0; i < 24; i++) {
  1788. mixedPieces[i] = regexEscape(mixedPieces[i]);
  1789. }
  1790. this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  1791. this._monthsShortRegex = this._monthsRegex;
  1792. this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
  1793. this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
  1794. }
  1795. // FORMATTING
  1796. addFormatToken('Y', 0, 0, function () {
  1797. var y = this.year();
  1798. return y <= 9999 ? '' + y : '+' + y;
  1799. });
  1800. addFormatToken(0, ['YY', 2], 0, function () {
  1801. return this.year() % 100;
  1802. });
  1803. addFormatToken(0, ['YYYY', 4], 0, 'year');
  1804. addFormatToken(0, ['YYYYY', 5], 0, 'year');
  1805. addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
  1806. // ALIASES
  1807. addUnitAlias('year', 'y');
  1808. // PRIORITIES
  1809. addUnitPriority('year', 1);
  1810. // PARSING
  1811. addRegexToken('Y', matchSigned);
  1812. addRegexToken('YY', match1to2, match2);
  1813. addRegexToken('YYYY', match1to4, match4);
  1814. addRegexToken('YYYYY', match1to6, match6);
  1815. addRegexToken('YYYYYY', match1to6, match6);
  1816. addParseToken(['YYYYY', 'YYYYYY'], YEAR);
  1817. addParseToken('YYYY', function (input, array) {
  1818. array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input);
  1819. });
  1820. addParseToken('YY', function (input, array) {
  1821. array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input);
  1822. });
  1823. addParseToken('Y', function (input, array) {
  1824. array[YEAR] = parseInt(input, 10);
  1825. });
  1826. // HELPERS
  1827. function daysInYear(year) {
  1828. return isLeapYear(year) ? 366 : 365;
  1829. }
  1830. function isLeapYear(year) {
  1831. return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
  1832. }
  1833. // HOOKS
  1834. utils_hooks__hooks.parseTwoDigitYear = function (input) {
  1835. return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
  1836. };
  1837. // MOMENTS
  1838. var getSetYear = makeGetSet('FullYear', true);
  1839. function getIsLeapYear () {
  1840. return isLeapYear(this.year());
  1841. }
  1842. function createDate (y, m, d, h, M, s, ms) {
  1843. //can't just apply() to create a date:
  1844. //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
  1845. var date = new Date(y, m, d, h, M, s, ms);
  1846. //the date constructor remaps years 0-99 to 1900-1999
  1847. if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
  1848. date.setFullYear(y);
  1849. }
  1850. return date;
  1851. }
  1852. function createUTCDate (y) {
  1853. var date = new Date(Date.UTC.apply(null, arguments));
  1854. //the Date.UTC function remaps years 0-99 to 1900-1999
  1855. if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
  1856. date.setUTCFullYear(y);
  1857. }
  1858. return date;
  1859. }
  1860. // start-of-first-week - start-of-year
  1861. function firstWeekOffset(year, dow, doy) {
  1862. var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
  1863. fwd = 7 + dow - doy,
  1864. // first-week day local weekday -- which local weekday is fwd
  1865. fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  1866. return -fwdlw + fwd - 1;
  1867. }
  1868. //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
  1869. function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  1870. var localWeekday = (7 + weekday - dow) % 7,
  1871. weekOffset = firstWeekOffset(year, dow, doy),
  1872. dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
  1873. resYear, resDayOfYear;
  1874. if (dayOfYear <= 0) {
  1875. resYear = year - 1;
  1876. resDayOfYear = daysInYear(resYear) + dayOfYear;
  1877. } else if (dayOfYear > daysInYear(year)) {
  1878. resYear = year + 1;
  1879. resDayOfYear = dayOfYear - daysInYear(year);
  1880. } else {
  1881. resYear = year;
  1882. resDayOfYear = dayOfYear;
  1883. }
  1884. return {
  1885. year: resYear,
  1886. dayOfYear: resDayOfYear
  1887. };
  1888. }
  1889. function weekOfYear(mom, dow, doy) {
  1890. var weekOffset = firstWeekOffset(mom.year(), dow, doy),
  1891. week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
  1892. resWeek, resYear;
  1893. if (week < 1) {
  1894. resYear = mom.year() - 1;
  1895. resWeek = week + weeksInYear(resYear, dow, doy);
  1896. } else if (week > weeksInYear(mom.year(), dow, doy)) {
  1897. resWeek = week - weeksInYear(mom.year(), dow, doy);
  1898. resYear = mom.year() + 1;
  1899. } else {
  1900. resYear = mom.year();
  1901. resWeek = week;
  1902. }
  1903. return {
  1904. week: resWeek,
  1905. year: resYear
  1906. };
  1907. }
  1908. function weeksInYear(year, dow, doy) {
  1909. var weekOffset = firstWeekOffset(year, dow, doy),
  1910. weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  1911. return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
  1912. }
  1913. // FORMATTING
  1914. addFormatToken('w', ['ww', 2], 'wo', 'week');
  1915. addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
  1916. // ALIASES
  1917. addUnitAlias('week', 'w');
  1918. addUnitAlias('isoWeek', 'W');
  1919. // PRIORITIES
  1920. addUnitPriority('week', 5);
  1921. addUnitPriority('isoWeek', 5);
  1922. // PARSING
  1923. addRegexToken('w', match1to2);
  1924. addRegexToken('ww', match1to2, match2);
  1925. addRegexToken('W', match1to2);
  1926. addRegexToken('WW', match1to2, match2);
  1927. addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
  1928. week[token.substr(0, 1)] = toInt(input);
  1929. });
  1930. // HELPERS
  1931. // LOCALES
  1932. function localeWeek (mom) {
  1933. return weekOfYear(mom, this._week.dow, this._week.doy).week;
  1934. }
  1935. var defaultLocaleWeek = {
  1936. dow : 0, // Sunday is the first day of the week.
  1937. doy : 6 // The week that contains Jan 1st is the first week of the year.
  1938. };
  1939. function localeFirstDayOfWeek () {
  1940. return this._week.dow;
  1941. }
  1942. function localeFirstDayOfYear () {
  1943. return this._week.doy;
  1944. }
  1945. // MOMENTS
  1946. function getSetWeek (input) {
  1947. var week = this.localeData().week(this);
  1948. return input == null ? week : this.add((input - week) * 7, 'd');
  1949. }
  1950. function getSetISOWeek (input) {
  1951. var week = weekOfYear(this, 1, 4).week;
  1952. return input == null ? week : this.add((input - week) * 7, 'd');
  1953. }
  1954. // FORMATTING
  1955. addFormatToken('d', 0, 'do', 'day');
  1956. addFormatToken('dd', 0, 0, function (format) {
  1957. return this.localeData().weekdaysMin(this, format);
  1958. });
  1959. addFormatToken('ddd', 0, 0, function (format) {
  1960. return this.localeData().weekdaysShort(this, format);
  1961. });
  1962. addFormatToken('dddd', 0, 0, function (format) {
  1963. return this.localeData().weekdays(this, format);
  1964. });
  1965. addFormatToken('e', 0, 0, 'weekday');
  1966. addFormatToken('E', 0, 0, 'isoWeekday');
  1967. // ALIASES
  1968. addUnitAlias('day', 'd');
  1969. addUnitAlias('weekday', 'e');
  1970. addUnitAlias('isoWeekday', 'E');
  1971. // PRIORITY
  1972. addUnitPriority('day', 11);
  1973. addUnitPriority('weekday', 11);
  1974. addUnitPriority('isoWeekday', 11);
  1975. // PARSING
  1976. addRegexToken('d', match1to2);
  1977. addRegexToken('e', match1to2);
  1978. addRegexToken('E', match1to2);
  1979. addRegexToken('dd', function (isStrict, locale) {
  1980. return locale.weekdaysMinRegex(isStrict);
  1981. });
  1982. addRegexToken('ddd', function (isStrict, locale) {
  1983. return locale.weekdaysShortRegex(isStrict);
  1984. });
  1985. addRegexToken('dddd', function (isStrict, locale) {
  1986. return locale.weekdaysRegex(isStrict);
  1987. });
  1988. addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
  1989. var weekday = config._locale.weekdaysParse(input, token, config._strict);
  1990. // if we didn't get a weekday name, mark the date as invalid
  1991. if (weekday != null) {
  1992. week.d = weekday;
  1993. } else {
  1994. getParsingFlags(config).invalidWeekday = input;
  1995. }
  1996. });
  1997. addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
  1998. week[token] = toInt(input);
  1999. });
  2000. // HELPERS
  2001. function parseWeekday(input, locale) {
  2002. if (typeof input !== 'string') {
  2003. return input;
  2004. }
  2005. if (!isNaN(input)) {
  2006. return parseInt(input, 10);
  2007. }
  2008. input = locale.weekdaysParse(input);
  2009. if (typeof input === 'number') {
  2010. return input;
  2011. }
  2012. return null;
  2013. }
  2014. function parseIsoWeekday(input, locale) {
  2015. if (typeof input === 'string') {
  2016. return locale.weekdaysParse(input) % 7 || 7;
  2017. }
  2018. return isNaN(input) ? null : input;
  2019. }
  2020. // LOCALES
  2021. var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
  2022. function localeWeekdays (m, format) {
  2023. if (!m) {
  2024. return this._weekdays;
  2025. }
  2026. return isArray(this._weekdays) ? this._weekdays[m.day()] :
  2027. this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()];
  2028. }
  2029. var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
  2030. function localeWeekdaysShort (m) {
  2031. return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
  2032. }
  2033. var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
  2034. function localeWeekdaysMin (m) {
  2035. return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
  2036. }
  2037. function day_of_week__handleStrictParse(weekdayName, format, strict) {
  2038. var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
  2039. if (!this._weekdaysParse) {
  2040. this._weekdaysParse = [];
  2041. this._shortWeekdaysParse = [];
  2042. this._minWeekdaysParse = [];
  2043. for (i = 0; i < 7; ++i) {
  2044. mom = create_utc__createUTC([2000, 1]).day(i);
  2045. this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
  2046. this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
  2047. this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
  2048. }
  2049. }
  2050. if (strict) {
  2051. if (format === 'dddd') {
  2052. ii = indexOf.call(this._weekdaysParse, llc);
  2053. return ii !== -1 ? ii : null;
  2054. } else if (format === 'ddd') {
  2055. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2056. return ii !== -1 ? ii : null;
  2057. } else {
  2058. ii = indexOf.call(this._minWeekdaysParse, llc);
  2059. return ii !== -1 ? ii : null;
  2060. }
  2061. } else {
  2062. if (format === 'dddd') {
  2063. ii = indexOf.call(this._weekdaysParse, llc);
  2064. if (ii !== -1) {
  2065. return ii;
  2066. }
  2067. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2068. if (ii !== -1) {
  2069. return ii;
  2070. }
  2071. ii = indexOf.call(this._minWeekdaysParse, llc);
  2072. return ii !== -1 ? ii : null;
  2073. } else if (format === 'ddd') {
  2074. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2075. if (ii !== -1) {
  2076. return ii;
  2077. }
  2078. ii = indexOf.call(this._weekdaysParse, llc);
  2079. if (ii !== -1) {
  2080. return ii;
  2081. }
  2082. ii = indexOf.call(this._minWeekdaysParse, llc);
  2083. return ii !== -1 ? ii : null;
  2084. } else {
  2085. ii = indexOf.call(this._minWeekdaysParse, llc);
  2086. if (ii !== -1) {
  2087. return ii;
  2088. }
  2089. ii = indexOf.call(this._weekdaysParse, llc);
  2090. if (ii !== -1) {
  2091. return ii;
  2092. }
  2093. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2094. return ii !== -1 ? ii : null;
  2095. }
  2096. }
  2097. }
  2098. function localeWeekdaysParse (weekdayName, format, strict) {
  2099. var i, mom, regex;
  2100. if (this._weekdaysParseExact) {
  2101. return day_of_week__handleStrictParse.call(this, weekdayName, format, strict);
  2102. }
  2103. if (!this._weekdaysParse) {
  2104. this._weekdaysParse = [];
  2105. this._minWeekdaysParse = [];
  2106. this._shortWeekdaysParse = [];
  2107. this._fullWeekdaysParse = [];
  2108. }
  2109. for (i = 0; i < 7; i++) {
  2110. // make the regex if we don't have it already
  2111. mom = create_utc__createUTC([2000, 1]).day(i);
  2112. if (strict && !this._fullWeekdaysParse[i]) {
  2113. this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
  2114. this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
  2115. this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
  2116. }
  2117. if (!this._weekdaysParse[i]) {
  2118. regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
  2119. this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
  2120. }
  2121. // test the regex
  2122. if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
  2123. return i;
  2124. } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
  2125. return i;
  2126. } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
  2127. return i;
  2128. } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
  2129. return i;
  2130. }
  2131. }
  2132. }
  2133. // MOMENTS
  2134. function getSetDayOfWeek (input) {
  2135. if (!this.isValid()) {
  2136. return input != null ? this : NaN;
  2137. }
  2138. var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
  2139. if (input != null) {
  2140. input = parseWeekday(input, this.localeData());
  2141. return this.add(input - day, 'd');
  2142. } else {
  2143. return day;
  2144. }
  2145. }
  2146. function getSetLocaleDayOfWeek (input) {
  2147. if (!this.isValid()) {
  2148. return input != null ? this : NaN;
  2149. }
  2150. var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  2151. return input == null ? weekday : this.add(input - weekday, 'd');
  2152. }
  2153. function getSetISODayOfWeek (input) {
  2154. if (!this.isValid()) {
  2155. return input != null ? this : NaN;
  2156. }
  2157. // behaves the same as moment#day except
  2158. // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
  2159. // as a setter, sunday should belong to the previous week.
  2160. if (input != null) {
  2161. var weekday = parseIsoWeekday(input, this.localeData());
  2162. return this.day(this.day() % 7 ? weekday : weekday - 7);
  2163. } else {
  2164. return this.day() || 7;
  2165. }
  2166. }
  2167. var defaultWeekdaysRegex = matchWord;
  2168. function weekdaysRegex (isStrict) {
  2169. if (this._weekdaysParseExact) {
  2170. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2171. computeWeekdaysParse.call(this);
  2172. }
  2173. if (isStrict) {
  2174. return this._weekdaysStrictRegex;
  2175. } else {
  2176. return this._weekdaysRegex;
  2177. }
  2178. } else {
  2179. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2180. this._weekdaysRegex = defaultWeekdaysRegex;
  2181. }
  2182. return this._weekdaysStrictRegex && isStrict ?
  2183. this._weekdaysStrictRegex : this._weekdaysRegex;
  2184. }
  2185. }
  2186. var defaultWeekdaysShortRegex = matchWord;
  2187. function weekdaysShortRegex (isStrict) {
  2188. if (this._weekdaysParseExact) {
  2189. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2190. computeWeekdaysParse.call(this);
  2191. }
  2192. if (isStrict) {
  2193. return this._weekdaysShortStrictRegex;
  2194. } else {
  2195. return this._weekdaysShortRegex;
  2196. }
  2197. } else {
  2198. if (!hasOwnProp(this, '_weekdaysShortRegex')) {
  2199. this._weekdaysShortRegex = defaultWeekdaysShortRegex;
  2200. }
  2201. return this._weekdaysShortStrictRegex && isStrict ?
  2202. this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
  2203. }
  2204. }
  2205. var defaultWeekdaysMinRegex = matchWord;
  2206. function weekdaysMinRegex (isStrict) {
  2207. if (this._weekdaysParseExact) {
  2208. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2209. computeWeekdaysParse.call(this);
  2210. }
  2211. if (isStrict) {
  2212. return this._weekdaysMinStrictRegex;
  2213. } else {
  2214. return this._weekdaysMinRegex;
  2215. }
  2216. } else {
  2217. if (!hasOwnProp(this, '_weekdaysMinRegex')) {
  2218. this._weekdaysMinRegex = defaultWeekdaysMinRegex;
  2219. }
  2220. return this._weekdaysMinStrictRegex && isStrict ?
  2221. this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
  2222. }
  2223. }
  2224. function computeWeekdaysParse () {
  2225. function cmpLenRev(a, b) {
  2226. return b.length - a.length;
  2227. }
  2228. var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [],
  2229. i, mom, minp, shortp, longp;
  2230. for (i = 0; i < 7; i++) {
  2231. // make the regex if we don't have it already
  2232. mom = create_utc__createUTC([2000, 1]).day(i);
  2233. minp = this.weekdaysMin(mom, '');
  2234. shortp = this.weekdaysShort(mom, '');
  2235. longp = this.weekdays(mom, '');
  2236. minPieces.push(minp);
  2237. shortPieces.push(shortp);
  2238. longPieces.push(longp);
  2239. mixedPieces.push(minp);
  2240. mixedPieces.push(shortp);
  2241. mixedPieces.push(longp);
  2242. }
  2243. // Sorting makes sure if one weekday (or abbr) is a prefix of another it
  2244. // will match the longer piece.
  2245. minPieces.sort(cmpLenRev);
  2246. shortPieces.sort(cmpLenRev);
  2247. longPieces.sort(cmpLenRev);
  2248. mixedPieces.sort(cmpLenRev);
  2249. for (i = 0; i < 7; i++) {
  2250. shortPieces[i] = regexEscape(shortPieces[i]);
  2251. longPieces[i] = regexEscape(longPieces[i]);
  2252. mixedPieces[i] = regexEscape(mixedPieces[i]);
  2253. }
  2254. this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  2255. this._weekdaysShortRegex = this._weekdaysRegex;
  2256. this._weekdaysMinRegex = this._weekdaysRegex;
  2257. this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
  2258. this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
  2259. this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
  2260. }
  2261. // FORMATTING
  2262. function hFormat() {
  2263. return this.hours() % 12 || 12;
  2264. }
  2265. function kFormat() {
  2266. return this.hours() || 24;
  2267. }
  2268. addFormatToken('H', ['HH', 2], 0, 'hour');
  2269. addFormatToken('h', ['hh', 2], 0, hFormat);
  2270. addFormatToken('k', ['kk', 2], 0, kFormat);
  2271. addFormatToken('hmm', 0, 0, function () {
  2272. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
  2273. });
  2274. addFormatToken('hmmss', 0, 0, function () {
  2275. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
  2276. zeroFill(this.seconds(), 2);
  2277. });
  2278. addFormatToken('Hmm', 0, 0, function () {
  2279. return '' + this.hours() + zeroFill(this.minutes(), 2);
  2280. });
  2281. addFormatToken('Hmmss', 0, 0, function () {
  2282. return '' + this.hours() + zeroFill(this.minutes(), 2) +
  2283. zeroFill(this.seconds(), 2);
  2284. });
  2285. function meridiem (token, lowercase) {
  2286. addFormatToken(token, 0, 0, function () {
  2287. return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
  2288. });
  2289. }
  2290. meridiem('a', true);
  2291. meridiem('A', false);
  2292. // ALIASES
  2293. addUnitAlias('hour', 'h');
  2294. // PRIORITY
  2295. addUnitPriority('hour', 13);
  2296. // PARSING
  2297. function matchMeridiem (isStrict, locale) {
  2298. return locale._meridiemParse;
  2299. }
  2300. addRegexToken('a', matchMeridiem);
  2301. addRegexToken('A', matchMeridiem);
  2302. addRegexToken('H', match1to2);
  2303. addRegexToken('h', match1to2);
  2304. addRegexToken('HH', match1to2, match2);
  2305. addRegexToken('hh', match1to2, match2);
  2306. addRegexToken('hmm', match3to4);
  2307. addRegexToken('hmmss', match5to6);
  2308. addRegexToken('Hmm', match3to4);
  2309. addRegexToken('Hmmss', match5to6);
  2310. addParseToken(['H', 'HH'], HOUR);
  2311. addParseToken(['a', 'A'], function (input, array, config) {
  2312. config._isPm = config._locale.isPM(input);
  2313. config._meridiem = input;
  2314. });
  2315. addParseToken(['h', 'hh'], function (input, array, config) {
  2316. array[HOUR] = toInt(input);
  2317. getParsingFlags(config).bigHour = true;
  2318. });
  2319. addParseToken('hmm', function (input, array, config) {
  2320. var pos = input.length - 2;
  2321. array[HOUR] = toInt(input.substr(0, pos));
  2322. array[MINUTE] = toInt(input.substr(pos));
  2323. getParsingFlags(config).bigHour = true;
  2324. });
  2325. addParseToken('hmmss', function (input, array, config) {
  2326. var pos1 = input.length - 4;
  2327. var pos2 = input.length - 2;
  2328. array[HOUR] = toInt(input.substr(0, pos1));
  2329. array[MINUTE] = toInt(input.substr(pos1, 2));
  2330. array[SECOND] = toInt(input.substr(pos2));
  2331. getParsingFlags(config).bigHour = true;
  2332. });
  2333. addParseToken('Hmm', function (input, array, config) {
  2334. var pos = input.length - 2;
  2335. array[HOUR] = toInt(input.substr(0, pos));
  2336. array[MINUTE] = toInt(input.substr(pos));
  2337. });
  2338. addParseToken('Hmmss', function (input, array, config) {
  2339. var pos1 = input.length - 4;
  2340. var pos2 = input.length - 2;
  2341. array[HOUR] = toInt(input.substr(0, pos1));
  2342. array[MINUTE] = toInt(input.substr(pos1, 2));
  2343. array[SECOND] = toInt(input.substr(pos2));
  2344. });
  2345. // LOCALES
  2346. function localeIsPM (input) {
  2347. // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
  2348. // Using charAt should be more compatible.
  2349. return ((input + '').toLowerCase().charAt(0) === 'p');
  2350. }
  2351. var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
  2352. function localeMeridiem (hours, minutes, isLower) {
  2353. if (hours > 11) {
  2354. return isLower ? 'pm' : 'PM';
  2355. } else {
  2356. return isLower ? 'am' : 'AM';
  2357. }
  2358. }
  2359. // MOMENTS
  2360. // Setting the hour should keep the time, because the user explicitly
  2361. // specified which hour he wants. So trying to maintain the same hour (in
  2362. // a new timezone) makes sense. Adding/subtracting hours does not follow
  2363. // this rule.
  2364. var getSetHour = makeGetSet('Hours', true);
  2365. var baseConfig = {
  2366. calendar: defaultCalendar,
  2367. longDateFormat: defaultLongDateFormat,
  2368. invalidDate: defaultInvalidDate,
  2369. ordinal: defaultOrdinal,
  2370. ordinalParse: defaultOrdinalParse,
  2371. relativeTime: defaultRelativeTime,
  2372. months: defaultLocaleMonths,
  2373. monthsShort: defaultLocaleMonthsShort,
  2374. week: defaultLocaleWeek,
  2375. weekdays: defaultLocaleWeekdays,
  2376. weekdaysMin: defaultLocaleWeekdaysMin,
  2377. weekdaysShort: defaultLocaleWeekdaysShort,
  2378. meridiemParse: defaultLocaleMeridiemParse
  2379. };
  2380. // internal storage for locale config files
  2381. var locales = {};
  2382. var globalLocale;
  2383. function normalizeLocale(key) {
  2384. return key ? key.toLowerCase().replace('_', '-') : key;
  2385. }
  2386. // pick the locale from the array
  2387. // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
  2388. // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
  2389. function chooseLocale(names) {
  2390. var i = 0, j, next, locale, split;
  2391. while (i < names.length) {
  2392. split = normalizeLocale(names[i]).split('-');
  2393. j = split.length;
  2394. next = normalizeLocale(names[i + 1]);
  2395. next = next ? next.split('-') : null;
  2396. while (j > 0) {
  2397. locale = loadLocale(split.slice(0, j).join('-'));
  2398. if (locale) {
  2399. return locale;
  2400. }
  2401. if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
  2402. //the next array item is better than a shallower substring of this one
  2403. break;
  2404. }
  2405. j--;
  2406. }
  2407. i++;
  2408. }
  2409. return null;
  2410. }
  2411. function loadLocale(name) {
  2412. var oldLocale = null;
  2413. // TODO: Find a better way to register and load all the locales in Node
  2414. if (!locales[name] && (typeof module !== 'undefined') &&
  2415. module && module.exports) {
  2416. try {
  2417. oldLocale = globalLocale._abbr;
  2418. require('./locale/' + name);
  2419. // because defineLocale currently also sets the global locale, we
  2420. // want to undo that for lazy loaded locales
  2421. locale_locales__getSetGlobalLocale(oldLocale);
  2422. } catch (e) { }
  2423. }
  2424. return locales[name];
  2425. }
  2426. // This function will load locale and then set the global locale. If
  2427. // no arguments are passed in, it will simply return the current global
  2428. // locale key.
  2429. function locale_locales__getSetGlobalLocale (key, values) {
  2430. var data;
  2431. if (key) {
  2432. if (isUndefined(values)) {
  2433. data = locale_locales__getLocale(key);
  2434. }
  2435. else {
  2436. data = defineLocale(key, values);
  2437. }
  2438. if (data) {
  2439. // moment.duration._locale = moment._locale = data;
  2440. globalLocale = data;
  2441. }
  2442. }
  2443. return globalLocale._abbr;
  2444. }
  2445. function defineLocale (name, config) {
  2446. if (config !== null) {
  2447. var parentConfig = baseConfig;
  2448. config.abbr = name;
  2449. if (locales[name] != null) {
  2450. deprecateSimple('defineLocaleOverride',
  2451. 'use moment.updateLocale(localeName, config) to change ' +
  2452. 'an existing locale. moment.defineLocale(localeName, ' +
  2453. 'config) should only be used for creating a new locale ' +
  2454. 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
  2455. parentConfig = locales[name]._config;
  2456. } else if (config.parentLocale != null) {
  2457. if (locales[config.parentLocale] != null) {
  2458. parentConfig = locales[config.parentLocale]._config;
  2459. } else {
  2460. // treat as if there is no base config
  2461. deprecateSimple('parentLocaleUndefined',
  2462. 'specified parentLocale is not defined yet. See http://momentjs.com/guides/#/warnings/parent-locale/');
  2463. }
  2464. }
  2465. locales[name] = new Locale(mergeConfigs(parentConfig, config));
  2466. // backwards compat for now: also set the locale
  2467. locale_locales__getSetGlobalLocale(name);
  2468. return locales[name];
  2469. } else {
  2470. // useful for testing
  2471. delete locales[name];
  2472. return null;
  2473. }
  2474. }
  2475. function updateLocale(name, config) {
  2476. if (config != null) {
  2477. var locale, parentConfig = baseConfig;
  2478. // MERGE
  2479. if (locales[name] != null) {
  2480. parentConfig = locales[name]._config;
  2481. }
  2482. config = mergeConfigs(parentConfig, config);
  2483. locale = new Locale(config);
  2484. locale.parentLocale = locales[name];
  2485. locales[name] = locale;
  2486. // backwards compat for now: also set the locale
  2487. locale_locales__getSetGlobalLocale(name);
  2488. } else {
  2489. // pass null for config to unupdate, useful for tests
  2490. if (locales[name] != null) {
  2491. if (locales[name].parentLocale != null) {
  2492. locales[name] = locales[name].parentLocale;
  2493. } else if (locales[name] != null) {
  2494. delete locales[name];
  2495. }
  2496. }
  2497. }
  2498. return locales[name];
  2499. }
  2500. // returns locale data
  2501. function locale_locales__getLocale (key) {
  2502. var locale;
  2503. if (key && key._locale && key._locale._abbr) {
  2504. key = key._locale._abbr;
  2505. }
  2506. if (!key) {
  2507. return globalLocale;
  2508. }
  2509. if (!isArray(key)) {
  2510. //short-circuit everything else
  2511. locale = loadLocale(key);
  2512. if (locale) {
  2513. return locale;
  2514. }
  2515. key = [key];
  2516. }
  2517. return chooseLocale(key);
  2518. }
  2519. function locale_locales__listLocales() {
  2520. return keys(locales);
  2521. }
  2522. function checkOverflow (m) {
  2523. var overflow;
  2524. var a = m._a;
  2525. if (a && getParsingFlags(m).overflow === -2) {
  2526. overflow =
  2527. a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
  2528. a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
  2529. a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
  2530. a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
  2531. a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
  2532. a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
  2533. -1;
  2534. if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
  2535. overflow = DATE;
  2536. }
  2537. if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
  2538. overflow = WEEK;
  2539. }
  2540. if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
  2541. overflow = WEEKDAY;
  2542. }
  2543. getParsingFlags(m).overflow = overflow;
  2544. }
  2545. return m;
  2546. }
  2547. // iso 8601 regex
  2548. // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
  2549. var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;
  2550. var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/;
  2551. var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
  2552. var isoDates = [
  2553. ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
  2554. ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
  2555. ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
  2556. ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
  2557. ['YYYY-DDD', /\d{4}-\d{3}/],
  2558. ['YYYY-MM', /\d{4}-\d\d/, false],
  2559. ['YYYYYYMMDD', /[+-]\d{10}/],
  2560. ['YYYYMMDD', /\d{8}/],
  2561. // YYYYMM is NOT allowed by the standard
  2562. ['GGGG[W]WWE', /\d{4}W\d{3}/],
  2563. ['GGGG[W]WW', /\d{4}W\d{2}/, false],
  2564. ['YYYYDDD', /\d{7}/]
  2565. ];
  2566. // iso time formats and regexes
  2567. var isoTimes = [
  2568. ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
  2569. ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
  2570. ['HH:mm:ss', /\d\d:\d\d:\d\d/],
  2571. ['HH:mm', /\d\d:\d\d/],
  2572. ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
  2573. ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
  2574. ['HHmmss', /\d\d\d\d\d\d/],
  2575. ['HHmm', /\d\d\d\d/],
  2576. ['HH', /\d\d/]
  2577. ];
  2578. var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
  2579. // date from iso format
  2580. function configFromISO(config) {
  2581. var i, l,
  2582. string = config._i,
  2583. match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
  2584. allowTime, dateFormat, timeFormat, tzFormat;
  2585. if (match) {
  2586. getParsingFlags(config).iso = true;
  2587. for (i = 0, l = isoDates.length; i < l; i++) {
  2588. if (isoDates[i][1].exec(match[1])) {
  2589. dateFormat = isoDates[i][0];
  2590. allowTime = isoDates[i][2] !== false;
  2591. break;
  2592. }
  2593. }
  2594. if (dateFormat == null) {
  2595. config._isValid = false;
  2596. return;
  2597. }
  2598. if (match[3]) {
  2599. for (i = 0, l = isoTimes.length; i < l; i++) {
  2600. if (isoTimes[i][1].exec(match[3])) {
  2601. // match[2] should be 'T' or space
  2602. timeFormat = (match[2] || ' ') + isoTimes[i][0];
  2603. break;
  2604. }
  2605. }
  2606. if (timeFormat == null) {
  2607. config._isValid = false;
  2608. return;
  2609. }
  2610. }
  2611. if (!allowTime && timeFormat != null) {
  2612. config._isValid = false;
  2613. return;
  2614. }
  2615. if (match[4]) {
  2616. if (tzRegex.exec(match[4])) {
  2617. tzFormat = 'Z';
  2618. } else {
  2619. config._isValid = false;
  2620. return;
  2621. }
  2622. }
  2623. config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
  2624. configFromStringAndFormat(config);
  2625. } else {
  2626. config._isValid = false;
  2627. }
  2628. }
  2629. // date from iso format or fallback
  2630. function configFromString(config) {
  2631. var matched = aspNetJsonRegex.exec(config._i);
  2632. if (matched !== null) {
  2633. config._d = new Date(+matched[1]);
  2634. return;
  2635. }
  2636. configFromISO(config);
  2637. if (config._isValid === false) {
  2638. delete config._isValid;
  2639. utils_hooks__hooks.createFromInputFallback(config);
  2640. }
  2641. }
  2642. utils_hooks__hooks.createFromInputFallback = deprecate(
  2643. 'value provided is not in a recognized ISO format. moment construction falls back to js Date(), ' +
  2644. 'which is not reliable across all browsers and versions. Non ISO date formats are ' +
  2645. 'discouraged and will be removed in an upcoming major release. Please refer to ' +
  2646. 'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
  2647. function (config) {
  2648. config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
  2649. }
  2650. );
  2651. // Pick the first defined of two or three arguments.
  2652. function defaults(a, b, c) {
  2653. if (a != null) {
  2654. return a;
  2655. }
  2656. if (b != null) {
  2657. return b;
  2658. }
  2659. return c;
  2660. }
  2661. function currentDateArray(config) {
  2662. // hooks is actually the exported moment object
  2663. var nowValue = new Date(utils_hooks__hooks.now());
  2664. if (config._useUTC) {
  2665. return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
  2666. }
  2667. return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
  2668. }
  2669. // convert an array to a date.
  2670. // the array should mirror the parameters below
  2671. // note: all values past the year are optional and will default to the lowest possible value.
  2672. // [year, month, day , hour, minute, second, millisecond]
  2673. function configFromArray (config) {
  2674. var i, date, input = [], currentDate, yearToUse;
  2675. if (config._d) {
  2676. return;
  2677. }
  2678. currentDate = currentDateArray(config);
  2679. //compute day of the year from weeks and weekdays
  2680. if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
  2681. dayOfYearFromWeekInfo(config);
  2682. }
  2683. //if the day of the year is set, figure out what it is
  2684. if (config._dayOfYear) {
  2685. yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
  2686. if (config._dayOfYear > daysInYear(yearToUse)) {
  2687. getParsingFlags(config)._overflowDayOfYear = true;
  2688. }
  2689. date = createUTCDate(yearToUse, 0, config._dayOfYear);
  2690. config._a[MONTH] = date.getUTCMonth();
  2691. config._a[DATE] = date.getUTCDate();
  2692. }
  2693. // Default to current date.
  2694. // * if no year, month, day of month are given, default to today
  2695. // * if day of month is given, default month and year
  2696. // * if month is given, default only year
  2697. // * if year is given, don't default anything
  2698. for (i = 0; i < 3 && config._a[i] == null; ++i) {
  2699. config._a[i] = input[i] = currentDate[i];
  2700. }
  2701. // Zero out whatever was not defaulted, including time
  2702. for (; i < 7; i++) {
  2703. config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
  2704. }
  2705. // Check for 24:00:00.000
  2706. if (config._a[HOUR] === 24 &&
  2707. config._a[MINUTE] === 0 &&
  2708. config._a[SECOND] === 0 &&
  2709. config._a[MILLISECOND] === 0) {
  2710. config._nextDay = true;
  2711. config._a[HOUR] = 0;
  2712. }
  2713. config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
  2714. // Apply timezone offset from input. The actual utcOffset can be changed
  2715. // with parseZone.
  2716. if (config._tzm != null) {
  2717. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  2718. }
  2719. if (config._nextDay) {
  2720. config._a[HOUR] = 24;
  2721. }
  2722. }
  2723. function dayOfYearFromWeekInfo(config) {
  2724. var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
  2725. w = config._w;
  2726. if (w.GG != null || w.W != null || w.E != null) {
  2727. dow = 1;
  2728. doy = 4;
  2729. // TODO: We need to take the current isoWeekYear, but that depends on
  2730. // how we interpret now (local, utc, fixed offset). So create
  2731. // a now version of current config (take local/utc/offset flags, and
  2732. // create now).
  2733. weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year);
  2734. week = defaults(w.W, 1);
  2735. weekday = defaults(w.E, 1);
  2736. if (weekday < 1 || weekday > 7) {
  2737. weekdayOverflow = true;
  2738. }
  2739. } else {
  2740. dow = config._locale._week.dow;
  2741. doy = config._locale._week.doy;
  2742. weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year);
  2743. week = defaults(w.w, 1);
  2744. if (w.d != null) {
  2745. // weekday -- low day numbers are considered next week
  2746. weekday = w.d;
  2747. if (weekday < 0 || weekday > 6) {
  2748. weekdayOverflow = true;
  2749. }
  2750. } else if (w.e != null) {
  2751. // local weekday -- counting starts from begining of week
  2752. weekday = w.e + dow;
  2753. if (w.e < 0 || w.e > 6) {
  2754. weekdayOverflow = true;
  2755. }
  2756. } else {
  2757. // default to begining of week
  2758. weekday = dow;
  2759. }
  2760. }
  2761. if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
  2762. getParsingFlags(config)._overflowWeeks = true;
  2763. } else if (weekdayOverflow != null) {
  2764. getParsingFlags(config)._overflowWeekday = true;
  2765. } else {
  2766. temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
  2767. config._a[YEAR] = temp.year;
  2768. config._dayOfYear = temp.dayOfYear;
  2769. }
  2770. }
  2771. // constant that refers to the ISO standard
  2772. utils_hooks__hooks.ISO_8601 = function () {};
  2773. // date from string and format string
  2774. function configFromStringAndFormat(config) {
  2775. // TODO: Move this to another part of the creation flow to prevent circular deps
  2776. if (config._f === utils_hooks__hooks.ISO_8601) {
  2777. configFromISO(config);
  2778. return;
  2779. }
  2780. config._a = [];
  2781. getParsingFlags(config).empty = true;
  2782. // This array is used to make a Date, either with `new Date` or `Date.UTC`
  2783. var string = '' + config._i,
  2784. i, parsedInput, tokens, token, skipped,
  2785. stringLength = string.length,
  2786. totalParsedInputLength = 0;
  2787. tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
  2788. for (i = 0; i < tokens.length; i++) {
  2789. token = tokens[i];
  2790. parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
  2791. // console.log('token', token, 'parsedInput', parsedInput,
  2792. // 'regex', getParseRegexForToken(token, config));
  2793. if (parsedInput) {
  2794. skipped = string.substr(0, string.indexOf(parsedInput));
  2795. if (skipped.length > 0) {
  2796. getParsingFlags(config).unusedInput.push(skipped);
  2797. }
  2798. string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
  2799. totalParsedInputLength += parsedInput.length;
  2800. }
  2801. // don't parse if it's not a known token
  2802. if (formatTokenFunctions[token]) {
  2803. if (parsedInput) {
  2804. getParsingFlags(config).empty = false;
  2805. }
  2806. else {
  2807. getParsingFlags(config).unusedTokens.push(token);
  2808. }
  2809. addTimeToArrayFromToken(token, parsedInput, config);
  2810. }
  2811. else if (config._strict && !parsedInput) {
  2812. getParsingFlags(config).unusedTokens.push(token);
  2813. }
  2814. }
  2815. // add remaining unparsed input length to the string
  2816. getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
  2817. if (string.length > 0) {
  2818. getParsingFlags(config).unusedInput.push(string);
  2819. }
  2820. // clear _12h flag if hour is <= 12
  2821. if (config._a[HOUR] <= 12 &&
  2822. getParsingFlags(config).bigHour === true &&
  2823. config._a[HOUR] > 0) {
  2824. getParsingFlags(config).bigHour = undefined;
  2825. }
  2826. getParsingFlags(config).parsedDateParts = config._a.slice(0);
  2827. getParsingFlags(config).meridiem = config._meridiem;
  2828. // handle meridiem
  2829. config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
  2830. configFromArray(config);
  2831. checkOverflow(config);
  2832. }
  2833. function meridiemFixWrap (locale, hour, meridiem) {
  2834. var isPm;
  2835. if (meridiem == null) {
  2836. // nothing to do
  2837. return hour;
  2838. }
  2839. if (locale.meridiemHour != null) {
  2840. return locale.meridiemHour(hour, meridiem);
  2841. } else if (locale.isPM != null) {
  2842. // Fallback
  2843. isPm = locale.isPM(meridiem);
  2844. if (isPm && hour < 12) {
  2845. hour += 12;
  2846. }
  2847. if (!isPm && hour === 12) {
  2848. hour = 0;
  2849. }
  2850. return hour;
  2851. } else {
  2852. // this is not supposed to happen
  2853. return hour;
  2854. }
  2855. }
  2856. // date from string and array of format strings
  2857. function configFromStringAndArray(config) {
  2858. var tempConfig,
  2859. bestMoment,
  2860. scoreToBeat,
  2861. i,
  2862. currentScore;
  2863. if (config._f.length === 0) {
  2864. getParsingFlags(config).invalidFormat = true;
  2865. config._d = new Date(NaN);
  2866. return;
  2867. }
  2868. for (i = 0; i < config._f.length; i++) {
  2869. currentScore = 0;
  2870. tempConfig = copyConfig({}, config);
  2871. if (config._useUTC != null) {
  2872. tempConfig._useUTC = config._useUTC;
  2873. }
  2874. tempConfig._f = config._f[i];
  2875. configFromStringAndFormat(tempConfig);
  2876. if (!valid__isValid(tempConfig)) {
  2877. continue;
  2878. }
  2879. // if there is any input that was not parsed add a penalty for that format
  2880. currentScore += getParsingFlags(tempConfig).charsLeftOver;
  2881. //or tokens
  2882. currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
  2883. getParsingFlags(tempConfig).score = currentScore;
  2884. if (scoreToBeat == null || currentScore < scoreToBeat) {
  2885. scoreToBeat = currentScore;
  2886. bestMoment = tempConfig;
  2887. }
  2888. }
  2889. extend(config, bestMoment || tempConfig);
  2890. }
  2891. function configFromObject(config) {
  2892. if (config._d) {
  2893. return;
  2894. }
  2895. var i = normalizeObjectUnits(config._i);
  2896. config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
  2897. return obj && parseInt(obj, 10);
  2898. });
  2899. configFromArray(config);
  2900. }
  2901. function createFromConfig (config) {
  2902. var res = new Moment(checkOverflow(prepareConfig(config)));
  2903. if (res._nextDay) {
  2904. // Adding is smart enough around DST
  2905. res.add(1, 'd');
  2906. res._nextDay = undefined;
  2907. }
  2908. return res;
  2909. }
  2910. function prepareConfig (config) {
  2911. var input = config._i,
  2912. format = config._f;
  2913. config._locale = config._locale || locale_locales__getLocale(config._l);
  2914. if (input === null || (format === undefined && input === '')) {
  2915. return valid__createInvalid({nullInput: true});
  2916. }
  2917. if (typeof input === 'string') {
  2918. config._i = input = config._locale.preparse(input);
  2919. }
  2920. if (isMoment(input)) {
  2921. return new Moment(checkOverflow(input));
  2922. } else if (isArray(format)) {
  2923. configFromStringAndArray(config);
  2924. } else if (isDate(input)) {
  2925. config._d = input;
  2926. } else if (format) {
  2927. configFromStringAndFormat(config);
  2928. } else {
  2929. configFromInput(config);
  2930. }
  2931. if (!valid__isValid(config)) {
  2932. config._d = null;
  2933. }
  2934. return config;
  2935. }
  2936. function configFromInput(config) {
  2937. var input = config._i;
  2938. if (input === undefined) {
  2939. config._d = new Date(utils_hooks__hooks.now());
  2940. } else if (isDate(input)) {
  2941. config._d = new Date(input.valueOf());
  2942. } else if (typeof input === 'string') {
  2943. configFromString(config);
  2944. } else if (isArray(input)) {
  2945. config._a = map(input.slice(0), function (obj) {
  2946. return parseInt(obj, 10);
  2947. });
  2948. configFromArray(config);
  2949. } else if (typeof(input) === 'object') {
  2950. configFromObject(config);
  2951. } else if (typeof(input) === 'number') {
  2952. // from milliseconds
  2953. config._d = new Date(input);
  2954. } else {
  2955. utils_hooks__hooks.createFromInputFallback(config);
  2956. }
  2957. }
  2958. function createLocalOrUTC (input, format, locale, strict, isUTC) {
  2959. var c = {};
  2960. if (typeof(locale) === 'boolean') {
  2961. strict = locale;
  2962. locale = undefined;
  2963. }
  2964. if ((isObject(input) && isObjectEmpty(input)) ||
  2965. (isArray(input) && input.length === 0)) {
  2966. input = undefined;
  2967. }
  2968. // object construction must be done this way.
  2969. // https://github.com/moment/moment/issues/1423
  2970. c._isAMomentObject = true;
  2971. c._useUTC = c._isUTC = isUTC;
  2972. c._l = locale;
  2973. c._i = input;
  2974. c._f = format;
  2975. c._strict = strict;
  2976. return createFromConfig(c);
  2977. }
  2978. function local__createLocal (input, format, locale, strict) {
  2979. return createLocalOrUTC(input, format, locale, strict, false);
  2980. }
  2981. var prototypeMin = deprecate(
  2982. 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
  2983. function () {
  2984. var other = local__createLocal.apply(null, arguments);
  2985. if (this.isValid() && other.isValid()) {
  2986. return other < this ? this : other;
  2987. } else {
  2988. return valid__createInvalid();
  2989. }
  2990. }
  2991. );
  2992. var prototypeMax = deprecate(
  2993. 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
  2994. function () {
  2995. var other = local__createLocal.apply(null, arguments);
  2996. if (this.isValid() && other.isValid()) {
  2997. return other > this ? this : other;
  2998. } else {
  2999. return valid__createInvalid();
  3000. }
  3001. }
  3002. );
  3003. // Pick a moment m from moments so that m[fn](other) is true for all
  3004. // other. This relies on the function fn to be transitive.
  3005. //
  3006. // moments should either be an array of moment objects or an array, whose
  3007. // first element is an array of moment objects.
  3008. function pickBy(fn, moments) {
  3009. var res, i;
  3010. if (moments.length === 1 && isArray(moments[0])) {
  3011. moments = moments[0];
  3012. }
  3013. if (!moments.length) {
  3014. return local__createLocal();
  3015. }
  3016. res = moments[0];
  3017. for (i = 1; i < moments.length; ++i) {
  3018. if (!moments[i].isValid() || moments[i][fn](res)) {
  3019. res = moments[i];
  3020. }
  3021. }
  3022. return res;
  3023. }
  3024. // TODO: Use [].sort instead?
  3025. function min () {
  3026. var args = [].slice.call(arguments, 0);
  3027. return pickBy('isBefore', args);
  3028. }
  3029. function max () {
  3030. var args = [].slice.call(arguments, 0);
  3031. return pickBy('isAfter', args);
  3032. }
  3033. var now = function () {
  3034. return Date.now ? Date.now() : +(new Date());
  3035. };
  3036. function Duration (duration) {
  3037. var normalizedInput = normalizeObjectUnits(duration),
  3038. years = normalizedInput.year || 0,
  3039. quarters = normalizedInput.quarter || 0,
  3040. months = normalizedInput.month || 0,
  3041. weeks = normalizedInput.week || 0,
  3042. days = normalizedInput.day || 0,
  3043. hours = normalizedInput.hour || 0,
  3044. minutes = normalizedInput.minute || 0,
  3045. seconds = normalizedInput.second || 0,
  3046. milliseconds = normalizedInput.millisecond || 0;
  3047. // representation for dateAddRemove
  3048. this._milliseconds = +milliseconds +
  3049. seconds * 1e3 + // 1000
  3050. minutes * 6e4 + // 1000 * 60
  3051. hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
  3052. // Because of dateAddRemove treats 24 hours as different from a
  3053. // day when working around DST, we need to store them separately
  3054. this._days = +days +
  3055. weeks * 7;
  3056. // It is impossible translate months into days without knowing
  3057. // which months you are are talking about, so we have to store
  3058. // it separately.
  3059. this._months = +months +
  3060. quarters * 3 +
  3061. years * 12;
  3062. this._data = {};
  3063. this._locale = locale_locales__getLocale();
  3064. this._bubble();
  3065. }
  3066. function isDuration (obj) {
  3067. return obj instanceof Duration;
  3068. }
  3069. function absRound (number) {
  3070. if (number < 0) {
  3071. return Math.round(-1 * number) * -1;
  3072. } else {
  3073. return Math.round(number);
  3074. }
  3075. }
  3076. // FORMATTING
  3077. function offset (token, separator) {
  3078. addFormatToken(token, 0, 0, function () {
  3079. var offset = this.utcOffset();
  3080. var sign = '+';
  3081. if (offset < 0) {
  3082. offset = -offset;
  3083. sign = '-';
  3084. }
  3085. return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
  3086. });
  3087. }
  3088. offset('Z', ':');
  3089. offset('ZZ', '');
  3090. // PARSING
  3091. addRegexToken('Z', matchShortOffset);
  3092. addRegexToken('ZZ', matchShortOffset);
  3093. addParseToken(['Z', 'ZZ'], function (input, array, config) {
  3094. config._useUTC = true;
  3095. config._tzm = offsetFromString(matchShortOffset, input);
  3096. });
  3097. // HELPERS
  3098. // timezone chunker
  3099. // '+10:00' > ['10', '00']
  3100. // '-1530' > ['-15', '30']
  3101. var chunkOffset = /([\+\-]|\d\d)/gi;
  3102. function offsetFromString(matcher, string) {
  3103. var matches = ((string || '').match(matcher) || []);
  3104. var chunk = matches[matches.length - 1] || [];
  3105. var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
  3106. var minutes = +(parts[1] * 60) + toInt(parts[2]);
  3107. return parts[0] === '+' ? minutes : -minutes;
  3108. }
  3109. // Return a moment from input, that is local/utc/zone equivalent to model.
  3110. function cloneWithOffset(input, model) {
  3111. var res, diff;
  3112. if (model._isUTC) {
  3113. res = model.clone();
  3114. diff = (isMoment(input) || isDate(input) ? input.valueOf() : local__createLocal(input).valueOf()) - res.valueOf();
  3115. // Use low-level api, because this fn is low-level api.
  3116. res._d.setTime(res._d.valueOf() + diff);
  3117. utils_hooks__hooks.updateOffset(res, false);
  3118. return res;
  3119. } else {
  3120. return local__createLocal(input).local();
  3121. }
  3122. }
  3123. function getDateOffset (m) {
  3124. // On Firefox.24 Date#getTimezoneOffset returns a floating point.
  3125. // https://github.com/moment/moment/pull/1871
  3126. return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
  3127. }
  3128. // HOOKS
  3129. // This function will be called whenever a moment is mutated.
  3130. // It is intended to keep the offset in sync with the timezone.
  3131. utils_hooks__hooks.updateOffset = function () {};
  3132. // MOMENTS
  3133. // keepLocalTime = true means only change the timezone, without
  3134. // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
  3135. // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
  3136. // +0200, so we adjust the time as needed, to be valid.
  3137. //
  3138. // Keeping the time actually adds/subtracts (one hour)
  3139. // from the actual represented time. That is why we call updateOffset
  3140. // a second time. In case it wants us to change the offset again
  3141. // _changeInProgress == true case, then we have to adjust, because
  3142. // there is no such time in the given timezone.
  3143. function getSetOffset (input, keepLocalTime) {
  3144. var offset = this._offset || 0,
  3145. localAdjust;
  3146. if (!this.isValid()) {
  3147. return input != null ? this : NaN;
  3148. }
  3149. if (input != null) {
  3150. if (typeof input === 'string') {
  3151. input = offsetFromString(matchShortOffset, input);
  3152. } else if (Math.abs(input) < 16) {
  3153. input = input * 60;
  3154. }
  3155. if (!this._isUTC && keepLocalTime) {
  3156. localAdjust = getDateOffset(this);
  3157. }
  3158. this._offset = input;
  3159. this._isUTC = true;
  3160. if (localAdjust != null) {
  3161. this.add(localAdjust, 'm');
  3162. }
  3163. if (offset !== input) {
  3164. if (!keepLocalTime || this._changeInProgress) {
  3165. add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false);
  3166. } else if (!this._changeInProgress) {
  3167. this._changeInProgress = true;
  3168. utils_hooks__hooks.updateOffset(this, true);
  3169. this._changeInProgress = null;
  3170. }
  3171. }
  3172. return this;
  3173. } else {
  3174. return this._isUTC ? offset : getDateOffset(this);
  3175. }
  3176. }
  3177. function getSetZone (input, keepLocalTime) {
  3178. if (input != null) {
  3179. if (typeof input !== 'string') {
  3180. input = -input;
  3181. }
  3182. this.utcOffset(input, keepLocalTime);
  3183. return this;
  3184. } else {
  3185. return -this.utcOffset();
  3186. }
  3187. }
  3188. function setOffsetToUTC (keepLocalTime) {
  3189. return this.utcOffset(0, keepLocalTime);
  3190. }
  3191. function setOffsetToLocal (keepLocalTime) {
  3192. if (this._isUTC) {
  3193. this.utcOffset(0, keepLocalTime);
  3194. this._isUTC = false;
  3195. if (keepLocalTime) {
  3196. this.subtract(getDateOffset(this), 'm');
  3197. }
  3198. }
  3199. return this;
  3200. }
  3201. function setOffsetToParsedOffset () {
  3202. if (this._tzm) {
  3203. this.utcOffset(this._tzm);
  3204. } else if (typeof this._i === 'string') {
  3205. var tZone = offsetFromString(matchOffset, this._i);
  3206. if (tZone === 0) {
  3207. this.utcOffset(0, true);
  3208. } else {
  3209. this.utcOffset(offsetFromString(matchOffset, this._i));
  3210. }
  3211. }
  3212. return this;
  3213. }
  3214. function hasAlignedHourOffset (input) {
  3215. if (!this.isValid()) {
  3216. return false;
  3217. }
  3218. input = input ? local__createLocal(input).utcOffset() : 0;
  3219. return (this.utcOffset() - input) % 60 === 0;
  3220. }
  3221. function isDaylightSavingTime () {
  3222. return (
  3223. this.utcOffset() > this.clone().month(0).utcOffset() ||
  3224. this.utcOffset() > this.clone().month(5).utcOffset()
  3225. );
  3226. }
  3227. function isDaylightSavingTimeShifted () {
  3228. if (!isUndefined(this._isDSTShifted)) {
  3229. return this._isDSTShifted;
  3230. }
  3231. var c = {};
  3232. copyConfig(c, this);
  3233. c = prepareConfig(c);
  3234. if (c._a) {
  3235. var other = c._isUTC ? create_utc__createUTC(c._a) : local__createLocal(c._a);
  3236. this._isDSTShifted = this.isValid() &&
  3237. compareArrays(c._a, other.toArray()) > 0;
  3238. } else {
  3239. this._isDSTShifted = false;
  3240. }
  3241. return this._isDSTShifted;
  3242. }
  3243. function isLocal () {
  3244. return this.isValid() ? !this._isUTC : false;
  3245. }
  3246. function isUtcOffset () {
  3247. return this.isValid() ? this._isUTC : false;
  3248. }
  3249. function isUtc () {
  3250. return this.isValid() ? this._isUTC && this._offset === 0 : false;
  3251. }
  3252. // ASP.NET json date format regex
  3253. var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
  3254. // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
  3255. // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
  3256. // and further modified to allow for strings containing both week and day
  3257. var isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;
  3258. function create__createDuration (input, key) {
  3259. var duration = input,
  3260. // matching against regexp is expensive, do it on demand
  3261. match = null,
  3262. sign,
  3263. ret,
  3264. diffRes;
  3265. if (isDuration(input)) {
  3266. duration = {
  3267. ms : input._milliseconds,
  3268. d : input._days,
  3269. M : input._months
  3270. };
  3271. } else if (typeof input === 'number') {
  3272. duration = {};
  3273. if (key) {
  3274. duration[key] = input;
  3275. } else {
  3276. duration.milliseconds = input;
  3277. }
  3278. } else if (!!(match = aspNetRegex.exec(input))) {
  3279. sign = (match[1] === '-') ? -1 : 1;
  3280. duration = {
  3281. y : 0,
  3282. d : toInt(match[DATE]) * sign,
  3283. h : toInt(match[HOUR]) * sign,
  3284. m : toInt(match[MINUTE]) * sign,
  3285. s : toInt(match[SECOND]) * sign,
  3286. ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
  3287. };
  3288. } else if (!!(match = isoRegex.exec(input))) {
  3289. sign = (match[1] === '-') ? -1 : 1;
  3290. duration = {
  3291. y : parseIso(match[2], sign),
  3292. M : parseIso(match[3], sign),
  3293. w : parseIso(match[4], sign),
  3294. d : parseIso(match[5], sign),
  3295. h : parseIso(match[6], sign),
  3296. m : parseIso(match[7], sign),
  3297. s : parseIso(match[8], sign)
  3298. };
  3299. } else if (duration == null) {// checks for null or undefined
  3300. duration = {};
  3301. } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
  3302. diffRes = momentsDifference(local__createLocal(duration.from), local__createLocal(duration.to));
  3303. duration = {};
  3304. duration.ms = diffRes.milliseconds;
  3305. duration.M = diffRes.months;
  3306. }
  3307. ret = new Duration(duration);
  3308. if (isDuration(input) && hasOwnProp(input, '_locale')) {
  3309. ret._locale = input._locale;
  3310. }
  3311. return ret;
  3312. }
  3313. create__createDuration.fn = Duration.prototype;
  3314. function parseIso (inp, sign) {
  3315. // We'd normally use ~~inp for this, but unfortunately it also
  3316. // converts floats to ints.
  3317. // inp may be undefined, so careful calling replace on it.
  3318. var res = inp && parseFloat(inp.replace(',', '.'));
  3319. // apply sign while we're at it
  3320. return (isNaN(res) ? 0 : res) * sign;
  3321. }
  3322. function positiveMomentsDifference(base, other) {
  3323. var res = {milliseconds: 0, months: 0};
  3324. res.months = other.month() - base.month() +
  3325. (other.year() - base.year()) * 12;
  3326. if (base.clone().add(res.months, 'M').isAfter(other)) {
  3327. --res.months;
  3328. }
  3329. res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
  3330. return res;
  3331. }
  3332. function momentsDifference(base, other) {
  3333. var res;
  3334. if (!(base.isValid() && other.isValid())) {
  3335. return {milliseconds: 0, months: 0};
  3336. }
  3337. other = cloneWithOffset(other, base);
  3338. if (base.isBefore(other)) {
  3339. res = positiveMomentsDifference(base, other);
  3340. } else {
  3341. res = positiveMomentsDifference(other, base);
  3342. res.milliseconds = -res.milliseconds;
  3343. res.months = -res.months;
  3344. }
  3345. return res;
  3346. }
  3347. // TODO: remove 'name' arg after deprecation is removed
  3348. function createAdder(direction, name) {
  3349. return function (val, period) {
  3350. var dur, tmp;
  3351. //invert the arguments, but complain about it
  3352. if (period !== null && !isNaN(+period)) {
  3353. deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
  3354. 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
  3355. tmp = val; val = period; period = tmp;
  3356. }
  3357. val = typeof val === 'string' ? +val : val;
  3358. dur = create__createDuration(val, period);
  3359. add_subtract__addSubtract(this, dur, direction);
  3360. return this;
  3361. };
  3362. }
  3363. function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) {
  3364. var milliseconds = duration._milliseconds,
  3365. days = absRound(duration._days),
  3366. months = absRound(duration._months);
  3367. if (!mom.isValid()) {
  3368. // No op
  3369. return;
  3370. }
  3371. updateOffset = updateOffset == null ? true : updateOffset;
  3372. if (milliseconds) {
  3373. mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
  3374. }
  3375. if (days) {
  3376. get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding);
  3377. }
  3378. if (months) {
  3379. setMonth(mom, get_set__get(mom, 'Month') + months * isAdding);
  3380. }
  3381. if (updateOffset) {
  3382. utils_hooks__hooks.updateOffset(mom, days || months);
  3383. }
  3384. }
  3385. var add_subtract__add = createAdder(1, 'add');
  3386. var add_subtract__subtract = createAdder(-1, 'subtract');
  3387. function getCalendarFormat(myMoment, now) {
  3388. var diff = myMoment.diff(now, 'days', true);
  3389. return diff < -6 ? 'sameElse' :
  3390. diff < -1 ? 'lastWeek' :
  3391. diff < 0 ? 'lastDay' :
  3392. diff < 1 ? 'sameDay' :
  3393. diff < 2 ? 'nextDay' :
  3394. diff < 7 ? 'nextWeek' : 'sameElse';
  3395. }
  3396. function moment_calendar__calendar (time, formats) {
  3397. // We want to compare the start of today, vs this.
  3398. // Getting start-of-today depends on whether we're local/utc/offset or not.
  3399. var now = time || local__createLocal(),
  3400. sod = cloneWithOffset(now, this).startOf('day'),
  3401. format = utils_hooks__hooks.calendarFormat(this, sod) || 'sameElse';
  3402. var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
  3403. return this.format(output || this.localeData().calendar(format, this, local__createLocal(now)));
  3404. }
  3405. function clone () {
  3406. return new Moment(this);
  3407. }
  3408. function isAfter (input, units) {
  3409. var localInput = isMoment(input) ? input : local__createLocal(input);
  3410. if (!(this.isValid() && localInput.isValid())) {
  3411. return false;
  3412. }
  3413. units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
  3414. if (units === 'millisecond') {
  3415. return this.valueOf() > localInput.valueOf();
  3416. } else {
  3417. return localInput.valueOf() < this.clone().startOf(units).valueOf();
  3418. }
  3419. }
  3420. function isBefore (input, units) {
  3421. var localInput = isMoment(input) ? input : local__createLocal(input);
  3422. if (!(this.isValid() && localInput.isValid())) {
  3423. return false;
  3424. }
  3425. units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
  3426. if (units === 'millisecond') {
  3427. return this.valueOf() < localInput.valueOf();
  3428. } else {
  3429. return this.clone().endOf(units).valueOf() < localInput.valueOf();
  3430. }
  3431. }
  3432. function isBetween (from, to, units, inclusivity) {
  3433. inclusivity = inclusivity || '()';
  3434. return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) &&
  3435. (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units));
  3436. }
  3437. function isSame (input, units) {
  3438. var localInput = isMoment(input) ? input : local__createLocal(input),
  3439. inputMs;
  3440. if (!(this.isValid() && localInput.isValid())) {
  3441. return false;
  3442. }
  3443. units = normalizeUnits(units || 'millisecond');
  3444. if (units === 'millisecond') {
  3445. return this.valueOf() === localInput.valueOf();
  3446. } else {
  3447. inputMs = localInput.valueOf();
  3448. return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
  3449. }
  3450. }
  3451. function isSameOrAfter (input, units) {
  3452. return this.isSame(input, units) || this.isAfter(input,units);
  3453. }
  3454. function isSameOrBefore (input, units) {
  3455. return this.isSame(input, units) || this.isBefore(input,units);
  3456. }
  3457. function diff (input, units, asFloat) {
  3458. var that,
  3459. zoneDelta,
  3460. delta, output;
  3461. if (!this.isValid()) {
  3462. return NaN;
  3463. }
  3464. that = cloneWithOffset(input, this);
  3465. if (!that.isValid()) {
  3466. return NaN;
  3467. }
  3468. zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  3469. units = normalizeUnits(units);
  3470. if (units === 'year' || units === 'month' || units === 'quarter') {
  3471. output = monthDiff(this, that);
  3472. if (units === 'quarter') {
  3473. output = output / 3;
  3474. } else if (units === 'year') {
  3475. output = output / 12;
  3476. }
  3477. } else {
  3478. delta = this - that;
  3479. output = units === 'second' ? delta / 1e3 : // 1000
  3480. units === 'minute' ? delta / 6e4 : // 1000 * 60
  3481. units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60
  3482. units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
  3483. units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
  3484. delta;
  3485. }
  3486. return asFloat ? output : absFloor(output);
  3487. }
  3488. function monthDiff (a, b) {
  3489. // difference in months
  3490. var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
  3491. // b is in (anchor - 1 month, anchor + 1 month)
  3492. anchor = a.clone().add(wholeMonthDiff, 'months'),
  3493. anchor2, adjust;
  3494. if (b - anchor < 0) {
  3495. anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
  3496. // linear across the month
  3497. adjust = (b - anchor) / (anchor - anchor2);
  3498. } else {
  3499. anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
  3500. // linear across the month
  3501. adjust = (b - anchor) / (anchor2 - anchor);
  3502. }
  3503. //check for negative zero, return zero if negative zero
  3504. return -(wholeMonthDiff + adjust) || 0;
  3505. }
  3506. utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
  3507. utils_hooks__hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
  3508. function toString () {
  3509. return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
  3510. }
  3511. function moment_format__toISOString () {
  3512. var m = this.clone().utc();
  3513. if (0 < m.year() && m.year() <= 9999) {
  3514. if (isFunction(Date.prototype.toISOString)) {
  3515. // native implementation is ~50x faster, use it when we can
  3516. return this.toDate().toISOString();
  3517. } else {
  3518. return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
  3519. }
  3520. } else {
  3521. return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
  3522. }
  3523. }
  3524. function format (inputString) {
  3525. if (!inputString) {
  3526. inputString = this.isUtc() ? utils_hooks__hooks.defaultFormatUtc : utils_hooks__hooks.defaultFormat;
  3527. }
  3528. var output = formatMoment(this, inputString);
  3529. return this.localeData().postformat(output);
  3530. }
  3531. function from (time, withoutSuffix) {
  3532. if (this.isValid() &&
  3533. ((isMoment(time) && time.isValid()) ||
  3534. local__createLocal(time).isValid())) {
  3535. return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
  3536. } else {
  3537. return this.localeData().invalidDate();
  3538. }
  3539. }
  3540. function fromNow (withoutSuffix) {
  3541. return this.from(local__createLocal(), withoutSuffix);
  3542. }
  3543. function to (time, withoutSuffix) {
  3544. if (this.isValid() &&
  3545. ((isMoment(time) && time.isValid()) ||
  3546. local__createLocal(time).isValid())) {
  3547. return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
  3548. } else {
  3549. return this.localeData().invalidDate();
  3550. }
  3551. }
  3552. function toNow (withoutSuffix) {
  3553. return this.to(local__createLocal(), withoutSuffix);
  3554. }
  3555. // If passed a locale key, it will set the locale for this
  3556. // instance. Otherwise, it will return the locale configuration
  3557. // variables for this instance.
  3558. function locale (key) {
  3559. var newLocaleData;
  3560. if (key === undefined) {
  3561. return this._locale._abbr;
  3562. } else {
  3563. newLocaleData = locale_locales__getLocale(key);
  3564. if (newLocaleData != null) {
  3565. this._locale = newLocaleData;
  3566. }
  3567. return this;
  3568. }
  3569. }
  3570. var lang = deprecate(
  3571. 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
  3572. function (key) {
  3573. if (key === undefined) {
  3574. return this.localeData();
  3575. } else {
  3576. return this.locale(key);
  3577. }
  3578. }
  3579. );
  3580. function localeData () {
  3581. return this._locale;
  3582. }
  3583. function startOf (units) {
  3584. units = normalizeUnits(units);
  3585. // the following switch intentionally omits break keywords
  3586. // to utilize falling through the cases.
  3587. switch (units) {
  3588. case 'year':
  3589. this.month(0);
  3590. /* falls through */
  3591. case 'quarter':
  3592. case 'month':
  3593. this.date(1);
  3594. /* falls through */
  3595. case 'week':
  3596. case 'isoWeek':
  3597. case 'day':
  3598. case 'date':
  3599. this.hours(0);
  3600. /* falls through */
  3601. case 'hour':
  3602. this.minutes(0);
  3603. /* falls through */
  3604. case 'minute':
  3605. this.seconds(0);
  3606. /* falls through */
  3607. case 'second':
  3608. this.milliseconds(0);
  3609. }
  3610. // weeks are a special case
  3611. if (units === 'week') {
  3612. this.weekday(0);
  3613. }
  3614. if (units === 'isoWeek') {
  3615. this.isoWeekday(1);
  3616. }
  3617. // quarters are also special
  3618. if (units === 'quarter') {
  3619. this.month(Math.floor(this.month() / 3) * 3);
  3620. }
  3621. return this;
  3622. }
  3623. function endOf (units) {
  3624. units = normalizeUnits(units);
  3625. if (units === undefined || units === 'millisecond') {
  3626. return this;
  3627. }
  3628. // 'date' is an alias for 'day', so it should be considered as such.
  3629. if (units === 'date') {
  3630. units = 'day';
  3631. }
  3632. return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
  3633. }
  3634. function to_type__valueOf () {
  3635. return this._d.valueOf() - ((this._offset || 0) * 60000);
  3636. }
  3637. function unix () {
  3638. return Math.floor(this.valueOf() / 1000);
  3639. }
  3640. function toDate () {
  3641. return new Date(this.valueOf());
  3642. }
  3643. function toArray () {
  3644. var m = this;
  3645. return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
  3646. }
  3647. function toObject () {
  3648. var m = this;
  3649. return {
  3650. years: m.year(),
  3651. months: m.month(),
  3652. date: m.date(),
  3653. hours: m.hours(),
  3654. minutes: m.minutes(),
  3655. seconds: m.seconds(),
  3656. milliseconds: m.milliseconds()
  3657. };
  3658. }
  3659. function toJSON () {
  3660. // new Date(NaN).toJSON() === null
  3661. return this.isValid() ? this.toISOString() : null;
  3662. }
  3663. function moment_valid__isValid () {
  3664. return valid__isValid(this);
  3665. }
  3666. function parsingFlags () {
  3667. return extend({}, getParsingFlags(this));
  3668. }
  3669. function invalidAt () {
  3670. return getParsingFlags(this).overflow;
  3671. }
  3672. function creationData() {
  3673. return {
  3674. input: this._i,
  3675. format: this._f,
  3676. locale: this._locale,
  3677. isUTC: this._isUTC,
  3678. strict: this._strict
  3679. };
  3680. }
  3681. // FORMATTING
  3682. addFormatToken(0, ['gg', 2], 0, function () {
  3683. return this.weekYear() % 100;
  3684. });
  3685. addFormatToken(0, ['GG', 2], 0, function () {
  3686. return this.isoWeekYear() % 100;
  3687. });
  3688. function addWeekYearFormatToken (token, getter) {
  3689. addFormatToken(0, [token, token.length], 0, getter);
  3690. }
  3691. addWeekYearFormatToken('gggg', 'weekYear');
  3692. addWeekYearFormatToken('ggggg', 'weekYear');
  3693. addWeekYearFormatToken('GGGG', 'isoWeekYear');
  3694. addWeekYearFormatToken('GGGGG', 'isoWeekYear');
  3695. // ALIASES
  3696. addUnitAlias('weekYear', 'gg');
  3697. addUnitAlias('isoWeekYear', 'GG');
  3698. // PRIORITY
  3699. addUnitPriority('weekYear', 1);
  3700. addUnitPriority('isoWeekYear', 1);
  3701. // PARSING
  3702. addRegexToken('G', matchSigned);
  3703. addRegexToken('g', matchSigned);
  3704. addRegexToken('GG', match1to2, match2);
  3705. addRegexToken('gg', match1to2, match2);
  3706. addRegexToken('GGGG', match1to4, match4);
  3707. addRegexToken('gggg', match1to4, match4);
  3708. addRegexToken('GGGGG', match1to6, match6);
  3709. addRegexToken('ggggg', match1to6, match6);
  3710. addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
  3711. week[token.substr(0, 2)] = toInt(input);
  3712. });
  3713. addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
  3714. week[token] = utils_hooks__hooks.parseTwoDigitYear(input);
  3715. });
  3716. // MOMENTS
  3717. function getSetWeekYear (input) {
  3718. return getSetWeekYearHelper.call(this,
  3719. input,
  3720. this.week(),
  3721. this.weekday(),
  3722. this.localeData()._week.dow,
  3723. this.localeData()._week.doy);
  3724. }
  3725. function getSetISOWeekYear (input) {
  3726. return getSetWeekYearHelper.call(this,
  3727. input, this.isoWeek(), this.isoWeekday(), 1, 4);
  3728. }
  3729. function getISOWeeksInYear () {
  3730. return weeksInYear(this.year(), 1, 4);
  3731. }
  3732. function getWeeksInYear () {
  3733. var weekInfo = this.localeData()._week;
  3734. return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
  3735. }
  3736. function getSetWeekYearHelper(input, week, weekday, dow, doy) {
  3737. var weeksTarget;
  3738. if (input == null) {
  3739. return weekOfYear(this, dow, doy).year;
  3740. } else {
  3741. weeksTarget = weeksInYear(input, dow, doy);
  3742. if (week > weeksTarget) {
  3743. week = weeksTarget;
  3744. }
  3745. return setWeekAll.call(this, input, week, weekday, dow, doy);
  3746. }
  3747. }
  3748. function setWeekAll(weekYear, week, weekday, dow, doy) {
  3749. var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
  3750. date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  3751. this.year(date.getUTCFullYear());
  3752. this.month(date.getUTCMonth());
  3753. this.date(date.getUTCDate());
  3754. return this;
  3755. }
  3756. // FORMATTING
  3757. addFormatToken('Q', 0, 'Qo', 'quarter');
  3758. // ALIASES
  3759. addUnitAlias('quarter', 'Q');
  3760. // PRIORITY
  3761. addUnitPriority('quarter', 7);
  3762. // PARSING
  3763. addRegexToken('Q', match1);
  3764. addParseToken('Q', function (input, array) {
  3765. array[MONTH] = (toInt(input) - 1) * 3;
  3766. });
  3767. // MOMENTS
  3768. function getSetQuarter (input) {
  3769. return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
  3770. }
  3771. // FORMATTING
  3772. addFormatToken('D', ['DD', 2], 'Do', 'date');
  3773. // ALIASES
  3774. addUnitAlias('date', 'D');
  3775. // PRIOROITY
  3776. addUnitPriority('date', 9);
  3777. // PARSING
  3778. addRegexToken('D', match1to2);
  3779. addRegexToken('DD', match1to2, match2);
  3780. addRegexToken('Do', function (isStrict, locale) {
  3781. return isStrict ? locale._ordinalParse : locale._ordinalParseLenient;
  3782. });
  3783. addParseToken(['D', 'DD'], DATE);
  3784. addParseToken('Do', function (input, array) {
  3785. array[DATE] = toInt(input.match(match1to2)[0], 10);
  3786. });
  3787. // MOMENTS
  3788. var getSetDayOfMonth = makeGetSet('Date', true);
  3789. // FORMATTING
  3790. addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
  3791. // ALIASES
  3792. addUnitAlias('dayOfYear', 'DDD');
  3793. // PRIORITY
  3794. addUnitPriority('dayOfYear', 4);
  3795. // PARSING
  3796. addRegexToken('DDD', match1to3);
  3797. addRegexToken('DDDD', match3);
  3798. addParseToken(['DDD', 'DDDD'], function (input, array, config) {
  3799. config._dayOfYear = toInt(input);
  3800. });
  3801. // HELPERS
  3802. // MOMENTS
  3803. function getSetDayOfYear (input) {
  3804. var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
  3805. return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
  3806. }
  3807. // FORMATTING
  3808. addFormatToken('m', ['mm', 2], 0, 'minute');
  3809. // ALIASES
  3810. addUnitAlias('minute', 'm');
  3811. // PRIORITY
  3812. addUnitPriority('minute', 14);
  3813. // PARSING
  3814. addRegexToken('m', match1to2);
  3815. addRegexToken('mm', match1to2, match2);
  3816. addParseToken(['m', 'mm'], MINUTE);
  3817. // MOMENTS
  3818. var getSetMinute = makeGetSet('Minutes', false);
  3819. // FORMATTING
  3820. addFormatToken('s', ['ss', 2], 0, 'second');
  3821. // ALIASES
  3822. addUnitAlias('second', 's');
  3823. // PRIORITY
  3824. addUnitPriority('second', 15);
  3825. // PARSING
  3826. addRegexToken('s', match1to2);
  3827. addRegexToken('ss', match1to2, match2);
  3828. addParseToken(['s', 'ss'], SECOND);
  3829. // MOMENTS
  3830. var getSetSecond = makeGetSet('Seconds', false);
  3831. // FORMATTING
  3832. addFormatToken('S', 0, 0, function () {
  3833. return ~~(this.millisecond() / 100);
  3834. });
  3835. addFormatToken(0, ['SS', 2], 0, function () {
  3836. return ~~(this.millisecond() / 10);
  3837. });
  3838. addFormatToken(0, ['SSS', 3], 0, 'millisecond');
  3839. addFormatToken(0, ['SSSS', 4], 0, function () {
  3840. return this.millisecond() * 10;
  3841. });
  3842. addFormatToken(0, ['SSSSS', 5], 0, function () {
  3843. return this.millisecond() * 100;
  3844. });
  3845. addFormatToken(0, ['SSSSSS', 6], 0, function () {
  3846. return this.millisecond() * 1000;
  3847. });
  3848. addFormatToken(0, ['SSSSSSS', 7], 0, function () {
  3849. return this.millisecond() * 10000;
  3850. });
  3851. addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
  3852. return this.millisecond() * 100000;
  3853. });
  3854. addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
  3855. return this.millisecond() * 1000000;
  3856. });
  3857. // ALIASES
  3858. addUnitAlias('millisecond', 'ms');
  3859. // PRIORITY
  3860. addUnitPriority('millisecond', 16);
  3861. // PARSING
  3862. addRegexToken('S', match1to3, match1);
  3863. addRegexToken('SS', match1to3, match2);
  3864. addRegexToken('SSS', match1to3, match3);
  3865. var token;
  3866. for (token = 'SSSS'; token.length <= 9; token += 'S') {
  3867. addRegexToken(token, matchUnsigned);
  3868. }
  3869. function parseMs(input, array) {
  3870. array[MILLISECOND] = toInt(('0.' + input) * 1000);
  3871. }
  3872. for (token = 'S'; token.length <= 9; token += 'S') {
  3873. addParseToken(token, parseMs);
  3874. }
  3875. // MOMENTS
  3876. var getSetMillisecond = makeGetSet('Milliseconds', false);
  3877. // FORMATTING
  3878. addFormatToken('z', 0, 0, 'zoneAbbr');
  3879. addFormatToken('zz', 0, 0, 'zoneName');
  3880. // MOMENTS
  3881. function getZoneAbbr () {
  3882. return this._isUTC ? 'UTC' : '';
  3883. }
  3884. function getZoneName () {
  3885. return this._isUTC ? 'Coordinated Universal Time' : '';
  3886. }
  3887. var momentPrototype__proto = Moment.prototype;
  3888. momentPrototype__proto.add = add_subtract__add;
  3889. momentPrototype__proto.calendar = moment_calendar__calendar;
  3890. momentPrototype__proto.clone = clone;
  3891. momentPrototype__proto.diff = diff;
  3892. momentPrototype__proto.endOf = endOf;
  3893. momentPrototype__proto.format = format;
  3894. momentPrototype__proto.from = from;
  3895. momentPrototype__proto.fromNow = fromNow;
  3896. momentPrototype__proto.to = to;
  3897. momentPrototype__proto.toNow = toNow;
  3898. momentPrototype__proto.get = stringGet;
  3899. momentPrototype__proto.invalidAt = invalidAt;
  3900. momentPrototype__proto.isAfter = isAfter;
  3901. momentPrototype__proto.isBefore = isBefore;
  3902. momentPrototype__proto.isBetween = isBetween;
  3903. momentPrototype__proto.isSame = isSame;
  3904. momentPrototype__proto.isSameOrAfter = isSameOrAfter;
  3905. momentPrototype__proto.isSameOrBefore = isSameOrBefore;
  3906. momentPrototype__proto.isValid = moment_valid__isValid;
  3907. momentPrototype__proto.lang = lang;
  3908. momentPrototype__proto.locale = locale;
  3909. momentPrototype__proto.localeData = localeData;
  3910. momentPrototype__proto.max = prototypeMax;
  3911. momentPrototype__proto.min = prototypeMin;
  3912. momentPrototype__proto.parsingFlags = parsingFlags;
  3913. momentPrototype__proto.set = stringSet;
  3914. momentPrototype__proto.startOf = startOf;
  3915. momentPrototype__proto.subtract = add_subtract__subtract;
  3916. momentPrototype__proto.toArray = toArray;
  3917. momentPrototype__proto.toObject = toObject;
  3918. momentPrototype__proto.toDate = toDate;
  3919. momentPrototype__proto.toISOString = moment_format__toISOString;
  3920. momentPrototype__proto.toJSON = toJSON;
  3921. momentPrototype__proto.toString = toString;
  3922. momentPrototype__proto.unix = unix;
  3923. momentPrototype__proto.valueOf = to_type__valueOf;
  3924. momentPrototype__proto.creationData = creationData;
  3925. // Year
  3926. momentPrototype__proto.year = getSetYear;
  3927. momentPrototype__proto.isLeapYear = getIsLeapYear;
  3928. // Week Year
  3929. momentPrototype__proto.weekYear = getSetWeekYear;
  3930. momentPrototype__proto.isoWeekYear = getSetISOWeekYear;
  3931. // Quarter
  3932. momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter;
  3933. // Month
  3934. momentPrototype__proto.month = getSetMonth;
  3935. momentPrototype__proto.daysInMonth = getDaysInMonth;
  3936. // Week
  3937. momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek;
  3938. momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks = getSetISOWeek;
  3939. momentPrototype__proto.weeksInYear = getWeeksInYear;
  3940. momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear;
  3941. // Day
  3942. momentPrototype__proto.date = getSetDayOfMonth;
  3943. momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek;
  3944. momentPrototype__proto.weekday = getSetLocaleDayOfWeek;
  3945. momentPrototype__proto.isoWeekday = getSetISODayOfWeek;
  3946. momentPrototype__proto.dayOfYear = getSetDayOfYear;
  3947. // Hour
  3948. momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour;
  3949. // Minute
  3950. momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute;
  3951. // Second
  3952. momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond;
  3953. // Millisecond
  3954. momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond;
  3955. // Offset
  3956. momentPrototype__proto.utcOffset = getSetOffset;
  3957. momentPrototype__proto.utc = setOffsetToUTC;
  3958. momentPrototype__proto.local = setOffsetToLocal;
  3959. momentPrototype__proto.parseZone = setOffsetToParsedOffset;
  3960. momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset;
  3961. momentPrototype__proto.isDST = isDaylightSavingTime;
  3962. momentPrototype__proto.isLocal = isLocal;
  3963. momentPrototype__proto.isUtcOffset = isUtcOffset;
  3964. momentPrototype__proto.isUtc = isUtc;
  3965. momentPrototype__proto.isUTC = isUtc;
  3966. // Timezone
  3967. momentPrototype__proto.zoneAbbr = getZoneAbbr;
  3968. momentPrototype__proto.zoneName = getZoneName;
  3969. // Deprecations
  3970. momentPrototype__proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
  3971. momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
  3972. momentPrototype__proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
  3973. momentPrototype__proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
  3974. momentPrototype__proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
  3975. var momentPrototype = momentPrototype__proto;
  3976. function moment__createUnix (input) {
  3977. return local__createLocal(input * 1000);
  3978. }
  3979. function moment__createInZone () {
  3980. return local__createLocal.apply(null, arguments).parseZone();
  3981. }
  3982. function preParsePostFormat (string) {
  3983. return string;
  3984. }
  3985. var prototype__proto = Locale.prototype;
  3986. prototype__proto.calendar = locale_calendar__calendar;
  3987. prototype__proto.longDateFormat = longDateFormat;
  3988. prototype__proto.invalidDate = invalidDate;
  3989. prototype__proto.ordinal = ordinal;
  3990. prototype__proto.preparse = preParsePostFormat;
  3991. prototype__proto.postformat = preParsePostFormat;
  3992. prototype__proto.relativeTime = relative__relativeTime;
  3993. prototype__proto.pastFuture = pastFuture;
  3994. prototype__proto.set = locale_set__set;
  3995. // Month
  3996. prototype__proto.months = localeMonths;
  3997. prototype__proto.monthsShort = localeMonthsShort;
  3998. prototype__proto.monthsParse = localeMonthsParse;
  3999. prototype__proto.monthsRegex = monthsRegex;
  4000. prototype__proto.monthsShortRegex = monthsShortRegex;
  4001. // Week
  4002. prototype__proto.week = localeWeek;
  4003. prototype__proto.firstDayOfYear = localeFirstDayOfYear;
  4004. prototype__proto.firstDayOfWeek = localeFirstDayOfWeek;
  4005. // Day of Week
  4006. prototype__proto.weekdays = localeWeekdays;
  4007. prototype__proto.weekdaysMin = localeWeekdaysMin;
  4008. prototype__proto.weekdaysShort = localeWeekdaysShort;
  4009. prototype__proto.weekdaysParse = localeWeekdaysParse;
  4010. prototype__proto.weekdaysRegex = weekdaysRegex;
  4011. prototype__proto.weekdaysShortRegex = weekdaysShortRegex;
  4012. prototype__proto.weekdaysMinRegex = weekdaysMinRegex;
  4013. // Hours
  4014. prototype__proto.isPM = localeIsPM;
  4015. prototype__proto.meridiem = localeMeridiem;
  4016. function lists__get (format, index, field, setter) {
  4017. var locale = locale_locales__getLocale();
  4018. var utc = create_utc__createUTC().set(setter, index);
  4019. return locale[field](utc, format);
  4020. }
  4021. function listMonthsImpl (format, index, field) {
  4022. if (typeof format === 'number') {
  4023. index = format;
  4024. format = undefined;
  4025. }
  4026. format = format || '';
  4027. if (index != null) {
  4028. return lists__get(format, index, field, 'month');
  4029. }
  4030. var i;
  4031. var out = [];
  4032. for (i = 0; i < 12; i++) {
  4033. out[i] = lists__get(format, i, field, 'month');
  4034. }
  4035. return out;
  4036. }
  4037. // ()
  4038. // (5)
  4039. // (fmt, 5)
  4040. // (fmt)
  4041. // (true)
  4042. // (true, 5)
  4043. // (true, fmt, 5)
  4044. // (true, fmt)
  4045. function listWeekdaysImpl (localeSorted, format, index, field) {
  4046. if (typeof localeSorted === 'boolean') {
  4047. if (typeof format === 'number') {
  4048. index = format;
  4049. format = undefined;
  4050. }
  4051. format = format || '';
  4052. } else {
  4053. format = localeSorted;
  4054. index = format;
  4055. localeSorted = false;
  4056. if (typeof format === 'number') {
  4057. index = format;
  4058. format = undefined;
  4059. }
  4060. format = format || '';
  4061. }
  4062. var locale = locale_locales__getLocale(),
  4063. shift = localeSorted ? locale._week.dow : 0;
  4064. if (index != null) {
  4065. return lists__get(format, (index + shift) % 7, field, 'day');
  4066. }
  4067. var i;
  4068. var out = [];
  4069. for (i = 0; i < 7; i++) {
  4070. out[i] = lists__get(format, (i + shift) % 7, field, 'day');
  4071. }
  4072. return out;
  4073. }
  4074. function lists__listMonths (format, index) {
  4075. return listMonthsImpl(format, index, 'months');
  4076. }
  4077. function lists__listMonthsShort (format, index) {
  4078. return listMonthsImpl(format, index, 'monthsShort');
  4079. }
  4080. function lists__listWeekdays (localeSorted, format, index) {
  4081. return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
  4082. }
  4083. function lists__listWeekdaysShort (localeSorted, format, index) {
  4084. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
  4085. }
  4086. function lists__listWeekdaysMin (localeSorted, format, index) {
  4087. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
  4088. }
  4089. locale_locales__getSetGlobalLocale('en', {
  4090. ordinalParse: /\d{1,2}(th|st|nd|rd)/,
  4091. ordinal : function (number) {
  4092. var b = number % 10,
  4093. output = (toInt(number % 100 / 10) === 1) ? 'th' :
  4094. (b === 1) ? 'st' :
  4095. (b === 2) ? 'nd' :
  4096. (b === 3) ? 'rd' : 'th';
  4097. return number + output;
  4098. }
  4099. });
  4100. // Side effect imports
  4101. utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale);
  4102. utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale);
  4103. var mathAbs = Math.abs;
  4104. function duration_abs__abs () {
  4105. var data = this._data;
  4106. this._milliseconds = mathAbs(this._milliseconds);
  4107. this._days = mathAbs(this._days);
  4108. this._months = mathAbs(this._months);
  4109. data.milliseconds = mathAbs(data.milliseconds);
  4110. data.seconds = mathAbs(data.seconds);
  4111. data.minutes = mathAbs(data.minutes);
  4112. data.hours = mathAbs(data.hours);
  4113. data.months = mathAbs(data.months);
  4114. data.years = mathAbs(data.years);
  4115. return this;
  4116. }
  4117. function duration_add_subtract__addSubtract (duration, input, value, direction) {
  4118. var other = create__createDuration(input, value);
  4119. duration._milliseconds += direction * other._milliseconds;
  4120. duration._days += direction * other._days;
  4121. duration._months += direction * other._months;
  4122. return duration._bubble();
  4123. }
  4124. // supports only 2.0-style add(1, 's') or add(duration)
  4125. function duration_add_subtract__add (input, value) {
  4126. return duration_add_subtract__addSubtract(this, input, value, 1);
  4127. }
  4128. // supports only 2.0-style subtract(1, 's') or subtract(duration)
  4129. function duration_add_subtract__subtract (input, value) {
  4130. return duration_add_subtract__addSubtract(this, input, value, -1);
  4131. }
  4132. function absCeil (number) {
  4133. if (number < 0) {
  4134. return Math.floor(number);
  4135. } else {
  4136. return Math.ceil(number);
  4137. }
  4138. }
  4139. function bubble () {
  4140. var milliseconds = this._milliseconds;
  4141. var days = this._days;
  4142. var months = this._months;
  4143. var data = this._data;
  4144. var seconds, minutes, hours, years, monthsFromDays;
  4145. // if we have a mix of positive and negative values, bubble down first
  4146. // check: https://github.com/moment/moment/issues/2166
  4147. if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
  4148. (milliseconds <= 0 && days <= 0 && months <= 0))) {
  4149. milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
  4150. days = 0;
  4151. months = 0;
  4152. }
  4153. // The following code bubbles up values, see the tests for
  4154. // examples of what that means.
  4155. data.milliseconds = milliseconds % 1000;
  4156. seconds = absFloor(milliseconds / 1000);
  4157. data.seconds = seconds % 60;
  4158. minutes = absFloor(seconds / 60);
  4159. data.minutes = minutes % 60;
  4160. hours = absFloor(minutes / 60);
  4161. data.hours = hours % 24;
  4162. days += absFloor(hours / 24);
  4163. // convert days to months
  4164. monthsFromDays = absFloor(daysToMonths(days));
  4165. months += monthsFromDays;
  4166. days -= absCeil(monthsToDays(monthsFromDays));
  4167. // 12 months -> 1 year
  4168. years = absFloor(months / 12);
  4169. months %= 12;
  4170. data.days = days;
  4171. data.months = months;
  4172. data.years = years;
  4173. return this;
  4174. }
  4175. function daysToMonths (days) {
  4176. // 400 years have 146097 days (taking into account leap year rules)
  4177. // 400 years have 12 months === 4800
  4178. return days * 4800 / 146097;
  4179. }
  4180. function monthsToDays (months) {
  4181. // the reverse of daysToMonths
  4182. return months * 146097 / 4800;
  4183. }
  4184. function as (units) {
  4185. var days;
  4186. var months;
  4187. var milliseconds = this._milliseconds;
  4188. units = normalizeUnits(units);
  4189. if (units === 'month' || units === 'year') {
  4190. days = this._days + milliseconds / 864e5;
  4191. months = this._months + daysToMonths(days);
  4192. return units === 'month' ? months : months / 12;
  4193. } else {
  4194. // handle milliseconds separately because of floating point math errors (issue #1867)
  4195. days = this._days + Math.round(monthsToDays(this._months));
  4196. switch (units) {
  4197. case 'week' : return days / 7 + milliseconds / 6048e5;
  4198. case 'day' : return days + milliseconds / 864e5;
  4199. case 'hour' : return days * 24 + milliseconds / 36e5;
  4200. case 'minute' : return days * 1440 + milliseconds / 6e4;
  4201. case 'second' : return days * 86400 + milliseconds / 1000;
  4202. // Math.floor prevents floating point math errors here
  4203. case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
  4204. default: throw new Error('Unknown unit ' + units);
  4205. }
  4206. }
  4207. }
  4208. // TODO: Use this.as('ms')?
  4209. function duration_as__valueOf () {
  4210. return (
  4211. this._milliseconds +
  4212. this._days * 864e5 +
  4213. (this._months % 12) * 2592e6 +
  4214. toInt(this._months / 12) * 31536e6
  4215. );
  4216. }
  4217. function makeAs (alias) {
  4218. return function () {
  4219. return this.as(alias);
  4220. };
  4221. }
  4222. var asMilliseconds = makeAs('ms');
  4223. var asSeconds = makeAs('s');
  4224. var asMinutes = makeAs('m');
  4225. var asHours = makeAs('h');
  4226. var asDays = makeAs('d');
  4227. var asWeeks = makeAs('w');
  4228. var asMonths = makeAs('M');
  4229. var asYears = makeAs('y');
  4230. function duration_get__get (units) {
  4231. units = normalizeUnits(units);
  4232. return this[units + 's']();
  4233. }
  4234. function makeGetter(name) {
  4235. return function () {
  4236. return this._data[name];
  4237. };
  4238. }
  4239. var milliseconds = makeGetter('milliseconds');
  4240. var seconds = makeGetter('seconds');
  4241. var minutes = makeGetter('minutes');
  4242. var hours = makeGetter('hours');
  4243. var days = makeGetter('days');
  4244. var months = makeGetter('months');
  4245. var years = makeGetter('years');
  4246. function weeks () {
  4247. return absFloor(this.days() / 7);
  4248. }
  4249. var round = Math.round;
  4250. var thresholds = {
  4251. s: 45, // seconds to minute
  4252. m: 45, // minutes to hour
  4253. h: 22, // hours to day
  4254. d: 26, // days to month
  4255. M: 11 // months to year
  4256. };
  4257. // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
  4258. function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
  4259. return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
  4260. }
  4261. function duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) {
  4262. var duration = create__createDuration(posNegDuration).abs();
  4263. var seconds = round(duration.as('s'));
  4264. var minutes = round(duration.as('m'));
  4265. var hours = round(duration.as('h'));
  4266. var days = round(duration.as('d'));
  4267. var months = round(duration.as('M'));
  4268. var years = round(duration.as('y'));
  4269. var a = seconds < thresholds.s && ['s', seconds] ||
  4270. minutes <= 1 && ['m'] ||
  4271. minutes < thresholds.m && ['mm', minutes] ||
  4272. hours <= 1 && ['h'] ||
  4273. hours < thresholds.h && ['hh', hours] ||
  4274. days <= 1 && ['d'] ||
  4275. days < thresholds.d && ['dd', days] ||
  4276. months <= 1 && ['M'] ||
  4277. months < thresholds.M && ['MM', months] ||
  4278. years <= 1 && ['y'] || ['yy', years];
  4279. a[2] = withoutSuffix;
  4280. a[3] = +posNegDuration > 0;
  4281. a[4] = locale;
  4282. return substituteTimeAgo.apply(null, a);
  4283. }
  4284. // This function allows you to set the rounding function for relative time strings
  4285. function duration_humanize__getSetRelativeTimeRounding (roundingFunction) {
  4286. if (roundingFunction === undefined) {
  4287. return round;
  4288. }
  4289. if (typeof(roundingFunction) === 'function') {
  4290. round = roundingFunction;
  4291. return true;
  4292. }
  4293. return false;
  4294. }
  4295. // This function allows you to set a threshold for relative time strings
  4296. function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) {
  4297. if (thresholds[threshold] === undefined) {
  4298. return false;
  4299. }
  4300. if (limit === undefined) {
  4301. return thresholds[threshold];
  4302. }
  4303. thresholds[threshold] = limit;
  4304. return true;
  4305. }
  4306. function humanize (withSuffix) {
  4307. var locale = this.localeData();
  4308. var output = duration_humanize__relativeTime(this, !withSuffix, locale);
  4309. if (withSuffix) {
  4310. output = locale.pastFuture(+this, output);
  4311. }
  4312. return locale.postformat(output);
  4313. }
  4314. var iso_string__abs = Math.abs;
  4315. function iso_string__toISOString() {
  4316. // for ISO strings we do not use the normal bubbling rules:
  4317. // * milliseconds bubble up until they become hours
  4318. // * days do not bubble at all
  4319. // * months bubble up until they become years
  4320. // This is because there is no context-free conversion between hours and days
  4321. // (think of clock changes)
  4322. // and also not between days and months (28-31 days per month)
  4323. var seconds = iso_string__abs(this._milliseconds) / 1000;
  4324. var days = iso_string__abs(this._days);
  4325. var months = iso_string__abs(this._months);
  4326. var minutes, hours, years;
  4327. // 3600 seconds -> 60 minutes -> 1 hour
  4328. minutes = absFloor(seconds / 60);
  4329. hours = absFloor(minutes / 60);
  4330. seconds %= 60;
  4331. minutes %= 60;
  4332. // 12 months -> 1 year
  4333. years = absFloor(months / 12);
  4334. months %= 12;
  4335. // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
  4336. var Y = years;
  4337. var M = months;
  4338. var D = days;
  4339. var h = hours;
  4340. var m = minutes;
  4341. var s = seconds;
  4342. var total = this.asSeconds();
  4343. if (!total) {
  4344. // this is the same as C#'s (Noda) and python (isodate)...
  4345. // but not other JS (goog.date)
  4346. return 'P0D';
  4347. }
  4348. return (total < 0 ? '-' : '') +
  4349. 'P' +
  4350. (Y ? Y + 'Y' : '') +
  4351. (M ? M + 'M' : '') +
  4352. (D ? D + 'D' : '') +
  4353. ((h || m || s) ? 'T' : '') +
  4354. (h ? h + 'H' : '') +
  4355. (m ? m + 'M' : '') +
  4356. (s ? s + 'S' : '');
  4357. }
  4358. var duration_prototype__proto = Duration.prototype;
  4359. duration_prototype__proto.abs = duration_abs__abs;
  4360. duration_prototype__proto.add = duration_add_subtract__add;
  4361. duration_prototype__proto.subtract = duration_add_subtract__subtract;
  4362. duration_prototype__proto.as = as;
  4363. duration_prototype__proto.asMilliseconds = asMilliseconds;
  4364. duration_prototype__proto.asSeconds = asSeconds;
  4365. duration_prototype__proto.asMinutes = asMinutes;
  4366. duration_prototype__proto.asHours = asHours;
  4367. duration_prototype__proto.asDays = asDays;
  4368. duration_prototype__proto.asWeeks = asWeeks;
  4369. duration_prototype__proto.asMonths = asMonths;
  4370. duration_prototype__proto.asYears = asYears;
  4371. duration_prototype__proto.valueOf = duration_as__valueOf;
  4372. duration_prototype__proto._bubble = bubble;
  4373. duration_prototype__proto.get = duration_get__get;
  4374. duration_prototype__proto.milliseconds = milliseconds;
  4375. duration_prototype__proto.seconds = seconds;
  4376. duration_prototype__proto.minutes = minutes;
  4377. duration_prototype__proto.hours = hours;
  4378. duration_prototype__proto.days = days;
  4379. duration_prototype__proto.weeks = weeks;
  4380. duration_prototype__proto.months = months;
  4381. duration_prototype__proto.years = years;
  4382. duration_prototype__proto.humanize = humanize;
  4383. duration_prototype__proto.toISOString = iso_string__toISOString;
  4384. duration_prototype__proto.toString = iso_string__toISOString;
  4385. duration_prototype__proto.toJSON = iso_string__toISOString;
  4386. duration_prototype__proto.locale = locale;
  4387. duration_prototype__proto.localeData = localeData;
  4388. // Deprecations
  4389. duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString);
  4390. duration_prototype__proto.lang = lang;
  4391. // Side effect imports
  4392. // FORMATTING
  4393. addFormatToken('X', 0, 0, 'unix');
  4394. addFormatToken('x', 0, 0, 'valueOf');
  4395. // PARSING
  4396. addRegexToken('x', matchSigned);
  4397. addRegexToken('X', matchTimestamp);
  4398. addParseToken('X', function (input, array, config) {
  4399. config._d = new Date(parseFloat(input, 10) * 1000);
  4400. });
  4401. addParseToken('x', function (input, array, config) {
  4402. config._d = new Date(toInt(input));
  4403. });
  4404. // Side effect imports
  4405. utils_hooks__hooks.version = '2.15.2';
  4406. setHookCallback(local__createLocal);
  4407. utils_hooks__hooks.fn = momentPrototype;
  4408. utils_hooks__hooks.min = min;
  4409. utils_hooks__hooks.max = max;
  4410. utils_hooks__hooks.now = now;
  4411. utils_hooks__hooks.utc = create_utc__createUTC;
  4412. utils_hooks__hooks.unix = moment__createUnix;
  4413. utils_hooks__hooks.months = lists__listMonths;
  4414. utils_hooks__hooks.isDate = isDate;
  4415. utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale;
  4416. utils_hooks__hooks.invalid = valid__createInvalid;
  4417. utils_hooks__hooks.duration = create__createDuration;
  4418. utils_hooks__hooks.isMoment = isMoment;
  4419. utils_hooks__hooks.weekdays = lists__listWeekdays;
  4420. utils_hooks__hooks.parseZone = moment__createInZone;
  4421. utils_hooks__hooks.localeData = locale_locales__getLocale;
  4422. utils_hooks__hooks.isDuration = isDuration;
  4423. utils_hooks__hooks.monthsShort = lists__listMonthsShort;
  4424. utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin;
  4425. utils_hooks__hooks.defineLocale = defineLocale;
  4426. utils_hooks__hooks.updateLocale = updateLocale;
  4427. utils_hooks__hooks.locales = locale_locales__listLocales;
  4428. utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort;
  4429. utils_hooks__hooks.normalizeUnits = normalizeUnits;
  4430. utils_hooks__hooks.relativeTimeRounding = duration_humanize__getSetRelativeTimeRounding;
  4431. utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold;
  4432. utils_hooks__hooks.calendarFormat = getCalendarFormat;
  4433. utils_hooks__hooks.prototype = momentPrototype;
  4434. var _moment = utils_hooks__hooks;
  4435. return _moment;
  4436. }));
  4437. define('moment', ['moment/moment'], function (main) { return main; });
  4438. define('backend',['fast', 'moment'], function (Fast, Moment) {
  4439. var Backend = {
  4440. api: {
  4441. sidebar: function (params) {
  4442. colorArr = ['red', 'green', 'yellow', 'blue', 'teal', 'orange', 'purple'];
  4443. $colorNums = colorArr.length;
  4444. badgeList = {};
  4445. $.each(params, function (k, v) {
  4446. $url = Fast.api.fixurl(k);
  4447. if ($.isArray(v))
  4448. {
  4449. $nums = typeof v[0] !== 'undefined' ? v[0] : 0;
  4450. $color = typeof v[1] !== 'undefined' ? v[1] : colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  4451. $class = typeof v[2] !== 'undefined' ? v[2] : 'label';
  4452. } else
  4453. {
  4454. $nums = v;
  4455. $color = colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  4456. $class = 'label';
  4457. }
  4458. //必须nums大于0才显示
  4459. badgeList[$url] = $nums > 0 ? '<small class="' + $class + ' pull-right bg-' + $color + '">' + $nums + '</small>' : '';
  4460. });
  4461. $.each(badgeList, function (k, v) {
  4462. var anchor = top.window.$("li a[addtabs][url='" + k + "']");
  4463. if (anchor) {
  4464. top.window.$(".pull-right-container", anchor).html(v);
  4465. top.window.$(".nav-addtabs li a[node-id='" + anchor.attr("addtabs") + "'] .pull-right-container").html(v);
  4466. }
  4467. });
  4468. },
  4469. addtabs: function (url, title, icon) {
  4470. var dom = "a[url='{url}']"
  4471. var leftlink = top.window.$(dom.replace(/\{url\}/, url));
  4472. if (leftlink.size() > 0) {
  4473. leftlink.trigger("click");
  4474. } else {
  4475. url = Fast.api.fixurl(url);
  4476. leftlink = top.window.$(dom.replace(/\{url\}/, url));
  4477. if (leftlink.size() > 0) {
  4478. var event = leftlink.parent().hasClass("active") ? "dblclick" : "click";
  4479. leftlink.trigger(event);
  4480. } else {
  4481. var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
  4482. leftlink = top.window.$(dom.replace(/\{url\}/, baseurl));
  4483. //能找到相对地址
  4484. if (leftlink.size() > 0) {
  4485. icon = typeof icon !== 'undefined' ? icon : leftlink.find("i").attr("class");
  4486. title = typeof title !== 'undefined' ? title : leftlink.find("span:first").text();
  4487. leftlink.trigger("fa.event.toggleitem");
  4488. }
  4489. var navnode = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
  4490. if (navnode.size() > 0) {
  4491. navnode.trigger("click");
  4492. } else {
  4493. //追加新的tab
  4494. var id = Math.floor(new Date().valueOf() * Math.random());
  4495. icon = typeof icon !== 'undefined' ? icon : 'fa fa-circle-o';
  4496. title = typeof title !== 'undefined' ? title : '';
  4497. top.window.$("<a />").append('<i class="' + icon + '"></i> <span>' + title + '</span>').prop("href", url).attr({url: url, addtabs: id}).addClass("hide").appendTo(top.window.document.body).trigger("click");
  4498. }
  4499. }
  4500. }
  4501. },
  4502. closetabs: function (url) {
  4503. if (typeof url === 'undefined') {
  4504. top.window.$("ul.nav-addtabs li.active .close-tab").trigger("click");
  4505. } else {
  4506. var dom = "a[url='{url}']"
  4507. var navlink = top.window.$(dom.replace(/\{url\}/, url));
  4508. if (navlink.size() === 0) {
  4509. url = Fast.api.fixurl(url);
  4510. navlink = top.window.$(dom.replace(/\{url\}/, url));
  4511. if (navlink.size() === 0) {
  4512. } else {
  4513. var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
  4514. navlink = top.window.$(dom.replace(/\{url\}/, baseurl));
  4515. //能找到相对地址
  4516. if (navlink.size() === 0) {
  4517. navlink = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
  4518. }
  4519. }
  4520. }
  4521. if (navlink.size() > 0 && navlink.attr('addtabs')) {
  4522. top.window.$("ul.nav-addtabs li#tab_" + navlink.attr('addtabs') + " .close-tab").trigger("click");
  4523. }
  4524. }
  4525. },
  4526. replaceids: function (elem, url) {
  4527. //如果有需要替换ids的
  4528. if (url.indexOf("{ids}") > -1) {
  4529. var ids = 0;
  4530. var tableId = $(elem).data("table-id");
  4531. if (tableId && $(tableId).size() > 0 && $(tableId).data("bootstrap.table")) {
  4532. var Table = require("table");
  4533. ids = Table.api.selectedids($(tableId)).join(",");
  4534. }
  4535. url = url.replace(/\{ids\}/g, ids);
  4536. }
  4537. return url;
  4538. },
  4539. refreshmenu: function () {
  4540. top.window.$(".sidebar-menu").trigger("refresh");
  4541. }
  4542. },
  4543. init: function () {
  4544. //公共代码
  4545. //添加ios-fix兼容iOS下的iframe
  4546. if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
  4547. $("html").addClass("ios-fix");
  4548. }
  4549. //配置Toastr的参数
  4550. Toastr.options.positionClass = Config.controllername === 'index' ? "toast-top-right-index" : "toast-top-right";
  4551. //点击包含.btn-dialog的元素时弹出dialog
  4552. $(document).on('click', '.btn-dialog,.dialogit', function (e) {
  4553. var that = this;
  4554. var options = $.extend({}, $(that).data() || {});
  4555. if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
  4556. var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
  4557. if (tableOptions) {
  4558. var columnObj = null;
  4559. $.each(tableOptions.columns, function (i, columns) {
  4560. $.each(columns, function (j, column) {
  4561. if (typeof column.fieldIndex !== 'undefined' && column.fieldIndex === options.fieldIndex) {
  4562. columnObj = column;
  4563. return false;
  4564. }
  4565. });
  4566. if (columnObj) {
  4567. return false;
  4568. }
  4569. });
  4570. if (columnObj) {
  4571. var button = columnObj['buttons'][options.buttonIndex];
  4572. if (button && typeof button.callback === 'function') {
  4573. options.callback = button.callback;
  4574. }
  4575. }
  4576. }
  4577. }
  4578. if (typeof options.confirm !== 'undefined') {
  4579. Layer.confirm(options.confirm, function (index) {
  4580. Backend.api.open(Backend.api.replaceids(that, $(that).attr('href')), $(that).attr('title'), options);
  4581. Layer.close(index);
  4582. });
  4583. } else {
  4584. Backend.api.open(Backend.api.replaceids(that, $(that).attr('href')), $(that).attr('title'), options);
  4585. }
  4586. return false;
  4587. });
  4588. //点击包含.btn-addtabs的元素时新增选项卡
  4589. $(document).on('click', '.btn-addtabs,.addtabsit', function (e) {
  4590. var that = this;
  4591. var options = $.extend({}, $(that).data() || {});
  4592. if (typeof options.confirm !== 'undefined') {
  4593. Layer.confirm(options.confirm, function (index) {
  4594. Backend.api.addtabs(Backend.api.replaceids(that, $(that).attr('href')), $(that).attr("title"));
  4595. Layer.close(index);
  4596. });
  4597. } else {
  4598. Backend.api.addtabs(Backend.api.replaceids(that, $(that).attr('href')), $(that).attr("title"));
  4599. }
  4600. return false;
  4601. });
  4602. //点击包含.btn-ajax的元素时发送Ajax请求
  4603. $(document).on('click', '.btn-ajax,.ajaxit', function (e) {
  4604. var that = this;
  4605. var options = $.extend({}, $(that).data() || {});
  4606. if (typeof options.url === 'undefined' && $(that).attr("href")) {
  4607. options.url = $(that).attr("href");
  4608. }
  4609. options.url = Backend.api.replaceids(this, options.url);
  4610. var success = typeof options.success === 'function' ? options.success : null;
  4611. var error = typeof options.error === 'function' ? options.error : null;
  4612. delete options.success;
  4613. delete options.error;
  4614. if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
  4615. var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
  4616. if (tableOptions) {
  4617. var columnObj = null;
  4618. $.each(tableOptions.columns, function (i, columns) {
  4619. $.each(columns, function (j, column) {
  4620. if (typeof column.fieldIndex !== 'undefined' && column.fieldIndex === options.fieldIndex) {
  4621. columnObj = column;
  4622. return false;
  4623. }
  4624. });
  4625. if (columnObj) {
  4626. return false;
  4627. }
  4628. });
  4629. if (columnObj) {
  4630. var button = columnObj['buttons'][options.buttonIndex];
  4631. if (button && typeof button.success === 'function') {
  4632. success = button.success;
  4633. }
  4634. if (button && typeof button.error === 'function') {
  4635. error = button.error;
  4636. }
  4637. }
  4638. }
  4639. }
  4640. //如果未设备成功的回调,设定了自动刷新的情况下自动进行刷新
  4641. if (!success && typeof options.tableId !== 'undefined' && typeof options.refresh !== 'undefined' && options.refresh) {
  4642. $("#" + options.tableId).bootstrapTable('refresh');
  4643. }
  4644. if (typeof options.confirm !== 'undefined') {
  4645. Layer.confirm(options.confirm, function (index) {
  4646. Backend.api.ajax(options, success, error);
  4647. Layer.close(index);
  4648. });
  4649. } else {
  4650. Backend.api.ajax(options, success, error);
  4651. }
  4652. return false;
  4653. });
  4654. //修复含有fixed-footer类的body边距
  4655. if ($(".fixed-footer").size() > 0) {
  4656. $(document.body).css("padding-bottom", $(".fixed-footer").outerHeight());
  4657. }
  4658. //修复不在iframe时layer-footer隐藏的问题
  4659. if ($(".layer-footer").size() > 0 && self === top) {
  4660. $(".layer-footer").show();
  4661. }
  4662. }
  4663. };
  4664. Backend.api = $.extend(Fast.api, Backend.api);
  4665. //将Moment渲染至全局,以便于在子框架中调用
  4666. window.Moment = Moment;
  4667. //将Backend渲染至全局,以便于在子框架中调用
  4668. window.Backend = Backend;
  4669. Backend.init();
  4670. return Backend;
  4671. });
  4672. define('backend-init',['backend'], function (Backend) {
  4673. });
  4674. //! moment.js locale configuration
  4675. //! locale : Chinese (China) [zh-cn]
  4676. //! author : suupic : https://github.com/suupic
  4677. //! author : Zeno Zeng : https://github.com/zenozeng
  4678. ;(function (global, factory) {
  4679. typeof exports === 'object' && typeof module !== 'undefined'
  4680. && typeof require === 'function' ? factory(require('../moment')) :
  4681. typeof define === 'function' && define.amd ? define('moment/locale/zh-cn',['../moment'], factory) :
  4682. factory(global.moment)
  4683. }(this, function (moment) { 'use strict';
  4684. var zh_cn = moment.defineLocale('zh-cn', {
  4685. months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
  4686. monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
  4687. weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  4688. weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  4689. weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
  4690. longDateFormat : {
  4691. LT : 'Ah点mm分',
  4692. LTS : 'Ah点m分s秒',
  4693. L : 'YYYY-MM-DD',
  4694. LL : 'YYYY年MMMD日',
  4695. LLL : 'YYYY年MMMD日Ah点mm分',
  4696. LLLL : 'YYYY年MMMD日ddddAh点mm分',
  4697. l : 'YYYY-MM-DD',
  4698. ll : 'YYYY年MMMD日',
  4699. lll : 'YYYY年MMMD日Ah点mm分',
  4700. llll : 'YYYY年MMMD日ddddAh点mm分'
  4701. },
  4702. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  4703. meridiemHour: function (hour, meridiem) {
  4704. if (hour === 12) {
  4705. hour = 0;
  4706. }
  4707. if (meridiem === '凌晨' || meridiem === '早上' ||
  4708. meridiem === '上午') {
  4709. return hour;
  4710. } else if (meridiem === '下午' || meridiem === '晚上') {
  4711. return hour + 12;
  4712. } else {
  4713. // '中午'
  4714. return hour >= 11 ? hour : hour + 12;
  4715. }
  4716. },
  4717. meridiem : function (hour, minute, isLower) {
  4718. var hm = hour * 100 + minute;
  4719. if (hm < 600) {
  4720. return '凌晨';
  4721. } else if (hm < 900) {
  4722. return '早上';
  4723. } else if (hm < 1130) {
  4724. return '上午';
  4725. } else if (hm < 1230) {
  4726. return '中午';
  4727. } else if (hm < 1800) {
  4728. return '下午';
  4729. } else {
  4730. return '晚上';
  4731. }
  4732. },
  4733. calendar : {
  4734. sameDay : function () {
  4735. return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT';
  4736. },
  4737. nextDay : function () {
  4738. return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT';
  4739. },
  4740. lastDay : function () {
  4741. return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT';
  4742. },
  4743. nextWeek : function () {
  4744. var startOfWeek, prefix;
  4745. startOfWeek = moment().startOf('week');
  4746. prefix = this.diff(startOfWeek, 'days') >= 7 ? '[下]' : '[本]';
  4747. return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
  4748. },
  4749. lastWeek : function () {
  4750. var startOfWeek, prefix;
  4751. startOfWeek = moment().startOf('week');
  4752. prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]';
  4753. return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
  4754. },
  4755. sameElse : 'LL'
  4756. },
  4757. ordinalParse: /\d{1,2}(日|月|周)/,
  4758. ordinal : function (number, period) {
  4759. switch (period) {
  4760. case 'd':
  4761. case 'D':
  4762. case 'DDD':
  4763. return number + '日';
  4764. case 'M':
  4765. return number + '月';
  4766. case 'w':
  4767. case 'W':
  4768. return number + '周';
  4769. default:
  4770. return number;
  4771. }
  4772. },
  4773. relativeTime : {
  4774. future : '%s内',
  4775. past : '%s前',
  4776. s : '几秒',
  4777. m : '1 分钟',
  4778. mm : '%d 分钟',
  4779. h : '1 小时',
  4780. hh : '%d 小时',
  4781. d : '1 天',
  4782. dd : '%d 天',
  4783. M : '1 个月',
  4784. MM : '%d 个月',
  4785. y : '1 年',
  4786. yy : '%d 年'
  4787. },
  4788. week : {
  4789. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  4790. dow : 1, // Monday is the first day of the week.
  4791. doy : 4 // The week that contains Jan 4th is the first week of the year.
  4792. }
  4793. });
  4794. return zh_cn;
  4795. }));
  4796. /*
  4797. * bootstrap-table - v1.11.1 - 2017-02-22
  4798. * https://github.com/wenzhixin/bootstrap-table
  4799. * Copyright (c) 2017 zhixin wen
  4800. * Licensed MIT License
  4801. */
  4802. !function(a){"use strict";var b=null,c=function(a){var b=arguments,c=!0,d=1;return a=a.replace(/%s/g,function(){var a=b[d++];return"undefined"==typeof a?(c=!1,""):a}),c?a:""},d=function(b,c,d,e){var f="";return a.each(b,function(a,b){return b[c]===e?(f=b[d],!1):!0}),f},e=function(b,c){var d=-1;return a.each(b,function(a,b){return b.field===c?(d=a,!1):!0}),d},f=function(b){var c,d,e,f=0,g=[];for(c=0;c<b[0].length;c++)f+=b[0][c].colspan||1;for(c=0;c<b.length;c++)for(g[c]=[],d=0;f>d;d++)g[c][d]=!1;for(c=0;c<b.length;c++)for(d=0;d<b[c].length;d++){var h=b[c][d],i=h.rowspan||1,j=h.colspan||1,k=a.inArray(!1,g[c]);for(1===j&&(h.fieldIndex=k,"undefined"==typeof h.field&&(h.field=k)),e=0;i>e;e++)g[c+e][k]=!0;for(e=0;j>e;e++)g[c][k+e]=!0}},g=function(){if(null===b){var c,d,e=a("<p/>").addClass("fixed-table-scroll-inner"),f=a("<div/>").addClass("fixed-table-scroll-outer");f.append(e),a("body").append(f),c=e[0].offsetWidth,f.css("overflow","scroll"),d=e[0].offsetWidth,c===d&&(d=f[0].clientWidth),f.remove(),b=c-d}return b},h=function(b,d,e,f){var g=d;if("string"==typeof d){var h=d.split(".");h.length>1?(g=window,a.each(h,function(a,b){g=g[b]})):g=window[d]}return"object"==typeof g?g:"function"==typeof g?g.apply(b,e||[]):!g&&"string"==typeof d&&c.apply(this,[d].concat(e))?c.apply(this,[d].concat(e)):f},i=function(b,c,d){var e=Object.getOwnPropertyNames(b),f=Object.getOwnPropertyNames(c),g="";if(d&&e.length!==f.length)return!1;for(var h=0;h<e.length;h++)if(g=e[h],a.inArray(g,f)>-1&&b[g]!==c[g])return!1;return!0},j=function(a){return"string"==typeof a?a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/`/g,"&#x60;"):a},k=function(a){for(var b in a){var c=b.split(/(?=[A-Z])/).join("-").toLowerCase();c!==b&&(a[c]=a[b],delete a[b])}return a},l=function(a,b,c){var d=a;if("string"!=typeof b||a.hasOwnProperty(b))return c?j(a[b]):a[b];var e=b.split(".");for(var f in e)e.hasOwnProperty(f)&&(d=d&&d[e[f]]);return c?j(d):d},m=function(){return!!(navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./))},n=function(){Object.keys||(Object.keys=function(){var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=c.length;return function(e){if("object"!=typeof e&&("function"!=typeof e||null===e))throw new TypeError("Object.keys called on non-object");var f,g,h=[];for(f in e)a.call(e,f)&&h.push(f);if(b)for(g=0;d>g;g++)a.call(e,c[g])&&h.push(c[g]);return h}}())},o=function(b,c){this.options=c,this.$el=a(b),this.$el_=this.$el.clone(),this.timeoutId_=0,this.timeoutFooter_=0,this.init()};o.DEFAULTS={classes:"table table-hover",sortClass:void 0,locale:void 0,height:void 0,undefinedText:"-",sortName:void 0,sortOrder:"asc",sortStable:!1,striped:!1,columns:[[]],data:[],totalField:"total",dataField:"rows",method:"get",url:void 0,ajax:void 0,cache:!0,contentType:"application/json",dataType:"json",ajaxOptions:{},queryParams:function(a){return a},queryParamsType:"limit",responseHandler:function(a){return a},pagination:!1,onlyInfoPagination:!1,paginationLoop:!0,sidePagination:"client",totalRows:0,pageNumber:1,pageSize:10,pageList:[10,25,50,100],paginationHAlign:"right",paginationVAlign:"bottom",paginationDetailHAlign:"left",paginationPreText:"&lsaquo;",paginationNextText:"&rsaquo;",search:!1,searchOnEnterKey:!1,strictSearch:!1,searchAlign:"right",selectItemName:"btSelectItem",showHeader:!0,showFooter:!1,showColumns:!1,showPaginationSwitch:!1,showRefresh:!1,showToggle:!1,buttonsAlign:"right",smartDisplay:!0,escape:!1,minimumCountColumns:1,idField:void 0,uniqueId:void 0,cardView:!1,detailView:!1,detailFormatter:function(){return""},trimOnSearch:!0,clickToSelect:!1,singleSelect:!1,toolbar:void 0,toolbarAlign:"left",checkboxHeader:!0,sortable:!0,silentSort:!0,maintainSelected:!1,searchTimeOut:500,searchText:"",iconSize:void 0,buttonsClass:"default",iconsPrefix:"glyphicon",icons:{paginationSwitchDown:"glyphicon-collapse-down icon-chevron-down",paginationSwitchUp:"glyphicon-collapse-up icon-chevron-up",refresh:"glyphicon-refresh icon-refresh",toggle:"glyphicon-list-alt icon-list-alt",columns:"glyphicon-th icon-th",detailOpen:"glyphicon-plus icon-plus",detailClose:"glyphicon-minus icon-minus"},customSearch:a.noop,customSort:a.noop,rowStyle:function(){return{}},rowAttributes:function(){return{}},footerStyle:function(){return{}},onAll:function(){return!1},onClickCell:function(){return!1},onDblClickCell:function(){return!1},onClickRow:function(){return!1},onDblClickRow:function(){return!1},onSort:function(){return!1},onCheck:function(){return!1},onUncheck:function(){return!1},onCheckAll:function(){return!1},onUncheckAll:function(){return!1},onCheckSome:function(){return!1},onUncheckSome:function(){return!1},onLoadSuccess:function(){return!1},onLoadError:function(){return!1},onColumnSwitch:function(){return!1},onPageChange:function(){return!1},onSearch:function(){return!1},onToggle:function(){return!1},onPreBody:function(){return!1},onPostBody:function(){return!1},onPostHeader:function(){return!1},onExpandRow:function(){return!1},onCollapseRow:function(){return!1},onRefreshOptions:function(){return!1},onRefresh:function(){return!1},onResetView:function(){return!1}},o.LOCALES={},o.LOCALES["en-US"]=o.LOCALES.en={formatLoadingMessage:function(){return"Loading, please wait..."},formatRecordsPerPage:function(a){return c("%s rows per page",a)},formatShowingRows:function(a,b,d){return c("Showing %s to %s of %s rows",a,b,d)},formatDetailPagination:function(a){return c("Showing %s rows",a)},formatSearch:function(){return"Search"},formatNoMatches:function(){return"No matching records found"},formatPaginationSwitch:function(){return"Hide/Show pagination"},formatRefresh:function(){return"Refresh"},formatToggle:function(){return"Toggle"},formatColumns:function(){return"Columns"},formatAllRows:function(){return"All"}},a.extend(o.DEFAULTS,o.LOCALES["en-US"]),o.COLUMN_DEFAULTS={radio:!1,checkbox:!1,checkboxEnabled:!0,field:void 0,title:void 0,titleTooltip:void 0,"class":void 0,align:void 0,halign:void 0,falign:void 0,valign:void 0,width:void 0,sortable:!1,order:"asc",visible:!0,switchable:!0,clickToSelect:!0,formatter:void 0,footerFormatter:void 0,events:void 0,sorter:void 0,sortName:void 0,cellStyle:void 0,searchable:!0,searchFormatter:!0,cardVisible:!0,escape:!1},o.EVENTS={"all.bs.table":"onAll","click-cell.bs.table":"onClickCell","dbl-click-cell.bs.table":"onDblClickCell","click-row.bs.table":"onClickRow","dbl-click-row.bs.table":"onDblClickRow","sort.bs.table":"onSort","check.bs.table":"onCheck","uncheck.bs.table":"onUncheck","check-all.bs.table":"onCheckAll","uncheck-all.bs.table":"onUncheckAll","check-some.bs.table":"onCheckSome","uncheck-some.bs.table":"onUncheckSome","load-success.bs.table":"onLoadSuccess","load-error.bs.table":"onLoadError","column-switch.bs.table":"onColumnSwitch","page-change.bs.table":"onPageChange","search.bs.table":"onSearch","toggle.bs.table":"onToggle","pre-body.bs.table":"onPreBody","post-body.bs.table":"onPostBody","post-header.bs.table":"onPostHeader","expand-row.bs.table":"onExpandRow","collapse-row.bs.table":"onCollapseRow","refresh-options.bs.table":"onRefreshOptions","reset-view.bs.table":"onResetView","refresh.bs.table":"onRefresh"},o.prototype.init=function(){this.initLocale(),this.initContainer(),this.initTable(),this.initHeader(),this.initData(),this.initHiddenRows(),this.initFooter(),this.initToolbar(),this.initPagination(),this.initBody(),this.initSearchText(),this.initServer()},o.prototype.initLocale=function(){if(this.options.locale){var b=this.options.locale.split(/-|_/);b[0].toLowerCase(),b[1]&&b[1].toUpperCase(),a.fn.bootstrapTable.locales[this.options.locale]?a.extend(this.options,a.fn.bootstrapTable.locales[this.options.locale]):a.fn.bootstrapTable.locales[b.join("-")]?a.extend(this.options,a.fn.bootstrapTable.locales[b.join("-")]):a.fn.bootstrapTable.locales[b[0]]&&a.extend(this.options,a.fn.bootstrapTable.locales[b[0]])}},o.prototype.initContainer=function(){this.$container=a(['<div class="bootstrap-table">','<div class="fixed-table-toolbar"></div>',"top"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?'<div class="fixed-table-pagination" style="clear: both;"></div>':"",'<div class="fixed-table-container">','<div class="fixed-table-header"><table></table></div>','<div class="fixed-table-body">','<div class="fixed-table-loading">',this.options.formatLoadingMessage(),"</div>","</div>",'<div class="fixed-table-footer"><table><tr></tr></table></div>',"bottom"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?'<div class="fixed-table-pagination"></div>':"","</div>","</div>"].join("")),this.$container.insertAfter(this.$el),this.$tableContainer=this.$container.find(".fixed-table-container"),this.$tableHeader=this.$container.find(".fixed-table-header"),this.$tableBody=this.$container.find(".fixed-table-body"),this.$tableLoading=this.$container.find(".fixed-table-loading"),this.$tableFooter=this.$container.find(".fixed-table-footer"),this.$toolbar=this.$container.find(".fixed-table-toolbar"),this.$pagination=this.$container.find(".fixed-table-pagination"),this.$tableBody.append(this.$el),this.$container.after('<div class="clearfix"></div>'),this.$el.addClass(this.options.classes),this.options.striped&&this.$el.addClass("table-striped"),-1!==a.inArray("table-no-bordered",this.options.classes.split(" "))&&this.$tableContainer.addClass("table-no-bordered")},o.prototype.initTable=function(){var b=this,c=[],d=[];if(this.$header=this.$el.find(">thead"),this.$header.length||(this.$header=a("<thead></thead>").appendTo(this.$el)),this.$header.find("tr").each(function(){var b=[];a(this).find("th").each(function(){"undefined"!=typeof a(this).data("field")&&a(this).data("field",a(this).data("field")+""),b.push(a.extend({},{title:a(this).html(),"class":a(this).attr("class"),titleTooltip:a(this).attr("title"),rowspan:a(this).attr("rowspan")?+a(this).attr("rowspan"):void 0,colspan:a(this).attr("colspan")?+a(this).attr("colspan"):void 0},a(this).data()))}),c.push(b)}),a.isArray(this.options.columns[0])||(this.options.columns=[this.options.columns]),this.options.columns=a.extend(!0,[],c,this.options.columns),this.columns=[],f(this.options.columns),a.each(this.options.columns,function(c,d){a.each(d,function(d,e){e=a.extend({},o.COLUMN_DEFAULTS,e),"undefined"!=typeof e.fieldIndex&&(b.columns[e.fieldIndex]=e),b.options.columns[c][d]=e})}),!this.options.data.length){var e=[];this.$el.find(">tbody>tr").each(function(c){var f={};f._id=a(this).attr("id"),f._class=a(this).attr("class"),f._data=k(a(this).data()),a(this).find(">td").each(function(d){for(var g,h,i=a(this),j=+i.attr("colspan")||1,l=+i.attr("rowspan")||1;e[c]&&e[c][d];d++);for(g=d;d+j>g;g++)for(h=c;c+l>h;h++)e[h]||(e[h]=[]),e[h][g]=!0;var m=b.columns[d].field;f[m]=a(this).html(),f["_"+m+"_id"]=a(this).attr("id"),f["_"+m+"_class"]=a(this).attr("class"),f["_"+m+"_rowspan"]=a(this).attr("rowspan"),f["_"+m+"_colspan"]=a(this).attr("colspan"),f["_"+m+"_title"]=a(this).attr("title"),f["_"+m+"_data"]=k(a(this).data())}),d.push(f)}),this.options.data=d,d.length&&(this.fromHtml=!0)}},o.prototype.initHeader=function(){var b=this,d={},e=[];this.header={fields:[],styles:[],classes:[],formatters:[],events:[],sorters:[],sortNames:[],cellStyles:[],searchables:[]},a.each(this.options.columns,function(f,g){e.push("<tr>"),0===f&&!b.options.cardView&&b.options.detailView&&e.push(c('<th class="detail" rowspan="%s"><div class="fht-cell"></div></th>',b.options.columns.length)),a.each(g,function(a,f){var g="",h="",i="",k="",l=c(' class="%s"',f["class"]),m=(b.options.sortOrder||f.order,"px"),n=f.width;if(void 0===f.width||b.options.cardView||"string"==typeof f.width&&-1!==f.width.indexOf("%")&&(m="%"),f.width&&"string"==typeof f.width&&(n=f.width.replace("%","").replace("px","")),h=c("text-align: %s; ",f.halign?f.halign:f.align),i=c("text-align: %s; ",f.align),k=c("vertical-align: %s; ",f.valign),k+=c("width: %s; ",!f.checkbox&&!f.radio||n?n?n+m:void 0:"36px"),"undefined"!=typeof f.fieldIndex){if(b.header.fields[f.fieldIndex]=f.field,b.header.styles[f.fieldIndex]=i+k,b.header.classes[f.fieldIndex]=l,b.header.formatters[f.fieldIndex]=f.formatter,b.header.events[f.fieldIndex]=f.events,b.header.sorters[f.fieldIndex]=f.sorter,b.header.sortNames[f.fieldIndex]=f.sortName,b.header.cellStyles[f.fieldIndex]=f.cellStyle,b.header.searchables[f.fieldIndex]=f.searchable,!f.visible)return;if(b.options.cardView&&!f.cardVisible)return;d[f.field]=f}e.push("<th"+c(' title="%s"',f.titleTooltip),f.checkbox||f.radio?c(' class="bs-checkbox %s"',f["class"]||""):l,c(' style="%s"',h+k),c(' rowspan="%s"',f.rowspan),c(' colspan="%s"',f.colspan),c(' data-field="%s"',f.field),">"),e.push(c('<div class="th-inner %s">',b.options.sortable&&f.sortable?"sortable both":"")),g=b.options.escape?j(f.title):f.title,f.checkbox&&(!b.options.singleSelect&&b.options.checkboxHeader&&(g='<input name="btSelectAll" type="checkbox" />'),b.header.stateField=f.field),f.radio&&(g="",b.header.stateField=f.field,b.options.singleSelect=!0),e.push(g),e.push("</div>"),e.push('<div class="fht-cell"></div>'),e.push("</div>"),e.push("</th>")}),e.push("</tr>")}),this.$header.html(e.join("")),this.$header.find("th[data-field]").each(function(){a(this).data(d[a(this).data("field")])}),this.$container.off("click",".th-inner").on("click",".th-inner",function(c){var d=a(this);return b.options.detailView&&d.closest(".bootstrap-table")[0]!==b.$container[0]?!1:void(b.options.sortable&&d.parent().data().sortable&&b.onSort(c))}),this.$header.children().children().off("keypress").on("keypress",function(c){if(b.options.sortable&&a(this).data().sortable){var d=c.keyCode||c.which;13==d&&b.onSort(c)}}),a(window).off("resize.bootstrap-table"),!this.options.showHeader||this.options.cardView?(this.$header.hide(),this.$tableHeader.hide(),this.$tableLoading.css("top",0)):(this.$header.show(),this.$tableHeader.show(),this.$tableLoading.css("top",this.$header.outerHeight()+1),this.getCaret(),a(window).on("resize.bootstrap-table",a.proxy(this.resetWidth,this))),this.$selectAll=this.$header.find('[name="btSelectAll"]'),this.$selectAll.off("click").on("click",function(){var c=a(this).prop("checked");b[c?"checkAll":"uncheckAll"](),b.updateSelected()})},o.prototype.initFooter=function(){!this.options.showFooter||this.options.cardView?this.$tableFooter.hide():this.$tableFooter.show()},o.prototype.initData=function(a,b){this.data="append"===b?this.data.concat(a):"prepend"===b?[].concat(a).concat(this.data):a||this.options.data,this.options.data="append"===b?this.options.data.concat(a):"prepend"===b?[].concat(a).concat(this.options.data):this.data,"server"!==this.options.sidePagination&&this.initSort()},o.prototype.initSort=function(){var b=this,d=this.options.sortName,e="desc"===this.options.sortOrder?-1:1,f=a.inArray(this.options.sortName,this.header.fields),g=0;return this.options.customSort!==a.noop?void this.options.customSort.apply(this,[this.options.sortName,this.options.sortOrder]):void(-1!==f&&(this.options.sortStable&&a.each(this.data,function(a,b){b.hasOwnProperty("_position")||(b._position=a)}),this.data.sort(function(c,g){b.header.sortNames[f]&&(d=b.header.sortNames[f]);var i=l(c,d,b.options.escape),j=l(g,d,b.options.escape),k=h(b.header,b.header.sorters[f],[i,j]);return void 0!==k?e*k:((void 0===i||null===i)&&(i=""),(void 0===j||null===j)&&(j=""),b.options.sortStable&&i===j&&(i=c._position,j=g._position),a.isNumeric(i)&&a.isNumeric(j)?(i=parseFloat(i),j=parseFloat(j),j>i?-1*e:e):i===j?0:("string"!=typeof i&&(i=i.toString()),-1===i.localeCompare(j)?-1*e:e))}),void 0!==this.options.sortClass&&(clearTimeout(g),g=setTimeout(function(){b.$el.removeClass(b.options.sortClass);var a=b.$header.find(c('[data-field="%s"]',b.options.sortName).index()+1);b.$el.find(c("tr td:nth-child(%s)",a)).addClass(b.options.sortClass)},250))))},o.prototype.onSort=function(b){var c="keypress"===b.type?a(b.currentTarget):a(b.currentTarget).parent(),d=this.$header.find("th").eq(c.index());return this.$header.add(this.$header_).find("span.order").remove(),this.options.sortName===c.data("field")?this.options.sortOrder="asc"===this.options.sortOrder?"desc":"asc":(this.options.sortName=c.data("field"),this.options.sortOrder="asc"===c.data("order")?"desc":"asc"),this.trigger("sort",this.options.sortName,this.options.sortOrder),c.add(d).data("order",this.options.sortOrder),this.getCaret(),"server"===this.options.sidePagination?void this.initServer(this.options.silentSort):(this.initSort(),void this.initBody())},o.prototype.initToolbar=function(){var b,d,e=this,f=[],g=0,i=0;this.$toolbar.find(".bs-bars").children().length&&a("body").append(a(this.options.toolbar)),this.$toolbar.html(""),("string"==typeof this.options.toolbar||"object"==typeof this.options.toolbar)&&a(c('<div class="bs-bars pull-%s"></div>',this.options.toolbarAlign)).appendTo(this.$toolbar).append(a(this.options.toolbar)),f=[c('<div class="columns columns-%s btn-group pull-%s">',this.options.buttonsAlign,this.options.buttonsAlign)],"string"==typeof this.options.icons&&(this.options.icons=h(null,this.options.icons)),this.options.showPaginationSwitch&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="paginationSwitch" aria-label="pagination Switch" title="%s">',this.options.formatPaginationSwitch()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.paginationSwitchDown),"</button>"),this.options.showRefresh&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="refresh" aria-label="refresh" title="%s">',this.options.formatRefresh()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.refresh),"</button>"),this.options.showToggle&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="toggle" aria-label="toggle" title="%s">',this.options.formatToggle()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.toggle),"</button>"),this.options.showColumns&&(f.push(c('<div class="keep-open btn-group" title="%s">',this.options.formatColumns()),'<button type="button" aria-label="columns" class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">',c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.columns),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'),a.each(this.columns,function(a,b){if(!(b.radio||b.checkbox||e.options.cardView&&!b.cardVisible)){var d=b.visible?' checked="checked"':"";b.switchable&&(f.push(c('<li role="menuitem"><label><input type="checkbox" data-field="%s" value="%s"%s> %s</label></li>',b.field,a,d,b.title)),i++)}}),f.push("</ul>","</div>")),f.push("</div>"),(this.showToolbar||f.length>2)&&this.$toolbar.append(f.join("")),this.options.showPaginationSwitch&&this.$toolbar.find('button[name="paginationSwitch"]').off("click").on("click",a.proxy(this.togglePagination,this)),this.options.showRefresh&&this.$toolbar.find('button[name="refresh"]').off("click").on("click",a.proxy(this.refresh,this)),this.options.showToggle&&this.$toolbar.find('button[name="toggle"]').off("click").on("click",function(){e.toggleView()}),this.options.showColumns&&(b=this.$toolbar.find(".keep-open"),i<=this.options.minimumCountColumns&&b.find("input").prop("disabled",!0),b.find("li").off("click").on("click",function(a){a.stopImmediatePropagation()}),b.find("input").off("click").on("click",function(){var b=a(this);e.toggleColumn(a(this).val(),b.prop("checked"),!1),e.trigger("column-switch",a(this).data("field"),b.prop("checked"))})),this.options.search&&(f=[],f.push('<div class="pull-'+this.options.searchAlign+' search">',c('<input class="form-control'+c(" input-%s",this.options.iconSize)+'" type="text" placeholder="%s">',this.options.formatSearch()),"</div>"),this.$toolbar.append(f.join("")),d=this.$toolbar.find(".search input"),d.off("keyup drop blur").on("keyup drop blur",function(b){e.options.searchOnEnterKey&&13!==b.keyCode||a.inArray(b.keyCode,[37,38,39,40])>-1||(clearTimeout(g),g=setTimeout(function(){e.onSearch(b)},e.options.searchTimeOut))}),m()&&d.off("mouseup").on("mouseup",function(a){clearTimeout(g),g=setTimeout(function(){e.onSearch(a)},e.options.searchTimeOut)}))},o.prototype.onSearch=function(b){var c=a.trim(a(b.currentTarget).val());this.options.trimOnSearch&&a(b.currentTarget).val()!==c&&a(b.currentTarget).val(c),c!==this.searchText&&(this.searchText=c,this.options.searchText=c,this.options.pageNumber=1,this.initSearch(),this.updatePagination(),this.trigger("search",c))},o.prototype.initSearch=function(){var b=this;if("server"!==this.options.sidePagination){if(this.options.customSearch!==a.noop)return void this.options.customSearch.apply(this,[this.searchText]);var c=this.searchText&&(this.options.escape?j(this.searchText):this.searchText).toLowerCase(),d=a.isEmptyObject(this.filterColumns)?null:this.filterColumns;this.data=d?a.grep(this.options.data,function(b){for(var c in d)if(a.isArray(d[c])&&-1===a.inArray(b[c],d[c])||!a.isArray(d[c])&&b[c]!==d[c])return!1;return!0}):this.options.data,this.data=c?a.grep(this.data,function(d,f){for(var g=0;g<b.header.fields.length;g++)if(b.header.searchables[g]){var i,j=a.isNumeric(b.header.fields[g])?parseInt(b.header.fields[g],10):b.header.fields[g],k=b.columns[e(b.columns,j)];if("string"==typeof j){i=d;for(var l=j.split("."),m=0;m<l.length;m++)i=i[l[m]];k&&k.searchFormatter&&(i=h(k,b.header.formatters[g],[i,d,f],i))}else i=d[j];if("string"==typeof i||"number"==typeof i)if(b.options.strictSearch){if((i+"").toLowerCase()===c)return!0}else if(-1!==(i+"").toLowerCase().indexOf(c))return!0}return!1}):this.data}},o.prototype.initPagination=function(){if(!this.options.pagination)return void this.$pagination.hide();this.$pagination.show();var b,d,e,f,g,h,i,j,k,l=this,m=[],n=!1,o=this.getData(),p=this.options.pageList;if("server"!==this.options.sidePagination&&(this.options.totalRows=o.length),this.totalPages=0,this.options.totalRows){if(this.options.pageSize===this.options.formatAllRows())this.options.pageSize=this.options.totalRows,n=!0;else if(this.options.pageSize===this.options.totalRows){var q="string"==typeof this.options.pageList?this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").toLowerCase().split(","):this.options.pageList;a.inArray(this.options.formatAllRows().toLowerCase(),q)>-1&&(n=!0)}this.totalPages=~~((this.options.totalRows-1)/this.options.pageSize)+1,this.options.totalPages=this.totalPages}if(this.totalPages>0&&this.options.pageNumber>this.totalPages&&(this.options.pageNumber=this.totalPages),this.pageFrom=(this.options.pageNumber-1)*this.options.pageSize+1,this.pageTo=this.options.pageNumber*this.options.pageSize,this.pageTo>this.options.totalRows&&(this.pageTo=this.options.totalRows),m.push('<div class="pull-'+this.options.paginationDetailHAlign+' pagination-detail">','<span class="pagination-info">',this.options.onlyInfoPagination?this.options.formatDetailPagination(this.options.totalRows):this.options.formatShowingRows(this.pageFrom,this.pageTo,this.options.totalRows),"</span>"),!this.options.onlyInfoPagination){m.push('<span class="page-list">');var r=[c('<span class="btn-group %s">',"top"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?"dropdown":"dropup"),'<button type="button" class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">','<span class="page-size">',n?this.options.formatAllRows():this.options.pageSize,"</span>",' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'];if("string"==typeof this.options.pageList){var s=this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").split(",");p=[],a.each(s,function(a,b){p.push(b.toUpperCase()===l.options.formatAllRows().toUpperCase()?l.options.formatAllRows():+b)})}for(a.each(p,function(a,b){if(!l.options.smartDisplay||0===a||p[a-1]<l.options.totalRows){var d;d=n?b===l.options.formatAllRows()?' class="active"':"":b===l.options.pageSize?' class="active"':"",r.push(c('<li role="menuitem"%s><a href="#">%s</a></li>',d,b))}}),r.push("</ul></span>"),m.push(this.options.formatRecordsPerPage(r.join(""))),m.push("</span>"),m.push("</div>",'<div class="pull-'+this.options.paginationHAlign+' pagination">','<ul class="pagination'+c(" pagination-%s",this.options.iconSize)+'">','<li class="page-pre"><a href="#">'+this.options.paginationPreText+"</a></li>"),this.totalPages<5?(d=1,e=this.totalPages):(d=this.options.pageNumber-2,e=d+4,1>d&&(d=1,e=5),e>this.totalPages&&(e=this.totalPages,d=e-4)),this.totalPages>=6&&(this.options.pageNumber>=3&&(m.push('<li class="page-first'+(1===this.options.pageNumber?" active":"")+'">','<a href="#">',1,"</a>","</li>"),d++),this.options.pageNumber>=4&&(4==this.options.pageNumber||6==this.totalPages||7==this.totalPages?d--:m.push('<li class="page-first-separator disabled">','<a href="#">...</a>',"</li>"),e--)),this.totalPages>=7&&this.options.pageNumber>=this.totalPages-2&&d--,6==this.totalPages?this.options.pageNumber>=this.totalPages-2&&e++:this.totalPages>=7&&(7==this.totalPages||this.options.pageNumber>=this.totalPages-3)&&e++,b=d;e>=b;b++)m.push('<li class="page-number'+(b===this.options.pageNumber?" active":"")+'">','<a href="#">',b,"</a>","</li>");this.totalPages>=8&&this.options.pageNumber<=this.totalPages-4&&m.push('<li class="page-last-separator disabled">','<a href="#">...</a>',"</li>"),this.totalPages>=6&&this.options.pageNumber<=this.totalPages-3&&m.push('<li class="page-last'+(this.totalPages===this.options.pageNumber?" active":"")+'">','<a href="#">',this.totalPages,"</a>","</li>"),m.push('<li class="page-next"><a href="#">'+this.options.paginationNextText+"</a></li>","</ul>","</div>")}this.$pagination.html(m.join("")),this.options.onlyInfoPagination||(f=this.$pagination.find(".page-list a"),g=this.$pagination.find(".page-first"),h=this.$pagination.find(".page-pre"),i=this.$pagination.find(".page-next"),j=this.$pagination.find(".page-last"),k=this.$pagination.find(".page-number"),this.options.smartDisplay&&(this.totalPages<=1&&this.$pagination.find("div.pagination").hide(),(p.length<2||this.options.totalRows<=p[0])&&this.$pagination.find("span.page-list").hide(),this.$pagination[this.getData().length?"show":"hide"]()),this.options.paginationLoop||(1===this.options.pageNumber&&h.addClass("disabled"),this.options.pageNumber===this.totalPages&&i.addClass("disabled")),n&&(this.options.pageSize=this.options.formatAllRows()),f.off("click").on("click",a.proxy(this.onPageListChange,this)),g.off("click").on("click",a.proxy(this.onPageFirst,this)),h.off("click").on("click",a.proxy(this.onPagePre,this)),i.off("click").on("click",a.proxy(this.onPageNext,this)),j.off("click").on("click",a.proxy(this.onPageLast,this)),k.off("click").on("click",a.proxy(this.onPageNumber,this)))},o.prototype.updatePagination=function(b){b&&a(b.currentTarget).hasClass("disabled")||(this.options.maintainSelected||this.resetRows(),this.initPagination(),"server"===this.options.sidePagination?this.initServer():this.initBody(),this.trigger("page-change",this.options.pageNumber,this.options.pageSize))},o.prototype.onPageListChange=function(b){var c=a(b.currentTarget);return c.parent().addClass("active").siblings().removeClass("active"),this.options.pageSize=c.text().toUpperCase()===this.options.formatAllRows().toUpperCase()?this.options.formatAllRows():+c.text(),this.$toolbar.find(".page-size").text(this.options.pageSize),this.updatePagination(b),!1},o.prototype.onPageFirst=function(a){return this.options.pageNumber=1,this.updatePagination(a),!1},o.prototype.onPagePre=function(a){return this.options.pageNumber-1===0?this.options.pageNumber=this.options.totalPages:this.options.pageNumber--,this.updatePagination(a),!1},o.prototype.onPageNext=function(a){return this.options.pageNumber+1>this.options.totalPages?this.options.pageNumber=1:this.options.pageNumber++,this.updatePagination(a),!1},o.prototype.onPageLast=function(a){return this.options.pageNumber=this.totalPages,this.updatePagination(a),!1},o.prototype.onPageNumber=function(b){return this.options.pageNumber!==+a(b.currentTarget).text()?(this.options.pageNumber=+a(b.currentTarget).text(),this.updatePagination(b),!1):void 0},o.prototype.initRow=function(b,e){var f,g=this,i=[],k={},m=[],n="",o={},p=[];if(!(a.inArray(b,this.hiddenRows)>-1)){if(k=h(this.options,this.options.rowStyle,[b,e],k),k&&k.css)for(f in k.css)m.push(f+": "+k.css[f]);if(o=h(this.options,this.options.rowAttributes,[b,e],o))for(f in o)p.push(c('%s="%s"',f,j(o[f])));return b._data&&!a.isEmptyObject(b._data)&&a.each(b._data,function(a,b){"index"!==a&&(n+=c(' data-%s="%s"',a,b))}),i.push("<tr",c(" %s",p.join(" ")),c(' id="%s"',a.isArray(b)?void 0:b._id),c(' class="%s"',k.classes||(a.isArray(b)?void 0:b._class)),c(' data-index="%s"',e),c(' data-uniqueid="%s"',b[this.options.uniqueId]),c("%s",n),">"),this.options.cardView&&i.push(c('<td colspan="%s"><div class="card-views">',this.header.fields.length)),!this.options.cardView&&this.options.detailView&&i.push("<td>",'<a class="detail-icon" href="#">',c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.detailOpen),"</a>","</td>"),a.each(this.header.fields,function(f,n){var o="",p=l(b,n,g.options.escape),q="",r="",s={},t="",u=g.header.classes[f],v="",w="",x="",y="",z=g.columns[f];if(!(g.fromHtml&&"undefined"==typeof p||!z.visible||g.options.cardView&&!z.cardVisible)){if(z.escape&&(p=j(p)),k=c('style="%s"',m.concat(g.header.styles[f]).join("; ")),b["_"+n+"_id"]&&(t=c(' id="%s"',b["_"+n+"_id"])),b["_"+n+"_class"]&&(u=c(' class="%s"',b["_"+n+"_class"])),b["_"+n+"_rowspan"]&&(w=c(' rowspan="%s"',b["_"+n+"_rowspan"])),b["_"+n+"_colspan"]&&(x=c(' colspan="%s"',b["_"+n+"_colspan"])),b["_"+n+"_title"]&&(y=c(' title="%s"',b["_"+n+"_title"])),s=h(g.header,g.header.cellStyles[f],[p,b,e,n],s),s.classes&&(u=c(' class="%s"',s.classes)),s.css){var A=[];for(var B in s.css)A.push(B+": "+s.css[B]);k=c('style="%s"',A.concat(g.header.styles[f]).join("; "))}q=h(z,g.header.formatters[f],[p,b,e],p),b["_"+n+"_data"]&&!a.isEmptyObject(b["_"+n+"_data"])&&a.each(b["_"+n+"_data"],function(a,b){"index"!==a&&(v+=c(' data-%s="%s"',a,b))}),z.checkbox||z.radio?(r=z.checkbox?"checkbox":r,r=z.radio?"radio":r,o=[c(g.options.cardView?'<div class="card-view %s">':'<td class="bs-checkbox %s">',z["class"]||""),"<input"+c(' data-index="%s"',e)+c(' name="%s"',g.options.selectItemName)+c(' type="%s"',r)+c(' value="%s"',b[g.options.idField])+c(' checked="%s"',q===!0||p||q&&q.checked?"checked":void 0)+c(' disabled="%s"',!z.checkboxEnabled||q&&q.disabled?"disabled":void 0)+" />",g.header.formatters[f]&&"string"==typeof q?q:"",g.options.cardView?"</div>":"</td>"].join(""),b[g.header.stateField]=q===!0||q&&q.checked):(q="undefined"==typeof q||null===q?g.options.undefinedText:q,o=g.options.cardView?['<div class="card-view">',g.options.showHeader?c('<span class="title" %s>%s</span>',k,d(g.columns,"field","title",n)):"",c('<span class="value">%s</span>',q),"</div>"].join(""):[c("<td%s %s %s %s %s %s %s>",t,u,k,v,w,x,y),q,"</td>"].join(""),g.options.cardView&&g.options.smartDisplay&&""===q&&(o='<div class="card-view"></div>')),i.push(o)}}),this.options.cardView&&i.push("</div></td>"),i.push("</tr>"),i.join(" ")}},o.prototype.initBody=function(b){var d=this,f=this.getData();this.trigger("pre-body",f),this.$body=this.$el.find(">tbody"),this.$body.length||(this.$body=a("<tbody></tbody>").appendTo(this.$el)),this.options.pagination&&"server"!==this.options.sidePagination||(this.pageFrom=1,this.pageTo=f.length);for(var g,i=a(document.createDocumentFragment()),j=this.pageFrom-1;j<this.pageTo;j++){
  4803. var k=f[j],m=this.initRow(k,j,f,i);g=g||!!m,m&&m!==!0&&i.append(m)}g||i.append('<tr class="no-records-found">'+c('<td colspan="%s">%s</td>',this.$header.find("th").length,this.options.formatNoMatches())+"</tr>"),this.$body.html(i),b||this.scrollTo(0),this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(b){var f=a(this),g=f.parent(),h=d.data[g.data("index")],i=f[0].cellIndex,j=d.getVisibleFields(),k=j[d.options.detailView&&!d.options.cardView?i-1:i],m=d.columns[e(d.columns,k)],n=l(h,k,d.options.escape);if(!f.find(".detail-icon").length&&(d.trigger("click"===b.type?"click-cell":"dbl-click-cell",k,n,h,f),d.trigger("click"===b.type?"click-row":"dbl-click-row",h,g,k),"click"===b.type&&d.options.clickToSelect&&m.clickToSelect)){var o=g.find(c('[name="%s"]',d.options.selectItemName));o.length&&o[0].click()}}),this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click",function(){var b=a(this),e=b.parent().parent(),g=e.data("index"),i=f[g];if(e.next().is("tr.detail-view"))b.find("i").attr("class",c("%s %s",d.options.iconsPrefix,d.options.icons.detailOpen)),d.trigger("collapse-row",g,i),e.next().remove();else{b.find("i").attr("class",c("%s %s",d.options.iconsPrefix,d.options.icons.detailClose)),e.after(c('<tr class="detail-view"><td colspan="%s"></td></tr>',e.find("td").length));var j=e.next().find("td"),k=h(d.options,d.options.detailFormatter,[g,i,j],"");1===j.length&&j.append(k),d.trigger("expand-row",g,i,j)}return d.resetView(),!1}),this.$selectItem=this.$body.find(c('[name="%s"]',this.options.selectItemName)),this.$selectItem.off("click").on("click",function(b){b.stopImmediatePropagation();var c=a(this),e=c.prop("checked"),f=d.data[c.data("index")];d.options.maintainSelected&&a(this).is(":radio")&&a.each(d.options.data,function(a,b){b[d.header.stateField]=!1}),f[d.header.stateField]=e,d.options.singleSelect&&(d.$selectItem.not(this).each(function(){d.data[a(this).data("index")][d.header.stateField]=!1}),d.$selectItem.filter(":checked").not(this).prop("checked",!1)),d.updateSelected(),d.trigger(e?"check":"uncheck",f,c)}),a.each(this.header.events,function(b,c){if(c){"string"==typeof c&&(c=h(null,c));var e=d.header.fields[b],f=a.inArray(e,d.getVisibleFields());d.options.detailView&&!d.options.cardView&&(f+=1);for(var g in c)d.$body.find(">tr:not(.no-records-found)").each(function(){var b=a(this),h=b.find(d.options.cardView?".card-view":"td").eq(f),i=g.indexOf(" "),j=g.substring(0,i),k=g.substring(i+1),l=c[g];h.find(k).off(j).on(j,function(a){var c=b.data("index"),f=d.data[c],g=f[e];l.apply(this,[a,g,f,c])})})}}),this.updateSelected(),this.resetView(),this.trigger("post-body",f)},o.prototype.initServer=function(b,c,d){var e,f=this,g={},i={searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder};this.options.pagination&&(i.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize,i.pageNumber=this.options.pageNumber),(d||this.options.url||this.options.ajax)&&("limit"===this.options.queryParamsType&&(i={search:i.searchText,sort:i.sortName,order:i.sortOrder},this.options.pagination&&(i.offset=this.options.pageSize===this.options.formatAllRows()?0:this.options.pageSize*(this.options.pageNumber-1),i.limit=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize)),a.isEmptyObject(this.filterColumnsPartial)||(i.filter=JSON.stringify(this.filterColumnsPartial,null)),g=h(this.options,this.options.queryParams,[i],g),a.extend(g,c||{}),g!==!1&&(b||this.$tableLoading.show(),e=a.extend({},h(null,this.options.ajaxOptions),{type:this.options.method,url:d||this.options.url,data:"application/json"===this.options.contentType&&"post"===this.options.method?JSON.stringify(g):g,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function(a){a=h(f.options,f.options.responseHandler,[a],a),f.load(a),f.trigger("load-success",a),b||f.$tableLoading.hide()},error:function(a){f.trigger("load-error",a.status,a),b||f.$tableLoading.hide()}}),this.options.ajax?h(this,this.options.ajax,[e],null):(this._xhr&&4!==this._xhr.readyState&&this._xhr.abort(),this._xhr=a.ajax(e))))},o.prototype.initSearchText=function(){if(this.options.search&&""!==this.options.searchText){var a=this.$toolbar.find(".search input");a.val(this.options.searchText),this.onSearch({currentTarget:a})}},o.prototype.getCaret=function(){var b=this;a.each(this.$header.find("th"),function(c,d){a(d).find(".sortable").removeClass("desc asc").addClass(a(d).data("field")===b.options.sortName?b.options.sortOrder:"both")})},o.prototype.updateSelected=function(){var b=this.$selectItem.filter(":enabled").length&&this.$selectItem.filter(":enabled").length===this.$selectItem.filter(":enabled").filter(":checked").length;this.$selectAll.add(this.$selectAll_).prop("checked",b),this.$selectItem.each(function(){a(this).closest("tr")[a(this).prop("checked")?"addClass":"removeClass"]("selected")})},o.prototype.updateRows=function(){var b=this;this.$selectItem.each(function(){b.data[a(this).data("index")][b.header.stateField]=a(this).prop("checked")})},o.prototype.resetRows=function(){var b=this;a.each(this.data,function(a,c){b.$selectAll.prop("checked",!1),b.$selectItem.prop("checked",!1),b.header.stateField&&(c[b.header.stateField]=!1)}),this.initHiddenRows()},o.prototype.trigger=function(b){var c=Array.prototype.slice.call(arguments,1);b+=".bs.table",this.options[o.EVENTS[b]].apply(this.options,c),this.$el.trigger(a.Event(b),c),this.options.onAll(b,c),this.$el.trigger(a.Event("all.bs.table"),[b,c])},o.prototype.resetHeader=function(){clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(a.proxy(this.fitHeader,this),this.$el.is(":hidden")?100:0)},o.prototype.fitHeader=function(){var b,d,e,f,h=this;if(h.$el.is(":hidden"))return void(h.timeoutId_=setTimeout(a.proxy(h.fitHeader,h),100));if(b=this.$tableBody.get(0),d=b.scrollWidth>b.clientWidth&&b.scrollHeight>b.clientHeight+this.$header.outerHeight()?g():0,this.$el.css("margin-top",-this.$header.outerHeight()),e=a(":focus"),e.length>0){var i=e.parents("th");if(i.length>0){var j=i.attr("data-field");if(void 0!==j){var k=this.$header.find("[data-field='"+j+"']");k.length>0&&k.find(":input").addClass("focus-temp")}}}this.$header_=this.$header.clone(!0,!0),this.$selectAll_=this.$header_.find('[name="btSelectAll"]'),this.$tableHeader.css({"margin-right":d}).find("table").css("width",this.$el.outerWidth()).html("").attr("class",this.$el.attr("class")).append(this.$header_),f=a(".focus-temp:visible:eq(0)"),f.length>0&&(f.focus(),this.$header.find(".focus-temp").removeClass("focus-temp")),this.$header.find("th[data-field]").each(function(){h.$header_.find(c('th[data-field="%s"]',a(this).data("field"))).data(a(this).data())});var l=this.getVisibleFields(),m=this.$header_.find("th");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(b){var d=a(this),e=b;h.options.detailView&&!h.options.cardView&&(0===b&&h.$header_.find("th.detail").find(".fht-cell").width(d.innerWidth()),e=b-1);var f=h.$header_.find(c('th[data-field="%s"]',l[e]));f.length>1&&(f=a(m[d[0].cellIndex])),f.find(".fht-cell").width(d.innerWidth())}),this.$tableBody.off("scroll").on("scroll",function(){h.$tableHeader.scrollLeft(a(this).scrollLeft()),h.options.showFooter&&!h.options.cardView&&h.$tableFooter.scrollLeft(a(this).scrollLeft())}),h.trigger("post-header")},o.prototype.resetFooter=function(){var b=this,d=b.getData(),e=[];this.options.showFooter&&!this.options.cardView&&(!this.options.cardView&&this.options.detailView&&e.push('<td><div class="th-inner">&nbsp;</div><div class="fht-cell"></div></td>'),a.each(this.columns,function(a,f){var g,i="",j="",k=[],l={},m=c(' class="%s"',f["class"]);if(f.visible&&(!b.options.cardView||f.cardVisible)){if(i=c("text-align: %s; ",f.falign?f.falign:f.align),j=c("vertical-align: %s; ",f.valign),l=h(null,b.options.footerStyle),l&&l.css)for(g in l.css)k.push(g+": "+l.css[g]);e.push("<td",m,c(' style="%s"',i+j+k.concat().join("; ")),">"),e.push('<div class="th-inner">'),e.push(h(f,f.footerFormatter,[d],"&nbsp;")||"&nbsp;"),e.push("</div>"),e.push('<div class="fht-cell"></div>'),e.push("</div>"),e.push("</td>")}}),this.$tableFooter.find("tr").html(e.join("")),this.$tableFooter.show(),clearTimeout(this.timeoutFooter_),this.timeoutFooter_=setTimeout(a.proxy(this.fitFooter,this),this.$el.is(":hidden")?100:0))},o.prototype.fitFooter=function(){var b,c,d;return clearTimeout(this.timeoutFooter_),this.$el.is(":hidden")?void(this.timeoutFooter_=setTimeout(a.proxy(this.fitFooter,this),100)):(c=this.$el.css("width"),d=c>this.$tableBody.width()?g():0,this.$tableFooter.css({"margin-right":d}).find("table").css("width",c).attr("class",this.$el.attr("class")),b=this.$tableFooter.find("td"),void this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(c){var d=a(this);b.eq(c).find(".fht-cell").width(d.innerWidth())}))},o.prototype.toggleColumn=function(a,b,d){if(-1!==a&&(this.columns[a].visible=b,this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns)){var e=this.$toolbar.find(".keep-open input").prop("disabled",!1);d&&e.filter(c('[value="%s"]',a)).prop("checked",b),e.filter(":checked").length<=this.options.minimumCountColumns&&e.filter(":checked").prop("disabled",!0)}},o.prototype.getVisibleFields=function(){var b=this,c=[];return a.each(this.header.fields,function(a,d){var f=b.columns[e(b.columns,d)];f.visible&&c.push(d)}),c},o.prototype.resetView=function(a){var b=0;if(a&&a.height&&(this.options.height=a.height),this.$selectAll.prop("checked",this.$selectItem.length>0&&this.$selectItem.length===this.$selectItem.filter(":checked").length),this.options.height){var c=this.$toolbar.outerHeight(!0),d=this.$pagination.outerHeight(!0),e=this.options.height-c-d;this.$tableContainer.css("height",e+"px")}return this.options.cardView?(this.$el.css("margin-top","0"),this.$tableContainer.css("padding-bottom","0"),void this.$tableFooter.hide()):(this.options.showHeader&&this.options.height?(this.$tableHeader.show(),this.resetHeader(),b+=this.$header.outerHeight()):(this.$tableHeader.hide(),this.trigger("post-header")),this.options.showFooter&&(this.resetFooter(),this.options.height&&(b+=this.$tableFooter.outerHeight()+1)),this.getCaret(),this.$tableContainer.css("padding-bottom",b+"px"),void this.trigger("reset-view"))},o.prototype.getData=function(b){return!this.searchText&&a.isEmptyObject(this.filterColumns)&&a.isEmptyObject(this.filterColumnsPartial)?b?this.options.data.slice(this.pageFrom-1,this.pageTo):this.options.data:b?this.data.slice(this.pageFrom-1,this.pageTo):this.data},o.prototype.load=function(b){var c=!1;"server"===this.options.sidePagination?(this.options.totalRows=b[this.options.totalField],c=b.fixedScroll,b=b[this.options.dataField]):a.isArray(b)||(c=b.fixedScroll,b=b.data),this.initData(b),this.initSearch(),this.initPagination(),this.initBody(c)},o.prototype.append=function(a){this.initData(a,"append"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.prepend=function(a){this.initData(a,"prepend"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.remove=function(b){var c,d,e=this.options.data.length;if(b.hasOwnProperty("field")&&b.hasOwnProperty("values")){for(c=e-1;c>=0;c--)d=this.options.data[c],d.hasOwnProperty(b.field)&&-1!==a.inArray(d[b.field],b.values)&&(this.options.data.splice(c,1),"server"===this.options.sidePagination&&(this.options.totalRows-=1));e!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))}},o.prototype.removeAll=function(){this.options.data.length>0&&(this.options.data.splice(0,this.options.data.length),this.initSearch(),this.initPagination(),this.initBody(!0))},o.prototype.getRowByUniqueId=function(a){var b,c,d,e=this.options.uniqueId,f=this.options.data.length,g=null;for(b=f-1;b>=0;b--){if(c=this.options.data[b],c.hasOwnProperty(e))d=c[e];else{if(!c._data.hasOwnProperty(e))continue;d=c._data[e]}if("string"==typeof d?a=a.toString():"number"==typeof d&&(Number(d)===d&&d%1===0?a=parseInt(a):d===Number(d)&&0!==d&&(a=parseFloat(a))),d===a){g=c;break}}return g},o.prototype.removeByUniqueId=function(a){var b=this.options.data.length,c=this.getRowByUniqueId(a);c&&this.options.data.splice(this.options.data.indexOf(c),1),b!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initBody(!0))},o.prototype.updateByUniqueId=function(b){var c=this,d=a.isArray(b)?b:[b];a.each(d,function(b,d){var e;d.hasOwnProperty("id")&&d.hasOwnProperty("row")&&(e=a.inArray(c.getRowByUniqueId(d.id),c.options.data),-1!==e&&a.extend(c.options.data[e],d.row))}),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.insertRow=function(a){a.hasOwnProperty("index")&&a.hasOwnProperty("row")&&(this.data.splice(a.index,0,a.row),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))},o.prototype.updateRow=function(b){var c=this,d=a.isArray(b)?b:[b];a.each(d,function(b,d){d.hasOwnProperty("index")&&d.hasOwnProperty("row")&&a.extend(c.options.data[d.index],d.row)}),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.initHiddenRows=function(){this.hiddenRows=[]},o.prototype.showRow=function(a){this.toggleRow(a,!0)},o.prototype.hideRow=function(a){this.toggleRow(a,!1)},o.prototype.toggleRow=function(b,c){var d,e;b.hasOwnProperty("index")?d=this.getData()[b.index]:b.hasOwnProperty("uniqueId")&&(d=this.getRowByUniqueId(b.uniqueId)),d&&(e=a.inArray(d,this.hiddenRows),c||-1!==e?c&&e>-1&&this.hiddenRows.splice(e,1):this.hiddenRows.push(d),this.initBody(!0))},o.prototype.getHiddenRows=function(){var b=this,c=this.getData(),d=[];return a.each(c,function(c,e){a.inArray(e,b.hiddenRows)>-1&&d.push(e)}),this.hiddenRows=d,d},o.prototype.mergeCells=function(b){var c,d,e,f=b.index,g=a.inArray(b.field,this.getVisibleFields()),h=b.rowspan||1,i=b.colspan||1,j=this.$body.find(">tr");if(this.options.detailView&&!this.options.cardView&&(g+=1),e=j.eq(f).find(">td").eq(g),!(0>f||0>g||f>=this.data.length)){for(c=f;f+h>c;c++)for(d=g;g+i>d;d++)j.eq(c).find(">td").eq(d).hide();e.attr("rowspan",h).attr("colspan",i).show()}},o.prototype.updateCell=function(a){a.hasOwnProperty("index")&&a.hasOwnProperty("field")&&a.hasOwnProperty("value")&&(this.data[a.index][a.field]=a.value,a.reinit!==!1&&(this.initSort(),this.initBody(!0)))},o.prototype.getOptions=function(){return this.options},o.prototype.getSelections=function(){var b=this;return a.grep(this.options.data,function(a){return a[b.header.stateField]===!0})},o.prototype.getAllSelections=function(){var b=this;return a.grep(this.options.data,function(a){return a[b.header.stateField]})},o.prototype.checkAll=function(){this.checkAll_(!0)},o.prototype.uncheckAll=function(){this.checkAll_(!1)},o.prototype.checkInvert=function(){var b=this,c=b.$selectItem.filter(":enabled"),d=c.filter(":checked");c.each(function(){a(this).prop("checked",!a(this).prop("checked"))}),b.updateRows(),b.updateSelected(),b.trigger("uncheck-some",d),d=b.getSelections(),b.trigger("check-some",d)},o.prototype.checkAll_=function(a){var b;a||(b=this.getSelections()),this.$selectAll.add(this.$selectAll_).prop("checked",a),this.$selectItem.filter(":enabled").prop("checked",a),this.updateRows(),a&&(b=this.getSelections()),this.trigger(a?"check-all":"uncheck-all",b)},o.prototype.check=function(a){this.check_(!0,a)},o.prototype.uncheck=function(a){this.check_(!1,a)},o.prototype.check_=function(a,b){var d=this.$selectItem.filter(c('[data-index="%s"]',b)).prop("checked",a);this.data[b][this.header.stateField]=a,this.updateSelected(),this.trigger(a?"check":"uncheck",this.data[b],d)},o.prototype.checkBy=function(a){this.checkBy_(!0,a)},o.prototype.uncheckBy=function(a){this.checkBy_(!1,a)},o.prototype.checkBy_=function(b,d){if(d.hasOwnProperty("field")&&d.hasOwnProperty("values")){var e=this,f=[];a.each(this.options.data,function(g,h){if(!h.hasOwnProperty(d.field))return!1;if(-1!==a.inArray(h[d.field],d.values)){var i=e.$selectItem.filter(":enabled").filter(c('[data-index="%s"]',g)).prop("checked",b);h[e.header.stateField]=b,f.push(h),e.trigger(b?"check":"uncheck",h,i)}}),this.updateSelected(),this.trigger(b?"check-some":"uncheck-some",f)}},o.prototype.destroy=function(){this.$el.insertBefore(this.$container),a(this.options.toolbar).insertBefore(this.$el),this.$container.next().remove(),this.$container.remove(),this.$el.html(this.$el_.html()).css("margin-top","0").attr("class",this.$el_.attr("class")||"")},o.prototype.showLoading=function(){this.$tableLoading.show()},o.prototype.hideLoading=function(){this.$tableLoading.hide()},o.prototype.togglePagination=function(){this.options.pagination=!this.options.pagination;var a=this.$toolbar.find('button[name="paginationSwitch"] i');this.options.pagination?a.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchDown):a.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchUp),this.updatePagination()},o.prototype.refresh=function(a){a&&a.url&&(this.options.url=a.url),a&&a.pageNumber&&(this.options.pageNumber=a.pageNumber),a&&a.pageSize&&(this.options.pageSize=a.pageSize),this.initServer(a&&a.silent,a&&a.query,a&&a.url),this.trigger("refresh",a)},o.prototype.resetWidth=function(){this.options.showHeader&&this.options.height&&this.fitHeader(),this.options.showFooter&&this.fitFooter()},o.prototype.showColumn=function(a){this.toggleColumn(e(this.columns,a),!0,!0)},o.prototype.hideColumn=function(a){this.toggleColumn(e(this.columns,a),!1,!0)},o.prototype.getHiddenColumns=function(){return a.grep(this.columns,function(a){return!a.visible})},o.prototype.getVisibleColumns=function(){return a.grep(this.columns,function(a){return a.visible})},o.prototype.toggleAllColumns=function(b){if(a.each(this.columns,function(a){this.columns[a].visible=b}),this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns){var c=this.$toolbar.find(".keep-open input").prop("disabled",!1);c.filter(":checked").length<=this.options.minimumCountColumns&&c.filter(":checked").prop("disabled",!0)}},o.prototype.showAllColumns=function(){this.toggleAllColumns(!0)},o.prototype.hideAllColumns=function(){this.toggleAllColumns(!1)},o.prototype.filterBy=function(b){this.filterColumns=a.isEmptyObject(b)?{}:b,this.options.pageNumber=1,this.initSearch(),this.updatePagination()},o.prototype.scrollTo=function(a){return"string"==typeof a&&(a="bottom"===a?this.$tableBody[0].scrollHeight:0),"number"==typeof a&&this.$tableBody.scrollTop(a),"undefined"==typeof a?this.$tableBody.scrollTop():void 0},o.prototype.getScrollPosition=function(){return this.scrollTo()},o.prototype.selectPage=function(a){a>0&&a<=this.options.totalPages&&(this.options.pageNumber=a,this.updatePagination())},o.prototype.prevPage=function(){this.options.pageNumber>1&&(this.options.pageNumber--,this.updatePagination())},o.prototype.nextPage=function(){this.options.pageNumber<this.options.totalPages&&(this.options.pageNumber++,this.updatePagination())},o.prototype.toggleView=function(){this.options.cardView=!this.options.cardView,this.initHeader(),this.initBody(),this.trigger("toggle",this.options.cardView)},o.prototype.refreshOptions=function(b){i(this.options,b,!0)||(this.options=a.extend(this.options,b),this.trigger("refresh-options",this.options),this.destroy(),this.init())},o.prototype.resetSearch=function(a){var b=this.$toolbar.find(".search input");b.val(a||""),this.onSearch({currentTarget:b})},o.prototype.expandRow_=function(a,b){var d=this.$body.find(c('> tr[data-index="%s"]',b));d.next().is("tr.detail-view")===(a?!1:!0)&&d.find("> td > .detail-icon").click()},o.prototype.expandRow=function(a){this.expandRow_(!0,a)},o.prototype.collapseRow=function(a){this.expandRow_(!1,a)},o.prototype.expandAllRows=function(b){if(b){var d=this.$body.find(c('> tr[data-index="%s"]',0)),e=this,f=null,g=!1,h=-1;if(d.next().is("tr.detail-view")?d.next().next().is("tr.detail-view")||(d.next().find(".detail-icon").click(),g=!0):(d.find("> td > .detail-icon").click(),g=!0),g)try{h=setInterval(function(){f=e.$body.find("tr.detail-view").last().find(".detail-icon"),f.length>0?f.click():clearInterval(h)},1)}catch(i){clearInterval(h)}}else for(var j=this.$body.children(),k=0;k<j.length;k++)this.expandRow_(!0,a(j[k]).data("index"))},o.prototype.collapseAllRows=function(b){if(b)this.expandRow_(!1,0);else for(var c=this.$body.children(),d=0;d<c.length;d++)this.expandRow_(!1,a(c[d]).data("index"))},o.prototype.updateFormatText=function(a,b){this.options[c("format%s",a)]&&("string"==typeof b?this.options[c("format%s",a)]=function(){return b}:"function"==typeof b&&(this.options[c("format%s",a)]=b)),this.initToolbar(),this.initPagination(),this.initBody()};var p=["getOptions","getSelections","getAllSelections","getData","load","append","prepend","remove","removeAll","insertRow","updateRow","updateCell","updateByUniqueId","removeByUniqueId","getRowByUniqueId","showRow","hideRow","getHiddenRows","mergeCells","checkAll","uncheckAll","checkInvert","check","uncheck","checkBy","uncheckBy","refresh","resetView","resetWidth","destroy","showLoading","hideLoading","showColumn","hideColumn","getHiddenColumns","getVisibleColumns","showAllColumns","hideAllColumns","filterBy","scrollTo","getScrollPosition","selectPage","prevPage","nextPage","togglePagination","toggleView","refreshOptions","resetSearch","expandRow","collapseRow","expandAllRows","collapseAllRows","updateFormatText"];a.fn.bootstrapTable=function(b){var c,d=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=a(this),f=e.data("bootstrap.table"),g=a.extend({},o.DEFAULTS,e.data(),"object"==typeof b&&b);if("string"==typeof b){if(a.inArray(b,p)<0)throw new Error("Unknown method: "+b);if(!f)return;c=f[b].apply(f,d),"destroy"===b&&e.removeData("bootstrap.table")}f||e.data("bootstrap.table",f=new o(this,g))}),"undefined"==typeof c?this:c},a.fn.bootstrapTable.Constructor=o,a.fn.bootstrapTable.defaults=o.DEFAULTS,a.fn.bootstrapTable.columnDefaults=o.COLUMN_DEFAULTS,a.fn.bootstrapTable.locales=o.LOCALES,a.fn.bootstrapTable.methods=p,a.fn.bootstrapTable.utils={sprintf:c,getFieldIndex:e,compareObjects:i,calculateObjectValue:h,getItemField:l,objectKeys:n,isIEBrowser:m},a(function(){a('[data-toggle="table"]').bootstrapTable()})}(jQuery);
  4804. define("bootstrap-table", ["bootstrap"], (function (global) {
  4805. return function () {
  4806. var ret, fn;
  4807. return ret || global.$.fn.bootstrapTable;
  4808. };
  4809. }(this)));
  4810. /**
  4811. * Bootstrap Table Chinese translation
  4812. * Author: Zhixin Wen<wenzhixin2010@gmail.com>
  4813. */
  4814. (function ($) {
  4815. 'use strict';
  4816. $.fn.bootstrapTable.locales['zh-CN'] = {
  4817. formatLoadingMessage: function () {
  4818. return '正在努力地加载数据中,请稍候……';
  4819. },
  4820. formatRecordsPerPage: function (pageNumber) {
  4821. return '每页显示 ' + pageNumber + ' 条记录';
  4822. },
  4823. formatShowingRows: function (pageFrom, pageTo, totalRows) {
  4824. return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
  4825. },
  4826. formatSearch: function () {
  4827. return '搜索';
  4828. },
  4829. formatNoMatches: function () {
  4830. return '没有找到匹配的记录';
  4831. },
  4832. formatPaginationSwitch: function () {
  4833. return '隐藏/显示分页';
  4834. },
  4835. formatRefresh: function () {
  4836. return '刷新';
  4837. },
  4838. formatToggle: function () {
  4839. return '切换';
  4840. },
  4841. formatColumns: function () {
  4842. return '列';
  4843. },
  4844. formatExport: function () {
  4845. return '导出数据';
  4846. },
  4847. formatClearFilters: function () {
  4848. return '清空过滤';
  4849. }
  4850. };
  4851. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
  4852. })(jQuery);
  4853. define("bootstrap-table-lang", ["bootstrap-table"], (function (global) {
  4854. return function () {
  4855. var ret, fn;
  4856. return ret || global.$.fn.bootstrapTable.defaults;
  4857. };
  4858. }(this)));
  4859. /*
  4860. tableExport.jquery.plugin
  4861. Version 1.9.9
  4862. Copyright (c) 2015-2018 hhurz, https://github.com/hhurz
  4863. Original Work Copyright (c) 2014 Giri Raj
  4864. Licensed under the MIT License
  4865. */
  4866. var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,h,u){c instanceof String&&(c=String(c));for(var C=c.length,D=0;D<C;D++){var O=c[D];if(h.call(u,O,D,c))return{i:D,v:O}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,h,u){c!=Array.prototype&&c!=Object.prototype&&(c[h]=u.value)};
  4867. $jscomp.getGlobal=function(c){return"undefined"!=typeof window&&window===c?c:"undefined"!=typeof global&&null!=global?global:c};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(c,h,u,C){if(h){u=$jscomp.global;c=c.split(".");for(C=0;C<c.length-1;C++){var D=c[C];D in u||(u[D]={});u=u[D]}c=c[c.length-1];C=u[c];h=h(C);h!=C&&null!=h&&$jscomp.defineProperty(u,c,{configurable:!0,writable:!0,value:h})}};
  4868. $jscomp.polyfill("Array.prototype.find",function(c){return c?c:function(c,u){return $jscomp.findInternal(this,c,u).v}},"es6","es3");
  4869. (function(c){c.fn.tableExport=function(h){function u(b){var d=[];C(b,"tbody").each(function(){d.push.apply(d,D(c(this),a.tbodySelector).toArray())});a.tfootSelector.length&&C(b,"tfoot").each(function(){d.push.apply(d,D(c(this),a.tfootSelector).toArray())});return d}function C(b,d){var a=b.parents("table").length;return b.find(d).filter(function(){return c(this).closest("table").parents("table").length===a})}function D(b,d){return b.find(d).filter(function(){return 0===c(this).find("table").length&&
  4870. 1===c(this).parents("table").length})}function O(b){var d=[];c(b).find("thead").first().find("th").each(function(b,a){void 0!==c(a).attr("data-field")?d[b]=c(a).attr("data-field"):d[b]=b.toString()});return d}function P(b){var d="undefined"!==typeof b[0].cellIndex,a="undefined"!==typeof b[0].rowIndex,p=d||a?Aa(b):b.is(":visible"),g=b.data("tableexport-display");d&&"none"!=g&&"always"!=g&&(b=c(b[0].parentNode),a="undefined"!==typeof b[0].rowIndex,g=b.data("tableexport-display"));a&&"none"!=g&&"always"!=
  4871. g&&(g=b.closest("table").data("tableexport-display"));return"none"!==g&&(1==p||"always"==g)}function Aa(b){var d=[];T&&(d=K.filter(function(){var d=!1;this.nodeType==b[0].nodeType&&("undefined"!==typeof this.rowIndex&&this.rowIndex==b[0].rowIndex?d=!0:"undefined"!==typeof this.cellIndex&&this.cellIndex==b[0].cellIndex&&"undefined"!==typeof this.parentNode.rowIndex&&"undefined"!==typeof b[0].parentNode.rowIndex&&this.parentNode.rowIndex==b[0].parentNode.rowIndex&&(d=!0));return d}));return 0==T||0==
  4872. d.length}function Ba(b,d,f){var p=!1;P(b)?0<a.ignoreColumn.length&&(-1!=c.inArray(f,a.ignoreColumn)||-1!=c.inArray(f-d,a.ignoreColumn)||Q.length>f&&"undefined"!=typeof Q[f]&&-1!=c.inArray(Q[f],a.ignoreColumn))&&(p=!0):p=!0;return p}function B(b,d,f,p,g){if("function"===typeof g){var l=!1;"function"===typeof a.onIgnoreRow&&(l=a.onIgnoreRow(c(b),f));if(!1===l&&-1==c.inArray(f,a.ignoreRow)&&-1==c.inArray(f-p,a.ignoreRow)&&P(c(b))){var x=c(b).find(d),r=0;x.each(function(b){var d=c(this),a,l=R(this),p=
  4873. S(this);c.each(G,function(){if(f>=this.s.r&&f<=this.e.r&&r>=this.s.c&&r<=this.e.c)for(a=0;a<=this.e.c-this.s.c;++a)g(null,f,r++)});if(!1===Ba(d,x.length,b)){if(p||l)l=l||1,G.push({s:{r:f,c:r},e:{r:f+(p||1)-1,c:r+l-1}});g(this,f,r++)}if(l)for(a=0;a<l-1;++a)g(null,f,r++)});c.each(G,function(){if(f>=this.s.r&&f<=this.e.r&&r>=this.s.c&&r<=this.e.c)for(aa=0;aa<=this.e.c-this.s.c;++aa)g(null,f,r++)})}}}function na(b,d){!0===a.consoleLog&&console.log(b.output());if("string"===a.outputMode)return b.output();
  4874. if("base64"===a.outputMode)return L(b.output());if("window"===a.outputMode)window.URL=window.URL||window.webkitURL,window.open(window.URL.createObjectURL(b.output("blob")));else try{var f=b.output("blob");saveAs(f,a.fileName+".pdf")}catch(p){H(a.fileName+".pdf","data:application/pdf"+(d?"":";base64")+",",d?b.output("blob"):b.output())}}function oa(b,d,a){var f=0;"undefined"!==typeof a&&(f=a.colspan);if(0<=f){for(var g=b.width,c=b.textPos.x,x=d.table.columns.indexOf(d.column),r=1;r<f;r++)g+=d.table.columns[x+
  4875. r].width;1<f&&("right"===b.styles.halign?c=b.textPos.x+g-b.width:"center"===b.styles.halign&&(c=b.textPos.x+(g-b.width)/2));b.width=g;b.textPos.x=c;"undefined"!==typeof a&&1<a.rowspan&&(b.height*=a.rowspan);if("middle"===b.styles.valign||"bottom"===b.styles.valign)a=("string"===typeof b.text?b.text.split(/\r\n|\r|\n/g):b.text).length||1,2<a&&(b.textPos.y-=(2-1.15)/2*d.row.styles.fontSize*(a-2)/3);return!0}return!1}function pa(b,d,a){"undefined"!=typeof a.images&&d.each(function(){var d=c(this).children();
  4876. if(c(this).is("img")){var g=qa(this.src);a.images[g]={url:this.src,src:this.src}}"undefined"!=typeof d&&0<d.length&&pa(b,d,a)})}function Ca(b,d){function a(b){if(b.url){var a=new Image;g=++l;a.crossOrigin="Anonymous";a.onerror=a.onload=function(){if(a.complete&&(0===a.src.indexOf("data:image/")&&(a.width=b.width||a.width||0,a.height=b.height||a.height||0),a.width+a.height)){var c=document.createElement("canvas"),f=c.getContext("2d");c.width=a.width;c.height=a.height;f.drawImage(a,0,0);b.src=c.toDataURL("image/jpeg")}--l||
  4877. d(g)};a.src=b.url}}var c,g=0,l=0;if("undefined"!=typeof b.images)for(c in b.images)b.images.hasOwnProperty(c)&&a(b.images[c]);(b=l)||(d(g),b=void 0);return b}function ra(b,d,f){d.each(function(){var d=c(this).children(),g=0;if(c(this).is("div")){var l=ba(M(this,"background-color"),[255,255,255]),x=ba(M(this,"border-top-color"),[0,0,0]),r=ca(this,"border-top-width",a.jspdf.unit),e=this.getBoundingClientRect(),h=this.offsetLeft*f.dw;g=this.offsetTop*f.dh;var k=e.width*f.dw;e=e.height*f.dh;f.doc.setDrawColor.apply(void 0,
  4878. x);f.doc.setFillColor.apply(void 0,l);f.doc.setLineWidth(r);f.doc.rect(b.x+h,b.y+g,k,e,r?"FD":"F")}else if(c(this).is("img")&&"undefined"!=typeof f.images&&(l=qa(this.src),l=f.images[l],"undefined"!=typeof l)){x=b.width/b.height;r=this.width/this.height;h=b.width;k=b.height;e=19.049976/25.4;r<=x?(k=Math.min(b.height,this.height),h=this.width*k/this.height):r>x&&(h=Math.min(b.width,this.width),k=this.height*h/this.width);h*=e;k*=e;k<b.height&&(g=(b.height-k)/2);try{f.doc.addImage(l.src,b.textPos.x,
  4879. b.y+g,h,k)}catch(Ga){}b.textPos.x+=h}"undefined"!=typeof d&&0<d.length&&ra(b,d,f)})}function sa(b,a,f){if("function"===typeof f.onAutotableText)f.onAutotableText(f.doc,b,a);else{var d=b.textPos.x,g=b.textPos.y,l={halign:b.styles.halign,valign:b.styles.valign};if(a.length){for(a=a[0];a.previousSibling;)a=a.previousSibling;for(var x=!1,r=!1;a;){var e=a.innerText||a.textContent||"";e=(e.length&&" "==e[0]?" ":"")+c.trim(e)+(1<e.length&&" "==e[e.length-1]?" ":"");c(a).is("br")&&(d=b.textPos.x,g+=f.doc.internal.getFontSize());
  4880. c(a).is("b")?x=!0:c(a).is("i")&&(r=!0);(x||r)&&f.doc.setFontType(x&&r?"bolditalic":x?"bold":"italic");var h=f.doc.getStringUnitWidth(e)*f.doc.internal.getFontSize();if(h){if("linebreak"===b.styles.overflow&&d>b.textPos.x&&d+h>b.textPos.x+b.width){if(0<=".,!%*;:=-".indexOf(e.charAt(0))){var k=e.charAt(0);h=f.doc.getStringUnitWidth(k)*f.doc.internal.getFontSize();d+h<=b.textPos.x+b.width&&(f.doc.autoTableText(k,d,g,l),e=e.substring(1,e.length));h=f.doc.getStringUnitWidth(e)*f.doc.internal.getFontSize()}d=
  4881. b.textPos.x;g+=f.doc.internal.getFontSize()}for(;e.length&&d+h>b.textPos.x+b.width;)e=e.substring(0,e.length-1),h=f.doc.getStringUnitWidth(e)*f.doc.internal.getFontSize();f.doc.autoTableText(e,d,g,l);d+=h}if(x||r)c(a).is("b")?x=!1:c(a).is("i")&&(r=!1),f.doc.setFontType(x||r?x?"bold":"italic":"normal");a=a.nextSibling}b.textPos.x=d;b.textPos.y=g}else f.doc.autoTableText(b.text,b.textPos.x,b.textPos.y,l)}}function da(b,a,c){return b.replace(new RegExp(a.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),
  4882. "g"),c)}function ha(b){b=da(b||"0",a.numbers.html.thousandsSeparator,"");b=da(b,a.numbers.html.decimalMark,".");return"number"===typeof b||!1!==jQuery.isNumeric(b)?b:!1}function Da(b){-1<b.indexOf("%")?(b=ha(b.replace(/%/g,"")),!1!==b&&(b/=100)):b=!1;return b}function z(b,d,f){var p="";if(null!==b){var g=c(b);if(g[0].hasAttribute("data-tableexport-value"))var l=(l=g.data("tableexport-value"))?l+"":"";else if(l=g.html(),"function"===typeof a.onCellHtmlData)l=a.onCellHtmlData(g,d,f,l);else if(""!=l){var e=
  4883. c.parseHTML(l),h=0,k=0;l="";c.each(e,function(){if(c(this).is("input"))l+=g.find("input").eq(h++).val();else if(c(this).is("select"))l+=g.find("select option:selected").eq(k++).text();else if("undefined"===typeof c(this).html())l+=c(this).text();else if(void 0===jQuery().bootstrapTable||!0!==c(this).hasClass("filterControl")&&0===c(b).parents(".detail-view").length)l+=c(this).html()})}if(!0===a.htmlContent)p=c.trim(l);else if(l&&""!=l)if(""!=c(b).data("tableexport-cellformat")){var n=l.replace(/\n/g,
  4884. "\u2028").replace(/<br\s*[\/]?>/gi,"\u2060"),m=c("<div/>").html(n).contents();e=!1;n="";c.each(m.text().split("\u2028"),function(b,a){0<b&&(n+=" ");n+=c.trim(a)});c.each(n.split("\u2060"),function(b,a){0<b&&(p+="\n");p+=c.trim(a).replace(/\u00AD/g,"")});if("json"==a.type||"excel"===a.type&&"xmlss"===a.excelFileFormat||!1===a.numbers.output)e=ha(p),!1!==e&&(p=Number(e));else if(a.numbers.html.decimalMark!=a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!=a.numbers.output.thousandsSeparator)if(e=
  4885. ha(p),!1!==e){m=(""+e.substr(0>e?1:0)).split(".");1==m.length&&(m[1]="");var q=3<m[0].length?m[0].length%3:0;p=(0>e?"-":"")+(a.numbers.output.thousandsSeparator?(q?m[0].substr(0,q)+a.numbers.output.thousandsSeparator:"")+m[0].substr(q).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):m[0])+(m[1].length?a.numbers.output.decimalMark+m[1]:"")}}else p=l;!0===a.escape&&(p=escape(p));"function"===typeof a.onCellData&&(p=a.onCellData(g,d,f,p))}return p}function Ea(b,a,c){return a+"-"+c.toLowerCase()}
  4886. function ba(b,a){(b=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(b))&&(a=[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]);return a}function ta(b){var a=M(b,"text-align"),c=M(b,"font-weight"),p=M(b,"font-style"),g="";"start"==a&&(a="rtl"==M(b,"direction")?"right":"left");700<=c&&(g="bold");"italic"==p&&(g+=p);""===g&&(g="normal");a={style:{align:a,bcolor:ba(M(b,"background-color"),[255,255,255]),color:ba(M(b,"color"),[0,0,0]),fstyle:g},colspan:R(b),rowspan:S(b)};null!==b&&(b=b.getBoundingClientRect(),
  4887. a.rect={width:b.width,height:b.height});return a}function R(b){var a=c(b).data("tableexport-colspan");"undefined"==typeof a&&c(b).is("[colspan]")&&(a=c(b).attr("colspan"));return parseInt(a)||0}function S(b){var a=c(b).data("tableexport-rowspan");"undefined"==typeof a&&c(b).is("[rowspan]")&&(a=c(b).attr("rowspan"));return parseInt(a)||0}function M(b,a){try{return window.getComputedStyle?(a=a.replace(/([a-z])([A-Z])/,Ea),window.getComputedStyle(b,null).getPropertyValue(a)):b.currentStyle?b.currentStyle[a]:
  4888. b.style[a]}catch(f){}return""}function ca(b,a,c){a=M(b,a).match(/\d+/);if(null!==a){a=a[0];b=b.parentElement;var d=document.createElement("div");d.style.overflow="hidden";d.style.visibility="hidden";b.appendChild(d);d.style.width=100+c;c=100/d.offsetWidth;b.removeChild(d);return a*c}return 0}function ia(){if(!(this instanceof ia))return new ia;this.SheetNames=[];this.Sheets={}}function ua(a){for(var b=new ArrayBuffer(a.length),c=new Uint8Array(b),e=0;e!=a.length;++e)c[e]=a.charCodeAt(e)&255;return b}
  4889. function Fa(a){for(var b={},c={s:{c:1E7,r:1E7},e:{c:0,r:0}},e=0;e!=a.length;++e)for(var g=0;g!=a[e].length;++g){c.s.r>e&&(c.s.r=e);c.s.c>g&&(c.s.c=g);c.e.r<e&&(c.e.r=e);c.e.c<g&&(c.e.c=g);var l={v:a[e][g]};if(null!==l.v){var h=XLSX.utils.encode_cell({c:g,r:e});if("number"===typeof l.v)l.t="n";else if("boolean"===typeof l.v)l.t="b";else if(l.v instanceof Date){l.t="n";l.z=XLSX.SSF._table[14];var r=l;var k=(Date.parse(l.v)-new Date(Date.UTC(1899,11,30)))/864E5;r.v=k}else l.t="s";b[h]=l}}1E7>c.s.c&&
  4890. (b["!ref"]=XLSX.utils.encode_range(c));return b}function qa(a){var b=0,c;if(0===a.length)return b;var e=0;for(c=a.length;e<c;e++){var g=a.charCodeAt(e);b=(b<<5)-b+g;b|=0}return b}function H(a,c,f){var b=window.navigator.userAgent;if(!1!==a&&window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(new Blob([f]),a);else if(!1!==a&&(0<b.indexOf("MSIE ")||b.match(/Trident.*rv\:11\./))){if(c=document.createElement("iframe")){document.body.appendChild(c);c.setAttribute("style","display:none");
  4891. c.contentDocument.open("txt/plain","replace");c.contentDocument.write(f);c.contentDocument.close();c.contentDocument.focus();switch(a.substr(a.lastIndexOf(".")+1)){case "doc":case "json":case "png":case "pdf":case "xls":case "xlsx":a+=".txt"}c.contentDocument.execCommand("SaveAs",!0,a);document.body.removeChild(c)}}else{var g=document.createElement("a");if(g){var d=null;g.style.display="none";!1!==a?g.download=a:g.target="_blank";"object"==typeof f?(window.URL=window.URL||window.webkitURL,d=window.URL.createObjectURL(f),
  4892. g.href=d):0<=c.toLowerCase().indexOf("base64,")?g.href=c+L(f):g.href=c+encodeURIComponent(f);document.body.appendChild(g);if(document.createEvent)null===ea&&(ea=document.createEvent("MouseEvents")),ea.initEvent("click",!0,!1),g.dispatchEvent(ea);else if(document.createEventObject)g.fireEvent("onclick");else if("function"==typeof g.onclick)g.onclick();setTimeout(function(){d&&window.URL.revokeObjectURL(d);document.body.removeChild(g)},100)}}}function L(a){var b,c="",e=0;if("string"===typeof a){a=a.replace(/\x0d\x0a/g,
  4893. "\n");var g="";for(b=0;b<a.length;b++){var l=a.charCodeAt(b);128>l?g+=String.fromCharCode(l):(127<l&&2048>l?g+=String.fromCharCode(l>>6|192):(g+=String.fromCharCode(l>>12|224),g+=String.fromCharCode(l>>6&63|128)),g+=String.fromCharCode(l&63|128))}a=g}for(;e<a.length;){var h=a.charCodeAt(e++);g=a.charCodeAt(e++);b=a.charCodeAt(e++);l=h>>2;h=(h&3)<<4|g>>4;var r=(g&15)<<2|b>>6;var k=b&63;isNaN(g)?r=k=64:isNaN(b)&&(k=64);c=c+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l)+
  4894. "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(r)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(k)}return c}var a={consoleLog:!1,csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,displayTableName:!1,escape:!1,excelFileFormat:"xlshtml",excelRTL:!1,excelstyles:[],exportHiddenCells:!1,fileName:"tableExport",htmlContent:!1,ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",
  4895. unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},onDocCreated:null,autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"left",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"center"},alternateRowStyles:{fillColor:245},tableExport:{doc:null,onAfterAutotable:null,onBeforeAutotable:null,onAutotableText:null,onTable:null,outputImages:!0}}},numbers:{html:{decimalMark:".",
  4896. thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onCellData:null,onCellHtmlData:null,onIgnoreRow:null,onMsoNumberFormat:null,outputMode:"file",pdfmake:{enabled:!1,docDefinition:{pageOrientation:"portrait",defaultStyle:{font:"Roboto"}},fonts:{}},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"Table",type:"csv",worksheetName:""},v=this,ea=null,q=[],t=[],k=0,m="",Q=[],G=[],K=[],T=!1;c.extend(!0,a,h);Q=O(v);if("csv"==a.type||"tsv"==a.type||"txt"==a.type){var I=
  4897. "",W=0;G=[];k=0;var ja=function(b,d,f){b.each(function(){m="";B(this,d,k,f+b.length,function(b,c,d){var g=m,f="";if(null!==b)if(b=z(b,c,d),c=null===b||""===b?"":b.toString(),"tsv"==a.type)b instanceof Date&&b.toLocaleString(),f=da(c,"\t"," ");else if(b instanceof Date)f=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else if(f=da(c,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=f.indexOf(a.csvSeparator)||/[\r\n ]/g.test(f))f=a.csvEnclosure+f+a.csvEnclosure;m=g+(f+("tsv"==a.type?"\t":a.csvSeparator))});
  4898. m=c.trim(m).substring(0,m.length-1);0<m.length&&(0<I.length&&(I+="\n"),I+=m);k++});return b.length};W+=ja(c(v).find("thead").first().find(a.theadSelector),"th,td",W);C(c(v),"tbody").each(function(){W+=ja(D(c(this),a.tbodySelector),"td,th",W)});a.tfootSelector.length&&ja(c(v).find("tfoot").first().find(a.tfootSelector),"td,th",W);I+="\n";!0===a.consoleLog&&console.log(I);if("string"===a.outputMode)return I;if("base64"===a.outputMode)return L(I);if("window"===a.outputMode){H(!1,"data:text/"+("csv"==
  4899. a.type?"csv":"plain")+";charset=utf-8,",I);return}try{var A=new Blob([I],{type:"text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8"});saveAs(A,a.fileName+"."+a.type,"csv"!=a.type||!1===a.csvUseBOM)}catch(b){H(a.fileName+"."+a.type,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,"+("csv"==a.type&&a.csvUseBOM?"\ufeff":""),I)}}else if("sql"==a.type){k=0;G=[];var w="INSERT INTO `"+a.tableName+"` (";q=c(v).find("thead").first().find(a.theadSelector);q.each(function(){B(this,"th,td",k,q.length,
  4900. function(a,c,f){w+="'"+z(a,c,f)+"',"});k++;w=c.trim(w).substring(0,w.length-1)});w+=") VALUES ";t=u(c(v));c(t).each(function(){m="";B(this,"td,th",k,q.length+t.length,function(a,c,f){m+="'"+z(a,c,f)+"',"});3<m.length&&(w+="("+m,w=c.trim(w).substring(0,w.length-1),w+="),");k++});w=c.trim(w).substring(0,w.length-1);w+=";";!0===a.consoleLog&&console.log(w);if("string"===a.outputMode)return w;if("base64"===a.outputMode)return L(w);try{A=new Blob([w],{type:"text/plain;charset=utf-8"}),saveAs(A,a.fileName+
  4901. ".sql")}catch(b){H(a.fileName+".sql","data:application/sql;charset=utf-8,",w)}}else if("json"==a.type){var U=[];G=[];q=c(v).find("thead").first().find(a.theadSelector);q.each(function(){var a=[];B(this,"th,td",k,q.length,function(b,c,e){a.push(z(b,c,e))});U.push(a)});var ka=[];t=u(c(v));c(t).each(function(){var a={},d=0;B(this,"td,th",k,q.length+t.length,function(b,c,g){U.length?a[U[U.length-1][d]]=z(b,c,g):a[d]=z(b,c,g);d++});!1===c.isEmptyObject(a)&&ka.push(a);k++});h="";h="head"==a.jsonScope?JSON.stringify(U):
  4902. "data"==a.jsonScope?JSON.stringify(ka):JSON.stringify({header:U,data:ka});!0===a.consoleLog&&console.log(h);if("string"===a.outputMode)return h;if("base64"===a.outputMode)return L(h);try{A=new Blob([h],{type:"application/json;charset=utf-8"}),saveAs(A,a.fileName+".json")}catch(b){H(a.fileName+".json","data:application/json;charset=utf-8;base64,",h)}}else if("xml"===a.type){k=0;G=[];var J='<?xml version="1.0" encoding="utf-8"?>';J+="<tabledata><fields>";q=c(v).find("thead").first().find(a.theadSelector);
  4903. q.each(function(){B(this,"th,td",k,q.length,function(a,c,f){J+="<field>"+z(a,c,f)+"</field>"});k++});J+="</fields><data>";var va=1;t=u(c(v));c(t).each(function(){var a=1;m="";B(this,"td,th",k,q.length+t.length,function(b,c,e){m+="<column-"+a+">"+z(b,c,e)+"</column-"+a+">";a++});0<m.length&&"<column-1></column-1>"!=m&&(J+='<row id="'+va+'">'+m+"</row>",va++);k++});J+="</data></tabledata>";!0===a.consoleLog&&console.log(J);if("string"===a.outputMode)return J;if("base64"===a.outputMode)return L(J);try{A=
  4904. new Blob([J],{type:"application/xml;charset=utf-8"}),saveAs(A,a.fileName+".xml")}catch(b){H(a.fileName+".xml","data:application/xml;charset=utf-8;base64,",J)}}else if("excel"===a.type&&"xmlss"===a.excelFileFormat){var la=[],F=[];c(v).filter(function(){return P(c(this))}).each(function(){function b(a,b,d){var g=[];c(a).each(function(){var b=0,f=0;m="";B(this,"td,th",k,d+a.length,function(a,d,l){if(null!==a){var e="";d=z(a,d,l);l="String";if(!1!==jQuery.isNumeric(d))l="Number";else{var h=Da(d);!1!==
  4905. h&&(d=h,l="Number",e+=' ss:StyleID="pct1"')}"Number"!==l&&(d=d.replace(/\n/g,"<br>"));h=R(a);a=S(a);c.each(g,function(){if(k>=this.s.r&&k<=this.e.r&&f>=this.s.c&&f<=this.e.c)for(var a=0;a<=this.e.c-this.s.c;++a)f++,b++});if(a||h)a=a||1,h=h||1,g.push({s:{r:k,c:f},e:{r:k+a-1,c:f+h-1}});1<h&&(e+=' ss:MergeAcross="'+(h-1)+'"',f+=h-1);1<a&&(e+=' ss:MergeDown="'+(a-1)+'" ss:StyleID="rsp1"');0<b&&(e+=' ss:Index="'+(f+1)+'"',b=0);m+="<Cell"+e+'><Data ss:Type="'+l+'">'+c("<div />").text(d).html()+"</Data></Cell>\r";
  4906. f++}});0<m.length&&(E+='<Row ss:AutoFitHeight="0">\r'+m+"</Row>\r");k++});return a.length}var d=c(this),f="";"string"===typeof a.worksheetName&&a.worksheetName.length?f=a.worksheetName+" "+(F.length+1):"undefined"!==typeof a.worksheetName[F.length]&&(f=a.worksheetName[F.length]);f.length||(f=d.find("caption").text()||"");f.length||(f="Table "+(F.length+1));f=c.trim(f.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));F.push(c("<div />").text(f).html());!1===a.exportHiddenCells&&(K=d.find("tr, th, td").filter(":hidden"),
  4907. T=0<K.length);k=0;Q=O(this);E="<Table>\r";f=0;f+=b(d.find("thead").first().find(a.theadSelector),"th,td",f);b(u(d),"td,th",f);E+="</Table>\r";la.push(E);!0===a.consoleLog&&console.log(E)});h={};for(var y={},n,N,V=0,aa=F.length;V<aa;V++)n=F[V],N=h[n],N=h[n]=null==N?1:N+1,2==N&&(F[y[n]]=F[y[n]].substring(0,29)+"-1"),1<h[n]?F[V]=F[V].substring(0,29)+"-"+h[n]:y[n]=V;h='<?xml version="1.0" encoding="UTF-8"?>\r<?mso-application progid="Excel.Sheet"?>\r<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:o="urn:schemas-microsoft-com:office:office"\r xmlns:x="urn:schemas-microsoft-com:office:excel"\r xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:html="http://www.w3.org/TR/REC-html40">\r<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">\r <Created>'+
  4908. (new Date).toISOString()+'</Created>\r</DocumentProperties>\r<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">\r <AllowPNG/>\r</OfficeDocumentSettings>\r<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">\r <WindowHeight>9000</WindowHeight>\r <WindowWidth>13860</WindowWidth>\r <WindowTopX>0</WindowTopX>\r <WindowTopY>0</WindowTopY>\r <ProtectStructure>False</ProtectStructure>\r <ProtectWindows>False</ProtectWindows>\r</ExcelWorkbook>\r<Styles>\r <Style ss:ID="Default" ss:Name="Normal">\r <Alignment ss:Vertical="Bottom"/>\r <Borders/>\r <Font/>\r <Interior/>\r <NumberFormat/>\r <Protection/>\r </Style>\r <Style ss:ID="rsp1">\r <Alignment ss:Vertical="Center"/>\r </Style>\r <Style ss:ID="pct1">\r <NumberFormat ss:Format="Percent"/>\r </Style>\r</Styles>\r';
  4909. for(y=0;y<la.length;y++)h+='<Worksheet ss:Name="'+F[y]+'" ss:RightToLeft="'+(a.excelRTL?"1":"0")+'">\r'+la[y],h=a.excelRTL?h+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">\r<DisplayRightToLeft/>\r</WorksheetOptions>\r':h+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"/>\r',h+="</Worksheet>\r";h+="</Workbook>\r";!0===a.consoleLog&&console.log(h);if("string"===a.outputMode)return h;if("base64"===a.outputMode)return L(h);try{A=new Blob([h],{type:"application/xml;charset=utf-8"}),
  4910. saveAs(A,a.fileName+".xml")}catch(b){H(a.fileName+".xml","data:application/xml;charset=utf-8;base64,",h)}}else if("excel"==a.type||"xls"==a.type||"word"==a.type||"doc"==a.type){h="excel"==a.type||"xls"==a.type?"excel":"word";y="excel"==h?"xls":"doc";n='xmlns:x="urn:schemas-microsoft-com:office:'+h+'"';var E="",X="";c(v).filter(function(){return P(c(this))}).each(function(){var b=c(this);""===X&&(X=a.worksheetName||b.find("caption").text()||"Table",X=c.trim(X.replace(/[\\\/[\]*:?'"]/g,"").substring(0,
  4911. 31)));!1===a.exportHiddenCells&&(K=b.find("tr, th, td").filter(":hidden"),T=0<K.length);k=0;G=[];Q=O(this);E+="<table><thead>";q=b.find("thead").first().find(a.theadSelector);q.each(function(){m="";B(this,"th,td",k,q.length,function(b,f,e){if(null!==b){var g="";m+="<th";for(var d in a.excelstyles)if(a.excelstyles.hasOwnProperty(d)){var h=c(b).css(a.excelstyles[d]);""!==h&&"0px none rgb(0, 0, 0)"!=h&&"rgba(0, 0, 0, 0)"!=h&&(g+=""===g?'style="':";",g+=a.excelstyles[d]+":"+h)}""!==g&&(m+=" "+g+'"');
  4912. g=R(b);0<g&&(m+=' colspan="'+g+'"');g=S(b);0<g&&(m+=' rowspan="'+g+'"');m+=">"+z(b,f,e)+"</th>"}});0<m.length&&(E+="<tr>"+m+"</tr>");k++});E+="</thead><tbody>";t=u(b);c(t).each(function(){var b=c(this);m="";B(this,"td,th",k,q.length+t.length,function(d,e,g){if(null!==d){var f=z(d,e,g),h="",k=c(d).data("tableexport-msonumberformat");"undefined"==typeof k&&"function"===typeof a.onMsoNumberFormat&&(k=a.onMsoNumberFormat(d,e,g));"undefined"!=typeof k&&""!==k&&(h="style=\"mso-number-format:'"+k+"'");for(var p in a.excelstyles)a.excelstyles.hasOwnProperty(p)&&
  4913. (k=c(d).css(a.excelstyles[p]),""===k&&(k=b.css(a.excelstyles[p])),""!==k&&"0px none rgb(0, 0, 0)"!=k&&"rgba(0, 0, 0, 0)"!=k&&(h+=""===h?'style="':";",h+=a.excelstyles[p]+":"+k));m+="<td";""!==h&&(m+=" "+h+'"');e=R(d);0<e&&(m+=' colspan="'+e+'"');d=S(d);0<d&&(m+=' rowspan="'+d+'"');"string"===typeof f&&""!=f&&(f=f.replace(/\n/g,"<br>"));m+=">"+f+"</td>"}});0<m.length&&(E+="<tr>"+m+"</tr>");k++});a.displayTableName&&(E+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+z(c("<p>"+a.tableName+"</p>"))+"</td></tr>");
  4914. E+="</tbody></table>";!0===a.consoleLog&&console.log(E)});n='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+n+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta http-equiv="content-type" content="application/vnd.ms-'+h+'; charset=UTF-8">')+"<head>";"excel"===h&&(n+="\x3c!--[if gte mso 9]>",n+="<xml>",n+="<x:ExcelWorkbook>",n+="<x:ExcelWorksheets>",n+="<x:ExcelWorksheet>",n+="<x:Name>",n+=X,n+="</x:Name>",n+="<x:WorksheetOptions>",n+="<x:DisplayGridlines/>",a.excelRTL&&(n+="<x:DisplayRightToLeft/>"),
  4915. n+="</x:WorksheetOptions>",n+="</x:ExcelWorksheet>",n+="</x:ExcelWorksheets>",n+="</x:ExcelWorkbook>",n+="</xml>",n+="<![endif]--\x3e");n+="<style>br {mso-data-placement:same-cell;}</style>";n+="</head>";n+="<body>";n+=E;n+="</body>";n+="</html>";!0===a.consoleLog&&console.log(n);if("string"===a.outputMode)return n;if("base64"===a.outputMode)return L(n);try{A=new Blob([n],{type:"application/vnd.ms-"+a.type}),saveAs(A,a.fileName+"."+y)}catch(b){H(a.fileName+"."+y,"data:application/vnd.ms-"+h+";base64,",
  4916. n)}}else if("xlsx"==a.type){var wa=[],ma=[];k=0;t=c(v).find("thead").first().find(a.theadSelector).toArray();t.push.apply(t,u(c(v)));c(t).each(function(){var b=[];B(this,"th,td",k,t.length,function(d,e,h){if("undefined"!==typeof d&&null!==d){h=z(d,e,h);e=R(d);d=S(d);c.each(ma,function(){if(k>=this.s.r&&k<=this.e.r&&b.length>=this.s.c&&b.length<=this.e.c)for(var a=0;a<=this.e.c-this.s.c;++a)b.push(null)});if(d||e)e=e||1,ma.push({s:{r:k,c:b.length},e:{r:k+(d||1)-1,c:b.length+e-1}});"function"!==typeof a.onCellData&&
  4917. ""!==h&&h==+h&&(h=+h);b.push(""!==h?h:null);if(e)for(d=0;d<e-1;++d)b.push(null)}});wa.push(b);k++});h=new ia;y=Fa(wa);y["!merges"]=ma;h.SheetNames.push(a.worksheetName);h.Sheets[a.worksheetName]=y;h=XLSX.write(h,{bookType:a.type,bookSST:!1,type:"binary"});try{A=new Blob([ua(h)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"}),saveAs(A,a.fileName+"."+a.type)}catch(b){H(a.fileName+"."+a.type,"data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8,",
  4918. ua(h))}}else if("png"==a.type)html2canvas(c(v)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),e=new ArrayBuffer(c.length),h=new Uint8Array(e),g=0;g<c.length;g++)h[g]=c.charCodeAt(g);!0===a.consoleLog&&console.log(c);if("string"===a.outputMode)return c;if("base64"===a.outputMode)return L(b);if("window"===a.outputMode)window.open(b);else try{A=new Blob([e],{type:"image/png"}),saveAs(A,a.fileName+".png")}catch(l){H(a.fileName+".png","data:image/png,",A)}});else if("pdf"==a.type)if(!0===
  4919. a.pdfmake.enabled){h=[];var xa=[];k=0;G=[];y=function(a,d,e){var b=0;c(a).each(function(){var a=[];B(this,d,k,e,function(b,c,d){if("undefined"!==typeof b&&null!==b){var g=R(b),e=S(b);b=z(b,c,d)||" ";1<g||1<e?a.push({colSpan:g||1,rowSpan:e||1,text:b}):a.push(b)}else a.push(" ")});a.length&&xa.push(a);b<a.length&&(b=a.length);k++});return b};q=c(this).find("thead").first().find(a.theadSelector);n=y(q,"th,td",q.length);for(N=h.length;N<n;N++)h.push("*");t=u(c(this));y(t,"th,td",q.length+t.length);h=
  4920. {content:[{table:{headerRows:q.length,widths:h,body:xa}}]};c.extend(!0,h,a.pdfmake.docDefinition);pdfMake.fonts={Roboto:{normal:"Roboto-Regular.ttf",bold:"Roboto-Medium.ttf",italics:"Roboto-Italic.ttf",bolditalics:"Roboto-MediumItalic.ttf"}};c.extend(!0,pdfMake.fonts,a.pdfmake.fonts);pdfMake.createPdf(h).getBuffer(function(b){try{var c=new Blob([b],{type:"application/pdf"});saveAs(c,a.fileName+".pdf")}catch(f){H(a.fileName+".pdf","data:application/pdf;base64,",b)}})}else if(!1===a.jspdf.autotable){h=
  4921. {dim:{w:ca(c(v).first().get(0),"width","mm"),h:ca(c(v).first().get(0),"height","mm")},pagesplit:!1};var ya=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);ya.addHTML(c(v).first(),a.jspdf.margins.left,a.jspdf.margins.top,h,function(){na(ya,!1)})}else{var e=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&"bestfit"===a.jspdf.format.toLowerCase()){var Y={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89]},fa="",Z="",za=0;
  4922. c(v).each(function(){if(P(c(this))){var a=ca(c(this).get(0),"width","pt");if(a>za){a>Y.a0[0]&&(fa="a0",Z="l");for(var d in Y)Y.hasOwnProperty(d)&&Y[d][1]>a&&(fa=d,Z="l",Y[d][0]>a&&(Z="p"));za=a}}});a.jspdf.format=""===fa?"a4":fa;a.jspdf.orientation=""===Z?"w":Z}if(null==e.doc&&(e.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format),"function"===typeof a.jspdf.onDocCreated))a.jspdf.onDocCreated(e.doc);!0===e.outputImages&&(e.images={});"undefined"!=typeof e.images&&(c(v).filter(function(){return P(c(this))}).each(function(){var b=
  4923. 0;G=[];!1===a.exportHiddenCells&&(K=c(this).find("tr, th, td").filter(":hidden"),T=0<K.length);q=c(this).find("thead").find(a.theadSelector);t=u(c(this));c(t).each(function(){B(this,"td,th",q.length+b,q.length+t.length,function(a){if("undefined"!==typeof a&&null!==a){var b=c(a).children();"undefined"!=typeof b&&0<b.length&&pa(a,b,e)}});b++})}),q=[],t=[]);Ca(e,function(){c(v).filter(function(){return P(c(this))}).each(function(){var b;k=0;G=[];!1===a.exportHiddenCells&&(K=c(this).find("tr, th, td").filter(":hidden"),
  4924. T=0<K.length);Q=O(this);e.columns=[];e.rows=[];e.rowoptions={};if("function"===typeof e.onTable&&!1===e.onTable(c(this),a))return!0;a.jspdf.autotable.tableExport=null;var d=c.extend(!0,{},a.jspdf.autotable);a.jspdf.autotable.tableExport=e;d.margin={};c.extend(!0,d.margin,a.jspdf.margins);d.tableExport=e;"function"!==typeof d.beforePageContent&&(d.beforePageContent=function(a){if(1==a.pageCount){var b=a.table.rows.concat(a.table.headerRow);c.each(b,function(){0<this.height&&(this.height+=(2-1.15)/
  4925. 2*this.styles.fontSize,a.table.height+=(2-1.15)/2*this.styles.fontSize)})}});"function"!==typeof d.createdHeaderCell&&(d.createdHeaderCell=function(a,b){a.styles=c.extend({},b.row.styles);if("undefined"!=typeof e.columns[b.column.dataKey]){var g=e.columns[b.column.dataKey];if("undefined"!=typeof g.rect){a.contentWidth=g.rect.width;if("undefined"==typeof e.heightRatio||0===e.heightRatio){var f=b.row.raw[b.column.dataKey].rowspan?b.row.raw[b.column.dataKey].rect.height/b.row.raw[b.column.dataKey].rowspan:
  4926. b.row.raw[b.column.dataKey].rect.height;e.heightRatio=a.styles.rowHeight/f}f=b.row.raw[b.column.dataKey].rect.height*e.heightRatio;f>a.styles.rowHeight&&(a.styles.rowHeight=f)}"undefined"!=typeof g.style&&!0!==g.style.hidden&&(a.styles.halign=g.style.align,"inherit"===d.styles.fillColor&&(a.styles.fillColor=g.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=g.style.color),"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=g.style.fstyle))}});"function"!==typeof d.createdCell&&(d.createdCell=
  4927. function(a,b){b=e.rowoptions[b.row.index+":"+b.column.dataKey];"undefined"!=typeof b&&"undefined"!=typeof b.style&&!0!==b.style.hidden&&(a.styles.halign=b.style.align,"inherit"===d.styles.fillColor&&(a.styles.fillColor=b.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=b.style.color),"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=b.style.fstyle))});"function"!==typeof d.drawHeaderCell&&(d.drawHeaderCell=function(a,b){var c=e.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||
  4928. !0!==c.style.hidden)&&0<=c.rowIndex?oa(a,b,c):!1});"function"!==typeof d.drawCell&&(d.drawCell=function(a,b){var c=e.rowoptions[b.row.index+":"+b.column.dataKey];if(oa(a,b,c))if(e.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle),"undefined"!=typeof c&&"undefined"!=typeof c.kids&&0<c.kids.length){b=a.height/c.rect.height;if(b>e.dh||"undefined"==typeof e.dh)e.dh=b;e.dw=a.width/c.rect.width;b=a.textPos.y;ra(a,c.kids,e);a.textPos.y=b;sa(a,c.kids,e)}else sa(a,{},e);return!1});e.headerrows=[];q=c(this).find("thead").find(a.theadSelector);
  4929. q.each(function(){b=0;e.headerrows[k]=[];B(this,"th,td",k,q.length,function(a,c,d){var g=ta(a);g.title=z(a,c,d);g.key=b++;g.rowIndex=k;e.headerrows[k].push(g)});k++});if(0<k)for(var f=k-1;0<=f;)c.each(e.headerrows[f],function(){var a=this;0<f&&null===this.rect&&(a=e.headerrows[f-1][this.key]);null!==a&&0<=a.rowIndex&&(!0!==a.style.hasOwnProperty("hidden")||!0!==a.style.hidden)&&e.columns.push(a)}),f=0<e.columns.length?-1:f-1;var h=0;t=[];t=u(c(this));c(t).each(function(){var a=[];b=0;B(this,"td,th",
  4930. k,q.length+t.length,function(d,f,g){if("undefined"===typeof e.columns[b]){var k={title:"",key:b,style:{hidden:!0}};e.columns.push(k)}"undefined"!==typeof d&&null!==d?(k=ta(d),k.kids=c(d).children()):(k=c.extend(!0,{},e.rowoptions[h+":"+(b-1)]),k.colspan=-1);e.rowoptions[h+":"+b++]=k;a.push(z(d,f,g))});a.length&&(e.rows.push(a),h++);k++});if("function"===typeof e.onBeforeAutotable)e.onBeforeAutotable(c(this),e.columns,e.rows,d);e.doc.autoTable(e.columns,e.rows,d);if("function"===typeof e.onAfterAutotable)e.onAfterAutotable(c(this),
  4931. d);a.jspdf.autotable.startY=e.doc.autoTableEndPosY()+d.margin.top});na(e.doc,"undefined"!=typeof e.images&&!1===jQuery.isEmptyObject(e.images));"undefined"!=typeof e.headerrows&&(e.headerrows.length=0);"undefined"!=typeof e.columns&&(e.columns.length=0);"undefined"!=typeof e.rows&&(e.rows.length=0);delete e.doc;e.doc=null})}return this}})(jQuery);
  4932. define("tableexport", ["jquery"], (function (global) {
  4933. return function () {
  4934. var ret, fn;
  4935. return ret || global.$.fn.extend;
  4936. };
  4937. }(this)));
  4938. /*
  4939. * bootstrap-table - v1.11.1 - 2017-02-22
  4940. * https://github.com/wenzhixin/bootstrap-table
  4941. * Copyright (c) 2017 zhixin wen
  4942. * Licensed MIT License
  4943. */
  4944. !function(a){"use strict";var b=a.fn.bootstrapTable.utils.sprintf,c={json:"JSON",xml:"XML",png:"PNG",csv:"CSV",txt:"TXT",sql:"SQL",doc:"MS-Word",excel:"MS-Excel",xlsx:"MS-Excel (OpenXML)",powerpoint:"MS-Powerpoint",pdf:"PDF"};a.extend(a.fn.bootstrapTable.defaults,{showExport:!1,exportDataType:"basic",exportTypes:["json","xml","csv","txt","sql","excel"],exportOptions:{}}),a.extend(a.fn.bootstrapTable.defaults.icons,{"export":"glyphicon-export icon-share"}),a.extend(a.fn.bootstrapTable.locales,{formatExport:function(){return"Export data"}}),a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales);var d=a.fn.bootstrapTable.Constructor,e=d.prototype.initToolbar;d.prototype.initToolbar=function(){if(this.showToolbar=this.options.showExport,e.apply(this,Array.prototype.slice.apply(arguments)),this.options.showExport){var d=this,f=this.$toolbar.find(">.btn-group"),g=f.find("div.export");if(!g.length){g=a(['<div class="export btn-group">','<button class="btn'+b(" btn-%s",this.options.buttonsClass)+b(" btn-%s",this.options.iconSize)+' dropdown-toggle" aria-label="export type" title="'+this.options.formatExport()+'" data-toggle="dropdown" type="button">',b('<i class="%s %s"></i> ',this.options.iconsPrefix,this.options.icons["export"]),'<span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">',"</ul>","</div>"].join("")).appendTo(f);var h=g.find(".dropdown-menu"),i=this.options.exportTypes;if("string"==typeof this.options.exportTypes){var j=this.options.exportTypes.slice(1,-1).replace(/ /g,"").split(",");i=[],a.each(j,function(a,b){i.push(b.slice(1,-1))})}a.each(i,function(a,b){c.hasOwnProperty(b)&&h.append(['<li role="menuitem" data-type="'+b+'">','<a href="javascript:void(0)">',c[b],"</a>","</li>"].join(""))}),h.find("li").click(function(){var b=a(this).data("type"),c=function(){d.$el.tableExport(a.extend({},d.options.exportOptions,{type:b,escape:!1}))};if("all"===d.options.exportDataType&&d.options.pagination)d.$el.one("server"===d.options.sidePagination?"post-body.bs.table":"page-change.bs.table",function(){c(),d.togglePagination()}),d.togglePagination();else if("selected"===d.options.exportDataType){var e=d.getData(),f=d.getAllSelections();"server"===d.options.sidePagination&&(e={total:d.options.totalRows},e[d.options.dataField]=d.getData(),f={total:d.options.totalRows},f[d.options.dataField]=d.getAllSelections()),d.load(f),c(),d.load(e)}else c()})}}}}(jQuery);
  4945. define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (global) {
  4946. return function () {
  4947. var ret, fn;
  4948. return ret || global.$.fn.bootstrapTable.defaults;
  4949. };
  4950. }(this)));
  4951. !function(a){"use strict";if("function"==typeof define&&define.amd)define('bootstrap-datetimepicker',["jquery","moment"],a);else if("object"==typeof exports)module.exports=a(require("jquery"),require("moment"));else{if("undefined"==typeof jQuery)throw"bootstrap-datetimepicker requires jQuery to be loaded first";if("undefined"==typeof moment)throw"bootstrap-datetimepicker requires Moment.js to be loaded first";a(jQuery,moment)}}(function(a,b){"use strict";if(!b)throw new Error("bootstrap-datetimepicker requires Moment.js to be loaded first");var c=function(c,d){var e,f,g,h,i,j,k,l={},m=!0,n=!1,o=!1,p=0,q=[{clsName:"days",navFnc:"M",navStep:1},{clsName:"months",navFnc:"y",navStep:1},{clsName:"years",navFnc:"y",navStep:10},{clsName:"decades",navFnc:"y",navStep:100}],r=["days","months","years","decades"],s=["top","bottom","auto"],t=["left","right","auto"],u=["default","top","bottom"],v={up:38,38:"up",down:40,40:"down",left:37,37:"left",right:39,39:"right",tab:9,9:"tab",escape:27,27:"escape",enter:13,13:"enter",pageUp:33,33:"pageUp",pageDown:34,34:"pageDown",shift:16,16:"shift",control:17,17:"control",space:32,32:"space",t:84,84:"t",delete:46,46:"delete"},w={},x=function(){return void 0!==b.tz&&void 0!==d.timeZone&&null!==d.timeZone&&""!==d.timeZone},y=function(a){var c;return c=void 0===a||null===a?b():b.isDate(a)||b.isMoment(a)?b(a):x()?b.tz(a,j,d.useStrict,d.timeZone):b(a,j,d.useStrict),x()&&c.tz(d.timeZone),c},z=function(a){if("string"!=typeof a||a.length>1)throw new TypeError("isEnabled expects a single character string parameter");switch(a){case"y":return i.indexOf("Y")!==-1;case"M":return i.indexOf("M")!==-1;case"d":return i.toLowerCase().indexOf("d")!==-1;case"h":case"H":return i.toLowerCase().indexOf("h")!==-1;case"m":return i.indexOf("m")!==-1;case"s":return i.indexOf("s")!==-1;default:return!1}},A=function(){return z("h")||z("m")||z("s")},B=function(){return z("y")||z("M")||z("d")},C=function(){var b=a("<thead>").append(a("<tr>").append(a("<th>").addClass("prev").attr("data-action","previous").append(a("<span>").addClass(d.icons.previous))).append(a("<th>").addClass("picker-switch").attr("data-action","pickerSwitch").attr("colspan",d.calendarWeeks?"6":"5")).append(a("<th>").addClass("next").attr("data-action","next").append(a("<span>").addClass(d.icons.next)))),c=a("<tbody>").append(a("<tr>").append(a("<td>").attr("colspan",d.calendarWeeks?"8":"7")));return[a("<div>").addClass("datepicker-days").append(a("<table>").addClass("table-condensed").append(b).append(a("<tbody>"))),a("<div>").addClass("datepicker-months").append(a("<table>").addClass("table-condensed").append(b.clone()).append(c.clone())),a("<div>").addClass("datepicker-years").append(a("<table>").addClass("table-condensed").append(b.clone()).append(c.clone())),a("<div>").addClass("datepicker-decades").append(a("<table>").addClass("table-condensed").append(b.clone()).append(c.clone()))]},D=function(){var b=a("<tr>"),c=a("<tr>"),e=a("<tr>");return z("h")&&(b.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.incrementHour}).addClass("btn").attr("data-action","incrementHours").append(a("<span>").addClass(d.icons.up)))),c.append(a("<td>").append(a("<span>").addClass("timepicker-hour").attr({"data-time-component":"hours",title:d.tooltips.pickHour}).attr("data-action","showHours"))),e.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.decrementHour}).addClass("btn").attr("data-action","decrementHours").append(a("<span>").addClass(d.icons.down))))),z("m")&&(z("h")&&(b.append(a("<td>").addClass("separator")),c.append(a("<td>").addClass("separator").html(":")),e.append(a("<td>").addClass("separator"))),b.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.incrementMinute}).addClass("btn").attr("data-action","incrementMinutes").append(a("<span>").addClass(d.icons.up)))),c.append(a("<td>").append(a("<span>").addClass("timepicker-minute").attr({"data-time-component":"minutes",title:d.tooltips.pickMinute}).attr("data-action","showMinutes"))),e.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.decrementMinute}).addClass("btn").attr("data-action","decrementMinutes").append(a("<span>").addClass(d.icons.down))))),z("s")&&(z("m")&&(b.append(a("<td>").addClass("separator")),c.append(a("<td>").addClass("separator").html(":")),e.append(a("<td>").addClass("separator"))),b.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.incrementSecond}).addClass("btn").attr("data-action","incrementSeconds").append(a("<span>").addClass(d.icons.up)))),c.append(a("<td>").append(a("<span>").addClass("timepicker-second").attr({"data-time-component":"seconds",title:d.tooltips.pickSecond}).attr("data-action","showSeconds"))),e.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.decrementSecond}).addClass("btn").attr("data-action","decrementSeconds").append(a("<span>").addClass(d.icons.down))))),h||(b.append(a("<td>").addClass("separator")),c.append(a("<td>").append(a("<button>").addClass("btn btn-primary").attr({"data-action":"togglePeriod",tabindex:"-1",title:d.tooltips.togglePeriod}))),e.append(a("<td>").addClass("separator"))),a("<div>").addClass("timepicker-picker").append(a("<table>").addClass("table-condensed").append([b,c,e]))},E=function(){var b=a("<div>").addClass("timepicker-hours").append(a("<table>").addClass("table-condensed")),c=a("<div>").addClass("timepicker-minutes").append(a("<table>").addClass("table-condensed")),d=a("<div>").addClass("timepicker-seconds").append(a("<table>").addClass("table-condensed")),e=[D()];return z("h")&&e.push(b),z("m")&&e.push(c),z("s")&&e.push(d),e},F=function(){var b=[];return d.showTodayButton&&b.push(a("<td>").append(a("<a>").attr({"data-action":"today",title:d.tooltips.today}).append(a("<span>").addClass(d.icons.today)))),!d.sideBySide&&B()&&A()&&b.push(a("<td>").append(a("<a>").attr({"data-action":"togglePicker",title:d.tooltips.selectTime}).append(a("<span>").addClass(d.icons.time)))),d.showClear&&b.push(a("<td>").append(a("<a>").attr({"data-action":"clear",title:d.tooltips.clear}).append(a("<span>").addClass(d.icons.clear)))),d.showClose&&b.push(a("<td>").append(a("<a>").attr({"data-action":"close",title:d.tooltips.close}).append(a("<span>").addClass(d.icons.close)))),a("<table>").addClass("table-condensed").append(a("<tbody>").append(a("<tr>").append(b)))},G=function(){var b=a("<div>").addClass("bootstrap-datetimepicker-widget dropdown-menu"),c=a("<div>").addClass("datepicker").append(C()),e=a("<div>").addClass("timepicker").append(E()),f=a("<ul>").addClass("list-unstyled"),g=a("<li>").addClass("picker-switch"+(d.collapse?" accordion-toggle":"")).append(F());return d.inline&&b.removeClass("dropdown-menu"),h&&b.addClass("usetwentyfour"),z("s")&&!h&&b.addClass("wider"),d.sideBySide&&B()&&A()?(b.addClass("timepicker-sbs"),"top"===d.toolbarPlacement&&b.append(g),b.append(a("<div>").addClass("row").append(c.addClass("col-md-6")).append(e.addClass("col-md-6"))),"bottom"===d.toolbarPlacement&&b.append(g),b):("top"===d.toolbarPlacement&&f.append(g),B()&&f.append(a("<li>").addClass(d.collapse&&A()?"collapse in":"").append(c)),"default"===d.toolbarPlacement&&f.append(g),A()&&f.append(a("<li>").addClass(d.collapse&&B()?"collapse":"").append(e)),"bottom"===d.toolbarPlacement&&f.append(g),b.append(f))},H=function(){var b,e={};return b=c.is("input")||d.inline?c.data():c.find("input").data(),b.dateOptions&&b.dateOptions instanceof Object&&(e=a.extend(!0,e,b.dateOptions)),a.each(d,function(a){var c="date"+a.charAt(0).toUpperCase()+a.slice(1);void 0!==b[c]&&(e[a]=b[c])}),e},I=function(){var b,e=(n||c).position(),f=(n||c).offset(),g=d.widgetPositioning.vertical,h=d.widgetPositioning.horizontal;if(d.widgetParent)b=d.widgetParent.append(o);else if(c.is("input"))b=c.after(o).parent();else{if(d.inline)return void(b=c.append(o));b=c,c.children().first().after(o)}if("auto"===g&&(g=f.top+1.5*o.height()>=a(window).height()+a(window).scrollTop()&&o.height()+c.outerHeight()<f.top?"top":"bottom"),"auto"===h&&(h=b.width()<f.left+o.outerWidth()/2&&f.left+o.outerWidth()>a(window).width()?"right":"left"),"top"===g?o.addClass("top").removeClass("bottom"):o.addClass("bottom").removeClass("top"),"right"===h?o.addClass("pull-right"):o.removeClass("pull-right"),"static"===b.css("position")&&(b=b.parents().filter(function(){return"static"!==a(this).css("position")}).first()),0===b.length)throw new Error("datetimepicker component should be placed within a non-static positioned container");o.css({top:"top"===g?"auto":e.top+c.outerHeight(),bottom:"top"===g?b.outerHeight()-(b===c?0:e.top):"auto",left:"left"===h?b===c?0:e.left:"auto",right:"left"===h?"auto":b.outerWidth()-c.outerWidth()-(b===c?0:e.left)})},J=function(a){"dp.change"===a.type&&(a.date&&a.date.isSame(a.oldDate)||!a.date&&!a.oldDate)||c.trigger(a)},K=function(a){"y"===a&&(a="YYYY"),J({type:"dp.update",change:a,viewDate:f.clone()})},L=function(a){o&&(a&&(k=Math.max(p,Math.min(3,k+a))),o.find(".datepicker > div").hide().filter(".datepicker-"+q[k].clsName).show())},M=function(){var b=a("<tr>"),c=f.clone().startOf("w").startOf("d");for(d.calendarWeeks===!0&&b.append(a("<th>").addClass("cw").text("#"));c.isBefore(f.clone().endOf("w"));)b.append(a("<th>").addClass("dow").text(c.format("dd"))),c.add(1,"d");o.find(".datepicker-days thead").append(b)},N=function(a){return d.disabledDates[a.format("YYYY-MM-DD")]===!0},O=function(a){return d.enabledDates[a.format("YYYY-MM-DD")]===!0},P=function(a){return d.disabledHours[a.format("H")]===!0},Q=function(a){return d.enabledHours[a.format("H")]===!0},R=function(b,c){if(!b.isValid())return!1;if(d.disabledDates&&"d"===c&&N(b))return!1;if(d.enabledDates&&"d"===c&&!O(b))return!1;if(d.minDate&&b.isBefore(d.minDate,c))return!1;if(d.maxDate&&b.isAfter(d.maxDate,c))return!1;if(d.daysOfWeekDisabled&&"d"===c&&d.daysOfWeekDisabled.indexOf(b.day())!==-1)return!1;if(d.disabledHours&&("h"===c||"m"===c||"s"===c)&&P(b))return!1;if(d.enabledHours&&("h"===c||"m"===c||"s"===c)&&!Q(b))return!1;if(d.disabledTimeIntervals&&("h"===c||"m"===c||"s"===c)){var e=!1;if(a.each(d.disabledTimeIntervals,function(){if(b.isBetween(this[0],this[1]))return e=!0,!1}),e)return!1}return!0},S=function(){for(var b=[],c=f.clone().startOf("y").startOf("d");c.isSame(f,"y");)b.push(a("<span>").attr("data-action","selectMonth").addClass("month").text(c.format("MMM"))),c.add(1,"M");o.find(".datepicker-months td").empty().append(b)},T=function(){var b=o.find(".datepicker-months"),c=b.find("th"),g=b.find("tbody").find("span");c.eq(0).find("span").attr("title",d.tooltips.prevYear),c.eq(1).attr("title",d.tooltips.selectYear),c.eq(2).find("span").attr("title",d.tooltips.nextYear),b.find(".disabled").removeClass("disabled"),R(f.clone().subtract(1,"y"),"y")||c.eq(0).addClass("disabled"),c.eq(1).text(f.year()),R(f.clone().add(1,"y"),"y")||c.eq(2).addClass("disabled"),g.removeClass("active"),e.isSame(f,"y")&&!m&&g.eq(e.month()).addClass("active"),g.each(function(b){R(f.clone().month(b),"M")||a(this).addClass("disabled")})},U=function(){var a=o.find(".datepicker-years"),b=a.find("th"),c=f.clone().subtract(5,"y"),g=f.clone().add(6,"y"),h="";for(b.eq(0).find("span").attr("title",d.tooltips.prevDecade),b.eq(1).attr("title",d.tooltips.selectDecade),b.eq(2).find("span").attr("title",d.tooltips.nextDecade),a.find(".disabled").removeClass("disabled"),d.minDate&&d.minDate.isAfter(c,"y")&&b.eq(0).addClass("disabled"),b.eq(1).text(c.year()+"-"+g.year()),d.maxDate&&d.maxDate.isBefore(g,"y")&&b.eq(2).addClass("disabled");!c.isAfter(g,"y");)h+='<span data-action="selectYear" class="year'+(c.isSame(e,"y")&&!m?" active":"")+(R(c,"y")?"":" disabled")+'">'+c.year()+"</span>",c.add(1,"y");a.find("td").html(h)},V=function(){var a,c=o.find(".datepicker-decades"),g=c.find("th"),h=b({y:f.year()-f.year()%100-1}),i=h.clone().add(100,"y"),j=h.clone(),k=!1,l=!1,m="";for(g.eq(0).find("span").attr("title",d.tooltips.prevCentury),g.eq(2).find("span").attr("title",d.tooltips.nextCentury),c.find(".disabled").removeClass("disabled"),(h.isSame(b({y:1900}))||d.minDate&&d.minDate.isAfter(h,"y"))&&g.eq(0).addClass("disabled"),g.eq(1).text(h.year()+"-"+i.year()),(h.isSame(b({y:2e3}))||d.maxDate&&d.maxDate.isBefore(i,"y"))&&g.eq(2).addClass("disabled");!h.isAfter(i,"y");)a=h.year()+12,k=d.minDate&&d.minDate.isAfter(h,"y")&&d.minDate.year()<=a,l=d.maxDate&&d.maxDate.isAfter(h,"y")&&d.maxDate.year()<=a,m+='<span data-action="selectDecade" class="decade'+(e.isAfter(h)&&e.year()<=a?" active":"")+(R(h,"y")||k||l?"":" disabled")+'" data-selection="'+(h.year()+6)+'">'+(h.year()+1)+" - "+(h.year()+12)+"</span>",h.add(12,"y");m+="<span></span><span></span><span></span>",c.find("td").html(m),g.eq(1).text(j.year()+1+"-"+h.year())},W=function(){var b,c,g,h=o.find(".datepicker-days"),i=h.find("th"),j=[],k=[];if(B()){for(i.eq(0).find("span").attr("title",d.tooltips.prevMonth),i.eq(1).attr("title",d.tooltips.selectMonth),i.eq(2).find("span").attr("title",d.tooltips.nextMonth),h.find(".disabled").removeClass("disabled"),i.eq(1).text(f.format(d.dayViewHeaderFormat)),R(f.clone().subtract(1,"M"),"M")||i.eq(0).addClass("disabled"),R(f.clone().add(1,"M"),"M")||i.eq(2).addClass("disabled"),b=f.clone().startOf("M").startOf("w").startOf("d"),g=0;g<42;g++)0===b.weekday()&&(c=a("<tr>"),d.calendarWeeks&&c.append('<td class="cw">'+b.week()+"</td>"),j.push(c)),k=["day"],b.isBefore(f,"M")&&k.push("old"),b.isAfter(f,"M")&&k.push("new"),b.isSame(e,"d")&&!m&&k.push("active"),R(b,"d")||k.push("disabled"),b.isSame(y(),"d")&&k.push("today"),0!==b.day()&&6!==b.day()||k.push("weekend"),J({type:"dp.classify",date:b,classNames:k}),c.append('<td data-action="selectDay" data-day="'+b.format("L")+'" class="'+k.join(" ")+'">'+b.date()+"</td>"),b.add(1,"d");h.find("tbody").empty().append(j),T(),U(),V()}},X=function(){var b=o.find(".timepicker-hours table"),c=f.clone().startOf("d"),d=[],e=a("<tr>");for(f.hour()>11&&!h&&c.hour(12);c.isSame(f,"d")&&(h||f.hour()<12&&c.hour()<12||f.hour()>11);)c.hour()%4===0&&(e=a("<tr>"),d.push(e)),e.append('<td data-action="selectHour" class="hour'+(R(c,"h")?"":" disabled")+'">'+c.format(h?"HH":"hh")+"</td>"),c.add(1,"h");b.empty().append(d)},Y=function(){for(var b=o.find(".timepicker-minutes table"),c=f.clone().startOf("h"),e=[],g=a("<tr>"),h=1===d.stepping?5:d.stepping;f.isSame(c,"h");)c.minute()%(4*h)===0&&(g=a("<tr>"),e.push(g)),g.append('<td data-action="selectMinute" class="minute'+(R(c,"m")?"":" disabled")+'">'+c.format("mm")+"</td>"),c.add(h,"m");b.empty().append(e)},Z=function(){for(var b=o.find(".timepicker-seconds table"),c=f.clone().startOf("m"),d=[],e=a("<tr>");f.isSame(c,"m");)c.second()%20===0&&(e=a("<tr>"),d.push(e)),e.append('<td data-action="selectSecond" class="second'+(R(c,"s")?"":" disabled")+'">'+c.format("ss")+"</td>"),c.add(5,"s");b.empty().append(d)},$=function(){var a,b,c=o.find(".timepicker span[data-time-component]");h||(a=o.find(".timepicker [data-action=togglePeriod]"),b=e.clone().add(e.hours()>=12?-12:12,"h"),a.text(e.format("A")),R(b,"h")?a.removeClass("disabled"):a.addClass("disabled")),c.filter("[data-time-component=hours]").text(e.format(h?"HH":"hh")),c.filter("[data-time-component=minutes]").text(e.format("mm")),c.filter("[data-time-component=seconds]").text(e.format("ss")),X(),Y(),Z()},_=function(){o&&(W(),$())},aa=function(a){var b=m?null:e;if(!a)return m=!0,g.val(""),c.data("date",""),J({type:"dp.change",date:!1,oldDate:b}),void _();if(a=a.clone().locale(d.locale),x()&&a.tz(d.timeZone),1!==d.stepping)for(a.minutes(Math.round(a.minutes()/d.stepping)*d.stepping).seconds(0);d.minDate&&a.isBefore(d.minDate);)a.add(d.stepping,"minutes");R(a)?(e=a,f=e.clone(),g.val(e.format(i)),c.data("date",e.format(i)),m=!1,_(),J({type:"dp.change",date:e.clone(),oldDate:b})):(d.keepInvalid?J({type:"dp.change",date:a,oldDate:b}):g.val(m?"":e.format(i)),J({type:"dp.error",date:a,oldDate:b}))},ba=function(){var b=!1;return o?(o.find(".collapse").each(function(){var c=a(this).data("collapse");return!c||!c.transitioning||(b=!0,!1)}),b?l:(n&&n.hasClass("btn")&&n.toggleClass("active"),o.hide(),a(window).off("resize",I),o.off("click","[data-action]"),o.off("mousedown",!1),o.remove(),o=!1,J({type:"dp.hide",date:e.clone()}),g.blur(),f=e.clone(),l)):l},ca=function(){aa(null)},da=function(a){return void 0===d.parseInputDate?(!b.isMoment(a)||a instanceof Date)&&(a=y(a)):a=d.parseInputDate(a),a},ea={next:function(){var a=q[k].navFnc;f.add(q[k].navStep,a),W(),K(a)},previous:function(){var a=q[k].navFnc;f.subtract(q[k].navStep,a),W(),K(a)},pickerSwitch:function(){L(1)},selectMonth:function(b){var c=a(b.target).closest("tbody").find("span").index(a(b.target));f.month(c),k===p?(aa(e.clone().year(f.year()).month(f.month())),d.inline||ba()):(L(-1),W()),K("M")},selectYear:function(b){var c=parseInt(a(b.target).text(),10)||0;f.year(c),k===p?(aa(e.clone().year(f.year())),d.inline||ba()):(L(-1),W()),K("YYYY")},selectDecade:function(b){var c=parseInt(a(b.target).data("selection"),10)||0;f.year(c),k===p?(aa(e.clone().year(f.year())),d.inline||ba()):(L(-1),W()),K("YYYY")},selectDay:function(b){var c=f.clone();a(b.target).is(".old")&&c.subtract(1,"M"),a(b.target).is(".new")&&c.add(1,"M"),aa(c.date(parseInt(a(b.target).text(),10))),A()||d.keepOpen||d.inline||ba()},incrementHours:function(){var a=e.clone().add(1,"h");R(a,"h")&&aa(a)},incrementMinutes:function(){var a=e.clone().add(d.stepping,"m");R(a,"m")&&aa(a)},incrementSeconds:function(){var a=e.clone().add(1,"s");R(a,"s")&&aa(a)},decrementHours:function(){var a=e.clone().subtract(1,"h");R(a,"h")&&aa(a)},decrementMinutes:function(){var a=e.clone().subtract(d.stepping,"m");R(a,"m")&&aa(a)},decrementSeconds:function(){var a=e.clone().subtract(1,"s");R(a,"s")&&aa(a)},togglePeriod:function(){aa(e.clone().add(e.hours()>=12?-12:12,"h"))},togglePicker:function(b){var c,e=a(b.target),f=e.closest("ul"),g=f.find(".in"),h=f.find(".collapse:not(.in)");if(g&&g.length){if(c=g.data("collapse"),c&&c.transitioning)return;g.collapse?(g.collapse("hide"),h.collapse("show")):(g.removeClass("in"),h.addClass("in")),e.is("span")?e.toggleClass(d.icons.time+" "+d.icons.date):e.find("span").toggleClass(d.icons.time+" "+d.icons.date)}},showPicker:function(){o.find(".timepicker > div:not(.timepicker-picker)").hide(),o.find(".timepicker .timepicker-picker").show()},showHours:function(){o.find(".timepicker .timepicker-picker").hide(),o.find(".timepicker .timepicker-hours").show()},showMinutes:function(){o.find(".timepicker .timepicker-picker").hide(),o.find(".timepicker .timepicker-minutes").show()},showSeconds:function(){o.find(".timepicker .timepicker-picker").hide(),o.find(".timepicker .timepicker-seconds").show()},selectHour:function(b){var c=parseInt(a(b.target).text(),10);h||(e.hours()>=12?12!==c&&(c+=12):12===c&&(c=0)),aa(e.clone().hours(c)),ea.showPicker.call(l)},selectMinute:function(b){aa(e.clone().minutes(parseInt(a(b.target).text(),10))),ea.showPicker.call(l)},selectSecond:function(b){aa(e.clone().seconds(parseInt(a(b.target).text(),10))),ea.showPicker.call(l)},clear:ca,today:function(){var a=y();R(a,"d")&&aa(a)},close:ba},fa=function(b){return!a(b.currentTarget).is(".disabled")&&(ea[a(b.currentTarget).data("action")].apply(l,arguments),!1)},ga=function(){var b,c={year:function(a){return a.month(0).date(1).hours(0).seconds(0).minutes(0)},month:function(a){return a.date(1).hours(0).seconds(0).minutes(0)},day:function(a){return a.hours(0).seconds(0).minutes(0)},hour:function(a){return a.seconds(0).minutes(0)},minute:function(a){return a.seconds(0)}};return g.prop("disabled")||!d.ignoreReadonly&&g.prop("readonly")||o?l:(void 0!==g.val()&&0!==g.val().trim().length?aa(da(g.val().trim())):m&&d.useCurrent&&(d.inline||g.is("input")&&0===g.val().trim().length)&&(b=y(),"string"==typeof d.useCurrent&&(b=c[d.useCurrent](b)),aa(b)),o=G(),M(),S(),o.find(".timepicker-hours").hide(),o.find(".timepicker-minutes").hide(),o.find(".timepicker-seconds").hide(),_(),L(),a(window).on("resize",I),o.on("click","[data-action]",fa),o.on("mousedown",!1),n&&n.hasClass("btn")&&n.toggleClass("active"),I(),o.show(),d.focusOnShow&&!g.is(":focus")&&g.focus(),J({type:"dp.show"}),l)},ha=function(){return o?ba():ga()},ia=function(a){var b,c,e,f,g=null,h=[],i={},j=a.which,k="p";w[j]=k;for(b in w)w.hasOwnProperty(b)&&w[b]===k&&(h.push(b),parseInt(b,10)!==j&&(i[b]=!0));for(b in d.keyBinds)if(d.keyBinds.hasOwnProperty(b)&&"function"==typeof d.keyBinds[b]&&(e=b.split(" "),e.length===h.length&&v[j]===e[e.length-1])){for(f=!0,c=e.length-2;c>=0;c--)if(!(v[e[c]]in i)){f=!1;break}if(f){g=d.keyBinds[b];break}}g&&(g.call(l,o),a.stopPropagation(),a.preventDefault())},ja=function(a){w[a.which]="r",a.stopPropagation(),a.preventDefault()},ka=function(b){var c=a(b.target).val().trim(),d=c?da(c):null;return aa(d),b.stopImmediatePropagation(),!1},la=function(){g.on({change:ka,blur:d.debug?"":ba,keydown:ia,keyup:ja,focus:d.allowInputToggle?ga:""}),c.is("input")?g.on({focus:ga}):n&&(n.on("click",ha),n.on("mousedown",!1))},ma=function(){g.off({change:ka,blur:blur,keydown:ia,keyup:ja,focus:d.allowInputToggle?ba:""}),c.is("input")?g.off({focus:ga}):n&&(n.off("click",ha),n.off("mousedown",!1))},na=function(b){var c={};return a.each(b,function(){var a=da(this);a.isValid()&&(c[a.format("YYYY-MM-DD")]=!0)}),!!Object.keys(c).length&&c},oa=function(b){var c={};return a.each(b,function(){c[this]=!0}),!!Object.keys(c).length&&c},pa=function(){var a=d.format||"L LT";i=a.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,function(a){var b=e.localeData().longDateFormat(a)||a;return b.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,function(a){return e.localeData().longDateFormat(a)||a})}),j=d.extraFormats?d.extraFormats.slice():[],j.indexOf(a)<0&&j.indexOf(i)<0&&j.push(i),h=i.toLowerCase().indexOf("a")<1&&i.replace(/\[.*?\]/g,"").indexOf("h")<1,z("y")&&(p=2),z("M")&&(p=1),z("d")&&(p=0),k=Math.max(p,k),m||aa(e)};if(l.destroy=function(){ba(),ma(),c.removeData("DateTimePicker"),c.removeData("date")},l.toggle=ha,l.show=ga,l.hide=ba,l.disable=function(){return ba(),n&&n.hasClass("btn")&&n.addClass("disabled"),g.prop("disabled",!0),l},l.enable=function(){return n&&n.hasClass("btn")&&n.removeClass("disabled"),g.prop("disabled",!1),l},l.ignoreReadonly=function(a){if(0===arguments.length)return d.ignoreReadonly;if("boolean"!=typeof a)throw new TypeError("ignoreReadonly () expects a boolean parameter");return d.ignoreReadonly=a,l},l.options=function(b){if(0===arguments.length)return a.extend(!0,{},d);if(!(b instanceof Object))throw new TypeError("options() options parameter should be an object");return a.extend(!0,d,b),a.each(d,function(a,b){if(void 0===l[a])throw new TypeError("option "+a+" is not recognized!");l[a](b)}),l},l.date=function(a){if(0===arguments.length)return m?null:e.clone();if(!(null===a||"string"==typeof a||b.isMoment(a)||a instanceof Date))throw new TypeError("date() parameter must be one of [null, string, moment or Date]");return aa(null===a?null:da(a)),l},l.format=function(a){if(0===arguments.length)return d.format;if("string"!=typeof a&&("boolean"!=typeof a||a!==!1))throw new TypeError("format() expects a string or boolean:false parameter "+a);return d.format=a,i&&pa(),l},l.timeZone=function(a){if(0===arguments.length)return d.timeZone;if("string"!=typeof a)throw new TypeError("newZone() expects a string parameter");return d.timeZone=a,l},l.dayViewHeaderFormat=function(a){if(0===arguments.length)return d.dayViewHeaderFormat;if("string"!=typeof a)throw new TypeError("dayViewHeaderFormat() expects a string parameter");return d.dayViewHeaderFormat=a,l},l.extraFormats=function(a){if(0===arguments.length)return d.extraFormats;if(a!==!1&&!(a instanceof Array))throw new TypeError("extraFormats() expects an array or false parameter");return d.extraFormats=a,j&&pa(),l},l.disabledDates=function(b){if(0===arguments.length)return d.disabledDates?a.extend({},d.disabledDates):d.disabledDates;if(!b)return d.disabledDates=!1,_(),l;if(!(b instanceof Array))throw new TypeError("disabledDates() expects an array parameter");return d.disabledDates=na(b),d.enabledDates=!1,_(),l},l.enabledDates=function(b){if(0===arguments.length)return d.enabledDates?a.extend({},d.enabledDates):d.enabledDates;if(!b)return d.enabledDates=!1,_(),l;if(!(b instanceof Array))throw new TypeError("enabledDates() expects an array parameter");return d.enabledDates=na(b),d.disabledDates=!1,_(),l},l.daysOfWeekDisabled=function(a){if(0===arguments.length)return d.daysOfWeekDisabled.splice(0);if("boolean"==typeof a&&!a)return d.daysOfWeekDisabled=!1,_(),l;if(!(a instanceof Array))throw new TypeError("daysOfWeekDisabled() expects an array parameter");if(d.daysOfWeekDisabled=a.reduce(function(a,b){return b=parseInt(b,10),b>6||b<0||isNaN(b)?a:(a.indexOf(b)===-1&&a.push(b),a)},[]).sort(),d.useCurrent&&!d.keepInvalid){for(var b=0;!R(e,"d");){if(e.add(1,"d"),31===b)throw"Tried 31 times to find a valid date";b++}aa(e)}return _(),l},l.maxDate=function(a){if(0===arguments.length)return d.maxDate?d.maxDate.clone():d.maxDate;if("boolean"==typeof a&&a===!1)return d.maxDate=!1,_(),l;"string"==typeof a&&("now"!==a&&"moment"!==a||(a=y()));var b=da(a);if(!b.isValid())throw new TypeError("maxDate() Could not parse date parameter: "+a);if(d.minDate&&b.isBefore(d.minDate))throw new TypeError("maxDate() date parameter is before options.minDate: "+b.format(i));return d.maxDate=b,d.useCurrent&&!d.keepInvalid&&e.isAfter(a)&&aa(d.maxDate),f.isAfter(b)&&(f=b.clone().subtract(d.stepping,"m")),_(),l},l.minDate=function(a){if(0===arguments.length)return d.minDate?d.minDate.clone():d.minDate;if("boolean"==typeof a&&a===!1)return d.minDate=!1,_(),l;"string"==typeof a&&("now"!==a&&"moment"!==a||(a=y()));var b=da(a);if(!b.isValid())throw new TypeError("minDate() Could not parse date parameter: "+a);if(d.maxDate&&b.isAfter(d.maxDate))throw new TypeError("minDate() date parameter is after options.maxDate: "+b.format(i));return d.minDate=b,d.useCurrent&&!d.keepInvalid&&e.isBefore(a)&&aa(d.minDate),f.isBefore(b)&&(f=b.clone().add(d.stepping,"m")),_(),l},l.defaultDate=function(a){if(0===arguments.length)return d.defaultDate?d.defaultDate.clone():d.defaultDate;if(!a)return d.defaultDate=!1,l;"string"==typeof a&&(a="now"===a||"moment"===a?y():y(a));var b=da(a);if(!b.isValid())throw new TypeError("defaultDate() Could not parse date parameter: "+a);if(!R(b))throw new TypeError("defaultDate() date passed is invalid according to component setup validations");return d.defaultDate=b,(d.defaultDate&&d.inline||""===g.val().trim())&&aa(d.defaultDate),l},l.locale=function(a){if(0===arguments.length)return d.locale;if(!b.localeData(a))throw new TypeError("locale() locale "+a+" is not loaded from moment locales!");return d.locale=a,e.locale(d.locale),f.locale(d.locale),i&&pa(),o&&(ba(),ga()),l},l.stepping=function(a){return 0===arguments.length?d.stepping:(a=parseInt(a,10),(isNaN(a)||a<1)&&(a=1),d.stepping=a,l)},l.useCurrent=function(a){var b=["year","month","day","hour","minute"];if(0===arguments.length)return d.useCurrent;if("boolean"!=typeof a&&"string"!=typeof a)throw new TypeError("useCurrent() expects a boolean or string parameter");if("string"==typeof a&&b.indexOf(a.toLowerCase())===-1)throw new TypeError("useCurrent() expects a string parameter of "+b.join(", "));return d.useCurrent=a,l},l.collapse=function(a){if(0===arguments.length)return d.collapse;if("boolean"!=typeof a)throw new TypeError("collapse() expects a boolean parameter");return d.collapse===a?l:(d.collapse=a,o&&(ba(),ga()),l)},l.icons=function(b){if(0===arguments.length)return a.extend({},d.icons);if(!(b instanceof Object))throw new TypeError("icons() expects parameter to be an Object");return a.extend(d.icons,b),o&&(ba(),ga()),l},l.tooltips=function(b){if(0===arguments.length)return a.extend({},d.tooltips);if(!(b instanceof Object))throw new TypeError("tooltips() expects parameter to be an Object");return a.extend(d.tooltips,b),o&&(ba(),ga()),l},l.useStrict=function(a){if(0===arguments.length)return d.useStrict;if("boolean"!=typeof a)throw new TypeError("useStrict() expects a boolean parameter");return d.useStrict=a,l},l.sideBySide=function(a){if(0===arguments.length)return d.sideBySide;if("boolean"!=typeof a)throw new TypeError("sideBySide() expects a boolean parameter");return d.sideBySide=a,o&&(ba(),ga()),l},l.viewMode=function(a){if(0===arguments.length)return d.viewMode;if("string"!=typeof a)throw new TypeError("viewMode() expects a string parameter");if(r.indexOf(a)===-1)throw new TypeError("viewMode() parameter must be one of ("+r.join(", ")+") value");return d.viewMode=a,k=Math.max(r.indexOf(a),p),L(),l},l.toolbarPlacement=function(a){if(0===arguments.length)return d.toolbarPlacement;if("string"!=typeof a)throw new TypeError("toolbarPlacement() expects a string parameter");if(u.indexOf(a)===-1)throw new TypeError("toolbarPlacement() parameter must be one of ("+u.join(", ")+") value");return d.toolbarPlacement=a,o&&(ba(),ga()),l},l.widgetPositioning=function(b){if(0===arguments.length)return a.extend({},d.widgetPositioning);if("[object Object]"!=={}.toString.call(b))throw new TypeError("widgetPositioning() expects an object variable");if(b.horizontal){if("string"!=typeof b.horizontal)throw new TypeError("widgetPositioning() horizontal variable must be a string");if(b.horizontal=b.horizontal.toLowerCase(),t.indexOf(b.horizontal)===-1)throw new TypeError("widgetPositioning() expects horizontal parameter to be one of ("+t.join(", ")+")");d.widgetPositioning.horizontal=b.horizontal}if(b.vertical){if("string"!=typeof b.vertical)throw new TypeError("widgetPositioning() vertical variable must be a string");if(b.vertical=b.vertical.toLowerCase(),s.indexOf(b.vertical)===-1)throw new TypeError("widgetPositioning() expects vertical parameter to be one of ("+s.join(", ")+")");d.widgetPositioning.vertical=b.vertical}return _(),l},l.calendarWeeks=function(a){if(0===arguments.length)return d.calendarWeeks;if("boolean"!=typeof a)throw new TypeError("calendarWeeks() expects parameter to be a boolean value");return d.calendarWeeks=a,_(),l},l.showTodayButton=function(a){if(0===arguments.length)return d.showTodayButton;if("boolean"!=typeof a)throw new TypeError("showTodayButton() expects a boolean parameter");return d.showTodayButton=a,o&&(ba(),ga()),l},l.showClear=function(a){if(0===arguments.length)return d.showClear;if("boolean"!=typeof a)throw new TypeError("showClear() expects a boolean parameter");return d.showClear=a,o&&(ba(),ga()),l},l.widgetParent=function(b){if(0===arguments.length)return d.widgetParent;if("string"==typeof b&&(b=a(b)),null!==b&&"string"!=typeof b&&!(b instanceof a))throw new TypeError("widgetParent() expects a string or a jQuery object parameter");return d.widgetParent=b,o&&(ba(),ga()),l},l.keepOpen=function(a){if(0===arguments.length)return d.keepOpen;if("boolean"!=typeof a)throw new TypeError("keepOpen() expects a boolean parameter");return d.keepOpen=a,l},l.focusOnShow=function(a){if(0===arguments.length)return d.focusOnShow;if("boolean"!=typeof a)throw new TypeError("focusOnShow() expects a boolean parameter");return d.focusOnShow=a,l},l.inline=function(a){if(0===arguments.length)return d.inline;if("boolean"!=typeof a)throw new TypeError("inline() expects a boolean parameter");return d.inline=a,l},l.clear=function(){return ca(),l},l.keyBinds=function(a){return 0===arguments.length?d.keyBinds:(d.keyBinds=a,l)},l.getMoment=function(a){return y(a)},l.debug=function(a){if("boolean"!=typeof a)throw new TypeError("debug() expects a boolean parameter");return d.debug=a,l},l.allowInputToggle=function(a){if(0===arguments.length)return d.allowInputToggle;if("boolean"!=typeof a)throw new TypeError("allowInputToggle() expects a boolean parameter");return d.allowInputToggle=a,l},l.showClose=function(a){if(0===arguments.length)return d.showClose;if("boolean"!=typeof a)throw new TypeError("showClose() expects a boolean parameter");return d.showClose=a,l},l.keepInvalid=function(a){if(0===arguments.length)return d.keepInvalid;if("boolean"!=typeof a)throw new TypeError("keepInvalid() expects a boolean parameter");
  4952. return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)return d.datepickerInput;if("string"!=typeof a)throw new TypeError("datepickerInput() expects a string parameter");return d.datepickerInput=a,l},l.parseInputDate=function(a){if(0===arguments.length)return d.parseInputDate;if("function"!=typeof a)throw new TypeError("parseInputDate() sholud be as function");return d.parseInputDate=a,l},l.disabledTimeIntervals=function(b){if(0===arguments.length)return d.disabledTimeIntervals?a.extend({},d.disabledTimeIntervals):d.disabledTimeIntervals;if(!b)return d.disabledTimeIntervals=!1,_(),l;if(!(b instanceof Array))throw new TypeError("disabledTimeIntervals() expects an array parameter");return d.disabledTimeIntervals=b,_(),l},l.disabledHours=function(b){if(0===arguments.length)return d.disabledHours?a.extend({},d.disabledHours):d.disabledHours;if(!b)return d.disabledHours=!1,_(),l;if(!(b instanceof Array))throw new TypeError("disabledHours() expects an array parameter");if(d.disabledHours=oa(b),d.enabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!R(e,"h");){if(e.add(1,"h"),24===c)throw"Tried 24 times to find a valid date";c++}aa(e)}return _(),l},l.enabledHours=function(b){if(0===arguments.length)return d.enabledHours?a.extend({},d.enabledHours):d.enabledHours;if(!b)return d.enabledHours=!1,_(),l;if(!(b instanceof Array))throw new TypeError("enabledHours() expects an array parameter");if(d.enabledHours=oa(b),d.disabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!R(e,"h");){if(e.add(1,"h"),24===c)throw"Tried 24 times to find a valid date";c++}aa(e)}return _(),l},l.viewDate=function(a){if(0===arguments.length)return f.clone();if(!a)return f=e.clone(),l;if(!("string"==typeof a||b.isMoment(a)||a instanceof Date))throw new TypeError("viewDate() parameter must be one of [string, moment or Date]");return f=da(a),K(),l},c.is("input"))g=c;else if(g=c.find(d.datepickerInput),0===g.length)g=c.find("input");else if(!g.is("input"))throw new Error('CSS class "'+d.datepickerInput+'" cannot be applied to non input element');if(c.hasClass("input-group")&&(n=0===c.find(".datepickerbutton").length?c.find(".input-group-addon"):c.find(".datepickerbutton")),!d.inline&&!g.is("input"))throw new Error("Could not initialize DateTimePicker without an input element");return e=y(),f=e.clone(),a.extend(!0,d,H()),l.options(d),pa(),la(),g.prop("disabled")&&l.disable(),g.is("input")&&0!==g.val().trim().length?aa(da(g.val().trim())):d.defaultDate&&void 0===g.attr("placeholder")&&aa(d.defaultDate),d.inline&&ga(),l};return a.fn.datetimepicker=function(b){b=b||{};var d,e=Array.prototype.slice.call(arguments,1),f=!0,g=["destroy","hide","show","toggle"];if("object"==typeof b)return this.each(function(){var d,e=a(this);e.data("DateTimePicker")||(d=a.extend(!0,{},a.fn.datetimepicker.defaults,b),e.data("DateTimePicker",c(e,d)))});if("string"==typeof b)return this.each(function(){var c=a(this),g=c.data("DateTimePicker");if(!g)throw new Error('bootstrap-datetimepicker("'+b+'") method was called on an element that is not using DateTimePicker');d=g[b].apply(g,e),f=d===g}),f||a.inArray(b,g)>-1?this:d;throw new TypeError("Invalid arguments for DateTimePicker: "+b)},a.fn.datetimepicker.defaults={timeZone:"",format:!1,dayViewHeaderFormat:"MMMM YYYY",extraFormats:!1,stepping:1,minDate:!1,maxDate:!1,useCurrent:!0,collapse:!0,locale:b.locale(),defaultDate:!1,disabledDates:!1,enabledDates:!1,icons:{time:"glyphicon glyphicon-time",date:"glyphicon glyphicon-calendar",up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down",previous:"glyphicon glyphicon-chevron-left",next:"glyphicon glyphicon-chevron-right",today:"glyphicon glyphicon-screenshot",clear:"glyphicon glyphicon-trash",close:"glyphicon glyphicon-remove"},tooltips:{today:"Go to today",clear:"Clear selection",close:"Close the picker",selectMonth:"Select Month",prevMonth:"Previous Month",nextMonth:"Next Month",selectYear:"Select Year",prevYear:"Previous Year",nextYear:"Next Year",selectDecade:"Select Decade",prevDecade:"Previous Decade",nextDecade:"Next Decade",prevCentury:"Previous Century",nextCentury:"Next Century",pickHour:"Pick Hour",incrementHour:"Increment Hour",decrementHour:"Decrement Hour",pickMinute:"Pick Minute",incrementMinute:"Increment Minute",decrementMinute:"Decrement Minute",pickSecond:"Pick Second",incrementSecond:"Increment Second",decrementSecond:"Decrement Second",togglePeriod:"Toggle Period",selectTime:"Select Time"},useStrict:!1,sideBySide:!1,daysOfWeekDisabled:!1,calendarWeeks:!1,viewMode:"days",toolbarPlacement:"default",showTodayButton:!1,showClear:!1,showClose:!1,widgetPositioning:{horizontal:"auto",vertical:"auto"},widgetParent:null,ignoreReadonly:!1,keepOpen:!1,focusOnShow:!0,inline:!1,keepInvalid:!1,datepickerInput:".datepickerinput",keyBinds:{up:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().subtract(7,"d")):this.date(b.clone().add(this.stepping(),"m"))}},down:function(a){if(!a)return void this.show();var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().add(7,"d")):this.date(b.clone().subtract(this.stepping(),"m"))},"control up":function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().subtract(1,"y")):this.date(b.clone().add(1,"h"))}},"control down":function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().add(1,"y")):this.date(b.clone().subtract(1,"h"))}},left:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().subtract(1,"d"))}},right:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().add(1,"d"))}},pageUp:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().subtract(1,"M"))}},pageDown:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().add(1,"M"))}},enter:function(){this.hide()},escape:function(){this.hide()},"control space":function(a){a&&a.find(".timepicker").is(":visible")&&a.find('.btn[data-action="togglePeriod"]').click()},t:function(){this.date(this.getMoment())},delete:function(){this.clear()}},debug:!1,allowInputToggle:!1,disabledTimeIntervals:!1,disabledHours:!1,enabledHours:!1,viewDate:!1},a.fn.datetimepicker});
  4953. /**
  4954. * @version: 2.1.27
  4955. * @author: Dan Grossman http://www.dangrossman.info/
  4956. * @copyright: Copyright (c) 2012-2017 Dan Grossman. All rights reserved.
  4957. * @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php
  4958. * @website: http://www.daterangepicker.com/
  4959. */
  4960. // Follow the UMD template https://github.com/umdjs/umd/blob/master/templates/returnExportsGlobal.js
  4961. (function (root, factory) {
  4962. if (typeof define === 'function' && define.amd) {
  4963. // AMD. Make globaly available as well
  4964. define('bootstrap-daterangepicker',['moment', 'jquery'], function (moment, jquery) {
  4965. if (!jquery.fn) jquery.fn = {}; // webpack server rendering
  4966. return factory(moment, jquery);
  4967. });
  4968. } else if (typeof module === 'object' && module.exports) {
  4969. // Node / Browserify
  4970. //isomorphic issue
  4971. var jQuery = (typeof window != 'undefined') ? window.jQuery : undefined;
  4972. if (!jQuery) {
  4973. jQuery = require('jquery');
  4974. if (!jQuery.fn) jQuery.fn = {};
  4975. }
  4976. var moment = (typeof window != 'undefined' && typeof window.moment != 'undefined') ? window.moment : require('moment');
  4977. module.exports = factory(moment, jQuery);
  4978. } else {
  4979. // Browser globals
  4980. root.daterangepicker = factory(root.moment, root.jQuery);
  4981. }
  4982. }(this, function(moment, $) {
  4983. var DateRangePicker = function(element, options, cb) {
  4984. //default settings for options
  4985. this.parentEl = 'body';
  4986. this.element = $(element);
  4987. this.startDate = moment().startOf('day');
  4988. this.endDate = moment().endOf('day');
  4989. this.minDate = false;
  4990. this.maxDate = false;
  4991. this.dateLimit = false;
  4992. this.autoApply = false;
  4993. this.singleDatePicker = false;
  4994. this.showDropdowns = false;
  4995. this.showWeekNumbers = false;
  4996. this.showISOWeekNumbers = false;
  4997. this.showCustomRangeLabel = true;
  4998. this.timePicker = false;
  4999. this.timePicker24Hour = false;
  5000. this.timePickerIncrement = 1;
  5001. this.timePickerSeconds = false;
  5002. this.linkedCalendars = true;
  5003. this.autoUpdateInput = true;
  5004. this.alwaysShowCalendars = false;
  5005. this.ranges = {};
  5006. this.opens = 'right';
  5007. if (this.element.hasClass('pull-right'))
  5008. this.opens = 'left';
  5009. this.drops = 'down';
  5010. if (this.element.hasClass('dropup'))
  5011. this.drops = 'up';
  5012. this.buttonClasses = 'btn btn-sm';
  5013. this.applyClass = 'btn-success';
  5014. this.cancelClass = 'btn-default';
  5015. this.locale = {
  5016. direction: 'ltr',
  5017. format: moment.localeData().longDateFormat('L'),
  5018. separator: ' - ',
  5019. applyLabel: 'Apply',
  5020. cancelLabel: 'Cancel',
  5021. weekLabel: 'W',
  5022. customRangeLabel: 'Custom Range',
  5023. daysOfWeek: moment.weekdaysMin(),
  5024. monthNames: moment.monthsShort(),
  5025. firstDay: moment.localeData().firstDayOfWeek()
  5026. };
  5027. this.callback = function() { };
  5028. //some state information
  5029. this.isShowing = false;
  5030. this.leftCalendar = {};
  5031. this.rightCalendar = {};
  5032. //custom options from user
  5033. if (typeof options !== 'object' || options === null)
  5034. options = {};
  5035. //allow setting options with data attributes
  5036. //data-api options will be overwritten with custom javascript options
  5037. options = $.extend(this.element.data(), options);
  5038. //html template for the picker UI
  5039. if (typeof options.template !== 'string' && !(options.template instanceof $))
  5040. options.template = '<div class="daterangepicker dropdown-menu">' +
  5041. '<div class="calendar left">' +
  5042. '<div class="daterangepicker_input">' +
  5043. '<input class="input-mini form-control" type="text" name="daterangepicker_start" value="" />' +
  5044. '<i class="fa fa-calendar glyphicon glyphicon-calendar"></i>' +
  5045. '<div class="calendar-time">' +
  5046. '<div></div>' +
  5047. '<i class="fa fa-clock-o glyphicon glyphicon-time"></i>' +
  5048. '</div>' +
  5049. '</div>' +
  5050. '<div class="calendar-table"></div>' +
  5051. '</div>' +
  5052. '<div class="calendar right">' +
  5053. '<div class="daterangepicker_input">' +
  5054. '<input class="input-mini form-control" type="text" name="daterangepicker_end" value="" />' +
  5055. '<i class="fa fa-calendar glyphicon glyphicon-calendar"></i>' +
  5056. '<div class="calendar-time">' +
  5057. '<div></div>' +
  5058. '<i class="fa fa-clock-o glyphicon glyphicon-time"></i>' +
  5059. '</div>' +
  5060. '</div>' +
  5061. '<div class="calendar-table"></div>' +
  5062. '</div>' +
  5063. '<div class="ranges">' +
  5064. '<div class="range_inputs">' +
  5065. '<button class="applyBtn" disabled="disabled" type="button"></button> ' +
  5066. '<button class="cancelBtn" type="button"></button>' +
  5067. '</div>' +
  5068. '</div>' +
  5069. '</div>';
  5070. this.parentEl = (options.parentEl && $(options.parentEl).length) ? $(options.parentEl) : $(this.parentEl);
  5071. this.container = $(options.template).appendTo(this.parentEl);
  5072. //
  5073. // handle all the possible options overriding defaults
  5074. //
  5075. if (typeof options.locale === 'object') {
  5076. if (typeof options.locale.direction === 'string')
  5077. this.locale.direction = options.locale.direction;
  5078. if (typeof options.locale.format === 'string')
  5079. this.locale.format = options.locale.format;
  5080. if (typeof options.locale.separator === 'string')
  5081. this.locale.separator = options.locale.separator;
  5082. if (typeof options.locale.daysOfWeek === 'object')
  5083. this.locale.daysOfWeek = options.locale.daysOfWeek.slice();
  5084. if (typeof options.locale.monthNames === 'object')
  5085. this.locale.monthNames = options.locale.monthNames.slice();
  5086. if (typeof options.locale.firstDay === 'number')
  5087. this.locale.firstDay = options.locale.firstDay;
  5088. if (typeof options.locale.applyLabel === 'string')
  5089. this.locale.applyLabel = options.locale.applyLabel;
  5090. if (typeof options.locale.cancelLabel === 'string')
  5091. this.locale.cancelLabel = options.locale.cancelLabel;
  5092. if (typeof options.locale.weekLabel === 'string')
  5093. this.locale.weekLabel = options.locale.weekLabel;
  5094. if (typeof options.locale.customRangeLabel === 'string'){
  5095. //Support unicode chars in the custom range name.
  5096. var elem = document.createElement('textarea');
  5097. elem.innerHTML = options.locale.customRangeLabel;
  5098. var rangeHtml = elem.value;
  5099. this.locale.customRangeLabel = rangeHtml;
  5100. }
  5101. }
  5102. this.container.addClass(this.locale.direction);
  5103. if (typeof options.startDate === 'string')
  5104. this.startDate = moment(options.startDate, this.locale.format);
  5105. if (typeof options.endDate === 'string')
  5106. this.endDate = moment(options.endDate, this.locale.format);
  5107. if (typeof options.minDate === 'string')
  5108. this.minDate = moment(options.minDate, this.locale.format);
  5109. if (typeof options.maxDate === 'string')
  5110. this.maxDate = moment(options.maxDate, this.locale.format);
  5111. if (typeof options.startDate === 'object')
  5112. this.startDate = moment(options.startDate);
  5113. if (typeof options.endDate === 'object')
  5114. this.endDate = moment(options.endDate);
  5115. if (typeof options.minDate === 'object')
  5116. this.minDate = moment(options.minDate);
  5117. if (typeof options.maxDate === 'object')
  5118. this.maxDate = moment(options.maxDate);
  5119. // sanity check for bad options
  5120. if (this.minDate && this.startDate.isBefore(this.minDate))
  5121. this.startDate = this.minDate.clone();
  5122. // sanity check for bad options
  5123. if (this.maxDate && this.endDate.isAfter(this.maxDate))
  5124. this.endDate = this.maxDate.clone();
  5125. if (typeof options.applyClass === 'string')
  5126. this.applyClass = options.applyClass;
  5127. if (typeof options.cancelClass === 'string')
  5128. this.cancelClass = options.cancelClass;
  5129. if (typeof options.dateLimit === 'object')
  5130. this.dateLimit = options.dateLimit;
  5131. if (typeof options.opens === 'string')
  5132. this.opens = options.opens;
  5133. if (typeof options.drops === 'string')
  5134. this.drops = options.drops;
  5135. if (typeof options.showWeekNumbers === 'boolean')
  5136. this.showWeekNumbers = options.showWeekNumbers;
  5137. if (typeof options.showISOWeekNumbers === 'boolean')
  5138. this.showISOWeekNumbers = options.showISOWeekNumbers;
  5139. if (typeof options.buttonClasses === 'string')
  5140. this.buttonClasses = options.buttonClasses;
  5141. if (typeof options.buttonClasses === 'object')
  5142. this.buttonClasses = options.buttonClasses.join(' ');
  5143. if (typeof options.showDropdowns === 'boolean')
  5144. this.showDropdowns = options.showDropdowns;
  5145. if (typeof options.showCustomRangeLabel === 'boolean')
  5146. this.showCustomRangeLabel = options.showCustomRangeLabel;
  5147. if (typeof options.singleDatePicker === 'boolean') {
  5148. this.singleDatePicker = options.singleDatePicker;
  5149. if (this.singleDatePicker)
  5150. this.endDate = this.startDate.clone();
  5151. }
  5152. if (typeof options.timePicker === 'boolean')
  5153. this.timePicker = options.timePicker;
  5154. if (typeof options.timePickerSeconds === 'boolean')
  5155. this.timePickerSeconds = options.timePickerSeconds;
  5156. if (typeof options.timePickerIncrement === 'number')
  5157. this.timePickerIncrement = options.timePickerIncrement;
  5158. if (typeof options.timePicker24Hour === 'boolean')
  5159. this.timePicker24Hour = options.timePicker24Hour;
  5160. if (typeof options.autoApply === 'boolean')
  5161. this.autoApply = options.autoApply;
  5162. if (typeof options.autoUpdateInput === 'boolean')
  5163. this.autoUpdateInput = options.autoUpdateInput;
  5164. if (typeof options.linkedCalendars === 'boolean')
  5165. this.linkedCalendars = options.linkedCalendars;
  5166. if (typeof options.isInvalidDate === 'function')
  5167. this.isInvalidDate = options.isInvalidDate;
  5168. if (typeof options.isCustomDate === 'function')
  5169. this.isCustomDate = options.isCustomDate;
  5170. if (typeof options.alwaysShowCalendars === 'boolean')
  5171. this.alwaysShowCalendars = options.alwaysShowCalendars;
  5172. // update day names order to firstDay
  5173. if (this.locale.firstDay != 0) {
  5174. var iterator = this.locale.firstDay;
  5175. while (iterator > 0) {
  5176. this.locale.daysOfWeek.push(this.locale.daysOfWeek.shift());
  5177. iterator--;
  5178. }
  5179. }
  5180. var start, end, range;
  5181. //if no start/end dates set, check if an input element contains initial values
  5182. if (typeof options.startDate === 'undefined' && typeof options.endDate === 'undefined') {
  5183. if ($(this.element).is('input[type=text]')) {
  5184. var val = $(this.element).val(),
  5185. split = val.split(this.locale.separator);
  5186. start = end = null;
  5187. if (split.length == 2) {
  5188. start = moment(split[0], this.locale.format);
  5189. end = moment(split[1], this.locale.format);
  5190. } else if (this.singleDatePicker && val !== "") {
  5191. start = moment(val, this.locale.format);
  5192. end = moment(val, this.locale.format);
  5193. }
  5194. if (start !== null && end !== null) {
  5195. this.setStartDate(start);
  5196. this.setEndDate(end);
  5197. }
  5198. }
  5199. }
  5200. if (typeof options.ranges === 'object') {
  5201. for (range in options.ranges) {
  5202. if (typeof options.ranges[range][0] === 'string')
  5203. start = moment(options.ranges[range][0], this.locale.format);
  5204. else
  5205. start = moment(options.ranges[range][0]);
  5206. if (typeof options.ranges[range][1] === 'string')
  5207. end = moment(options.ranges[range][1], this.locale.format);
  5208. else
  5209. end = moment(options.ranges[range][1]);
  5210. // If the start or end date exceed those allowed by the minDate or dateLimit
  5211. // options, shorten the range to the allowable period.
  5212. if (this.minDate && start.isBefore(this.minDate))
  5213. start = this.minDate.clone();
  5214. var maxDate = this.maxDate;
  5215. if (this.dateLimit && maxDate && start.clone().add(this.dateLimit).isAfter(maxDate))
  5216. maxDate = start.clone().add(this.dateLimit);
  5217. if (maxDate && end.isAfter(maxDate))
  5218. end = maxDate.clone();
  5219. // If the end of the range is before the minimum or the start of the range is
  5220. // after the maximum, don't display this range option at all.
  5221. if ((this.minDate && end.isBefore(this.minDate, this.timepicker ? 'minute' : 'day'))
  5222. || (maxDate && start.isAfter(maxDate, this.timepicker ? 'minute' : 'day')))
  5223. continue;
  5224. //Support unicode chars in the range names.
  5225. var elem = document.createElement('textarea');
  5226. elem.innerHTML = range;
  5227. var rangeHtml = elem.value;
  5228. this.ranges[rangeHtml] = [start, end];
  5229. }
  5230. var list = '<ul>';
  5231. for (range in this.ranges) {
  5232. list += '<li data-range-key="' + range + '">' + range + '</li>';
  5233. }
  5234. if (this.showCustomRangeLabel) {
  5235. list += '<li data-range-key="' + this.locale.customRangeLabel + '">' + this.locale.customRangeLabel + '</li>';
  5236. }
  5237. list += '</ul>';
  5238. this.container.find('.ranges').prepend(list);
  5239. }
  5240. if (typeof cb === 'function') {
  5241. this.callback = cb;
  5242. }
  5243. if (!this.timePicker) {
  5244. this.startDate = this.startDate.startOf('day');
  5245. this.endDate = this.endDate.endOf('day');
  5246. this.container.find('.calendar-time').hide();
  5247. }
  5248. //can't be used together for now
  5249. if (this.timePicker && this.autoApply)
  5250. this.autoApply = false;
  5251. if (this.autoApply && typeof options.ranges !== 'object') {
  5252. this.container.find('.ranges').hide();
  5253. } else if (this.autoApply) {
  5254. this.container.find('.applyBtn, .cancelBtn').addClass('hide');
  5255. }
  5256. if (this.singleDatePicker) {
  5257. this.container.addClass('single');
  5258. this.container.find('.calendar.left').addClass('single');
  5259. this.container.find('.calendar.left').show();
  5260. this.container.find('.calendar.right').hide();
  5261. this.container.find('.daterangepicker_input input, .daterangepicker_input > i').hide();
  5262. if (this.timePicker) {
  5263. this.container.find('.ranges ul').hide();
  5264. } else {
  5265. this.container.find('.ranges').hide();
  5266. }
  5267. }
  5268. if ((typeof options.ranges === 'undefined' && !this.singleDatePicker) || this.alwaysShowCalendars) {
  5269. this.container.addClass('show-calendar');
  5270. }
  5271. this.container.addClass('opens' + this.opens);
  5272. //swap the position of the predefined ranges if opens right
  5273. if (typeof options.ranges !== 'undefined' && this.opens == 'right') {
  5274. this.container.find('.ranges').prependTo( this.container.find('.calendar.left').parent() );
  5275. }
  5276. //apply CSS classes and labels to buttons
  5277. this.container.find('.applyBtn, .cancelBtn').addClass(this.buttonClasses);
  5278. if (this.applyClass.length)
  5279. this.container.find('.applyBtn').addClass(this.applyClass);
  5280. if (this.cancelClass.length)
  5281. this.container.find('.cancelBtn').addClass(this.cancelClass);
  5282. this.container.find('.applyBtn').html(this.locale.applyLabel);
  5283. this.container.find('.cancelBtn').html(this.locale.cancelLabel);
  5284. //
  5285. // event listeners
  5286. //
  5287. this.container.find('.calendar')
  5288. .on('click.daterangepicker', '.prev', $.proxy(this.clickPrev, this))
  5289. .on('click.daterangepicker', '.next', $.proxy(this.clickNext, this))
  5290. .on('mousedown.daterangepicker', 'td.available', $.proxy(this.clickDate, this))
  5291. .on('mouseenter.daterangepicker', 'td.available', $.proxy(this.hoverDate, this))
  5292. .on('mouseleave.daterangepicker', 'td.available', $.proxy(this.updateFormInputs, this))
  5293. .on('change.daterangepicker', 'select.yearselect', $.proxy(this.monthOrYearChanged, this))
  5294. .on('change.daterangepicker', 'select.monthselect', $.proxy(this.monthOrYearChanged, this))
  5295. .on('change.daterangepicker', 'select.hourselect,select.minuteselect,select.secondselect,select.ampmselect', $.proxy(this.timeChanged, this))
  5296. .on('click.daterangepicker', '.daterangepicker_input input', $.proxy(this.showCalendars, this))
  5297. .on('focus.daterangepicker', '.daterangepicker_input input', $.proxy(this.formInputsFocused, this))
  5298. .on('blur.daterangepicker', '.daterangepicker_input input', $.proxy(this.formInputsBlurred, this))
  5299. .on('change.daterangepicker', '.daterangepicker_input input', $.proxy(this.formInputsChanged, this))
  5300. .on('keydown.daterangepicker', '.daterangepicker_input input', $.proxy(this.formInputsKeydown, this));
  5301. this.container.find('.ranges')
  5302. .on('click.daterangepicker', 'button.applyBtn', $.proxy(this.clickApply, this))
  5303. .on('click.daterangepicker', 'button.cancelBtn', $.proxy(this.clickCancel, this))
  5304. .on('click.daterangepicker', 'li', $.proxy(this.clickRange, this))
  5305. .on('mouseenter.daterangepicker', 'li', $.proxy(this.hoverRange, this))
  5306. .on('mouseleave.daterangepicker', 'li', $.proxy(this.updateFormInputs, this));
  5307. if (this.element.is('input') || this.element.is('button')) {
  5308. this.element.on({
  5309. 'click.daterangepicker': $.proxy(this.show, this),
  5310. 'focus.daterangepicker': $.proxy(this.show, this),
  5311. 'keyup.daterangepicker': $.proxy(this.elementChanged, this),
  5312. 'keydown.daterangepicker': $.proxy(this.keydown, this) //IE 11 compatibility
  5313. });
  5314. } else {
  5315. this.element.on('click.daterangepicker', $.proxy(this.toggle, this));
  5316. this.element.on('keydown.daterangepicker', $.proxy(this.toggle, this));
  5317. }
  5318. //
  5319. // if attached to a text input, set the initial value
  5320. //
  5321. if (this.element.is('input') && !this.singleDatePicker && this.autoUpdateInput) {
  5322. this.element.val(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
  5323. this.element.trigger('change');
  5324. } else if (this.element.is('input') && this.autoUpdateInput) {
  5325. this.element.val(this.startDate.format(this.locale.format));
  5326. this.element.trigger('change');
  5327. }
  5328. };
  5329. DateRangePicker.prototype = {
  5330. constructor: DateRangePicker,
  5331. setStartDate: function(startDate) {
  5332. if (typeof startDate === 'string')
  5333. this.startDate = moment(startDate, this.locale.format);
  5334. if (typeof startDate === 'object')
  5335. this.startDate = moment(startDate);
  5336. if (!this.timePicker)
  5337. this.startDate = this.startDate.startOf('day');
  5338. if (this.timePicker && this.timePickerIncrement)
  5339. this.startDate.minute(Math.round(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
  5340. if (this.minDate && this.startDate.isBefore(this.minDate)) {
  5341. this.startDate = this.minDate.clone();
  5342. if (this.timePicker && this.timePickerIncrement)
  5343. this.startDate.minute(Math.round(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
  5344. }
  5345. if (this.maxDate && this.startDate.isAfter(this.maxDate)) {
  5346. this.startDate = this.maxDate.clone();
  5347. if (this.timePicker && this.timePickerIncrement)
  5348. this.startDate.minute(Math.floor(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
  5349. }
  5350. if (!this.isShowing)
  5351. this.updateElement();
  5352. this.updateMonthsInView();
  5353. },
  5354. setEndDate: function(endDate) {
  5355. if (typeof endDate === 'string')
  5356. this.endDate = moment(endDate, this.locale.format);
  5357. if (typeof endDate === 'object')
  5358. this.endDate = moment(endDate);
  5359. if (!this.timePicker)
  5360. this.endDate = this.endDate.add(1,'d').startOf('day').subtract(1,'second');
  5361. if (this.timePicker && this.timePickerIncrement)
  5362. this.endDate.minute(Math.round(this.endDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
  5363. if (this.endDate.isBefore(this.startDate))
  5364. this.endDate = this.startDate.clone();
  5365. if (this.maxDate && this.endDate.isAfter(this.maxDate))
  5366. this.endDate = this.maxDate.clone();
  5367. if (this.dateLimit && this.startDate.clone().add(this.dateLimit).isBefore(this.endDate))
  5368. this.endDate = this.startDate.clone().add(this.dateLimit);
  5369. this.previousRightTime = this.endDate.clone();
  5370. if (!this.isShowing)
  5371. this.updateElement();
  5372. this.updateMonthsInView();
  5373. },
  5374. isInvalidDate: function() {
  5375. return false;
  5376. },
  5377. isCustomDate: function() {
  5378. return false;
  5379. },
  5380. updateView: function() {
  5381. if (this.timePicker) {
  5382. this.renderTimePicker('left');
  5383. this.renderTimePicker('right');
  5384. if (!this.endDate) {
  5385. this.container.find('.right .calendar-time select').attr('disabled', 'disabled').addClass('disabled');
  5386. } else {
  5387. this.container.find('.right .calendar-time select').removeAttr('disabled').removeClass('disabled');
  5388. }
  5389. }
  5390. if (this.endDate) {
  5391. this.container.find('input[name="daterangepicker_end"]').removeClass('active');
  5392. this.container.find('input[name="daterangepicker_start"]').addClass('active');
  5393. } else {
  5394. this.container.find('input[name="daterangepicker_end"]').addClass('active');
  5395. this.container.find('input[name="daterangepicker_start"]').removeClass('active');
  5396. }
  5397. this.updateMonthsInView();
  5398. this.updateCalendars();
  5399. this.updateFormInputs();
  5400. },
  5401. updateMonthsInView: function() {
  5402. if (this.endDate) {
  5403. //if both dates are visible already, do nothing
  5404. if (!this.singleDatePicker && this.leftCalendar.month && this.rightCalendar.month &&
  5405. (this.startDate.format('YYYY-MM') == this.leftCalendar.month.format('YYYY-MM') || this.startDate.format('YYYY-MM') == this.rightCalendar.month.format('YYYY-MM'))
  5406. &&
  5407. (this.endDate.format('YYYY-MM') == this.leftCalendar.month.format('YYYY-MM') || this.endDate.format('YYYY-MM') == this.rightCalendar.month.format('YYYY-MM'))
  5408. ) {
  5409. return;
  5410. }
  5411. this.leftCalendar.month = this.startDate.clone().date(2);
  5412. if (!this.linkedCalendars && (this.endDate.month() != this.startDate.month() || this.endDate.year() != this.startDate.year())) {
  5413. this.rightCalendar.month = this.endDate.clone().date(2);
  5414. } else {
  5415. this.rightCalendar.month = this.startDate.clone().date(2).add(1, 'month');
  5416. }
  5417. } else {
  5418. if (this.leftCalendar.month.format('YYYY-MM') != this.startDate.format('YYYY-MM') && this.rightCalendar.month.format('YYYY-MM') != this.startDate.format('YYYY-MM')) {
  5419. this.leftCalendar.month = this.startDate.clone().date(2);
  5420. this.rightCalendar.month = this.startDate.clone().date(2).add(1, 'month');
  5421. }
  5422. }
  5423. if (this.maxDate && this.linkedCalendars && !this.singleDatePicker && this.rightCalendar.month > this.maxDate) {
  5424. this.rightCalendar.month = this.maxDate.clone().date(2);
  5425. this.leftCalendar.month = this.maxDate.clone().date(2).subtract(1, 'month');
  5426. }
  5427. },
  5428. updateCalendars: function() {
  5429. if (this.timePicker) {
  5430. var hour, minute, second;
  5431. if (this.endDate) {
  5432. hour = parseInt(this.container.find('.left .hourselect').val(), 10);
  5433. minute = parseInt(this.container.find('.left .minuteselect').val(), 10);
  5434. second = this.timePickerSeconds ? parseInt(this.container.find('.left .secondselect').val(), 10) : 0;
  5435. if (!this.timePicker24Hour) {
  5436. var ampm = this.container.find('.left .ampmselect').val();
  5437. if (ampm === 'PM' && hour < 12)
  5438. hour += 12;
  5439. if (ampm === 'AM' && hour === 12)
  5440. hour = 0;
  5441. }
  5442. } else {
  5443. hour = parseInt(this.container.find('.right .hourselect').val(), 10);
  5444. minute = parseInt(this.container.find('.right .minuteselect').val(), 10);
  5445. second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0;
  5446. if (!this.timePicker24Hour) {
  5447. var ampm = this.container.find('.right .ampmselect').val();
  5448. if (ampm === 'PM' && hour < 12)
  5449. hour += 12;
  5450. if (ampm === 'AM' && hour === 12)
  5451. hour = 0;
  5452. }
  5453. }
  5454. this.leftCalendar.month.hour(hour).minute(minute).second(second);
  5455. this.rightCalendar.month.hour(hour).minute(minute).second(second);
  5456. }
  5457. this.renderCalendar('left');
  5458. this.renderCalendar('right');
  5459. //highlight any predefined range matching the current start and end dates
  5460. this.container.find('.ranges li').removeClass('active');
  5461. if (this.endDate == null) return;
  5462. this.calculateChosenLabel();
  5463. },
  5464. renderCalendar: function(side) {
  5465. //
  5466. // Build the matrix of dates that will populate the calendar
  5467. //
  5468. var calendar = side == 'left' ? this.leftCalendar : this.rightCalendar;
  5469. var month = calendar.month.month();
  5470. var year = calendar.month.year();
  5471. var hour = calendar.month.hour();
  5472. var minute = calendar.month.minute();
  5473. var second = calendar.month.second();
  5474. var daysInMonth = moment([year, month]).daysInMonth();
  5475. var firstDay = moment([year, month, 1]);
  5476. var lastDay = moment([year, month, daysInMonth]);
  5477. var lastMonth = moment(firstDay).subtract(1, 'month').month();
  5478. var lastYear = moment(firstDay).subtract(1, 'month').year();
  5479. var daysInLastMonth = moment([lastYear, lastMonth]).daysInMonth();
  5480. var dayOfWeek = firstDay.day();
  5481. //initialize a 6 rows x 7 columns array for the calendar
  5482. var calendar = [];
  5483. calendar.firstDay = firstDay;
  5484. calendar.lastDay = lastDay;
  5485. for (var i = 0; i < 6; i++) {
  5486. calendar[i] = [];
  5487. }
  5488. //populate the calendar with date objects
  5489. var startDay = daysInLastMonth - dayOfWeek + this.locale.firstDay + 1;
  5490. if (startDay > daysInLastMonth)
  5491. startDay -= 7;
  5492. if (dayOfWeek == this.locale.firstDay)
  5493. startDay = daysInLastMonth - 6;
  5494. var curDate = moment([lastYear, lastMonth, startDay, 12, minute, second]);
  5495. var col, row;
  5496. for (var i = 0, col = 0, row = 0; i < 42; i++, col++, curDate = moment(curDate).add(24, 'hour')) {
  5497. if (i > 0 && col % 7 === 0) {
  5498. col = 0;
  5499. row++;
  5500. }
  5501. calendar[row][col] = curDate.clone().hour(hour).minute(minute).second(second);
  5502. curDate.hour(12);
  5503. if (this.minDate && calendar[row][col].format('YYYY-MM-DD') == this.minDate.format('YYYY-MM-DD') && calendar[row][col].isBefore(this.minDate) && side == 'left') {
  5504. calendar[row][col] = this.minDate.clone();
  5505. }
  5506. if (this.maxDate && calendar[row][col].format('YYYY-MM-DD') == this.maxDate.format('YYYY-MM-DD') && calendar[row][col].isAfter(this.maxDate) && side == 'right') {
  5507. calendar[row][col] = this.maxDate.clone();
  5508. }
  5509. }
  5510. //make the calendar object available to hoverDate/clickDate
  5511. if (side == 'left') {
  5512. this.leftCalendar.calendar = calendar;
  5513. } else {
  5514. this.rightCalendar.calendar = calendar;
  5515. }
  5516. //
  5517. // Display the calendar
  5518. //
  5519. var minDate = side == 'left' ? this.minDate : this.startDate;
  5520. var maxDate = this.maxDate;
  5521. var selected = side == 'left' ? this.startDate : this.endDate;
  5522. var arrow = this.locale.direction == 'ltr' ? {left: 'chevron-left', right: 'chevron-right'} : {left: 'chevron-right', right: 'chevron-left'};
  5523. var html = '<table class="table-condensed">';
  5524. html += '<thead>';
  5525. html += '<tr>';
  5526. // add empty cell for week number
  5527. if (this.showWeekNumbers || this.showISOWeekNumbers)
  5528. html += '<th></th>';
  5529. if ((!minDate || minDate.isBefore(calendar.firstDay)) && (!this.linkedCalendars || side == 'left')) {
  5530. html += '<th class="prev available"><i class="fa fa-' + arrow.left + ' glyphicon glyphicon-' + arrow.left + '"></i></th>';
  5531. } else {
  5532. html += '<th></th>';
  5533. }
  5534. var dateHtml = this.locale.monthNames[calendar[1][1].month()] + calendar[1][1].format(" YYYY");
  5535. if (this.showDropdowns) {
  5536. var currentMonth = calendar[1][1].month();
  5537. var currentYear = calendar[1][1].year();
  5538. var maxYear = (maxDate && maxDate.year()) || (currentYear + 5);
  5539. var minYear = (minDate && minDate.year()) || (currentYear - 50);
  5540. var inMinYear = currentYear == minYear;
  5541. var inMaxYear = currentYear == maxYear;
  5542. var monthHtml = '<select class="monthselect">';
  5543. for (var m = 0; m < 12; m++) {
  5544. if ((!inMinYear || m >= minDate.month()) && (!inMaxYear || m <= maxDate.month())) {
  5545. monthHtml += "<option value='" + m + "'" +
  5546. (m === currentMonth ? " selected='selected'" : "") +
  5547. ">" + this.locale.monthNames[m] + "</option>";
  5548. } else {
  5549. monthHtml += "<option value='" + m + "'" +
  5550. (m === currentMonth ? " selected='selected'" : "") +
  5551. " disabled='disabled'>" + this.locale.monthNames[m] + "</option>";
  5552. }
  5553. }
  5554. monthHtml += "</select>";
  5555. var yearHtml = '<select class="yearselect">';
  5556. for (var y = minYear; y <= maxYear; y++) {
  5557. yearHtml += '<option value="' + y + '"' +
  5558. (y === currentYear ? ' selected="selected"' : '') +
  5559. '>' + y + '</option>';
  5560. }
  5561. yearHtml += '</select>';
  5562. dateHtml = monthHtml + yearHtml;
  5563. }
  5564. html += '<th colspan="5" class="month">' + dateHtml + '</th>';
  5565. if ((!maxDate || maxDate.isAfter(calendar.lastDay)) && (!this.linkedCalendars || side == 'right' || this.singleDatePicker)) {
  5566. html += '<th class="next available"><i class="fa fa-' + arrow.right + ' glyphicon glyphicon-' + arrow.right + '"></i></th>';
  5567. } else {
  5568. html += '<th></th>';
  5569. }
  5570. html += '</tr>';
  5571. html += '<tr>';
  5572. // add week number label
  5573. if (this.showWeekNumbers || this.showISOWeekNumbers)
  5574. html += '<th class="week">' + this.locale.weekLabel + '</th>';
  5575. $.each(this.locale.daysOfWeek, function(index, dayOfWeek) {
  5576. html += '<th>' + dayOfWeek + '</th>';
  5577. });
  5578. html += '</tr>';
  5579. html += '</thead>';
  5580. html += '<tbody>';
  5581. //adjust maxDate to reflect the dateLimit setting in order to
  5582. //grey out end dates beyond the dateLimit
  5583. if (this.endDate == null && this.dateLimit) {
  5584. var maxLimit = this.startDate.clone().add(this.dateLimit).endOf('day');
  5585. if (!maxDate || maxLimit.isBefore(maxDate)) {
  5586. maxDate = maxLimit;
  5587. }
  5588. }
  5589. for (var row = 0; row < 6; row++) {
  5590. html += '<tr>';
  5591. // add week number
  5592. if (this.showWeekNumbers)
  5593. html += '<td class="week">' + calendar[row][0].week() + '</td>';
  5594. else if (this.showISOWeekNumbers)
  5595. html += '<td class="week">' + calendar[row][0].isoWeek() + '</td>';
  5596. for (var col = 0; col < 7; col++) {
  5597. var classes = [];
  5598. //highlight today's date
  5599. if (calendar[row][col].isSame(new Date(), "day"))
  5600. classes.push('today');
  5601. //highlight weekends
  5602. if (calendar[row][col].isoWeekday() > 5)
  5603. classes.push('weekend');
  5604. //grey out the dates in other months displayed at beginning and end of this calendar
  5605. if (calendar[row][col].month() != calendar[1][1].month())
  5606. classes.push('off');
  5607. //don't allow selection of dates before the minimum date
  5608. if (this.minDate && calendar[row][col].isBefore(this.minDate, 'day'))
  5609. classes.push('off', 'disabled');
  5610. //don't allow selection of dates after the maximum date
  5611. if (maxDate && calendar[row][col].isAfter(maxDate, 'day'))
  5612. classes.push('off', 'disabled');
  5613. //don't allow selection of date if a custom function decides it's invalid
  5614. if (this.isInvalidDate(calendar[row][col]))
  5615. classes.push('off', 'disabled');
  5616. //highlight the currently selected start date
  5617. if (calendar[row][col].format('YYYY-MM-DD') == this.startDate.format('YYYY-MM-DD'))
  5618. classes.push('active', 'start-date');
  5619. //highlight the currently selected end date
  5620. if (this.endDate != null && calendar[row][col].format('YYYY-MM-DD') == this.endDate.format('YYYY-MM-DD'))
  5621. classes.push('active', 'end-date');
  5622. //highlight dates in-between the selected dates
  5623. if (this.endDate != null && calendar[row][col] > this.startDate && calendar[row][col] < this.endDate)
  5624. classes.push('in-range');
  5625. //apply custom classes for this date
  5626. var isCustom = this.isCustomDate(calendar[row][col]);
  5627. if (isCustom !== false) {
  5628. if (typeof isCustom === 'string')
  5629. classes.push(isCustom);
  5630. else
  5631. Array.prototype.push.apply(classes, isCustom);
  5632. }
  5633. var cname = '', disabled = false;
  5634. for (var i = 0; i < classes.length; i++) {
  5635. cname += classes[i] + ' ';
  5636. if (classes[i] == 'disabled')
  5637. disabled = true;
  5638. }
  5639. if (!disabled)
  5640. cname += 'available';
  5641. html += '<td class="' + cname.replace(/^\s+|\s+$/g, '') + '" data-title="' + 'r' + row + 'c' + col + '">' + calendar[row][col].date() + '</td>';
  5642. }
  5643. html += '</tr>';
  5644. }
  5645. html += '</tbody>';
  5646. html += '</table>';
  5647. this.container.find('.calendar.' + side + ' .calendar-table').html(html);
  5648. },
  5649. renderTimePicker: function(side) {
  5650. // Don't bother updating the time picker if it's currently disabled
  5651. // because an end date hasn't been clicked yet
  5652. if (side == 'right' && !this.endDate) return;
  5653. var html, selected, minDate, maxDate = this.maxDate;
  5654. if (this.dateLimit && (!this.maxDate || this.startDate.clone().add(this.dateLimit).isAfter(this.maxDate)))
  5655. maxDate = this.startDate.clone().add(this.dateLimit);
  5656. if (side == 'left') {
  5657. selected = this.startDate.clone();
  5658. minDate = this.minDate;
  5659. } else if (side == 'right') {
  5660. selected = this.endDate.clone();
  5661. minDate = this.startDate;
  5662. //Preserve the time already selected
  5663. var timeSelector = this.container.find('.calendar.right .calendar-time div');
  5664. if (timeSelector.html() != '') {
  5665. selected.hour(timeSelector.find('.hourselect option:selected').val() || selected.hour());
  5666. selected.minute(timeSelector.find('.minuteselect option:selected').val() || selected.minute());
  5667. selected.second(timeSelector.find('.secondselect option:selected').val() || selected.second());
  5668. if (!this.timePicker24Hour) {
  5669. var ampm = timeSelector.find('.ampmselect option:selected').val();
  5670. if (ampm === 'PM' && selected.hour() < 12)
  5671. selected.hour(selected.hour() + 12);
  5672. if (ampm === 'AM' && selected.hour() === 12)
  5673. selected.hour(0);
  5674. }
  5675. }
  5676. if (selected.isBefore(this.startDate))
  5677. selected = this.startDate.clone();
  5678. if (maxDate && selected.isAfter(maxDate))
  5679. selected = maxDate.clone();
  5680. }
  5681. //
  5682. // hours
  5683. //
  5684. html = '<select class="hourselect">';
  5685. var start = this.timePicker24Hour ? 0 : 1;
  5686. var end = this.timePicker24Hour ? 23 : 12;
  5687. for (var i = start; i <= end; i++) {
  5688. var i_in_24 = i;
  5689. if (!this.timePicker24Hour)
  5690. i_in_24 = selected.hour() >= 12 ? (i == 12 ? 12 : i + 12) : (i == 12 ? 0 : i);
  5691. var time = selected.clone().hour(i_in_24);
  5692. var disabled = false;
  5693. if (minDate && time.minute(59).isBefore(minDate))
  5694. disabled = true;
  5695. if (maxDate && time.minute(0).isAfter(maxDate))
  5696. disabled = true;
  5697. if (i_in_24 == selected.hour() && !disabled) {
  5698. html += '<option value="' + i + '" selected="selected">' + i + '</option>';
  5699. } else if (disabled) {
  5700. html += '<option value="' + i + '" disabled="disabled" class="disabled">' + i + '</option>';
  5701. } else {
  5702. html += '<option value="' + i + '">' + i + '</option>';
  5703. }
  5704. }
  5705. html += '</select> ';
  5706. //
  5707. // minutes
  5708. //
  5709. html += ': <select class="minuteselect">';
  5710. for (var i = 0; i < 60; i += this.timePickerIncrement) {
  5711. var padded = i < 10 ? '0' + i : i;
  5712. var time = selected.clone().minute(i);
  5713. var disabled = false;
  5714. if (minDate && time.second(59).isBefore(minDate))
  5715. disabled = true;
  5716. if (maxDate && time.second(0).isAfter(maxDate))
  5717. disabled = true;
  5718. if (selected.minute() == i && !disabled) {
  5719. html += '<option value="' + i + '" selected="selected">' + padded + '</option>';
  5720. } else if (disabled) {
  5721. html += '<option value="' + i + '" disabled="disabled" class="disabled">' + padded + '</option>';
  5722. } else {
  5723. html += '<option value="' + i + '">' + padded + '</option>';
  5724. }
  5725. }
  5726. html += '</select> ';
  5727. //
  5728. // seconds
  5729. //
  5730. if (this.timePickerSeconds) {
  5731. html += ': <select class="secondselect">';
  5732. for (var i = 0; i < 60; i++) {
  5733. var padded = i < 10 ? '0' + i : i;
  5734. var time = selected.clone().second(i);
  5735. var disabled = false;
  5736. if (minDate && time.isBefore(minDate))
  5737. disabled = true;
  5738. if (maxDate && time.isAfter(maxDate))
  5739. disabled = true;
  5740. if (selected.second() == i && !disabled) {
  5741. html += '<option value="' + i + '" selected="selected">' + padded + '</option>';
  5742. } else if (disabled) {
  5743. html += '<option value="' + i + '" disabled="disabled" class="disabled">' + padded + '</option>';
  5744. } else {
  5745. html += '<option value="' + i + '">' + padded + '</option>';
  5746. }
  5747. }
  5748. html += '</select> ';
  5749. }
  5750. //
  5751. // AM/PM
  5752. //
  5753. if (!this.timePicker24Hour) {
  5754. html += '<select class="ampmselect">';
  5755. var am_html = '';
  5756. var pm_html = '';
  5757. if (minDate && selected.clone().hour(12).minute(0).second(0).isBefore(minDate))
  5758. am_html = ' disabled="disabled" class="disabled"';
  5759. if (maxDate && selected.clone().hour(0).minute(0).second(0).isAfter(maxDate))
  5760. pm_html = ' disabled="disabled" class="disabled"';
  5761. if (selected.hour() >= 12) {
  5762. html += '<option value="AM"' + am_html + '>AM</option><option value="PM" selected="selected"' + pm_html + '>PM</option>';
  5763. } else {
  5764. html += '<option value="AM" selected="selected"' + am_html + '>AM</option><option value="PM"' + pm_html + '>PM</option>';
  5765. }
  5766. html += '</select>';
  5767. }
  5768. this.container.find('.calendar.' + side + ' .calendar-time div').html(html);
  5769. },
  5770. updateFormInputs: function() {
  5771. //ignore mouse movements while an above-calendar text input has focus
  5772. if (this.container.find('input[name=daterangepicker_start]').is(":focus") || this.container.find('input[name=daterangepicker_end]').is(":focus"))
  5773. return;
  5774. this.container.find('input[name=daterangepicker_start]').val(this.startDate.format(this.locale.format));
  5775. if (this.endDate)
  5776. this.container.find('input[name=daterangepicker_end]').val(this.endDate.format(this.locale.format));
  5777. if (this.singleDatePicker || (this.endDate && (this.startDate.isBefore(this.endDate) || this.startDate.isSame(this.endDate)))) {
  5778. this.container.find('button.applyBtn').removeAttr('disabled');
  5779. } else {
  5780. this.container.find('button.applyBtn').attr('disabled', 'disabled');
  5781. }
  5782. },
  5783. move: function() {
  5784. var parentOffset = { top: 0, left: 0 },
  5785. containerTop;
  5786. var parentRightEdge = $(window).width();
  5787. if (!this.parentEl.is('body')) {
  5788. parentOffset = {
  5789. top: this.parentEl.offset().top - this.parentEl.scrollTop(),
  5790. left: this.parentEl.offset().left - this.parentEl.scrollLeft()
  5791. };
  5792. parentRightEdge = this.parentEl[0].clientWidth + this.parentEl.offset().left;
  5793. }
  5794. if (this.drops == 'up')
  5795. containerTop = this.element.offset().top - this.container.outerHeight() - parentOffset.top;
  5796. else
  5797. containerTop = this.element.offset().top + this.element.outerHeight() - parentOffset.top;
  5798. this.container[this.drops == 'up' ? 'addClass' : 'removeClass']('dropup');
  5799. if (this.opens == 'left') {
  5800. this.container.css({
  5801. top: containerTop,
  5802. right: parentRightEdge - this.element.offset().left - this.element.outerWidth(),
  5803. left: 'auto'
  5804. });
  5805. if (this.container.offset().left < 0) {
  5806. this.container.css({
  5807. right: 'auto',
  5808. left: 9
  5809. });
  5810. }
  5811. } else if (this.opens == 'center') {
  5812. this.container.css({
  5813. top: containerTop,
  5814. left: this.element.offset().left - parentOffset.left + this.element.outerWidth() / 2
  5815. - this.container.outerWidth() / 2,
  5816. right: 'auto'
  5817. });
  5818. if (this.container.offset().left < 0) {
  5819. this.container.css({
  5820. right: 'auto',
  5821. left: 9
  5822. });
  5823. }
  5824. } else {
  5825. this.container.css({
  5826. top: containerTop,
  5827. left: this.element.offset().left - parentOffset.left,
  5828. right: 'auto'
  5829. });
  5830. if (this.container.offset().left + this.container.outerWidth() > $(window).width()) {
  5831. this.container.css({
  5832. left: 'auto',
  5833. right: 0
  5834. });
  5835. }
  5836. }
  5837. },
  5838. show: function(e) {
  5839. if (this.isShowing) return;
  5840. // Create a click proxy that is private to this instance of datepicker, for unbinding
  5841. this._outsideClickProxy = $.proxy(function(e) { this.outsideClick(e); }, this);
  5842. // Bind global datepicker mousedown for hiding and
  5843. $(document)
  5844. .on('mousedown.daterangepicker', this._outsideClickProxy)
  5845. // also support mobile devices
  5846. .on('touchend.daterangepicker', this._outsideClickProxy)
  5847. // also explicitly play nice with Bootstrap dropdowns, which stopPropagation when clicking them
  5848. .on('click.daterangepicker', '[data-toggle=dropdown]', this._outsideClickProxy)
  5849. // and also close when focus changes to outside the picker (eg. tabbing between controls)
  5850. .on('focusin.daterangepicker', this._outsideClickProxy);
  5851. // Reposition the picker if the window is resized while it's open
  5852. $(window).on('resize.daterangepicker', $.proxy(function(e) { this.move(e); }, this));
  5853. this.oldStartDate = this.startDate.clone();
  5854. this.oldEndDate = this.endDate.clone();
  5855. this.previousRightTime = this.endDate.clone();
  5856. this.updateView();
  5857. this.container.show();
  5858. this.move();
  5859. this.element.trigger('show.daterangepicker', this);
  5860. this.isShowing = true;
  5861. },
  5862. hide: function(e) {
  5863. if (!this.isShowing) return;
  5864. //incomplete date selection, revert to last values
  5865. if (!this.endDate) {
  5866. this.startDate = this.oldStartDate.clone();
  5867. this.endDate = this.oldEndDate.clone();
  5868. }
  5869. //if a new date range was selected, invoke the user callback function
  5870. if (!this.startDate.isSame(this.oldStartDate) || !this.endDate.isSame(this.oldEndDate))
  5871. this.callback(this.startDate, this.endDate, this.chosenLabel);
  5872. //if picker is attached to a text input, update it
  5873. this.updateElement();
  5874. $(document).off('.daterangepicker');
  5875. $(window).off('.daterangepicker');
  5876. this.container.hide();
  5877. this.element.trigger('hide.daterangepicker', this);
  5878. this.isShowing = false;
  5879. },
  5880. toggle: function(e) {
  5881. if (this.isShowing) {
  5882. this.hide();
  5883. } else {
  5884. this.show();
  5885. }
  5886. },
  5887. outsideClick: function(e) {
  5888. var target = $(e.target);
  5889. // if the page is clicked anywhere except within the daterangerpicker/button
  5890. // itself then call this.hide()
  5891. if (
  5892. // ie modal dialog fix
  5893. e.type == "focusin" ||
  5894. target.closest(this.element).length ||
  5895. target.closest(this.container).length ||
  5896. target.closest('.calendar-table').length
  5897. ) return;
  5898. this.hide();
  5899. this.element.trigger('outsideClick.daterangepicker', this);
  5900. },
  5901. showCalendars: function() {
  5902. this.container.addClass('show-calendar');
  5903. this.move();
  5904. this.element.trigger('showCalendar.daterangepicker', this);
  5905. },
  5906. hideCalendars: function() {
  5907. this.container.removeClass('show-calendar');
  5908. this.element.trigger('hideCalendar.daterangepicker', this);
  5909. },
  5910. hoverRange: function(e) {
  5911. //ignore mouse movements while an above-calendar text input has focus
  5912. if (this.container.find('input[name=daterangepicker_start]').is(":focus") || this.container.find('input[name=daterangepicker_end]').is(":focus"))
  5913. return;
  5914. var label = e.target.getAttribute('data-range-key');
  5915. if (label == this.locale.customRangeLabel) {
  5916. this.updateView();
  5917. } else {
  5918. var dates = this.ranges[label];
  5919. this.container.find('input[name=daterangepicker_start]').val(dates[0].format(this.locale.format));
  5920. this.container.find('input[name=daterangepicker_end]').val(dates[1].format(this.locale.format));
  5921. }
  5922. },
  5923. clickRange: function(e) {
  5924. var label = e.target.getAttribute('data-range-key');
  5925. this.chosenLabel = label;
  5926. if (label == this.locale.customRangeLabel) {
  5927. this.showCalendars();
  5928. } else {
  5929. var dates = this.ranges[label];
  5930. this.startDate = dates[0];
  5931. this.endDate = dates[1];
  5932. if (!this.timePicker) {
  5933. this.startDate.startOf('day');
  5934. this.endDate.endOf('day');
  5935. }
  5936. if (!this.alwaysShowCalendars)
  5937. this.hideCalendars();
  5938. this.clickApply();
  5939. }
  5940. },
  5941. clickPrev: function(e) {
  5942. var cal = $(e.target).parents('.calendar');
  5943. if (cal.hasClass('left')) {
  5944. this.leftCalendar.month.subtract(1, 'month');
  5945. if (this.linkedCalendars)
  5946. this.rightCalendar.month.subtract(1, 'month');
  5947. } else {
  5948. this.rightCalendar.month.subtract(1, 'month');
  5949. }
  5950. this.updateCalendars();
  5951. },
  5952. clickNext: function(e) {
  5953. var cal = $(e.target).parents('.calendar');
  5954. if (cal.hasClass('left')) {
  5955. this.leftCalendar.month.add(1, 'month');
  5956. } else {
  5957. this.rightCalendar.month.add(1, 'month');
  5958. if (this.linkedCalendars)
  5959. this.leftCalendar.month.add(1, 'month');
  5960. }
  5961. this.updateCalendars();
  5962. },
  5963. hoverDate: function(e) {
  5964. //ignore mouse movements while an above-calendar text input has focus
  5965. //if (this.container.find('input[name=daterangepicker_start]').is(":focus") || this.container.find('input[name=daterangepicker_end]').is(":focus"))
  5966. // return;
  5967. //ignore dates that can't be selected
  5968. if (!$(e.target).hasClass('available')) return;
  5969. //have the text inputs above calendars reflect the date being hovered over
  5970. var title = $(e.target).attr('data-title');
  5971. var row = title.substr(1, 1);
  5972. var col = title.substr(3, 1);
  5973. var cal = $(e.target).parents('.calendar');
  5974. var date = cal.hasClass('left') ? this.leftCalendar.calendar[row][col] : this.rightCalendar.calendar[row][col];
  5975. if (this.endDate && !this.container.find('input[name=daterangepicker_start]').is(":focus")) {
  5976. this.container.find('input[name=daterangepicker_start]').val(date.format(this.locale.format));
  5977. } else if (!this.endDate && !this.container.find('input[name=daterangepicker_end]').is(":focus")) {
  5978. this.container.find('input[name=daterangepicker_end]').val(date.format(this.locale.format));
  5979. }
  5980. //highlight the dates between the start date and the date being hovered as a potential end date
  5981. var leftCalendar = this.leftCalendar;
  5982. var rightCalendar = this.rightCalendar;
  5983. var startDate = this.startDate;
  5984. if (!this.endDate) {
  5985. this.container.find('.calendar tbody td').each(function(index, el) {
  5986. //skip week numbers, only look at dates
  5987. if ($(el).hasClass('week')) return;
  5988. var title = $(el).attr('data-title');
  5989. var row = title.substr(1, 1);
  5990. var col = title.substr(3, 1);
  5991. var cal = $(el).parents('.calendar');
  5992. var dt = cal.hasClass('left') ? leftCalendar.calendar[row][col] : rightCalendar.calendar[row][col];
  5993. if ((dt.isAfter(startDate) && dt.isBefore(date)) || dt.isSame(date, 'day')) {
  5994. $(el).addClass('in-range');
  5995. } else {
  5996. $(el).removeClass('in-range');
  5997. }
  5998. });
  5999. }
  6000. },
  6001. clickDate: function(e) {
  6002. if (!$(e.target).hasClass('available')) return;
  6003. var title = $(e.target).attr('data-title');
  6004. var row = title.substr(1, 1);
  6005. var col = title.substr(3, 1);
  6006. var cal = $(e.target).parents('.calendar');
  6007. var date = cal.hasClass('left') ? this.leftCalendar.calendar[row][col] : this.rightCalendar.calendar[row][col];
  6008. //
  6009. // this function needs to do a few things:
  6010. // * alternate between selecting a start and end date for the range,
  6011. // * if the time picker is enabled, apply the hour/minute/second from the select boxes to the clicked date
  6012. // * if autoapply is enabled, and an end date was chosen, apply the selection
  6013. // * if single date picker mode, and time picker isn't enabled, apply the selection immediately
  6014. // * if one of the inputs above the calendars was focused, cancel that manual input
  6015. //
  6016. if (this.endDate || date.isBefore(this.startDate, 'day')) { //picking start
  6017. if (this.timePicker) {
  6018. var hour = parseInt(this.container.find('.left .hourselect').val(), 10);
  6019. if (!this.timePicker24Hour) {
  6020. var ampm = this.container.find('.left .ampmselect').val();
  6021. if (ampm === 'PM' && hour < 12)
  6022. hour += 12;
  6023. if (ampm === 'AM' && hour === 12)
  6024. hour = 0;
  6025. }
  6026. var minute = parseInt(this.container.find('.left .minuteselect').val(), 10);
  6027. var second = this.timePickerSeconds ? parseInt(this.container.find('.left .secondselect').val(), 10) : 0;
  6028. date = date.clone().hour(hour).minute(minute).second(second);
  6029. }
  6030. this.endDate = null;
  6031. this.setStartDate(date.clone());
  6032. } else if (!this.endDate && date.isBefore(this.startDate)) {
  6033. //special case: clicking the same date for start/end,
  6034. //but the time of the end date is before the start date
  6035. this.setEndDate(this.startDate.clone());
  6036. } else { // picking end
  6037. if (this.timePicker) {
  6038. var hour = parseInt(this.container.find('.right .hourselect').val(), 10);
  6039. if (!this.timePicker24Hour) {
  6040. var ampm = this.container.find('.right .ampmselect').val();
  6041. if (ampm === 'PM' && hour < 12)
  6042. hour += 12;
  6043. if (ampm === 'AM' && hour === 12)
  6044. hour = 0;
  6045. }
  6046. var minute = parseInt(this.container.find('.right .minuteselect').val(), 10);
  6047. var second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0;
  6048. date = date.clone().hour(hour).minute(minute).second(second);
  6049. }
  6050. this.setEndDate(date.clone());
  6051. if (this.autoApply) {
  6052. this.calculateChosenLabel();
  6053. this.clickApply();
  6054. }
  6055. }
  6056. if (this.singleDatePicker) {
  6057. this.setEndDate(this.startDate);
  6058. if (!this.timePicker)
  6059. this.clickApply();
  6060. }
  6061. this.updateView();
  6062. //This is to cancel the blur event handler if the mouse was in one of the inputs
  6063. e.stopPropagation();
  6064. },
  6065. calculateChosenLabel: function () {
  6066. var customRange = true;
  6067. var i = 0;
  6068. for (var range in this.ranges) {
  6069. if (this.timePicker) {
  6070. var format = this.timePickerSeconds ? "YYYY-MM-DD hh:mm:ss" : "YYYY-MM-DD hh:mm";
  6071. //ignore times when comparing dates if time picker seconds is not enabled
  6072. if (this.startDate.format(format) == this.ranges[range][0].format(format) && this.endDate.format(format) == this.ranges[range][1].format(format)) {
  6073. customRange = false;
  6074. this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').html();
  6075. break;
  6076. }
  6077. } else {
  6078. //ignore times when comparing dates if time picker is not enabled
  6079. if (this.startDate.format('YYYY-MM-DD') == this.ranges[range][0].format('YYYY-MM-DD') && this.endDate.format('YYYY-MM-DD') == this.ranges[range][1].format('YYYY-MM-DD')) {
  6080. customRange = false;
  6081. this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').html();
  6082. break;
  6083. }
  6084. }
  6085. i++;
  6086. }
  6087. if (customRange) {
  6088. if (this.showCustomRangeLabel) {
  6089. this.chosenLabel = this.container.find('.ranges li:last').addClass('active').html();
  6090. } else {
  6091. this.chosenLabel = null;
  6092. }
  6093. this.showCalendars();
  6094. }
  6095. },
  6096. clickApply: function(e) {
  6097. this.hide();
  6098. this.element.trigger('apply.daterangepicker', this);
  6099. },
  6100. clickCancel: function(e) {
  6101. this.startDate = this.oldStartDate;
  6102. this.endDate = this.oldEndDate;
  6103. this.hide();
  6104. this.element.trigger('cancel.daterangepicker', this);
  6105. },
  6106. monthOrYearChanged: function(e) {
  6107. var isLeft = $(e.target).closest('.calendar').hasClass('left'),
  6108. leftOrRight = isLeft ? 'left' : 'right',
  6109. cal = this.container.find('.calendar.'+leftOrRight);
  6110. // Month must be Number for new moment versions
  6111. var month = parseInt(cal.find('.monthselect').val(), 10);
  6112. var year = cal.find('.yearselect').val();
  6113. if (!isLeft) {
  6114. if (year < this.startDate.year() || (year == this.startDate.year() && month < this.startDate.month())) {
  6115. month = this.startDate.month();
  6116. year = this.startDate.year();
  6117. }
  6118. }
  6119. if (this.minDate) {
  6120. if (year < this.minDate.year() || (year == this.minDate.year() && month < this.minDate.month())) {
  6121. month = this.minDate.month();
  6122. year = this.minDate.year();
  6123. }
  6124. }
  6125. if (this.maxDate) {
  6126. if (year > this.maxDate.year() || (year == this.maxDate.year() && month > this.maxDate.month())) {
  6127. month = this.maxDate.month();
  6128. year = this.maxDate.year();
  6129. }
  6130. }
  6131. if (isLeft) {
  6132. this.leftCalendar.month.month(month).year(year);
  6133. if (this.linkedCalendars)
  6134. this.rightCalendar.month = this.leftCalendar.month.clone().add(1, 'month');
  6135. } else {
  6136. this.rightCalendar.month.month(month).year(year);
  6137. if (this.linkedCalendars)
  6138. this.leftCalendar.month = this.rightCalendar.month.clone().subtract(1, 'month');
  6139. }
  6140. this.updateCalendars();
  6141. },
  6142. timeChanged: function(e) {
  6143. var cal = $(e.target).closest('.calendar'),
  6144. isLeft = cal.hasClass('left');
  6145. var hour = parseInt(cal.find('.hourselect').val(), 10);
  6146. var minute = parseInt(cal.find('.minuteselect').val(), 10);
  6147. var second = this.timePickerSeconds ? parseInt(cal.find('.secondselect').val(), 10) : 0;
  6148. if (!this.timePicker24Hour) {
  6149. var ampm = cal.find('.ampmselect').val();
  6150. if (ampm === 'PM' && hour < 12)
  6151. hour += 12;
  6152. if (ampm === 'AM' && hour === 12)
  6153. hour = 0;
  6154. }
  6155. if (isLeft) {
  6156. var start = this.startDate.clone();
  6157. start.hour(hour);
  6158. start.minute(minute);
  6159. start.second(second);
  6160. this.setStartDate(start);
  6161. if (this.singleDatePicker) {
  6162. this.endDate = this.startDate.clone();
  6163. } else if (this.endDate && this.endDate.format('YYYY-MM-DD') == start.format('YYYY-MM-DD') && this.endDate.isBefore(start)) {
  6164. this.setEndDate(start.clone());
  6165. }
  6166. } else if (this.endDate) {
  6167. var end = this.endDate.clone();
  6168. end.hour(hour);
  6169. end.minute(minute);
  6170. end.second(second);
  6171. this.setEndDate(end);
  6172. }
  6173. //update the calendars so all clickable dates reflect the new time component
  6174. this.updateCalendars();
  6175. //update the form inputs above the calendars with the new time
  6176. this.updateFormInputs();
  6177. //re-render the time pickers because changing one selection can affect what's enabled in another
  6178. this.renderTimePicker('left');
  6179. this.renderTimePicker('right');
  6180. },
  6181. formInputsChanged: function(e) {
  6182. var isRight = $(e.target).closest('.calendar').hasClass('right');
  6183. var start = moment(this.container.find('input[name="daterangepicker_start"]').val(), this.locale.format);
  6184. var end = moment(this.container.find('input[name="daterangepicker_end"]').val(), this.locale.format);
  6185. if (start.isValid() && end.isValid()) {
  6186. if (isRight && end.isBefore(start))
  6187. start = end.clone();
  6188. this.setStartDate(start);
  6189. this.setEndDate(end);
  6190. if (isRight) {
  6191. this.container.find('input[name="daterangepicker_start"]').val(this.startDate.format(this.locale.format));
  6192. } else {
  6193. this.container.find('input[name="daterangepicker_end"]').val(this.endDate.format(this.locale.format));
  6194. }
  6195. }
  6196. this.updateView();
  6197. },
  6198. formInputsFocused: function(e) {
  6199. // Highlight the focused input
  6200. this.container.find('input[name="daterangepicker_start"], input[name="daterangepicker_end"]').removeClass('active');
  6201. $(e.target).addClass('active');
  6202. // Set the state such that if the user goes back to using a mouse,
  6203. // the calendars are aware we're selecting the end of the range, not
  6204. // the start. This allows someone to edit the end of a date range without
  6205. // re-selecting the beginning, by clicking on the end date input then
  6206. // using the calendar.
  6207. var isRight = $(e.target).closest('.calendar').hasClass('right');
  6208. if (isRight) {
  6209. this.endDate = null;
  6210. this.setStartDate(this.startDate.clone());
  6211. this.updateView();
  6212. }
  6213. },
  6214. formInputsBlurred: function(e) {
  6215. // this function has one purpose right now: if you tab from the first
  6216. // text input to the second in the UI, the endDate is nulled so that
  6217. // you can click another, but if you tab out without clicking anything
  6218. // or changing the input value, the old endDate should be retained
  6219. if (!this.endDate) {
  6220. var val = this.container.find('input[name="daterangepicker_end"]').val();
  6221. var end = moment(val, this.locale.format);
  6222. if (end.isValid()) {
  6223. this.setEndDate(end);
  6224. this.updateView();
  6225. }
  6226. }
  6227. },
  6228. formInputsKeydown: function(e) {
  6229. // This function ensures that if the 'enter' key was pressed in the input, then the calendars
  6230. // are updated with the startDate and endDate.
  6231. // This behaviour is automatic in Chrome/Firefox/Edge but not in IE 11 hence why this exists.
  6232. // Other browsers and versions of IE are untested and the behaviour is unknown.
  6233. if (e.keyCode === 13) {
  6234. // Prevent the calendar from being updated twice on Chrome/Firefox/Edge
  6235. e.preventDefault();
  6236. this.formInputsChanged(e);
  6237. }
  6238. },
  6239. elementChanged: function() {
  6240. if (!this.element.is('input')) return;
  6241. if (!this.element.val().length) return;
  6242. var dateString = this.element.val().split(this.locale.separator),
  6243. start = null,
  6244. end = null;
  6245. if (dateString.length === 2) {
  6246. start = moment(dateString[0], this.locale.format);
  6247. end = moment(dateString[1], this.locale.format);
  6248. }
  6249. if (this.singleDatePicker || start === null || end === null) {
  6250. start = moment(this.element.val(), this.locale.format);
  6251. end = start;
  6252. }
  6253. if (!start.isValid() || !end.isValid()) return;
  6254. this.setStartDate(start);
  6255. this.setEndDate(end);
  6256. this.updateView();
  6257. },
  6258. keydown: function(e) {
  6259. //hide on tab or enter
  6260. if ((e.keyCode === 9) || (e.keyCode === 13)) {
  6261. this.hide();
  6262. }
  6263. //hide on esc and prevent propagation
  6264. if (e.keyCode === 27) {
  6265. e.preventDefault();
  6266. e.stopPropagation();
  6267. this.hide();
  6268. }
  6269. },
  6270. updateElement: function() {
  6271. if (this.element.is('input') && !this.singleDatePicker && this.autoUpdateInput) {
  6272. this.element.val(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
  6273. this.element.trigger('change');
  6274. } else if (this.element.is('input') && this.autoUpdateInput) {
  6275. this.element.val(this.startDate.format(this.locale.format));
  6276. this.element.trigger('change');
  6277. }
  6278. },
  6279. remove: function() {
  6280. this.container.remove();
  6281. this.element.off('.daterangepicker');
  6282. this.element.removeData();
  6283. }
  6284. };
  6285. $.fn.daterangepicker = function(options, callback) {
  6286. var implementOptions = $.extend(true, {}, $.fn.daterangepicker.defaultOptions, options);
  6287. this.each(function() {
  6288. var el = $(this);
  6289. if (el.data('daterangepicker'))
  6290. el.data('daterangepicker').remove();
  6291. el.data('daterangepicker', new DateRangePicker(el, implementOptions, callback));
  6292. });
  6293. return this;
  6294. };
  6295. return DateRangePicker;
  6296. }));
  6297. /**
  6298. * @author: pppscn <35696959@qq.com>
  6299. * @version: v0.0.1
  6300. *
  6301. * @update 2017-05-07 <http://git.oschina.net/pp/fastadmin>
  6302. * @update 2017-09-17 <http://git.oschina.net/karson/fastadmin>
  6303. */
  6304. !function ($) {
  6305. 'use strict';
  6306. var ColumnsForSearch = [];
  6307. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  6308. var initCommonSearch = function (pColumns, that) {
  6309. var vFormCommon = createFormCommon(pColumns, that);
  6310. var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden");
  6311. vModal += vFormCommon.join('');
  6312. vModal += "</div>";
  6313. that.$container.prepend($(vModal));
  6314. that.$commonsearch = $(".commonsearch-table", that.$container);
  6315. var form = $("form.form-commonsearch", that.$commonsearch);
  6316. //绑定日期时间元素事件
  6317. if ($(".datetimepicker", form).size() > 0) {
  6318. require(['bootstrap-datetimepicker'], function () {
  6319. $('.datetimepicker', form).parent().css('position', 'relative');
  6320. $('.datetimepicker', form).datetimepicker({
  6321. //format: 'YYYY-MM-DD',
  6322. icons: {
  6323. time: 'fa fa-clock-o',
  6324. date: 'fa fa-calendar',
  6325. up: 'fa fa-chevron-up',
  6326. down: 'fa fa-chevron-down',
  6327. previous: 'fa fa-chevron-left',
  6328. next: 'fa fa-chevron-right',
  6329. today: 'fa fa-history',
  6330. clear: 'fa fa-trash',
  6331. close: 'fa fa-remove'
  6332. },
  6333. showTodayButton: true,
  6334. showClose: true
  6335. });
  6336. });
  6337. }
  6338. if ($(".datetimerange", form).size() > 0) {
  6339. var ranges = {};
  6340. ranges[__('Today')] = [Moment().startOf('day'), Moment().endOf('day')];
  6341. ranges[__('Yesterday')] = [Moment().subtract(1, 'days').startOf('day'), Moment().subtract(1, 'days').endOf('day')];
  6342. ranges[__('Last 7 Days')] = [Moment().subtract(6, 'days').startOf('day'), Moment().endOf('day')];
  6343. ranges[__('Last 30 Days')] = [Moment().subtract(29, 'days').startOf('day'), Moment().endOf('day')];
  6344. ranges[__('This Month')] = [Moment().startOf('month'), Moment().endOf('month')];
  6345. ranges[__('Last Month')] = [Moment().subtract(1, 'month').startOf('month'), Moment().subtract(1, 'month').endOf('month')];
  6346. var options = {
  6347. timePicker: false,
  6348. autoUpdateInput: false,
  6349. timePickerSeconds: true,
  6350. timePicker24Hour: true,
  6351. autoApply: true,
  6352. locale: {
  6353. format: 'YYYY-MM-DD HH:mm:ss',
  6354. customRangeLabel: __("Custom Range"),
  6355. applyLabel: __("Apply"),
  6356. cancelLabel: __("Clear"),
  6357. },
  6358. ranges: ranges,
  6359. };
  6360. var callback = function (start, end) {
  6361. $(this.element).val(start.format(options.locale.format) + " - " + end.format(options.locale.format));
  6362. };
  6363. var column, index;
  6364. require(['bootstrap-daterangepicker'], function () {
  6365. $(".datetimerange", form).each(function () {
  6366. $(this).on('apply.daterangepicker', function (ev, picker) {
  6367. callback.call(picker, picker.startDate, picker.endDate);
  6368. });
  6369. $(this).on('cancel.daterangepicker', function (ev, picker) {
  6370. $(this).val('');
  6371. });
  6372. index = $(this).data("index");
  6373. column = pColumns[index];
  6374. $(this).daterangepicker($.extend({}, options, column.options || {}), callback);
  6375. });
  6376. });
  6377. }
  6378. // 表单提交
  6379. form.on("submit", function (event) {
  6380. event.preventDefault();
  6381. that.onCommonSearch();
  6382. return false;
  6383. });
  6384. // 重置搜索
  6385. form.on("click", "button[type=reset]", function (event) {
  6386. form[0].reset();
  6387. that.onCommonSearch();
  6388. });
  6389. };
  6390. var createFormCommon = function (pColumns, that) {
  6391. var htmlForm = [];
  6392. var opList = ['=', '>', '>=', '<', '<=', '!=', 'FIND_IN_SET', 'LIKE', 'LIKE %...%', 'NOT LIKE', 'IN', 'NOT IN', 'IN(...)', 'NOT IN(...)', 'BETWEEN', 'NOT BETWEEN', 'RANGE', 'NOT RANGE', 'IS NULL', 'IS NOT NULL'];
  6393. htmlForm.push(sprintf('<form class="form-horizontal form-commonsearch" action="%s" >', that.options.actionForm));
  6394. htmlForm.push('<fieldset>');
  6395. if (that.options.titleForm.length > 0)
  6396. htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
  6397. htmlForm.push('<div class="row">');
  6398. for (var i in pColumns) {
  6399. var vObjCol = pColumns[i];
  6400. if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
  6401. var query = Backend.api.query(vObjCol.field);
  6402. query = query ? query : '';
  6403. vObjCol.defaultValue = that.options.renderDefault && query != '' ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue);
  6404. ColumnsForSearch.push(vObjCol);
  6405. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  6406. htmlForm.push(sprintf('<label for="%s" class="control-label col-xs-4">%s</label>', vObjCol.field, vObjCol.title));
  6407. htmlForm.push('<div class="col-xs-8">');
  6408. vObjCol.operate = (typeof vObjCol.operate === 'undefined' || $.inArray(vObjCol.operate.toUpperCase(), opList) === -1) ? '=' : vObjCol.operate.toUpperCase();
  6409. htmlForm.push(sprintf('<input type="hidden" class="form-control operate" name="field-%s" data-name="%s" value="%s" readonly>', vObjCol.field, vObjCol.field, vObjCol.operate));
  6410. var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style);
  6411. if (vObjCol.searchList) {
  6412. if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') {
  6413. htmlForm.push(sprintf('<select class="form-control" name="%s" %s>%s</select>', vObjCol.field, style, sprintf('<option value="">%s</option>', that.options.formatCommonChoose())));
  6414. (function (vObjCol, that) {
  6415. $.when(vObjCol.searchList).done(function (ret) {
  6416. var isArray = false;
  6417. if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) {
  6418. var resultlist = {};
  6419. $.each(ret.data.searchlist, function (key, value) {
  6420. resultlist[value.id] = value.name;
  6421. });
  6422. } else if (ret.constructor === Array || ret.constructor === Object) {
  6423. var resultlist = ret;
  6424. isArray = ret.constructor === Array ? true : isArray;
  6425. }
  6426. var optionList = [];
  6427. $.each(resultlist, function (key, value) {
  6428. var isSelect = (isArray ? value : key) == vObjCol.defaultValue ? 'selected' : '';
  6429. optionList.push(sprintf("<option value='" + (isArray ? value : key) + "' %s>" + value + "</option>", isSelect));
  6430. });
  6431. $("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).append(optionList.join(''));
  6432. });
  6433. })(vObjCol, that);
  6434. } else if (typeof vObjCol.searchList == 'function') {
  6435. htmlForm.push(vObjCol.searchList.call(this, vObjCol));
  6436. } else {
  6437. var isArray = vObjCol.searchList.constructor === Array;
  6438. var searchList = [];
  6439. searchList.push(sprintf('<option value="">%s</option>', that.options.formatCommonChoose()));
  6440. $.each(vObjCol.searchList, function (key, value) {
  6441. var isSelect = (isArray ? value : key) == vObjCol.defaultValue ? 'selected' : '';
  6442. searchList.push(sprintf("<option value='" + (isArray ? value : key) + "' %s>" + value + "</option>", isSelect));
  6443. });
  6444. htmlForm.push(sprintf('<select class="form-control" name="%s" %s>%s</select>', vObjCol.field, style, searchList.join('')));
  6445. }
  6446. } else {
  6447. var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder;
  6448. var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type;
  6449. var addclass = typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass;
  6450. var data = typeof vObjCol.data === 'undefined' ? '' : vObjCol.data;
  6451. var defaultValue = typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue;
  6452. if (/BETWEEN$/.test(vObjCol.operate)) {
  6453. var defaultValueArr = defaultValue.toString().match(/\|/) ? defaultValue.split('|') : ['', ''];
  6454. var placeholderArr = placeholder.toString().match(/\|/) ? placeholder.split('|') : [placeholder, placeholder];
  6455. htmlForm.push('<div class="row row-between">');
  6456. htmlForm.push(sprintf('<div class="col-xs-6 11"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s></div>', type, addclass, vObjCol.field, defaultValueArr[0], placeholderArr[0], vObjCol.field, i, style, data));
  6457. htmlForm.push(sprintf('<div class="col-xs-6 22"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s></div>', type, addclass, vObjCol.field, defaultValueArr[1], placeholderArr[1], vObjCol.field, i, style, data));
  6458. htmlForm.push('</div>');
  6459. } else {
  6460. htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s>', type, addclass, vObjCol.field, defaultValue, placeholder, vObjCol.field, i, style, data));
  6461. }
  6462. }
  6463. htmlForm.push('</div>');
  6464. htmlForm.push('</div>');
  6465. }
  6466. }
  6467. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  6468. htmlForm.push(createFormBtn(that).join(''));
  6469. htmlForm.push('</div>');
  6470. htmlForm.push('</div>');
  6471. htmlForm.push('</fieldset>');
  6472. htmlForm.push('</form>');
  6473. return htmlForm;
  6474. };
  6475. var createFormBtn = function (that) {
  6476. var htmlBtn = [];
  6477. var searchSubmit = that.options.formatCommonSubmitButton();
  6478. var searchReset = that.options.formatCommonResetButton();
  6479. htmlBtn.push('<div class="col-sm-8 col-xs-offset-4">');
  6480. htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" >%s</button> ', searchSubmit));
  6481. htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
  6482. htmlBtn.push('</div>');
  6483. return htmlBtn;
  6484. };
  6485. var isSearchAvailble = function (that) {
  6486. //只支持服务端搜索
  6487. if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) {
  6488. return false;
  6489. }
  6490. return true;
  6491. };
  6492. var getSearchQuery = function (that, removeempty) {
  6493. var op = {};
  6494. var filter = {};
  6495. var value = '';
  6496. $("form.form-commonsearch input.operate", that.$commonsearch).each(function (i) {
  6497. var name = $(this).data("name");
  6498. var sym = $(this).val().toUpperCase();
  6499. var obj = $("[name='" + name + "']", that.$commonsearch);
  6500. if (obj.size() == 0)
  6501. return true;
  6502. var vObjCol = ColumnsForSearch[i];
  6503. if (obj.size() > 1) {
  6504. if (/BETWEEN$/.test(sym)) {
  6505. var value_begin = $.trim($("[name='" + name + "']:first", that.$commonsearch).val()), value_end = $.trim($("[name='" + name + "']:last", that.$commonsearch).val());
  6506. if (value_begin.length || value_end.length) {
  6507. if (typeof vObjCol.process === 'function') {
  6508. value_begin = vObjCol.process(value_begin, 'begin');
  6509. value_end = vObjCol.process(value_end, 'end');
  6510. }
  6511. value = value_begin + ',' + value_end;
  6512. } else {
  6513. value = '';
  6514. }
  6515. //如果是时间筛选,将operate置为RANGE
  6516. if ($("[name='" + name + "']:first", that.$commonsearch).hasClass("datetimepicker")) {
  6517. sym = 'RANGE';
  6518. }
  6519. } else {
  6520. value = $("[name='" + name + "']:checked", that.$commonsearch).val();
  6521. }
  6522. } else {
  6523. value = (vObjCol && typeof vObjCol.process === 'function') ? vObjCol.process(obj.val()) : (sym == 'LIKE %...%' ? obj.val().replace(/\*/g, '%') : obj.val());
  6524. }
  6525. if (removeempty && value == '' && sym.indexOf("NULL") == -1) {
  6526. return true;
  6527. }
  6528. op[name] = sym;
  6529. filter[name] = value;
  6530. });
  6531. return {op: op, filter: filter};
  6532. };
  6533. var getQueryParams = function (params, searchQuery, removeempty) {
  6534. params.filter = typeof params.filter === 'Object' ? params.filter : (params.filter ? JSON.parse(params.filter) : {});
  6535. params.op = typeof params.op === 'Object' ? params.op : (params.op ? JSON.parse(params.op) : {});
  6536. params.filter = $.extend({}, params.filter, searchQuery.filter);
  6537. params.op = $.extend({}, params.op, searchQuery.op);
  6538. //移除empty的值
  6539. if (removeempty) {
  6540. $.each(params.filter, function (i, j) {
  6541. if (j === '') {
  6542. delete params.filter[i];
  6543. delete params.op[i];
  6544. }
  6545. });
  6546. }
  6547. params.filter = JSON.stringify(params.filter);
  6548. params.op = JSON.stringify(params.op);
  6549. return params;
  6550. };
  6551. $.extend($.fn.bootstrapTable.defaults, {
  6552. commonSearch: false,
  6553. titleForm: "Common search",
  6554. actionForm: "",
  6555. searchFormVisible: true,
  6556. searchClass: 'searchit',
  6557. renderDefault: true,
  6558. onCommonSearch: function (field, text) {
  6559. return false;
  6560. },
  6561. onPostCommonSearch: function (table) {
  6562. return false;
  6563. }
  6564. });
  6565. $.extend($.fn.bootstrapTable.defaults.icons, {
  6566. commonSearchIcon: 'glyphicon-search'
  6567. });
  6568. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  6569. 'common-search.bs.table': 'onCommonSearch',
  6570. 'post-common-search.bs.table': 'onPostCommonSearch'
  6571. });
  6572. $.extend($.fn.bootstrapTable.locales[$.fn.bootstrapTable.defaults.locale], {
  6573. formatCommonSearch: function () {
  6574. return "Common search";
  6575. },
  6576. formatCommonSubmitButton: function () {
  6577. return "Submit";
  6578. },
  6579. formatCommonResetButton: function () {
  6580. return "Reset";
  6581. },
  6582. formatCommonCloseButton: function () {
  6583. return "Close";
  6584. },
  6585. formatCommonChoose: function () {
  6586. return "Choose";
  6587. }
  6588. });
  6589. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  6590. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  6591. _initHeader = BootstrapTable.prototype.initHeader,
  6592. _initToolbar = BootstrapTable.prototype.initToolbar,
  6593. _load = BootstrapTable.prototype.load,
  6594. _initSearch = BootstrapTable.prototype.initSearch;
  6595. BootstrapTable.prototype.initHeader = function () {
  6596. _initHeader.apply(this, Array.prototype.slice.apply(arguments));
  6597. this.$header.find('th[data-field]').each(function (i) {
  6598. var column = $(this).data();
  6599. if (typeof column['width'] !== 'undefined') {
  6600. $(this).css("min-width", column['width']);
  6601. }
  6602. });
  6603. };
  6604. BootstrapTable.prototype.initToolbar = function () {
  6605. _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
  6606. if (!isSearchAvailble(this)) {
  6607. return;
  6608. }
  6609. var that = this,
  6610. html = [];
  6611. html.push(sprintf('<div class="columns-%s pull-%s" style="margin-top:10px;margin-bottom:10px;">', this.options.buttonsAlign, this.options.buttonsAlign));
  6612. html.push(sprintf('<button class="btn btn-default%s' + '" type="button" name="commonSearch" title="%s">', that.options.iconSize === undefined ? '' : ' btn-' + that.options.iconSize, that.options.formatCommonSearch()));
  6613. html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.commonSearchIcon))
  6614. html.push('</button></div>');
  6615. if (that.$toolbar.find(".pull-right").size() > 0) {
  6616. $(html.join('')).insertBefore(that.$toolbar.find(".pull-right:first"));
  6617. } else {
  6618. that.$toolbar.append(html.join(''));
  6619. }
  6620. initCommonSearch(that.columns, that);
  6621. that.$toolbar.find('button[name="commonSearch"]')
  6622. .off('click').on('click', function () {
  6623. that.$commonsearch.toggleClass("hidden");
  6624. return;
  6625. });
  6626. that.$container.on("click", "." + that.options.searchClass, function () {
  6627. var obj = $("form [name='" + $(this).data("field") + "']", that.$commonsearch);
  6628. if (obj.size() > 0) {
  6629. obj.val($(this).data("value"));
  6630. $("form", that.$commonsearch).trigger("submit");
  6631. }
  6632. });
  6633. var queryParams = that.options.queryParams;
  6634. //匹配默认搜索值
  6635. this.options.queryParams = function (params) {
  6636. return queryParams(getQueryParams(params, getSearchQuery(this, true)));
  6637. };
  6638. this.trigger('post-common-search', that);
  6639. };
  6640. BootstrapTable.prototype.onCommonSearch = function () {
  6641. var searchQuery = getSearchQuery(this);
  6642. this.trigger('common-search', this, searchQuery);
  6643. this.options.pageNumber = 1;
  6644. this.refresh({});
  6645. };
  6646. BootstrapTable.prototype.load = function (data) {
  6647. _load.apply(this, Array.prototype.slice.apply(arguments));
  6648. if (!isSearchAvailble(this)) {
  6649. return;
  6650. }
  6651. };
  6652. BootstrapTable.prototype.initSearch = function () {
  6653. _initSearch.apply(this, Array.prototype.slice.apply(arguments));
  6654. if (!isSearchAvailble(this)) {
  6655. return;
  6656. }
  6657. var that = this;
  6658. var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
  6659. this.data = fp ? $.grep(this.data, function (item, i) {
  6660. for (var key in fp) {
  6661. var fval = fp[key].toLowerCase();
  6662. var value = item[key];
  6663. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
  6664. that.header.formatters[$.inArray(key, that.header.fields)],
  6665. [value, item, i], value);
  6666. if (!($.inArray(key, that.header.fields) !== -1 &&
  6667. (typeof value === 'string' || typeof value === 'number') &&
  6668. (value + '').toLowerCase().indexOf(fval) !== -1)) {
  6669. return false;
  6670. }
  6671. }
  6672. return true;
  6673. }) : this.data;
  6674. };
  6675. }(jQuery);
  6676. define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) {
  6677. return function () {
  6678. var ret, fn;
  6679. return ret || global.$.fn.bootstrapTable.defaults;
  6680. };
  6681. }(this)));
  6682. /*!art-template - Template Engine | http://aui.github.com/artTemplate/*/
  6683. !function(){function a(a){return a.replace(t,"").replace(u,",").replace(v,"").replace(w,"").replace(x,"").split(y)}function b(a){return"'"+a.replace(/('|\\)/g,"\\$1").replace(/\r/g,"\\r").replace(/\n/g,"\\n")+"'"}function c(c,d){function e(a){return m+=a.split(/\n/).length-1,k&&(a=a.replace(/\s+/g," ").replace(/<!--[\w\W]*?-->/g,"")),a&&(a=s[1]+b(a)+s[2]+"\n"),a}function f(b){var c=m;if(j?b=j(b,d):g&&(b=b.replace(/\n/g,function(){return m++,"$line="+m+";"})),0===b.indexOf("=")){var e=l&&!/^=[=#]/.test(b);if(b=b.replace(/^=[=#]?|[\s;]*$/g,""),e){var f=b.replace(/\s*\([^\)]+\)/,"");n[f]||/^(include|print)$/.test(f)||(b="$escape("+b+")")}else b="$string("+b+")";b=s[1]+b+s[2]}return g&&(b="$line="+c+";"+b),r(a(b),function(a){if(a&&!p[a]){var b;b="print"===a?u:"include"===a?v:n[a]?"$utils."+a:o[a]?"$helpers."+a:"$data."+a,w+=a+"="+b+",",p[a]=!0}}),b+"\n"}var g=d.debug,h=d.openTag,i=d.closeTag,j=d.parser,k=d.compress,l=d.escape,m=1,p={$data:1,$filename:1,$utils:1,$helpers:1,$out:1,$line:1},q="".trim,s=q?["$out='';","$out+=",";","$out"]:["$out=[];","$out.push(",");","$out.join('')"],t=q?"$out+=text;return $out;":"$out.push(text);",u="function(){var text=''.concat.apply('',arguments);"+t+"}",v="function(filename,data){data=data||$data;var text=$utils.$include(filename,data,$filename);"+t+"}",w="'use strict';var $utils=this,$helpers=$utils.$helpers,"+(g?"$line=0,":""),x=s[0],y="return new String("+s[3]+");";r(c.split(h),function(a){a=a.split(i);var b=a[0],c=a[1];1===a.length?x+=e(b):(x+=f(b),c&&(x+=e(c)))});var z=w+x+y;g&&(z="try{"+z+"}catch(e){throw {filename:$filename,name:'Render Error',message:e.message,line:$line,source:"+b(c)+".split(/\\n/)[$line-1].replace(/^\\s+/,'')};}");try{var A=new Function("$data","$filename",z);return A.prototype=n,A}catch(a){throw a.temp="function anonymous($data,$filename) {"+z+"}",a}}var d=function(a,b){return"string"==typeof b?q(b,{filename:a}):g(a,b)};d.version="3.0.0",d.config=function(a,b){e[a]=b};var e=d.defaults={openTag:"<%",closeTag:"%>",escape:!0,cache:!0,compress:!1,parser:null},f=d.cache={};d.render=function(a,b){return q(a)(b)};var g=d.renderFile=function(a,b){var c=d.get(a)||p({filename:a,name:"Render Error",message:"Template not found"});return b?c(b):c};d.get=function(a){var b;if(f[a])b=f[a];else if("object"==typeof document){var c=document.getElementById(a);if(c){var d=(c.value||c.innerHTML).replace(/^\s*|\s*$/g,"");b=q(d,{filename:a})}}return b};var h=function(a,b){return"string"!=typeof a&&(b=typeof a,"number"===b?a+="":a="function"===b?h(a.call(a)):""),a},i={"<":"&#60;",">":"&#62;",'"':"&#34;","'":"&#39;","&":"&#38;"},j=function(a){return i[a]},k=function(a){return h(a).replace(/&(?![\w#]+;)|[<>"']/g,j)},l=Array.isArray||function(a){return"[object Array]"==={}.toString.call(a)},m=function(a,b){var c,d;if(l(a))for(c=0,d=a.length;c<d;c++)b.call(a,a[c],c,a);else for(c in a)b.call(a,a[c],c)},n=d.utils={$helpers:{},$include:g,$string:h,$escape:k,$each:m};d.helper=function(a,b){o[a]=b};var o=d.helpers=n.$helpers;d.onerror=function(a){var b="Template Error\n\n";for(var c in a)b+="<"+c+">\n"+a[c]+"\n\n";"object"==typeof console&&console.error(b)};var p=function(a){return d.onerror(a),function(){return"{Template Error}"}},q=d.compile=function(a,b){function d(c){try{return new i(c,h)+""}catch(d){return b.debug?p(d)():(b.debug=!0,q(a,b)(c))}}b=b||{};for(var g in e)void 0===b[g]&&(b[g]=e[g]);var h=b.filename;try{var i=c(a,b)}catch(a){return a.filename=h||"anonymous",a.name="Syntax Error",p(a)}return d.prototype=i.prototype,d.toString=function(){return i.toString()},h&&b.cache&&(f[h]=d),d},r=n.$each,s="break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,undefined",t=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g,u=/[^\w$]+/g,v=new RegExp(["\\b"+s.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),w=/^\d[^,]*|,\d[^,]*/g,x=/^,+|,+$/g,y=/^$|,+/;"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define?define('template',[],function(){return d}):this.template=d}();
  6684. /**
  6685. * 将BootstrapTable的行使用自定义的模板来渲染
  6686. *
  6687. * @author: karson
  6688. * @version: v0.0.1
  6689. *
  6690. * @update 2017-06-24 <http://github.com/karsonzhang/fastadmin>
  6691. */
  6692. !function ($) {
  6693. 'use strict';
  6694. $.extend($.fn.bootstrapTable.defaults, {
  6695. //是否启用模板渲染
  6696. templateView: false,
  6697. //数据格式化的模板ID或格式函数
  6698. templateFormatter: "itemtpl",
  6699. //添加的父类的class
  6700. templateParentClass: "row row-flex",
  6701. //向table添加的class
  6702. templateTableClass: "table-template",
  6703. });
  6704. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  6705. _initContainer = BootstrapTable.prototype.initContainer,
  6706. _initBody = BootstrapTable.prototype.initBody,
  6707. _initRow = BootstrapTable.prototype.initRow;
  6708. BootstrapTable.prototype.initContainer = function () {
  6709. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  6710. var that = this;
  6711. if (!that.options.templateView) {
  6712. return;
  6713. }
  6714. that.options.cardView = true;
  6715. };
  6716. BootstrapTable.prototype.initBody = function () {
  6717. var that = this;
  6718. $.extend(that.options, {
  6719. showHeader: !that.options.templateView ? $.fn.bootstrapTable.defaults.showHeader : false,
  6720. showFooter: !that.options.templateView ? $.fn.bootstrapTable.defaults.showFooter : false,
  6721. });
  6722. $(that.$el).toggleClass(that.options.templateTableClass, that.options.templateView);
  6723. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  6724. if (!that.options.templateView) {
  6725. return;
  6726. } else {
  6727. //由于Bootstrap是基于Table的,添加一个父类容器
  6728. $("> *:not(.no-records-found)", that.$body).wrapAll($("<div />").addClass(that.options.templateParentClass));
  6729. }
  6730. };
  6731. BootstrapTable.prototype.initRow = function (item, i, data, parentDom) {
  6732. var that = this;
  6733. //如果未启用则使用原生的initRow方法
  6734. if (!that.options.templateView) {
  6735. return _initRow.apply(that, Array.prototype.slice.apply(arguments));
  6736. }
  6737. var $content = '';
  6738. if (typeof that.options.templateFormatter === 'function') {
  6739. $content = that.options.templateFormatter.call(that, item, i, data);
  6740. } else {
  6741. var Template = require('template');
  6742. $content = Template(that.options.templateFormatter, {item: item, i: i, data: data});
  6743. }
  6744. return $content;
  6745. };
  6746. }(jQuery);
  6747. define("bootstrap-table-template", ["bootstrap-table","template"], (function (global) {
  6748. return function () {
  6749. var ret, fn;
  6750. return ret || global.$.fn.bootstrapTable.defaults;
  6751. };
  6752. }(this)));
  6753. define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-export', 'bootstrap-table-commonsearch', 'bootstrap-table-template'], function ($, undefined, Moment) {
  6754. var Table = {
  6755. list: {},
  6756. // Bootstrap-table 基础配置
  6757. defaults: {
  6758. url: '',
  6759. sidePagination: 'server',
  6760. method: 'get', //请求方法
  6761. toolbar: ".toolbar", //工具栏
  6762. search: true, //是否启用快速搜索
  6763. cache: false,
  6764. commonSearch: true, //是否启用通用搜索
  6765. searchFormVisible: false, //是否始终显示搜索表单
  6766. titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
  6767. idTable: 'commonTable',
  6768. showExport: true,
  6769. exportDataType: "all",
  6770. exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
  6771. pageSize: 10,
  6772. pageList: [10, 25, 50, 'All'],
  6773. pagination: true,
  6774. clickToSelect: true, //是否启用点击选中
  6775. singleSelect: false, //是否启用单选
  6776. showRefresh: false,
  6777. locale: 'zh-CN',
  6778. showToggle: true,
  6779. showColumns: true,
  6780. pk: 'id',
  6781. sortName: 'id',
  6782. sortOrder: 'desc',
  6783. paginationFirstText: __("First"),
  6784. paginationPreText: __("Previous"),
  6785. paginationNextText: __("Next"),
  6786. paginationLastText: __("Last"),
  6787. cardView: false, //卡片视图
  6788. checkOnInit: true, //是否在初始化时判断
  6789. escape: true, //是否对内容进行转义
  6790. extend: {
  6791. index_url: '',
  6792. add_url: '',
  6793. edit_url: '',
  6794. del_url: '',
  6795. import_url: '',
  6796. multi_url: '',
  6797. dragsort_url: 'ajax/weigh',
  6798. }
  6799. },
  6800. // Bootstrap-table 列配置
  6801. columnDefaults: {
  6802. align: 'center',
  6803. valign: 'middle',
  6804. },
  6805. config: {
  6806. firsttd: 'tbody tr td:first-child:not(:has(div.card-views))',
  6807. toolbar: '.toolbar',
  6808. refreshbtn: '.btn-refresh',
  6809. addbtn: '.btn-add',
  6810. editbtn: '.btn-edit',
  6811. delbtn: '.btn-del',
  6812. importbtn: '.btn-import',
  6813. multibtn: '.btn-multi',
  6814. disabledbtn: '.btn-disabled',
  6815. editonebtn: '.btn-editone',
  6816. dragsortfield: 'weigh',
  6817. },
  6818. api: {
  6819. init: function (defaults, columnDefaults, locales) {
  6820. defaults = defaults ? defaults : {};
  6821. columnDefaults = columnDefaults ? columnDefaults : {};
  6822. locales = locales ? locales : {};
  6823. // 如果是iOS设备则启用卡片视图
  6824. if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
  6825. Table.defaults.cardView = true;
  6826. }
  6827. // 写入bootstrap-table默认配置
  6828. $.extend(true, $.fn.bootstrapTable.defaults, Table.defaults, defaults);
  6829. // 写入bootstrap-table column配置
  6830. $.extend($.fn.bootstrapTable.columnDefaults, Table.columnDefaults, columnDefaults);
  6831. // 写入bootstrap-table locale配置
  6832. $.extend($.fn.bootstrapTable.locales[Table.defaults.locale], {
  6833. formatCommonSearch: function () {
  6834. return __('Common search');
  6835. },
  6836. formatCommonSubmitButton: function () {
  6837. return __('Submit');
  6838. },
  6839. formatCommonResetButton: function () {
  6840. return __('Reset');
  6841. },
  6842. formatCommonCloseButton: function () {
  6843. return __('Close');
  6844. },
  6845. formatCommonChoose: function () {
  6846. return __('Choose');
  6847. }
  6848. }, locales);
  6849. },
  6850. // 绑定事件
  6851. bindevent: function (table) {
  6852. //Bootstrap-table的父元素,包含table,toolbar,pagnation
  6853. var parenttable = table.closest('.bootstrap-table');
  6854. //Bootstrap-table配置
  6855. var options = table.bootstrapTable('getOptions');
  6856. //Bootstrap操作区
  6857. var toolbar = $(options.toolbar, parenttable);
  6858. //当刷新表格时
  6859. table.on('load-error.bs.table', function (status, res, e) {
  6860. if (e.status === 0) {
  6861. return;
  6862. }
  6863. Toastr.error(__('Unknown data format'));
  6864. });
  6865. //当刷新表格时
  6866. table.on('refresh.bs.table', function (e, settings, data) {
  6867. $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
  6868. });
  6869. //当双击单元格时
  6870. table.on('dbl-click-row.bs.table', function (e, row, element, field) {
  6871. $(Table.config.editonebtn, element).trigger("click");
  6872. });
  6873. //当内容渲染完成后
  6874. table.on('post-body.bs.table', function (e, settings, json, xhr) {
  6875. $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
  6876. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', true);
  6877. if ($(Table.config.firsttd, table).find("input[type='checkbox'][data-index]").size() > 0) {
  6878. // 挺拽选择,需要重新绑定事件
  6879. require(['drag', 'drop'], function () {
  6880. $(Table.config.firsttd, table).drag("start", function (ev, dd) {
  6881. return $('<div class="selection" />').css('opacity', .65).appendTo(document.body);
  6882. }).drag(function (ev, dd) {
  6883. $(dd.proxy).css({
  6884. top: Math.min(ev.pageY, dd.startY),
  6885. left: Math.min(ev.pageX, dd.startX),
  6886. height: Math.abs(ev.pageY - dd.startY),
  6887. width: Math.abs(ev.pageX - dd.startX)
  6888. });
  6889. }).drag("end", function (ev, dd) {
  6890. $(dd.proxy).remove();
  6891. });
  6892. $(Table.config.firsttd, table).drop("start", function () {
  6893. Table.api.toggleattr(this);
  6894. }).drop(function () {
  6895. Table.api.toggleattr(this);
  6896. }).drop("end", function () {
  6897. Table.api.toggleattr(this);
  6898. });
  6899. $.drop({
  6900. multi: true
  6901. });
  6902. });
  6903. }
  6904. });
  6905. // 处理选中筛选框后按钮的状态统一变更
  6906. table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () {
  6907. var ids = Table.api.selectedids(table);
  6908. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !ids.length);
  6909. });
  6910. // 刷新按钮事件
  6911. $(toolbar).on('click', Table.config.refreshbtn, function () {
  6912. table.bootstrapTable('refresh');
  6913. });
  6914. // 添加按钮事件
  6915. $(toolbar).on('click', Table.config.addbtn, function () {
  6916. var ids = Table.api.selectedids(table);
  6917. var url = options.extend.add_url;
  6918. if (url.indexOf("{ids}") !== -1) {
  6919. url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
  6920. }
  6921. Fast.api.open(url, __('Add'), $(this).data() || {});
  6922. });
  6923. // 导入按钮事件
  6924. if ($(Table.config.importbtn, toolbar).size() > 0) {
  6925. require(['upload'], function (Upload) {
  6926. Upload.api.plupload($(Table.config.importbtn, toolbar), function (data, ret) {
  6927. Fast.api.ajax({
  6928. url: options.extend.import_url,
  6929. data: {file: data.url},
  6930. }, function (data, ret) {
  6931. table.bootstrapTable('refresh');
  6932. });
  6933. });
  6934. });
  6935. }
  6936. // 批量编辑按钮事件
  6937. $(toolbar).on('click', Table.config.editbtn, function () {
  6938. var that = this;
  6939. //循环弹出多个编辑框
  6940. $.each(table.bootstrapTable('getSelections'), function (index, row) {
  6941. var url = options.extend.edit_url;
  6942. row = $.extend({}, row ? row : {}, {ids: row[options.pk]});
  6943. var url = Table.api.replaceurl(url, row, table);
  6944. Fast.api.open(url, __('Edit'), $(that).data() || {});
  6945. });
  6946. });
  6947. // 批量操作按钮事件
  6948. $(toolbar).on('click', Table.config.multibtn, function () {
  6949. var ids = Table.api.selectedids(table);
  6950. Table.api.multi($(this).data("action"), ids, table, this);
  6951. });
  6952. // 批量删除按钮事件
  6953. $(toolbar).on('click', Table.config.delbtn, function () {
  6954. var that = this;
  6955. var ids = Table.api.selectedids(table);
  6956. Layer.confirm(
  6957. __('Are you sure you want to delete the %s selected item?', ids.length),
  6958. {icon: 3, title: __('Warning'), offset: 0, shadeClose: true},
  6959. function (index) {
  6960. Table.api.multi("del", ids, table, that);
  6961. Layer.close(index);
  6962. }
  6963. );
  6964. });
  6965. // 拖拽排序
  6966. require(['dragsort'], function () {
  6967. //绑定拖动排序
  6968. $("tbody", table).dragsort({
  6969. itemSelector: 'tr:visible',
  6970. dragSelector: "a.btn-dragsort",
  6971. dragEnd: function (a, b) {
  6972. var element = $("a.btn-dragsort", this);
  6973. var data = table.bootstrapTable('getData');
  6974. var current = data[parseInt($(this).data("index"))];
  6975. var options = table.bootstrapTable('getOptions');
  6976. //改变的值和改变的ID集合
  6977. var ids = $.map($("tbody tr:visible", table), function (tr) {
  6978. return data[parseInt($(tr).data("index"))][options.pk];
  6979. });
  6980. var changeid = current[options.pk];
  6981. var pid = typeof current.pid != 'undefined' ? current.pid : '';
  6982. var params = {
  6983. url: table.bootstrapTable('getOptions').extend.dragsort_url,
  6984. data: {
  6985. ids: ids.join(','),
  6986. changeid: changeid,
  6987. pid: pid,
  6988. field: Table.config.dragsortfield,
  6989. orderway: options.sortOrder,
  6990. table: options.extend.table
  6991. }
  6992. };
  6993. Fast.api.ajax(params, function (data, ret) {
  6994. var success = $(element).data("success") || $.noop;
  6995. if (typeof success === 'function') {
  6996. if (false === success.call(element, data, ret)) {
  6997. return false;
  6998. }
  6999. }
  7000. table.bootstrapTable('refresh');
  7001. }, function () {
  7002. var error = $(element).data("error") || $.noop;
  7003. if (typeof error === 'function') {
  7004. if (false === error.call(element, data, ret)) {
  7005. return false;
  7006. }
  7007. }
  7008. table.bootstrapTable('refresh');
  7009. });
  7010. },
  7011. placeHolderTemplate: ""
  7012. });
  7013. });
  7014. $(table).on("click", "input[data-id][name='checkbox']", function (e) {
  7015. var ids = $(this).data("id");
  7016. var row = Table.api.getrowbyid(ids);
  7017. table.trigger('check.bs.table', [row, this]);
  7018. });
  7019. $(table).on("click", "[data-id].btn-change", function (e) {
  7020. e.preventDefault();
  7021. Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this);
  7022. });
  7023. $(table).on("click", "[data-id].btn-edit", function (e) {
  7024. e.preventDefault();
  7025. var ids = $(this).data("id");
  7026. var row = Table.api.getrowbyid(ids);
  7027. row.ids = ids;
  7028. var url = Table.api.replaceurl(options.extend.edit_url, row, table);
  7029. Fast.api.open(url, __('Edit'), $(this).data() || {});
  7030. });
  7031. $(table).on("click", "[data-id].btn-del", function (e) {
  7032. e.preventDefault();
  7033. var id = $(this).data("id");
  7034. var that = this;
  7035. Layer.confirm(
  7036. __('Are you sure you want to delete this item?'),
  7037. {icon: 3, title: __('Warning'), shadeClose: true},
  7038. function (index) {
  7039. Table.api.multi("del", id, table, that);
  7040. Layer.close(index);
  7041. }
  7042. );
  7043. });
  7044. var id = table.attr("id");
  7045. Table.list[id] = table;
  7046. return table;
  7047. },
  7048. // 批量操作请求
  7049. multi: function (action, ids, table, element) {
  7050. var options = table.bootstrapTable('getOptions');
  7051. var data = element ? $(element).data() : {};
  7052. var ids = ($.isArray(ids) ? ids.join(",") : ids);
  7053. var url = typeof data.url !== "undefined" ? data.url : (action == "del" ? options.extend.del_url : options.extend.multi_url);
  7054. url = this.replaceurl(url, {ids: ids}, table);
  7055. var params = typeof data.params !== "undefined" ? (typeof data.params == 'object' ? $.param(data.params) : data.params) : '';
  7056. var options = {url: url, data: {action: action, ids: ids, params: params}};
  7057. Fast.api.ajax(options, function (data, ret) {
  7058. var success = $(element).data("success") || $.noop;
  7059. if (typeof success === 'function') {
  7060. if (false === success.call(element, data, ret)) {
  7061. return false;
  7062. }
  7063. }
  7064. table.bootstrapTable('refresh');
  7065. }, function (data, ret) {
  7066. var error = $(element).data("error") || $.noop;
  7067. if (typeof error === 'function') {
  7068. if (false === error.call(element, data, ret)) {
  7069. return false;
  7070. }
  7071. }
  7072. });
  7073. },
  7074. // 单元格元素事件
  7075. events: {
  7076. operate: {
  7077. 'click .btn-editone': function (e, value, row, index) {
  7078. e.stopPropagation();
  7079. e.preventDefault();
  7080. var table = $(this).closest('table');
  7081. var options = table.bootstrapTable('getOptions');
  7082. var ids = row[options.pk];
  7083. row = $.extend({}, row ? row : {}, {ids: ids});
  7084. var url = options.extend.edit_url;
  7085. Fast.api.open(Table.api.replaceurl(url, row, table), __('Edit'), $(this).data() || {});
  7086. },
  7087. 'click .btn-delone': function (e, value, row, index) {
  7088. e.stopPropagation();
  7089. e.preventDefault();
  7090. var that = this;
  7091. var top = $(that).offset().top - $(window).scrollTop();
  7092. var left = $(that).offset().left - $(window).scrollLeft() - 260;
  7093. if (top + 154 > $(window).height()) {
  7094. top = top - 154;
  7095. }
  7096. if ($(window).width() < 480) {
  7097. top = left = undefined;
  7098. }
  7099. Layer.confirm(
  7100. __('Are you sure you want to delete this item?'),
  7101. {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true},
  7102. function (index) {
  7103. var table = $(that).closest('table');
  7104. var options = table.bootstrapTable('getOptions');
  7105. Table.api.multi("del", row[options.pk], table, that);
  7106. Layer.close(index);
  7107. }
  7108. );
  7109. }
  7110. }
  7111. },
  7112. // 单元格数据格式化
  7113. formatter: {
  7114. icon: function (value, row, index) {
  7115. if (!value)
  7116. return '';
  7117. value = value.indexOf(" ") > -1 ? value : "fa fa-" + value;
  7118. //渲染fontawesome图标
  7119. return '<i class="' + value + '"></i> ' + value;
  7120. },
  7121. image: function (value, row, index) {
  7122. value = value ? value : '/assets/img/blank.gif';
  7123. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  7124. return '<img class="' + classname + '" src="' + Fast.api.cdnurl(value) + '" />';
  7125. },
  7126. images: function (value, row, index) {
  7127. value = value === null ? '' : value.toString();
  7128. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  7129. var arr = value.split(',');
  7130. var html = [];
  7131. $.each(arr, function (i, value) {
  7132. value = value ? value : '/assets/img/blank.gif';
  7133. html.push('<img class="' + classname + '" src="' + Fast.api.cdnurl(value) + '" />');
  7134. });
  7135. return html.join(' ');
  7136. },
  7137. status: function (value, row, index) {
  7138. //颜色状态数组,可使用red/yellow/aqua/blue/navy/teal/olive/lime/fuchsia/purple/maroon
  7139. var colorArr = {normal: 'success', hidden: 'grey', deleted: 'danger', locked: 'info'};
  7140. //如果字段列有定义custom
  7141. if (typeof this.custom !== 'undefined') {
  7142. colorArr = $.extend(colorArr, this.custom);
  7143. }
  7144. value = value === null ? '' : value.toString();
  7145. var color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  7146. value = value.charAt(0).toUpperCase() + value.slice(1);
  7147. //渲染状态
  7148. var html = '<span class="text-' + color + '"><i class="fa fa-circle"></i> ' + __(value) + '</span>';
  7149. return html;
  7150. },
  7151. url: function (value, row, index) {
  7152. return '<div class="input-group input-group-sm" style="width:250px;"><input type="text" class="form-control input-sm" value="' + value + '"><span class="input-group-btn input-group-sm"><a href="' + value + '" target="_blank" class="btn btn-default btn-sm"><i class="fa fa-link"></i></a></span></div>';
  7153. },
  7154. search: function (value, row, index) {
  7155. return '<a href="javascript:;" class="searchit" data-field="' + this.field + '" data-value="' + value + '">' + value + '</a>';
  7156. },
  7157. addtabs: function (value, row, index) {
  7158. var url = Table.api.replaceurl(this.url, row, this.table);
  7159. var title = this.atitle ? this.atitle : __("Search %s", value);
  7160. return '<a href="' + Fast.api.fixurl(url) + '" class="addtabsit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  7161. },
  7162. dialog: function (value, row, index) {
  7163. var url = Table.api.replaceurl(this.url, row, this.table);
  7164. var title = this.atitle ? this.atitle : __("View %s", value);
  7165. return '<a href="' + Fast.api.fixurl(url) + '" class="dialogit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  7166. },
  7167. flag: function (value, row, index) {
  7168. value = value === null ? '' : value.toString();
  7169. var colorArr = {index: 'success', hot: 'warning', recommend: 'danger', 'new': 'info'};
  7170. //如果字段列有定义custom
  7171. if (typeof this.custom !== 'undefined') {
  7172. colorArr = $.extend(colorArr, this.custom);
  7173. }
  7174. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  7175. value = row[this.customField];
  7176. }
  7177. //渲染Flag
  7178. var html = [];
  7179. var arr = value.split(',');
  7180. $.each(arr, function (i, value) {
  7181. value = value === null ? '' : value.toString();
  7182. if (value == '')
  7183. return true;
  7184. var color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  7185. value = value.charAt(0).toUpperCase() + value.slice(1);
  7186. html.push('<span class="label label-' + color + '">' + __(value) + '</span>');
  7187. });
  7188. return html.join(' ');
  7189. },
  7190. label: function (value, row, index) {
  7191. return Table.api.formatter.flag.call(this, value, row, index);
  7192. },
  7193. datetime: function (value, row, index) {
  7194. return value ? Moment(parseInt(value) * 1000).format("YYYY-MM-DD HH:mm:ss") : __('None');
  7195. },
  7196. operate: function (value, row, index) {
  7197. var table = this.table;
  7198. // 操作配置
  7199. var options = table ? table.bootstrapTable('getOptions') : {};
  7200. // 默认按钮组
  7201. var buttons = $.extend([], this.buttons || []);
  7202. if (options.extend.dragsort_url !== '') {
  7203. buttons.push({
  7204. name: 'dragsort',
  7205. icon: 'fa fa-arrows',
  7206. title: __('Drag to sort'),
  7207. classname: 'btn btn-xs btn-primary btn-dragsort'
  7208. });
  7209. }
  7210. if (options.extend.edit_url !== '') {
  7211. buttons.push({
  7212. name: 'edit',
  7213. icon: 'fa fa-pencil',
  7214. title: __('Edit'),
  7215. classname: 'btn btn-xs btn-success btn-editone',
  7216. url: options.extend.edit_url
  7217. });
  7218. }
  7219. if (options.extend.del_url !== '') {
  7220. buttons.push({
  7221. name: 'del',
  7222. icon: 'fa fa-trash',
  7223. title: __('Del'),
  7224. classname: 'btn btn-xs btn-danger btn-delone'
  7225. });
  7226. }
  7227. return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
  7228. },
  7229. buttons: function (value, row, index) {
  7230. // 默认按钮组
  7231. var buttons = $.extend([], this.buttons || []);
  7232. return Table.api.buttonlink(this, buttons, value, row, index, 'buttons');
  7233. }
  7234. },
  7235. buttonlink: function (column, buttons, value, row, index, type) {
  7236. var table = column.table;
  7237. type = typeof type === 'undefined' ? 'buttons' : type;
  7238. var options = table ? table.bootstrapTable('getOptions') : {};
  7239. var html = [];
  7240. var hidden, url, classname, icon, text, title, refresh, confirm, extend;
  7241. var fieldIndex = column.fieldIndex;
  7242. $.each(buttons, function (i, j) {
  7243. if (type === 'operate') {
  7244. if (j.name === 'dragsort' && typeof row[Table.config.dragsortfield] === 'undefined') {
  7245. return true;
  7246. }
  7247. if (['add', 'edit', 'del', 'multi', 'dragsort'].indexOf(j.name) > -1 && !options.extend[j.name + "_url"]) {
  7248. return true;
  7249. }
  7250. }
  7251. var attr = table.data(type + "-" + j.name);
  7252. if (typeof attr === 'undefined' || attr) {
  7253. hidden = typeof j.hidden === 'function' ? j.hidden.call(table, row, j) : (j.hidden ? j.hidden : false);
  7254. if (hidden) {
  7255. return true;
  7256. }
  7257. url = j.url ? j.url : '';
  7258. url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
  7259. classname = j.classname ? j.classname : 'btn-primary btn-' + name + 'one';
  7260. icon = j.icon ? j.icon : '';
  7261. text = j.text ? j.text : '';
  7262. title = j.title ? j.title : text;
  7263. refresh = j.refresh ? 'data-refresh="' + j.refresh + '"' : '';
  7264. confirm = j.confirm ? 'data-confirm="' + j.confirm + '"' : '';
  7265. extend = j.extend ? j.extend : '';
  7266. html.push('<a href="' + url + '" class="' + classname + '" ' + (confirm ? confirm + ' ' : '') + (refresh ? refresh + ' ' : '') + extend + ' title="' + title + '" data-table-id="' + (table ? table.attr("id") : '') + '" data-field-index="' + fieldIndex + '" data-row-index="' + index + '" data-button-index="' + i + '"><i class="' + icon + '"></i>' + (text ? ' ' + text : '') + '</a>');
  7267. }
  7268. });
  7269. return html.join(' ');
  7270. },
  7271. //替换URL中的数据
  7272. replaceurl: function (url, row, table) {
  7273. var options = table ? table.bootstrapTable('getOptions') : null;
  7274. var ids = options ? row[options.pk] : 0;
  7275. row.ids = ids ? ids : (typeof row.ids !== 'undefined' ? row.ids : 0);
  7276. //自动添加ids参数
  7277. url = !url.match(/\{ids\}/i) ? url + (url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + '{ids}' : url;
  7278. url = url.replace(/\{(.*?)\}/gi, function (matched) {
  7279. matched = matched.substring(1, matched.length - 1);
  7280. if (matched.indexOf(".") !== -1) {
  7281. var temp = row;
  7282. var arr = matched.split(/\./);
  7283. for (var i = 0; i < arr.length; i++) {
  7284. if (typeof temp[arr[i]] !== 'undefined') {
  7285. temp = temp[arr[i]];
  7286. }
  7287. }
  7288. return typeof temp === 'object' ? '' : temp;
  7289. }
  7290. return row[matched];
  7291. });
  7292. return url;
  7293. },
  7294. // 获取选中的条目ID集合
  7295. selectedids: function (table) {
  7296. var options = table.bootstrapTable('getOptions');
  7297. if (options.templateView) {
  7298. return $.map($("input[data-id][name='checkbox']:checked"), function (dom) {
  7299. return $(dom).data("id");
  7300. });
  7301. } else {
  7302. return $.map(table.bootstrapTable('getSelections'), function (row) {
  7303. return row[options.pk];
  7304. });
  7305. }
  7306. },
  7307. // 切换复选框状态
  7308. toggleattr: function (table) {
  7309. $("input[type='checkbox']", table).trigger('click');
  7310. },
  7311. // 根据行索引获取行数据
  7312. getrowdata: function (table, index) {
  7313. index = parseInt(index);
  7314. var data = table.bootstrapTable('getData');
  7315. return typeof data[index] !== 'undefined' ? data[index] : null;
  7316. },
  7317. // 根据行索引获取行数据
  7318. getrowbyindex: function (table, index) {
  7319. return Table.api.getrowdata(table, index);
  7320. },
  7321. // 根据主键ID获取行数据
  7322. getrowbyid: function (table, id) {
  7323. var row = {};
  7324. var options = table.bootstrapTable("getOptions");
  7325. $.each(table.bootstrapTable('getData'), function (i, j) {
  7326. if (j[options.pk] == id) {
  7327. row = j;
  7328. return false;
  7329. }
  7330. });
  7331. return row;
  7332. }
  7333. },
  7334. };
  7335. return Table;
  7336. });
  7337. /**
  7338. * mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
  7339. * v1.5.2
  7340. *
  7341. * Copyright 2013, Moxiecode Systems AB
  7342. * Released under GPL License.
  7343. *
  7344. * License: http://www.plupload.com/license
  7345. * Contributing: http://www.plupload.com/contributing
  7346. *
  7347. * Date: 2016-11-23
  7348. */
  7349. !function(e,t){var i=function(){var e={};return t.apply(e,arguments),e.moxie};"function"==typeof define&&define.amd?define("moxie",[],i):"object"==typeof module&&module.exports?module.exports=i():e.moxie=i()}(this||window,function(){!function(e,t){"use strict";function i(e,t){for(var i,n=[],r=0;r<e.length;++r){if(i=s[e[r]]||o(e[r]),!i)throw"module definition dependecy not found: "+e[r];n.push(i)}t.apply(null,n)}function n(e,n,r){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(n===t)throw"invalid module definition, dependencies must be specified";if(r===t)throw"invalid module definition, definition function must be specified";i(n,function(){s[e]=r.apply(null,arguments)})}function r(e){return!!s[e]}function o(t){for(var i=e,n=t.split(/[.\/]/),r=0;r<n.length;++r){if(!i[n[r]])return;i=i[n[r]]}return i}function a(i){for(var n=0;n<i.length;n++){for(var r=e,o=i[n],a=o.split(/[.\/]/),u=0;u<a.length-1;++u)r[a[u]]===t&&(r[a[u]]={}),r=r[a[u]];r[a[a.length-1]]=s[o]}}var s={};n("moxie/core/utils/Basic",[],function(){function e(e){var t;return e===t?"undefined":null===e?"null":e.nodeType?"node":{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()}function t(){return a(!1,!1,arguments)}function i(){return a(!0,!1,arguments)}function n(){return a(!1,!0,arguments)}function r(){return a(!0,!0,arguments)}function o(i){switch(e(i)){case"array":return Array.prototype.slice.call(i);case"object":return t({},i)}return i}function a(t,i,n){var r,s=n[0];return u(n,function(n,c){c>0&&u(n,function(n,u){var c=-1!==m(e(n),["array","object"]);return n===r||t&&s[u]===r?!0:(c&&i&&(n=o(n)),e(s[u])===e(n)&&c?a(t,i,[s[u],n]):s[u]=n,void 0)})}),s}function s(e,t){function i(){this.constructor=e}for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n]);return i.prototype=t.prototype,e.prototype=new i,e.__parent__=t.prototype,e}function u(e,t){var i,n,r,o;if(e){try{i=e.length}catch(a){i=o}if(i===o||"number"!=typeof i){for(n in e)if(e.hasOwnProperty(n)&&t(e[n],n)===!1)return}else for(r=0;i>r;r++)if(t(e[r],r)===!1)return}}function c(t){var i;if(!t||"object"!==e(t))return!0;for(i in t)return!1;return!0}function l(t,i){function n(r){"function"===e(t[r])&&t[r](function(e){++r<o&&!e?n(r):i(e)})}var r=0,o=t.length;"function"!==e(i)&&(i=function(){}),t&&t.length||i(),n(r)}function d(e,t){var i=0,n=e.length,r=new Array(n);u(e,function(e,o){e(function(e){if(e)return t(e);var a=[].slice.call(arguments);a.shift(),r[o]=a,i++,i===n&&(r.unshift(null),t.apply(this,r))})})}function m(e,t){if(t){if(Array.prototype.indexOf)return Array.prototype.indexOf.call(t,e);for(var i=0,n=t.length;n>i;i++)if(t[i]===e)return i}return-1}function h(t,i){var n=[];"array"!==e(t)&&(t=[t]),"array"!==e(i)&&(i=[i]);for(var r in t)-1===m(t[r],i)&&n.push(t[r]);return n.length?n:!1}function f(e,t){var i=[];return u(e,function(e){-1!==m(e,t)&&i.push(e)}),i.length?i:null}function p(e){var t,i=[];for(t=0;t<e.length;t++)i[t]=e[t];return i}function g(e){return e?String.prototype.trim?String.prototype.trim.call(e):e.toString().replace(/^\s*/,"").replace(/\s*$/,""):e}function x(e){if("string"!=typeof e)return e;var t,i={t:1099511627776,g:1073741824,m:1048576,k:1024};return e=/^([0-9\.]+)([tmgk]?)$/.exec(e.toLowerCase().replace(/[^0-9\.tmkg]/g,"")),t=e[2],e=+e[1],i.hasOwnProperty(t)&&(e*=i[t]),Math.floor(e)}function v(t){var i=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=i.shift();return"undefined"!==e(t)?t:""})}function y(e,t){var i=this;setTimeout(function(){e.call(i)},t||1)}var w=function(){var e=0;return function(t){var i,n=(new Date).getTime().toString(32);for(i=0;5>i;i++)n+=Math.floor(65535*Math.random()).toString(32);return(t||"o_")+n+(e++).toString(32)}}();return{guid:w,typeOf:e,extend:t,extendIf:i,extendImmutable:n,extendImmutableIf:r,inherit:s,each:u,isEmptyObj:c,inSeries:l,inParallel:d,inArray:m,arrayDiff:h,arrayIntersect:f,toArray:p,trim:g,sprintf:v,parseSizeStr:x,delay:y}}),n("moxie/core/utils/Encode",[],function(){var e=function(e){return unescape(encodeURIComponent(e))},t=function(e){return decodeURIComponent(escape(e))},i=function(e,i){if("function"==typeof window.atob)return i?t(window.atob(e)):window.atob(e);var n,r,o,a,s,u,c,l,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,h=0,f="",p=[];if(!e)return e;e+="";do a=d.indexOf(e.charAt(m++)),s=d.indexOf(e.charAt(m++)),u=d.indexOf(e.charAt(m++)),c=d.indexOf(e.charAt(m++)),l=a<<18|s<<12|u<<6|c,n=255&l>>16,r=255&l>>8,o=255&l,p[h++]=64==u?String.fromCharCode(n):64==c?String.fromCharCode(n,r):String.fromCharCode(n,r,o);while(m<e.length);return f=p.join(""),i?t(f):f},n=function(t,i){if(i&&(t=e(t)),"function"==typeof window.btoa)return window.btoa(t);var n,r,o,a,s,u,c,l,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,h=0,f="",p=[];if(!t)return t;do n=t.charCodeAt(m++),r=t.charCodeAt(m++),o=t.charCodeAt(m++),l=n<<16|r<<8|o,a=63&l>>18,s=63&l>>12,u=63&l>>6,c=63&l,p[h++]=d.charAt(a)+d.charAt(s)+d.charAt(u)+d.charAt(c);while(m<t.length);f=p.join("");var g=t.length%3;return(g?f.slice(0,g-3):f)+"===".slice(g||3)};return{utf8_encode:e,utf8_decode:t,atob:i,btoa:n}}),n("moxie/core/utils/Env",["moxie/core/utils/Basic"],function(e){function t(e,t,i){var n=0,r=0,o=0,a={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},s=function(e){return e=(""+e).replace(/[_\-+]/g,"."),e=e.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),e.length?e.split("."):[-8]},u=function(e){return e?isNaN(e)?a[e]||-7:parseInt(e,10):0};for(e=s(e),t=s(t),r=Math.max(e.length,t.length),n=0;r>n;n++)if(e[n]!=t[n]){if(e[n]=u(e[n]),t[n]=u(t[n]),e[n]<t[n]){o=-1;break}if(e[n]>t[n]){o=1;break}}if(!i)return o;switch(i){case">":case"gt":return o>0;case">=":case"ge":return o>=0;case"<=":case"le":return 0>=o;case"==":case"=":case"eq":return 0===o;case"<>":case"!=":case"ne":return 0!==o;case"":case"<":case"lt":return 0>o;default:return null}}var i=function(e){var t="",i="?",n="function",r="undefined",o="object",a="name",s="version",u={has:function(e,t){return-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()}},c={rgx:function(){for(var t,i,a,s,u,c,l,d=0,m=arguments;d<m.length;d+=2){var h=m[d],f=m[d+1];if(typeof t===r){t={};for(s in f)u=f[s],typeof u===o?t[u[0]]=e:t[u]=e}for(i=a=0;i<h.length;i++)if(c=h[i].exec(this.getUA())){for(s=0;s<f.length;s++)l=c[++a],u=f[s],typeof u===o&&u.length>0?2==u.length?t[u[0]]=typeof u[1]==n?u[1].call(this,l):u[1]:3==u.length?t[u[0]]=typeof u[1]!==n||u[1].exec&&u[1].test?l?l.replace(u[1],u[2]):e:l?u[1].call(this,l,u[2]):e:4==u.length&&(t[u[0]]=l?u[3].call(this,l.replace(u[1],u[2])):e):t[u]=l?l:e;break}if(c)break}return t},str:function(t,n){for(var r in n)if(typeof n[r]===o&&n[r].length>0){for(var a=0;a<n[r].length;a++)if(u.has(n[r][a],t))return r===i?e:r}else if(u.has(n[r],t))return r===i?e:r;return t}},l={browser:{oldsafari:{major:{1:["/8","/1","/3"],2:"/4","?":"/"},version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",RT:"ARM"}}}},d={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[a,s],[/\s(opr)\/([\w\.]+)/i],[[a,"Opera"],s],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi)\/([\w\.-]+)/i],[a,s],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[a,"IE"],s],[/(edge)\/((\d+)?[\w\.]+)/i],[a,s],[/(yabrowser)\/([\w\.]+)/i],[[a,"Yandex"],s],[/(comodo_dragon)\/([\w\.]+)/i],[[a,/_/g," "],s],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i,/(uc\s?browser|qqbrowser)[\/\s]?([\w\.]+)/i],[a,s],[/(dolfin)\/([\w\.]+)/i],[[a,"Dolphin"],s],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[a,"Chrome"],s],[/XiaoMi\/MiuiBrowser\/([\w\.]+)/i],[s,[a,"MIUI Browser"]],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i],[s,[a,"Android Browser"]],[/FBAV\/([\w\.]+);/i],[s,[a,"Facebook"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[s,[a,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[s,a],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[a,[s,c.str,l.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[a,s],[/(navigator|netscape)\/([\w\.-]+)/i],[[a,"Netscape"],s],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]+)*/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[a,s]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[s,[a,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[a,s],[/rv\:([\w\.]+).*(gecko)/i],[s,a]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[a,s],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[a,[s,c.str,l.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[a,"Windows"],[s,c.str,l.os.windows.version]],[/\((bb)(10);/i],[[a,"BlackBerry"],s],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],[a,s],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[a,"Symbian"],s],[/\((series40);/i],[a],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[a,"Firefox OS"],s],[/(nintendo|playstation)\s([wids3portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[a,s],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[a,"Chromium OS"],s],[/(sunos)\s?([\w\.]+\d)*/i],[[a,"Solaris"],s],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[a,s],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[a,"iOS"],[s,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[[a,"Mac OS"],[s,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],[a,s]]},m=function(e){var i=e||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:t);this.getBrowser=function(){return c.rgx.apply(this,d.browser)},this.getEngine=function(){return c.rgx.apply(this,d.engine)},this.getOS=function(){return c.rgx.apply(this,d.os)},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS()}},this.getUA=function(){return i},this.setUA=function(e){return i=e,this},this.setUA(i)};return m}(),n=function(){var t={define_property:function(){return!1}(),create_canvas:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))}(),return_response_type:function(t){try{if(-1!==e.inArray(t,["","text","document"]))return!0;if(window.XMLHttpRequest){var i=new XMLHttpRequest;if(i.open("get","/"),"responseType"in i)return i.responseType=t,i.responseType!==t?!1:!0}}catch(n){}return!1},use_data_uri:function(){var e=new Image;return e.onload=function(){t.use_data_uri=1===e.width&&1===e.height},setTimeout(function(){e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="},1),!1}(),use_data_uri_over32kb:function(){return t.use_data_uri&&("IE"!==o.browser||o.version>=9)},use_data_uri_of:function(e){return t.use_data_uri&&33e3>e||t.use_data_uri_over32kb()},use_fileinput:function(){if(navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/))return!1;var e=document.createElement("input");return e.setAttribute("type","file"),!e.disabled}};return function(i){var n=[].slice.call(arguments);return n.shift(),"function"===e.typeOf(t[i])?t[i].apply(this,n):!!t[i]}}(),r=(new i).getResult(),o={can:n,uaParser:i,browser:r.browser.name,version:r.browser.version,os:r.os.name,osVersion:r.os.version,verComp:t,swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return o.OS=o.os,o}),n("moxie/core/Exceptions",["moxie/core/utils/Basic"],function(e){function t(e,t){var i;for(i in e)if(e[i]===t)return i;return null}return{RuntimeError:function(){function i(e,i){this.code=e,this.name=t(n,e),this.message=this.name+(i||": RuntimeError "+this.code)}var n={NOT_INIT_ERR:1,EXCEPTION_ERR:3,NOT_SUPPORTED_ERR:9,JS_ERR:4};return e.extend(i,n),i.prototype=Error.prototype,i}(),OperationNotAllowedException:function(){function t(e){this.code=e,this.name="OperationNotAllowedException"}return e.extend(t,{NOT_ALLOWED_ERR:1}),t.prototype=Error.prototype,t}(),ImageError:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": ImageError "+this.code}var n={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2,INVALID_META_ERR:3};return e.extend(i,n),i.prototype=Error.prototype,i}(),FileException:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": FileException "+this.code}var n={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return e.extend(i,n),i.prototype=Error.prototype,i}(),DOMException:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": DOMException "+this.code}var n={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return e.extend(i,n),i.prototype=Error.prototype,i}(),EventException:function(){function t(e){this.code=e,this.name="EventException"}return e.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0}),t.prototype=Error.prototype,t}()}}),n("moxie/core/utils/Dom",["moxie/core/utils/Env"],function(e){var t=function(e){return"string"!=typeof e?e:document.getElementById(e)},i=function(e,t){if(!e.className)return!1;var i=new RegExp("(^|\\s+)"+t+"(\\s+|$)");return i.test(e.className)},n=function(e,t){i(e,t)||(e.className=e.className?e.className.replace(/\s+$/,"")+" "+t:t)},r=function(e,t){if(e.className){var i=new RegExp("(^|\\s+)"+t+"(\\s+|$)");e.className=e.className.replace(i,function(e,t,i){return" "===t&&" "===i?" ":""})}},o=function(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(e,null)[t]:void 0},a=function(t,i){function n(e){var t,i,n=0,r=0;return e&&(i=e.getBoundingClientRect(),t="CSS1Compat"===c.compatMode?c.documentElement:c.body,n=i.left+t.scrollLeft,r=i.top+t.scrollTop),{x:n,y:r}}var r,o,a,s=0,u=0,c=document;if(t=t,i=i||c.body,t&&t.getBoundingClientRect&&"IE"===e.browser&&(!c.documentMode||c.documentMode<8))return o=n(t),a=n(i),{x:o.x-a.x,y:o.y-a.y};for(r=t;r&&r!=i&&r.nodeType;)s+=r.offsetLeft||0,u+=r.offsetTop||0,r=r.offsetParent;for(r=t.parentNode;r&&r!=i&&r.nodeType;)s-=r.scrollLeft||0,u-=r.scrollTop||0,r=r.parentNode;return{x:s,y:u}},s=function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}};return{get:t,hasClass:i,addClass:n,removeClass:r,getStyle:o,getPos:a,getSize:s}}),n("moxie/core/EventTarget",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic"],function(e,t,i){function n(){this.uid=i.guid()}var r={};return i.extend(n.prototype,{init:function(){this.uid||(this.uid=i.guid("uid_"))},addEventListener:function(e,t,n,o){var a,s=this;return this.hasOwnProperty("uid")||(this.uid=i.guid("uid_")),e=i.trim(e),/\s/.test(e)?(i.each(e.split(/\s+/),function(e){s.addEventListener(e,t,n,o)}),void 0):(e=e.toLowerCase(),n=parseInt(n,10)||0,a=r[this.uid]&&r[this.uid][e]||[],a.push({fn:t,priority:n,scope:o||this}),r[this.uid]||(r[this.uid]={}),r[this.uid][e]=a,void 0)},hasEventListener:function(e){var t;return e?(e=e.toLowerCase(),t=r[this.uid]&&r[this.uid][e]):t=r[this.uid],t?t:!1},removeEventListener:function(e,t){var n,o,a=this;if(e=e.toLowerCase(),/\s/.test(e))return i.each(e.split(/\s+/),function(e){a.removeEventListener(e,t)}),void 0;if(n=r[this.uid]&&r[this.uid][e]){if(t){for(o=n.length-1;o>=0;o--)if(n[o].fn===t){n.splice(o,1);break}}else n=[];n.length||(delete r[this.uid][e],i.isEmptyObj(r[this.uid])&&delete r[this.uid])}},removeAllEventListeners:function(){r[this.uid]&&delete r[this.uid]},dispatchEvent:function(e){var n,o,a,s,u,c={},l=!0;if("string"!==i.typeOf(e)){if(s=e,"string"!==i.typeOf(s.type))throw new t.EventException(t.EventException.UNSPECIFIED_EVENT_TYPE_ERR);e=s.type,s.total!==u&&s.loaded!==u&&(c.total=s.total,c.loaded=s.loaded),c.async=s.async||!1}if(-1!==e.indexOf("::")?function(t){n=t[0],e=t[1]}(e.split("::")):n=this.uid,e=e.toLowerCase(),o=r[n]&&r[n][e]){o.sort(function(e,t){return t.priority-e.priority}),a=[].slice.call(arguments),a.shift(),c.type=e,a.unshift(c);var d=[];i.each(o,function(e){a[0].target=e.scope,c.async?d.push(function(t){setTimeout(function(){t(e.fn.apply(e.scope,a)===!1)},1)}):d.push(function(t){t(e.fn.apply(e.scope,a)===!1)})}),d.length&&i.inSeries(d,function(e){l=!e})}return l},bindOnce:function(e,t,i,n){var r=this;r.bind.call(this,e,function o(){return r.unbind(e,o),t.apply(this,arguments)},i,n)},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},handleEventProps:function(e){var t=this;this.bind(e.join(" "),function(e){var t="on"+e.type.toLowerCase();"function"===i.typeOf(this[t])&&this[t].apply(this,arguments)}),i.each(e,function(e){e="on"+e.toLowerCase(e),"undefined"===i.typeOf(t[e])&&(t[e]=null)})}}),n.instance=new n,n}),n("moxie/runtime/Runtime",["moxie/core/utils/Env","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/EventTarget"],function(e,t,i,n){function r(e,n,o,s,u){var c,l=this,d=t.guid(n+"_"),m=u||"browser";e=e||{},a[d]=this,o=t.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},o),e.preferred_caps&&(m=r.getMode(s,e.preferred_caps,m)),c=function(){var e={};return{exec:function(t,i,n,r){return c[i]&&(e[t]||(e[t]={context:this,instance:new c[i]}),e[t].instance[n])?e[t].instance[n].apply(this,r):void 0},removeInstance:function(t){delete e[t]},removeAllInstances:function(){var i=this;t.each(e,function(e,n){"function"===t.typeOf(e.instance.destroy)&&e.instance.destroy.call(e.context),i.removeInstance(n)})}}}(),t.extend(this,{initialized:!1,uid:d,type:n,mode:r.getMode(s,e.required_caps,m),shimid:d+"_container",clients:0,options:e,can:function(e,i){var n=arguments[2]||o;if("string"===t.typeOf(e)&&"undefined"===t.typeOf(i)&&(e=r.parseCaps(e)),"object"===t.typeOf(e)){for(var a in e)if(!this.can(a,e[a],n))return!1;return!0}return"function"===t.typeOf(n[e])?n[e].call(this,i):i===n[e]},getShimContainer:function(){var e,n=i.get(this.shimid);return n||(e=i.get(this.options.container)||document.body,n=document.createElement("div"),n.id=this.shimid,n.className="moxie-shim moxie-shim-"+this.type,t.extend(n.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),e.appendChild(n),e=null),n},getShim:function(){return c},shimExec:function(e,t){var i=[].slice.call(arguments,2);return l.getShim().exec.call(this,this.uid,e,t,i)},exec:function(e,t){var i=[].slice.call(arguments,2);return l[e]&&l[e][t]?l[e][t].apply(this,i):l.shimExec.apply(this,arguments)},destroy:function(){if(l){var e=i.get(this.shimid);e&&e.parentNode.removeChild(e),c&&c.removeAllInstances(),this.unbindAll(),delete a[this.uid],this.uid=null,d=l=c=e=null}}}),this.mode&&e.required_caps&&!this.can(e.required_caps)&&(this.mode=!1)}var o={},a={};return r.order="html5,flash,silverlight,html4",r.getRuntime=function(e){return a[e]?a[e]:!1},r.addConstructor=function(e,t){t.prototype=n.instance,o[e]=t},r.getConstructor=function(e){return o[e]||null},r.getInfo=function(e){var t=r.getRuntime(e);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},r.parseCaps=function(e){var i={};return"string"!==t.typeOf(e)?e||{}:(t.each(e.split(","),function(e){i[e]=!0}),i)},r.can=function(e,t){var i,n,o=r.getConstructor(e);return o?(i=new o({required_caps:t}),n=i.mode,i.destroy(),!!n):!1},r.thatCan=function(e,t){var i=(t||r.order).split(/\s*,\s*/);for(var n in i)if(r.can(i[n],e))return i[n];return null},r.getMode=function(e,i,n){var r=null;if("undefined"===t.typeOf(n)&&(n="browser"),i&&!t.isEmptyObj(e)){if(t.each(i,function(i,n){if(e.hasOwnProperty(n)){var o=e[n](i);if("string"==typeof o&&(o=[o]),r){if(!(r=t.arrayIntersect(r,o)))return r=!1}else r=o}}),r)return-1!==t.inArray(n,r)?n:r[0];if(r===!1)return!1}return n},r.capTrue=function(){return!0},r.capFalse=function(){return!1},r.capTest=function(e){return function(){return!!e}},r}),n("moxie/runtime/RuntimeClient",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/Runtime"],function(e,t,i,n){return function(){var e;i.extend(this,{connectRuntime:function(r){function o(i){var a,u;return i.length?(a=i.shift().toLowerCase(),(u=n.getConstructor(a))?(e=new u(r),e.bind("Init",function(){e.initialized=!0,setTimeout(function(){e.clients++,s.ruid=e.uid,s.trigger("RuntimeInit",e)},1)}),e.bind("Error",function(){e.destroy(),o(i)}),e.bind("Exception",function(e,i){var n=i.name+"(#"+i.code+")"+(i.message?", from: "+i.message:"");s.trigger("RuntimeError",new t.RuntimeError(t.RuntimeError.EXCEPTION_ERR,n))}),e.mode?(e.init(),void 0):(e.trigger("Error"),void 0)):(o(i),void 0)):(s.trigger("RuntimeError",new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)),e=null,void 0)}var a,s=this;if("string"===i.typeOf(r)?a=r:"string"===i.typeOf(r.ruid)&&(a=r.ruid),a){if(e=n.getRuntime(a))return s.ruid=a,e.clients++,e;throw new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)}o((r.runtime_order||n.order).split(/\s*,\s*/))},disconnectRuntime:function(){e&&--e.clients<=0&&e.destroy(),e=null},getRuntime:function(){return e&&e.uid?e:e=null},exec:function(){return e?e.exec.apply(this,arguments):null},can:function(t){return e?e.can(t):!1}})}}),n("moxie/file/Blob",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient"],function(e,t,i){function n(o,a){function s(t,i,o){var a,s=r[this.uid];return"string"===e.typeOf(s)&&s.length?(a=new n(null,{type:o,size:i-t}),a.detach(s.substr(t,a.size)),a):null}i.call(this),o&&this.connectRuntime(o),a?"string"===e.typeOf(a)&&(a={data:a}):a={},e.extend(this,{uid:a.uid||e.guid("uid_"),ruid:o,size:a.size||0,type:a.type||"",slice:function(e,t,i){return this.isDetached()?s.apply(this,arguments):this.getRuntime().exec.call(this,"Blob","slice",this.getSource(),e,t,i)},getSource:function(){return r[this.uid]?r[this.uid]:null},detach:function(e){if(this.ruid&&(this.getRuntime().exec.call(this,"Blob","destroy"),this.disconnectRuntime(),this.ruid=null),e=e||"","data:"==e.substr(0,5)){var i=e.indexOf(";base64,");this.type=e.substring(5,i),e=t.atob(e.substring(i+8))}this.size=e.length,r[this.uid]=e},isDetached:function(){return!this.ruid&&"string"===e.typeOf(r[this.uid])},destroy:function(){this.detach(),delete r[this.uid]}}),a.data?this.detach(a.data):r[this.uid]=a}var r={};return n}),n("moxie/core/I18n",["moxie/core/utils/Basic"],function(e){var t={};return{addI18n:function(i){return e.extend(t,i)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(t){var i=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=i.shift();return"undefined"!==e.typeOf(t)?t:""})}}}),n("moxie/core/utils/Mime",["moxie/core/utils/Basic","moxie/core/I18n"],function(e,t){var i="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",n={mimes:{},extensions:{},addMimeType:function(e){var t,i,n,r=e.split(/,/);for(t=0;t<r.length;t+=2){for(n=r[t+1].split(/ /),i=0;i<n.length;i++)this.mimes[n[i]]=r[t];this.extensions[r[t]]=n}},extList2mimes:function(t,i){var n,r,o,a,s=this,u=[];for(r=0;r<t.length;r++)for(n=t[r].extensions.split(/\s*,\s*/),o=0;o<n.length;o++){if("*"===n[o])return[];if(a=s.mimes[n[o]],a&&-1===e.inArray(a,u)&&u.push(a),i&&/^\w+$/.test(n[o]))u.push("."+n[o]);else if(!a)return[]}return u},mimes2exts:function(t){var i=this,n=[];return e.each(t,function(t){if("*"===t)return n=[],!1;var r=t.match(/^(\w+)\/(\*|\w+)$/);r&&("*"===r[2]?e.each(i.extensions,function(e,t){new RegExp("^"+r[1]+"/").test(t)&&[].push.apply(n,i.extensions[t])}):i.extensions[t]&&[].push.apply(n,i.extensions[t]))}),n},mimes2extList:function(i){var n=[],r=[];return"string"===e.typeOf(i)&&(i=e.trim(i).split(/\s*,\s*/)),r=this.mimes2exts(i),n.push({title:t.translate("Files"),extensions:r.length?r.join(","):"*"}),n.mimes=i,n},getFileExtension:function(e){var t=e&&e.match(/\.([^.]+)$/);return t?t[1].toLowerCase():""},getFileMime:function(e){return this.mimes[this.getFileExtension(e)]||""}};return n.addMimeType(i),n}),n("moxie/file/FileInput",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Mime","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/I18n","moxie/runtime/Runtime","moxie/runtime/RuntimeClient"],function(e,t,i,n,r,o,a,s,u){function c(t){var o,c,d;if(-1!==e.inArray(e.typeOf(t),["string","node"])&&(t={browse_button:t}),c=n.get(t.browse_button),!c)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR);d={accept:[{title:a.translate("All Files"),extensions:"*"}],multiple:!1,required_caps:!1,container:c.parentNode||document.body},t=e.extend({},d,t),"string"==typeof t.required_caps&&(t.required_caps=s.parseCaps(t.required_caps)),"string"==typeof t.accept&&(t.accept=i.mimes2extList(t.accept)),o=n.get(t.container),o||(o=document.body),"static"===n.getStyle(o,"position")&&(o.style.position="relative"),o=c=null,u.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,shimid:null,files:null,init:function(){var i=this;i.bind("RuntimeInit",function(r,o){i.ruid=o.uid,i.shimid=o.shimid,i.bind("Ready",function(){i.trigger("Refresh")},999),i.bind("Refresh",function(){var i,r,a,s,u;a=n.get(t.browse_button),s=n.get(o.shimid),a&&(i=n.getPos(a,n.get(t.container)),r=n.getSize(a),u=parseInt(n.getStyle(a,"z-index"),10)||0,s&&e.extend(s.style,{top:i.y+"px",left:i.x+"px",width:r.w+"px",height:r.h+"px",zIndex:u+1})),s=a=null}),o.exec.call(i,"FileInput","init",t)}),i.connectRuntime(e.extend({},t,{required_caps:{select_file:!0}}))},getOption:function(e){return t[e]},setOption:function(e,n){if(t.hasOwnProperty(e)){var o=t[e];switch(e){case"accept":"string"==typeof n&&(n=i.mimes2extList(n));break;case"container":case"required_caps":throw new r.FileException(r.FileException.NO_MODIFICATION_ALLOWED_ERR)}t[e]=n,this.exec("FileInput","setOption",e,n),this.trigger("OptionChanged",e,n,o)}},disable:function(t){var i=this.getRuntime();i&&this.exec("FileInput","disable","undefined"===e.typeOf(t)?!0:t)},refresh:function(){this.trigger("Refresh")},destroy:function(){var t=this.getRuntime();t&&(t.exec.call(this,"FileInput","destroy"),this.disconnectRuntime()),"array"===e.typeOf(this.files)&&e.each(this.files,function(e){e.destroy()}),this.files=null,this.unbindAll()}}),this.handleEventProps(l)}var l=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];return c.prototype=o.instance,c}),n("moxie/file/File",["moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/file/Blob"],function(e,t,i){function n(n,r){r||(r={}),i.apply(this,arguments),this.type||(this.type=t.getFileMime(r.name));var o;if(r.name)o=r.name.replace(/\\/g,"/"),o=o.substr(o.lastIndexOf("/")+1);else if(this.type){var a=this.type.split("/")[0];o=e.guid((""!==a?a:"file")+"_"),t.extensions[this.type]&&(o+="."+t.extensions[this.type][0])}e.extend(this,{name:o||e.guid("file_"),relativePath:"",lastModifiedDate:r.lastModifiedDate||(new Date).toLocaleString()})}return n.prototype=i.prototype,n}),n("moxie/file/FileDrop",["moxie/core/I18n","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/core/utils/Env","moxie/file/File","moxie/runtime/RuntimeClient","moxie/core/EventTarget","moxie/core/utils/Mime"],function(e,t,i,n,r,o,a,s,u){function c(i){var r,o=this;"string"==typeof i&&(i={drop_zone:i}),r={accept:[{title:e.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}},i="object"==typeof i?n.extend({},r,i):r,i.container=t.get(i.drop_zone)||document.body,"static"===t.getStyle(i.container,"position")&&(i.container.style.position="relative"),"string"==typeof i.accept&&(i.accept=u.mimes2extList(i.accept)),a.call(o),n.extend(o,{uid:n.guid("uid_"),ruid:null,files:null,init:function(){o.bind("RuntimeInit",function(e,t){o.ruid=t.uid,t.exec.call(o,"FileDrop","init",i),o.dispatchEvent("ready")}),o.connectRuntime(i)},destroy:function(){var e=this.getRuntime();e&&(e.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime()),this.files=null,this.unbindAll()}}),this.handleEventProps(l)}var l=["ready","dragenter","dragleave","drop","error"];return c.prototype=s.instance,c}),n("moxie/file/FileReader",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/Exceptions","moxie/core/EventTarget","moxie/file/Blob","moxie/runtime/RuntimeClient"],function(e,t,i,n,r,o){function a(){function n(e,n){if(this.trigger("loadstart"),this.readyState===a.LOADING)return this.trigger("error",new i.DOMException(i.DOMException.INVALID_STATE_ERR)),this.trigger("loadend"),void 0;
  7350. if(!(n instanceof r))return this.trigger("error",new i.DOMException(i.DOMException.NOT_FOUND_ERR)),this.trigger("loadend"),void 0;if(this.result=null,this.readyState=a.LOADING,n.isDetached()){var o=n.getSource();switch(e){case"readAsText":case"readAsBinaryString":this.result=o;break;case"readAsDataURL":this.result="data:"+n.type+";base64,"+t.btoa(o)}this.readyState=a.DONE,this.trigger("load"),this.trigger("loadend")}else this.connectRuntime(n.ruid),this.exec("FileReader","read",e,n)}o.call(this),e.extend(this,{uid:e.guid("uid_"),readyState:a.EMPTY,result:null,error:null,readAsBinaryString:function(e){n.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){n.call(this,"readAsDataURL",e)},readAsText:function(e){n.call(this,"readAsText",e)},abort:function(){this.result=null,-1===e.inArray(this.readyState,[a.EMPTY,a.DONE])&&(this.readyState===a.LOADING&&(this.readyState=a.DONE),this.exec("FileReader","abort"),this.trigger("abort"),this.trigger("loadend"))},destroy:function(){this.abort(),this.exec("FileReader","destroy"),this.disconnectRuntime(),this.unbindAll()}}),this.handleEventProps(s),this.bind("Error",function(e,t){this.readyState=a.DONE,this.error=t},999),this.bind("Load",function(){this.readyState=a.DONE},999)}var s=["loadstart","progress","load","abort","error","loadend"];return a.EMPTY=0,a.LOADING=1,a.DONE=2,a.prototype=n.instance,a}),n("moxie/core/utils/Url",[],function(){var e=function(t,i){for(var n=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],r=n.length,o={http:80,https:443},a={},s=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,u=s.exec(t||"");r--;)u[r]&&(a[n[r]]=u[r]);if(!a.scheme){i&&"string"!=typeof i||(i=e(i||document.location.href)),a.scheme=i.scheme,a.host=i.host,a.port=i.port;var c="";/^[^\/]/.test(a.path)&&(c=i.path,c=/\/[^\/]*\.[^\/]*$/.test(c)?c.replace(/\/[^\/]+$/,"/"):c.replace(/\/?$/,"/")),a.path=c+(a.path||"")}return a.port||(a.port=o[a.scheme]||80),a.port=parseInt(a.port,10),a.path||(a.path="/"),delete a.source,a},t=function(t){var i={http:80,https:443},n="object"==typeof t?t:e(t);return n.scheme+"://"+n.host+(n.port!==i[n.scheme]?":"+n.port:"")+n.path+(n.query?n.query:"")},i=function(t){function i(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof t&&(t=e(t)),i(e())===i(t)};return{parseUrl:e,resolveUrl:t,hasSameOrigin:i}}),n("moxie/runtime/RuntimeTarget",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,i){function n(){this.uid=e.guid("uid_"),t.call(this),this.destroy=function(){this.disconnectRuntime(),this.unbindAll()}}return n.prototype=i.instance,n}),n("moxie/file/FileReaderSync",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/utils/Encode"],function(e,t,i){return function(){function n(e,t){if(!t.isDetached()){var n=this.connectRuntime(t.ruid).exec.call(this,"FileReaderSync","read",e,t);return this.disconnectRuntime(),n}var r=t.getSource();switch(e){case"readAsBinaryString":return r;case"readAsDataURL":return"data:"+t.type+";base64,"+i.btoa(r);case"readAsText":for(var o="",a=0,s=r.length;s>a;a++)o+=String.fromCharCode(r[a]);return o}}t.call(this),e.extend(this,{uid:e.guid("uid_"),readAsBinaryString:function(e){return n.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){return n.call(this,"readAsDataURL",e)},readAsText:function(e){return n.call(this,"readAsText",e)}})}}),n("moxie/xhr/FormData",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/file/Blob"],function(e,t,i){function n(){var e,n=[];t.extend(this,{append:function(r,o){var a=this,s=t.typeOf(o);o instanceof i?e={name:r,value:o}:"array"===s?(r+="[]",t.each(o,function(e){a.append(r,e)})):"object"===s?t.each(o,function(e,t){a.append(r+"["+t+"]",e)}):"null"===s||"undefined"===s||"number"===s&&isNaN(o)?a.append(r,"false"):n.push({name:r,value:o.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return e&&e.value||null},getBlobName:function(){return e&&e.name||null},each:function(i){t.each(n,function(e){i(e.value,e.name)}),e&&i(e.value,e.name)},destroy:function(){e=null,n=[]}})}return n}),n("moxie/xhr/XMLHttpRequest",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/core/utils/Url","moxie/runtime/Runtime","moxie/runtime/RuntimeTarget","moxie/file/Blob","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/core/utils/Env","moxie/core/utils/Mime"],function(e,t,i,n,r,o,a,s,u,c,l,d){function m(){this.uid=e.guid("uid_")}function h(){function i(e,t){return I.hasOwnProperty(e)?1===arguments.length?l.can("define_property")?I[e]:A[e]:(l.can("define_property")?I[e]=t:A[e]=t,void 0):void 0}function u(t){function n(){R&&(R.destroy(),R=null),s.dispatchEvent("loadend"),s=null}function r(r){R.bind("LoadStart",function(e){i("readyState",h.LOADING),s.dispatchEvent("readystatechange"),s.dispatchEvent(e),L&&s.upload.dispatchEvent(e)}),R.bind("Progress",function(e){i("readyState")!==h.LOADING&&(i("readyState",h.LOADING),s.dispatchEvent("readystatechange")),s.dispatchEvent(e)}),R.bind("UploadProgress",function(e){L&&s.upload.dispatchEvent({type:"progress",lengthComputable:!1,total:e.total,loaded:e.loaded})}),R.bind("Load",function(t){i("readyState",h.DONE),i("status",Number(r.exec.call(R,"XMLHttpRequest","getStatus")||0)),i("statusText",f[i("status")]||""),i("response",r.exec.call(R,"XMLHttpRequest","getResponse",i("responseType"))),~e.inArray(i("responseType"),["text",""])?i("responseText",i("response")):"document"===i("responseType")&&i("responseXML",i("response")),U=r.exec.call(R,"XMLHttpRequest","getAllResponseHeaders"),s.dispatchEvent("readystatechange"),i("status")>0?(L&&s.upload.dispatchEvent(t),s.dispatchEvent(t)):(F=!0,s.dispatchEvent("error")),n()}),R.bind("Abort",function(e){s.dispatchEvent(e),n()}),R.bind("Error",function(e){F=!0,i("readyState",h.DONE),s.dispatchEvent("readystatechange"),M=!0,s.dispatchEvent(e),n()}),r.exec.call(R,"XMLHttpRequest","send",{url:x,method:v,async:T,user:y,password:w,headers:S,mimeType:D,encoding:O,responseType:s.responseType,withCredentials:s.withCredentials,options:k},t)}var s=this;E=(new Date).getTime(),R=new a,"string"==typeof k.required_caps&&(k.required_caps=o.parseCaps(k.required_caps)),k.required_caps=e.extend({},k.required_caps,{return_response_type:s.responseType}),t instanceof c&&(k.required_caps.send_multipart=!0),e.isEmptyObj(S)||(k.required_caps.send_custom_headers=!0),B||(k.required_caps.do_cors=!0),k.ruid?r(R.connectRuntime(k)):(R.bind("RuntimeInit",function(e,t){r(t)}),R.bind("RuntimeError",function(e,t){s.dispatchEvent("RuntimeError",t)}),R.connectRuntime(k))}function g(){i("responseText",""),i("responseXML",null),i("response",null),i("status",0),i("statusText",""),E=b=null}var x,v,y,w,E,b,R,_,A=this,I={timeout:0,readyState:h.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},T=!0,S={},O=null,D=null,N=!1,C=!1,L=!1,M=!1,F=!1,B=!1,P=null,H=null,k={},U="";e.extend(this,I,{uid:e.guid("uid_"),upload:new m,open:function(o,a,s,u,c){var l;if(!o||!a)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(o)||n.utf8_encode(o)!==o)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(~e.inArray(o.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(v=o.toUpperCase()),~e.inArray(v,["CONNECT","TRACE","TRACK"]))throw new t.DOMException(t.DOMException.SECURITY_ERR);if(a=n.utf8_encode(a),l=r.parseUrl(a),B=r.hasSameOrigin(l),x=r.resolveUrl(a),(u||c)&&!B)throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);if(y=u||l.user,w=c||l.pass,T=s||!0,T===!1&&(i("timeout")||i("withCredentials")||""!==i("responseType")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);N=!T,C=!1,S={},g.call(this),i("readyState",h.OPENED),this.dispatchEvent("readystatechange")},setRequestHeader:function(r,o){var a=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(i("readyState")!==h.OPENED||C)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(r)||n.utf8_encode(r)!==r)throw new t.DOMException(t.DOMException.SYNTAX_ERR);return r=e.trim(r).toLowerCase(),~e.inArray(r,a)||/^(proxy\-|sec\-)/.test(r)?!1:(S[r]?S[r]+=", "+o:S[r]=o,!0)},hasRequestHeader:function(e){return e&&S[e.toLowerCase()]||!1},getAllResponseHeaders:function(){return U||""},getResponseHeader:function(t){return t=t.toLowerCase(),F||~e.inArray(t,["set-cookie","set-cookie2"])?null:U&&""!==U&&(_||(_={},e.each(U.split(/\r\n/),function(t){var i=t.split(/:\s+/);2===i.length&&(i[0]=e.trim(i[0]),_[i[0].toLowerCase()]={header:i[0],value:e.trim(i[1])})})),_.hasOwnProperty(t))?_[t].header+": "+_[t].value:null},overrideMimeType:function(n){var r,o;if(~e.inArray(i("readyState"),[h.LOADING,h.DONE]))throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(n=e.trim(n.toLowerCase()),/;/.test(n)&&(r=n.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(n=r[1],r[2]&&(o=r[2])),!d.mimes[n])throw new t.DOMException(t.DOMException.SYNTAX_ERR);P=n,H=o},send:function(i,r){if(k="string"===e.typeOf(r)?{ruid:r}:r?r:{},this.readyState!==h.OPENED||C)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(i instanceof s)k.ruid=i.ruid,D=i.type||"application/octet-stream";else if(i instanceof c){if(i.hasBlob()){var o=i.getBlob();k.ruid=o.ruid,D=o.type||"application/octet-stream"}}else"string"==typeof i&&(O="UTF-8",D="text/plain;charset=UTF-8",i=n.utf8_encode(i));this.withCredentials||(this.withCredentials=k.required_caps&&k.required_caps.send_browser_cookies&&!B),L=!N&&this.upload.hasEventListener(),F=!1,M=!i,N||(C=!0),u.call(this,i)},abort:function(){if(F=!0,N=!1,~e.inArray(i("readyState"),[h.UNSENT,h.OPENED,h.DONE]))i("readyState",h.UNSENT);else{if(i("readyState",h.DONE),C=!1,!R)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);R.getRuntime().exec.call(R,"XMLHttpRequest","abort",M),M=!0}},destroy:function(){R&&("function"===e.typeOf(R.destroy)&&R.destroy(),R=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}}),this.handleEventProps(p.concat(["readystatechange"])),this.upload.handleEventProps(p)}var f={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};m.prototype=i.instance;var p=["loadstart","progress","abort","error","load","timeout","loadend"];return h.UNSENT=0,h.OPENED=1,h.HEADERS_RECEIVED=2,h.LOADING=3,h.DONE=4,h.prototype=i.instance,h}),n("moxie/runtime/Transporter",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,i,n){function r(){function n(){l=d=0,c=this.result=null}function o(t,i){var n=this;u=i,n.bind("TransportingProgress",function(t){d=t.loaded,l>d&&-1===e.inArray(n.state,[r.IDLE,r.DONE])&&a.call(n)},999),n.bind("TransportingComplete",function(){d=l,n.state=r.DONE,c=null,n.result=u.exec.call(n,"Transporter","getAsBlob",t||"")},999),n.state=r.BUSY,n.trigger("TransportingStarted"),a.call(n)}function a(){var e,i=this,n=l-d;m>n&&(m=n),e=t.btoa(c.substr(d,m)),u.exec.call(i,"Transporter","receive",e,l)}var s,u,c,l,d,m;i.call(this),e.extend(this,{uid:e.guid("uid_"),state:r.IDLE,result:null,transport:function(t,i,r){var a=this;if(r=e.extend({chunk_size:204798},r),(s=r.chunk_size%3)&&(r.chunk_size+=3-s),m=r.chunk_size,n.call(this),c=t,l=t.length,"string"===e.typeOf(r)||r.ruid)o.call(a,i,this.connectRuntime(r));else{var u=function(e,t){a.unbind("RuntimeInit",u),o.call(a,i,t)};this.bind("RuntimeInit",u),this.connectRuntime(r)}},abort:function(){var e=this;e.state=r.IDLE,u&&(u.exec.call(e,"Transporter","clear"),e.trigger("TransportingAborted")),n.call(e)},destroy:function(){this.unbindAll(),u=null,this.disconnectRuntime(),n.call(this)}})}return r.IDLE=0,r.BUSY=1,r.DONE=2,r.prototype=n.instance,r}),n("moxie/image/Image",["moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/file/FileReaderSync","moxie/xhr/XMLHttpRequest","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/runtime/Transporter","moxie/core/utils/Env","moxie/core/EventTarget","moxie/file/Blob","moxie/file/File","moxie/core/utils/Encode"],function(e,t,i,n,r,o,a,s,u,c,l,d,m){function h(){function n(e){try{return e||(e=this.exec("Image","getInfo")),this.size=e.size,this.width=e.width,this.height=e.height,this.type=e.type,this.meta=e.meta,""===this.name&&(this.name=e.name),!0}catch(t){return this.trigger("error",t.code),!1}}function c(t){var n=e.typeOf(t);try{if(t instanceof h){if(!t.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);p.apply(this,arguments)}else if(t instanceof l){if(!~e.inArray(t.type,["image/jpeg","image/png"]))throw new i.ImageError(i.ImageError.WRONG_FORMAT);g.apply(this,arguments)}else if(-1!==e.inArray(n,["blob","file"]))c.call(this,new d(null,t),arguments[1]);else if("string"===n)"data:"===t.substr(0,5)?c.call(this,new l(null,{data:t}),arguments[1]):x.apply(this,arguments);else{if("node"!==n||"img"!==t.nodeName.toLowerCase())throw new i.DOMException(i.DOMException.TYPE_MISMATCH_ERR);c.call(this,t.src,arguments[1])}}catch(r){this.trigger("error",r.code)}}function p(t,i){var n=this.connectRuntime(t.ruid);this.ruid=n.uid,n.exec.call(this,"Image","loadFromImage",t,"undefined"===e.typeOf(i)?!0:i)}function g(t,i){function n(e){r.ruid=e.uid,e.exec.call(r,"Image","loadFromBlob",t)}var r=this;r.name=t.name||"",t.isDetached()?(this.bind("RuntimeInit",function(e,t){n(t)}),i&&"string"==typeof i.required_caps&&(i.required_caps=o.parseCaps(i.required_caps)),this.connectRuntime(e.extend({required_caps:{access_image_binary:!0,resize_image:!0}},i))):n(this.connectRuntime(t.ruid))}function x(e,t){var i,n=this;i=new r,i.open("get",e),i.responseType="blob",i.onprogress=function(e){n.trigger(e)},i.onload=function(){g.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind("RuntimeError",function(e,t){n.trigger("RuntimeError",t)}),i.send(null,t)}a.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){c.apply(this,arguments)},resize:function(t){var n,r,o=this,a={x:0,y:0,width:o.width,height:o.height},s=e.extendIf({width:o.width,height:o.height,type:o.type||"image/jpeg",quality:90,crop:!1,fit:!0,preserveHeaders:!0,resample:"default",multipass:!0},t);try{if(!o.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);if(o.width>h.MAX_RESIZE_WIDTH||o.height>h.MAX_RESIZE_HEIGHT)throw new i.ImageError(i.ImageError.MAX_RESOLUTION_ERR);if(n=o.meta&&o.meta.tiff&&o.meta.tiff.Orientation||1,-1!==e.inArray(n,[5,6,7,8])){var u=s.width;s.width=s.height,s.height=u}if(s.crop){switch(r=Math.max(s.width/o.width,s.height/o.height),t.fit?(a.width=Math.min(Math.ceil(s.width/r),o.width),a.height=Math.min(Math.ceil(s.height/r),o.height),r=s.width/a.width):(a.width=Math.min(s.width,o.width),a.height=Math.min(s.height,o.height),r=1),"boolean"==typeof s.crop&&(s.crop="cc"),s.crop.toLowerCase().replace(/_/,"-")){case"rb":case"right-bottom":a.x=o.width-a.width,a.y=o.height-a.height;break;case"cb":case"center-bottom":a.x=Math.floor((o.width-a.width)/2),a.y=o.height-a.height;break;case"lb":case"left-bottom":a.x=0,a.y=o.height-a.height;break;case"lt":case"left-top":a.x=0,a.y=0;break;case"ct":case"center-top":a.x=Math.floor((o.width-a.width)/2),a.y=0;break;case"rt":case"right-top":a.x=o.width-a.width,a.y=0;break;case"rc":case"right-center":case"right-middle":a.x=o.width-a.width,a.y=Math.floor((o.height-a.height)/2);break;case"lc":case"left-center":case"left-middle":a.x=0,a.y=Math.floor((o.height-a.height)/2);break;case"cc":case"center-center":case"center-middle":default:a.x=Math.floor((o.width-a.width)/2),a.y=Math.floor((o.height-a.height)/2)}a.x=Math.max(a.x,0),a.y=Math.max(a.y,0)}else r=Math.min(s.width/o.width,s.height/o.height);this.exec("Image","resize",a,r,s)}catch(c){o.trigger("error",c.code)}},downsize:function(t){var i,n={width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,crop:!1,preserveHeaders:!0,resample:"default"};i="object"==typeof t?e.extend(n,t):e.extend(n,{width:arguments[0],height:arguments[1],crop:arguments[2],preserveHeaders:arguments[3]}),this.resize(i)},crop:function(e,t,i){this.downsize(e,t,!0,i)},getAsCanvas:function(){if(!u.can("create_canvas"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);var e=this.connectRuntime(this.ruid);return e.exec.call(this,"Image","getAsCanvas")},getAsBlob:function(e,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsBlob",e||"image/jpeg",t||90)},getAsDataURL:function(e,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsDataURL",e||"image/jpeg",t||90)},getAsBinaryString:function(e,t){var i=this.getAsDataURL(e,t);return m.atob(i.substring(i.indexOf("base64,")+7))},embed:function(n,r){function o(t,r){var o=this;if(u.can("create_canvas")){var l=o.getAsCanvas();if(l)return n.appendChild(l),l=null,o.destroy(),c.trigger("embedded"),void 0}var d=o.getAsDataURL(t,r);if(!d)throw new i.ImageError(i.ImageError.WRONG_FORMAT);if(u.can("use_data_uri_of",d.length))n.innerHTML='<img src="'+d+'" width="'+o.width+'" height="'+o.height+'" />',o.destroy(),c.trigger("embedded");else{var h=new s;h.bind("TransportingComplete",function(){a=c.connectRuntime(this.result.ruid),c.bind("Embedded",function(){e.extend(a.getShimContainer().style,{top:"0px",left:"0px",width:o.width+"px",height:o.height+"px"}),a=null},999),a.exec.call(c,"ImageView","display",this.result.uid,width,height),o.destroy()}),h.transport(m.atob(d.substring(d.indexOf("base64,")+7)),t,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:n})}}var a,c=this,l=e.extend({width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90},r);try{if(!(n=t.get(n)))throw new i.DOMException(i.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);this.width>h.MAX_RESIZE_WIDTH||this.height>h.MAX_RESIZE_HEIGHT;var d=new h;return d.bind("Resize",function(){o.call(this,l.type,l.quality)}),d.bind("Load",function(){d.downsize(l)}),this.meta.thumb&&this.meta.thumb.width>=l.width&&this.meta.thumb.height>=l.height?d.load(this.meta.thumb.data):d.clone(this,!1),d}catch(f){this.trigger("error",f.code)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.unbindAll()}}),this.handleEventProps(f),this.bind("Load Resize",function(){return n.call(this)},999)}var f=["progress","load","error","resize","embedded"];return h.MAX_RESIZE_WIDTH=8192,h.MAX_RESIZE_HEIGHT=8192,h.prototype=c.instance,h}),n("moxie/runtime/html5/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(e,t,i,n){function o(t){var o=this,u=i.capTest,c=i.capTrue,l=e.extend({access_binary:u(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return o.can("access_binary")&&!!s.Image},display_media:u((n.can("create_canvas")||n.can("use_data_uri_over32kb"))&&r("moxie/image/Image")),do_cors:u(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:u(function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&("IE"!==n.browser||n.verComp(n.version,9,">"))}()),filter_by_extension:u(function(){return!("Chrome"===n.browser&&n.verComp(n.version,28,"<")||"IE"===n.browser&&n.verComp(n.version,10,"<")||"Safari"===n.browser&&n.verComp(n.version,7,"<")||"Firefox"===n.browser&&n.verComp(n.version,37,"<"))}()),return_response_headers:c,return_response_type:function(e){return"json"===e&&window.JSON?!0:n.can("return_response_type",e)},return_status_code:c,report_upload_progress:u(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return o.can("access_binary")&&n.can("create_canvas")},select_file:function(){return n.can("use_fileinput")&&window.File},select_folder:function(){return o.can("select_file")&&("Chrome"===n.browser&&n.verComp(n.version,21,">=")||"Firefox"===n.browser&&n.verComp(n.version,42,">="))},select_multiple:function(){return!(!o.can("select_file")||"Safari"===n.browser&&"Windows"===n.os||"iOS"===n.os&&n.verComp(n.osVersion,"7.0.0",">")&&n.verComp(n.osVersion,"8.0.0","<"))},send_binary_string:u(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:u(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||o.can("send_binary_string")},slice_blob:u(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return o.can("slice_blob")&&o.can("send_multipart")},summon_file_dialog:function(){return o.can("select_file")&&("Firefox"===n.browser&&n.verComp(n.version,4,">=")||"Opera"===n.browser&&n.verComp(n.version,12,">=")||"IE"===n.browser&&n.verComp(n.version,10,">=")||!!~e.inArray(n.browser,["Chrome","Safari","Edge"]))},upload_filesize:c,use_http_method:c},arguments[2]);i.call(this,t,arguments[1]||a,l),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),s)}var a="html5",s={};return i.addConstructor(a,o),s}),n("moxie/runtime/html5/file/Blob",["moxie/runtime/html5/Runtime","moxie/file/Blob"],function(e,t){function i(){function e(e,t,i){var n;if(!window.File.prototype.slice)return(n=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?n.call(e,t,i):null;try{return e.slice(),e.slice(t,i)}catch(r){return e.slice(t,i-t)}}this.slice=function(){return new t(this.getRuntime().uid,e.apply(this,arguments))}}return e.Blob=i}),n("moxie/core/utils/Events",["moxie/core/utils/Basic"],function(e){function t(){this.returnValue=!1}function i(){this.cancelBubble=!0}var n={},r="moxie_"+e.guid(),o=function(o,a,s,u){var c,l;a=a.toLowerCase(),o.addEventListener?(c=s,o.addEventListener(a,c,!1)):o.attachEvent&&(c=function(){var e=window.event;e.target||(e.target=e.srcElement),e.preventDefault=t,e.stopPropagation=i,s(e)},o.attachEvent("on"+a,c)),o[r]||(o[r]=e.guid()),n.hasOwnProperty(o[r])||(n[o[r]]={}),l=n[o[r]],l.hasOwnProperty(a)||(l[a]=[]),l[a].push({func:c,orig:s,key:u})},a=function(t,i,o){var a,s;if(i=i.toLowerCase(),t[r]&&n[t[r]]&&n[t[r]][i]){a=n[t[r]][i];for(var u=a.length-1;u>=0&&(a[u].orig!==o&&a[u].key!==o||(t.removeEventListener?t.removeEventListener(i,a[u].func,!1):t.detachEvent&&t.detachEvent("on"+i,a[u].func),a[u].orig=null,a[u].func=null,a.splice(u,1),o===s));u--);if(a.length||delete n[t[r]][i],e.isEmptyObj(n[t[r]])){delete n[t[r]];try{delete t[r]}catch(c){t[r]=s}}}},s=function(t,i){t&&t[r]&&e.each(n[t[r]],function(e,n){a(t,n,i)})};return{addEvent:o,removeEvent:a,removeAllEvents:s}}),n("moxie/runtime/html5/file/FileInput",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,a){function s(){var e,s;i.extend(this,{init:function(u){var c,l,d,m,h,f,p=this,g=p.getRuntime();e=u,d=e.accept.mimes||o.extList2mimes(e.accept,g.can("filter_by_extension")),l=g.getShimContainer(),l.innerHTML='<input id="'+g.uid+'" type="file" style="font-size:999px;opacity:0;"'+(e.multiple&&g.can("select_multiple")?"multiple":"")+(e.directory&&g.can("select_folder")?"webkitdirectory directory":"")+(d?' accept="'+d.join(",")+'"':"")+" />",c=n.get(g.uid),i.extend(c.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),m=n.get(e.browse_button),s=n.getStyle(m,"z-index")||"auto",g.can("summon_file_dialog")&&("static"===n.getStyle(m,"position")&&(m.style.position="relative"),r.addEvent(m,"click",function(e){var t=n.get(g.uid);t&&!t.disabled&&t.click(),e.preventDefault()},p.uid),p.bind("Refresh",function(){h=parseInt(s,10)||1,n.get(e.browse_button).style.zIndex=h,this.getRuntime().getShimContainer().style.zIndex=h-1})),f=g.can("summon_file_dialog")?m:l,r.addEvent(f,"mouseover",function(){p.trigger("mouseenter")},p.uid),r.addEvent(f,"mouseout",function(){p.trigger("mouseleave")},p.uid),r.addEvent(f,"mousedown",function(){p.trigger("mousedown")},p.uid),r.addEvent(n.get(e.container),"mouseup",function(){p.trigger("mouseup")},p.uid),c.onchange=function x(){if(p.files=[],i.each(this.files,function(i){var n="";return e.directory&&"."==i.name?!0:(i.webkitRelativePath&&(n="/"+i.webkitRelativePath.replace(/^\//,"")),i=new t(g.uid,i),i.relativePath=n,p.files.push(i),void 0)}),"IE"!==a.browser&&"IEMobile"!==a.browser)this.value="";else{var n=this.cloneNode(!0);this.parentNode.replaceChild(n,this),n.onchange=x}p.files.length&&p.trigger("change")},p.trigger({type:"ready",async:!0}),l=null},setOption:function(e,t){var i=this.getRuntime(),r=n.get(i.uid);switch(e){case"accept":if(t){var a=t.mimes||o.extList2mimes(t,i.can("filter_by_extension"));r.setAttribute("accept",a.join(","))}else r.removeAttribute("accept");break;case"directory":t&&i.can("select_folder")?(r.setAttribute("directory",""),r.setAttribute("webkitdirectory","")):(r.removeAttribute("directory"),r.removeAttribute("webkitdirectory"));break;case"multiple":t&&i.can("select_multiple")?r.setAttribute("multiple",""):r.removeAttribute("multiple")}},disable:function(e){var t,i=this.getRuntime();(t=n.get(i.uid))&&(t.disabled=!!e)},destroy:function(){var t=this.getRuntime(),i=t.getShim(),o=t.getShimContainer(),a=e&&n.get(e.container),u=e&&n.get(e.browse_button);a&&r.removeAllEvents(a,this.uid),u&&(r.removeAllEvents(u,this.uid),u.style.zIndex=s),o&&(r.removeAllEvents(o,this.uid),o.innerHTML=""),i.removeInstance(this.uid),e=o=a=u=i=null}})}return e.FileInput=s}),n("moxie/runtime/html5/file/FileDrop",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime"],function(e,t,i,n,r,o){function a(){function e(e){if(!e.dataTransfer||!e.dataTransfer.types)return!1;var t=i.toArray(e.dataTransfer.types||[]);return-1!==i.inArray("Files",t)||-1!==i.inArray("public.file-url",t)||-1!==i.inArray("application/x-moz-file",t)}function a(e,i){if(u(e)){var n=new t(f,e);n.relativePath=i||"",p.push(n)}}function s(e){for(var t=[],n=0;n<e.length;n++)[].push.apply(t,e[n].extensions.split(/\s*,\s*/));return-1===i.inArray("*",t)?t:[]}function u(e){if(!g.length)return!0;var t=o.getFileExtension(e.name);return!t||-1!==i.inArray(t,g)}function c(e,t){var n=[];i.each(e,function(e){var t=e.webkitGetAsEntry();t&&(t.isFile?a(e.getAsFile(),t.fullPath):n.push(t))}),n.length?l(n,t):t()}function l(e,t){var n=[];i.each(e,function(e){n.push(function(t){d(e,t)})}),i.inSeries(n,function(){t()})}function d(e,t){e.isFile?e.file(function(i){a(i,e.fullPath),t()},function(){t()}):e.isDirectory?m(e,t):t()}function m(e,t){function i(e){r.readEntries(function(t){t.length?([].push.apply(n,t),i(e)):e()},e)}var n=[],r=e.createReader();i(function(){l(n,t)})}var h,f,p=[],g=[];i.extend(this,{init:function(t){var n,o=this;h=t,f=o.ruid,g=s(h.accept),n=h.container,r.addEvent(n,"dragover",function(t){e(t)&&(t.preventDefault(),t.dataTransfer.dropEffect="copy")},o.uid),r.addEvent(n,"drop",function(t){e(t)&&(t.preventDefault(),p=[],t.dataTransfer.items&&t.dataTransfer.items[0].webkitGetAsEntry?c(t.dataTransfer.items,function(){o.files=p,o.trigger("drop")}):(i.each(t.dataTransfer.files,function(e){a(e)}),o.files=p,o.trigger("drop")))},o.uid),r.addEvent(n,"dragenter",function(){o.trigger("dragenter")},o.uid),r.addEvent(n,"dragleave",function(){o.trigger("dragleave")},o.uid)},destroy:function(){r.removeAllEvents(h&&n.get(h.container),this.uid),f=p=g=h=null}})}return e.FileDrop=a}),n("moxie/runtime/html5/file/FileReader",["moxie/runtime/html5/Runtime","moxie/core/utils/Encode","moxie/core/utils/Basic"],function(e,t,i){function n(){function e(e){return t.atob(e.substring(e.indexOf("base64,")+7))}var n,r=!1;i.extend(this,{read:function(t,o){var a=this;a.result="",n=new window.FileReader,n.addEventListener("progress",function(e){a.trigger(e)}),n.addEventListener("load",function(t){a.result=r?e(n.result):n.result,a.trigger(t)}),n.addEventListener("error",function(e){a.trigger(e,n.error)}),n.addEventListener("loadend",function(e){n=null,a.trigger(e)}),"function"===i.typeOf(n[t])?(r=!1,n[t](o.getSource())):"readAsBinaryString"===t&&(r=!0,n.readAsDataURL(o.getSource()))},abort:function(){n&&n.abort()},destroy:function(){n=null}})}return e.FileReader=n}),n("moxie/runtime/html5/xhr/XMLHttpRequest",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/core/utils/Url","moxie/file/File","moxie/file/Blob","moxie/xhr/FormData","moxie/core/Exceptions","moxie/core/utils/Env"],function(e,t,i,n,r,o,a,s,u){function c(){function e(e,t){var i,n,r=this;i=t.getBlob().getSource(),n=new window.FileReader,n.onload=function(){t.append(t.getBlobName(),new o(null,{type:i.type,data:n.result})),f.send.call(r,e,t)},n.readAsBinaryString(i)}function c(){return!window.XMLHttpRequest||"IE"===u.browser&&u.verComp(u.version,8,"<")?function(){for(var e=["Msxml2.XMLHTTP.6.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{return new ActiveXObject(e[t])}catch(i){}}():new window.XMLHttpRequest}function l(e){var t=e.responseXML,i=e.responseText;return"IE"===u.browser&&i&&t&&!t.documentElement&&/[^\/]+\/[^\+]+\+xml/.test(e.getResponseHeader("Content-Type"))&&(t=new window.ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.validateOnParse=!1,t.loadXML(i)),t&&("IE"===u.browser&&0!==t.parseError||!t.documentElement||"parsererror"===t.documentElement.tagName)?null:t}function d(e){var t="----moxieboundary"+(new Date).getTime(),i="--",n="\r\n",r="",a=this.getRuntime();if(!a.can("send_binary_string"))throw new s.RuntimeError(s.RuntimeError.NOT_SUPPORTED_ERR);return m.setRequestHeader("Content-Type","multipart/form-data; boundary="+t),e.each(function(e,a){r+=e instanceof o?i+t+n+'Content-Disposition: form-data; name="'+a+'"; filename="'+unescape(encodeURIComponent(e.name||"blob"))+'"'+n+"Content-Type: "+(e.type||"application/octet-stream")+n+n+e.getSource()+n:i+t+n+'Content-Disposition: form-data; name="'+a+'"'+n+n+unescape(encodeURIComponent(e))+n}),r+=i+t+i+n}var m,h,f=this;t.extend(this,{send:function(i,r){var s=this,l="Mozilla"===u.browser&&u.verComp(u.version,4,">=")&&u.verComp(u.version,7,"<"),f="Android Browser"===u.browser,p=!1;if(h=i.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),m=c(),m.open(i.method,i.url,i.async,i.user,i.password),r instanceof o)r.isDetached()&&(p=!0),r=r.getSource();
  7351. else if(r instanceof a){if(r.hasBlob())if(r.getBlob().isDetached())r=d.call(s,r),p=!0;else if((l||f)&&"blob"===t.typeOf(r.getBlob().getSource())&&window.FileReader)return e.call(s,i,r),void 0;if(r instanceof a){var g=new window.FormData;r.each(function(e,t){e instanceof o?g.append(t,e.getSource()):g.append(t,e)}),r=g}}m.upload?(i.withCredentials&&(m.withCredentials=!0),m.addEventListener("load",function(e){s.trigger(e)}),m.addEventListener("error",function(e){s.trigger(e)}),m.addEventListener("progress",function(e){s.trigger(e)}),m.upload.addEventListener("progress",function(e){s.trigger({type:"UploadProgress",loaded:e.loaded,total:e.total})})):m.onreadystatechange=function(){switch(m.readyState){case 1:break;case 2:break;case 3:var e,t;try{n.hasSameOrigin(i.url)&&(e=m.getResponseHeader("Content-Length")||0),m.responseText&&(t=m.responseText.length)}catch(r){e=t=0}s.trigger({type:"progress",lengthComputable:!!e,total:parseInt(e,10),loaded:t});break;case 4:m.onreadystatechange=function(){},0===m.status?s.trigger("error"):s.trigger("load")}},t.isEmptyObj(i.headers)||t.each(i.headers,function(e,t){m.setRequestHeader(t,e)}),""!==i.responseType&&"responseType"in m&&(m.responseType="json"!==i.responseType||u.can("return_response_type","json")?i.responseType:"text"),p?m.sendAsBinary?m.sendAsBinary(r):function(){for(var e=new Uint8Array(r.length),t=0;t<r.length;t++)e[t]=255&r.charCodeAt(t);m.send(e.buffer)}():m.send(r),s.trigger("loadstart")},getStatus:function(){try{if(m)return m.status}catch(e){}return 0},getResponse:function(e){var t=this.getRuntime();try{switch(e){case"blob":var n=new r(t.uid,m.response),o=m.getResponseHeader("Content-Disposition");if(o){var a=o.match(/filename=([\'\"'])([^\1]+)\1/);a&&(h=a[2])}return n.name=h,n.type||(n.type=i.getFileMime(h)),n;case"json":return u.can("return_response_type","json")?m.response:200===m.status&&window.JSON?JSON.parse(m.responseText):null;case"document":return l(m);default:return""!==m.responseText?m.responseText:null}}catch(s){return null}},getAllResponseHeaders:function(){try{return m.getAllResponseHeaders()}catch(e){}return""},abort:function(){m&&m.abort()},destroy:function(){f=h=null}})}return e.XMLHttpRequest=c}),n("moxie/runtime/html5/utils/BinaryReader",["moxie/core/utils/Basic"],function(e){function t(e){e instanceof ArrayBuffer?i.apply(this,arguments):n.apply(this,arguments)}function i(t){var i=new DataView(t);e.extend(this,{readByteAt:function(e){return i.getUint8(e)},writeByteAt:function(e,t){i.setUint8(e,t)},SEGMENT:function(e,n,r){switch(arguments.length){case 2:return t.slice(e,e+n);case 1:return t.slice(e);case 3:if(null===r&&(r=new ArrayBuffer),r instanceof ArrayBuffer){var o=new Uint8Array(this.length()-n+r.byteLength);e>0&&o.set(new Uint8Array(t.slice(0,e)),0),o.set(new Uint8Array(r),e),o.set(new Uint8Array(t.slice(e+n)),e+r.byteLength),this.clear(),t=o.buffer,i=new DataView(t);break}default:return t}},length:function(){return t?t.byteLength:0},clear:function(){i=t=null}})}function n(t){function i(e,i,n){n=3===arguments.length?n:t.length-i-1,t=t.substr(0,i)+e+t.substr(n+i)}e.extend(this,{readByteAt:function(e){return t.charCodeAt(e)},writeByteAt:function(e,t){i(String.fromCharCode(t),e,1)},SEGMENT:function(e,n,r){switch(arguments.length){case 1:return t.substr(e);case 2:return t.substr(e,n);case 3:i(null!==r?r:"",e,n);break;default:return t}},length:function(){return t?t.length:0},clear:function(){t=null}})}return e.extend(t.prototype,{littleEndian:!1,read:function(e,t){var i,n,r;if(e+t>this.length())throw new Error("You are trying to read outside the source boundaries.");for(n=this.littleEndian?0:-8*(t-1),r=0,i=0;t>r;r++)i|=this.readByteAt(e+r)<<Math.abs(n+8*r);return i},write:function(e,t,i){var n,r;if(e>this.length())throw new Error("You are trying to write outside the source boundaries.");for(n=this.littleEndian?0:-8*(i-1),r=0;i>r;r++)this.writeByteAt(e+r,255&t>>Math.abs(n+8*r))},BYTE:function(e){return this.read(e,1)},SHORT:function(e){return this.read(e,2)},LONG:function(e){return this.read(e,4)},SLONG:function(e){var t=this.read(e,4);return t>2147483647?t-4294967296:t},CHAR:function(e){return String.fromCharCode(this.read(e,1))},STRING:function(e,t){return this.asArray("CHAR",e,t).join("")},asArray:function(e,t,i){for(var n=[],r=0;i>r;r++)n[r]=this[e](t+r);return n}}),t}),n("moxie/runtime/html5/image/JPEGHeaders",["moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(e,t){return function i(n){var r,o,a,s=[],u=0;if(r=new e(n),65496!==r.SHORT(0))throw r.clear(),new t.ImageError(t.ImageError.WRONG_FORMAT);for(o=2;o<=r.length();)if(a=r.SHORT(o),a>=65488&&65495>=a)o+=2;else{if(65498===a||65497===a)break;u=r.SHORT(o+2)+2,a>=65505&&65519>=a&&s.push({hex:a,name:"APP"+(15&a),start:o,length:u,segment:r.SEGMENT(o,u)}),o+=u}return r.clear(),{headers:s,restore:function(t){var i,n,r;for(r=new e(t),o=65504==r.SHORT(2)?4+r.SHORT(4):2,n=0,i=s.length;i>n;n++)r.SEGMENT(o,0,s[n].segment),o+=s[n].length;return t=r.SEGMENT(),r.clear(),t},strip:function(t){var n,r,o,a;for(o=new i(t),r=o.headers,o.purge(),n=new e(t),a=r.length;a--;)n.SEGMENT(r[a].start,r[a].length,"");return t=n.SEGMENT(),n.clear(),t},get:function(e){for(var t=[],i=0,n=s.length;n>i;i++)s[i].name===e.toUpperCase()&&t.push(s[i].segment);return t},set:function(e,t){var i,n,r,o=[];for("string"==typeof t?o.push(t):o=t,i=n=0,r=s.length;r>i&&(s[i].name===e.toUpperCase()&&(s[i].segment=o[n],s[i].length=o[n].length,n++),!(n>=o.length));i++);},purge:function(){this.headers=s=[]}}}}),n("moxie/runtime/html5/image/ExifParser",["moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(e,i,n){function r(o){function a(i,r){var o,a,s,u,c,m,h,f,p=this,g=[],x={},v={1:"BYTE",7:"UNDEFINED",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",9:"SLONG",10:"SRATIONAL"},y={BYTE:1,UNDEFINED:1,ASCII:1,SHORT:2,LONG:4,RATIONAL:8,SLONG:4,SRATIONAL:8};for(o=p.SHORT(i),a=0;o>a;a++)if(g=[],h=i+2+12*a,s=r[p.SHORT(h)],s!==t){if(u=v[p.SHORT(h+=2)],c=p.LONG(h+=2),m=y[u],!m)throw new n.ImageError(n.ImageError.INVALID_META_ERR);if(h+=4,m*c>4&&(h=p.LONG(h)+d.tiffHeader),h+m*c>=this.length())throw new n.ImageError(n.ImageError.INVALID_META_ERR);"ASCII"!==u?(g=p.asArray(u,h,c),f=1==c?g[0]:g,x[s]=l.hasOwnProperty(s)&&"object"!=typeof f?l[s][f]:f):x[s]=e.trim(p.STRING(h,c).replace(/\0$/,""))}return x}function s(e,t,i){var n,r,o,a=0;if("string"==typeof t){var s=c[e.toLowerCase()];for(var u in s)if(s[u]===t){t=u;break}}n=d[e.toLowerCase()+"IFD"],r=this.SHORT(n);for(var l=0;r>l;l++)if(o=n+12*l+2,this.SHORT(o)==t){a=o+8;break}if(!a)return!1;try{this.write(a,i,4)}catch(m){return!1}return!0}var u,c,l,d,m,h;if(i.call(this,o),c={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"},thumb:{513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength"}},l={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}},d={tiffHeader:10},m=d.tiffHeader,u={clear:this.clear},e.extend(this,{read:function(){try{return r.prototype.read.apply(this,arguments)}catch(e){throw new n.ImageError(n.ImageError.INVALID_META_ERR)}},write:function(){try{return r.prototype.write.apply(this,arguments)}catch(e){throw new n.ImageError(n.ImageError.INVALID_META_ERR)}},UNDEFINED:function(){return this.BYTE.apply(this,arguments)},RATIONAL:function(e){return this.LONG(e)/this.LONG(e+4)},SRATIONAL:function(e){return this.SLONG(e)/this.SLONG(e+4)},ASCII:function(e){return this.CHAR(e)},TIFF:function(){return h||null},EXIF:function(){var t=null;if(d.exifIFD){try{t=a.call(this,d.exifIFD,c.exif)}catch(i){return null}if(t.ExifVersion&&"array"===e.typeOf(t.ExifVersion)){for(var n=0,r="";n<t.ExifVersion.length;n++)r+=String.fromCharCode(t.ExifVersion[n]);t.ExifVersion=r}}return t},GPS:function(){var t=null;if(d.gpsIFD){try{t=a.call(this,d.gpsIFD,c.gps)}catch(i){return null}t.GPSVersionID&&"array"===e.typeOf(t.GPSVersionID)&&(t.GPSVersionID=t.GPSVersionID.join("."))}return t},thumb:function(){if(d.IFD1)try{var e=a.call(this,d.IFD1,c.thumb);if("JPEGInterchangeFormat"in e)return this.SEGMENT(d.tiffHeader+e.JPEGInterchangeFormat,e.JPEGInterchangeFormatLength)}catch(t){}return null},setExif:function(e,t){return"PixelXDimension"!==e&&"PixelYDimension"!==e?!1:s.call(this,"exif",e,t)},clear:function(){u.clear(),o=c=l=h=d=u=null}}),65505!==this.SHORT(0)||"EXIF\0"!==this.STRING(4,5).toUpperCase())throw new n.ImageError(n.ImageError.INVALID_META_ERR);if(this.littleEndian=18761==this.SHORT(m),42!==this.SHORT(m+=2))throw new n.ImageError(n.ImageError.INVALID_META_ERR);d.IFD0=d.tiffHeader+this.LONG(m+=2),h=a.call(this,d.IFD0,c.tiff),"ExifIFDPointer"in h&&(d.exifIFD=d.tiffHeader+h.ExifIFDPointer,delete h.ExifIFDPointer),"GPSInfoIFDPointer"in h&&(d.gpsIFD=d.tiffHeader+h.GPSInfoIFDPointer,delete h.GPSInfoIFDPointer),e.isEmptyObj(h)&&(h=null);var f=this.LONG(d.IFD0+12*this.SHORT(d.IFD0)+2);f&&(d.IFD1=d.tiffHeader+f)}return r.prototype=i.prototype,r}),n("moxie/runtime/html5/image/JPEG",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEGHeaders","moxie/runtime/html5/utils/BinaryReader","moxie/runtime/html5/image/ExifParser"],function(e,t,i,n,r){function o(o){function a(e){var t,i,n=0;for(e||(e=c);n<=e.length();){if(t=e.SHORT(n+=2),t>=65472&&65475>=t)return n+=5,{height:e.SHORT(n),width:e.SHORT(n+=2)};i=e.SHORT(n+=2),n+=i-2}return null}function s(){var e,t,i=d.thumb();return i&&(e=new n(i),t=a(e),e.clear(),t)?(t.data=i,t):null}function u(){d&&l&&c&&(d.clear(),l.purge(),c.clear(),m=l=d=c=null)}var c,l,d,m;if(c=new n(o),65496!==c.SHORT(0))throw new t.ImageError(t.ImageError.WRONG_FORMAT);l=new i(o);try{d=new r(l.get("app1")[0])}catch(h){}m=a.call(this),e.extend(this,{type:"image/jpeg",size:c.length(),width:m&&m.width||0,height:m&&m.height||0,setExif:function(t,i){return d?("object"===e.typeOf(t)?e.each(t,function(e,t){d.setExif(t,e)}):d.setExif(t,i),l.set("app1",d.SEGMENT()),void 0):!1},writeHeaders:function(){return arguments.length?l.restore(arguments[0]):l.restore(o)},stripHeaders:function(e){return l.strip(e)},purge:function(){u.call(this)}}),d&&(this.meta={tiff:d.TIFF(),exif:d.EXIF(),gps:d.GPS(),thumb:s()})}return o}),n("moxie/runtime/html5/image/PNG",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader"],function(e,t,i){function n(n){function r(){var e,t;return e=a.call(this,8),"IHDR"==e.type?(t=e.start,{width:s.LONG(t),height:s.LONG(t+=4)}):null}function o(){s&&(s.clear(),n=l=u=c=s=null)}function a(e){var t,i,n,r;return t=s.LONG(e),i=s.STRING(e+=4,4),n=e+=4,r=s.LONG(e+t),{length:t,type:i,start:n,CRC:r}}var s,u,c,l;s=new i(n),function(){var t=0,i=0,n=[35152,20039,3338,6666];for(i=0;i<n.length;i++,t+=2)if(n[i]!=s.SHORT(t))throw new e.ImageError(e.ImageError.WRONG_FORMAT)}(),l=r.call(this),t.extend(this,{type:"image/png",size:s.length(),width:l.width,height:l.height,purge:function(){o.call(this)}}),o.call(this)}return n}),n("moxie/runtime/html5/image/ImageInfo",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEG","moxie/runtime/html5/image/PNG"],function(e,t,i,n){return function(r){var o,a=[i,n];o=function(){for(var e=0;e<a.length;e++)try{return new a[e](r)}catch(i){}throw new t.ImageError(t.ImageError.WRONG_FORMAT)}(),e.extend(this,{type:"",size:0,width:0,height:0,setExif:function(){},writeHeaders:function(e){return e},stripHeaders:function(e){return e},purge:function(){r=null}}),e.extend(this,o),this.purge=function(){o.purge(),o=null}}}),n("moxie/runtime/html5/image/ResizerCanvas",[],function(){function e(i,n){var r=i.width,o=Math.floor(r*n),a=!1;(.5>n||n>2)&&(n=.5>n?.5:2,a=!0);var s=t(i,n);return a?e(s,o/s.width):s}function t(e,t){var i=e.width,n=e.height,r=Math.floor(i*t),o=Math.floor(n*t),a=document.createElement("canvas");return a.width=r,a.height=o,a.getContext("2d").drawImage(e,0,0,i,n,0,0,r,o),e=null,a}return{scale:e}}),n("moxie/runtime/html5/image/Image",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/File","moxie/runtime/html5/image/ImageInfo","moxie/runtime/html5/image/ResizerCanvas","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,a,s,u){function c(){function e(){if(!v&&!g)throw new i.ImageError(i.DOMException.INVALID_STATE_ERR);return v||g}function c(){var t=e();return"canvas"==t.nodeName.toLowerCase()?t:(v=document.createElement("canvas"),v.width=t.width,v.height=t.height,v.getContext("2d").drawImage(t,0,0),v)}function l(e){return n.atob(e.substring(e.indexOf("base64,")+7))}function d(e,t){return"data:"+(t||"")+";base64,"+n.btoa(e)}function m(e){var t=this;g=new Image,g.onerror=function(){p.call(this),t.trigger("error",i.ImageError.WRONG_FORMAT)},g.onload=function(){t.trigger("load")},g.src="data:"==e.substr(0,5)?e:d(e,w.type)}function h(e,t){var n,r=this;return window.FileReader?(n=new FileReader,n.onload=function(){t(this.result)},n.onerror=function(){r.trigger("error",i.ImageError.WRONG_FORMAT)},n.readAsDataURL(e),void 0):t(e.getAsDataURL())}function f(e,i){var n=Math.PI/180,r=document.createElement("canvas"),o=r.getContext("2d"),a=e.width,s=e.height;switch(t.inArray(i,[5,6,7,8])>-1?(r.width=s,r.height=a):(r.width=a,r.height=s),i){case 2:o.translate(a,0),o.scale(-1,1);break;case 3:o.translate(a,s),o.rotate(180*n);break;case 4:o.translate(0,s),o.scale(1,-1);break;case 5:o.rotate(90*n),o.scale(1,-1);break;case 6:o.rotate(90*n),o.translate(0,-s);break;case 7:o.rotate(90*n),o.translate(a,-s),o.scale(-1,1);break;case 8:o.rotate(-90*n),o.translate(-a,0)}return o.drawImage(e,0,0,a,s),r}function p(){x&&(x.purge(),x=null),y=g=v=w=null,b=!1}var g,x,v,y,w,E=this,b=!1,R=!0;t.extend(this,{loadFromBlob:function(e){var t=this,n=t.getRuntime(),r=arguments.length>1?arguments[1]:!0;if(!n.can("access_binary"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);return w=e,e.isDetached()?(y=e.getSource(),m.call(this,y),void 0):(h.call(this,e.getSource(),function(e){r&&(y=l(e)),m.call(t,e)}),void 0)},loadFromImage:function(e,t){this.meta=e.meta,w=new o(null,{name:e.name,size:e.size,type:e.type}),m.call(this,t?y=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var t,i=this.getRuntime();return!x&&y&&i.can("access_image_binary")&&(x=new a(y)),t={width:e().width||0,height:e().height||0,type:w.type||u.getFileMime(w.name),size:y&&y.length||w.size||0,name:w.name||"",meta:null},R&&(t.meta=x&&x.meta||this.meta||{},!t.meta||!t.meta.thumb||t.meta.thumb.data instanceof r||(t.meta.thumb.data=new r(null,{type:"image/jpeg",data:t.meta.thumb.data}))),t},resize:function(t,i,n){var r=document.createElement("canvas");if(r.width=t.width,r.height=t.height,r.getContext("2d").drawImage(e(),t.x,t.y,t.width,t.height,0,0,r.width,r.height),v=s.scale(r,i),R=n.preserveHeaders,!R){var o=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1;v=f(v,o)}this.width=v.width,this.height=v.height,b=!0,this.trigger("Resize")},getAsCanvas:function(){return v||(v=c()),v.id=this.uid+"_canvas",v},getAsBlob:function(e,t){return e!==this.type?(b=!0,new o(null,{name:w.name||"",type:e,data:E.getAsDataURL(e,t)})):new o(null,{name:w.name||"",type:e,data:E.getAsBinaryString(e,t)})},getAsDataURL:function(e){var t=arguments[1]||90;if(!b)return g.src;if(c(),"image/jpeg"!==e)return v.toDataURL("image/png");try{return v.toDataURL("image/jpeg",t/100)}catch(i){return v.toDataURL("image/jpeg")}},getAsBinaryString:function(e,t){if(!b)return y||(y=l(E.getAsDataURL(e,t))),y;if("image/jpeg"!==e)y=l(E.getAsDataURL(e,t));else{var i;t||(t=90),c();try{i=v.toDataURL("image/jpeg",t/100)}catch(n){i=v.toDataURL("image/jpeg")}y=l(i),x&&(y=x.stripHeaders(y),R&&(x.meta&&x.meta.exif&&x.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),y=x.writeHeaders(y)),x.purge(),x=null)}return b=!1,y},destroy:function(){E=null,p.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}return e.Image=c}),n("moxie/runtime/flash/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(e,t,i,n,o){function a(){var e;try{e=navigator.plugins["Shockwave Flash"],e=e.description}catch(t){try{e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(i){e="0.0"}}return e=e.match(/\d+/g),parseFloat(e[0]+"."+e[1])}function s(e){var n=i.get(e);n&&"OBJECT"==n.nodeName&&("IE"===t.browser?(n.style.display="none",function r(){4==n.readyState?u(e):setTimeout(r,10)}()):n.parentNode.removeChild(n))}function u(e){var t=i.get(e);if(t){for(var n in t)"function"==typeof t[n]&&(t[n]=null);t.parentNode.removeChild(t)}}function c(u){var c,m=this;u=e.extend({swf_url:t.swf_url},u),o.call(this,u,l,{access_binary:function(e){return e&&"browser"===m.mode},access_image_binary:function(e){return e&&"browser"===m.mode},display_media:o.capTest(r("moxie/image/Image")),do_cors:o.capTrue,drag_and_drop:!1,report_upload_progress:function(){return"client"===m.mode},resize_image:o.capTrue,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!e.arrayDiff(t,["","text","document"])||"browser"===m.mode},return_status_code:function(t){return"browser"===m.mode||!e.arrayDiff(t,[200,404])},select_file:o.capTrue,select_multiple:o.capTrue,send_binary_string:function(e){return e&&"browser"===m.mode},send_browser_cookies:function(e){return e&&"browser"===m.mode},send_custom_headers:function(e){return e&&"browser"===m.mode},send_multipart:o.capTrue,slice_blob:function(e){return e&&"browser"===m.mode},stream_upload:function(e){return e&&"browser"===m.mode},summon_file_dialog:!1,upload_filesize:function(t){return e.parseSizeStr(t)<=2097152||"client"===m.mode},use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}},{access_binary:function(e){return e?"browser":"client"},access_image_binary:function(e){return e?"browser":"client"},report_upload_progress:function(e){return e?"browser":"client"},return_response_type:function(t){return e.arrayDiff(t,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"browser":["client","browser"]},send_binary_string:function(e){return e?"browser":"client"},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"browser":"client"},slice_blob:function(e){return e?"browser":"client"},stream_upload:function(e){return e?"client":"browser"},upload_filesize:function(t){return e.parseSizeStr(t)>=2097152?"client":"browser"}},"client"),a()<11.3&&(this.mode=!1),e.extend(this,{getShim:function(){return i.get(this.uid)},shimExec:function(e,t){var i=[].slice.call(arguments,2);return m.getShim().exec(this.uid,e,t,i)},init:function(){var i,r,o;o=this.getShimContainer(),e.extend(o.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),i='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+u.swf_url+'" ',"IE"===t.browser&&(i+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),i+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+u.swf_url+'" />'+'<param name="flashvars" value="uid='+escape(this.uid)+"&target="+t.global_event_dispatcher+'" />'+'<param name="wmode" value="transparent" />'+'<param name="allowscriptaccess" value="always" />'+"</object>","IE"===t.browser?(r=document.createElement("div"),o.appendChild(r),r.outerHTML=i,r=o=null):o.innerHTML=i,c=setTimeout(function(){m&&!m.initialized&&m.trigger("Error",new n.RuntimeError(n.RuntimeError.NOT_INIT_ERR))},5e3)},destroy:function(e){return function(){s(m.uid),e.call(m),clearTimeout(c),u=c=e=m=null}}(this.destroy)},d)}var l="flash",d={};return o.addConstructor(l,c),d}),n("moxie/runtime/flash/file/Blob",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(e,t){var i={slice:function(e,i,n,r){var o=this.getRuntime();return 0>i?i=Math.max(e.size+i,0):i>0&&(i=Math.min(i,e.size)),0>n?n=Math.max(e.size+n,0):n>0&&(n=Math.min(n,e.size)),e=o.shimExec.call(this,"Blob","slice",i,n,r||""),e&&(e=new t(o.uid,e)),e}};return e.Blob=i}),n("moxie/runtime/flash/file/FileInput",["moxie/runtime/flash/Runtime","moxie/file/File","moxie/core/utils/Basic"],function(e,t,i){var n={init:function(e){var n=this,r=this.getRuntime();this.bind("Change",function(){var e=r.shimExec.call(n,"FileInput","getFiles");n.files=[],i.each(e,function(e){n.files.push(new t(r.uid,e))})},999),this.getRuntime().shimExec.call(this,"FileInput","init",{accept:e.accept,multiple:e.multiple}),this.trigger("ready")}};return e.FileInput=n}),n("moxie/runtime/flash/file/FileReader",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(e,t){function i(e,i){switch(i){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var n={read:function(e,t){var n=this;return n.result="","readAsDataURL"===e&&(n.result="data:"+(t.type||"")+";base64,"),n.bind("Progress",function(t,r){r&&(n.result+=i(r,e))},999),n.getRuntime().shimExec.call(this,"FileReader","readAsBase64",t.uid)}};return e.FileReader=n}),n("moxie/runtime/flash/file/FileReaderSync",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(e,t){function i(e,i){switch(i){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var n={read:function(e,t){var n,r=this.getRuntime();return(n=r.shimExec.call(this,"FileReaderSync","readAsBase64",t.uid))?("readAsDataURL"===e&&(n="data:"+(t.type||"")+";base64,"+n),i(n,e,t.type)):null}};return e.FileReaderSync=n}),n("moxie/runtime/flash/runtime/Transporter",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(e,t){var i={getAsBlob:function(e){var i=this.getRuntime(),n=i.shimExec.call(this,"Transporter","getAsBlob",e);return n?new t(i.uid,n):null}};return e.Transporter=i}),n("moxie/runtime/flash/xhr/XMLHttpRequest",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/file/Blob","moxie/file/File","moxie/file/FileReaderSync","moxie/runtime/flash/file/FileReaderSync","moxie/xhr/FormData","moxie/runtime/Transporter","moxie/runtime/flash/runtime/Transporter"],function(e,t,i,n,r,o,a,s){var u={send:function(e,n){function r(){e.transport=l.mode,l.shimExec.call(c,"XMLHttpRequest","send",e,n)}function o(e,t){l.shimExec.call(c,"XMLHttpRequest","appendBlob",e,t.uid),n=null,r()}function u(e,t){var i=new s;i.bind("TransportingComplete",function(){t(this.result)}),i.transport(e.getSource(),e.type,{ruid:l.uid})}var c=this,l=c.getRuntime();if(t.isEmptyObj(e.headers)||t.each(e.headers,function(e,t){l.shimExec.call(c,"XMLHttpRequest","setRequestHeader",t,e.toString())}),n instanceof a){var d;if(n.each(function(e,t){e instanceof i?d=t:l.shimExec.call(c,"XMLHttpRequest","append",t,e)}),n.hasBlob()){var m=n.getBlob();m.isDetached()?u(m,function(e){m.destroy(),o(d,e)}):o(d,m)}else n=null,r()}else n instanceof i?n.isDetached()?u(n,function(e){n.destroy(),n=e.uid,r()}):(n=n.uid,r()):r()},getResponse:function(e){var i,o,a=this.getRuntime();if(o=a.shimExec.call(this,"XMLHttpRequest","getResponseAsBlob")){if(o=new n(a.uid,o),"blob"===e)return o;try{if(i=new r,~t.inArray(e,["","text"]))return i.readAsText(o);if("json"===e&&window.JSON)return JSON.parse(i.readAsText(o))}finally{o.destroy()}}return null},abort:function(){var e=this.getRuntime();e.shimExec.call(this,"XMLHttpRequest","abort"),this.dispatchEvent("readystatechange"),this.dispatchEvent("abort")}};return e.XMLHttpRequest=u}),n("moxie/runtime/flash/image/Image",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/runtime/Transporter","moxie/file/Blob","moxie/file/FileReaderSync"],function(e,t,i,n,r){var o={loadFromBlob:function(e){function t(e){r.shimExec.call(n,"Image","loadFromBlob",e.uid),n=r=null}var n=this,r=n.getRuntime();if(e.isDetached()){var o=new i;o.bind("TransportingComplete",function(){t(o.result.getSource())}),o.transport(e.getSource(),e.type,{ruid:r.uid})}else t(e.getSource())},loadFromImage:function(e){var t=this.getRuntime();return t.shimExec.call(this,"Image","loadFromImage",e.uid)},getInfo:function(){var e=this.getRuntime(),t=e.shimExec.call(this,"Image","getInfo");return!t.meta||!t.meta.thumb||t.meta.thumb.data instanceof n||(t.meta.thumb.data=new n(e.uid,t.meta.thumb.data)),t},getAsBlob:function(e,t){var i=this.getRuntime(),r=i.shimExec.call(this,"Image","getAsBlob",e,t);return r?new n(i.uid,r):null},getAsDataURL:function(){var e,t=this.getRuntime(),i=t.Image.getAsBlob.apply(this,arguments);return i?(e=new r,e.readAsDataURL(i)):null}};return e.Image=o}),n("moxie/runtime/silverlight/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(e,t,i,n,o){function a(e){var t,i,n,r,o,a=!1,s=null,u=0;try{try{s=new ActiveXObject("AgControl.AgControl"),s.IsVersionSupported(e)&&(a=!0),s=null}catch(c){var l=navigator.plugins["Silverlight Plug-In"];if(l){for(t=l.description,"1.0.30226.2"===t&&(t="2.0.30226.2"),i=t.split(".");i.length>3;)i.pop();for(;i.length<4;)i.push(0);for(n=e.split(".");n.length>4;)n.pop();do r=parseInt(n[u],10),o=parseInt(i[u],10),u++;while(u<n.length&&r===o);o>=r&&!isNaN(r)&&(a=!0)}}}catch(d){a=!1}return a}function s(s){var l,d=this;s=e.extend({xap_url:t.xap_url},s),o.call(this,s,u,{access_binary:o.capTrue,access_image_binary:o.capTrue,display_media:o.capTest(r("moxie/image/Image")),do_cors:o.capTrue,drag_and_drop:!1,report_upload_progress:o.capTrue,resize_image:o.capTrue,return_response_headers:function(e){return e&&"client"===d.mode},return_response_type:function(e){return"json"!==e?!0:!!window.JSON},return_status_code:function(t){return"client"===d.mode||!e.arrayDiff(t,[200,404])},select_file:o.capTrue,select_multiple:o.capTrue,send_binary_string:o.capTrue,send_browser_cookies:function(e){return e&&"browser"===d.mode},send_custom_headers:function(e){return e&&"client"===d.mode},send_multipart:o.capTrue,slice_blob:o.capTrue,stream_upload:!0,summon_file_dialog:!1,upload_filesize:o.capTrue,use_http_method:function(t){return"client"===d.mode||!e.arrayDiff(t,["GET","POST"])}},{return_response_headers:function(e){return e?"client":"browser"},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"client":["client","browser"]},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"client":"browser"},use_http_method:function(t){return e.arrayDiff(t,["GET","POST"])?"client":["client","browser"]}}),a("2.0.31005.0")&&"Opera"!==t.browser||(this.mode=!1),e.extend(this,{getShim:function(){return i.get(this.uid).content.Moxie},shimExec:function(e,t){var i=[].slice.call(arguments,2);return d.getShim().exec(this.uid,e,t,i)},init:function(){var e;e=this.getShimContainer(),e.innerHTML='<object id="'+this.uid+'" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">'+'<param name="source" value="'+s.xap_url+'"/>'+'<param name="background" value="Transparent"/>'+'<param name="windowless" value="true"/>'+'<param name="enablehtmlaccess" value="true"/>'+'<param name="initParams" value="uid='+this.uid+",target="+t.global_event_dispatcher+'"/>'+"</object>",l=setTimeout(function(){d&&!d.initialized&&d.trigger("Error",new n.RuntimeError(n.RuntimeError.NOT_INIT_ERR))},"Windows"!==t.OS?1e4:5e3)},destroy:function(e){return function(){e.call(d),clearTimeout(l),s=l=e=d=null}}(this.destroy)},c)}var u="silverlight",c={};return o.addConstructor(u,s),c}),n("moxie/runtime/silverlight/file/Blob",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/Blob"],function(e,t,i){return e.Blob=t.extend({},i)}),n("moxie/runtime/silverlight/file/FileInput",["moxie/runtime/silverlight/Runtime","moxie/file/File","moxie/core/utils/Basic"],function(e,t,i){function n(e){for(var t="",i=0;i<e.length;i++)t+=(""!==t?"|":"")+e[i].title+" | *."+e[i].extensions.replace(/,/g,";*.");return t}var r={init:function(e){var r=this,o=this.getRuntime();this.bind("Change",function(){var e=o.shimExec.call(r,"FileInput","getFiles");r.files=[],i.each(e,function(e){r.files.push(new t(o.uid,e))})},999),o.shimExec.call(this,"FileInput","init",n(e.accept),e.multiple),this.trigger("ready")},setOption:function(e,t){"accept"==e&&(t=n(t)),this.getRuntime().shimExec.call(this,"FileInput","setOption",e,t)}};return e.FileInput=r}),n("moxie/runtime/silverlight/file/FileDrop",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Dom","moxie/core/utils/Events"],function(e,t,i){var n={init:function(){var e,n=this,r=n.getRuntime();return e=r.getShimContainer(),i.addEvent(e,"dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},n.uid),i.addEvent(e,"dragenter",function(e){e.preventDefault();var i=t.get(r.uid).dragEnter(e);i&&e.stopPropagation()},n.uid),i.addEvent(e,"drop",function(e){e.preventDefault();var i=t.get(r.uid).dragDrop(e);i&&e.stopPropagation()},n.uid),r.shimExec.call(this,"FileDrop","init")}};return e.FileDrop=n}),n("moxie/runtime/silverlight/file/FileReader",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/FileReader"],function(e,t,i){return e.FileReader=t.extend({},i)}),n("moxie/runtime/silverlight/file/FileReaderSync",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/FileReaderSync"],function(e,t,i){return e.FileReaderSync=t.extend({},i)
  7352. }),n("moxie/runtime/silverlight/runtime/Transporter",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/runtime/Transporter"],function(e,t,i){return e.Transporter=t.extend({},i)}),n("moxie/runtime/silverlight/xhr/XMLHttpRequest",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/xhr/XMLHttpRequest","moxie/runtime/silverlight/file/FileReaderSync","moxie/runtime/silverlight/runtime/Transporter"],function(e,t,i){return e.XMLHttpRequest=t.extend({},i)}),n("moxie/runtime/silverlight/image/Image",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/file/Blob","moxie/runtime/flash/image/Image"],function(e,t,i,n){return e.Image=t.extend({},n,{getInfo:function(){var e=this.getRuntime(),n=["tiff","exif","gps","thumb"],r={meta:{}},o=e.shimExec.call(this,"Image","getInfo");return o.meta&&(t.each(n,function(e){var t,i,n,a,s=o.meta[e];if(s&&s.keys)for(r.meta[e]={},i=0,n=s.keys.length;n>i;i++)t=s.keys[i],a=s[t],a&&(/^(\d|[1-9]\d+)$/.test(a)?a=parseInt(a,10):/^\d*\.\d+$/.test(a)&&(a=parseFloat(a)),r.meta[e][t]=a)}),!r.meta||!r.meta.thumb||r.meta.thumb.data instanceof i||(r.meta.thumb.data=new i(e.uid,r.meta.thumb.data))),r.width=parseInt(o.width,10),r.height=parseInt(o.height,10),r.size=parseInt(o.size,10),r.type=o.type,r.name=o.name,r},resize:function(e,t,i){this.getRuntime().shimExec.call(this,"Image","resize",e.x,e.y,e.width,e.height,t,i.preserveHeaders,i.resample)}})}),n("moxie/runtime/html4/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(e,t,i,n){function o(t){var o=this,u=i.capTest,c=i.capTrue;i.call(this,t,a,{access_binary:u(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:u((n.can("create_canvas")||n.can("use_data_uri_over32kb"))&&r("moxie/image/Image")),do_cors:!1,drag_and_drop:!1,filter_by_extension:u(function(){return!("Chrome"===n.browser&&n.verComp(n.version,28,"<")||"IE"===n.browser&&n.verComp(n.version,10,"<")||"Safari"===n.browser&&n.verComp(n.version,7,"<")||"Firefox"===n.browser&&n.verComp(n.version,37,"<"))}()),resize_image:function(){return s.Image&&o.can("access_binary")&&n.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!!~e.inArray(t,["text","document",""])},return_status_code:function(t){return!e.arrayDiff(t,[200,404])},select_file:function(){return n.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return o.can("select_file")},summon_file_dialog:function(){return o.can("select_file")&&("Firefox"===n.browser&&n.verComp(n.version,4,">=")||"Opera"===n.browser&&n.verComp(n.version,12,">=")||"IE"===n.browser&&n.verComp(n.version,10,">=")||!!~e.inArray(n.browser,["Chrome","Safari"]))},upload_filesize:c,use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}}),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),s)}var a="html4",s={};return i.addConstructor(a,o),s}),n("moxie/runtime/html4/file/FileInput",["moxie/runtime/html4/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,a){function s(){function e(){var o,c,d,m,h,f,p=this,g=p.getRuntime();f=i.guid("uid_"),o=g.getShimContainer(),s&&(d=n.get(s+"_form"),d&&i.extend(d.style,{top:"100%"})),m=document.createElement("form"),m.setAttribute("id",f+"_form"),m.setAttribute("method","post"),m.setAttribute("enctype","multipart/form-data"),m.setAttribute("encoding","multipart/form-data"),i.extend(m.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),h=document.createElement("input"),h.setAttribute("id",f),h.setAttribute("type","file"),h.setAttribute("accept",l.join(",")),i.extend(h.style,{fontSize:"999px",opacity:0}),m.appendChild(h),o.appendChild(m),i.extend(h.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"IE"===a.browser&&a.verComp(a.version,10,"<")&&i.extend(h.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}),h.onchange=function(){var i;if(this.value){if(this.files){if(i=this.files[0],0===i.size)return m.parentNode.removeChild(m),void 0}else i={name:this.value};i=new t(g.uid,i),this.onchange=function(){},e.call(p),p.files=[i],h.setAttribute("id",i.uid),m.setAttribute("id",i.uid+"_form"),p.trigger("change"),h=m=null}},g.can("summon_file_dialog")&&(c=n.get(u.browse_button),r.removeEvent(c,"click",p.uid),r.addEvent(c,"click",function(e){h&&!h.disabled&&h.click(),e.preventDefault()},p.uid)),s=f,o=d=c=null}var s,u,c,l=[];i.extend(this,{init:function(t){var i,a=this,s=a.getRuntime();u=t,l=t.accept.mimes||o.extList2mimes(t.accept,s.can("filter_by_extension")),i=s.getShimContainer(),function(){var e,o,l;e=n.get(t.browse_button),c=n.getStyle(e,"z-index")||"auto",s.can("summon_file_dialog")&&("static"===n.getStyle(e,"position")&&(e.style.position="relative"),a.bind("Refresh",function(){o=parseInt(c,10)||1,n.get(u.browse_button).style.zIndex=o,this.getRuntime().getShimContainer().style.zIndex=o-1})),l=s.can("summon_file_dialog")?e:i,r.addEvent(l,"mouseover",function(){a.trigger("mouseenter")},a.uid),r.addEvent(l,"mouseout",function(){a.trigger("mouseleave")},a.uid),r.addEvent(l,"mousedown",function(){a.trigger("mousedown")},a.uid),r.addEvent(n.get(t.container),"mouseup",function(){a.trigger("mouseup")},a.uid),e=null}(),e.call(this),i=null,a.trigger({type:"ready",async:!0})},setOption:function(e,t){var i,r=this.getRuntime();"accept"==e&&(l=t.mimes||o.extList2mimes(t,r.can("filter_by_extension"))),i=n.get(s),i&&i.setAttribute("accept",l.join(","))},disable:function(e){var t;(t=n.get(s))&&(t.disabled=!!e)},destroy:function(){var e=this.getRuntime(),t=e.getShim(),i=e.getShimContainer(),o=u&&n.get(u.container),a=u&&n.get(u.browse_button);o&&r.removeAllEvents(o,this.uid),a&&(r.removeAllEvents(a,this.uid),a.style.zIndex=c),i&&(r.removeAllEvents(i,this.uid),i.innerHTML=""),t.removeInstance(this.uid),s=l=u=i=o=a=t=null}})}return e.FileInput=s}),n("moxie/runtime/html4/file/FileReader",["moxie/runtime/html4/Runtime","moxie/runtime/html5/file/FileReader"],function(e,t){return e.FileReader=t}),n("moxie/runtime/html4/xhr/XMLHttpRequest",["moxie/runtime/html4/Runtime","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Url","moxie/core/Exceptions","moxie/core/utils/Events","moxie/file/Blob","moxie/xhr/FormData"],function(e,t,i,n,r,o,a,s){function u(){function e(e){var t,n,r,a,s=this,u=!1;if(l){if(t=l.id.replace(/_iframe$/,""),n=i.get(t+"_form")){for(r=n.getElementsByTagName("input"),a=r.length;a--;)switch(r[a].getAttribute("type")){case"hidden":r[a].parentNode.removeChild(r[a]);break;case"file":u=!0}r=[],u||n.parentNode.removeChild(n),n=null}setTimeout(function(){o.removeEvent(l,"load",s.uid),l.parentNode&&l.parentNode.removeChild(l);var t=s.getRuntime().getShimContainer();t.children.length||t.parentNode.removeChild(t),t=l=null,e()},1)}}var u,c,l;t.extend(this,{send:function(d,m){function h(){var i=y.getShimContainer()||document.body,r=document.createElement("div");r.innerHTML='<iframe id="'+f+'_iframe" name="'+f+'_iframe" src="javascript:&quot;&quot;" style="display:none"></iframe>',l=r.firstChild,i.appendChild(l),o.addEvent(l,"load",function(){var i;try{i=l.contentWindow.document||l.contentDocument||window.frames[l.id].document,/^4(0[0-9]|1[0-7]|2[2346])\s/.test(i.title)?u=i.title.replace(/^(\d+).*$/,"$1"):(u=200,c=t.trim(i.body.innerHTML),v.trigger({type:"progress",loaded:c.length,total:c.length}),x&&v.trigger({type:"uploadprogress",loaded:x.size||1025,total:x.size||1025}))}catch(r){if(!n.hasSameOrigin(d.url))return e.call(v,function(){v.trigger("error")}),void 0;u=404}e.call(v,function(){v.trigger("load")})},v.uid)}var f,p,g,x,v=this,y=v.getRuntime();if(u=c=null,m instanceof s&&m.hasBlob()){if(x=m.getBlob(),f=x.uid,g=i.get(f),p=i.get(f+"_form"),!p)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR)}else f=t.guid("uid_"),p=document.createElement("form"),p.setAttribute("id",f+"_form"),p.setAttribute("method",d.method),p.setAttribute("enctype","multipart/form-data"),p.setAttribute("encoding","multipart/form-data"),y.getShimContainer().appendChild(p);p.setAttribute("target",f+"_iframe"),m instanceof s&&m.each(function(e,i){if(e instanceof a)g&&g.setAttribute("name",i);else{var n=document.createElement("input");t.extend(n,{type:"hidden",name:i,value:e}),g?p.insertBefore(n,g):p.appendChild(n)}}),p.setAttribute("action",d.url),h(),p.submit(),v.trigger("loadstart")},getStatus:function(){return u},getResponse:function(e){if("json"===e&&"string"===t.typeOf(c)&&window.JSON)try{return JSON.parse(c.replace(/^\s*<pre[^>]*>/,"").replace(/<\/pre>\s*$/,""))}catch(i){return null}return c},abort:function(){var t=this;l&&l.contentWindow&&(l.contentWindow.stop?l.contentWindow.stop():l.contentWindow.document.execCommand?l.contentWindow.document.execCommand("Stop"):l.src="about:blank"),e.call(this,function(){t.dispatchEvent("abort")})}})}return e.XMLHttpRequest=u}),n("moxie/runtime/html4/image/Image",["moxie/runtime/html4/Runtime","moxie/runtime/html5/image/Image"],function(e,t){return e.Image=t}),a(["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Dom","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/Blob","moxie/core/I18n","moxie/core/utils/Mime","moxie/file/FileInput","moxie/file/File","moxie/file/FileDrop","moxie/file/FileReader","moxie/core/utils/Url","moxie/runtime/RuntimeTarget","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/runtime/Transporter","moxie/image/Image","moxie/core/utils/Events","moxie/runtime/html5/image/ResizerCanvas"])}(this)});
  7353. define("../libs/plupload/js/moxie.min", function(){});
  7354. /**
  7355. * Plupload - multi-runtime File Uploader
  7356. * v2.2.1
  7357. *
  7358. * Copyright 2013, Moxiecode Systems AB
  7359. * Released under GPL License.
  7360. *
  7361. * License: http://www.plupload.com/license
  7362. * Contributing: http://www.plupload.com/contributing
  7363. *
  7364. * Date: 2016-11-23
  7365. */
  7366. !function(e,t){var i=function(){var e={};return t.apply(e,arguments),e.plupload};"function"==typeof define&&define.amd?define("plupload",["./moxie"],i):"object"==typeof module&&module.exports?module.exports=i(require("./moxie")):e.plupload=i(e.moxie)}(this||window,function(e){!function(e,t,i){function n(e){function t(e,t,i){var r={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",urlstream_upload:"send_binary_string",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};r[e]?n[r[e]]=t:i||(n[e]=t)}var i=e.required_features,n={};return"string"==typeof i?l.each(i.split(/\s*,\s*/),function(e){t(e,!0)}):"object"==typeof i?l.each(i,function(e,i){t(i,e)}):i===!0&&(e.chunk_size>0&&(n.slice_blob=!0),l.isEmptyObj(e.resize)&&e.multipart||(n.send_binary_string=!0),l.each(e,function(e,i){t(i,!!e,!0)})),n}var r=window.setTimeout,s={},a=t.core.utils,o=t.runtime.Runtime,l={VERSION:"2.2.1",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:a.Mime.mimes,ua:a.Env,typeOf:a.Basic.typeOf,extend:a.Basic.extend,guid:a.Basic.guid,getAll:function(e){var t,i=[];"array"!==l.typeOf(e)&&(e=[e]);for(var n=e.length;n--;)t=l.get(e[n]),t&&i.push(t);return i.length?i:null},get:a.Dom.get,each:a.Basic.each,getPos:a.Dom.getPos,getSize:a.Dom.getSize,xmlEncode:function(e){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},i=/[<>&\"\']/g;return e?(""+e).replace(i,function(e){return t[e]?"&"+t[e]+";":e}):e},toArray:a.Basic.toArray,inArray:a.Basic.inArray,inSeries:a.Basic.inSeries,addI18n:t.core.I18n.addI18n,translate:t.core.I18n.translate,sprintf:a.Basic.sprintf,isEmptyObj:a.Basic.isEmptyObj,hasClass:a.Dom.hasClass,addClass:a.Dom.addClass,removeClass:a.Dom.removeClass,getStyle:a.Dom.getStyle,addEvent:a.Events.addEvent,removeEvent:a.Events.removeEvent,removeAllEvents:a.Events.removeAllEvents,cleanName:function(e){var t,i;for(i=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"],t=0;t<i.length;t+=2)e=e.replace(i[t],i[t+1]);return e=e.replace(/\s+/g,"_"),e=e.replace(/[^a-z0-9_\-\.]+/gi,"")},buildUrl:function(e,t){var i="";return l.each(t,function(e,t){i+=(i?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(e)}),i&&(e+=(e.indexOf("?")>0?"&":"?")+i),e},formatSize:function(e){function t(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}if(e===i||/\D/.test(e))return l.translate("N/A");var n=Math.pow(1024,4);return e>n?t(e/n,1)+" "+l.translate("tb"):e>(n/=1024)?t(e/n,1)+" "+l.translate("gb"):e>(n/=1024)?t(e/n,1)+" "+l.translate("mb"):e>1024?Math.round(e/1024)+" "+l.translate("kb"):e+" "+l.translate("b")},parseSize:a.Basic.parseSizeStr,predictRuntime:function(e,t){var i,n;return i=new l.Uploader(e),n=o.thatCan(i.getOption().required_features,t||e.runtimes),i.destroy(),n},addFileFilter:function(e,t){s[e]=t}};l.addFileFilter("mime_types",function(e,t,i){e.length&&!e.regexp.test(t.name)?(this.trigger("Error",{code:l.FILE_EXTENSION_ERROR,message:l.translate("File extension error."),file:t}),i(!1)):i(!0)}),l.addFileFilter("max_file_size",function(e,t,i){var n;e=l.parseSize(e),t.size!==n&&e&&t.size>e?(this.trigger("Error",{code:l.FILE_SIZE_ERROR,message:l.translate("File size error."),file:t}),i(!1)):i(!0)}),l.addFileFilter("prevent_duplicates",function(e,t,i){if(e)for(var n=this.files.length;n--;)if(t.name===this.files[n].name&&t.size===this.files[n].size)return this.trigger("Error",{code:l.FILE_DUPLICATE_ERROR,message:l.translate("Duplicate file error."),file:t}),i(!1),void 0;i(!0)}),l.Uploader=function(e){function a(){var e,t,i=0;if(this.state==l.STARTED){for(t=0;t<T.length;t++)e||T[t].status!=l.QUEUED?i++:(e=T[t],this.trigger("BeforeUpload",e)&&(e.status=l.UPLOADING,this.trigger("UploadFile",e)));i==T.length&&(this.state!==l.STOPPED&&(this.state=l.STOPPED,this.trigger("StateChanged")),this.trigger("UploadComplete",T))}}function u(e){e.percent=e.size>0?Math.ceil(100*(e.loaded/e.size)):100,d()}function d(){var e,t;for(w.reset(),e=0;e<T.length;e++)t=T[e],t.size!==i?(w.size+=t.origSize,w.loaded+=t.loaded*t.origSize/t.size):w.size=i,t.status==l.DONE?w.uploaded++:t.status==l.FAILED?w.failed++:w.queued++;w.size===i?w.percent=T.length>0?Math.ceil(100*(w.uploaded/T.length)):0:(w.bytesPerSec=Math.ceil(w.loaded/((+new Date-S||1)/1e3)),w.percent=w.size>0?Math.ceil(100*(w.loaded/w.size)):0)}function c(){var e=A[0]||P[0];return e?e.getRuntime().uid:!1}function f(e,t){if(e.ruid){var i=o.getInfo(e.ruid);if(i)return i.can(t)}return!1}function p(){this.bind("FilesAdded FilesRemoved",function(e){e.trigger("QueueChanged"),e.refresh()}),this.bind("CancelUpload",y),this.bind("BeforeUpload",m),this.bind("UploadFile",E),this.bind("UploadProgress",v),this.bind("StateChanged",b),this.bind("QueueChanged",d),this.bind("Error",z),this.bind("FileUploaded",R),this.bind("Destroy",O)}function g(e,i){var n=this,r=0,s=[],a={runtime_order:e.runtimes,required_caps:e.required_features,preferred_caps:F,swf_url:e.flash_swf_url,xap_url:e.silverlight_xap_url};l.each(e.runtimes.split(/\s*,\s*/),function(t){e[t]&&(a[t]=e[t])}),e.browse_button&&l.each(e.browse_button,function(i){s.push(function(s){var u=new t.file.FileInput(l.extend({},a,{accept:e.filters.mime_types,name:e.file_data_name,multiple:e.multi_selection,container:e.container,browse_button:i}));u.onready=function(){var e=o.getInfo(this.ruid);l.extend(n.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),multi_selection:e.can("select_multiple")}),r++,A.push(this),s()},u.onchange=function(){n.addFile(this.files)},u.bind("mouseenter mouseleave mousedown mouseup",function(t){U||(e.browse_button_hover&&("mouseenter"===t.type?l.addClass(i,e.browse_button_hover):"mouseleave"===t.type&&l.removeClass(i,e.browse_button_hover)),e.browse_button_active&&("mousedown"===t.type?l.addClass(i,e.browse_button_active):"mouseup"===t.type&&l.removeClass(i,e.browse_button_active)))}),u.bind("mousedown",function(){n.trigger("Browse")}),u.bind("error runtimeerror",function(){u=null,s()}),u.init()})}),e.drop_element&&l.each(e.drop_element,function(e){s.push(function(i){var s=new t.file.FileDrop(l.extend({},a,{drop_zone:e}));s.onready=function(){var e=o.getInfo(this.ruid);l.extend(n.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),dragdrop:e.can("drag_and_drop")}),r++,P.push(this),i()},s.ondrop=function(){n.addFile(this.files)},s.bind("error runtimeerror",function(){s=null,i()}),s.init()})}),l.inSeries(s,function(){"function"==typeof i&&i(r)})}function h(e,n,r){var s=new t.image.Image;try{s.onload=function(){return n.width>this.width&&n.height>this.height&&n.quality===i&&n.preserve_headers&&!n.crop?(this.destroy(),r(e)):(s.downsize(n.width,n.height,n.crop,n.preserve_headers),void 0)},s.onresize=function(){r(this.getAsBlob(e.type,n.quality)),this.destroy()},s.onerror=function(){r(e)},s.load(e)}catch(a){r(e)}}function _(e,i,r){function s(e,i,n){var r=I[e];switch(e){case"max_file_size":"max_file_size"===e&&(I.max_file_size=I.filters.max_file_size=i);break;case"chunk_size":(i=l.parseSize(i))&&(I[e]=i,I.send_file_name=!0);break;case"multipart":I[e]=i,i||(I.send_file_name=!0);break;case"unique_names":I[e]=i,i&&(I.send_file_name=!0);break;case"filters":"array"===l.typeOf(i)&&(i={mime_types:i}),n?l.extend(I.filters,i):I.filters=i,i.mime_types&&("string"===l.typeOf(i.mime_types)&&(i.mime_types=t.core.utils.Mime.mimes2extList(i.mime_types)),i.mime_types.regexp=function(e){var t=[];return l.each(e,function(e){l.each(e.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?t.push("\\.*"):t.push("\\."+e.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+t.join("|")+")$","i")}(i.mime_types),I.filters.mime_types=i.mime_types);break;case"resize":I.resize=i?l.extend({preserve_headers:!0,crop:!1},i):!1;break;case"prevent_duplicates":I.prevent_duplicates=I.filters.prevent_duplicates=!!i;break;case"container":case"browse_button":case"drop_element":i="container"===e?l.get(i):l.getAll(i);case"runtimes":case"multi_selection":case"flash_swf_url":case"silverlight_xap_url":I[e]=i,n||(u=!0);break;default:I[e]=i}n||a.trigger("OptionChanged",e,i,r)}var a=this,u=!1;"object"==typeof e?l.each(e,function(e,t){s(t,e,r)}):s(e,i,r),r?(I.required_features=n(l.extend({},I)),F=n(l.extend({},I,{required_features:!0}))):u&&(a.trigger("Destroy"),g.call(a,I,function(e){e?(a.runtime=o.getInfo(c()).type,a.trigger("Init",{runtime:a.runtime}),a.trigger("PostInit")):a.trigger("Error",{code:l.INIT_ERROR,message:l.translate("Init error.")})}))}function m(e,t){if(e.settings.unique_names){var i=t.name.match(/\.([^.]+)$/),n="part";i&&(n=i[1]),t.target_name=t.id+"."+n}}function E(e,i){function n(){d-->0?r(s,1e3):(i.loaded=p,e.trigger("Error",{code:l.HTTP_ERROR,message:l.translate("HTTP Error."),file:i,response:D.responseText,status:D.status,responseHeaders:D.getAllResponseHeaders()}))}function s(){var f,g,h,_={};i.status===l.UPLOADING&&e.state!==l.STOPPED&&(e.settings.send_file_name&&(_.name=i.target_name||i.name),u&&c.chunks&&a.size>u?(h=Math.min(u,a.size-p),f=a.slice(p,p+h)):(h=a.size,f=a),u&&c.chunks&&(e.settings.send_chunk_number?(_.chunk=Math.ceil(p/u),_.chunks=Math.ceil(a.size/u)):(_.offset=p,_.total=a.size)),D=new t.xhr.XMLHttpRequest,D.upload&&(D.upload.onprogress=function(t){i.loaded=Math.min(i.size,p+t.loaded),e.trigger("UploadProgress",i)}),D.onload=function(){return D.status>=400?(n(),void 0):(d=e.settings.max_retries,h<a.size?(f.destroy(),p+=h,i.loaded=Math.min(p,a.size),e.trigger("ChunkUploaded",i,{offset:i.loaded,total:a.size,response:D.responseText,status:D.status,responseHeaders:D.getAllResponseHeaders()}),"Android Browser"===l.ua.browser&&e.trigger("UploadProgress",i)):i.loaded=i.size,f=g=null,!p||p>=a.size?(i.size!=i.origSize&&(a.destroy(),a=null),e.trigger("UploadProgress",i),i.status=l.DONE,e.trigger("FileUploaded",i,{response:D.responseText,status:D.status,responseHeaders:D.getAllResponseHeaders()})):r(s,1),void 0)},D.onerror=function(){n()},D.onloadend=function(){this.destroy(),D=null},e.settings.multipart&&c.multipart?(D.open("post",o,!0),l.each(e.settings.headers,function(e,t){D.setRequestHeader(t,e)}),g=new t.xhr.FormData,l.each(l.extend(_,e.settings.multipart_params),function(e,t){g.append(t,e)}),g.append(e.settings.file_data_name,f),D.send(g,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:F,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})):(o=l.buildUrl(e.settings.url,l.extend(_,e.settings.multipart_params)),D.open("post",o,!0),l.each(e.settings.headers,function(e,t){D.setRequestHeader(t,e)}),D.hasRequestHeader("Content-Type")||D.setRequestHeader("Content-Type","application/octet-stream"),D.send(f,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:F,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})))}var a,o=e.settings.url,u=e.settings.chunk_size,d=e.settings.max_retries,c=e.features,p=0;i.loaded&&(p=i.loaded=u?u*Math.floor(i.loaded/u):0),a=i.getSource(),!l.isEmptyObj(e.settings.resize)&&f(a,"send_binary_string")&&-1!==l.inArray(a.type,["image/jpeg","image/png"])?h.call(this,a,e.settings.resize,function(e){a=e,i.size=e.size,s()}):s()}function v(e,t){u(t)}function b(e){if(e.state==l.STARTED)S=+new Date;else if(e.state==l.STOPPED)for(var t=e.files.length-1;t>=0;t--)e.files[t].status==l.UPLOADING&&(e.files[t].status=l.QUEUED,d())}function y(){D&&D.abort()}function R(e){d(),r(function(){a.call(e)},1)}function z(e,t){t.code===l.INIT_ERROR?e.destroy():t.code===l.HTTP_ERROR&&(t.file.status=l.FAILED,u(t.file),e.state==l.STARTED&&(e.trigger("CancelUpload"),r(function(){a.call(e)},1)))}function O(e){e.stop(),l.each(T,function(e){e.destroy()}),T=[],A.length&&(l.each(A,function(e){e.destroy()}),A=[]),P.length&&(l.each(P,function(e){e.destroy()}),P=[]),F={},U=!1,S=D=null,w.reset()}var I,S,w,D,x=l.guid(),T=[],F={},A=[],P=[],U=!1;I={runtimes:o.order,max_retries:0,chunk_size:0,multipart:!0,multi_selection:!0,file_data_name:"file",flash_swf_url:"js/Moxie.swf",silverlight_xap_url:"js/Moxie.xap",filters:{mime_types:[],prevent_duplicates:!1,max_file_size:0},resize:!1,send_file_name:!0,send_chunk_number:!0},_.call(this,e,null,!0),w=new l.QueueProgress,l.extend(this,{id:x,uid:x,state:l.STOPPED,features:{},runtime:null,files:T,settings:I,total:w,init:function(){var e,t,i=this;return e=i.getOption("preinit"),"function"==typeof e?e(i):l.each(e,function(e,t){i.bind(t,e)}),p.call(i),l.each(["container","browse_button","drop_element"],function(e){return null===i.getOption(e)?(t={code:l.INIT_ERROR,message:l.sprintf(l.translate("%s specified, but cannot be found."),e)},!1):void 0}),t?i.trigger("Error",t):I.browse_button||I.drop_element?(g.call(i,I,function(e){var t=i.getOption("init");"function"==typeof t?t(i):l.each(t,function(e,t){i.bind(t,e)}),e?(i.runtime=o.getInfo(c()).type,i.trigger("Init",{runtime:i.runtime}),i.trigger("PostInit")):i.trigger("Error",{code:l.INIT_ERROR,message:l.translate("Init error.")})}),void 0):i.trigger("Error",{code:l.INIT_ERROR,message:l.translate("You must specify either browse_button or drop_element.")})},setOption:function(e,t){_.call(this,e,t,!this.runtime)},getOption:function(e){return e?I[e]:I},refresh:function(){A.length&&l.each(A,function(e){e.trigger("Refresh")}),this.trigger("Refresh")},start:function(){this.state!=l.STARTED&&(this.state=l.STARTED,this.trigger("StateChanged"),a.call(this))},stop:function(){this.state!=l.STOPPED&&(this.state=l.STOPPED,this.trigger("StateChanged"),this.trigger("CancelUpload"))},disableBrowse:function(){U=arguments[0]!==i?arguments[0]:!0,A.length&&l.each(A,function(e){e.disable(U)}),this.trigger("DisableBrowse",U)},getFile:function(e){var t;for(t=T.length-1;t>=0;t--)if(T[t].id===e)return T[t]},addFile:function(e,i){function n(e,t){var i=[];l.each(u.settings.filters,function(t,n){s[n]&&i.push(function(i){s[n].call(u,t,e,function(e){i(!e)})})}),l.inSeries(i,t)}function a(e){var s=l.typeOf(e);if(e instanceof t.file.File){if(!e.ruid&&!e.isDetached()){if(!o)return!1;e.ruid=o,e.connectRuntime(o)}a(new l.File(e))}else e instanceof t.file.Blob?(a(e.getSource()),e.destroy()):e instanceof l.File?(i&&(e.name=i),d.push(function(t){n(e,function(i){i||(T.push(e),f.push(e),u.trigger("FileFiltered",e)),r(t,1)})})):-1!==l.inArray(s,["file","blob"])?a(new t.file.File(null,e)):"node"===s&&"filelist"===l.typeOf(e.files)?l.each(e.files,a):"array"===s&&(i=null,l.each(e,a))}var o,u=this,d=[],f=[];o=c(),a(e),d.length&&l.inSeries(d,function(){f.length&&u.trigger("FilesAdded",f)})},removeFile:function(e){for(var t="string"==typeof e?e:e.id,i=T.length-1;i>=0;i--)if(T[i].id===t)return this.splice(i,1)[0]},splice:function(e,t){var n=T.splice(e===i?0:e,t===i?T.length:t),r=!1;return this.state==l.STARTED&&(l.each(n,function(e){return e.status===l.UPLOADING?(r=!0,!1):void 0}),r&&this.stop()),this.trigger("FilesRemoved",n),l.each(n,function(e){e.destroy()}),r&&this.start(),n},dispatchEvent:function(e){var t,i;if(e=e.toLowerCase(),t=this.hasEventListener(e)){t.sort(function(e,t){return t.priority-e.priority}),i=[].slice.call(arguments),i.shift(),i.unshift(this);for(var n=0;n<t.length;n++)if(t[n].fn.apply(t[n].scope,i)===!1)return!1}return!0},bind:function(e,t,i,n){l.Uploader.prototype.bind.call(this,e,t,n,i)},destroy:function(){this.trigger("Destroy"),I=w=null,this.unbindAll()}})},l.Uploader.prototype=t.core.EventTarget.instance,l.File=function(){function e(e){l.extend(this,{id:l.guid(),name:e.name||e.fileName,type:e.type||"",size:e.size||e.fileSize,origSize:e.size||e.fileSize,loaded:0,percent:0,status:l.QUEUED,lastModifiedDate:e.lastModifiedDate||(new Date).toLocaleString(),getNative:function(){var e=this.getSource().getSource();return-1!==l.inArray(l.typeOf(e),["blob","file"])?e:null},getSource:function(){return t[this.id]?t[this.id]:null},destroy:function(){var e=this.getSource();e&&(e.destroy(),delete t[this.id])}}),t[this.id]=e}var t={};return e}(),l.QueueProgress=function(){var e=this;e.size=0,e.loaded=0,e.uploaded=0,e.failed=0,e.queued=0,e.percent=0,e.bytesPerSec=0,e.reset=function(){e.size=e.loaded=e.uploaded=e.failed=e.queued=e.percent=e.bytesPerSec=0}},e.plupload=l}(this,e)});
  7367. define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, undefined, Plupload, Template) {
  7368. var Upload = {
  7369. list: {},
  7370. config: {
  7371. container: document.body,
  7372. classname: '.plupload:not([initialized])',
  7373. previewtpl: '<li class="col-xs-3"><a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail"><img src="<%=fullurl%>" class="img-responsive"></a><a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a></li>',
  7374. },
  7375. events: {
  7376. //初始化完成
  7377. onPostInit: function (up) {
  7378. },
  7379. //文件添加成功后
  7380. onFileAdded: function (up, files) {
  7381. var button = up.settings.button;
  7382. $(button).data("bakup-html", $(button).html());
  7383. var maxcount = $(button).data("maxcount");
  7384. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  7385. maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
  7386. if (maxcount > 0 && input_id) {
  7387. var inputObj = $("#" + input_id);
  7388. if (inputObj.size() > 0) {
  7389. var value = $.trim(inputObj.val());
  7390. var nums = value === '' ? 0 : value.split(/\,/).length;
  7391. var remains = maxcount - nums;
  7392. if (files.length > remains) {
  7393. for (var i = 0; i < files.length; i++) {
  7394. up.removeFile(files[i]);
  7395. }
  7396. Toastr.error(__('You can upload up to %d file%s', remains));
  7397. return false;
  7398. }
  7399. }
  7400. }
  7401. //添加后立即上传
  7402. setTimeout(function () {
  7403. up.start();
  7404. }, 1);
  7405. },
  7406. //上传进行中的回调
  7407. onUploadProgress: function (up, file) {
  7408. },
  7409. //上传之前的回调
  7410. onBeforeUpload: function (up, file) {
  7411. },
  7412. //上传成功的回调
  7413. onUploadSuccess: function (up, ret) {
  7414. var button = up.settings.button;
  7415. var onUploadSuccess = up.settings.onUploadSuccess;
  7416. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  7417. //上传成功后回调
  7418. if (button) {
  7419. //如果有文本框则填充
  7420. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  7421. if (input_id) {
  7422. var urlArr = [];
  7423. var inputObj = $("#" + input_id);
  7424. if ($(button).data("multiple") && inputObj.val() !== "") {
  7425. urlArr.push(inputObj.val());
  7426. }
  7427. urlArr.push(data.url);
  7428. inputObj.val(urlArr.join(",")).trigger("change");
  7429. }
  7430. //如果有回调函数
  7431. var onDomUploadSuccess = $(button).data("upload-success");
  7432. if (onDomUploadSuccess) {
  7433. if (typeof onDomUploadSuccess !== 'function' && typeof Upload.api.custom[onDomUploadSuccess] === 'function') {
  7434. onDomUploadSuccess = Upload.api.custom[onDomUploadSuccess];
  7435. }
  7436. if (typeof onDomUploadSuccess === 'function') {
  7437. var result = onDomUploadSuccess.call(button, data, ret);
  7438. if (result === false)
  7439. return;
  7440. }
  7441. }
  7442. }
  7443. if (typeof onUploadSuccess === 'function') {
  7444. var result = onUploadSuccess.call(button, data, ret);
  7445. if (result === false)
  7446. return;
  7447. }
  7448. },
  7449. //上传错误的回调
  7450. onUploadError: function (up, ret) {
  7451. var button = up.settings.button;
  7452. var onUploadError = up.settings.onUploadError;
  7453. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  7454. if (button) {
  7455. var onDomUploadError = $(button).data("upload-error");
  7456. if (onDomUploadError) {
  7457. if (typeof onDomUploadError !== 'function' && typeof Upload.api.custom[onDomUploadError] === 'function') {
  7458. onDomUploadError = Upload.api.custom[onDomUploadError];
  7459. }
  7460. if (typeof onDomUploadError === 'function') {
  7461. var result = onDomUploadError.call(button, data, ret);
  7462. if (result === false)
  7463. return;
  7464. }
  7465. }
  7466. }
  7467. if (typeof onUploadError === 'function') {
  7468. var result = onUploadError.call(button, data, ret);
  7469. if (result === false) {
  7470. return;
  7471. }
  7472. }
  7473. Toastr.error(ret.msg + "(code:" + ret.code + ")");
  7474. },
  7475. //服务器响应数据后
  7476. onUploadResponse: function (response) {
  7477. try {
  7478. var ret = typeof response === 'object' ? response : JSON.parse(response);
  7479. if (!ret.hasOwnProperty('code')) {
  7480. $.extend(ret, {code: -2, msg: response, data: null});
  7481. }
  7482. } catch (e) {
  7483. var ret = {code: -1, msg: e.message, data: null};
  7484. }
  7485. return ret;
  7486. },
  7487. //上传全部结束后
  7488. onUploadComplete: function (up, files) {
  7489. var button = up.settings.button;
  7490. var onUploadComplete = up.settings.onUploadComplete;
  7491. if (button) {
  7492. var onDomUploadComplete = $(button).data("upload-complete");
  7493. if (onDomUploadComplete) {
  7494. if (typeof onDomUploadComplete !== 'function' && typeof Upload.api.custom[onDomUploadComplete] === 'function') {
  7495. onDomUploadComplete = Upload.api.custom[onDomUploadComplete];
  7496. }
  7497. if (typeof onDomUploadComplete === 'function') {
  7498. var result = onDomUploadComplete.call(button, files);
  7499. if (result === false)
  7500. return;
  7501. }
  7502. }
  7503. }
  7504. if (typeof onUploadComplete === 'function') {
  7505. var result = onUploadComplete.call(button, files);
  7506. if (result === false) {
  7507. return;
  7508. }
  7509. }
  7510. }
  7511. },
  7512. api: {
  7513. //Plupload上传
  7514. plupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  7515. element = typeof element === 'undefined' ? Upload.config.classname : element;
  7516. $(element, Upload.config.container).each(function () {
  7517. if ($(this).attr("initialized")) {
  7518. return true;
  7519. }
  7520. $(this).attr("initialized", true);
  7521. var that = this;
  7522. var id = $(this).prop("id");
  7523. var url = $(this).data("url");
  7524. var maxsize = $(this).data("maxsize");
  7525. var mimetype = $(this).data("mimetype");
  7526. var multipart = $(this).data("multipart");
  7527. var multiple = $(this).data("multiple");
  7528. //填充ID
  7529. var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
  7530. //预览ID
  7531. var preview_id = $(that).data("preview-id") ? $(that).data("preview-id") : "";
  7532. //上传URL
  7533. url = url ? url : Config.upload.uploadurl;
  7534. url = Fast.api.fixurl(url);
  7535. //最大可上传文件大小
  7536. maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize;
  7537. //文件类型
  7538. mimetype = typeof mimetype !== "undefined" ? mimetype : Config.upload.mimetype;
  7539. //请求的表单参数
  7540. multipart = typeof multipart !== "undefined" ? multipart : Config.upload.multipart;
  7541. //是否支持批量上传
  7542. multiple = typeof multiple !== "undefined" ? multiple : Config.upload.multiple;
  7543. var mimetypeArr = new Array();
  7544. //支持后缀和Mimetype格式,以,分隔
  7545. if (mimetype && mimetype !== "*" && mimetype.indexOf("/") === -1)
  7546. {
  7547. var tempArr = mimetype.split(',');
  7548. for (var i = 0; i < tempArr.length; i++)
  7549. {
  7550. mimetypeArr.push({title: __('Files'), extensions: tempArr[i]});
  7551. }
  7552. mimetype = mimetypeArr;
  7553. }
  7554. //生成Plupload实例
  7555. Upload.list[id] = new Plupload.Uploader({
  7556. runtimes: 'html5,flash,silverlight,html4',
  7557. multi_selection: multiple, //是否允许多选批量上传
  7558. browse_button: id, // 浏览按钮的ID
  7559. container: $(this).parent().get(0), //取按钮的上级元素
  7560. flash_swf_url: '/assets/libs/plupload/js/Moxie.swf',
  7561. silverlight_xap_url: '/assets/libs/plupload/js/Moxie.xap',
  7562. filters: {
  7563. max_file_size: maxsize,
  7564. mime_types: mimetype,
  7565. },
  7566. url: url,
  7567. multipart_params: $.isArray(multipart) ? {} : multipart,
  7568. init: {
  7569. PostInit: Upload.events.onPostInit,
  7570. FilesAdded: Upload.events.onFileAdded,
  7571. BeforeUpload: Upload.events.onBeforeUpload,
  7572. UploadProgress: function (up, file) {
  7573. var button = up.settings.button;
  7574. $(button).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + file.percent + "%");
  7575. Upload.events.onUploadProgress(up, file);
  7576. },
  7577. FileUploaded: function (up, file, info) {
  7578. var button = up.settings.button;
  7579. //还原按钮文字及状态
  7580. $(button).prop("disabled", false).html($(button).data("bakup-html"));
  7581. var ret = Upload.events.onUploadResponse(info.response, info, up, file);
  7582. file.ret = ret;
  7583. if (ret.code === 1) {
  7584. Upload.events.onUploadSuccess(up, ret, file);
  7585. } else {
  7586. Upload.events.onUploadError(up, ret, file);
  7587. }
  7588. },
  7589. UploadComplete: Upload.events.onUploadComplete,
  7590. Error: function (up, err) {
  7591. var button = up.settings.button;
  7592. $(button).prop("disabled", false).html($(button).data("bakup-html"));
  7593. var ret = {code: err.code, msg: err.message, data: null};
  7594. Upload.events.onUploadError(up, ret);
  7595. }
  7596. },
  7597. onUploadSuccess: onUploadSuccess,
  7598. onUploadError: onUploadError,
  7599. onUploadComplete: onUploadComplete,
  7600. button: that
  7601. });
  7602. //拖动排序
  7603. if (preview_id && multiple) {
  7604. require(['dragsort'], function () {
  7605. $("#" + preview_id).dragsort({
  7606. dragSelector: "li",
  7607. dragEnd: function () {
  7608. $("#" + preview_id).trigger("fa.preview.change");
  7609. },
  7610. placeHolderTemplate: '<li class="col-xs-3"></li>'
  7611. });
  7612. });
  7613. }
  7614. if (preview_id && input_id) {
  7615. $(document.body).on("keyup change", "#" + input_id, function () {
  7616. var inputStr = $("#" + input_id).val();
  7617. var inputArr = inputStr.split(/\,/);
  7618. $("#" + preview_id).empty();
  7619. var tpl = $("#" + preview_id).data("template") ? $("#" + preview_id).data("template") : "";
  7620. $.each(inputArr, function (i, j) {
  7621. if (!j) {
  7622. return true;
  7623. }
  7624. var data = {url: j, fullurl: Fast.api.cdnurl(j), data: $(that).data()};
  7625. var html = tpl ? Template(tpl, data) : Template.render(Upload.config.previewtpl, data);
  7626. $("#" + preview_id).append(html);
  7627. });
  7628. });
  7629. $("#" + input_id).trigger("change");
  7630. }
  7631. if (preview_id) {
  7632. // 监听事件
  7633. $(document.body).on("fa.preview.change", "#" + preview_id, function () {
  7634. var urlArr = new Array();
  7635. $("#" + preview_id + " [data-url]").each(function (i, j) {
  7636. urlArr.push($(this).data("url"));
  7637. });
  7638. if (input_id) {
  7639. $("#" + input_id).val(urlArr.join(","));
  7640. }
  7641. });
  7642. // 移除按钮事件
  7643. $(document.body).on("click", "#" + preview_id + " .btn-trash", function () {
  7644. $(this).closest("li").remove();
  7645. $("#" + preview_id).trigger("fa.preview.change");
  7646. });
  7647. }
  7648. Upload.list[id].init();
  7649. });
  7650. },
  7651. // AJAX异步上传
  7652. send: function (file, onUploadSuccess, onUploadError, onUploadComplete) {
  7653. var index = Layer.msg(__('Uploading'), {offset: 't', time: 0});
  7654. var id = Plupload.guid();
  7655. var _onPostInit = Upload.events.onPostInit;
  7656. Upload.events.onPostInit = function () {
  7657. // 当加载完成后添加文件并上传
  7658. Upload.list[id].addFile(file);
  7659. //Upload.list[id].start();
  7660. };
  7661. $('<button type="button" id="' + id + '" class="btn btn-danger hidden plupload" />').appendTo("body");
  7662. $("#" + id).data("upload-complete", function (files) {
  7663. Upload.events.onPostInit = _onPostInit;
  7664. Layer.close(index);
  7665. });
  7666. Upload.api.plupload("#" + id, onUploadSuccess, onUploadError, onUploadComplete);
  7667. },
  7668. custom: {
  7669. //自定义上传完成回调
  7670. afteruploadcallback: function (response) {
  7671. console.log(this, response);
  7672. alert("Custom Callback,Response URL:" + response.url);
  7673. },
  7674. },
  7675. }
  7676. };
  7677. return Upload;
  7678. });
  7679. /*! nice-validator 1.1.3
  7680. * (c) 2012-2017 Jony Zhang <niceue@live.com>, MIT Licensed
  7681. * https://github.com/niceue/nice-validator
  7682. */
  7683. ;(function(factory) {
  7684. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  7685. typeof define === 'function' && define.amd ? define('validator-core',['jquery'], factory) :
  7686. factory(jQuery);
  7687. }(function($, undefined) {
  7688. "use strict";
  7689. var NS = 'validator',
  7690. CLS_NS = '.' + NS,
  7691. CLS_NS_RULE = '.rule',
  7692. CLS_NS_FIELD = '.field',
  7693. CLS_NS_FORM = '.form',
  7694. CLS_WRAPPER = 'nice-' + NS,
  7695. CLS_MSG_BOX = 'msg-box',
  7696. ARIA_INVALID = 'aria-invalid',
  7697. DATA_RULE = 'data-rule',
  7698. DATA_MSG = 'data-msg',
  7699. DATA_TIP = 'data-tip',
  7700. DATA_OK = 'data-ok',
  7701. DATA_TIMELY = 'data-timely',
  7702. DATA_TARGET = 'data-target',
  7703. DATA_DISPLAY = 'data-display',
  7704. DATA_MUST = 'data-must',
  7705. NOVALIDATE = 'novalidate',
  7706. INPUT_SELECTOR = ':verifiable',
  7707. rRules = /(&)?(!)?\b(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?\s*(;|\|)?/g,
  7708. rRule = /(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?/,
  7709. rDisplay = /(?:([^:;\(\[]*):)?(.*)/,
  7710. rDoubleBytes = /[^\x00-\xff]/g,
  7711. rPos = /top|right|bottom|left/,
  7712. rAjaxType = /(?:(cors|jsonp):)?(?:(post|get):)?(.+)/i,
  7713. rUnsafe = /[<>'"`\\]|&#x?\d+[A-F]?;?|%3[A-F]/gmi,
  7714. noop = $.noop,
  7715. proxy = $.proxy,
  7716. trim = $.trim,
  7717. isFunction = $.isFunction,
  7718. isString = function(s) {
  7719. return typeof s === 'string';
  7720. },
  7721. isObject = function(o) {
  7722. return o && Object.prototype.toString.call(o) === '[object Object]';
  7723. },
  7724. isIE = document.documentMode || +(navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1),
  7725. attr = function(el, key, value) {
  7726. if (!el || !el.tagName) return null;
  7727. if (value !== undefined) {
  7728. if (value === null) el.removeAttribute(key);
  7729. else el.setAttribute(key, '' + value);
  7730. } else {
  7731. return el.getAttribute(key);
  7732. }
  7733. },
  7734. novalidateonce,
  7735. preinitialized = {},
  7736. defaults = {
  7737. debug: 0,
  7738. theme: 'default',
  7739. ignore: '',
  7740. focusInvalid: true,
  7741. focusCleanup: false,
  7742. stopOnError: false,
  7743. beforeSubmit: null,
  7744. valid: null,
  7745. invalid: null,
  7746. validation: null,
  7747. formClass: 'n-default',
  7748. validClass: 'n-valid',
  7749. invalidClass: 'n-invalid',
  7750. bindClassTo: null
  7751. },
  7752. fieldDefaults = {
  7753. timely: 1,
  7754. display: null,
  7755. target: null,
  7756. ignoreBlank: false,
  7757. showOk: true,
  7758. // Translate ajax response to validation result
  7759. dataFilter: function (data) {
  7760. if ( isString(data) || ( isObject(data) && ('error' in data || 'ok' in data) ) ) {
  7761. return data;
  7762. }
  7763. },
  7764. msgMaker: function(opt) {
  7765. var html;
  7766. html = '<span role="alert" class="msg-wrap n-'+ opt.type + '">' + opt.arrow;
  7767. if (opt.result) {
  7768. $.each(opt.result, function(i, obj){
  7769. html += '<span class="n-'+ obj.type +'">' + opt.icon + '<span class="n-msg">' + obj.msg + '</span></span>';
  7770. });
  7771. } else {
  7772. html += opt.icon + '<span class="n-msg">' + opt.msg + '</span>';
  7773. }
  7774. html += '</span>';
  7775. return html;
  7776. },
  7777. msgWrapper: 'span',
  7778. msgArrow: '',
  7779. msgIcon: '<span class="n-icon"></span>',
  7780. msgClass: 'n-right',
  7781. msgStyle: '',
  7782. msgShow: null,
  7783. msgHide: null
  7784. },
  7785. themes = {};
  7786. /** jQuery Plugin
  7787. * @param {Object} options
  7788. debug {Boolean} 0 Whether to enable debug mode
  7789. timely {Number} 1 Whether to enable timely validation
  7790. theme {String} 'default' Theme name
  7791. stopOnError {Boolean} false Whether to stop validate when found an error input
  7792. focusCleanup {Boolean} false Whether to clean up the field message when focus the field
  7793. focusInvalid {Boolean} true Whether to focus the field that is invalid
  7794. ignoreBlank {Boolean} false When the field has no value, whether to ignore validation
  7795. ignore {jqSelector} '' Ignored fields (Using jQuery selector)
  7796. beforeSubmit {Function} Do something before submit form
  7797. dataFilter {Function} Convert ajax results
  7798. valid {Function} Triggered when the form is valid
  7799. invalid {Function} Triggered when the form is invalid
  7800. validClass {String} 'n-valid' Add this class name to a valid field
  7801. invalidClass {String} 'n-invalid' Add this class name to a invalid field
  7802. bindClassTo {jqSelector} ':verifiable' Which element should the className binding to
  7803. display {Function} Callback function to get dynamic display
  7804. target {Function} Callback function to get dynamic target
  7805. msgShow {Function} Trigger this callback when show message
  7806. msgHide {Function} Trigger this callback when hide message
  7807. msgWrapper {String} 'span' Message wrapper tag name
  7808. msgMaker {Function} Callback function to make message HTML
  7809. msgArrow {String} Message arrow template
  7810. msgIcon {String} Message icon template
  7811. msgStyle {String} Custom message css style
  7812. msgClass {String} Additional added to the message class names
  7813. formClass {String} Additional added to the form class names
  7814. messages {Object} Custom messages for the current instance
  7815. rules {Object} Custom rules for the current instance
  7816. fields {Object} Field validation configuration
  7817. {String} key name|#id
  7818. {String|Object} value Rule string or an object which can pass more arguments
  7819. fields[key][rule] {String} Rule string
  7820. fields[key][display] {String|Function}
  7821. fields[key][tip] {String} Custom tip message
  7822. fields[key][ok] {String} Custom success message
  7823. fields[key][msg] {Object} Custom error message
  7824. fields[key][msgStyle] {String} Custom message style
  7825. fields[key][msgClass] {String} A className which added to message placeholder element
  7826. fields[key][msgWrapper] {String} Tag name of the message placeholder element
  7827. fields[key][msgMaker] {Function} A function to custom message HTML
  7828. fields[key][dataFilter] {Function} A function to convert ajax results
  7829. fields[key][valid] {Function} A function triggered when field is valid
  7830. fields[key][invalid] {Function} A function triggered when field is invalid
  7831. fields[key][must] {Boolean} If set true, we always check the field even has remote checking
  7832. fields[key][timely] {Boolean} Whether to enable timely validation
  7833. fields[key][target] {jqSelector} Define placement of a message
  7834. */
  7835. $.fn.validator = function(options) {
  7836. var that = this,
  7837. args = arguments;
  7838. if (that.is(INPUT_SELECTOR)) return that;
  7839. if (!that.is('form')) that = this.find('form');
  7840. if (!that.length) that = this;
  7841. that.each(function() {
  7842. var instance = $(this).data(NS);
  7843. if (instance) {
  7844. if ( isString(options) ) {
  7845. if ( options.charAt(0) === '_' ) return;
  7846. instance[options].apply(instance, [].slice.call(args, 1));
  7847. }
  7848. else if (options) {
  7849. instance._reset(true);
  7850. instance._init(this, options);
  7851. }
  7852. } else {
  7853. new Validator(this, options);
  7854. }
  7855. });
  7856. return this;
  7857. };
  7858. // Validate a field, or an area
  7859. $.fn.isValid = function(callback, hideMsg) {
  7860. var me = _getInstance(this[0]),
  7861. hasCallback = isFunction(callback),
  7862. ret, opt;
  7863. if (!me) return true;
  7864. if (!hasCallback && hideMsg === undefined) hideMsg = callback;
  7865. me.checkOnly = !!hideMsg;
  7866. opt = me.options;
  7867. ret = me._multiValidate(
  7868. this.is(INPUT_SELECTOR) ? this : this.find(INPUT_SELECTOR),
  7869. function(isValid){
  7870. if (!isValid && opt.focusInvalid && !me.checkOnly) {
  7871. // navigate to the error element
  7872. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  7873. }
  7874. if (hasCallback) {
  7875. if (callback.length) {
  7876. callback(isValid);
  7877. } else if (isValid) {
  7878. callback();
  7879. }
  7880. }
  7881. me.checkOnly = false;
  7882. }
  7883. );
  7884. // If you pass a callback, we maintain the jQuery object chain
  7885. return hasCallback ? this : ret;
  7886. };
  7887. $.extend($.expr.pseudos || $.expr[':'], {
  7888. // A faster selector than ":input:not(:submit,:button,:reset,:image,:disabled,[contenteditable])"
  7889. verifiable: function(elem) {
  7890. var name = elem.nodeName.toLowerCase();
  7891. return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
  7892. name === 'select' ||
  7893. name === 'textarea' ||
  7894. elem.contentEditable === 'true'
  7895. ) && !elem.disabled;
  7896. },
  7897. // any value, but not only whitespace
  7898. filled: function(elem) {
  7899. return !!trim($(elem).val());
  7900. }
  7901. });
  7902. /**
  7903. * Creates a new Validator
  7904. *
  7905. * @class
  7906. * @param {Element} element - form element
  7907. * @param {Object} options - options for validator
  7908. */
  7909. function Validator(element, options) {
  7910. var me = this;
  7911. if ( !(me instanceof Validator) ) {
  7912. return new Validator(element, options);
  7913. }
  7914. if (Validator.pending) {
  7915. $(window).on('validatorready', init);
  7916. } else {
  7917. init();
  7918. }
  7919. function init() {
  7920. me.$el = $(element);
  7921. if (me.$el.length) {
  7922. me._init(me.$el[0], options);
  7923. }
  7924. else if (isString(element)) {
  7925. preinitialized[element] = options;
  7926. }
  7927. }
  7928. }
  7929. Validator.prototype = {
  7930. _init: function(element, options) {
  7931. var me = this,
  7932. opt, themeOpt, dataOpt;
  7933. // Initialization options
  7934. if ( isFunction(options) ) {
  7935. options = {
  7936. valid: options
  7937. };
  7938. }
  7939. options = me._opt = options || {};
  7940. dataOpt = attr(element, 'data-'+ NS +'-option');
  7941. dataOpt = me._dataOpt = dataOpt && dataOpt.charAt(0) === '{' ? (new Function("return " + dataOpt))() : {};
  7942. themeOpt = me._themeOpt = themes[ options.theme || dataOpt.theme || defaults.theme ];
  7943. opt = me.options = $.extend({}, defaults, fieldDefaults, themeOpt, me.options, options, dataOpt);
  7944. me.rules = new Rules(opt.rules, true);
  7945. me.messages = new Messages(opt.messages, true);
  7946. me.Field = _createFieldFactory(me);
  7947. me.elements = me.elements || {};
  7948. me.deferred = {};
  7949. me.errors = {};
  7950. me.fields = {};
  7951. // Initialization fields
  7952. me._initFields(opt.fields);
  7953. // Initialization events and make a cache
  7954. if ( !me.$el.data(NS) ) {
  7955. me.$el.data(NS, me).addClass(CLS_WRAPPER +' '+ opt.formClass)
  7956. .on('form-submit-validate', function(e, a, $form, opts, veto) {
  7957. me.vetoed = veto.veto = !me.isValid;
  7958. me.ajaxFormOptions = opts;
  7959. })
  7960. .on('submit'+ CLS_NS +' validate'+ CLS_NS, proxy(me, '_submit'))
  7961. .on('reset'+ CLS_NS, proxy(me, '_reset'))
  7962. .on('showmsg'+ CLS_NS, proxy(me, '_showmsg'))
  7963. .on('hidemsg'+ CLS_NS, proxy(me, '_hidemsg'))
  7964. .on('focusin'+ CLS_NS + ' click'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusin'))
  7965. .on('focusout'+ CLS_NS +' validate'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusout'))
  7966. .on('keyup'+ CLS_NS +' input'+ CLS_NS + ' compositionstart compositionend', INPUT_SELECTOR, proxy(me, '_focusout'))
  7967. .on('click'+ CLS_NS, ':radio,:checkbox', 'click', proxy(me, '_focusout'))
  7968. .on('change'+ CLS_NS, 'select,input[type="file"]', 'change', proxy(me, '_focusout'));
  7969. // cache the novalidate attribute value
  7970. me._NOVALIDATE = attr(element, NOVALIDATE);
  7971. // Initialization is complete, stop off default HTML5 form validation
  7972. // If use "jQuery.attr('novalidate')" in IE7 will complain: "SCRIPT3: Member not found."
  7973. attr(element, NOVALIDATE, NOVALIDATE);
  7974. }
  7975. // Display all messages in target container
  7976. if ( isString(opt.target) ) {
  7977. me.$el.find(opt.target).addClass('msg-container');
  7978. }
  7979. },
  7980. // Guess whether the form use ajax submit
  7981. _guessAjax: function(form) {
  7982. var me = this;
  7983. if ( !(me.isAjaxSubmit = !!me.options.valid) ) {
  7984. // if there is a "valid.form" event
  7985. var events = ($._data || $.data)(form, "events");
  7986. me.isAjaxSubmit = issetEvent(events, 'valid', 'form') || issetEvent(events, 'submit', 'form-plugin');
  7987. }
  7988. function issetEvent(events, name, namespace) {
  7989. if ( events && events[name] &&
  7990. $.map(events[name], function(e){
  7991. return ~e.namespace.indexOf(namespace) ? 1 : null;
  7992. }).length
  7993. ) {
  7994. return true;
  7995. }
  7996. return false;
  7997. }
  7998. },
  7999. _initFields: function(fields) {
  8000. var me = this, k, arr, i,
  8001. clear = fields === null;
  8002. // Processing field information
  8003. if (clear) fields = me.fields;
  8004. if ( isObject(fields) ) {
  8005. for (k in fields) {
  8006. if (~k.indexOf(',')) {
  8007. arr = k.split(',');
  8008. i = arr.length;
  8009. while (i--) {
  8010. initField(trim(arr[i]), fields[k]);
  8011. }
  8012. } else {
  8013. initField(k, fields[k]);
  8014. }
  8015. }
  8016. }
  8017. // Parsing DOM rules
  8018. me.$el.find(INPUT_SELECTOR).each(function() {
  8019. me._parse(this);
  8020. });
  8021. function initField(k, v) {
  8022. // delete a field from settings
  8023. if ( v === null || clear ) {
  8024. var el = me.elements[k];
  8025. if (el) me._resetElement(el, true);
  8026. delete me.fields[k];
  8027. } else {
  8028. me.fields[k] = new me.Field(k, isString(v) ? {rule: v} : v, me.fields[k]);
  8029. }
  8030. }
  8031. },
  8032. // Parsing a field
  8033. _parse: function(el) {
  8034. var me = this,
  8035. field,
  8036. key = el.name,
  8037. display,
  8038. timely,
  8039. dataRule = attr(el, DATA_RULE);
  8040. dataRule && attr(el, DATA_RULE, null);
  8041. // If the field has passed the key as id mode, or it doesn't has a name
  8042. if ( el.id && (
  8043. ('#' + el.id in me.fields) ||
  8044. !key ||
  8045. // If dataRule and element are diffrent from old's, we use ID mode.
  8046. (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
  8047. )
  8048. ) {
  8049. key = '#' + el.id;
  8050. }
  8051. // Generate id
  8052. if (!key) {
  8053. key = '#' + (el.id = 'N' + String(Math.random()).slice(-12));
  8054. }
  8055. field = me.getField(key, true);
  8056. // The priority of passing parameter by DOM is higher than by JS.
  8057. field.rule = dataRule || field.rule;
  8058. if (display = attr(el, DATA_DISPLAY)) {
  8059. field.display = display;
  8060. }
  8061. if (field.rule) {
  8062. if ( attr(el, DATA_MUST) !== null || /\b(?:match|checked)\b/.test(field.rule) ) {
  8063. field.must = true;
  8064. }
  8065. if ( /\brequired\b/.test(field.rule) ) {
  8066. field.required = true;
  8067. }
  8068. if (timely = attr(el, DATA_TIMELY)) {
  8069. field.timely = +timely;
  8070. } else if (field.timely > 3) {
  8071. attr(el, DATA_TIMELY, field.timely);
  8072. }
  8073. me._parseRule(field);
  8074. field.old = {};
  8075. }
  8076. if ( isString(field.target) ) {
  8077. attr(el, DATA_TARGET, field.target);
  8078. }
  8079. if ( isString(field.tip) ) {
  8080. attr(el, DATA_TIP, field.tip);
  8081. }
  8082. return me.fields[key] = field;
  8083. },
  8084. // Parsing field rules
  8085. _parseRule: function(field) {
  8086. var arr = rDisplay.exec(field.rule);
  8087. if (!arr) return;
  8088. // current rule index
  8089. field._i = 0;
  8090. if (arr[1]) {
  8091. field.display = arr[1];
  8092. }
  8093. if (arr[2]) {
  8094. field._rules = [];
  8095. arr[2].replace(rRules, function(){
  8096. var args = arguments;
  8097. args[4] = args[4] || args[5];
  8098. field._rules.push({
  8099. and: args[1] === "&",
  8100. not: args[2] === "!",
  8101. or: args[6] === "|",
  8102. method: args[3],
  8103. params: args[4] ? $.map( args[4].split(', '), trim ) : undefined
  8104. });
  8105. });
  8106. }
  8107. },
  8108. // Verify a zone
  8109. _multiValidate: function($inputs, doneCallback){
  8110. var me = this,
  8111. opt = me.options;
  8112. me.hasError = false;
  8113. if (opt.ignore) {
  8114. $inputs = $inputs.not(opt.ignore);
  8115. }
  8116. $inputs.each(function() {
  8117. me._validate(this);
  8118. if (me.hasError && opt.stopOnError) {
  8119. // stop the validation
  8120. return false;
  8121. }
  8122. });
  8123. // Need to wait for all fields validation complete, especially asynchronous validation
  8124. if (doneCallback) {
  8125. me.validating = true;
  8126. $.when.apply(
  8127. null,
  8128. $.map(me.deferred, function(v){return v;})
  8129. ).done(function(){
  8130. doneCallback.call(me, !me.hasError);
  8131. me.validating = false;
  8132. });
  8133. }
  8134. // If the form does not contain asynchronous validation, the return value is correct.
  8135. // Otherwise, you should detect form validation result through "doneCallback".
  8136. return !$.isEmptyObject(me.deferred) ? undefined : !me.hasError;
  8137. },
  8138. // Validate the whole form
  8139. _submit: function(e) {
  8140. var me = this,
  8141. opt = me.options,
  8142. form = e.target,
  8143. canSubmit = e.type === 'submit' && form.tagName === 'FORM' && !e.isDefaultPrevented();
  8144. e.preventDefault();
  8145. if (
  8146. novalidateonce && ~(novalidateonce = false) ||
  8147. // Prevent duplicate submission
  8148. me.submiting ||
  8149. // Receive the "validate" event only from the form.
  8150. e.type === 'validate' && me.$el[0] !== form ||
  8151. // trigger the beforeSubmit callback.
  8152. isFunction(opt.beforeSubmit) && opt.beforeSubmit.call(me, form) === false
  8153. ) {
  8154. return;
  8155. }
  8156. if (me.isAjaxSubmit === undefined) {
  8157. me._guessAjax(form);
  8158. }
  8159. me._debug('log', '\n<<< event: ' + e.type);
  8160. me._reset();
  8161. me.submiting = true;
  8162. me._multiValidate(
  8163. me.$el.find(INPUT_SELECTOR),
  8164. function(isValid){
  8165. var ret = (isValid || opt.debug === 2) ? 'valid' : 'invalid',
  8166. errors;
  8167. if (!isValid) {
  8168. if (opt.focusInvalid) {
  8169. // navigate to the error element
  8170. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  8171. }
  8172. errors = $.map(me.errors, function(err){return err;});
  8173. }
  8174. // releasing submit
  8175. me.submiting = false;
  8176. me.isValid = isValid;
  8177. // trigger callback and event
  8178. isFunction(opt[ret]) && opt[ret].call(me, form, errors);
  8179. me.$el.trigger(ret + CLS_NS_FORM, [form, errors]);
  8180. me._debug('log', '>>> ' + ret);
  8181. if (!isValid) return;
  8182. // For jquery.form plugin
  8183. if (me.vetoed) {
  8184. $(form).ajaxSubmit(me.ajaxFormOptions);
  8185. }
  8186. else if (canSubmit && !me.isAjaxSubmit) {
  8187. document.createElement('form').submit.call(form);
  8188. }
  8189. }
  8190. );
  8191. },
  8192. _reset: function(e) {
  8193. var me = this;
  8194. me.errors = {};
  8195. if (e) {
  8196. me.reseting = true;
  8197. me.$el.find(INPUT_SELECTOR).each( function(){
  8198. me._resetElement(this);
  8199. });
  8200. delete me.reseting;
  8201. }
  8202. },
  8203. _resetElement: function(el, all) {
  8204. this._setClass(el, null);
  8205. this.hideMsg(el);
  8206. },
  8207. // Handle events: "focusin/click"
  8208. _focusin: function(e) {
  8209. var me = this,
  8210. opt = me.options,
  8211. el = e.target,
  8212. timely,
  8213. msg;
  8214. if ( me.validating || ( e.type==='click' && document.activeElement === el ) ) {
  8215. return;
  8216. }
  8217. if (opt.focusCleanup) {
  8218. if ( attr(el, ARIA_INVALID) === 'true' ) {
  8219. me._setClass(el, null);
  8220. me.hideMsg(el);
  8221. }
  8222. }
  8223. msg = attr(el, DATA_TIP);
  8224. if (msg) {
  8225. me.showMsg(el, {
  8226. type: 'tip',
  8227. msg: msg
  8228. });
  8229. } else {
  8230. if (attr(el, DATA_RULE)) {
  8231. me._parse(el);
  8232. }
  8233. if (timely = attr(el, DATA_TIMELY)) {
  8234. if ( timely === 8 || timely === 9 ) {
  8235. me._focusout(e);
  8236. }
  8237. }
  8238. }
  8239. },
  8240. // Handle events: "focusout/validate/keyup/click/change/input/compositionstart/compositionend"
  8241. _focusout: function(e) {
  8242. var me = this,
  8243. opt = me.options,
  8244. el = e.target,
  8245. etype = e.type,
  8246. etype0,
  8247. focusin = etype === 'focusin',
  8248. special = etype === 'validate',
  8249. elem,
  8250. field,
  8251. old,
  8252. value,
  8253. timestamp,
  8254. key, specialKey,
  8255. timely,
  8256. timer = 0;
  8257. if (etype === 'compositionstart') {
  8258. me.pauseValidate = true;
  8259. }
  8260. if (etype === 'compositionend') {
  8261. me.pauseValidate = false;
  8262. }
  8263. if (me.pauseValidate) {
  8264. return;
  8265. }
  8266. // For checkbox and radio
  8267. elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
  8268. // Get field
  8269. if (!(field = me.getField(elem)) || !field.rule) {
  8270. return;
  8271. }
  8272. // Cache event type
  8273. etype0 = field._e;
  8274. field._e = etype;
  8275. timely = field.timely;
  8276. if (!special) {
  8277. if (!timely || (_checkable(el) && etype !== 'click')) {
  8278. return;
  8279. }
  8280. value = field.getValue();
  8281. // not validate field unless fill a value
  8282. if ( field.ignoreBlank && !value && !focusin ) {
  8283. me.hideMsg(el);
  8284. return;
  8285. }
  8286. if ( etype === 'focusout' ) {
  8287. if (etype0 === 'change') {
  8288. return;
  8289. }
  8290. if ( timely === 2 || timely === 8 ) {
  8291. old = field.old;
  8292. if (value && old) {
  8293. if (field.isValid && !old.showOk) {
  8294. me.hideMsg(el);
  8295. } else {
  8296. me._makeMsg(el, field, old);
  8297. }
  8298. } else {
  8299. return;
  8300. }
  8301. }
  8302. }
  8303. else {
  8304. if ( timely < 2 && !e.data ) {
  8305. return;
  8306. }
  8307. // mark timestamp to reduce the frequency of the received event
  8308. timestamp = +new Date();
  8309. if ( timestamp - (el._ts || 0) < 100 ) {
  8310. return;
  8311. }
  8312. el._ts = timestamp;
  8313. // handle keyup
  8314. if ( etype === 'keyup' ) {
  8315. if (etype0 === 'input') {
  8316. return;
  8317. }
  8318. key = e.keyCode;
  8319. specialKey = {
  8320. 8: 1, // Backspace
  8321. 9: 1, // Tab
  8322. 16: 1, // Shift
  8323. 32: 1, // Space
  8324. 46: 1 // Delete
  8325. };
  8326. // only gets focus, no validation
  8327. if ( key === 9 && !value ) {
  8328. return;
  8329. }
  8330. // do not validate, if triggered by these keys
  8331. if ( key < 48 && !specialKey[key] ) {
  8332. return;
  8333. }
  8334. }
  8335. if ( !focusin ) {
  8336. // keyboard events, reducing the frequency of validation
  8337. timer = timely <100 ? (etype === 'click' || el.tagName === 'SELECT') ? 0 : 400 : timely;
  8338. }
  8339. }
  8340. }
  8341. // if the current field is ignored
  8342. if ( opt.ignore && $(el).is(opt.ignore) ) {
  8343. return;
  8344. }
  8345. clearTimeout(field._t);
  8346. if (timer) {
  8347. field._t = setTimeout(function() {
  8348. me._validate(el, field);
  8349. }, timer);
  8350. } else {
  8351. if (special) field.old = {};
  8352. me._validate(el, field);
  8353. }
  8354. },
  8355. _setClass: function(el, isValid) {
  8356. var $el = $(el), opt = this.options;
  8357. if (opt.bindClassTo) {
  8358. $el = $el.closest(opt.bindClassTo);
  8359. }
  8360. $el.removeClass( opt.invalidClass + ' ' + opt.validClass );
  8361. if (isValid !== null) {
  8362. $el.addClass( isValid ? opt.validClass : opt.invalidClass );
  8363. }
  8364. },
  8365. _showmsg: function(e, type, msg) {
  8366. var me = this,
  8367. el = e.target;
  8368. if ( me.$el.is(el) ) {
  8369. if (isObject(type)) {
  8370. me.showMsg(type)
  8371. }
  8372. else if ( type === 'tip' ) {
  8373. me.$el.find(INPUT_SELECTOR +"["+ DATA_TIP +"]", el).each(function(){
  8374. me.showMsg(this, {type: type, msg: msg});
  8375. });
  8376. }
  8377. }
  8378. else {
  8379. me.showMsg(el, {type: type, msg: msg});
  8380. }
  8381. },
  8382. _hidemsg: function(e) {
  8383. var $el = $(e.target);
  8384. if ( $el.is(INPUT_SELECTOR) ) {
  8385. this.hideMsg($el);
  8386. }
  8387. },
  8388. // Validated a field
  8389. _validatedField: function(el, field, ret) {
  8390. var me = this,
  8391. opt = me.options,
  8392. isValid = field.isValid = ret.isValid = !!ret.isValid,
  8393. callback = isValid ? 'valid' : 'invalid';
  8394. ret.key = field.key;
  8395. ret.ruleName = field._r;
  8396. ret.id = el.id;
  8397. ret.value = field.value;
  8398. me.elements[field.key] = ret.element = el;
  8399. me.isValid = me.$el[0].isValid = isValid ? me.isFormValid() : isValid;
  8400. if (isValid) {
  8401. ret.type = 'ok';
  8402. } else {
  8403. if (me.submiting) {
  8404. me.errors[field.key] = ret.msg;
  8405. }
  8406. me.hasError = true;
  8407. }
  8408. // cache result
  8409. field.old = ret;
  8410. // trigger callback
  8411. isFunction(field[callback]) && field[callback].call(me, el, ret);
  8412. isFunction(opt.validation) && opt.validation.call(me, el, ret);
  8413. // trigger event
  8414. $(el).attr( ARIA_INVALID, isValid ? null : true )
  8415. .trigger( callback + CLS_NS_FIELD, [ret, me] );
  8416. me.$el.triggerHandler('validation', [ret, me]);
  8417. if (me.checkOnly) return;
  8418. // set className
  8419. me._setClass(el, ret.skip || ret.type === 'tip' ? null : isValid);
  8420. me._makeMsg.apply(me, arguments);
  8421. },
  8422. _makeMsg: function(el, field, ret) {
  8423. // show or hide the message
  8424. if (field.msgMaker) {
  8425. ret = $.extend({}, ret);
  8426. if (field._e === 'focusin') {
  8427. ret.type = 'tip';
  8428. }
  8429. this[ ret.showOk || ret.msg || ret.type === 'tip' ? 'showMsg' : 'hideMsg' ](el, ret, field);
  8430. }
  8431. },
  8432. // Validated a rule
  8433. _validatedRule: function(el, field, ret, msgOpt) {
  8434. field = field || me.getField(el);
  8435. msgOpt = msgOpt || {};
  8436. var me = this,
  8437. msg,
  8438. rule,
  8439. method = field._r,
  8440. timely = field.timely,
  8441. special = timely === 9 || timely === 8,
  8442. transfer,
  8443. temp,
  8444. isValid = false;
  8445. // use null to break validation from a field
  8446. if (ret === null) {
  8447. me._validatedField(el, field, {isValid: true, skip: true});
  8448. field._i = 0;
  8449. return;
  8450. }
  8451. else if (ret === undefined) {
  8452. transfer = true;
  8453. }
  8454. else if (ret === true || ret === '') {
  8455. isValid = true;
  8456. }
  8457. else if (isString(ret)) {
  8458. msg = ret;
  8459. }
  8460. else if (isObject(ret)) {
  8461. if (ret.error) {
  8462. msg = ret.error;
  8463. } else {
  8464. msg = ret.ok;
  8465. isValid = true;
  8466. }
  8467. }
  8468. else {
  8469. isValid = !!ret
  8470. }
  8471. rule = field._rules[field._i];
  8472. if (rule.not) {
  8473. msg = undefined;
  8474. isValid = method === "required" || !isValid;
  8475. }
  8476. if (rule.or) {
  8477. if (isValid) {
  8478. while ( field._i < field._rules.length && field._rules[field._i].or ) {
  8479. field._i++;
  8480. }
  8481. } else {
  8482. transfer = true;
  8483. }
  8484. }
  8485. else if (rule.and) {
  8486. if (!field.isValid) transfer = true;
  8487. }
  8488. if (transfer) {
  8489. isValid = true;
  8490. }
  8491. // message analysis, and throw rule level event
  8492. else {
  8493. if (isValid) {
  8494. if (field.showOk !== false) {
  8495. temp = attr(el, DATA_OK);
  8496. msg = temp === null ? isString(field.ok) ? field.ok : msg : temp;
  8497. if (!isString(msg) && isString(field.showOk)) {
  8498. msg = field.showOk;
  8499. }
  8500. if (isString(msg)) {
  8501. msgOpt.showOk = isValid;
  8502. }
  8503. }
  8504. }
  8505. if (!isValid || special) {
  8506. /* rule message priority:
  8507. 1. custom DOM message
  8508. 2. custom field message;
  8509. 3. global defined message;
  8510. 4. rule returned message;
  8511. 5. default message;
  8512. */
  8513. msg = (_getDataMsg(el, field, msg || rule.msg || me.messages[method]) || me.messages.fallback).replace(/\{0\|?([^\}]*)\}/, function(m, defaultDisplay){
  8514. return me._getDisplay(el, field.display) || defaultDisplay || me.messages[0];
  8515. });
  8516. }
  8517. if (!isValid) field.isValid = isValid;
  8518. msgOpt.msg = msg;
  8519. $(el).trigger( (isValid ? 'valid' : 'invalid') + CLS_NS_RULE, [method, msg]);
  8520. }
  8521. if (special && (!transfer || rule.and)) {
  8522. if (!isValid && !field._m) field._m = msg;
  8523. field._v = field._v || [];
  8524. field._v.push({
  8525. type: isValid ? !transfer ? 'ok' : 'tip' : 'error',
  8526. msg: msg || rule.msg
  8527. });
  8528. }
  8529. me._debug('log', ' ' + field._i + ': ' + method + ' => ' + (isValid || msg));
  8530. // the current rule has passed, continue to validate
  8531. if ( (isValid || special) && field._i < field._rules.length - 1) {
  8532. field._i++;
  8533. me._checkRule(el, field);
  8534. }
  8535. // field was invalid, or all fields was valid
  8536. else {
  8537. field._i = 0;
  8538. if (special) {
  8539. msgOpt.isValid = field.isValid;
  8540. msgOpt.result = field._v;
  8541. msgOpt.msg = field._m || '';
  8542. if (!field.value && (field._e === 'focusin')) {
  8543. msgOpt.type = 'tip';
  8544. }
  8545. } else {
  8546. msgOpt.isValid = isValid;
  8547. }
  8548. me._validatedField(el, field, msgOpt);
  8549. delete field._m;
  8550. delete field._v;
  8551. }
  8552. },
  8553. // Verify a rule form a field
  8554. _checkRule: function(el, field) {
  8555. var me = this,
  8556. ret,
  8557. fn,
  8558. old,
  8559. key = field.key,
  8560. rule = field._rules[field._i],
  8561. method = rule.method,
  8562. params = rule.params;
  8563. // request has been sent, wait it
  8564. if (me.submiting && me.deferred[key]) {
  8565. return;
  8566. }
  8567. old = field.old;
  8568. field._r = method;
  8569. if (old && !field.must && !rule.must && rule.result !== undefined &&
  8570. old.ruleName === method && old.id === el.id &&
  8571. field.value && old.value === field.value )
  8572. {
  8573. // get result from cache
  8574. ret = rule.result;
  8575. }
  8576. else {
  8577. // get result from current rule
  8578. fn = _getDataRule(el, method) || me.rules[method] || noop;
  8579. ret = fn.call(field, el, params, field);
  8580. if (fn.msg) rule.msg = fn.msg;
  8581. }
  8582. // asynchronous validation
  8583. if (isObject(ret) && isFunction(ret.then)) {
  8584. me.deferred[key] = ret;
  8585. // whether the field valid is unknown
  8586. field.isValid = undefined;
  8587. // show loading message
  8588. !me.checkOnly && me.showMsg(el, {
  8589. type: 'loading',
  8590. msg: me.messages.loading
  8591. }, field);
  8592. // waiting to parse the response data
  8593. ret.then(
  8594. function(d, textStatus, jqXHR) {
  8595. var data = trim(jqXHR.responseText),
  8596. result,
  8597. dataFilter = field.dataFilter;
  8598. // detect if data is json or jsonp format
  8599. if (/jsonp?/.test(this.dataType)) {
  8600. data = d;
  8601. } else if (data.charAt(0) === '{') {
  8602. data = $.parseJSON(data);
  8603. }
  8604. // filter data
  8605. result = dataFilter.call(this, data, field);
  8606. if (result === undefined) result = dataFilter.call(this, data.data, field);
  8607. rule.data = this.data;
  8608. rule.result = field.old ? result : undefined;
  8609. me._validatedRule(el, field, result);
  8610. },
  8611. function(jqXHR, textStatus){
  8612. me._validatedRule(el, field, me.messages[textStatus] || textStatus);
  8613. }
  8614. ).always(function(){
  8615. delete me.deferred[key];
  8616. });
  8617. }
  8618. // other result
  8619. else {
  8620. me._validatedRule(el, field, ret);
  8621. }
  8622. },
  8623. // Processing the validation
  8624. _validate: function(el, field) {
  8625. var me = this;
  8626. // doesn't validate the element that has "disabled" or "novalidate" attribute
  8627. if ( el.disabled || attr(el, NOVALIDATE) !== null ) {
  8628. return;
  8629. }
  8630. field = field || me.getField(el);
  8631. if (!field) return;
  8632. if (!field._rules) me._parse(el);
  8633. if (!field._rules) return;
  8634. me._debug('info', field.key);
  8635. field.isValid = true;
  8636. field.element = el;
  8637. // Cache the value
  8638. field.value = field.getValue();
  8639. // if the field is not required, and that has a blank value
  8640. if (!field.required && !field.must && !field.value) {
  8641. if (!_checkable(el)) {
  8642. me._validatedField(el, field, {isValid: true});
  8643. return true;
  8644. }
  8645. }
  8646. me._checkRule(el, field);
  8647. return field.isValid;
  8648. },
  8649. _debug: function(type, messages) {
  8650. if (window.console && this.options.debug) {
  8651. console[type](messages);
  8652. }
  8653. },
  8654. /**
  8655. * Detecting whether the value of an element that matches a rule
  8656. *
  8657. * @method test
  8658. * @param {Element} el - input element
  8659. * @param {String} rule - rule name
  8660. */
  8661. test: function(el, rule) {
  8662. var me = this,
  8663. ret,
  8664. parts = rRule.exec(rule),
  8665. field,
  8666. method,
  8667. params;
  8668. if (parts) {
  8669. method = parts[1];
  8670. if (method in me.rules) {
  8671. params = parts[2] || parts[3];
  8672. params = params ? params.split(', ') : undefined;
  8673. field = me.getField(el, true);
  8674. field._r = method;
  8675. field.value = field.getValue();
  8676. ret = me.rules[method].call(field, el, params);
  8677. }
  8678. }
  8679. return ret === true || ret === undefined || ret === null;
  8680. },
  8681. _getDisplay: function(el, str) {
  8682. return !isString(str) ? isFunction(str) ? str.call(this, el) : '' : str;
  8683. },
  8684. _getMsgOpt: function(obj, field) {
  8685. var opt = field ? field : this.options;
  8686. return $.extend({
  8687. type: 'error',
  8688. pos: _getPos(opt.msgClass),
  8689. target: opt.target,
  8690. wrapper: opt.msgWrapper,
  8691. style: opt.msgStyle,
  8692. cls: opt.msgClass,
  8693. arrow: opt.msgArrow,
  8694. icon: opt.msgIcon
  8695. }, isString(obj) ? {msg: obj} : obj);
  8696. },
  8697. _getMsgDOM: function(el, msgOpt) {
  8698. var $el = $(el), $msgbox, datafor, tgt, container;
  8699. if ( $el.is(INPUT_SELECTOR) ) {
  8700. tgt = msgOpt.target || attr(el, DATA_TARGET);
  8701. if (tgt) {
  8702. tgt = !isFunction(tgt) ? tgt.charAt(0) === '#' ? $(tgt) : this.$el.find(tgt) : tgt.call(this, el);
  8703. if (tgt.length) {
  8704. if ( tgt.is(INPUT_SELECTOR) ) {
  8705. $el = tgt
  8706. el = tgt.get(0);
  8707. } else if ( tgt.hasClass(CLS_MSG_BOX) ) {
  8708. $msgbox = tgt;
  8709. } else {
  8710. container = tgt;
  8711. }
  8712. }
  8713. }
  8714. if (!$msgbox) {
  8715. datafor = (!_checkable(el) || !el.name) && el.id ? el.id : el.name;
  8716. $msgbox = (container || this.$el).find(msgOpt.wrapper + '.' + CLS_MSG_BOX + '[for="' + datafor + '"]');
  8717. }
  8718. } else {
  8719. $msgbox = $el;
  8720. }
  8721. // Create new message box
  8722. if (!msgOpt.hide && !$msgbox.length) {
  8723. $msgbox = $('<'+ msgOpt.wrapper + '>').attr({
  8724. 'class': CLS_MSG_BOX + (msgOpt.cls ? ' ' + msgOpt.cls : ''),
  8725. 'style': msgOpt.style || undefined,
  8726. 'for': datafor
  8727. });
  8728. if (container) {
  8729. $msgbox.appendTo(container);
  8730. } else {
  8731. if ( _checkable(el) ) {
  8732. var $parent = $el.parent();
  8733. $msgbox.appendTo( $parent.is('label') ? $parent.parent() : $parent );
  8734. } else {
  8735. $msgbox[!msgOpt.pos || msgOpt.pos === 'right' ? 'insertAfter' : 'insertBefore']($el);
  8736. }
  8737. }
  8738. }
  8739. return $msgbox;
  8740. },
  8741. /**
  8742. * Show validation message
  8743. *
  8744. * @method showMsg
  8745. * @param {Element} el - input element
  8746. * @param {Object} msgOpt
  8747. */
  8748. showMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  8749. if (!el) return;
  8750. var me = this,
  8751. opt = me.options,
  8752. msgShow,
  8753. msgMaker,
  8754. temp,
  8755. $msgbox;
  8756. if (isObject(el) && !el.jquery && !msgOpt) {
  8757. $.each(el, function(key, msg) {
  8758. var el = me.elements[key] || me.$el.find(_key2selector(key))[0];
  8759. me.showMsg(el, msg);
  8760. });
  8761. return;
  8762. }
  8763. if ($(el).is(INPUT_SELECTOR)) {
  8764. field = field || me.getField(el);
  8765. }
  8766. if (!(msgMaker = (field || opt).msgMaker)) {
  8767. return;
  8768. }
  8769. msgOpt = me._getMsgOpt(msgOpt, field);
  8770. el = (el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]') : $(el)).get(0);
  8771. // ok or tip
  8772. if (!msgOpt.msg && msgOpt.type !== 'error') {
  8773. temp = attr(el, 'data-' + msgOpt.type);
  8774. if (temp !== null) msgOpt.msg = temp;
  8775. }
  8776. if ( !isString(msgOpt.msg) ) {
  8777. return;
  8778. }
  8779. $msgbox = me._getMsgDOM(el, msgOpt);
  8780. !rPos.test($msgbox[0].className) && $msgbox.addClass(msgOpt.cls);
  8781. if ( isIE === 6 && msgOpt.pos === 'bottom' ) {
  8782. $msgbox[0].style.marginTop = $(el).outerHeight() + 'px';
  8783. }
  8784. $msgbox.html( msgMaker.call(me, msgOpt) )[0].style.display = '';
  8785. if (isFunction(msgShow = field && field.msgShow || opt.msgShow)) {
  8786. msgShow.call(me, $msgbox, msgOpt.type);
  8787. }
  8788. },
  8789. /**
  8790. * Hide validation message
  8791. *
  8792. * @method hideMsg
  8793. * @param {Element} el - input element
  8794. * @param {Object} msgOpt optional
  8795. */
  8796. hideMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  8797. var me = this,
  8798. opt = me.options,
  8799. msgHide,
  8800. $msgbox;
  8801. el = $(el).get(0);
  8802. if ($(el).is(INPUT_SELECTOR)) {
  8803. field = field || me.getField(el);
  8804. if (field) {
  8805. if (field.isValid || me.reseting) attr(el, ARIA_INVALID, null);
  8806. }
  8807. }
  8808. msgOpt = me._getMsgOpt(msgOpt, field);
  8809. msgOpt.hide = true;
  8810. $msgbox = me._getMsgDOM(el, msgOpt);
  8811. if (!$msgbox.length) return;
  8812. if ( isFunction(msgHide = field && field.msgHide || opt.msgHide) ) {
  8813. msgHide.call(me, $msgbox, msgOpt.type);
  8814. } else {
  8815. $msgbox[0].style.display = 'none';
  8816. $msgbox[0].innerHTML = '';
  8817. }
  8818. },
  8819. /**
  8820. * Get field information
  8821. *
  8822. * @method getField
  8823. * @param {Element} - input element
  8824. * @return {Object} field
  8825. */
  8826. getField: function(el, must) {
  8827. var me = this,
  8828. key,
  8829. field;
  8830. if (isString(el)) {
  8831. key = el;
  8832. el = undefined;
  8833. } else {
  8834. if (attr(el, DATA_RULE)) {
  8835. return me._parse(el);
  8836. }
  8837. if (el.id && '#' + el.id in me.fields || !el.name) {
  8838. key = '#' + el.id;
  8839. } else {
  8840. key = el.name;
  8841. }
  8842. }
  8843. if ( (field = me.fields[key]) || must && (field = new me.Field(key)) ) {
  8844. field.element = el;
  8845. }
  8846. return field;
  8847. },
  8848. /**
  8849. * Config a field
  8850. *
  8851. * @method: setField
  8852. * @param {String} key
  8853. * @param {Object} obj
  8854. */
  8855. setField: function(key, obj) {
  8856. var fields = {};
  8857. if (!key) return;
  8858. // update this field
  8859. if (isString(key)) {
  8860. fields[key] = obj;
  8861. }
  8862. // update fields
  8863. else {
  8864. fields = key;
  8865. }
  8866. this._initFields(fields);
  8867. },
  8868. /**
  8869. * Detecting whether the form is valid
  8870. *
  8871. * @method isFormValid
  8872. * @return {Boolean}
  8873. */
  8874. isFormValid: function() {
  8875. var fields = this.fields, k, field;
  8876. for (k in fields) {
  8877. field = fields[k];
  8878. if (!field._rules || !field.required && !field.must && !field.value) continue;
  8879. if (!field.isValid) return false;
  8880. }
  8881. return true;
  8882. },
  8883. /**
  8884. * Prevent submission form
  8885. *
  8886. * @method holdSubmit
  8887. * @param {Boolean} hold - If set to false, will release the hold
  8888. */
  8889. holdSubmit: function(hold) {
  8890. this.submiting = hold === undefined || hold;
  8891. },
  8892. /**
  8893. * Clean validation messages
  8894. *
  8895. * @method cleanUp
  8896. */
  8897. cleanUp: function() {
  8898. this._reset(1);
  8899. },
  8900. /**
  8901. * Destroy the validation
  8902. *
  8903. * @method destroy
  8904. */
  8905. destroy: function() {
  8906. this._reset(1);
  8907. this.$el.off(CLS_NS).removeData(NS);
  8908. attr(this.$el[0], NOVALIDATE, this._NOVALIDATE);
  8909. }
  8910. };
  8911. /**
  8912. * Create Field Factory
  8913. *
  8914. * @class
  8915. * @param {Object} context
  8916. * @return {Function} Factory
  8917. */
  8918. function _createFieldFactory(context) {
  8919. function FieldFactory() {
  8920. var options = this.options;
  8921. for (var i in options) {
  8922. if (i in fieldDefaults) this[i] = options[i];
  8923. }
  8924. $.extend(this, {
  8925. _valHook: function() {
  8926. return this.element.contentEditable === 'true' ? 'text' : 'val';
  8927. },
  8928. getValue: function() {
  8929. var elem = this.element;
  8930. if (elem.type === "number" && elem.validity && elem.validity.badInput) {
  8931. return 'NaN';
  8932. }
  8933. return $(elem)[this._valHook()]();
  8934. },
  8935. setValue: function(value) {
  8936. $(this.element)[this._valHook()](this.value = value);
  8937. },
  8938. // Get a range of validation messages
  8939. getRangeMsg: function(value, params, suffix) {
  8940. if (!params) return;
  8941. var me = this,
  8942. msg = me.messages[me._r] || '',
  8943. result,
  8944. p = params[0].split('~'),
  8945. e = params[1] === 'false',
  8946. a = p[0],
  8947. b = p[1],
  8948. c = 'rg',
  8949. args = [''],
  8950. isNumber = trim(value) && +value === +value;
  8951. function compare(large, small) {
  8952. return !e ? large >= small : large > small;
  8953. }
  8954. if (p.length === 2) {
  8955. if (a && b) {
  8956. if (isNumber && compare(value, +a) && compare(+b, value)) {
  8957. result = true;
  8958. }
  8959. args = args.concat(p);
  8960. c = e ? 'gtlt' : 'rg';
  8961. }
  8962. else if (a && !b) {
  8963. if (isNumber && compare(value, +a)) {
  8964. result = true;
  8965. }
  8966. args.push(a);
  8967. c = e ? 'gt' : 'gte';
  8968. }
  8969. else if (!a && b) {
  8970. if (isNumber && compare(+b, value)) {
  8971. result = true;
  8972. }
  8973. args.push(b);
  8974. c = e ? 'lt' : 'lte';
  8975. }
  8976. }
  8977. else {
  8978. if (value === +a) {
  8979. result = true;
  8980. }
  8981. args.push(a);
  8982. c = 'eq';
  8983. }
  8984. if (msg) {
  8985. if (suffix && msg[c + suffix]) {
  8986. c += suffix;
  8987. }
  8988. args[0] = msg[c];
  8989. }
  8990. return result || me._rules && ( me._rules[me._i].msg = me.renderMsg.apply(null, args) );
  8991. },
  8992. // Render message template
  8993. renderMsg: function() {
  8994. var args = arguments,
  8995. tpl = args[0],
  8996. i = args.length;
  8997. if (!tpl) return;
  8998. while (--i) {
  8999. tpl = tpl.replace('{' + i + '}', args[i]);
  9000. }
  9001. return tpl;
  9002. }
  9003. });
  9004. }
  9005. function Field(key, obj, oldField) {
  9006. this.key = key;
  9007. this.validator = context;
  9008. $.extend(this, oldField, obj);
  9009. }
  9010. FieldFactory.prototype = context;
  9011. Field.prototype = new FieldFactory();
  9012. return Field;
  9013. }
  9014. /**
  9015. * Create Rules
  9016. *
  9017. * @class
  9018. * @param {Object} obj rules
  9019. * @param {Object} context context
  9020. */
  9021. function Rules(obj, context) {
  9022. if (!isObject(obj)) return;
  9023. var k, that = context ? context === true ? this : context : Rules.prototype;
  9024. for (k in obj) {
  9025. if (_checkRuleName(k))
  9026. that[k] = _getRule(obj[k]);
  9027. }
  9028. }
  9029. /**
  9030. * Create Messages
  9031. *
  9032. * @class
  9033. * @param {Object} obj rules
  9034. * @param {Object} context context
  9035. */
  9036. function Messages(obj, context) {
  9037. if (!isObject(obj)) return;
  9038. var k, that = context ? context === true ? this : context : Messages.prototype;
  9039. for (k in obj) {
  9040. that[k] = obj[k];
  9041. }
  9042. }
  9043. // Rule converted factory
  9044. function _getRule(fn) {
  9045. switch ($.type(fn)) {
  9046. case 'function':
  9047. return fn;
  9048. case 'array':
  9049. var f = function() {
  9050. return fn[0].test(this.value) || fn[1] || false;
  9051. };
  9052. f.msg = fn[1];
  9053. return f;
  9054. case 'regexp':
  9055. return function() {
  9056. return fn.test(this.value);
  9057. };
  9058. }
  9059. }
  9060. // Get instance by an element
  9061. function _getInstance(el) {
  9062. var wrap, k, options;
  9063. if (!el || !el.tagName) return;
  9064. switch (el.tagName) {
  9065. case 'INPUT':
  9066. case 'SELECT':
  9067. case 'TEXTAREA':
  9068. case 'BUTTON':
  9069. case 'FIELDSET':
  9070. wrap = el.form || $(el).closest('.' + CLS_WRAPPER);
  9071. break;
  9072. case 'FORM':
  9073. wrap = el;
  9074. break;
  9075. default:
  9076. wrap = $(el).closest('.' + CLS_WRAPPER);
  9077. }
  9078. for (k in preinitialized) {
  9079. if ($(wrap).is(k)) {
  9080. options = preinitialized[k];
  9081. break;
  9082. }
  9083. }
  9084. return $(wrap).data(NS) || $(wrap)[NS](options).data(NS);
  9085. }
  9086. // Get custom rules on the node
  9087. function _getDataRule(el, method) {
  9088. var fn = trim(attr(el, DATA_RULE + '-' + method));
  9089. if ( fn && (fn = new Function("return " + fn)()) ) {
  9090. return _getRule(fn);
  9091. }
  9092. }
  9093. // Get custom messages on the node
  9094. function _getDataMsg(el, field, m) {
  9095. var msg = field.msg,
  9096. item = field._r;
  9097. if ( isObject(msg) ) msg = msg[item];
  9098. if ( !isString(msg) ) {
  9099. msg = attr(el, DATA_MSG + '-' + item) || attr(el, DATA_MSG) || ( m ? isString(m) ? m : m[item] : '');
  9100. }
  9101. return msg;
  9102. }
  9103. // Get message position
  9104. function _getPos(str) {
  9105. var pos;
  9106. if (str) pos = rPos.exec(str);
  9107. return pos && pos[0];
  9108. }
  9109. // Check whether the element is checkbox or radio
  9110. function _checkable(el) {
  9111. return el.tagName === 'INPUT' && el.type === 'checkbox' || el.type === 'radio';
  9112. }
  9113. // Parse date string to timestamp
  9114. function _parseDate(str) {
  9115. return Date.parse(str.replace(/\.|\-/g, '/'));
  9116. }
  9117. // Rule name only allows alphanumeric characters and underscores
  9118. function _checkRuleName(name) {
  9119. return /^\w+$/.test(name);
  9120. }
  9121. // Translate field key to jQuery selector.
  9122. function _key2selector(key) {
  9123. var isID = key.charAt(0) === "#";
  9124. key = key.replace(/([:.{(|)}/\[\]])/g, "\\$1");
  9125. return isID ? key : '[name="'+ key +'"]:first';
  9126. }
  9127. // Fixed a issue cause by refresh page in IE.
  9128. $(window).on('beforeunload', function(){
  9129. this.focus();
  9130. });
  9131. $(document)
  9132. .on('click', ':submit', function(){
  9133. var input = this, attrNode;
  9134. if (!input.form) return;
  9135. // Shim for "formnovalidate"
  9136. attrNode = input.getAttributeNode('formnovalidate');
  9137. if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
  9138. novalidateonce = true;
  9139. }
  9140. })
  9141. // Automatic initializing form validation
  9142. .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
  9143. if ( attr(this, NOVALIDATE) !== null ) return;
  9144. var $form = $(this), me;
  9145. if ( !$form.data(NS) && (me = _getInstance(this)) ) {
  9146. if ( !$.isEmptyObject(me.fields) ) {
  9147. // Execute event handler
  9148. if (e.type === 'focusin') {
  9149. me._focusin(e);
  9150. } else {
  9151. me._submit(e);
  9152. }
  9153. } else {
  9154. attr(this, NOVALIDATE, NOVALIDATE);
  9155. $form.off(CLS_NS).removeData(NS);
  9156. }
  9157. }
  9158. });
  9159. new Messages({
  9160. fallback: "This field is not valid.",
  9161. loading: 'Validating...'
  9162. });
  9163. // Built-in rules (global)
  9164. new Rules({
  9165. /**
  9166. * required
  9167. *
  9168. * @example:
  9169. required
  9170. required(anotherRule)
  9171. required(not, -1)
  9172. required(from, .contact)
  9173. */
  9174. required: function(element, params) {
  9175. var me = this,
  9176. val = trim(me.value),
  9177. isValid = true;
  9178. if (params) {
  9179. if ( params.length === 1 ) {
  9180. if ( !_checkRuleName(params[0]) ) {
  9181. if (!val && !$(params[0], me.$el).length ) {
  9182. return null;
  9183. }
  9184. }
  9185. else if ( me.rules[params[0]] ) {
  9186. if ( !val && !me.test(element, params[0]) ) {
  9187. return null;
  9188. }
  9189. }
  9190. }
  9191. else if ( params[0] === 'not' ) {
  9192. $.each(params.slice(1), function() {
  9193. return (isValid = val !== trim(this));
  9194. });
  9195. }
  9196. else if ( params[0] === 'from' ) {
  9197. var $elements = me.$el.find(params[1]),
  9198. VALIDATED = '_validated_',
  9199. ret;
  9200. isValid = $elements.filter(function(){
  9201. var field = me.getField(this);
  9202. return field && !!trim(field.getValue());
  9203. }).length >= (params[2] || 1);
  9204. if (isValid) {
  9205. if (!val) ret = null;
  9206. } else {
  9207. ret = _getDataMsg($elements[0], me) || false;
  9208. }
  9209. if ( !$(element).data(VALIDATED) ) {
  9210. $elements.data(VALIDATED, 1).each(function(){
  9211. if (element !== this) {
  9212. me._validate(this);
  9213. }
  9214. }).removeData(VALIDATED);
  9215. }
  9216. return ret;
  9217. }
  9218. }
  9219. return isValid && !!val;
  9220. },
  9221. /**
  9222. * integer
  9223. *
  9224. * @example:
  9225. integer
  9226. integer[+]
  9227. integer[+0]
  9228. integer[-]
  9229. integer[-0]
  9230. */
  9231. integer: function(element, params) {
  9232. var re, z = '0|',
  9233. p = '[1-9]\\d*',
  9234. key = params ? params[0] : '*';
  9235. switch (key) {
  9236. case '+':
  9237. re = p;
  9238. break;
  9239. case '-':
  9240. re = '-' + p;
  9241. break;
  9242. case '+0':
  9243. re = z + p;
  9244. break;
  9245. case '-0':
  9246. re = z + '-' + p;
  9247. break;
  9248. default:
  9249. re = z + '-?' + p;
  9250. }
  9251. re = '^(?:' + re + ')$';
  9252. return new RegExp(re).test(this.value) || (this.messages.integer && this.messages.integer[key]);
  9253. },
  9254. /**
  9255. * match another field
  9256. *
  9257. * @example:
  9258. match[password] Match the password field (two values ​​must be the same)
  9259. match[eq, password] Ditto
  9260. match[neq, count] The value must be not equal to the value of the count field
  9261. match[lt, count] The value must be less than the value of the count field
  9262. match[lte, count] The value must be less than or equal to the value of the count field
  9263. match[gt, count] The value must be greater than the value of the count field
  9264. match[gte, count] The value must be greater than or equal to the value of the count field
  9265. match[gte, startDate, date]
  9266. match[gte, startTime, time]
  9267. **/
  9268. match: function(element, params) {
  9269. if (!params) return;
  9270. var me = this,
  9271. isValid = true,
  9272. a, b,
  9273. key, msg, type = 'eq', parser,
  9274. selector2, elem2, field2;
  9275. if (params.length === 1) {
  9276. key = params[0];
  9277. } else {
  9278. type = params[0];
  9279. key = params[1];
  9280. }
  9281. selector2 = _key2selector(key);
  9282. elem2 = me.$el.find(selector2)[0];
  9283. // If the compared field is not exist
  9284. if (!elem2) return;
  9285. field2 = me.getField(elem2);
  9286. a = me.value;
  9287. b = field2.getValue();
  9288. if (!me._match) {
  9289. me.$el.on('valid'+CLS_NS_FIELD+CLS_NS, selector2, function(){
  9290. $(element).trigger('validate');
  9291. });
  9292. me._match = field2._match = 1;
  9293. }
  9294. // If both fields are blank
  9295. if (!me.required && a === "" && b === "") {
  9296. return null;
  9297. }
  9298. parser = params[2];
  9299. if (parser) {
  9300. if (/^date(time)?$/i.test(parser)) {
  9301. a = _parseDate(a);
  9302. b = _parseDate(b);
  9303. } else if (parser === 'time') {
  9304. a = +a.replace(/:/g, '');
  9305. b = +b.replace(/:/g, '');
  9306. }
  9307. }
  9308. // If the compared field is incorrect, we only ensure that this field is correct.
  9309. if (type !== "eq" && !isNaN(+a) && isNaN(+b)) {
  9310. return true;
  9311. }
  9312. switch (type) {
  9313. case 'lt':
  9314. isValid = +a < +b; break;
  9315. case 'lte':
  9316. isValid = +a <= +b; break;
  9317. case 'gte':
  9318. isValid = +a >= +b; break;
  9319. case 'gt':
  9320. isValid = +a > +b; break;
  9321. case 'neq':
  9322. isValid = a !== b; break;
  9323. default:
  9324. isValid = a === b;
  9325. }
  9326. return isValid || (
  9327. isObject(me.messages.match)
  9328. && me.messages.match[type].replace( '{1}', me._getDisplay( element, field2.display || key ) )
  9329. );
  9330. },
  9331. /**
  9332. * range numbers
  9333. *
  9334. * @example:
  9335. range[0~99] Number 0-99
  9336. range[0~] Number greater than or equal to 0
  9337. range[~100] Number less than or equal to 100
  9338. **/
  9339. range: function(element, params) {
  9340. return this.getRangeMsg(this.value, params);
  9341. },
  9342. /**
  9343. * how many checkbox or radio inputs that checked
  9344. *
  9345. * @example:
  9346. checked; no empty, same to required
  9347. checked[1~3] 1-3 items
  9348. checked[1~] greater than 1 item
  9349. checked[~3] less than 3 items
  9350. checked[3] 3 items
  9351. **/
  9352. checked: function(element, params) {
  9353. if ( !_checkable(element) ) return;
  9354. var me = this,
  9355. elem, count;
  9356. if (element.name) {
  9357. count = me.$el.find('input[name="' + element.name + '"]').filter(function() {
  9358. var el = this;
  9359. if (!elem && _checkable(el)) elem = el;
  9360. return !el.disabled && el.checked;
  9361. }).length;
  9362. } else {
  9363. elem = element;
  9364. count = elem.checked;
  9365. }
  9366. if (params) {
  9367. return me.getRangeMsg(count, params);
  9368. } else {
  9369. return !!count || _getDataMsg(elem, me, '') || me.messages.required || false;
  9370. }
  9371. },
  9372. /**
  9373. * length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
  9374. *
  9375. * @example:
  9376. length[6~16] 6-16 characters
  9377. length[6~] Greater than 6 characters
  9378. length[~16] Less than 16 characters
  9379. length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
  9380. **/
  9381. length: function(element, params) {
  9382. var value = this.value,
  9383. len = (params[1] === 'true' ? value.replace(rDoubleBytes, 'xx') : value).length;
  9384. return this.getRangeMsg(len, params, (params[1] ? '_2' : ''));
  9385. },
  9386. /**
  9387. * remote validation
  9388. *
  9389. * @description
  9390. * remote([get:]url [, name1, [name2 ...]]);
  9391. * Adaptation three kinds of results (Front for the successful, followed by a failure):
  9392. 1. text:
  9393. '' 'Error Message'
  9394. 2. json:
  9395. {"ok": ""} {"error": "Error Message"}
  9396. 3. json wrapper:
  9397. {"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
  9398. * @example
  9399. The simplest: remote(path/to/server);
  9400. With parameters: remote(path/to/server, name1, name2, ...);
  9401. By GET: remote(get:path/to/server, name1, name2, ...);
  9402. Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
  9403. Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)
  9404. */
  9405. remote: function(element, params) {
  9406. if (!params) return;
  9407. var me = this,
  9408. arr = rAjaxType.exec(params[0]),
  9409. rule = me._rules[me._i],
  9410. data = {},
  9411. queryString = '',
  9412. url = arr[3],
  9413. type = arr[2] || 'POST', // GET / POST
  9414. rType = (arr[1]||'').toLowerCase(), // CORS / JSONP
  9415. dataType;
  9416. rule.must = true;
  9417. data[element.name] = me.value;
  9418. // There are extra fields
  9419. if (params[1]) {
  9420. $.map(params.slice(1), function(name) {
  9421. var arr, key;
  9422. if (~name.indexOf('=')) {
  9423. queryString += '&' + name;
  9424. } else {
  9425. arr = name.split(':');
  9426. name = trim(arr[0]);
  9427. key = trim(arr[1]) || name;
  9428. data[ name ] = me.$el.find( _key2selector(key) ).val();
  9429. }
  9430. });
  9431. }
  9432. data = $.param(data) + queryString;
  9433. if (!me.must && rule.data && rule.data === data) {
  9434. return rule.result;
  9435. }
  9436. // Cross-domain request, force jsonp dataType
  9437. if (rType !== 'cors' && /^https?:/.test(url) && !~url.indexOf(location.host)) {
  9438. dataType = 'jsonp';
  9439. }
  9440. // Asynchronous validation need return jqXHR objects
  9441. return $.ajax({
  9442. url: url,
  9443. type: type,
  9444. data: data,
  9445. dataType: dataType
  9446. });
  9447. },
  9448. /**
  9449. * filter characters, direct filtration without prompting error (support custom regular expressions)
  9450. *
  9451. * @example
  9452. * filter filtering unsafe characters
  9453. * filter(regexp) filtering the "regexp" matched characters
  9454. */
  9455. filter: function(element, params) {
  9456. var value = this.value,
  9457. temp = value.replace( params ? (new RegExp("[" + params[0] + "]", "gm")) : rUnsafe, '' );
  9458. if (temp !== value) this.setValue(temp);
  9459. }
  9460. });
  9461. /**
  9462. * Config global options
  9463. *
  9464. * @static config
  9465. * @param {Object} options
  9466. */
  9467. Validator.config = function(key, value) {
  9468. if (isObject(key)) {
  9469. $.each(key, _config);
  9470. }
  9471. else if (isString(key)) {
  9472. _config(key, value);
  9473. }
  9474. function _config(k, o) {
  9475. if (k === 'rules') {
  9476. new Rules(o);
  9477. }
  9478. else if (k === 'messages') {
  9479. new Messages(o);
  9480. }
  9481. else if (k in fieldDefaults) {
  9482. fieldDefaults[k] = o;
  9483. }
  9484. else {
  9485. defaults[k] = o;
  9486. }
  9487. }
  9488. };
  9489. /**
  9490. * Config themes
  9491. *
  9492. * @static setTheme
  9493. * @param {String|Object} name
  9494. * @param {Object} obj
  9495. * @example
  9496. .setTheme( themeName, themeOptions )
  9497. .setTheme( multiThemes )
  9498. */
  9499. Validator.setTheme = function(name, obj) {
  9500. if ( isObject(name) ) {
  9501. $.extend(true, themes, name);
  9502. }
  9503. else if ( isString(name) && isObject(obj) ) {
  9504. themes[name] = $.extend(themes[name], obj);
  9505. }
  9506. };
  9507. /**
  9508. * Resource loader
  9509. *
  9510. * @static load
  9511. * @param {String} str
  9512. * @example
  9513. .load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css
  9514. .load('local=zh-CN&css=') // load: local/zh-CN.js
  9515. .load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css
  9516. .load('local') // dito
  9517. */
  9518. Validator.load = function(str) {
  9519. if (!str) return;
  9520. var doc = document,
  9521. params = {},
  9522. node = doc.scripts[0],
  9523. dir, el, ONLOAD;
  9524. str.replace(/([^?=&]+)=([^&#]*)/g, function(m, key, value){
  9525. params[key] = value;
  9526. });
  9527. dir = params.dir || Validator.dir;
  9528. if (!Validator.css && params.css !== '') {
  9529. el = doc.createElement('link');
  9530. el.rel = 'stylesheet';
  9531. el.href = Validator.css = dir + 'jquery.validator.css';
  9532. node.parentNode.insertBefore(el, node);
  9533. }
  9534. if (!Validator.local && ~str.indexOf('local') && params.local !== '') {
  9535. Validator.local = (params.local || doc.documentElement.lang || 'en').replace('_','-');
  9536. Validator.pending = 1;
  9537. el = doc.createElement('script');
  9538. el.src = dir + 'local/' + Validator.local + '.js';
  9539. ONLOAD = 'onload' in el ? 'onload' : 'onreadystatechange';
  9540. el[ONLOAD] = function() {
  9541. if (!el.readyState || /loaded|complete/.test(el.readyState)) {
  9542. el = el[ONLOAD] = null;
  9543. delete Validator.pending;
  9544. $(window).triggerHandler('validatorready');
  9545. }
  9546. };
  9547. node.parentNode.insertBefore(el, node);
  9548. }
  9549. };
  9550. // Auto loading resources
  9551. (function(){
  9552. var scripts = document.scripts,
  9553. i = scripts.length, node, arr,
  9554. re = /(.*validator(?:\.min)?.js)(\?.*(?:local|css|dir)(?:=[\w\-]*)?)?/;
  9555. while (i-- && !arr) {
  9556. node = scripts[i];
  9557. arr = (node.hasAttribute ? node.src : node.getAttribute('src',4)||'').match(re);
  9558. }
  9559. if (!arr) return;
  9560. Validator.dir = arr[1].split('/').slice(0, -1).join('/')+'/';
  9561. Validator.load(arr[2]);
  9562. })();
  9563. return $[NS] = Validator;
  9564. }));
  9565. /*********************************
  9566. * Themes, rules, and i18n support
  9567. * Locale: Chinese; 中文
  9568. *********************************/
  9569. (function(factory) {
  9570. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  9571. typeof define === 'function' && define.amd ? define('validator-lang',['jquery'], factory) :
  9572. factory(jQuery);
  9573. }(function($) {
  9574. /* Global configuration
  9575. */
  9576. $.validator.config({
  9577. //stopOnError: true,
  9578. //focusCleanup: true,
  9579. //theme: 'yellow_right',
  9580. //timely: 2,
  9581. // Custom rules
  9582. rules: {
  9583. digits: [/^\d+$/, "请填写数字"]
  9584. ,letters: [/^[a-z]+$/i, "请填写字母"]
  9585. ,date: [/^\d{4}-\d{2}-\d{2}$/, "请填写有效的日期,格式:yyyy-mm-dd"]
  9586. ,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请填写有效的时间,00:00到23:59之间"]
  9587. ,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "请填写有效的邮箱"]
  9588. ,url: [/^(https?|s?ftp):\/\/\S+$/i, "请填写有效的网址"]
  9589. ,qq: [/^[1-9]\d{4,}$/, "请填写有效的QQ号"]
  9590. ,IDcard: [/^\d{6}(19|2\d)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)?$/, "请填写正确的身份证号码"]
  9591. ,tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "请填写有效的电话号码"]
  9592. ,mobile: [/^1[3-9]\d{9}$/, "请填写有效的手机号"]
  9593. ,zipcode: [/^\d{6}$/, "请检查邮政编码格式"]
  9594. ,chinese: [/^[\u0391-\uFFE5]+$/, "请填写中文字符"]
  9595. ,username: [/^\w{3,12}$/, "请填写3-12位数字、字母、下划线"]
  9596. ,password: [/^[\S]{6,16}$/, "请填写6-16位字符,不能包含空格"]
  9597. ,accept: function (element, params){
  9598. if (!params) return true;
  9599. var ext = params[0],
  9600. value = $(element).val();
  9601. return (ext === '*') ||
  9602. (new RegExp(".(?:" + ext + ")$", "i")).test(value) ||
  9603. this.renderMsg("只接受{1}后缀的文件", ext.replace(/\|/g, ','));
  9604. }
  9605. },
  9606. // Default error messages
  9607. messages: {
  9608. 0: "此处",
  9609. fallback: "{0}格式不正确",
  9610. loading: "正在验证...",
  9611. error: "网络异常",
  9612. timeout: "请求超时",
  9613. required: "{0}不能为空",
  9614. remote: "{0}已被使用",
  9615. integer: {
  9616. '*': "请填写整数",
  9617. '+': "请填写正整数",
  9618. '+0': "请填写正整数或0",
  9619. '-': "请填写负整数",
  9620. '-0': "请填写负整数或0"
  9621. },
  9622. match: {
  9623. eq: "{0}与{1}不一致",
  9624. neq: "{0}与{1}不能相同",
  9625. lt: "{0}必须小于{1}",
  9626. gt: "{0}必须大于{1}",
  9627. lte: "{0}不能大于{1}",
  9628. gte: "{0}不能小于{1}"
  9629. },
  9630. range: {
  9631. rg: "请填写{1}到{2}的数",
  9632. gte: "请填写不小于{1}的数",
  9633. lte: "请填写最大{1}的数",
  9634. gtlt: "请填写{1}到{2}之间的数",
  9635. gt: "请填写大于{1}的数",
  9636. lt: "请填写小于{1}的数"
  9637. },
  9638. checked: {
  9639. eq: "请选择{1}项",
  9640. rg: "请选择{1}到{2}项",
  9641. gte: "请至少选择{1}项",
  9642. lte: "请最多选择{1}项"
  9643. },
  9644. length: {
  9645. eq: "请填写{1}个字符",
  9646. rg: "请填写{1}到{2}个字符",
  9647. gte: "请至少填写{1}个字符",
  9648. lte: "请最多填写{1}个字符",
  9649. eq_2: "",
  9650. rg_2: "",
  9651. gte_2: "",
  9652. lte_2: ""
  9653. }
  9654. }
  9655. });
  9656. /* Themes
  9657. */
  9658. var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
  9659. $.validator.setTheme({
  9660. 'simple_right': {
  9661. formClass: 'n-simple',
  9662. msgClass: 'n-right'
  9663. },
  9664. 'simple_bottom': {
  9665. formClass: 'n-simple',
  9666. msgClass: 'n-bottom'
  9667. },
  9668. 'yellow_top': {
  9669. formClass: 'n-yellow',
  9670. msgClass: 'n-top',
  9671. msgArrow: TPL_ARROW
  9672. },
  9673. 'yellow_right': {
  9674. formClass: 'n-yellow',
  9675. msgClass: 'n-right',
  9676. msgArrow: TPL_ARROW
  9677. },
  9678. 'yellow_right_effect': {
  9679. formClass: 'n-yellow',
  9680. msgClass: 'n-right',
  9681. msgArrow: TPL_ARROW,
  9682. msgShow: function($msgbox, type){
  9683. var $el = $msgbox.children();
  9684. if ($el.is(':animated')) return;
  9685. if (type === 'error') {
  9686. $el.css({left: '20px', opacity: 0})
  9687. .delay(100).show().stop()
  9688. .animate({left: '-4px', opacity: 1}, 150)
  9689. .animate({left: '3px'}, 80)
  9690. .animate({left: 0}, 80);
  9691. } else {
  9692. $el.css({left: 0, opacity: 1}).fadeIn(200);
  9693. }
  9694. },
  9695. msgHide: function($msgbox, type){
  9696. var $el = $msgbox.children();
  9697. $el.stop().delay(100).show()
  9698. .animate({left: '20px', opacity: 0}, 300, function(){
  9699. $msgbox.hide();
  9700. });
  9701. }
  9702. }
  9703. });
  9704. }));
  9705. define('validator',['validator-core', 'validator-lang'], function (Validator, undefined) {
  9706. return Validator;
  9707. });
  9708. define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, Upload, Validator) {
  9709. var Form = {
  9710. config: {
  9711. },
  9712. events: {
  9713. validator: function (form, success, error, submit) {
  9714. if (!form.is("form"))
  9715. return;
  9716. //绑定表单事件
  9717. form.validator($.extend({
  9718. validClass: 'has-success',
  9719. invalidClass: 'has-error',
  9720. bindClassTo: '.form-group',
  9721. formClass: 'n-default n-bootstrap',
  9722. msgClass: 'n-right',
  9723. stopOnError: true,
  9724. display: function (elem) {
  9725. return $(elem).closest('.form-group').find(".control-label").text().replace(/\:/, '');
  9726. },
  9727. dataFilter: function (data) {
  9728. if (data.code === 1) {
  9729. return "";
  9730. } else {
  9731. return data.msg;
  9732. }
  9733. },
  9734. target: function (input) {
  9735. var $formitem = $(input).closest('.form-group'),
  9736. $msgbox = $formitem.find('span.msg-box');
  9737. if (!$msgbox.length) {
  9738. return [];
  9739. }
  9740. return $msgbox;
  9741. },
  9742. valid: function (ret) {
  9743. var that = this, submitBtn = $(".layer-footer [type=submit]", form);
  9744. that.holdSubmit();
  9745. $(".layer-footer [type=submit]", form).addClass("disabled");
  9746. //验证通过提交表单
  9747. Form.api.submit($(ret), function (data, ret) {
  9748. that.holdSubmit(false);
  9749. submitBtn.removeClass("disabled");
  9750. if (false === $(this).triggerHandler("success.form", [data, ret])) {
  9751. return false;
  9752. }
  9753. if (typeof success === 'function') {
  9754. if (false === success.call($(this), data, ret)) {
  9755. return false;
  9756. }
  9757. }
  9758. //提示及关闭当前窗口
  9759. var msg = ret.hasOwnProperty("msg") && ret.msg !== "" ? ret.msg : __('Operation completed');
  9760. parent.Toastr.success(msg);
  9761. parent.$(".btn-refresh").trigger("click");
  9762. var index = parent.Layer.getFrameIndex(window.name);
  9763. parent.Layer.close(index);
  9764. return false;
  9765. }, function (data, ret) {
  9766. that.holdSubmit(false);
  9767. if (false === $(this).triggerHandler("error.form", [data, ret])) {
  9768. return false;
  9769. }
  9770. submitBtn.removeClass("disabled");
  9771. if (typeof error === 'function') {
  9772. if (false === error.call($(this), data, ret)) {
  9773. return false;
  9774. }
  9775. }
  9776. }, submit);
  9777. return false;
  9778. }
  9779. }, form.data("validator-options") || {}));
  9780. //移除提交按钮的disabled类
  9781. $(".layer-footer [type=submit],.fixed-footer [type=submit],.normal-footer [type=submit]", form).removeClass("disabled");
  9782. },
  9783. selectpicker: function (form) {
  9784. //绑定select元素事件
  9785. if ($(".selectpicker", form).size() > 0) {
  9786. require(['bootstrap-select', 'bootstrap-select-lang'], function () {
  9787. $('.selectpicker', form).selectpicker();
  9788. });
  9789. }
  9790. },
  9791. selectpage: function (form) {
  9792. //绑定selectpage元素事件
  9793. if ($(".selectpage", form).size() > 0) {
  9794. require(['selectpage'], function () {
  9795. $('.selectpage', form).selectPage({
  9796. eAjaxSuccess: function (data) {
  9797. data.list = typeof data.rows !== 'undefined' ? data.rows : (typeof data.list !== 'undefined' ? data.list : []);
  9798. data.totalRow = typeof data.total !== 'undefined' ? data.total : (typeof data.totalRow !== 'undefined' ? data.totalRow : data.list.length);
  9799. return data;
  9800. }
  9801. });
  9802. });
  9803. //给隐藏的元素添加上validate验证触发事件
  9804. $(document).on("change", ".sp_hidden", function () {
  9805. $(this).trigger("validate");
  9806. });
  9807. $(document).on("change", ".sp_input", function () {
  9808. $(this).closest(".sp_container").find(".sp_hidden").trigger("change");
  9809. });
  9810. $(form).on("reset", function () {
  9811. setTimeout(function () {
  9812. $('.selectpage', form).selectPageClear();
  9813. }, 1);
  9814. });
  9815. }
  9816. },
  9817. cxselect: function (form) {
  9818. //绑定cxselect元素事件
  9819. if ($("[data-toggle='cxselect']", form).size() > 0) {
  9820. require(['cxselect'], function () {
  9821. $.cxSelect.defaults.jsonName = 'name';
  9822. $.cxSelect.defaults.jsonValue = 'value';
  9823. $.cxSelect.defaults.jsonSpace = 'data';
  9824. $("[data-toggle='cxselect']", form).cxSelect();
  9825. });
  9826. }
  9827. },
  9828. citypicker: function (form) {
  9829. //绑定城市远程插件
  9830. if ($("[data-toggle='city-picker']", form).size() > 0) {
  9831. require(['citypicker'], function () {});
  9832. }
  9833. },
  9834. datetimepicker: function (form) {
  9835. //绑定日期时间元素事件
  9836. if ($(".datetimepicker", form).size() > 0) {
  9837. require(['bootstrap-datetimepicker'], function () {
  9838. var options = {
  9839. format: 'YYYY-MM-DD HH:mm:ss',
  9840. icons: {
  9841. time: 'fa fa-clock-o',
  9842. date: 'fa fa-calendar',
  9843. up: 'fa fa-chevron-up',
  9844. down: 'fa fa-chevron-down',
  9845. previous: 'fa fa-chevron-left',
  9846. next: 'fa fa-chevron-right',
  9847. today: 'fa fa-history',
  9848. clear: 'fa fa-trash',
  9849. close: 'fa fa-remove'
  9850. },
  9851. showTodayButton: true,
  9852. showClose: true
  9853. };
  9854. $('.datetimepicker', form).parent().css('position', 'relative');
  9855. $('.datetimepicker', form).datetimepicker(options);
  9856. });
  9857. }
  9858. },
  9859. daterangepicker: function (form) {
  9860. //绑定日期时间元素事件
  9861. if ($(".datetimerange", form).size() > 0) {
  9862. require(['bootstrap-daterangepicker'], function () {
  9863. var ranges = {};
  9864. ranges[__('Today')] = [Moment().startOf('day'), Moment().endOf('day')];
  9865. ranges[__('Yesterday')] = [Moment().subtract(1, 'days').startOf('day'), Moment().subtract(1, 'days').endOf('day')];
  9866. ranges[__('Last 7 Days')] = [Moment().subtract(6, 'days').startOf('day'), Moment().endOf('day')];
  9867. ranges[__('Last 30 Days')] = [Moment().subtract(29, 'days').startOf('day'), Moment().endOf('day')];
  9868. ranges[__('This Month')] = [Moment().startOf('month'), Moment().endOf('month')];
  9869. ranges[__('Last Month')] = [Moment().subtract(1, 'month').startOf('month'), Moment().subtract(1, 'month').endOf('month')];
  9870. var options = {
  9871. timePicker: false,
  9872. autoUpdateInput: false,
  9873. timePickerSeconds: true,
  9874. timePicker24Hour: true,
  9875. autoApply: true,
  9876. locale: {
  9877. format: 'YYYY-MM-DD HH:mm:ss',
  9878. customRangeLabel: __("Custom Range"),
  9879. applyLabel: __("Apply"),
  9880. cancelLabel: __("Clear"),
  9881. },
  9882. ranges: ranges,
  9883. };
  9884. var origincallback = function (start, end) {
  9885. $(this.element).val(start.format(options.locale.format) + " - " + end.format(options.locale.format));
  9886. $(this.element).trigger('blur');
  9887. };
  9888. $(".datetimerange", form).each(function () {
  9889. var callback = typeof $(this).data('callback') == 'function' ? $(this).data('callback') : origincallback;
  9890. $(this).on('apply.daterangepicker', function (ev, picker) {
  9891. callback.call(picker, picker.startDate, picker.endDate);
  9892. });
  9893. $(this).on('cancel.daterangepicker', function (ev, picker) {
  9894. $(this).val('').trigger('blur');
  9895. });
  9896. $(this).daterangepicker($.extend({}, options, $(this).data()), callback);
  9897. });
  9898. });
  9899. }
  9900. },
  9901. plupload: function (form) {
  9902. //绑定plupload上传元素事件
  9903. if ($(".plupload", form).size() > 0) {
  9904. Upload.api.plupload($(".plupload", form));
  9905. }
  9906. },
  9907. faselect: function (form) {
  9908. //绑定fachoose选择附件事件
  9909. if ($(".fachoose", form).size() > 0) {
  9910. $(".fachoose", form).on('click', function () {
  9911. var that = this;
  9912. var multiple = $(this).data("multiple") ? $(this).data("multiple") : false;
  9913. var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : '';
  9914. parent.Fast.api.open("general/attachment/select?element_id=" + $(this).attr("id") + "&multiple=" + multiple + "&mimetype=" + mimetype, __('Choose'), {
  9915. callback: function (data) {
  9916. var button = $("#" + $(that).attr("id"));
  9917. var maxcount = $(button).data("maxcount");
  9918. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  9919. maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
  9920. if (input_id && data.multiple) {
  9921. var urlArr = [];
  9922. var inputObj = $("#" + input_id);
  9923. var value = $.trim(inputObj.val());
  9924. if (value !== "") {
  9925. urlArr.push(inputObj.val());
  9926. }
  9927. urlArr.push(data.url)
  9928. var result = urlArr.join(",");
  9929. if (maxcount > 0) {
  9930. var nums = value === '' ? 0 : value.split(/\,/).length;
  9931. var files = data.url !== "" ? data.url.split(/\,/) : [];
  9932. var remains = maxcount - nums;
  9933. if (files.length > remains) {
  9934. Toastr.error(__('You can choose up to %d file%s', remains));
  9935. return false;
  9936. }
  9937. }
  9938. inputObj.val(result).trigger("change");
  9939. } else {
  9940. $("#" + input_id).val(data.url).trigger("change");
  9941. }
  9942. }
  9943. });
  9944. return false;
  9945. });
  9946. }
  9947. },
  9948. fieldlist: function (form) {
  9949. if ($(".fieldlist", form).size() > 0) {
  9950. $(".fieldlist", form).on("click", ".append", function () {
  9951. var rel = parseInt($(this).closest("dl").attr("rel")) + 1;
  9952. var name = $(this).closest("dl").data("name");
  9953. $(this).closest("dl").attr("rel", rel);
  9954. $('<dd class="form-inline"><input type="text" name="' + name + '[field][' + rel + ']" class="form-control" value="" size="10" /> <input type="text" name="' + name + '[value][' + rel + ']" class="form-control" value="" size="40" /> <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span></dd>').insertBefore($(this).parent());
  9955. });
  9956. $(".fieldlist", form).on("click", "dd .btn-remove", function () {
  9957. $(this).parent().remove();
  9958. });
  9959. //拖拽排序
  9960. require(['dragsort'], function () {
  9961. //绑定拖动排序
  9962. $("dl.fieldlist", form).dragsort({
  9963. itemSelector: 'dd',
  9964. dragSelector: ".btn-dragsort",
  9965. dragEnd: function () {
  9966. },
  9967. placeHolderTemplate: "<dd></dd>"
  9968. });
  9969. });
  9970. }
  9971. },
  9972. bindevent: function (form) {
  9973. }
  9974. },
  9975. api: {
  9976. submit: function (form, success, error, submit) {
  9977. if (form.size() === 0)
  9978. return Toastr.error("表单未初始化完成,无法提交");
  9979. if (typeof submit === 'function') {
  9980. if (false === submit.call(form)) {
  9981. return false;
  9982. }
  9983. }
  9984. var type = form.attr("method").toUpperCase();
  9985. type = type && (type === 'GET' || type === 'POST') ? type : 'GET';
  9986. url = form.attr("action");
  9987. url = url ? url : location.href;
  9988. //修复当存在多选项元素时提交的BUG
  9989. var params = {};
  9990. var multipleList = $("[name$='[]']", form);
  9991. if (multipleList.size() > 0) {
  9992. var postFields = form.serializeArray().map(function (obj) {
  9993. return $(obj).prop("name");
  9994. });
  9995. $.each(multipleList, function (i, j) {
  9996. if (postFields.indexOf($(this).prop("name")) < 0) {
  9997. params[$(this).prop("name")] = '';
  9998. }
  9999. });
  10000. }
  10001. //调用Ajax请求方法
  10002. Fast.api.ajax({
  10003. type: type,
  10004. url: url,
  10005. data: form.serialize() + (Object.keys(params).length > 0 ? '&' + $.param(params) : ''),
  10006. dataType: 'json',
  10007. complete: function (xhr) {
  10008. var token = xhr.getResponseHeader('__token__');
  10009. if (token) {
  10010. $("input[name='__token__']", form).val(token);
  10011. }
  10012. }
  10013. }, function (data, ret) {
  10014. $('.form-group', form).removeClass('has-feedback has-success has-error');
  10015. if (data && typeof data === 'object') {
  10016. //刷新客户端token
  10017. if (typeof data.token !== 'undefined') {
  10018. $("input[name='__token__']", form).val(data.token);
  10019. }
  10020. //调用客户端事件
  10021. if (typeof data.callback !== 'undefined' && typeof data.callback === 'function') {
  10022. data.callback.call(form, data);
  10023. }
  10024. }
  10025. if (typeof success === 'function') {
  10026. if (false === success.call(form, data, ret)) {
  10027. return false;
  10028. }
  10029. }
  10030. }, function (data, ret) {
  10031. if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
  10032. $("input[name='__token__']", form).val(data.token);
  10033. }
  10034. if (typeof error === 'function') {
  10035. if (false === error.call(form, data, ret)) {
  10036. return false;
  10037. }
  10038. }
  10039. });
  10040. return false;
  10041. },
  10042. bindevent: function (form, success, error, submit) {
  10043. form = typeof form === 'object' ? form : $(form);
  10044. var events = Form.events;
  10045. events.bindevent(form);
  10046. events.validator(form, success, error, submit);
  10047. events.selectpicker(form);
  10048. events.daterangepicker(form);
  10049. events.selectpage(form);
  10050. events.cxselect(form);
  10051. events.citypicker(form);
  10052. events.datetimepicker(form);
  10053. events.plupload(form);
  10054. events.faselect(form);
  10055. events.fieldlist(form);
  10056. },
  10057. custom: {}
  10058. },
  10059. };
  10060. return Form;
  10061. });
  10062. // jQuery List DragSort v0.5.2
  10063. // Website: http://dragsort.codeplex.com/
  10064. // License: http://dragsort.codeplex.com/license
  10065. (function($) {
  10066. $.fn.dragsort = function(options) {
  10067. if (options == "destroy") {
  10068. $(this.selector).trigger("dragsort-uninit");
  10069. return;
  10070. }
  10071. var opts = $.extend({}, $.fn.dragsort.defaults, options);
  10072. var lists = [];
  10073. var list = null, lastPos = null;
  10074. this.each(function(i, cont) {
  10075. //if list container is table, the browser automatically wraps rows in tbody if not specified so change list container to tbody so that children returns rows as user expected
  10076. if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody"))
  10077. cont = $(cont).children().get(0);
  10078. var newList = {
  10079. draggedItem: null,
  10080. placeHolderItem: null,
  10081. pos: null,
  10082. offset: null,
  10083. offsetLimit: null,
  10084. scroll: null,
  10085. container: cont,
  10086. init: function() {
  10087. //set options to default values if not set
  10088. opts.tagName = opts.tagName == "" ? ($(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase()) : opts.tagName;
  10089. if (opts.itemSelector == "")
  10090. opts.itemSelector = opts.tagName;
  10091. if (opts.dragSelector == "")
  10092. opts.dragSelector = opts.tagName;
  10093. if (opts.placeHolderTemplate == "")
  10094. opts.placeHolderTemplate = "<" + opts.tagName + ">&nbsp;</" + opts.tagName + ">";
  10095. //listidx allows reference back to correct list variable instance
  10096. $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit);
  10097. this.styleDragHandlers(true);
  10098. },
  10099. uninit: function() {
  10100. var list = lists[$(this).attr("data-listidx")];
  10101. $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit");
  10102. list.styleDragHandlers(false);
  10103. },
  10104. getItems: function() {
  10105. return $(this.container).children(opts.itemSelector);
  10106. },
  10107. styleDragHandlers: function(cursor) {
  10108. this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : "");
  10109. },
  10110. grabItem: function(e) {
  10111. var list = lists[$(this).attr("data-listidx")];
  10112. var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0);
  10113. var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0;
  10114. //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return
  10115. if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem)
  10116. return;
  10117. //prevents selection, stops issue on Fx where dragging hyperlink doesn't work and on IE where it triggers mousemove even though mouse hasn't moved,
  10118. //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude
  10119. //e.preventDefault();
  10120. //change cursor to move while dragging
  10121. var dragHandle = e.target;
  10122. while (!$(dragHandle).is(opts.dragSelector)) {
  10123. if (dragHandle == this) return;
  10124. dragHandle = dragHandle.parentNode;
  10125. }
  10126. $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor"));
  10127. $(dragHandle).css("cursor", "move");
  10128. //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work
  10129. var listElem = this;
  10130. var trigger = function() {
  10131. list.dragStart.call(listElem, e);
  10132. $(list.container).unbind("mousemove", trigger);
  10133. };
  10134. $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); });
  10135. },
  10136. dragStart: function(e) {
  10137. if (list != null && list.draggedItem != null)
  10138. list.dropItem();
  10139. list = lists[$(this).attr("data-listidx")];
  10140. list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName)
  10141. //record current position so on dragend we know if the dragged item changed position or not, not using getItems to allow dragsort to restore dragged item to original location in relation to fixed items
  10142. list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem));
  10143. //calculate mouse offset relative to draggedItem
  10144. var mt = parseInt(list.draggedItem.css("marginTop"));
  10145. var ml = parseInt(list.draggedItem.css("marginLeft"));
  10146. list.offset = list.draggedItem.offset();
  10147. list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1;
  10148. list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1;
  10149. //calculate box the dragged item can't be dragged outside of
  10150. if (!opts.dragBetween) {
  10151. var containerHeight = $(list.container).outerHeight() == 0 ? Math.max(1, Math.round(0.5 + list.getItems().size() * list.draggedItem.outerWidth() / $(list.container).outerWidth())) * list.draggedItem.outerHeight() : $(list.container).outerHeight();
  10152. list.offsetLimit = $(list.container).offset();
  10153. list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth();
  10154. list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
  10155. }
  10156. //create placeholder item
  10157. var h = list.draggedItem.height();
  10158. var w = list.draggedItem.width();
  10159. if (opts.tagName == "tr") {
  10160. list.draggedItem.children().each(function() { $(this).width($(this).width()); });
  10161. list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true);
  10162. list.draggedItem.after(list.placeHolderItem);
  10163. //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html("&nbsp;"); });
  10164. list.placeHolderItem.children().each(function() { $(this).html("&nbsp;"); });
  10165. } else {
  10166. list.draggedItem.after(opts.placeHolderTemplate);
  10167. list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true);
  10168. }
  10169. if (opts.tagName == "td") {
  10170. var listTable = list.draggedItem.closest("table").get(0);
  10171. $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").appendTo("body").children().append(list.draggedItem);
  10172. }
  10173. //style draggedItem while dragging
  10174. var orig = list.draggedItem.attr("style");
  10175. list.draggedItem.attr("data-origstyle", orig ? orig : "");
  10176. list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w });
  10177. //auto-scroll setup
  10178. list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() };
  10179. list.scroll.scrollY = window.setInterval(function() {
  10180. if (opts.scrollContainer != window) {
  10181. $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY);
  10182. return;
  10183. }
  10184. var t = $(opts.scrollContainer).scrollTop();
  10185. if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) {
  10186. $(opts.scrollContainer).scrollTop(t + list.scroll.moveY);
  10187. list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1);
  10188. }
  10189. }, 10);
  10190. list.scroll.scrollX = window.setInterval(function() {
  10191. if (opts.scrollContainer != window) {
  10192. $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX);
  10193. return;
  10194. }
  10195. var l = $(opts.scrollContainer).scrollLeft();
  10196. if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) {
  10197. $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX);
  10198. list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1);
  10199. }
  10200. }, 10);
  10201. //misc
  10202. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  10203. list.setPos(e.pageX, e.pageY);
  10204. $(document).bind("mousemove", list.swapItems);
  10205. $(document).bind("mouseup", list.dropItem);
  10206. if (opts.scrollContainer != window)
  10207. $(window).bind("wheel", list.wheel);
  10208. },
  10209. //set position of draggedItem
  10210. setPos: function(x, y) {
  10211. //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner
  10212. var top = y - this.offset.top;
  10213. var left = x - this.offset.left;
  10214. //limit top, left to within box draggedItem can't be dragged outside of
  10215. if (!opts.dragBetween) {
  10216. top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
  10217. left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
  10218. }
  10219. //adjust top & left calculations to parent offset
  10220. var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin
  10221. if (parent != null) {
  10222. top -= parent.top;
  10223. left -= parent.left;
  10224. }
  10225. //set x or y auto-scroll amount
  10226. if (opts.scrollContainer == window) {
  10227. y -= $(window).scrollTop();
  10228. x -= $(window).scrollLeft();
  10229. y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5);
  10230. x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5);
  10231. } else {
  10232. var cont = $(opts.scrollContainer);
  10233. var offset = cont.offset();
  10234. y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top);
  10235. x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left);
  10236. }
  10237. list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x);
  10238. list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y);
  10239. //move draggedItem to new mouse cursor location
  10240. this.draggedItem.css({ top: top, left: left });
  10241. },
  10242. //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over
  10243. wheel: function(e) {
  10244. if (list && opts.scrollContainer != window) {
  10245. var cont = $(opts.scrollContainer);
  10246. var offset = cont.offset();
  10247. e = e.originalEvent;
  10248. if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) {
  10249. var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY;
  10250. cont.scrollTop(cont.scrollTop() + deltaY);
  10251. e.preventDefault();
  10252. }
  10253. }
  10254. },
  10255. //build a table recording all the positions of the moveable list items
  10256. buildPositionTable: function() {
  10257. var pos = [];
  10258. this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) {
  10259. var loc = $(this).offset();
  10260. loc.right = loc.left + $(this).outerWidth();
  10261. loc.bottom = loc.top + $(this).outerHeight();
  10262. loc.elm = this;
  10263. pos[i] = loc;
  10264. });
  10265. this.pos = pos;
  10266. },
  10267. dropItem: function() {
  10268. if (list.draggedItem == null)
  10269. return;
  10270. //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower
  10271. //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower)
  10272. var orig = list.draggedItem.attr("data-origstyle");
  10273. list.draggedItem.attr("style", orig);
  10274. if (orig == "")
  10275. list.draggedItem.removeAttr("style");
  10276. list.draggedItem.removeAttr("data-origstyle");
  10277. list.styleDragHandlers(true);
  10278. list.placeHolderItem.before(list.draggedItem);
  10279. list.placeHolderItem.remove();
  10280. $("[data-droptarget], .dragSortItem").remove();
  10281. window.clearInterval(list.scroll.scrollY);
  10282. window.clearInterval(list.scroll.scrollX);
  10283. //if position changed call dragEnd
  10284. if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem))
  10285. if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order
  10286. var pos = list.draggedItem.attr("data-origpos").split('-');
  10287. var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]);
  10288. if (nextItem.size() > 0)
  10289. nextItem.before(list.draggedItem);
  10290. else if (pos[1] == 0) //was the only item in list
  10291. $(lists[pos[0]].container).prepend(list.draggedItem);
  10292. else //was the last item in list
  10293. $(lists[pos[0]].container).append(list.draggedItem);
  10294. }
  10295. list.draggedItem.removeAttr("data-origpos");
  10296. list.draggedItem = null;
  10297. $(document).unbind("mousemove", list.swapItems);
  10298. $(document).unbind("mouseup", list.dropItem);
  10299. if (opts.scrollContainer != window)
  10300. $(window).unbind("wheel", list.wheel);
  10301. return false;
  10302. },
  10303. //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of
  10304. swapItems: function(e) {
  10305. if (list.draggedItem == null)
  10306. return false;
  10307. //move draggedItem to mouse location
  10308. list.setPos(e.pageX, e.pageY);
  10309. //retrieve list and item position mouse cursor is over
  10310. var ei = list.findPos(e.pageX, e.pageY);
  10311. var nlist = list;
  10312. for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) {
  10313. ei = lists[i].findPos(e.pageX, e.pageY);
  10314. nlist = lists[i];
  10315. }
  10316. //if not over another moveable list item return
  10317. if (ei == -1)
  10318. return false;
  10319. //save fixed items locations
  10320. var children = function() { return $(nlist.container).children().not(nlist.draggedItem); };
  10321. var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); });
  10322. //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after
  10323. if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left)
  10324. $(nlist.pos[ei].elm).before(list.placeHolderItem);
  10325. else
  10326. $(nlist.pos[ei].elm).after(list.placeHolderItem);
  10327. //restore fixed items location
  10328. fixed.each(function() {
  10329. var elm = children().eq(this.idx).get(0);
  10330. if (this != elm && children().index(this) < this.idx)
  10331. $(this).insertAfter(elm);
  10332. else if (this != elm)
  10333. $(this).insertBefore(elm);
  10334. });
  10335. //misc
  10336. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  10337. lastPos = list.draggedItem.offset();
  10338. return false;
  10339. },
  10340. //returns the index of the list item the mouse is over
  10341. findPos: function(x, y) {
  10342. for (var i = 0; i < this.pos.length; i++) {
  10343. if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y)
  10344. return i;
  10345. }
  10346. return -1;
  10347. },
  10348. //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position
  10349. createDropTargets: function() {
  10350. if (!opts.dragBetween)
  10351. return;
  10352. $(lists).each(function() {
  10353. var ph = $(this.container).find("[data-placeholder]");
  10354. var dt = $(this.container).find("[data-droptarget]");
  10355. if (ph.size() > 0 && dt.size() > 0)
  10356. dt.remove();
  10357. else if (ph.size() == 0 && dt.size() == 0) {
  10358. if (opts.tagName == "td")
  10359. $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container);
  10360. else
  10361. //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8)
  10362. $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true));
  10363. list.placeHolderItem.attr("data-placeholder", true);
  10364. }
  10365. });
  10366. }
  10367. };
  10368. newList.init();
  10369. lists.push(newList);
  10370. });
  10371. return this;
  10372. };
  10373. $.fn.dragsort.defaults = {
  10374. tagName:"",
  10375. itemSelector: "",
  10376. dragSelector: "",
  10377. dragSelectorExclude: "input, textarea",
  10378. dragEnd: function() { },
  10379. dragBetween: false,
  10380. placeHolderTemplate: "",
  10381. scrollContainer: window,
  10382. scrollSpeed: 5
  10383. };
  10384. })(jQuery);
  10385. define("dragsort", function(){});
  10386. /*!
  10387. * jquery.event.drag - v 2.2
  10388. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  10389. * Open Source MIT License - http://threedubmedia.com/code/license
  10390. */
  10391. ;(function(e){e.fn.drag=function(k,g,j){var i=typeof k=="string"?k:"",h=e.isFunction(k)?k:e.isFunction(g)?g:null;if(i.indexOf("drag")!==0){i="drag"+i}j=(k==h?g:j)||{};return h?this.bind(i,j,h):this.trigger(i)};var b=e.event,a=b.special,d=a.drag={defaults:{which:1,distance:0,not:":input",handle:null,relative:false,drop:true,click:false},datakey:"dragdata",noBubble:true,add:function(i){var h=e.data(this,d.datakey),g=i.data||{};h.related+=1;e.each(d.defaults,function(j,k){if(g[j]!==undefined){h[j]=g[j]}})},remove:function(){e.data(this,d.datakey).related-=1},setup:function(){if(e.data(this,d.datakey)){return}var g=e.extend({related:0},d.defaults);e.data(this,d.datakey,g);b.add(this,"touchstart mousedown",d.init,g);if(this.attachEvent){this.attachEvent("ondragstart",d.dontstart)}},teardown:function(){var g=e.data(this,d.datakey)||{};if(g.related){return}e.removeData(this,d.datakey);b.remove(this,"touchstart mousedown",d.init);d.textselect(true);if(this.detachEvent){this.detachEvent("ondragstart",d.dontstart)}},init:function(i){if(d.touched){return}var g=i.data,h;if(i.which!=0&&g.which>0&&i.which!=g.which){return}if(e(i.target).is(g.not)){return}if(g.handle&&!e(i.target).closest(g.handle,i.currentTarget).length){return}d.touched=i.type=="touchstart"?this:null;g.propagates=1;g.mousedown=this;g.interactions=[d.interaction(this,g)];g.target=i.target;g.pageX=i.pageX;g.pageY=i.pageY;g.dragging=null;h=d.hijack(i,"draginit",g);if(!g.propagates){return}h=d.flatten(h);if(h&&h.length){g.interactions=[];e.each(h,function(){g.interactions.push(d.interaction(this,g))})}g.propagates=g.interactions.length;if(g.drop!==false&&a.drop){a.drop.handler(i,g)}d.textselect(false);if(d.touched){b.add(d.touched,"touchmove touchend",d.handler,g)}else{b.add(document,"mousemove mouseup",d.handler,g)}if(!d.touched||g.live){return false}},interaction:function(h,g){var i=e(h)[g.relative?"position":"offset"]()||{top:0,left:0};return{drag:h,callback:new d.callback(),droppable:[],offset:i}},handler:function(h){var g=h.data;switch(h.type){case !g.dragging&&"touchmove":h.preventDefault();case !g.dragging&&"mousemove":if(Math.pow(h.pageX-g.pageX,2)+Math.pow(h.pageY-g.pageY,2)<Math.pow(g.distance,2)){break}h.target=g.target;d.hijack(h,"dragstart",g);if(g.propagates){g.dragging=true}case"touchmove":h.preventDefault();case"mousemove":if(g.dragging){d.hijack(h,"drag",g);if(g.propagates){if(g.drop!==false&&a.drop){a.drop.handler(h,g)}break}h.type="mouseup"}case"touchend":case"mouseup":default:if(d.touched){b.remove(d.touched,"touchmove touchend",d.handler)}else{b.remove(document,"mousemove mouseup",d.handler)}if(g.dragging){if(g.drop!==false&&a.drop){a.drop.handler(h,g)}d.hijack(h,"dragend",g)}d.textselect(true);if(g.click===false&&g.dragging){e.data(g.mousedown,"suppress.click",new Date().getTime()+5)}g.dragging=d.touched=false;break}},hijack:function(h,o,r,p,k){if(!r){return}var q={event:h.originalEvent,type:h.type},m=o.indexOf("drop")?"drag":"drop",t,l=p||0,j,g,s,n=!isNaN(p)?p:r.interactions.length;h.type=o;h.originalEvent=null;r.results=[];do{if(j=r.interactions[l]){if(o!=="dragend"&&j.cancelled){continue}s=d.properties(h,r,j);j.results=[];e(k||j[m]||r.droppable).each(function(u,i){s.target=i;h.isPropagationStopped=function(){return false};t=i?b.dispatch.call(i,h,s):null;if(t===false){if(m=="drag"){j.cancelled=true;r.propagates-=1}if(o=="drop"){j[m][u]=null}}else{if(o=="dropinit"){j.droppable.push(d.element(t)||i)}}if(o=="dragstart"){j.proxy=e(d.element(t)||j.drag)[0]}j.results.push(t);delete h.result;if(o!=="dropinit"){return t}});r.results[l]=d.flatten(j.results);if(o=="dropinit"){j.droppable=d.flatten(j.droppable)}if(o=="dragstart"&&!j.cancelled){s.update()}}}while(++l<n);h.type=q.type;h.originalEvent=q.event;return d.flatten(r.results)},properties:function(i,g,h){var j=h.callback;j.drag=h.drag;j.proxy=h.proxy||h.drag;j.startX=g.pageX;j.startY=g.pageY;j.deltaX=i.pageX-g.pageX;j.deltaY=i.pageY-g.pageY;j.originalX=h.offset.left;j.originalY=h.offset.top;j.offsetX=j.originalX+j.deltaX;j.offsetY=j.originalY+j.deltaY;j.drop=d.flatten((h.drop||[]).slice());j.available=d.flatten((h.droppable||[]).slice());return j},element:function(g){if(g&&(g.jquery||g.nodeType==1)){return g}},flatten:function(g){return e.map(g,function(h){return h&&h.jquery?e.makeArray(h):h&&h.length?d.flatten(h):h})},textselect:function(g){e(document)[g?"unbind":"bind"]("selectstart",d.dontstart).css("MozUserSelect",g?"":"none");document.unselectable=g?"off":"on"},dontstart:function(){return false},callback:function(){}};d.callback.prototype={update:function(){if(a.drop&&this.available.length){e.each(this.available,function(g){a.drop.locate(this,g)})}}};var f=b.dispatch;b.dispatch=function(g){if(e.data(this,"suppress."+g.type)-new Date().getTime()>0){e.removeData(this,"suppress."+g.type);return}return f.apply(this,arguments)};var c=b.fixHooks.touchstart=b.fixHooks.touchmove=b.fixHooks.touchend=b.fixHooks.touchcancel={props:"clientX clientY pageX pageY screenX screenY".split(" "),filter:function(h,i){if(i){var g=(i.touches&&i.touches[0])||(i.changedTouches&&i.changedTouches[0])||null;if(g){e.each(c.props,function(j,k){h[k]=g[k]})}}return h}};a.draginit=a.dragstart=a.dragend=d})(jQuery);
  10392. define("drag", function(){});
  10393. /*!
  10394. * jquery.event.drop - v 2.2
  10395. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  10396. * Open Source MIT License - http://threedubmedia.com/code/license
  10397. */
  10398. ;(function(d){d.fn.drop=function(i,e,h){var g=typeof i=="string"?i:"",f=d.isFunction(i)?i:d.isFunction(e)?e:null;if(g.indexOf("drop")!==0){g="drop"+g}h=(i==f?e:h)||{};return f?this.bind(g,h,f):this.trigger(g)};d.drop=function(e){e=e||{};b.multi=e.multi===true?Infinity:e.multi===false?1:!isNaN(e.multi)?e.multi:b.multi;b.delay=e.delay||b.delay;b.tolerance=d.isFunction(e.tolerance)?e.tolerance:e.tolerance===null?null:b.tolerance;b.mode=e.mode||b.mode||"intersect"};var c=d.event,a=c.special,b=d.event.special.drop={multi:1,delay:20,mode:"overlap",targets:[],datakey:"dropdata",noBubble:true,add:function(f){var e=d.data(this,b.datakey);e.related+=1},remove:function(){d.data(this,b.datakey).related-=1},setup:function(){if(d.data(this,b.datakey)){return}var e={related:0,active:[],anyactive:0,winner:0,location:{}};d.data(this,b.datakey,e);b.targets.push(this);return false},teardown:function(){var f=d.data(this,b.datakey)||{};if(f.related){return}d.removeData(this,b.datakey);var e=this;b.targets=d.grep(b.targets,function(g){return(g!==e)})},handler:function(g,e){var f,h;if(!e){return}switch(g.type){case"mousedown":case"touchstart":h=d(b.targets);if(typeof e.drop=="string"){h=h.filter(e.drop)}h.each(function(){var i=d.data(this,b.datakey);i.active=[];i.anyactive=0;i.winner=0});e.droppable=h;a.drag.hijack(g,"dropinit",e);break;case"mousemove":case"touchmove":b.event=g;if(!b.timer){b.tolerate(e)}break;case"mouseup":case"touchend":b.timer=clearTimeout(b.timer);if(e.propagates){a.drag.hijack(g,"drop",e);a.drag.hijack(g,"dropend",e)}break}},locate:function(k,h){var l=d.data(k,b.datakey),g=d(k),i=g.offset()||{},e=g.outerHeight(),j=g.outerWidth(),f={elem:k,width:j,height:e,top:i.top,left:i.left,right:i.left+j,bottom:i.top+e};if(l){l.location=f;l.index=h;l.elem=k}return f},contains:function(e,f){return((f[0]||f.left)>=e.left&&(f[0]||f.right)<=e.right&&(f[1]||f.top)>=e.top&&(f[1]||f.bottom)<=e.bottom)},modes:{intersect:function(f,e,g){return this.contains(g,[f.pageX,f.pageY])?1000000000:this.modes.overlap.apply(this,arguments)},overlap:function(f,e,g){return Math.max(0,Math.min(g.bottom,e.bottom)-Math.max(g.top,e.top))*Math.max(0,Math.min(g.right,e.right)-Math.max(g.left,e.left))},fit:function(f,e,g){return this.contains(g,e)?1:0},middle:function(f,e,g){return this.contains(g,[e.left+e.width*0.5,e.top+e.height*0.5])?1:0}},sort:function(f,e){return(e.winner-f.winner)||(f.index-e.index)},tolerate:function(q){var k,e,n,j,l,m,g,p=0,f,h=q.interactions.length,r=[b.event.pageX,b.event.pageY],o=b.tolerance||b.modes[b.mode];do{if(f=q.interactions[p]){if(!f){return}f.drop=[];l=[];m=f.droppable.length;if(o){n=b.locate(f.proxy)}k=0;do{if(g=f.droppable[k]){j=d.data(g,b.datakey);e=j.location;if(!e){continue}j.winner=o?o.call(b,b.event,n,e):b.contains(e,r)?1:0;l.push(j)}}while(++k<m);l.sort(b.sort);k=0;do{if(j=l[k]){if(j.winner&&f.drop.length<b.multi){if(!j.active[p]&&!j.anyactive){if(a.drag.hijack(b.event,"dropstart",q,p,j.elem)[0]!==false){j.active[p]=1;j.anyactive+=1}else{j.winner=0}}if(j.winner){f.drop.push(j.elem)}}else{if(j.active[p]&&j.anyactive==1){a.drag.hijack(b.event,"dropend",q,p,j.elem);j.active[p]=0;j.anyactive-=1}}}}while(++k<m)}}while(++p<h);if(b.last&&r[0]==b.last.pageX&&r[1]==b.last.pageY){delete b.timer}else{b.timer=setTimeout(function(){b.tolerate(q)},b.delay)}b.last=b.event}};a.dropinit=a.dropstart=a.dropend=b})(jQuery);
  10399. define("drop", function(){});
  10400. /**
  10401. * http://git.oschina.net/hbbcs/bootStrap-addTabs
  10402. * Created by joe on 2015-12-19.
  10403. */
  10404. $.fn.addtabs = function (options) {
  10405. var obj = $(this);
  10406. options = $.extend({
  10407. content: '', //直接指定所有页面TABS内容
  10408. close: true, //是否可以关闭
  10409. monitor: 'body', //监视的区域
  10410. nav: '.nav-addtabs',
  10411. tab: '.tab-addtabs',
  10412. iframeUse: true, //使用iframe还是ajax
  10413. iframeHeight: $(window).height() - 50, //固定TAB中IFRAME高度,根据需要自己修改
  10414. iframeForceRefresh: false, //点击后强制刷新对应的iframe
  10415. callback: function () {
  10416. //关闭后回调函数
  10417. }
  10418. }, options || {});
  10419. var navobj = $(options.nav);
  10420. var tabobj = $(options.tab);
  10421. if (history.pushState) {
  10422. //浏览器前进后退事件
  10423. $(window).on("popstate", function (e) {
  10424. var state = e.originalEvent.state;
  10425. if (state) {
  10426. $("a[addtabs=" + state.id + "]", options.monitor).data("pushstate", true).trigger("click");
  10427. }
  10428. });
  10429. }
  10430. $(options.monitor).on('click', '[addtabs]', function (e) {
  10431. if ($(this).attr('url').indexOf("javascript:") !== 0) {
  10432. if ($(this).is("a")) {
  10433. e.preventDefault();
  10434. }
  10435. var id = $(this).attr('addtabs');
  10436. var title = $(this).attr('title') ? $(this).attr('title') : $.trim($(this).text());
  10437. var url = $(this).attr('url');
  10438. var content = options.content ? options.content : $(this).attr('content');
  10439. var ajax = $(this).attr('ajax') ? true : false;
  10440. var state = ({
  10441. url: url, title: title, id: id, content: content, ajax: ajax
  10442. });
  10443. document.title = title;
  10444. if (history.pushState && !$(this).data("pushstate")) {
  10445. var pushurl = url.indexOf("ref=addtabs") == -1 ? (url + (url.indexOf("?") > -1 ? "&" : "?") + "ref=addtabs") : url;
  10446. window.history.pushState(state, title, pushurl);
  10447. }
  10448. $(this).data("pushstate", null);
  10449. _add.call(this, {
  10450. id: id,
  10451. title: $(this).attr('title') ? $(this).attr('title') : $(this).html(),
  10452. content: content,
  10453. url: url,
  10454. ajax: ajax
  10455. });
  10456. }
  10457. });
  10458. navobj.on('click', '.close-tab', function (e) {
  10459. id = $(this).prev("a").attr("aria-controls");
  10460. _close(id);
  10461. return false;
  10462. });
  10463. navobj.on('dblclick', 'li[role=presentation]', function (e) {
  10464. $(this).find(".close-tab").trigger("click");
  10465. });
  10466. navobj.on('click', 'li[role=presentation]', function (e) {
  10467. $("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click");
  10468. });
  10469. $(window).resize(function () {
  10470. $("#nav").width($("#header > .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20);
  10471. _drop();
  10472. });
  10473. _add = function (opts) {
  10474. var id, tabid, conid, url;
  10475. id = opts.id;
  10476. tabid = 'tab_' + opts.id;
  10477. conid = 'con_' + opts.id;
  10478. url = opts.url;
  10479. url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1");
  10480. navobj.find("[role='presentation']").removeClass('active');
  10481. tabobj.find("[role='tabpanel']").removeClass('active');
  10482. //如果TAB不存在,创建一个新的TAB
  10483. if ($("#" + tabid).size() == 0) {
  10484. //创建新TAB的title
  10485. title = $('<li role="presentation" id="' + tabid + '"><a href="#' + conid + '" node-id="' + opts.id + '" aria-controls="' + id + '" role="tab" data-toggle="tab">' + opts.title + '</a></li>');
  10486. //是否允许关闭
  10487. if (options.close && $("li", navobj).size() > 0) {
  10488. title.append(' <i class="close-tab fa fa-remove"></i>');
  10489. }
  10490. //创建新TAB的内容
  10491. content = $('<div role="tabpanel" class="tab-pane" id="' + conid + '"></div>');
  10492. //是否指定TAB内容
  10493. if (opts.content) {
  10494. content.append(opts.content);
  10495. } else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接
  10496. var height = options.iframeHeight;
  10497. content.append('<iframe src="' + url + '" width="100%" height="' + height + '" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes"></iframe></div>');
  10498. } else {
  10499. $.get(url, function (data) {
  10500. content.append(data);
  10501. });
  10502. }
  10503. //加入TABS
  10504. if ($('.tabdrop li').size() > 0) {
  10505. $('.tabdrop ul').append(title);
  10506. } else {
  10507. navobj.append(title);
  10508. }
  10509. tabobj.append(content);
  10510. } else {
  10511. //强制刷新iframe
  10512. if (options.iframeForceRefresh) {
  10513. $("#" + conid + " iframe").attr('src', function (i, val) {
  10514. return val;
  10515. });
  10516. }
  10517. }
  10518. localStorage.setItem("addtabs", $(this).prop('outerHTML'));
  10519. //激活TAB
  10520. $("#" + tabid).addClass('active');
  10521. $("#" + conid).addClass("active");
  10522. _drop();
  10523. };
  10524. _close = function (id) {
  10525. var tabid = 'tab_' + id;
  10526. var conid = 'con_' + id;
  10527. //如果关闭的是当前激活的TAB,激活他的前一个TAB
  10528. if (obj.find("li.active").not('.tabdrop').attr('id') == tabid) {
  10529. if ($("#" + tabid).prev().not(".tabdrop").size() > 0) {
  10530. $("#" + tabid).prev().not(".tabdrop").find("a").trigger("click");
  10531. } else if ($("#" + tabid).next().size() > 0) {
  10532. $("#" + tabid).next().trigger("click");
  10533. } else {
  10534. $(">li:last > a", navobj).trigger('click');
  10535. }
  10536. }
  10537. //关闭TAB
  10538. $("#" + tabid).remove();
  10539. $("#" + conid).remove();
  10540. _drop();
  10541. options.callback();
  10542. };
  10543. _drop = function () {
  10544. //创建下拉标签
  10545. var dropdown = $('<li class="dropdown pull-right hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;">' +
  10546. '<i class="glyphicon glyphicon-align-justify"></i>' +
  10547. ' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>');
  10548. //检测是否已增加
  10549. if (!$('.tabdrop').html()) {
  10550. dropdown.prependTo(navobj);
  10551. } else {
  10552. dropdown = navobj.find('.tabdrop');
  10553. }
  10554. //检测是否有下拉样式
  10555. if (navobj.parent().is('.tabs-below')) {
  10556. dropdown.addClass('dropup');
  10557. }
  10558. var collection = 0;
  10559. var maxwidth = navobj.width() - 60;
  10560. var liwidth = 0;
  10561. //检查超过一行的标签页
  10562. var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop');
  10563. var lisize = litabs.size();
  10564. litabs.each(function (i, j) {
  10565. liwidth += $(this).width();
  10566. if (collection == 0 && i == lisize - 1 && liwidth <= navobj.width()) {
  10567. return true;
  10568. }
  10569. if (liwidth > maxwidth) {
  10570. dropdown.find('ul').append($(this));
  10571. collection++;
  10572. }
  10573. });
  10574. //如果有超出的,显示下拉标签
  10575. if (collection > 0) {
  10576. dropdown.removeClass('hide');
  10577. if (dropdown.find('.active').length == 1) {
  10578. dropdown.addClass('active');
  10579. } else {
  10580. dropdown.removeClass('active');
  10581. }
  10582. } else {
  10583. dropdown.addClass('hide');
  10584. }
  10585. };
  10586. };
  10587. define("addtabs", function(){});
  10588. /**
  10589. * @summary SelectPage
  10590. * @desc Simple and powerful selection plugin
  10591. * @file selectpage.js
  10592. * @version 2.18
  10593. * @author TerryZeng
  10594. * @contact https://terryz.github.io/
  10595. * @license MIT License
  10596. *
  10597. */
  10598. ;
  10599. (function ($) {
  10600. "use strict";
  10601. /**
  10602. * Default options
  10603. */
  10604. var defaults = {
  10605. /**
  10606. * Data source
  10607. * @type {string|Object}
  10608. *
  10609. * string:server side request url address
  10610. * Object:JSON array,format:[{a:1,b:2,c:3},{...}]
  10611. */
  10612. data: undefined,
  10613. /**
  10614. * Language ('cn', 'en', 'ja', 'es', 'pt-br')
  10615. * @type string
  10616. * @default 'cn'
  10617. */
  10618. lang: 'cn',
  10619. /**
  10620. * Multiple select mode(tags)
  10621. * @type boolean
  10622. * @default false
  10623. */
  10624. multiple: false,
  10625. /**
  10626. * pagination or not
  10627. * @type boolean
  10628. * @default true
  10629. */
  10630. pagination: true,
  10631. /**
  10632. * Show up menu button
  10633. * @type boolean
  10634. * @default true
  10635. */
  10636. dropButton: true,
  10637. /**
  10638. * Result list visible size in pagination bar close
  10639. * @type number
  10640. * @default 10
  10641. */
  10642. listSize: 10,
  10643. /**
  10644. * Show control bar in multiple select mode
  10645. * @type boolean
  10646. * @default true
  10647. */
  10648. multipleControlbar: true,
  10649. /**
  10650. * Max selected item limited in multiple select mode
  10651. * @type number
  10652. * @default 0(unlimited)
  10653. */
  10654. maxSelectLimit: 0,
  10655. /**
  10656. * Select result item to close list, work on multiple select mode
  10657. * @type boolean
  10658. * @default false
  10659. */
  10660. selectToCloseList: false,
  10661. /**
  10662. * Init selected item key, the result will match to option.keyField option
  10663. * @type string
  10664. */
  10665. initRecord: undefined,
  10666. /**
  10667. * The table parameter in server side mode
  10668. * @type string
  10669. */
  10670. dbTable: 'tbl',
  10671. /**
  10672. * The value field, the value will fill to hidden element
  10673. * @type string
  10674. * @default 'id'
  10675. */
  10676. keyField: 'id',
  10677. /**
  10678. * The show text field, the text will show to input element or tags(multiple mode)
  10679. * @type string
  10680. * @default 'name'
  10681. */
  10682. showField: 'name',
  10683. /**
  10684. * Actually used to search field
  10685. * @type string
  10686. */
  10687. searchField: undefined,
  10688. /**
  10689. * Search type ('AND' or 'OR')
  10690. * @type string
  10691. * @default 'AND'
  10692. */
  10693. andOr: 'AND',
  10694. /**
  10695. * Result sort type
  10696. * @type array - if not set, will default used showField field
  10697. * @example
  10698. * orderBy : ['id desc']
  10699. */
  10700. orderBy: undefined,
  10701. /**
  10702. * Page size
  10703. * @type number
  10704. * @default 10
  10705. */
  10706. pageSize: 10,
  10707. /**
  10708. * Server side request parameters
  10709. * @type function
  10710. * @return object
  10711. * @example params : function(){return {'name':'aa','sex':1};}
  10712. */
  10713. params: undefined,
  10714. /**
  10715. * Custom result list item show text
  10716. * @type function
  10717. * @param data {object} row data
  10718. * @return string
  10719. */
  10720. formatItem: undefined,
  10721. /**
  10722. * Have some highlight item and lost focus, auto select the highlight item
  10723. * @type boolean
  10724. * @default false
  10725. */
  10726. autoFillResult: false,
  10727. /**
  10728. * Auto select first item in show up result list or search result
  10729. * depend on `autoFillResult` option set to true
  10730. * @type boolean
  10731. * @default false
  10732. */
  10733. autoSelectFirst: false,
  10734. /**
  10735. * Whether clear input element text when enter some keywords to search and no result return
  10736. * @type boolean
  10737. * @default true
  10738. */
  10739. noResultClean: true,
  10740. /**
  10741. * Select only mode
  10742. * @type boolean
  10743. */
  10744. selectOnly: false,
  10745. /**
  10746. * Input to search delay time, work on ajax data source
  10747. * @type number
  10748. * @default 0.5
  10749. */
  10750. inputDelay: 0.5,
  10751. /**
  10752. * -----------------------------------------Callback--------------------------------------------
  10753. */
  10754. /**
  10755. * Result list item selected callback
  10756. * @type function
  10757. * @param object - selected item json data
  10758. * @param self - plugin object
  10759. */
  10760. eSelect: undefined,
  10761. /**
  10762. * Before result list show up callback, you can do anything prepared
  10763. * @param self - plugin object
  10764. */
  10765. eOpen: undefined,
  10766. /**
  10767. * Server side return data convert callback
  10768. * @type function
  10769. * @param data {object} server side return data
  10770. * @param self {object} plugin object
  10771. * @return {object} return data format:
  10772. * @example
  10773. * {
  10774. * list : [{name:'aa',sex:1},{name:'bb',sex:1}...],
  10775. * totalRow : 100
  10776. * }
  10777. */
  10778. eAjaxSuccess: undefined,
  10779. /**
  10780. * Close selected item tag callback (multiple mode)
  10781. * @type function
  10782. * @param removeCount {number} remove item count
  10783. * @param self {object} plugin object
  10784. */
  10785. eTagRemove: undefined,
  10786. /**
  10787. * Clear selected item callback(single select mode)
  10788. * @type function
  10789. * @param self {object} plugin object
  10790. */
  10791. eClear: undefined
  10792. };
  10793. /**
  10794. * SelectPage class definition
  10795. * @constructor
  10796. * @param {Object} input - input element
  10797. * @param {Object} option
  10798. */
  10799. var SelectPage = function (input, option) {
  10800. //特殊字段处理
  10801. $.each({data: 'source', keyField: 'primaryKey', showField: 'field', pageSize: 'perPage'}, function (i, j) {
  10802. if (typeof option[j] !== 'undefined') {
  10803. option[i] = option[j];
  10804. delete option[j];
  10805. }
  10806. });
  10807. this.setOption(option);
  10808. this.setLanguage();
  10809. this.setCssClass();
  10810. this.setProp();
  10811. this.setElem(input);
  10812. this.setButtonAttrDefault();
  10813. this.setInitRecord();
  10814. this.eDropdownButton();
  10815. this.eInput();
  10816. this.eWhole();
  10817. };
  10818. /**
  10819. * Plugin version number
  10820. */
  10821. SelectPage.version = '2.18';
  10822. /**
  10823. * Plugin object cache key
  10824. */
  10825. SelectPage.dataKey = 'selectPageObject';
  10826. /**
  10827. * Options set
  10828. * @param {Object} option
  10829. */
  10830. SelectPage.prototype.setOption = function (option) {
  10831. //use showField to default
  10832. option.searchField = option.searchField || option.showField;
  10833. option.andOr = option.andOr.toUpperCase();
  10834. if (option.andOr !== 'AND' && option.andOr !== 'OR')
  10835. option.andOr = 'AND';
  10836. //support multiple field set
  10837. var arr = ['searchField'];
  10838. for (var i = 0; i < arr.length; i++) {
  10839. option[arr[i]] = this.strToArray(option[arr[i]]);
  10840. }
  10841. //set default order field
  10842. option.orderBy = option.orderBy || option.showField;
  10843. //set multiple order field
  10844. //example: [ ['id', 'ASC'], ['name', 'DESC'] ]
  10845. option.orderBy = this.setOrderbyOption(option.orderBy, option.showField);
  10846. //close auto fill result and auto select first in multiple mode and select item not close list
  10847. if (option.multiple && !option.selectToCloseList) {
  10848. option.autoFillResult = false;
  10849. option.autoSelectFirst = false;
  10850. }
  10851. //show all item when pagination bar close, limited 200
  10852. if (!option.pagination)
  10853. option.pageSize = 200;
  10854. if ($.type(option.listSize) !== 'number' || option.listSize < 0)
  10855. option.listSize = 10;
  10856. this.option = option;
  10857. };
  10858. /**
  10859. * String convert to array
  10860. * @param str {string}
  10861. * @return {Array}
  10862. */
  10863. SelectPage.prototype.strToArray = function (str) {
  10864. if (!str)
  10865. return '';
  10866. return str.replace(/[\s ]+/g, '').split(',');
  10867. };
  10868. /**
  10869. * Set order field
  10870. * @param {Array} arg_order
  10871. * @param {string} arg_field
  10872. * @return {Array}
  10873. */
  10874. SelectPage.prototype.setOrderbyOption = function (arg_order, arg_field) {
  10875. var arr = [], orders = [];
  10876. if (typeof arg_order == 'object') {
  10877. for (var i = 0; i < arg_order.length; i++) {
  10878. orders = $.trim(arg_order[i]).split(' ');
  10879. arr[i] = (orders.length == 2) ? orders : [orders[0], 'ASC'];
  10880. }
  10881. } else {
  10882. orders = $.trim(arg_order).split(' ');
  10883. arr[0] = (orders.length == 2) ? orders : (orders[0].match(/^(ASC|DESC)$/i)) ? [arg_field, orders[0]] : [orders[0], 'ASC'];
  10884. }
  10885. return arr;
  10886. };
  10887. /**
  10888. * i18n
  10889. */
  10890. SelectPage.prototype.setLanguage = function () {
  10891. var message, p = this.option;
  10892. switch (p.lang) {
  10893. // English
  10894. case 'en':
  10895. message = {
  10896. add_btn: 'Add button',
  10897. add_title: 'add a box',
  10898. del_btn: 'Del button',
  10899. del_title: 'delete a box',
  10900. next: 'Next',
  10901. next_title: 'Next' + p.pageSize + ' (Right key)',
  10902. prev: 'Prev',
  10903. prev_title: 'Prev' + p.pageSize + ' (Left key)',
  10904. first_title: 'First (Shift + Left key)',
  10905. last_title: 'Last (Shift + Right key)',
  10906. get_all_btn: 'Get All (Down key)',
  10907. get_all_alt: '(button)',
  10908. close_btn: 'Close (Tab key)',
  10909. close_alt: '(button)',
  10910. loading: 'loading...',
  10911. loading_alt: '(loading)',
  10912. page_info: 'page_num of page_count',
  10913. select_ng: 'Attention : Please choose from among the list.',
  10914. select_ok: 'OK : Correctly selected.',
  10915. not_found: 'not found',
  10916. ajax_error: 'An error occurred while connecting to server.',
  10917. clear: 'Clear content',
  10918. select_all: 'Select current page',
  10919. unselect_all: 'Clear current page',
  10920. clear_all: 'Clear all selected',
  10921. max_selected: 'You can only select up to max_selected_limit items'
  10922. };
  10923. break;
  10924. // 中文
  10925. case 'cn':
  10926. default:
  10927. message = {
  10928. add_btn: '添加按钮',
  10929. add_title: '添加区域',
  10930. del_btn: '删除按钮',
  10931. del_title: '删除区域',
  10932. next: '下一页',
  10933. next_title: '下' + p.pageSize + ' (→)',
  10934. prev: '上一页',
  10935. prev_title: '上' + p.pageSize + ' (←)',
  10936. first_title: '首页 (Shift + ←)',
  10937. last_title: '尾页 (Shift + →)',
  10938. get_all_btn: '获得全部 (↓)',
  10939. get_all_alt: '(按钮)',
  10940. close_btn: '关闭 (Tab键)',
  10941. close_alt: '(按钮)',
  10942. loading: '读取中...',
  10943. loading_alt: '(读取中)',
  10944. page_info: '第 page_num 页(共page_count页)',
  10945. select_ng: '请注意:请从列表中选择.',
  10946. select_ok: 'OK : 已经选择.',
  10947. not_found: '无查询结果',
  10948. ajax_error: '连接到服务器时发生错误!',
  10949. clear: '清除内容',
  10950. select_all: '选择当前页项目',
  10951. unselect_all: '取消选择当前页项目',
  10952. clear_all: '清除全部已选择项目',
  10953. max_selected: '最多只能选择 max_selected_limit 个项目'
  10954. };
  10955. break;
  10956. }
  10957. this.message = message;
  10958. };
  10959. /**
  10960. * Css classname defined
  10961. */
  10962. SelectPage.prototype.setCssClass = function () {
  10963. var css_class = {
  10964. container: 'sp_container',
  10965. container_open: 'sp_container_open',
  10966. re_area: 'sp_result_area',
  10967. result_open: 'sp_result_area_open',
  10968. control_box: 'sp_control_box',
  10969. //multiple select mode
  10970. element_box: 'sp_element_box',
  10971. navi: 'sp_navi',
  10972. //result list
  10973. results: 'sp_results',
  10974. re_off: 'sp_results_off',
  10975. select: 'sp_over',
  10976. select_ok: 'sp_select_ok',
  10977. select_ng: 'sp_select_ng',
  10978. selected: 'sp_selected',
  10979. input_off: 'sp_input_off',
  10980. message_box: 'sp_message_box',
  10981. disabled: 'sp_disabled',
  10982. button: 'sp_button',
  10983. btn_on: 'sp_btn_on',
  10984. btn_out: 'sp_btn_out',
  10985. input: 'sp_input',
  10986. clear_btn: 'sp_clear_btn',
  10987. align_right: 'sp_align_right'
  10988. };
  10989. this.css_class = css_class;
  10990. };
  10991. /**
  10992. * Plugin inner properties
  10993. */
  10994. SelectPage.prototype.setProp = function () {
  10995. this.prop = {
  10996. //input disabled status
  10997. disabled: false,
  10998. current_page: 1,
  10999. //total page
  11000. max_page: 1,
  11001. //ajax data loading status
  11002. is_loading: false,
  11003. xhr: false,
  11004. key_paging: false,
  11005. key_select: false,
  11006. //last selected item value
  11007. prev_value: '',
  11008. //last selected item text
  11009. selected_text: '',
  11010. last_input_time: undefined,
  11011. init_set: false
  11012. };
  11013. this.template = {
  11014. tag: {
  11015. content: '<li class="selected_tag" itemvalue="#item_value#">#item_text#<span class="tag_close"><i class="spfont sp-close"></i></span></li>',
  11016. textKey: '#item_text#',
  11017. valueKey: '#item_value#'
  11018. },
  11019. page: {
  11020. current: 'page_num',
  11021. total: 'page_count'
  11022. },
  11023. msg: {
  11024. maxSelectLimit: 'max_selected_limit'
  11025. }
  11026. };
  11027. };
  11028. /**
  11029. * Get the actual width/height of invisible DOM elements with jQuery.
  11030. * Source code come from dreamerslab/jquery.actual
  11031. * @param element
  11032. * @param method
  11033. * @returns {*}
  11034. */
  11035. SelectPage.prototype.elementRealSize = function (element, method) {
  11036. var defaults = {
  11037. absolute: false,
  11038. clone: false,
  11039. includeMargin: false,
  11040. display: 'block'
  11041. };
  11042. var configs = defaults, $target = element.eq(0), fix, restore, tmp = [], style = '', $hidden;
  11043. fix = function () {
  11044. // get all hidden parents
  11045. $hidden = $target.parents().addBack().filter(':hidden');
  11046. style += 'visibility: hidden !important; display: ' + configs.display + ' !important; ';
  11047. if (configs.absolute === true)
  11048. style += 'position: absolute !important;';
  11049. // save the origin style props
  11050. // set the hidden el css to be got the actual value later
  11051. $hidden.each(function () {
  11052. // Save original style. If no style was set, attr() returns undefined
  11053. var $this = $(this), thisStyle = $this.attr('style');
  11054. tmp.push(thisStyle);
  11055. // Retain as much of the original style as possible, if there is one
  11056. $this.attr('style', thisStyle ? thisStyle + ';' + style : style);
  11057. });
  11058. };
  11059. restore = function () {
  11060. // restore origin style values
  11061. $hidden.each(function (i) {
  11062. var $this = $(this), _tmp = tmp[ i ];
  11063. if (_tmp === undefined)
  11064. $this.removeAttr('style');
  11065. else
  11066. $this.attr('style', _tmp);
  11067. });
  11068. };
  11069. fix();
  11070. // get the actual value with user specific methed
  11071. // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc
  11072. // configs.includeMargin only works for 'outerWidth' and 'outerHeight'
  11073. var actual = /(outer)/.test(method) ?
  11074. $target[ method ](configs.includeMargin) :
  11075. $target[ method ]();
  11076. restore();
  11077. // IMPORTANT, this plugin only return the value of the first element
  11078. return actual;
  11079. };
  11080. /**
  11081. * Dom building
  11082. * @param {Object} combo_input - original input element
  11083. */
  11084. SelectPage.prototype.setElem = function (combo_input) {
  11085. // 1. build Dom object
  11086. var elem = {}, p = this.option, css = this.css_class, msg = this.message, input = $(combo_input);
  11087. var orgWidth = input.outerWidth();
  11088. // fix input width in hidden situation
  11089. if (orgWidth <= 0)
  11090. orgWidth = this.elementRealSize(input, 'outerWidth');
  11091. if (orgWidth < 150)
  11092. orgWidth = 150;
  11093. elem.combo_input = input.attr({'autocomplete': 'off'}).addClass(css.input).wrap('<div>');
  11094. if (p.selectOnly)
  11095. elem.combo_input.prop('readonly', true);
  11096. elem.container = elem.combo_input.parent().addClass(css.container);
  11097. if (elem.combo_input.prop('disabled')) {
  11098. if (p.multiple)
  11099. elem.container.addClass(css.disabled);
  11100. else
  11101. elem.combo_input.addClass(css.input_off);
  11102. }
  11103. // set outer box width
  11104. elem.container.width(orgWidth);
  11105. elem.button = $('<div>').addClass(css.button);
  11106. //drop down button
  11107. elem.dropdown = $('<span class="sp_caret"></span>');
  11108. //clear button 'X' in single mode
  11109. elem.clear_btn = $('<div>').html($('<i>').addClass('spfont sp-close')).addClass(css.clear_btn).attr('title', msg.clear);
  11110. if (!p.dropButton)
  11111. elem.clear_btn.addClass(css.align_right);
  11112. //main box in multiple mode
  11113. elem.element_box = $('<ul>').addClass(css.element_box);
  11114. if (p.multiple && p.multipleControlbar)
  11115. elem.control = $('<div>').addClass(css.control_box);
  11116. //result list box
  11117. elem.result_area = $('<div>').addClass(css.re_area);
  11118. //pagination bar
  11119. if (p.pagination)
  11120. elem.navi = $('<div>').addClass('sp_pagination').append('<ul>');
  11121. elem.results = $('<ul>').addClass(css.results);
  11122. var namePrefix = '_text',
  11123. input_id = elem.combo_input.attr('id') || elem.combo_input.attr('name'),
  11124. input_name = elem.combo_input.attr('name') || 'selectPage',
  11125. hidden_name = input_name,
  11126. hidden_id = input_id;
  11127. //switch the id and name attributes of input/hidden element
  11128. elem.hidden = $('<input type="hidden" class="sp_hidden" />').attr({
  11129. name: hidden_name,
  11130. id: hidden_id
  11131. }).val('');
  11132. elem.combo_input.attr({
  11133. name: input_name + namePrefix,
  11134. id: input_id + namePrefix
  11135. });
  11136. // 2. DOM element put
  11137. elem.container.append(elem.hidden);
  11138. if (p.dropButton) {
  11139. elem.container.append(elem.button)
  11140. elem.button.append(elem.dropdown);
  11141. }
  11142. $(document.body).append(elem.result_area);
  11143. elem.result_area.append(elem.results);
  11144. if (p.pagination)
  11145. elem.result_area.append(elem.navi);
  11146. //Multiple select mode
  11147. if (p.multiple) {
  11148. if (p.multipleControlbar) {
  11149. elem.control.append('<button type="button" class="btn btn-default sp_clear_all" ><i class="spfont sp-clear"></i></button>');
  11150. elem.control.append('<button type="button" class="btn btn-default sp_unselect_all" ><i class="spfont sp-unselect-all"></i></button>');
  11151. elem.control.append('<button type="button" class="btn btn-default sp_select_all" ><i class="spfont sp-select-all"></i></button>');
  11152. elem.control_text = $('<p>');
  11153. elem.control.append(elem.control_text);
  11154. elem.result_area.prepend(elem.control);
  11155. }
  11156. elem.container.addClass('sp_container_combo');
  11157. elem.combo_input.addClass('sp_combo_input').before(elem.element_box);
  11158. var li = $('<li>').addClass('input_box');
  11159. li.append(elem.combo_input);
  11160. elem.element_box.append(li);
  11161. if (elem.combo_input.attr('placeholder'))
  11162. elem.combo_input.attr('placeholder_bak', elem.combo_input.attr('placeholder'));
  11163. }
  11164. this.elem = elem;
  11165. };
  11166. /**
  11167. * Drop down button set to default
  11168. */
  11169. SelectPage.prototype.setButtonAttrDefault = function () {
  11170. /*
  11171. if (this.option.selectOnly) {
  11172. if ($(this.elem.combo_input).val() !== '') {
  11173. if ($(this.elem.hidden).val() !== '') {
  11174. //选择条件
  11175. $(this.elem.combo_input).attr('title', this.message.select_ok).removeClass(this.css_class.select_ng).addClass(this.css_class.select_ok);
  11176. } else {
  11177. //输入方式
  11178. $(this.elem.combo_input).attr('title', this.message.select_ng).removeClass(this.css_class.select_ok).addClass(this.css_class.select_ng);
  11179. }
  11180. } else {
  11181. $(this.elem.hidden).val('');
  11182. $(this.elem.combo_input).removeAttr('title').removeClass(this.css_class.select_ng);
  11183. }
  11184. }
  11185. */
  11186. //this.elem.button.attr('title', this.message.get_all_btn);
  11187. if (this.option.dropButton)
  11188. this.elem.button.attr('title', this.message.close_btn);
  11189. };
  11190. /**
  11191. * Set item need selected after init
  11192. * set selected item ways:
  11193. * <input value="key">
  11194. * <input data-init="key">
  11195. */
  11196. SelectPage.prototype.setInitRecord = function (refresh) {
  11197. var self = this, p = self.option, el = self.elem, key = '';
  11198. if ($.type(el.combo_input.data('init')) != 'undefined')
  11199. p.initRecord = String(el.combo_input.data('init'));
  11200. //data-init and value attribute can be init plugin selected item
  11201. //but, if set data-init and value attribute in the same time, plugin will choose data-init attribute first
  11202. if (!refresh && !p.initRecord && el.combo_input.val())
  11203. p.initRecord = el.combo_input.val();
  11204. el.combo_input.val('');
  11205. if (!refresh)
  11206. el.hidden.val(p.initRecord);
  11207. key = refresh && el.hidden.val() ? el.hidden.val() : p.initRecord;
  11208. if (key) {
  11209. if (typeof p.data === 'object') {
  11210. var data = new Array();
  11211. var keyarr = key.split(',');
  11212. $.each(keyarr, function (index, row) {
  11213. for (var i = 0; i < p.data.length; i++) {
  11214. if (p.data[i][p.keyField] == row) {
  11215. data.push(p.data[i]);
  11216. break;
  11217. }
  11218. }
  11219. });
  11220. if (!p.multiple && data.length > 1)
  11221. data = [data[0]];
  11222. self.afterInit(self, data);
  11223. } else {//ajax data source mode to init selected item
  11224. $.ajax({
  11225. dataType: 'json',
  11226. type: 'POST',
  11227. url: p.data,
  11228. data: {
  11229. searchTable: p.dbTable,
  11230. searchKey: p.keyField,
  11231. searchValue: key,
  11232. orderBy: p.orderBy,
  11233. showField: p.showField,
  11234. keyField: p.keyField,
  11235. keyValue: key,
  11236. searchField: p.searchField
  11237. },
  11238. success: function (json) {
  11239. var d = null;
  11240. if (p.eAjaxSuccess && $.isFunction(p.eAjaxSuccess))
  11241. d = p.eAjaxSuccess(json);
  11242. self.afterInit(self, d.list);
  11243. },
  11244. error: function (jqXHR, textStatus, errorThrown) {
  11245. self.ajaxErrorNotify(self, errorThrown);
  11246. }
  11247. });
  11248. }
  11249. }
  11250. };
  11251. /**
  11252. * Selected item set to plugin
  11253. * @param {Object} self
  11254. * @param {Object} data - selected item data
  11255. */
  11256. SelectPage.prototype.afterInit = function (self, data) {
  11257. if (!data || ($.isArray(data) && data.length === 0))
  11258. return;
  11259. if (!$.isArray(data))
  11260. data = [data];
  11261. var p = self.option, css = self.css_class;
  11262. var getText = function (row) {
  11263. var text = row[p.showField];
  11264. if (p.formatItem && $.isFunction(p.formatItem)) {
  11265. try {
  11266. text = p.formatItem(row);
  11267. } catch (e) {
  11268. }
  11269. }
  11270. return text;
  11271. };
  11272. if (p.multiple) {
  11273. self.prop.init_set = true;
  11274. self.clearAll(self);
  11275. $.each(data, function (i, row) {
  11276. var item = {text: getText(row), value: row[p.keyField]};
  11277. if (!self.isAlreadySelected(self, item))
  11278. self.addNewTag(self, item);
  11279. });
  11280. self.tagValuesSet(self);
  11281. self.inputResize(self);
  11282. console.log(self.elem.hidden.blur());
  11283. self.prop.init_set = false;
  11284. } else {
  11285. var row = data[0];
  11286. self.elem.combo_input.val(getText(row));
  11287. self.elem.hidden.val(row[p.keyField]);
  11288. self.prop.prev_value = getText(row);
  11289. self.prop.selected_text = getText(row);
  11290. if (p.selectOnly) {
  11291. self.elem.combo_input.attr('title', self.message.select_ok).removeClass(css.select_ng).addClass(css.select_ok);
  11292. }
  11293. self.putClearButton();
  11294. }
  11295. };
  11296. /**
  11297. * Drop down button event bind
  11298. */
  11299. SelectPage.prototype.eDropdownButton = function () {
  11300. var self = this;
  11301. if (self.option.dropButton) {
  11302. self.elem.button.mouseup(function (ev) {
  11303. ev.stopPropagation();
  11304. if (self.elem.result_area.is(':hidden') && !self.elem.combo_input.prop('disabled')) {
  11305. self.elem.combo_input.focus();
  11306. } else
  11307. self.hideResults(self);
  11308. });
  11309. }
  11310. };
  11311. /**
  11312. * Events bind
  11313. */
  11314. SelectPage.prototype.eInput = function () {
  11315. var self = this, p = self.option, el = self.elem, msg = self.message;
  11316. var showList = function () {
  11317. self.prop.page_move = false;
  11318. self.suggest(self);
  11319. self.setCssFocusedInput(self);
  11320. };
  11321. el.combo_input.keyup(function (e) {
  11322. self.processKey(self, e);
  11323. }).keydown(function (e) {
  11324. self.processControl(self, e);
  11325. }).focus(function (e) {
  11326. //When focus on input, show the result list
  11327. if (el.result_area.is(':hidden')) {
  11328. e.stopPropagation();
  11329. self.prop.first_show = true;
  11330. showList();
  11331. }
  11332. });
  11333. el.container.on('click.SelectPage', 'div.' + self.css_class.clear_btn, function (e) {
  11334. e.stopPropagation();
  11335. if (!self.disabled(self)) {
  11336. self.clearAll(self);
  11337. self.elem.hidden.change();
  11338. if (p.eClear && $.isFunction(p.eClear))
  11339. p.eClear(self);
  11340. }
  11341. });
  11342. el.result_area.on('mousedown.SelectPage', function (e) {
  11343. e.stopPropagation();
  11344. });
  11345. if (p.multiple) {
  11346. if (p.multipleControlbar) {
  11347. //Select all item of current page
  11348. el.control.find('.sp_select_all').on('click.SelectPage', function (e) {
  11349. self.selectAllLine(self);
  11350. }).hover(function () {
  11351. el.control_text.html(msg.select_all);
  11352. }, function () {
  11353. el.control_text.html('');
  11354. });
  11355. //Cancel select all item of current page
  11356. el.control.find('.sp_unselect_all').on('click.SelectPage', function (e) {
  11357. self.unSelectAllLine(self);
  11358. }).hover(function () {
  11359. el.control_text.html(msg.unselect_all);
  11360. }, function () {
  11361. el.control_text.html('');
  11362. });
  11363. //Clear all selected item
  11364. el.control.find('.sp_clear_all').on('click.SelectPage', function (e) {
  11365. self.clearAll(self);
  11366. }).hover(function () {
  11367. el.control_text.html(msg.clear_all);
  11368. }, function () {
  11369. el.control_text.html('');
  11370. });
  11371. }
  11372. el.element_box.on('click.SelectPage', function (e) {
  11373. var srcEl = e.target || e.srcElement;
  11374. if ($(srcEl).is('ul'))
  11375. el.combo_input.focus();
  11376. });
  11377. //Tag close
  11378. el.element_box.on('click.SelectPage', 'span.tag_close', function () {
  11379. var li = $(this).closest('li');
  11380. self.removeTag(self, li);
  11381. showList();
  11382. if (p.eTagRemove && $.isFunction(p.eTagRemove))
  11383. p.eTagRemove(1, self);
  11384. });
  11385. self.inputResize(self);
  11386. }
  11387. };
  11388. /**
  11389. * Out of plugin area click event handler
  11390. */
  11391. SelectPage.prototype.eWhole = function () {
  11392. var self = this, css = self.css_class;
  11393. var cleanContent = function (obj) {
  11394. obj.elem.combo_input.val('');
  11395. if (!obj.option.multiple)
  11396. obj.elem.hidden.val('');
  11397. obj.prop.selected_text = '';
  11398. };
  11399. //Out of plugin area
  11400. $(document.body).off('mousedown.selectPage').on('mousedown.selectPage', function (e) {
  11401. var ele = e.target || e.srcElement;
  11402. var sp = $(ele).closest('div.' + css.container);
  11403. //Open status result list
  11404. $('div.' + css.container + '.' + css.container_open).each(function () {
  11405. if (this == sp[0])
  11406. return;
  11407. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey);
  11408. if (!d.elem.combo_input.val() && d.elem.hidden.val() && !d.option.multiple) {
  11409. d.prop.current_page = 1;//reset page to 1
  11410. cleanContent(d);
  11411. d.hideResults(d);
  11412. return true;
  11413. }
  11414. if (d.elem.results.find('li').not('.' + css.message_box).size()) {
  11415. if (d.option.autoFillResult) {
  11416. //have selected item, then hide result list
  11417. if (d.elem.hidden.val())
  11418. d.hideResults(d);
  11419. else if (d.elem.results.find('li.sp_over').size()) {
  11420. //no one selected and have highlight item, select the highlight item
  11421. d.selectCurrentLine(d, true);
  11422. } else if (d.option.autoSelectFirst) {
  11423. //no one selected, no one highlight, select the first item
  11424. d.nextLine(d);
  11425. d.selectCurrentLine(d, true);
  11426. } else
  11427. d.hideResults(d);
  11428. } else
  11429. d.hideResults(d);
  11430. } else {
  11431. //when no one item match, clear search keywords
  11432. if (d.option.noResultClean)
  11433. cleanContent(d);
  11434. else {
  11435. if (!d.option.multiple)
  11436. d.elem.hidden.val('');
  11437. }
  11438. d.hideResults(d);
  11439. }
  11440. });
  11441. });
  11442. };
  11443. /**
  11444. * Result list event bind
  11445. */
  11446. SelectPage.prototype.eResultList = function () {
  11447. var self = this, css = this.css_class;
  11448. self.elem.results.children('li').hover(function () {
  11449. if (self.prop.key_select) {
  11450. self.prop.key_select = false;
  11451. return;
  11452. }
  11453. if (!$(this).hasClass(css.selected) && !$(this).hasClass(css.message_box)) {
  11454. $(this).addClass(css.select);
  11455. self.setCssFocusedResults(self);
  11456. }
  11457. }, function () {
  11458. $(this).removeClass(css.select);
  11459. }).click(function (e) {
  11460. if (self.prop.key_select) {
  11461. self.prop.key_select = false;
  11462. return;
  11463. }
  11464. e.preventDefault();
  11465. e.stopPropagation();
  11466. if (!$(this).hasClass(css.selected))
  11467. self.selectCurrentLine(self, false);
  11468. });
  11469. };
  11470. /**
  11471. * Reposition result list when list beyond the visible area
  11472. */
  11473. SelectPage.prototype.eScroll = function () {
  11474. var self = this, css = this.css_class;
  11475. $(window).on('scroll.SelectPage', function (e) {
  11476. $('div.' + css.container + '.' + css.container_open).each(function () {
  11477. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey),
  11478. offset = d.elem.result_area.offset(),
  11479. screenScrollTop = $(window).scrollTop(),
  11480. docHeight = $(document).height(),
  11481. viewHeight = $(window).height(),
  11482. listHeight = d.elem.result_area.outerHeight(),
  11483. listBottom = offset.top + listHeight,
  11484. hasOverflow = docHeight > viewHeight,
  11485. down = d.elem.result_area.hasClass('shadowDown');
  11486. if (hasOverflow) {
  11487. if (down) {//open down
  11488. if (listBottom > (viewHeight + screenScrollTop))
  11489. d.calcResultsSize(d);
  11490. } else {//open up
  11491. if (offset.top < screenScrollTop)
  11492. d.calcResultsSize(d);
  11493. }
  11494. }
  11495. });
  11496. });
  11497. };
  11498. /**
  11499. * Page bar button event bind
  11500. */
  11501. SelectPage.prototype.ePaging = function () {
  11502. var self = this;
  11503. if (!self.option.pagination)
  11504. return;
  11505. self.elem.navi.find('li.csFirstPage').off('click').on('click', function (ev) {
  11506. //$(self.elem.combo_input).focus();
  11507. ev.preventDefault();
  11508. self.firstPage(self);
  11509. });
  11510. self.elem.navi.find('li.csPreviousPage').off('click').on('click', function (ev) {
  11511. //$(self.elem.combo_input).focus();
  11512. ev.preventDefault();
  11513. self.prevPage(self);
  11514. });
  11515. self.elem.navi.find('li.csNextPage').off('click').on('click', function (ev) {
  11516. //$(self.elem.combo_input).focus();
  11517. ev.preventDefault();
  11518. self.nextPage(self);
  11519. });
  11520. self.elem.navi.find('li.csLastPage').off('click').on('click', function (ev) {
  11521. //$(self.elem.combo_input).focus();
  11522. ev.preventDefault();
  11523. self.lastPage(self);
  11524. });
  11525. };
  11526. /**
  11527. * Ajax request fail
  11528. * @param {Object} self
  11529. * @param {string} errorThrown
  11530. */
  11531. SelectPage.prototype.ajaxErrorNotify = function (self, errorThrown) {
  11532. self.showMessage(self.message.ajax_error);
  11533. };
  11534. /**
  11535. * Message box
  11536. * @param {Object} self
  11537. * @param msg {string} the text need to show
  11538. */
  11539. SelectPage.prototype.showMessage = function (self, msg) {
  11540. if (!msg)
  11541. return;
  11542. var msgLi = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' + msg + '</li>';
  11543. self.elem.results.empty().append(msgLi).show();
  11544. self.calcResultsSize(self);
  11545. self.setOpenStatus(self, true);
  11546. self.elem.control.hide();
  11547. if (self.option.pagination)
  11548. self.elem.navi.hide();
  11549. };
  11550. /**
  11551. * @desc Scroll
  11552. * @param {Object} self
  11553. * @param {boolean} enforce
  11554. */
  11555. SelectPage.prototype.scrollWindow = function (self, enforce) {
  11556. var current_result = self.getCurrentLine(self),
  11557. target_top = (current_result && !enforce) ? current_result.offset().top : self.elem.container.offset().top,
  11558. target_size;
  11559. self.prop.size_li = self.elem.results.children('li:first').outerHeight();
  11560. target_size = self.prop.size_li;
  11561. var gap, client_height = $(window).height(),
  11562. scroll_top = $(window).scrollTop(),
  11563. scroll_bottom = scroll_top + client_height - target_size;
  11564. if (current_result.length) {
  11565. if (target_top < scroll_top || target_size > client_height) {
  11566. //scroll to top
  11567. gap = target_top - scroll_top;
  11568. } else if (target_top > scroll_bottom) {
  11569. //scroll down
  11570. gap = target_top - scroll_bottom;
  11571. } else
  11572. return; //do not scroll
  11573. } else if (target_top < scroll_top)
  11574. gap = target_top - scroll_top;
  11575. window.scrollBy(0, gap);
  11576. };
  11577. /**
  11578. * change css class by status
  11579. * @param self
  11580. * @param status {boolean} true: open, false: close
  11581. */
  11582. SelectPage.prototype.setOpenStatus = function (self, status) {
  11583. var el = self.elem, css = self.css_class;
  11584. if (status) {
  11585. el.container.addClass(css.container_open);
  11586. el.result_area.addClass(css.result_open);
  11587. } else {
  11588. el.container.removeClass(css.container_open);
  11589. el.result_area.removeClass(css.result_open);
  11590. }
  11591. };
  11592. /**
  11593. * input element in focus css class set
  11594. * @param {Object} self
  11595. */
  11596. SelectPage.prototype.setCssFocusedInput = function (self) {
  11597. //$(self.elem.results).addClass(self.css_class.re_off);
  11598. //$(self.elem.combo_input).removeClass(self.css_class.input_off);
  11599. };
  11600. /**
  11601. * set result list get focus and input element lost focus
  11602. * @param {Object} self
  11603. */
  11604. SelectPage.prototype.setCssFocusedResults = function (self) {
  11605. //$(self.elem.results).removeClass(self.css_class.re_off);
  11606. //$(self.elem.combo_input).addClass(self.css_class.input_off);
  11607. };
  11608. /**
  11609. * Quick search input keywords listener
  11610. * @param {Object} self
  11611. */
  11612. SelectPage.prototype.checkValue = function (self) {
  11613. var now_value = self.elem.combo_input.val();
  11614. if (now_value != self.prop.prev_value) {
  11615. self.prop.prev_value = now_value;
  11616. self.prop.first_show = false;
  11617. if (self.option.selectOnly)
  11618. self.setButtonAttrDefault();
  11619. if (!self.option.multiple && !now_value) {
  11620. self.elem.combo_input.val('');
  11621. self.elem.hidden.val('');
  11622. self.elem.clear_btn.remove();
  11623. }
  11624. self.suggest(self);
  11625. }
  11626. };
  11627. /**
  11628. * Input handle(regular input)
  11629. * @param {Object} self
  11630. * @param {Object} e - event object
  11631. */
  11632. SelectPage.prototype.processKey = function (self, e) {
  11633. if ($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9, 13]) === -1) {
  11634. if (e.keyCode != 16)
  11635. self.setCssFocusedInput(self); // except Shift(16)
  11636. self.inputResize(self);
  11637. if ($.type(self.option.data) === 'string') {
  11638. self.prop.last_input_time = e.timeStamp;
  11639. setTimeout(function () {
  11640. if ((e.timeStamp - self.prop.last_input_time) === 0)
  11641. self.checkValue(self);
  11642. }, self.option.inputDelay * 1000);
  11643. } else {
  11644. self.checkValue(self);
  11645. }
  11646. }
  11647. }
  11648. /**
  11649. * Input handle(control key)
  11650. * @param {Object} self
  11651. * @param {Object} e - event object
  11652. */
  11653. SelectPage.prototype.processControl = function (self, e) {
  11654. if (($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9]) > -1 && self.elem.result_area.is(':visible')) ||
  11655. ($.inArray(e.keyCode, [13, 9]) > -1 && self.getCurrentLine(self))) {
  11656. e.preventDefault();
  11657. e.stopPropagation();
  11658. e.cancelBubble = true;
  11659. e.returnValue = false;
  11660. switch (e.keyCode) {
  11661. case 37:// left
  11662. if (e.shiftKey)
  11663. self.firstPage(self);
  11664. else
  11665. self.prevPage(self);
  11666. break;
  11667. case 38:// up
  11668. self.prop.key_select = true;
  11669. self.prevLine(self);
  11670. break;
  11671. case 39:// right
  11672. if (e.shiftKey)
  11673. self.lastPage(self);
  11674. else
  11675. self.nextPage(self);
  11676. break;
  11677. case 40:// down
  11678. if (self.elem.results.children('li').length) {
  11679. self.prop.key_select = true;
  11680. self.nextLine(self);
  11681. } else
  11682. self.suggest(self);
  11683. break;
  11684. case 9:// tab
  11685. self.prop.key_paging = true;
  11686. self.selectCurrentLine(self, true);
  11687. //self.hideResults(self);
  11688. break;
  11689. case 13:// return
  11690. self.selectCurrentLine(self, true);
  11691. break;
  11692. case 27:// escape
  11693. self.prop.key_paging = true;
  11694. self.hideResults(self);
  11695. break;
  11696. }
  11697. }
  11698. };
  11699. /**
  11700. * Abort Ajax request
  11701. * @param {Object} self
  11702. */
  11703. SelectPage.prototype.abortAjax = function (self) {
  11704. if (self.prop.xhr) {
  11705. self.prop.xhr.abort();
  11706. self.prop.xhr = false;
  11707. }
  11708. };
  11709. /**
  11710. * Suggest result of search keywords
  11711. * @param {Object} self
  11712. */
  11713. SelectPage.prototype.suggest = function (self) {
  11714. var q_word, val = $.trim(self.elem.combo_input.val());
  11715. if (self.option.multiple)
  11716. q_word = val;
  11717. else {
  11718. if (val && val === self.prop.selected_text)
  11719. q_word = '';
  11720. else
  11721. q_word = val;
  11722. }
  11723. q_word = q_word.split(/[\s ]+/);
  11724. //Before show up result list callback
  11725. if (self.option.eOpen && $.isFunction(self.option.eOpen))
  11726. self.option.eOpen.call(self);
  11727. self.abortAjax(self);
  11728. //self.setLoading(self);
  11729. var which_page_num = self.prop.current_page || 1;
  11730. if (typeof self.option.data == 'object')
  11731. self.searchForJson(self, q_word, which_page_num);
  11732. else
  11733. self.searchForDb(self, q_word, which_page_num);
  11734. };
  11735. /**
  11736. * Loading
  11737. * @param {Object} self
  11738. */
  11739. SelectPage.prototype.setLoading = function (self) {
  11740. if (self.elem.results.html() === '') {
  11741. //self.calcResultsSize(self);
  11742. self.setOpenStatus(self, true);
  11743. }
  11744. };
  11745. /**
  11746. * Search for ajax
  11747. * @param {Object} self
  11748. * @param {Array} q_word - query keyword
  11749. * @param {number} which_page_num - target page number
  11750. */
  11751. SelectPage.prototype.searchForDb = function (self, q_word, which_page_num) {
  11752. var p = self.option;
  11753. if (!p.eAjaxSuccess || !$.isFunction(p.eAjaxSuccess))
  11754. self.hideResults(self);
  11755. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  11756. //when have new query keyword, then reset page number to 1.
  11757. if (q_word.length && q_word[0] && q_word[0] !== self.prop.prev_value)
  11758. which_page_num = 1;
  11759. var _orgParams = {
  11760. q_word: q_word,
  11761. pageNumber: which_page_num,
  11762. pageSize: p.pageSize,
  11763. andOr: p.andOr,
  11764. orderBy: p.orderBy,
  11765. searchTable: p.dbTable,
  11766. showField: self.option.showField,
  11767. keyField: self.option.keyField,
  11768. searchField: self.option.searchField
  11769. };
  11770. _orgParams[searchKey] = q_word[0];
  11771. if (_paramsFunc) {
  11772. var result = $.isFunction(_paramsFunc) ? _paramsFunc() : _paramsFunc;
  11773. if (result && $.isPlainObject(result)) {
  11774. _params = $.extend({}, _orgParams, result);
  11775. } else {
  11776. _params = _orgParams;
  11777. }
  11778. } else
  11779. _params = _orgParams;
  11780. self.prop.xhr = $.ajax({
  11781. dataType: 'json',
  11782. url: p.data,
  11783. type: 'POST',
  11784. data: _params,
  11785. success: function (returnData) {
  11786. if (!returnData || !$.isPlainObject(returnData)) {
  11787. self.hideResults(self);
  11788. self.ajaxErrorNotify(self, errorThrown);
  11789. return;
  11790. }
  11791. var data = {}, json = {};
  11792. try {
  11793. data = p.eAjaxSuccess(returnData);
  11794. json.originalResult = data.list;
  11795. json.cnt_whole = data.totalRow;
  11796. } catch (e) {
  11797. self.showMessage(self, self.message.ajax_error);
  11798. return;
  11799. }
  11800. if(self.elem.navi) {
  11801. $(self.elem.navi).toggleClass("hide", json.cnt_whole <= json.originalResult.length);
  11802. }
  11803. json.candidate = [];
  11804. json.keyField = [];
  11805. if (typeof json.originalResult != 'object') {
  11806. self.prop.xhr = null;
  11807. self.notFoundSearch(self);
  11808. return;
  11809. }
  11810. json.cnt_page = json.originalResult.length;
  11811. for (var i = 0; i < json.cnt_page; i++) {
  11812. for (var key in json.originalResult[i]) {
  11813. if (key == p.keyField) {
  11814. json.keyField.push(json.originalResult[i][key]);
  11815. }
  11816. if (key == p.showField) {
  11817. json.candidate.push(json.originalResult[i][key]);
  11818. }
  11819. }
  11820. }
  11821. self.prepareResults(self, json, q_word, which_page_num);
  11822. },
  11823. error: function (jqXHR, textStatus, errorThrown) {
  11824. if (textStatus != 'abort') {
  11825. self.hideResults(self);
  11826. self.ajaxErrorNotify(self, errorThrown);
  11827. }
  11828. },
  11829. complete: function () {
  11830. self.prop.xhr = null;
  11831. }
  11832. });
  11833. };
  11834. /**
  11835. * Search for json data source
  11836. * @param {Object} self
  11837. * @param {Array} q_word
  11838. * @param {number} which_page_num
  11839. */
  11840. SelectPage.prototype.searchForJson = function (self, q_word, which_page_num) {
  11841. var p = self.option, matched = [], esc_q = [], sorted = [], json = {}, i = 0, arr_reg = [];
  11842. //query keyword filter
  11843. do {
  11844. //'/\W/g'正则代表全部不是字母,数字,下划线,汉字的字符
  11845. //将非法字符进行转义
  11846. esc_q[i] = q_word[i].replace(/\W/g, '\\$&').toString();
  11847. arr_reg[i] = new RegExp(esc_q[i], 'gi');
  11848. i++;
  11849. } while (i < q_word.length);
  11850. // SELECT * FROM data WHERE field LIKE q_word;
  11851. for (i = 0; i < p.data.length; i++) {
  11852. var flag = false, row = p.data[i], itemText;
  11853. for (var j = 0; j < arr_reg.length; j++) {
  11854. itemText = row[p.searchField];
  11855. if (p.formatItem && $.isFunction(p.formatItem))
  11856. itemText = p.formatItem(row);
  11857. if (itemText.match(arr_reg[j])) {
  11858. flag = true;
  11859. if (p.andOr == 'OR')
  11860. break;
  11861. } else {
  11862. flag = false;
  11863. if (p.andOr == 'AND')
  11864. break;
  11865. }
  11866. }
  11867. if (flag)
  11868. matched.push(row);
  11869. }
  11870. // (CASE WHEN ...) then く order some column
  11871. var reg1 = new RegExp('^' + esc_q[0] + '$', 'gi'),
  11872. reg2 = new RegExp('^' + esc_q[0], 'gi'),
  11873. matched1 = [], matched2 = [], matched3 = [];
  11874. for (i = 0; i < matched.length; i++) {
  11875. var orderField = p.orderBy[0][0];
  11876. var orderValue = String(matched[i][orderField]);
  11877. if (orderValue.match(reg1)) {
  11878. matched1.push(matched[i]);
  11879. } else if (orderValue.match(reg2)) {
  11880. matched2.push(matched[i]);
  11881. } else {
  11882. matched3.push(matched[i]);
  11883. }
  11884. }
  11885. if (p.orderBy[0][1].match(/^asc$/i)) {
  11886. matched1 = self.sortAsc(self, matched1);
  11887. matched2 = self.sortAsc(self, matched2);
  11888. matched3 = self.sortAsc(self, matched3);
  11889. } else {
  11890. matched1 = self.sortDesc(self, matched1);
  11891. matched2 = self.sortDesc(self, matched2);
  11892. matched3 = self.sortDesc(self, matched3);
  11893. }
  11894. sorted = sorted.concat(matched1).concat(matched2).concat(matched3);
  11895. /*
  11896. if (sorted.length === undefined || sorted.length === 0 ) {
  11897. self.notFoundSearch(self);
  11898. return;
  11899. }
  11900. */
  11901. json.cnt_whole = sorted.length;
  11902. //page_move used to distinguish between init plugin or page moving
  11903. if (!self.prop.page_move) {
  11904. //only single mode can be used page number relocation
  11905. if (!p.multiple) {
  11906. //get selected item belong page number
  11907. var currentValue = self.elem.hidden.val();
  11908. if ($.type(currentValue) !== 'undefined' && $.trim(currentValue) !== '') {
  11909. var index = 0;
  11910. $.each(sorted, function (i, row) {
  11911. if (row[p.keyField] == currentValue) {
  11912. index = i + 1;
  11913. return false;
  11914. }
  11915. });
  11916. which_page_num = Math.ceil(index / p.pageSize);
  11917. if (which_page_num < 1)
  11918. which_page_num = 1;
  11919. self.prop.current_page = which_page_num;
  11920. }
  11921. }
  11922. } else {
  11923. //set page number to 1 when result number less then page size
  11924. if (sorted.length <= ((which_page_num - 1) * p.pageSize)) {
  11925. which_page_num = 1;
  11926. self.prop.current_page = 1;
  11927. }
  11928. }
  11929. //LIMIT xx OFFSET xx
  11930. var start = (which_page_num - 1) * p.pageSize, end = start + p.pageSize;
  11931. //save original data
  11932. json.originalResult = [];
  11933. //after data filter handle
  11934. for (i = start; i < end; i++) {
  11935. if (sorted[i] === undefined)
  11936. break;
  11937. json.originalResult.push(sorted[i]);
  11938. for (var key in sorted[i]) {
  11939. if (key == p.keyField) {
  11940. if (json.keyField === undefined)
  11941. json.keyField = [];
  11942. json.keyField.push(sorted[i][key]);
  11943. }
  11944. if (key == p.showField) {
  11945. if (json.candidate === undefined)
  11946. json.candidate = [];
  11947. json.candidate.push(sorted[i][key]);
  11948. }
  11949. }
  11950. }
  11951. if (json.candidate === undefined)
  11952. json.candidate = [];
  11953. json.cnt_page = json.candidate.length;
  11954. self.prepareResults(self, json, q_word, which_page_num);
  11955. };
  11956. /**
  11957. * Set order asc
  11958. * @param {Object} self
  11959. * @param {Array} arr - result array
  11960. */
  11961. SelectPage.prototype.sortAsc = function (self, arr) {
  11962. arr.sort(function (a, b) {
  11963. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  11964. return $.type(valA) === 'number' ? valA - valB : String(valA).localeCompare(String(valB));
  11965. });
  11966. return arr;
  11967. };
  11968. /**
  11969. * Set order desc
  11970. * @param {Object} self
  11971. * @param {Array} arr - result array
  11972. */
  11973. SelectPage.prototype.sortDesc = function (self, arr) {
  11974. arr.sort(function (a, b) {
  11975. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  11976. return $.type(valA) === 'number' ? valB - valA : String(valB).localeCompare(String(valA));
  11977. });
  11978. return arr;
  11979. };
  11980. /**
  11981. * Not result found handle
  11982. * @param {Object} self
  11983. */
  11984. SelectPage.prototype.notFoundSearch = function (self) {
  11985. self.elem.results.empty();
  11986. self.calcResultsSize(self);
  11987. self.setOpenStatus(self, true);
  11988. self.setCssFocusedInput(self);
  11989. };
  11990. /**
  11991. * Prepare data to show
  11992. * @param {Object} self
  11993. * @param {Object} json - data result
  11994. * @param {Array} q_word - query keyword
  11995. * @param {number} which_page_num - target page number
  11996. */
  11997. SelectPage.prototype.prepareResults = function (self, json, q_word, which_page_num) {
  11998. if (self.option.pagination)
  11999. self.setNavi(self, json.cnt_whole, json.cnt_page, which_page_num);
  12000. if (!json.keyField)
  12001. json.keyField = false;
  12002. if (self.option.selectOnly && json.candidate.length === 1 && json.candidate[0] == q_word[0]) {
  12003. self.elem.hidden.val(json.keyField[0]);
  12004. this.setButtonAttrDefault();
  12005. }
  12006. var is_query = false;
  12007. if (q_word && q_word.length && q_word[0])
  12008. is_query = true;
  12009. self.displayResults(self, json, is_query);
  12010. };
  12011. /**
  12012. * Build page bar
  12013. * @param {Object} self
  12014. * @param {number} cnt_whole - total record count
  12015. * @param {number} cnt_page
  12016. * @param {number} page_num - current page number
  12017. */
  12018. SelectPage.prototype.setNavi = function (self, cnt_whole, cnt_page, page_num) {
  12019. var msg = self.message;
  12020. /**
  12021. * build pagination bar
  12022. */
  12023. var buildPageNav = function (self, pagebar, page_num, last_page) {
  12024. var updatePageInfo = function () {
  12025. var pageInfo = msg.page_info;
  12026. return pageInfo.replace(self.template.page.current, page_num).replace(self.template.page.total, last_page);
  12027. };
  12028. if (pagebar.find('li').size() === 0) {
  12029. pagebar.hide().empty();
  12030. var iconFist = 'spfont sp-first',
  12031. iconPrev = 'spfont sp-previous',
  12032. iconNext = 'spfont sp-next',
  12033. iconLast = 'spfont sp-last';
  12034. pagebar.append('<li class="csFirstPage" title="' + msg.first_title + '" ><a href="javascript:void(0);"> <i class="' + iconFist + '"></i> </a></li>');
  12035. pagebar.append('<li class="csPreviousPage" title="' + msg.prev_title + '" ><a href="javascript:void(0);"><i class="' + iconPrev + '"></i></a></li>');
  12036. //pagination information
  12037. pagebar.append('<li class="pageInfoBox"><a href="javascript:void(0);"> ' + updatePageInfo() + ' </a></li>');
  12038. pagebar.append('<li class="csNextPage" title="' + msg.next_title + '" ><a href="javascript:void(0);"><i class="' + iconNext + '"></i></a></li>');
  12039. pagebar.append('<li class="csLastPage" title="' + msg.last_title + '" ><a href="javascript:void(0);"> <i class="' + iconLast + '"></i> </a></li>');
  12040. pagebar.show();
  12041. } else {
  12042. pagebar.find('li.pageInfoBox a').html(updatePageInfo());
  12043. }
  12044. };
  12045. var pagebar = self.elem.navi.find('ul'),
  12046. last_page = Math.ceil(cnt_whole / self.option.pageSize); //calculate total page
  12047. if (last_page === 0)
  12048. page_num = 0;
  12049. else {
  12050. if (last_page < page_num)
  12051. page_num = last_page;
  12052. else if (page_num === 0)
  12053. page_num = 1;
  12054. }
  12055. self.prop.current_page = page_num;//update current page number
  12056. self.prop.max_page = last_page;//update page count
  12057. buildPageNav(self, pagebar, page_num, last_page);
  12058. //update paging status
  12059. var dClass = 'disabled',
  12060. first = pagebar.find('li.csFirstPage'),
  12061. previous = pagebar.find('li.csPreviousPage'),
  12062. next = pagebar.find('li.csNextPage'),
  12063. last = pagebar.find('li.csLastPage');
  12064. //first and previous
  12065. if (page_num === 1 || page_num === 0) {
  12066. if (!first.hasClass(dClass))
  12067. first.addClass(dClass);
  12068. if (!previous.hasClass(dClass))
  12069. previous.addClass(dClass);
  12070. } else {
  12071. if (first.hasClass(dClass))
  12072. first.removeClass(dClass);
  12073. if (previous.hasClass(dClass))
  12074. previous.removeClass(dClass);
  12075. }
  12076. //next and last
  12077. if (page_num === last_page || last_page === 0) {
  12078. if (!next.hasClass(dClass))
  12079. next.addClass(dClass);
  12080. if (!last.hasClass(dClass))
  12081. last.addClass(dClass);
  12082. } else {
  12083. if (next.hasClass(dClass))
  12084. next.removeClass(dClass);
  12085. if (last.hasClass(dClass))
  12086. last.removeClass(dClass);
  12087. }
  12088. if (last_page > 1)
  12089. self.ePaging(); //pagination event bind
  12090. };
  12091. /**
  12092. * Render result list
  12093. * @param {Object} self
  12094. * @param {Object} json - result data
  12095. * @param {boolean} is_query - used to different from search to open and just click to open
  12096. */
  12097. SelectPage.prototype.displayResults = function (self, json, is_query) {
  12098. var p = self.option, el = self.elem;
  12099. el.results.hide().empty();
  12100. if (p.multiple && $.type(p.maxSelectLimit) === 'number' && p.maxSelectLimit > 0) {
  12101. var selectedSize = el.element_box.find('li.selected_tag').size();
  12102. if (selectedSize > 0 && selectedSize >= p.maxSelectLimit) {
  12103. var msg = self.message.max_selected;
  12104. self.showMessage(self, msg.replace(self.template.msg.maxSelectLimit, p.maxSelectLimit));
  12105. return;
  12106. }
  12107. }
  12108. if (json.candidate.length) {
  12109. var arr_candidate = json.candidate,
  12110. arr_primary_key = json.keyField,
  12111. keystr = el.hidden.val(),
  12112. keyArr = keystr ? keystr.split(',') : new Array(),
  12113. itemText = '';
  12114. for (var i = 0; i < arr_candidate.length; i++) {
  12115. if (p.formatItem && $.isFunction(p.formatItem)) {
  12116. try {
  12117. itemText = p.formatItem(json.originalResult[i]);
  12118. } catch (e) {
  12119. console.error('formatItem内容格式化函数内容设置不正确!');
  12120. itemText = arr_candidate[i];
  12121. }
  12122. } else
  12123. itemText = arr_candidate[i];
  12124. var list = $('<li>').html(itemText).attr({
  12125. pkey: arr_primary_key[i]
  12126. });
  12127. if (!p.formatItem)
  12128. list.attr('title', itemText);
  12129. //Set selected item highlight
  12130. if ($.inArray(arr_primary_key[i].toString(), keyArr) !== -1) {
  12131. list.addClass(self.css_class.selected);
  12132. }
  12133. //cache item data
  12134. list.data('dataObj', json.originalResult[i]);
  12135. el.results.append(list);
  12136. }
  12137. } else {
  12138. var li = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' +
  12139. self.message.not_found + '</li>';
  12140. el.results.append(li);
  12141. }
  12142. el.results.show();
  12143. if (p.multiple && p.multipleControlbar)
  12144. el.control.show();
  12145. if (p.pagination)
  12146. el.navi.show();
  12147. self.calcResultsSize(self);
  12148. self.setOpenStatus(self, true);
  12149. //Result item event bind
  12150. self.eResultList();
  12151. //scrolling listen
  12152. self.eScroll();
  12153. //auto highlight first item in search, have result and set autoSelectFirst to true situation
  12154. if (is_query && json.candidate.length && p.autoSelectFirst)
  12155. self.nextLine(self);
  12156. };
  12157. /**
  12158. * Calculate result list size and position
  12159. * @param {Object} self
  12160. */
  12161. SelectPage.prototype.calcResultsSize = function (self) {
  12162. var p = self.option, el = self.elem;
  12163. var rePosition = function () {
  12164. if (el.container.css('position') === 'static') {
  12165. // position: static
  12166. var offset = el.combo_input.offset();
  12167. el.result_area.css({
  12168. top: offset.top + el.combo_input.outerHeight() + 'px',
  12169. left: offset.left + 'px'
  12170. });
  12171. } else {
  12172. if (!p.pagination) {
  12173. var itemHeight = el.results.find('li:first').outerHeight(true),
  12174. listHeight = itemHeight * p.listSize;
  12175. el.results.css({
  12176. 'max-height': listHeight,
  12177. 'overflow-y': 'auto'
  12178. });
  12179. }
  12180. //handle result list show up side(left, right, up or down)
  12181. var docWidth = $(document).width(),
  12182. docHeight = $(document).height(), //the document full height
  12183. viewHeight = $(window).height(), //browser visible area height
  12184. offset = el.container.offset(),
  12185. screenScrollTop = $(window).scrollTop(),
  12186. listWidth = el.result_area.outerWidth(),
  12187. //result list height
  12188. listHeight = el.result_area.outerHeight(),
  12189. //default left used input element left
  12190. defaultLeft = offset.left, //p.multiple ? -1 : 0;
  12191. //input element height
  12192. inputHeight = el.container.outerHeight(),
  12193. left = (offset.left + listWidth) > docWidth ?
  12194. defaultLeft - (listWidth - el.container.outerWidth()) :
  12195. defaultLeft,
  12196. //the actual top coordinate of input element(outer div)
  12197. screenTop = offset.top, //$(el.container).scrollTop();//offset.top - screenScrollTop;
  12198. top = 0, dist = 5, //set distance between input element and result list
  12199. //the actual top coordinate of result list
  12200. listBottom = screenTop + inputHeight + listHeight + dist,
  12201. hasOverflow = docHeight > viewHeight;
  12202. if ((screenTop - screenScrollTop - dist > listHeight) &&
  12203. (hasOverflow && listBottom > (viewHeight + screenScrollTop)) ||
  12204. (!hasOverflow && listBottom > viewHeight)) {
  12205. //open up
  12206. top = offset.top - listHeight - dist;
  12207. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowUp');
  12208. } else {
  12209. //open down
  12210. top = offset.top + (p.multiple ? el.container.outerHeight() : inputHeight);
  12211. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowDown');
  12212. top += dist;
  12213. }
  12214. return {
  12215. top: top + 'px', left: left + 'px'
  12216. };
  12217. }
  12218. };
  12219. if (el.result_area.is(':visible')) {
  12220. el.result_area.css(rePosition());
  12221. } else {
  12222. var pss = rePosition();
  12223. el.result_area.css(pss).show(1, function () {
  12224. var repss = rePosition();
  12225. if (pss.top !== repss.top || pss.left !== repss.left)
  12226. el.result_area.css(repss);
  12227. });
  12228. }
  12229. };
  12230. /**
  12231. * hide result list
  12232. * @param {Object} self
  12233. */
  12234. SelectPage.prototype.hideResults = function (self) {
  12235. if (self.prop.key_paging) {
  12236. self.scrollWindow(self, true);
  12237. self.prop.key_paging = false;
  12238. }
  12239. self.setCssFocusedInput(self);
  12240. if (self.option.autoFillResult) {
  12241. //self.selectCurrentLine(self, true);
  12242. }
  12243. self.elem.results.empty();
  12244. self.elem.result_area.hide();
  12245. self.setOpenStatus(self, false);
  12246. //unbind window scroll listen
  12247. $(window).off('scroll.SelectPage');
  12248. self.abortAjax(self);
  12249. self.setButtonAttrDefault();
  12250. };
  12251. /**
  12252. * set plugin to disabled / enabled
  12253. * @param self
  12254. * @param disabled
  12255. */
  12256. SelectPage.prototype.disabled = function (self, disabled) {
  12257. var p = self.option, el = self.elem;
  12258. if ($.type(disabled) === 'undefined')
  12259. return el.combo_input.prop('disabled');
  12260. if ($.type(disabled) === 'boolean') {
  12261. el.combo_input.prop('disabled', disabled);
  12262. if (disabled)
  12263. el.container.addClass(self.css_class.disabled);
  12264. else
  12265. el.container.removeClass(self.css_class.disabled);
  12266. }
  12267. };
  12268. /**
  12269. * Go fist page
  12270. * @param {Object} self
  12271. */
  12272. SelectPage.prototype.firstPage = function (self) {
  12273. if (self.prop.current_page > 1) {
  12274. self.prop.current_page = 1;
  12275. self.prop.page_move = true;
  12276. self.suggest(self);
  12277. }
  12278. };
  12279. /**
  12280. * Go previous page
  12281. * @param {Object} self
  12282. */
  12283. SelectPage.prototype.prevPage = function (self) {
  12284. if (self.prop.current_page > 1) {
  12285. self.prop.current_page--;
  12286. self.prop.page_move = true;
  12287. self.suggest(self);
  12288. }
  12289. };
  12290. /**
  12291. * Go next page
  12292. * @param {Object} self
  12293. */
  12294. SelectPage.prototype.nextPage = function (self) {
  12295. if (self.prop.current_page < self.prop.max_page) {
  12296. self.prop.current_page++;
  12297. self.prop.page_move = true;
  12298. self.suggest(self);
  12299. }
  12300. };
  12301. /**
  12302. * Go last page
  12303. * @param {Object} self
  12304. */
  12305. SelectPage.prototype.lastPage = function (self) {
  12306. if (self.prop.current_page < self.prop.max_page) {
  12307. self.prop.current_page = self.prop.max_page;
  12308. self.prop.page_move = true;
  12309. self.suggest(self);
  12310. }
  12311. };
  12312. /**
  12313. * do something after select/unSelect action
  12314. * @param {Object} self
  12315. */
  12316. SelectPage.prototype.afterAction = function (self) {
  12317. self.inputResize(self);
  12318. self.elem.combo_input.change();
  12319. self.setCssFocusedInput(self);
  12320. if (self.prop.init_set)
  12321. return;
  12322. if (self.option.multiple) {
  12323. if (self.option.selectToCloseList) {
  12324. self.hideResults(self);
  12325. self.elem.combo_input.blur();
  12326. } else {
  12327. self.suggest(self);
  12328. self.elem.combo_input.focus();
  12329. }
  12330. } else {
  12331. self.hideResults(self);
  12332. self.elem.combo_input.blur();
  12333. }
  12334. };
  12335. /**
  12336. * Select current list item
  12337. * @param {Object} self
  12338. * @param {boolean} is_enter_key
  12339. */
  12340. SelectPage.prototype.selectCurrentLine = function (self, is_enter_key) {
  12341. self.scrollWindow(self, true);
  12342. var p = self.option, current = self.getCurrentLine(self);
  12343. if (current) {
  12344. if (!p.multiple) {
  12345. self.elem.combo_input.val(current.text());
  12346. self.elem.hidden.val(current.attr('pkey'));
  12347. } else {
  12348. //build tags in multiple selection mode
  12349. self.elem.combo_input.val('');
  12350. var item = {text: current.text(), value: current.attr('pkey')};
  12351. if (!self.isAlreadySelected(self, item)) {
  12352. self.addNewTag(self, item);
  12353. self.tagValuesSet(self);
  12354. }
  12355. }
  12356. if (p.selectOnly)
  12357. self.setButtonAttrDefault();
  12358. //Select item callback
  12359. if (p.eSelect && $.isFunction(p.eSelect))
  12360. p.eSelect(current.data('dataObj'), self);
  12361. self.prop.prev_value = self.elem.combo_input.val();
  12362. self.prop.selected_text = self.elem.combo_input.val();
  12363. self.putClearButton();
  12364. }
  12365. self.afterAction(self);
  12366. };
  12367. /**
  12368. * Show clear button when item selected in single selection mode
  12369. */
  12370. SelectPage.prototype.putClearButton = function () {
  12371. if (!this.option.multiple && !this.elem.combo_input.prop('disabled'))
  12372. this.elem.container.append(this.elem.clear_btn);
  12373. };
  12374. /**
  12375. * Select all list item
  12376. * @param {Object} self
  12377. */
  12378. SelectPage.prototype.selectAllLine = function (self) {
  12379. var p = self.option, jsonarr = new Array();
  12380. self.elem.results.find('li').each(function (i, row) {
  12381. var $row = $(row);
  12382. var item = {text: $row.text(), value: $row.attr('pkey')};
  12383. if (!self.isAlreadySelected(self, item)) {
  12384. self.addNewTag(self, item);
  12385. self.tagValuesSet(self);
  12386. }
  12387. jsonarr.push($row.data('dataObj'));
  12388. //limited max selected items
  12389. if ($.type(p.maxSelectLimit) === 'number' &&
  12390. p.maxSelectLimit > 0 &&
  12391. p.maxSelectLimit === self.elem.element_box.find('li.selected_tag').size()) {
  12392. return false;
  12393. }
  12394. });
  12395. if (p.eSelect && $.isFunction(p.eSelect))
  12396. p.eSelect(jsonarr, self);
  12397. self.afterAction(self);
  12398. };
  12399. /**
  12400. * Cancel select all item in current page
  12401. * @param {Object} self
  12402. */
  12403. SelectPage.prototype.unSelectAllLine = function (self) {
  12404. var p = self.option, size = self.elem.results.find('li').size();
  12405. self.elem.results.find('li').each(function (i, row) {
  12406. var key = $(row).attr('pkey');
  12407. var tag = self.elem.element_box.find('li.selected_tag[itemvalue="' + key + '"]');
  12408. self.removeTag(self, tag);
  12409. });
  12410. self.afterAction(self);
  12411. if (p.eTagRemove && $.isFunction(p.eTagRemove))
  12412. p.eTagRemove(size, self);
  12413. };
  12414. /**
  12415. * Clear all selected items
  12416. * @param {Object} self
  12417. */
  12418. SelectPage.prototype.clearAll = function (self) {
  12419. var p = self.option, size = 0;
  12420. if (p.multiple) {
  12421. size = self.elem.element_box.find('li.selected_tag').size();
  12422. self.elem.element_box.find('li.selected_tag').remove();
  12423. }
  12424. self.reset(self);
  12425. self.afterAction(self);
  12426. if (!p.multiple)
  12427. self.elem.clear_btn.remove();
  12428. if (p.multiple) {
  12429. if (p.eTagRemove && $.isFunction(p.eTagRemove))
  12430. p.eTagRemove(size, self);
  12431. }
  12432. };
  12433. /**
  12434. * reset
  12435. */
  12436. SelectPage.prototype.reset = function (self) {
  12437. self.elem.combo_input.val('');
  12438. self.elem.hidden.val('');
  12439. self.prop.prev_value = '';
  12440. self.prop.selected_text = '';
  12441. self.prop.current_page = 1;
  12442. };
  12443. /**
  12444. * Get current highlight item
  12445. * @param {Object} self
  12446. */
  12447. SelectPage.prototype.getCurrentLine = function (self) {
  12448. if (self.elem.result_area.is(':hidden'))
  12449. return false;
  12450. var obj = self.elem.results.find('li.' + self.css_class.select);
  12451. if (obj.size())
  12452. return obj;
  12453. else
  12454. return false;
  12455. };
  12456. /**
  12457. * Check the result item is already selected or not
  12458. * @param {Object} self
  12459. * @param {Object} item - item info
  12460. */
  12461. SelectPage.prototype.isAlreadySelected = function (self, item) {
  12462. var isExist = false;
  12463. if (item.value) {
  12464. var keys = self.elem.hidden.val();
  12465. if (keys) {
  12466. var karr = keys.split(',');
  12467. if (karr && karr.length && $.inArray(item.value, karr) != -1)
  12468. isExist = true;
  12469. }
  12470. }
  12471. return isExist;
  12472. };
  12473. /**
  12474. * Add a new tag in multiple selection mode
  12475. * @param {Object} self
  12476. * @param {Object} item
  12477. */
  12478. SelectPage.prototype.addNewTag = function (self, item) {
  12479. if (!self.option.multiple || !item)
  12480. return;
  12481. var tmp = self.template.tag.content, tag;
  12482. tmp = tmp.replace(self.template.tag.textKey, item.text);
  12483. tmp = tmp.replace(self.template.tag.valueKey, item.value);
  12484. tag = $(tmp);
  12485. if (self.elem.combo_input.prop('disabled'))
  12486. tag.find('span.tag_close').hide();
  12487. self.elem.combo_input.closest('li').before(tag);
  12488. };
  12489. /**
  12490. * Remove a tag in multiple selection mode
  12491. * @param {Object} self
  12492. * @param {Object} item
  12493. */
  12494. SelectPage.prototype.removeTag = function (self, item) {
  12495. var key = $(item).attr('itemvalue');
  12496. var keys = self.elem.hidden.val();
  12497. if ($.type(key) != 'undefined' && keys) {
  12498. var keyarr = keys.split(','),
  12499. index = $.inArray(key.toString(), keyarr);
  12500. if (index != -1) {
  12501. keyarr.splice(index, 1);
  12502. self.elem.hidden.val(keyarr.toString());
  12503. }
  12504. }
  12505. $(item).remove();
  12506. self.afterAction(self);
  12507. };
  12508. /**
  12509. * Selected item value(keyField) put in to hidden element
  12510. * @param {Object} self
  12511. */
  12512. SelectPage.prototype.tagValuesSet = function (self) {
  12513. if (!self.option.multiple)
  12514. return;
  12515. var tags = self.elem.element_box.find('li.selected_tag');
  12516. if (tags && tags.size()) {
  12517. var result = new Array();
  12518. $.each(tags, function (i, li) {
  12519. var v = $(li).attr('itemvalue');
  12520. if ($.type(v) !== 'undefined')
  12521. result.push(v);
  12522. });
  12523. if (result.length) {
  12524. self.elem.hidden.val(result.join(','));
  12525. }
  12526. }
  12527. };
  12528. /**
  12529. * auto resize input element width in multiple select mode
  12530. * @param {Object} self
  12531. */
  12532. SelectPage.prototype.inputResize = function (self) {
  12533. if (!self.option.multiple)
  12534. return;
  12535. var width = '',
  12536. inputLi = self.elem.combo_input.closest('li');
  12537. var setDefaultSize = function (self, inputLi) {
  12538. inputLi.removeClass('full_width');
  12539. var minimumWidth = self.elem.combo_input.val().length + 1,
  12540. width = (minimumWidth * 0.75) + 'em';
  12541. self.elem.combo_input.css('width', width).removeAttr('placeholder');
  12542. };
  12543. if (self.elem.element_box.find('li.selected_tag').size() === 0) {
  12544. if (self.elem.combo_input.attr('placeholder_bak')) {
  12545. if (!inputLi.hasClass('full_width'))
  12546. inputLi.addClass('full_width');
  12547. self.elem.combo_input.attr('placeholder', self.elem.combo_input.attr('placeholder_bak')).removeAttr('style');
  12548. } else
  12549. setDefaultSize(self, inputLi);
  12550. } else
  12551. setDefaultSize(self, inputLi);
  12552. };
  12553. /**
  12554. * Move to next line
  12555. * @param {Object} self
  12556. */
  12557. SelectPage.prototype.nextLine = function (self) {
  12558. var obj = self.getCurrentLine(self), idx;
  12559. if (!obj)
  12560. idx = -1;
  12561. else {
  12562. idx = self.elem.results.children('li').index(obj);
  12563. obj.removeClass(self.css_class.select);
  12564. }
  12565. idx++;
  12566. if (idx < self.elem.results.children('li').length) {
  12567. var next = self.elem.results.children('li').eq(idx);
  12568. next.addClass(self.css_class.select);
  12569. self.setCssFocusedResults(self);
  12570. } else
  12571. self.setCssFocusedInput(self);
  12572. self.scrollWindow(self, false);
  12573. };
  12574. /**
  12575. * Move to previous line
  12576. * @param {Object} self
  12577. */
  12578. SelectPage.prototype.prevLine = function (self) {
  12579. var obj = self.getCurrentLine(self), idx;
  12580. if (!obj)
  12581. idx = self.elem.results.children('li').length;
  12582. else {
  12583. idx = self.elem.results.children('li').index(obj);
  12584. obj.removeClass(self.css_class.select);
  12585. }
  12586. idx--;
  12587. if (idx > -1) {
  12588. var prev = self.elem.results.children('li').eq(idx);
  12589. prev.addClass(self.css_class.select);
  12590. self.setCssFocusedResults(self);
  12591. } else
  12592. self.setCssFocusedInput(self);
  12593. self.scrollWindow(self, false);
  12594. };
  12595. /**
  12596. * SelectPage plugin definition
  12597. * @global
  12598. * @param option {Object} init plugin option
  12599. */
  12600. function Plugin(option) {
  12601. return this.each(function () {
  12602. var $this = $(this),
  12603. data = $this.data(SelectPage.dataKey),
  12604. params = $.extend({}, defaults, $this.data(), data && data.option, typeof option === 'object' && option);
  12605. if (!data)
  12606. $this.data(SelectPage.dataKey, (data = new SelectPage(this, params)));
  12607. });
  12608. }
  12609. /**
  12610. * Get plugin object
  12611. * @param {object} obj
  12612. * @returns
  12613. */
  12614. function getPlugin(obj) {
  12615. return $(obj).closest('div.sp_container').find('input.sp_input');
  12616. }
  12617. /**
  12618. * Clear all selected item
  12619. */
  12620. function ClearSelected() {
  12621. return this.each(function () {
  12622. var $this = getPlugin(this),
  12623. data = $this.data(SelectPage.dataKey);
  12624. if (data) {
  12625. data.prop.init_set = true;
  12626. data.clearAll(data);
  12627. data.prop.init_set = false;
  12628. }
  12629. });
  12630. }
  12631. /**
  12632. * Refresh result list
  12633. * use case:
  12634. * 1.use $(obj).val('xxx') to modify selectpage selected item key
  12635. * 2.refresh selected item show content/tag text
  12636. */
  12637. function SelectedRefresh() {
  12638. return this.each(function () {
  12639. var $this = getPlugin(this),
  12640. data = $this.data(SelectPage.dataKey);
  12641. if (data && data.elem.hidden.val())
  12642. data.setInitRecord(true);
  12643. });
  12644. }
  12645. /**
  12646. * Modify plugin datasource, only work on json datasource mode
  12647. * @param {array} data - new datasource
  12648. * @example
  12649. * [{name:'aa',sex:1},{name:'bb',sex:0},{...}]
  12650. */
  12651. function ModifyDataSource(data) {
  12652. return this.each(function () {
  12653. if (data && $.isArray(data)) {
  12654. var $this = getPlugin(this),
  12655. plugin = $this.data(SelectPage.dataKey);
  12656. if (plugin) {
  12657. plugin.clearAll(plugin);
  12658. plugin.option.data = data;
  12659. }
  12660. }
  12661. });
  12662. }
  12663. /**
  12664. * Get plugin disabled status or Modify plugin disabled status
  12665. * @param disabled {boolean} set disabled status
  12666. */
  12667. function PluginDisabled(disabled) {
  12668. var status = false;
  12669. this.each(function () {
  12670. var $this = getPlugin(this),
  12671. plugin = $this.data(SelectPage.dataKey);
  12672. if (plugin) {
  12673. if ($.type(disabled) !== 'undefined')
  12674. plugin.disabled(plugin, disabled);
  12675. else
  12676. status = plugin.disabled(plugin);
  12677. }
  12678. });
  12679. return status;
  12680. }
  12681. /**
  12682. * Get selected item text
  12683. * @returns {string}
  12684. */
  12685. function GetInputText() {
  12686. var str = '';
  12687. this.each(function () {
  12688. var $this = getPlugin(this), data = $this.data(SelectPage.dataKey);
  12689. if (data) {
  12690. if (data.option.multiple) {
  12691. var tags = [];
  12692. data.elem.element_box.find('li.selected_tag').each(function (i, tag) {
  12693. tags.push($(tag).text());
  12694. });
  12695. str += tags.toString();
  12696. } else {
  12697. str += data.elem.combo_input.val();
  12698. }
  12699. }
  12700. });
  12701. return str;
  12702. }
  12703. var old = $.fn.selectPage;
  12704. $.fn.selectPage = Plugin;
  12705. $.fn.selectPage.Constructor = SelectPage;
  12706. $.fn.selectPageClear = ClearSelected;
  12707. $.fn.selectPageRefresh = SelectedRefresh;
  12708. $.fn.selectPageData = ModifyDataSource;
  12709. $.fn.selectPageDisabled = PluginDisabled;
  12710. $.fn.selectPageText = GetInputText;
  12711. // SelectPage no conflict
  12712. // =================
  12713. $.fn.selectPage.noConflict = function () {
  12714. $.fn.selectPage = old;
  12715. return this;
  12716. };
  12717. })(window.jQuery);
  12718. define("selectpage", function(){});