require-backend.min.js 844 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515
  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', '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-select': '../libs/bootstrap-select/dist/js/bootstrap-select.min',
  42. 'bootstrap-select-lang': '../libs/bootstrap-select/dist/js/i18n/defaults-zh_CN',
  43. 'bootstrap-table': '../libs/bootstrap-table/dist/bootstrap-table.min',
  44. 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
  45. 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
  46. 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
  47. 'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',
  48. 'dragsort': '../libs/dragsort/jquery.dragsort',
  49. 'qrcode': '../libs/jquery-qrcode/jquery.qrcode.min',
  50. 'sortable': '../libs/Sortable/Sortable.min',
  51. 'addtabs': '../libs/jquery-addtabs/jquery.addtabs',
  52. 'slimscroll': '../libs/jquery-slimscroll/jquery.slimscroll',
  53. 'summernote': '../libs/summernote/dist/lang/summernote-zh-CN.min',
  54. 'validator-core': '../libs/nice-validator/dist/jquery.validator',
  55. 'validator-lang': '../libs/nice-validator/dist/local/zh-CN',
  56. 'plupload': '../libs/plupload/js/plupload.min',
  57. 'toastr': '../libs/toastr/toastr',
  58. 'jstree': '../libs/jstree/dist/jstree.min',
  59. 'layer': '../libs/layer/src/layer',
  60. 'cookie': '../libs/jquery.cookie/jquery.cookie',
  61. 'cxselect': '../libs/jquery-cxselect/js/jquery.cxselect',
  62. 'template': '../libs/art-template/dist/template-native',
  63. 'selectpage': '../libs/selectpage/selectpage',
  64. 'citypicker': '../libs/city-picker/dist/js/city-picker.min',
  65. 'citypicker-data': '../libs/city-picker/dist/js/city-picker.data',
  66. },
  67. // shim依赖配置
  68. shim: {
  69. 'addons': ['backend'],
  70. 'bootstrap': ['jquery'],
  71. 'bootstrap-table': {
  72. deps: [
  73. 'bootstrap',
  74. // 'css!../libs/bootstrap-table/dist/bootstrap-table.min.css'
  75. ],
  76. exports: '$.fn.bootstrapTable'
  77. },
  78. 'bootstrap-table-lang': {
  79. deps: ['bootstrap-table'],
  80. exports: '$.fn.bootstrapTable.defaults'
  81. },
  82. 'bootstrap-table-export': {
  83. deps: ['bootstrap-table', 'tableexport'],
  84. exports: '$.fn.bootstrapTable.defaults'
  85. },
  86. 'bootstrap-table-mobile': {
  87. deps: ['bootstrap-table'],
  88. exports: '$.fn.bootstrapTable.defaults'
  89. },
  90. 'bootstrap-table-advancedsearch': {
  91. deps: ['bootstrap-table'],
  92. exports: '$.fn.bootstrapTable.defaults'
  93. },
  94. 'bootstrap-table-commonsearch': {
  95. deps: ['bootstrap-table'],
  96. exports: '$.fn.bootstrapTable.defaults'
  97. },
  98. 'bootstrap-table-template': {
  99. deps: ['bootstrap-table', 'template'],
  100. exports: '$.fn.bootstrapTable.defaults'
  101. },
  102. 'tableexport': {
  103. deps: ['jquery'],
  104. exports: '$.fn.extend'
  105. },
  106. 'slimscroll': {
  107. deps: ['jquery'],
  108. exports: '$.fn.extend'
  109. },
  110. 'adminlte': {
  111. deps: ['bootstrap', 'slimscroll'],
  112. exports: '$.AdminLTE'
  113. },
  114. 'bootstrap-datetimepicker': [
  115. 'moment/locale/zh-cn',
  116. // 'css!../libs/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css',
  117. ],
  118. 'bootstrap-select': ['css!../libs/bootstrap-select/dist/css/bootstrap-select.min.css', ],
  119. 'bootstrap-select-lang': ['bootstrap-select'],
  120. 'summernote': ['../libs/summernote/dist/summernote.min', 'css!../libs/summernote/dist/summernote.css'],
  121. // 'toastr': ['css!../libs/toastr/toastr.min.css'],
  122. 'jstree': ['css!../libs/jstree/dist/themes/default/style.css', ],
  123. 'plupload': {
  124. deps: ['../libs/plupload/js/moxie.min'],
  125. exports: "plupload"
  126. },
  127. // 'layer': ['css!../libs/layer/build/skin/default/layer.css'],
  128. // 'validator-core': ['css!../libs/nice-validator/dist/jquery.validator.css'],
  129. 'validator-lang': ['validator-core'],
  130. // 'selectpage': ['css!../libs/selectpage/selectpage.css'],
  131. 'citypicker': ['citypicker-data', 'css!../libs/city-picker/dist/css/city-picker.css']
  132. },
  133. baseUrl: requirejs.s.contexts._.config.config.site.cdnurl + '/assets/js/', //资源基础路径
  134. map: {
  135. '*': {
  136. 'css': '../libs/require-css/css.min'
  137. }
  138. },
  139. waitSeconds: 30,
  140. charset: 'utf-8' // 文件编码
  141. });
  142. require(['jquery', 'bootstrap'], function ($, undefined) {
  143. //初始配置
  144. var Config = requirejs.s.contexts._.config.config;
  145. //将Config渲染到全局
  146. window.Config = Config;
  147. // 配置语言包的路径
  148. var paths = {};
  149. paths['lang'] = Config.moduleurl + '/ajax/lang?callback=define&controllername=' + Config.controllername;
  150. // 避免目录冲突
  151. paths['backend/'] = 'backend/';
  152. require.config({paths: paths});
  153. // 初始化
  154. $(function () {
  155. require(['fast'], function (Fast) {
  156. require(['backend', 'addons'], function (Backend, Addons) {
  157. //加载相应模块
  158. if (Config.jsname) {
  159. require([Config.jsname], function (Controller) {
  160. Controller[Config.actionname] != undefined && Controller[Config.actionname]();
  161. }, function (e) {
  162. console.error(e);
  163. // 这里可捕获模块加载的错误
  164. });
  165. }
  166. });
  167. });
  168. });
  169. });
  170. define("require-backend", function(){});
  171. 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});
  172. /**
  173. @Name:layer v3.0.3 Web弹层组件
  174. @Author:贤心
  175. @Site:http://layer.layui.com
  176. @License:MIT
  177. */
  178. ;!function(window, undefined){
  179. "use strict";
  180. var isLayui = window.layui && layui.define, $, win, ready = {
  181. getPath: function(){
  182. var js = document.scripts, script = js[js.length - 1], jsPath = script.src;
  183. if(script.getAttribute('merge')) return;
  184. return jsPath.substring(0, jsPath.lastIndexOf("/") + 1);
  185. }(),
  186. config: {}, end: {}, minIndex: 0, minLeft: [],
  187. btn: ['&#x786E;&#x5B9A;', '&#x53D6;&#x6D88;'],
  188. //五种原始层模式
  189. type: ['dialog', 'page', 'iframe', 'loading', 'tips']
  190. };
  191. //默认内置方法。
  192. var layer = {
  193. v: '3.0.3',
  194. ie: function(){ //ie版本
  195. var agent = navigator.userAgent.toLowerCase();
  196. return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
  197. (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识
  198. ) : false;
  199. }(),
  200. index: (window.layer && window.layer.v) ? 100000 : 0,
  201. path: ready.getPath,
  202. config: function(options, fn){
  203. options = options || {};
  204. layer.cache = ready.config = $.extend({}, ready.config, options);
  205. layer.path = ready.config.path || layer.path;
  206. typeof options.extend === 'string' && (options.extend = [options.extend]);
  207. if(ready.config.path) layer.ready();
  208. if(!options.extend) return this;
  209. isLayui
  210. ? layui.addcss('modules/layer/' + options.extend)
  211. : layer.link('skin/' + options.extend);
  212. return this;
  213. },
  214. //载入CSS配件
  215. link: function(href, fn, cssname){
  216. //未设置路径,则不主动加载css
  217. if(!layer.path) return;
  218. var head = $('head')[0], link = document.createElement('link');
  219. if(typeof fn === 'string') cssname = fn;
  220. var app = (cssname || href).replace(/\.|\//g, '');
  221. var id = 'layuicss-'+app, timeout = 0;
  222. link.rel = 'stylesheet';
  223. link.href = layer.path + href;
  224. link.id = id;
  225. if(!$('#'+ id)[0]){
  226. head.appendChild(link);
  227. }
  228. if(typeof fn !== 'function') return;
  229. //轮询css是否加载完毕
  230. (function poll() {
  231. if(++timeout > 8 * 1000 / 100){
  232. return window.console && console.error('layer.css: Invalid');
  233. };
  234. parseInt($('#'+id).css('width')) === 1989 ? fn() : setTimeout(poll, 100);
  235. }());
  236. },
  237. ready: function(callback){
  238. var cssname = 'skinlayercss', ver = '303';
  239. isLayui ? layui.addcss('modules/layer/default/layer.css?v='+layer.v+ver, callback, cssname)
  240. : layer.link('skin/default/layer.css?v='+layer.v+ver, callback, cssname);
  241. return this;
  242. },
  243. //各种快捷引用
  244. alert: function(content, options, yes){
  245. var type = typeof options === 'function';
  246. if(type) yes = options;
  247. return layer.open($.extend({
  248. content: content,
  249. yes: yes
  250. }, type ? {} : options));
  251. },
  252. confirm: function(content, options, yes, cancel){
  253. var type = typeof options === 'function';
  254. if(type){
  255. cancel = yes;
  256. yes = options;
  257. }
  258. return layer.open($.extend({
  259. content: content,
  260. btn: ready.btn,
  261. yes: yes,
  262. btn2: cancel
  263. }, type ? {} : options));
  264. },
  265. msg: function(content, options, end){ //最常用提示层
  266. var type = typeof options === 'function', rskin = ready.config.skin;
  267. var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg';
  268. var anim = doms.anim.length - 1;
  269. if(type) end = options;
  270. return layer.open($.extend({
  271. content: content,
  272. time: 3000,
  273. shade: false,
  274. skin: skin,
  275. title: false,
  276. closeBtn: false,
  277. btn: false,
  278. resize: false,
  279. end: end
  280. }, (type && !ready.config.skin) ? {
  281. skin: skin + ' layui-layer-hui',
  282. anim: anim
  283. } : function(){
  284. options = options || {};
  285. if(options.icon === -1 || options.icon === undefined && !ready.config.skin){
  286. options.skin = skin + ' ' + (options.skin||'layui-layer-hui');
  287. }
  288. return options;
  289. }()));
  290. },
  291. load: function(icon, options){
  292. return layer.open($.extend({
  293. type: 3,
  294. icon: icon || 0,
  295. resize: false,
  296. shade: 0.01
  297. }, options));
  298. },
  299. tips: function(content, follow, options){
  300. return layer.open($.extend({
  301. type: 4,
  302. content: [content, follow],
  303. closeBtn: false,
  304. time: 3000,
  305. shade: false,
  306. resize: false,
  307. fixed: false,
  308. maxWidth: 210
  309. }, options));
  310. }
  311. };
  312. var Class = function(setings){
  313. var that = this;
  314. that.index = ++layer.index;
  315. that.config = $.extend({}, that.config, ready.config, setings);
  316. document.body ? that.creat() : setTimeout(function(){
  317. that.creat();
  318. }, 30);
  319. };
  320. Class.pt = Class.prototype;
  321. //缓存常用字符
  322. var doms = ['layui-layer', '.layui-layer-title', '.layui-layer-main', '.layui-layer-dialog', 'layui-layer-iframe', 'layui-layer-content', 'layui-layer-btn', 'layui-layer-close'];
  323. doms.anim = ['layer-anim', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'layer-anim-04', 'layer-anim-05', 'layer-anim-06'];
  324. //默认配置
  325. Class.pt.config = {
  326. type: 0,
  327. shade: 0.3,
  328. fixed: true,
  329. move: doms[1],
  330. title: '&#x4FE1;&#x606F;',
  331. offset: 'auto',
  332. area: 'auto',
  333. closeBtn: 1,
  334. time: 0, //0表示不自动关闭
  335. zIndex: 19891014,
  336. maxWidth: 360,
  337. anim: 0,
  338. isOutAnim: true,
  339. icon: -1,
  340. moveType: 1,
  341. resize: true,
  342. scrollbar: true, //是否允许浏览器滚动条
  343. tips: 2
  344. };
  345. //容器
  346. Class.pt.vessel = function(conType, callback){
  347. var that = this, times = that.index, config = that.config;
  348. var zIndex = config.zIndex + times, titype = typeof config.title === 'object';
  349. var ismax = config.maxmin && (config.type === 1 || config.type === 2);
  350. var titleHTML = (config.title ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">'
  351. + (titype ? config.title[0] : config.title)
  352. + '</div>' : '');
  353. config.zIndex = zIndex;
  354. callback([
  355. //遮罩
  356. config.shade ? ('<div class="layui-layer-shade" id="layui-layer-shade'+ times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; background-color:'+ (config.shade[1]||'#000') +'; opacity:'+ (config.shade[0]||config.shade) +'; filter:alpha(opacity='+ (config.shade[0]*100||config.shade*100) +');') +'"></div>') : '',
  357. //主体
  358. '<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + (config.fixed ? '' : ';position:absolute;') +'">'
  359. + (conType && config.type != 2 ? '' : titleHTML)
  360. + '<div id="'+ (config.id||'') +'" class="layui-layer-content'+ ((config.type == 0 && config.icon !== -1) ? ' layui-layer-padding' :'') + (config.type == 3 ? ' layui-layer-loading'+config.icon : '') +'">'
  361. + (config.type == 0 && config.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico'+ config.icon +'"></i>' : '')
  362. + (config.type == 1 && conType ? '' : (config.content||''))
  363. + '</div>'
  364. + '<span class="layui-layer-setwin">'+ function(){
  365. var closebtn = ismax ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : '';
  366. config.closeBtn && (closebtn += '<a class="layui-layer-ico '+ doms[7] +' '+ doms[7] + (config.title ? config.closeBtn : (config.type == 4 ? '1' : '2')) +'" href="javascript:;"></a>');
  367. return closebtn;
  368. }() + '</span>'
  369. + (config.btn ? function(){
  370. var button = '';
  371. typeof config.btn === 'string' && (config.btn = [config.btn]);
  372. for(var i = 0, len = config.btn.length; i < len; i++){
  373. button += '<a class="'+ doms[6] +''+ i +'">'+ config.btn[i] +'</a>'
  374. }
  375. return '<div class="'+ doms[6] +' layui-layer-btn-'+ (config.btnAlign||'') +'">'+ button +'</div>'
  376. }() : '')
  377. + (config.resize ? '<span class="layui-layer-resize"></span>' : '')
  378. + '</div>'
  379. ], titleHTML, $('<div class="layui-layer-move"></div>'));
  380. return that;
  381. };
  382. //创建骨架
  383. Class.pt.creat = function(){
  384. var that = this
  385. ,config = that.config
  386. ,times = that.index, nodeIndex
  387. ,content = config.content
  388. ,conType = typeof content === 'object'
  389. ,body = $('body');
  390. if(config.id && $('#'+config.id)[0]) return;
  391. if(typeof config.area === 'string'){
  392. config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];
  393. }
  394. //anim兼容旧版shift
  395. if(config.shift){
  396. config.anim = config.shift;
  397. }
  398. if(layer.ie == 6){
  399. config.fixed = false;
  400. }
  401. switch(config.type){
  402. case 0:
  403. config.btn = ('btn' in config) ? config.btn : ready.btn[0];
  404. layer.closeAll('dialog');
  405. break;
  406. case 2:
  407. var content = config.content = conType ? config.content : [config.content||'http://layer.layui.com', 'auto'];
  408. config.content = '<iframe scrolling="'+ (config.content[1]||'auto') +'" allowtransparency="true" id="'+ doms[4] +''+ times +'" name="'+ doms[4] +''+ times +'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' + config.content[0] + '"></iframe>';
  409. break;
  410. case 3:
  411. delete config.title;
  412. delete config.closeBtn;
  413. config.icon === -1 && (config.icon === 0);
  414. layer.closeAll('loading');
  415. break;
  416. case 4:
  417. conType || (config.content = [config.content, 'body']);
  418. config.follow = config.content[1];
  419. config.content = config.content[0] + '<i class="layui-layer-TipsG"></i>';
  420. delete config.title;
  421. config.tips = typeof config.tips === 'object' ? config.tips : [config.tips, true];
  422. config.tipsMore || layer.closeAll('tips');
  423. break;
  424. }
  425. //建立容器
  426. that.vessel(conType, function(html, titleHTML, moveElem){
  427. body.append(html[0]);
  428. conType ? function(){
  429. (config.type == 2 || config.type == 4) ? function(){
  430. $('body').append(html[1]);
  431. }() : function(){
  432. if(!content.parents('.'+doms[0])[0]){
  433. content.data('display', content.css('display')).show().addClass('layui-layer-wrap').wrap(html[1]);
  434. $('#'+ doms[0] + times).find('.'+doms[5]).before(titleHTML);
  435. }
  436. }();
  437. }() : body.append(html[1]);
  438. $('.layui-layer-move')[0] || body.append(ready.moveElem = moveElem);
  439. that.layero = $('#'+ doms[0] + times);
  440. config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times);
  441. }).auto(times);
  442. config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]);
  443. //坐标自适应浏览器窗口尺寸
  444. config.type == 4 ? that.tips() : that.offset();
  445. if(config.fixed){
  446. win.on('resize', function(){
  447. that.offset();
  448. (/^\d+%$/.test(config.area[0]) || /^\d+%$/.test(config.area[1])) && that.auto(times);
  449. config.type == 4 && that.tips();
  450. });
  451. }
  452. config.time <= 0 || setTimeout(function(){
  453. layer.close(that.index)
  454. }, config.time);
  455. that.move().callback();
  456. //为兼容jQuery3.0的css动画影响元素尺寸计算
  457. if(doms.anim[config.anim]){
  458. that.layero.addClass(doms.anim[config.anim]);
  459. };
  460. //记录关闭动画
  461. if(config.isOutAnim){
  462. that.layero.data('isOutAnim', true);
  463. }
  464. };
  465. //自适应
  466. Class.pt.auto = function(index){
  467. var that = this, config = that.config, layero = $('#'+ doms[0] + index);
  468. if(config.area[0] === '' && config.maxWidth > 0){
  469. //为了修复IE7下一个让人难以理解的bug
  470. if(layer.ie && layer.ie < 8 && config.btn){
  471. layero.width(layero.innerWidth());
  472. }
  473. layero.outerWidth() > config.maxWidth && layero.width(config.maxWidth);
  474. }
  475. var area = [layero.innerWidth(), layero.innerHeight()];
  476. var titHeight = layero.find(doms[1]).outerHeight() || 0;
  477. var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
  478. function setHeight(elem){
  479. elem = layero.find(elem);
  480. elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding-top'))|0));
  481. }
  482. switch(config.type){
  483. case 2:
  484. setHeight('iframe');
  485. break;
  486. default:
  487. if(config.area[1] === ''){
  488. if(config.fixed && area[1] >= win.height()){
  489. area[1] = win.height();
  490. setHeight('.'+doms[5]);
  491. }
  492. } else {
  493. setHeight('.'+doms[5]);
  494. }
  495. break;
  496. }
  497. return that;
  498. };
  499. //计算坐标
  500. Class.pt.offset = function(){
  501. var that = this, config = that.config, layero = that.layero;
  502. var area = [layero.outerWidth(), layero.outerHeight()];
  503. var type = typeof config.offset === 'object';
  504. that.offsetTop = (win.height() - area[1])/2;
  505. that.offsetLeft = (win.width() - area[0])/2;
  506. if(type){
  507. that.offsetTop = config.offset[0];
  508. that.offsetLeft = config.offset[1]||that.offsetLeft;
  509. } else if(config.offset !== 'auto'){
  510. if(config.offset === 't'){ //上
  511. that.offsetTop = 0;
  512. } else if(config.offset === 'r'){ //右
  513. that.offsetLeft = win.width() - area[0];
  514. } else if(config.offset === 'b'){ //下
  515. that.offsetTop = win.height() - area[1];
  516. } else if(config.offset === 'l'){ //左
  517. that.offsetLeft = 0;
  518. } else if(config.offset === 'lt'){ //左上角
  519. that.offsetTop = 0;
  520. that.offsetLeft = 0;
  521. } else if(config.offset === 'lb'){ //左下角
  522. that.offsetTop = win.height() - area[1];
  523. that.offsetLeft = 0;
  524. } else if(config.offset === 'rt'){ //右上角
  525. that.offsetTop = 0;
  526. that.offsetLeft = win.width() - area[0];
  527. } else if(config.offset === 'rb'){ //右下角
  528. that.offsetTop = win.height() - area[1];
  529. that.offsetLeft = win.width() - area[0];
  530. } else {
  531. that.offsetTop = config.offset;
  532. }
  533. }
  534. if(!config.fixed){
  535. that.offsetTop = /%$/.test(that.offsetTop) ?
  536. win.height()*parseFloat(that.offsetTop)/100
  537. : parseFloat(that.offsetTop);
  538. that.offsetLeft = /%$/.test(that.offsetLeft) ?
  539. win.width()*parseFloat(that.offsetLeft)/100
  540. : parseFloat(that.offsetLeft);
  541. that.offsetTop += win.scrollTop();
  542. that.offsetLeft += win.scrollLeft();
  543. }
  544. if(layero.attr('minLeft')){
  545. that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0);
  546. that.offsetLeft = layero.css('left');
  547. }
  548. layero.css({top: that.offsetTop, left: that.offsetLeft});
  549. };
  550. //Tips
  551. Class.pt.tips = function(){
  552. var that = this, config = that.config, layero = that.layero;
  553. var layArea = [layero.outerWidth(), layero.outerHeight()], follow = $(config.follow);
  554. if(!follow[0]) follow = $('body');
  555. var goal = {
  556. width: follow.outerWidth(),
  557. height: follow.outerHeight(),
  558. top: follow.offset().top,
  559. left: follow.offset().left
  560. }, tipsG = layero.find('.layui-layer-TipsG');
  561. var guide = config.tips[0];
  562. config.tips[1] || tipsG.remove();
  563. goal.autoLeft = function(){
  564. if(goal.left + layArea[0] - win.width() > 0){
  565. goal.tipLeft = goal.left + goal.width - layArea[0];
  566. tipsG.css({right: 12, left: 'auto'});
  567. } else {
  568. goal.tipLeft = goal.left;
  569. };
  570. };
  571. //辨别tips的方位
  572. goal.where = [function(){ //上
  573. goal.autoLeft();
  574. goal.tipTop = goal.top - layArea[1] - 10;
  575. tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]);
  576. }, function(){ //右
  577. goal.tipLeft = goal.left + goal.width + 10;
  578. goal.tipTop = goal.top;
  579. tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]);
  580. }, function(){ //下
  581. goal.autoLeft();
  582. goal.tipTop = goal.top + goal.height + 10;
  583. tipsG.removeClass('layui-layer-TipsT').addClass('layui-layer-TipsB').css('border-right-color', config.tips[1]);
  584. }, function(){ //左
  585. goal.tipLeft = goal.left - layArea[0] - 10;
  586. goal.tipTop = goal.top;
  587. tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]);
  588. }];
  589. goal.where[guide-1]();
  590. /* 8*2为小三角形占据的空间 */
  591. if(guide === 1){
  592. goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2]();
  593. } else if(guide === 2){
  594. win.width() - (goal.left + goal.width + layArea[0] + 8*2) > 0 || goal.where[3]()
  595. } else if(guide === 3){
  596. (goal.top - win.scrollTop() + goal.height + layArea[1] + 8*2) - win.height() > 0 && goal.where[0]();
  597. } else if(guide === 4){
  598. layArea[0] + 8*2 - goal.left > 0 && goal.where[1]()
  599. }
  600. layero.find('.'+doms[5]).css({
  601. 'background-color': config.tips[1],
  602. 'padding-right': (config.closeBtn ? '30px' : '')
  603. });
  604. layero.css({
  605. left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0),
  606. top: goal.tipTop - (config.fixed ? win.scrollTop() : 0)
  607. });
  608. }
  609. //拖拽层
  610. Class.pt.move = function(){
  611. var that = this
  612. ,config = that.config
  613. ,_DOC = $(document)
  614. ,layero = that.layero
  615. ,moveElem = layero.find(config.move)
  616. ,resizeElem = layero.find('.layui-layer-resize')
  617. ,dict = {};
  618. if(config.move){
  619. moveElem.css('cursor', 'move');
  620. }
  621. moveElem.on('mousedown', function(e){
  622. e.preventDefault();
  623. if(config.move){
  624. dict.moveStart = true;
  625. dict.offset = [
  626. e.clientX - parseFloat(layero.css('left'))
  627. ,e.clientY - parseFloat(layero.css('top'))
  628. ];
  629. ready.moveElem.css('cursor', 'move').show();
  630. }
  631. });
  632. resizeElem.on('mousedown', function(e){
  633. e.preventDefault();
  634. dict.resizeStart = true;
  635. dict.offset = [e.clientX, e.clientY];
  636. dict.area = [
  637. layero.outerWidth()
  638. ,layero.outerHeight()
  639. ];
  640. ready.moveElem.css('cursor', 'se-resize').show();
  641. });
  642. _DOC.on('mousemove', function(e){
  643. //拖拽移动
  644. if(dict.moveStart){
  645. var X = e.clientX - dict.offset[0]
  646. ,Y = e.clientY - dict.offset[1]
  647. ,fixed = layero.css('position') === 'fixed';
  648. e.preventDefault();
  649. dict.stX = fixed ? 0 : win.scrollLeft();
  650. dict.stY = fixed ? 0 : win.scrollTop();
  651. //控制元素不被拖出窗口外
  652. if(!config.moveOut){
  653. var setRig = win.width() - layero.outerWidth() + dict.stX
  654. ,setBot = win.height() - layero.outerHeight() + dict.stY;
  655. X < dict.stX && (X = dict.stX);
  656. X > setRig && (X = setRig);
  657. Y < dict.stY && (Y = dict.stY);
  658. Y > setBot && (Y = setBot);
  659. }
  660. layero.css({
  661. left: X
  662. ,top: Y
  663. });
  664. }
  665. //Resize
  666. if(config.resize && dict.resizeStart){
  667. var X = e.clientX - dict.offset[0]
  668. ,Y = e.clientY - dict.offset[1];
  669. e.preventDefault();
  670. layer.style(that.index, {
  671. width: dict.area[0] + X
  672. ,height: dict.area[1] + Y
  673. })
  674. dict.isResize = true;
  675. config.resizing && config.resizing(layero);
  676. }
  677. }).on('mouseup', function(e){
  678. if(dict.moveStart){
  679. delete dict.moveStart;
  680. ready.moveElem.hide();
  681. config.moveEnd && config.moveEnd(layero);
  682. }
  683. if(dict.resizeStart){
  684. delete dict.resizeStart;
  685. ready.moveElem.hide();
  686. }
  687. });
  688. return that;
  689. };
  690. Class.pt.callback = function(){
  691. var that = this, layero = that.layero, config = that.config;
  692. that.openLayer();
  693. if(config.success){
  694. if(config.type == 2){
  695. layero.find('iframe').on('load', function(){
  696. config.success(layero, that.index);
  697. });
  698. } else {
  699. config.success(layero, that.index);
  700. }
  701. }
  702. layer.ie == 6 && that.IE6(layero);
  703. //按钮
  704. layero.find('.'+ doms[6]).children('a').on('click', function(){
  705. var index = $(this).index();
  706. if(index === 0){
  707. if(config.yes){
  708. config.yes(that.index, layero)
  709. } else if(config['btn1']){
  710. config['btn1'](that.index, layero)
  711. } else {
  712. layer.close(that.index);
  713. }
  714. } else {
  715. var close = config['btn'+(index+1)] && config['btn'+(index+1)](that.index, layero);
  716. close === false || layer.close(that.index);
  717. }
  718. });
  719. //取消
  720. function cancel(){
  721. var close = config.cancel && config.cancel(that.index, layero);
  722. close === false || layer.close(that.index);
  723. }
  724. //右上角关闭回调
  725. layero.find('.'+ doms[7]).on('click', cancel);
  726. //点遮罩关闭
  727. if(config.shadeClose){
  728. $('#layui-layer-shade'+ that.index).on('click', function(){
  729. layer.close(that.index);
  730. });
  731. }
  732. //最小化
  733. layero.find('.layui-layer-min').on('click', function(){
  734. var min = config.min && config.min(layero);
  735. min === false || layer.min(that.index, config);
  736. });
  737. //全屏/还原
  738. layero.find('.layui-layer-max').on('click', function(){
  739. if($(this).hasClass('layui-layer-maxmin')){
  740. layer.restore(that.index);
  741. config.restore && config.restore(layero);
  742. } else {
  743. layer.full(that.index, config);
  744. setTimeout(function(){
  745. config.full && config.full(layero);
  746. }, 100);
  747. }
  748. });
  749. config.end && (ready.end[that.index] = config.end);
  750. };
  751. //for ie6 恢复select
  752. ready.reselect = function(){
  753. $.each($('select'), function(index , value){
  754. var sthis = $(this);
  755. if(!sthis.parents('.'+doms[0])[0]){
  756. (sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show();
  757. }
  758. sthis = null;
  759. });
  760. };
  761. Class.pt.IE6 = function(layero){
  762. //隐藏select
  763. $('select').each(function(index , value){
  764. var sthis = $(this);
  765. if(!sthis.parents('.'+doms[0])[0]){
  766. sthis.css('display') === 'none' || sthis.attr({'layer' : '1'}).hide();
  767. }
  768. sthis = null;
  769. });
  770. };
  771. //需依赖原型的对外方法
  772. Class.pt.openLayer = function(){
  773. var that = this;
  774. //置顶当前窗口
  775. layer.zIndex = that.config.zIndex;
  776. layer.setTop = function(layero){
  777. var setZindex = function(){
  778. layer.zIndex++;
  779. layero.css('z-index', layer.zIndex + 1);
  780. };
  781. layer.zIndex = parseInt(layero[0].style.zIndex);
  782. layero.on('mousedown', setZindex);
  783. return layer.zIndex;
  784. };
  785. };
  786. ready.record = function(layero){
  787. var area = [
  788. layero.width(),
  789. layero.height(),
  790. layero.position().top,
  791. layero.position().left + parseFloat(layero.css('margin-left'))
  792. ];
  793. layero.find('.layui-layer-max').addClass('layui-layer-maxmin');
  794. layero.attr({area: area});
  795. };
  796. ready.rescollbar = function(index){
  797. if(doms.html.attr('layer-full') == index){
  798. if(doms.html[0].style.removeProperty){
  799. doms.html[0].style.removeProperty('overflow');
  800. } else {
  801. doms.html[0].style.removeAttribute('overflow');
  802. }
  803. doms.html.removeAttr('layer-full');
  804. }
  805. };
  806. /** 内置成员 */
  807. window.layer = layer;
  808. //获取子iframe的DOM
  809. layer.getChildFrame = function(selector, index){
  810. index = index || $('.'+doms[4]).attr('times');
  811. return $('#'+ doms[0] + index).find('iframe').contents().find(selector);
  812. };
  813. //得到当前iframe层的索引,子iframe时使用
  814. layer.getFrameIndex = function(name){
  815. return $('#'+ name).parents('.'+doms[4]).attr('times');
  816. };
  817. //iframe层自适应宽高
  818. layer.iframeAuto = function(index){
  819. if(!index) return;
  820. var heg = layer.getChildFrame('html', index).outerHeight();
  821. var layero = $('#'+ doms[0] + index);
  822. var titHeight = layero.find(doms[1]).outerHeight() || 0;
  823. var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
  824. layero.css({height: heg + titHeight + btnHeight});
  825. layero.find('iframe').css({height: heg});
  826. };
  827. //重置iframe url
  828. layer.iframeSrc = function(index, url){
  829. $('#'+ doms[0] + index).find('iframe').attr('src', url);
  830. };
  831. //设定层的样式
  832. layer.style = function(index, options, limit){
  833. var layero = $('#'+ doms[0] + index)
  834. ,contElem = layero.find('.layui-layer-content')
  835. ,type = layero.attr('type')
  836. ,titHeight = layero.find(doms[1]).outerHeight() || 0
  837. ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0
  838. ,minLeft = layero.attr('minLeft');
  839. if(type === ready.type[3] || type === ready.type[4]){
  840. return;
  841. }
  842. if(!limit){
  843. if(parseFloat(options.width) <= 260){
  844. options.width = 260;
  845. };
  846. if(parseFloat(options.height) - titHeight - btnHeight <= 64){
  847. options.height = 64 + titHeight + btnHeight;
  848. };
  849. }
  850. layero.css(options);
  851. btnHeight = layero.find('.'+doms[6]).outerHeight();
  852. if(type === ready.type[2]){
  853. layero.find('iframe').css({
  854. height: parseFloat(options.height) - titHeight - btnHeight
  855. });
  856. } else {
  857. contElem.css({
  858. height: parseFloat(options.height) - titHeight - btnHeight
  859. - parseFloat(contElem.css('padding-top'))
  860. - parseFloat(contElem.css('padding-bottom'))
  861. })
  862. }
  863. };
  864. //最小化
  865. layer.min = function(index, options){
  866. var layero = $('#'+ doms[0] + index)
  867. ,titHeight = layero.find(doms[1]).outerHeight() || 0
  868. ,left = layero.attr('minLeft') || (181*ready.minIndex)+'px'
  869. ,position = layero.css('position');
  870. ready.record(layero);
  871. if(ready.minLeft[0]){
  872. left = ready.minLeft[0];
  873. ready.minLeft.shift();
  874. }
  875. layero.attr('position', position);
  876. layer.style(index, {
  877. width: 180
  878. ,height: titHeight
  879. ,left: left
  880. ,top: win.height() - titHeight
  881. ,position: 'fixed'
  882. ,overflow: 'hidden'
  883. }, true);
  884. layero.find('.layui-layer-min').hide();
  885. layero.attr('type') === 'page' && layero.find(doms[4]).hide();
  886. ready.rescollbar(index);
  887. if(!layero.attr('minLeft')){
  888. ready.minIndex++;
  889. }
  890. layero.attr('minLeft', left);
  891. };
  892. //还原
  893. layer.restore = function(index){
  894. var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(',');
  895. var type = layero.attr('type');
  896. layer.style(index, {
  897. width: parseFloat(area[0]),
  898. height: parseFloat(area[1]),
  899. top: parseFloat(area[2]),
  900. left: parseFloat(area[3]),
  901. position: layero.attr('position'),
  902. overflow: 'visible'
  903. }, true);
  904. layero.find('.layui-layer-max').removeClass('layui-layer-maxmin');
  905. layero.find('.layui-layer-min').show();
  906. layero.attr('type') === 'page' && layero.find(doms[4]).show();
  907. ready.rescollbar(index);
  908. };
  909. //全屏
  910. layer.full = function(index){
  911. var layero = $('#'+ doms[0] + index), timer;
  912. ready.record(layero);
  913. if(!doms.html.attr('layer-full')){
  914. doms.html.css('overflow','hidden').attr('layer-full', index);
  915. }
  916. clearTimeout(timer);
  917. timer = setTimeout(function(){
  918. var isfix = layero.css('position') === 'fixed';
  919. layer.style(index, {
  920. top: isfix ? 0 : win.scrollTop(),
  921. left: isfix ? 0 : win.scrollLeft(),
  922. width: win.width(),
  923. height: win.height()
  924. }, true);
  925. layero.find('.layui-layer-min').hide();
  926. }, 100);
  927. };
  928. //改变title
  929. layer.title = function(name, index){
  930. var title = $('#'+ doms[0] + (index||layer.index)).find(doms[1]);
  931. title.html(name);
  932. };
  933. //关闭layer总方法
  934. layer.close = function(index){
  935. var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close';
  936. if(!layero[0]) return;
  937. var WRAP = 'layui-layer-wrap', remove = function(){
  938. if(type === ready.type[1] && layero.attr('conType') === 'object'){
  939. layero.children(':not(.'+ doms[5] +')').remove();
  940. var wrap = layero.find('.'+WRAP);
  941. for(var i = 0; i < 2; i++){
  942. wrap.unwrap();
  943. }
  944. wrap.css('display', wrap.data('display')).removeClass(WRAP);
  945. } else {
  946. //低版本IE 回收 iframe
  947. if(type === ready.type[2]){
  948. try {
  949. var iframe = $('#'+doms[4]+index)[0];
  950. iframe.contentWindow.document.write('');
  951. iframe.contentWindow.close();
  952. layero.find('.'+doms[5])[0].removeChild(iframe);
  953. } catch(e){}
  954. }
  955. layero[0].innerHTML = '';
  956. layero.remove();
  957. }
  958. typeof ready.end[index] === 'function' && ready.end[index]();
  959. delete ready.end[index];
  960. };
  961. if(layero.data('isOutAnim')){
  962. layero.addClass(closeAnim);
  963. }
  964. $('#layui-layer-moves, #layui-layer-shade' + index).remove();
  965. layer.ie == 6 && ready.reselect();
  966. ready.rescollbar(index);
  967. if(layero.attr('minLeft')){
  968. ready.minIndex--;
  969. ready.minLeft.push(layero.attr('minLeft'));
  970. }
  971. if((layer.ie && layer.ie < 10) || !layero.data('isOutAnim')){
  972. remove()
  973. } else {
  974. setTimeout(function(){
  975. remove();
  976. }, 200);
  977. }
  978. };
  979. //关闭所有层
  980. layer.closeAll = function(type){
  981. $.each($('.'+doms[0]), function(){
  982. var othis = $(this);
  983. var is = type ? (othis.attr('type') === type) : 1;
  984. is && layer.close(othis.attr('times'));
  985. is = null;
  986. });
  987. };
  988. /**
  989. 拓展模块,layui开始合并在一起
  990. */
  991. var cache = layer.cache||{}, skin = function(type){
  992. return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : '');
  993. };
  994. //仿系统prompt
  995. layer.prompt = function(options, yes){
  996. var style = '';
  997. options = options || {};
  998. if(typeof options === 'function') yes = options;
  999. if(options.area){
  1000. var area = options.area;
  1001. style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"';
  1002. delete options.area;
  1003. }
  1004. var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style +'>' + (options.value||'') +'</textarea>' : function(){
  1005. return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input" value="'+ (options.value||'') +'">';
  1006. }();
  1007. var success = options.success;
  1008. delete options.success;
  1009. return layer.open($.extend({
  1010. type: 1
  1011. ,btn: ['&#x786E;&#x5B9A;','&#x53D6;&#x6D88;']
  1012. ,content: content
  1013. ,skin: 'layui-layer-prompt' + skin('prompt')
  1014. ,maxWidth: win.width()
  1015. ,success: function(layero){
  1016. prompt = layero.find('.layui-layer-input');
  1017. prompt.focus();
  1018. typeof success === 'function' && success(layero);
  1019. }
  1020. ,resize: false
  1021. ,yes: function(index){
  1022. var value = prompt.val();
  1023. if(value === ''){
  1024. prompt.focus();
  1025. } else if(value.length > (options.maxlength||500)) {
  1026. layer.tips('&#x6700;&#x591A;&#x8F93;&#x5165;'+ (options.maxlength || 500) +'&#x4E2A;&#x5B57;&#x6570;', prompt, {tips: 1});
  1027. } else {
  1028. yes && yes(value, index, prompt);
  1029. }
  1030. }
  1031. }, options));
  1032. };
  1033. //tab层
  1034. layer.tab = function(options){
  1035. options = options || {};
  1036. var tab = options.tab || {}
  1037. ,success = options.success;
  1038. delete options.success;
  1039. return layer.open($.extend({
  1040. type: 1,
  1041. skin: 'layui-layer-tab' + skin('tab'),
  1042. resize: false,
  1043. title: function(){
  1044. var len = tab.length, ii = 1, str = '';
  1045. if(len > 0){
  1046. str = '<span class="layui-layer-tabnow">'+ tab[0].title +'</span>';
  1047. for(; ii < len; ii++){
  1048. str += '<span>'+ tab[ii].title +'</span>';
  1049. }
  1050. }
  1051. return str;
  1052. }(),
  1053. content: '<ul class="layui-layer-tabmain">'+ function(){
  1054. var len = tab.length, ii = 1, str = '';
  1055. if(len > 0){
  1056. str = '<li class="layui-layer-tabli xubox_tab_layer">'+ (tab[0].content || 'no content') +'</li>';
  1057. for(; ii < len; ii++){
  1058. str += '<li class="layui-layer-tabli">'+ (tab[ii].content || 'no content') +'</li>';
  1059. }
  1060. }
  1061. return str;
  1062. }() +'</ul>',
  1063. success: function(layero){
  1064. var btn = layero.find('.layui-layer-title').children();
  1065. var main = layero.find('.layui-layer-tabmain').children();
  1066. btn.on('mousedown', function(e){
  1067. e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;
  1068. var othis = $(this), index = othis.index();
  1069. othis.addClass('layui-layer-tabnow').siblings().removeClass('layui-layer-tabnow');
  1070. main.eq(index).show().siblings().hide();
  1071. typeof options.change === 'function' && options.change(index);
  1072. });
  1073. typeof success === 'function' && success(layero);
  1074. }
  1075. }, options));
  1076. };
  1077. //相册层
  1078. layer.photos = function(options, loop, key){
  1079. var dict = {};
  1080. options = options || {};
  1081. if(!options.photos) return;
  1082. var type = options.photos.constructor === Object;
  1083. var photos = type ? options.photos : {}, data = photos.data || [];
  1084. var start = photos.start || 0;
  1085. dict.imgIndex = (start|0) + 1;
  1086. options.img = options.img || 'img';
  1087. var success = options.success;
  1088. delete options.success;
  1089. if(!type){ //页面直接获取
  1090. var parent = $(options.photos), pushData = function(){
  1091. data = [];
  1092. parent.find(options.img).each(function(index){
  1093. var othis = $(this);
  1094. othis.attr('layer-index', index);
  1095. data.push({
  1096. alt: othis.attr('alt'),
  1097. pid: othis.attr('layer-pid'),
  1098. src: othis.attr('layer-src') || othis.attr('src'),
  1099. thumb: othis.attr('src')
  1100. });
  1101. })
  1102. };
  1103. pushData();
  1104. if (data.length === 0) return;
  1105. loop || parent.on('click', options.img, function(){
  1106. var othis = $(this), index = othis.attr('layer-index');
  1107. layer.photos($.extend(options, {
  1108. photos: {
  1109. start: index,
  1110. data: data,
  1111. tab: options.tab
  1112. },
  1113. full: options.full
  1114. }), true);
  1115. pushData();
  1116. })
  1117. //不直接弹出
  1118. if(!loop) return;
  1119. } else if (data.length === 0){
  1120. return layer.msg('&#x6CA1;&#x6709;&#x56FE;&#x7247;');
  1121. }
  1122. //上一张
  1123. dict.imgprev = function(key){
  1124. dict.imgIndex--;
  1125. if(dict.imgIndex < 1){
  1126. dict.imgIndex = data.length;
  1127. }
  1128. dict.tabimg(key);
  1129. };
  1130. //下一张
  1131. dict.imgnext = function(key,errorMsg){
  1132. dict.imgIndex++;
  1133. if(dict.imgIndex > data.length){
  1134. dict.imgIndex = 1;
  1135. if (errorMsg) {return};
  1136. }
  1137. dict.tabimg(key)
  1138. };
  1139. //方向键
  1140. dict.keyup = function(event){
  1141. if(!dict.end){
  1142. var code = event.keyCode;
  1143. event.preventDefault();
  1144. if(code === 37){
  1145. dict.imgprev(true);
  1146. } else if(code === 39) {
  1147. dict.imgnext(true);
  1148. } else if(code === 27) {
  1149. layer.close(dict.index);
  1150. }
  1151. }
  1152. }
  1153. //切换
  1154. dict.tabimg = function(key){
  1155. if(data.length <= 1) return;
  1156. photos.start = dict.imgIndex - 1;
  1157. layer.close(dict.index);
  1158. return layer.photos(options, true, key);
  1159. setTimeout(function(){
  1160. layer.photos(options, true, key);
  1161. }, 200);
  1162. }
  1163. //一些动作
  1164. dict.event = function(){
  1165. dict.bigimg.hover(function(){
  1166. dict.imgsee.show();
  1167. }, function(){
  1168. dict.imgsee.hide();
  1169. });
  1170. dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){
  1171. event.preventDefault();
  1172. dict.imgprev();
  1173. });
  1174. dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){
  1175. event.preventDefault();
  1176. dict.imgnext();
  1177. });
  1178. $(document).on('keyup', dict.keyup);
  1179. };
  1180. //图片预加载
  1181. function loadImage(url, callback, error) {
  1182. var img = new Image();
  1183. img.src = url;
  1184. if(img.complete){
  1185. return callback(img);
  1186. }
  1187. img.onload = function(){
  1188. img.onload = null;
  1189. callback(img);
  1190. };
  1191. img.onerror = function(e){
  1192. img.onerror = null;
  1193. error(e);
  1194. };
  1195. };
  1196. dict.loadi = layer.load(1, {
  1197. shade: 'shade' in options ? false : 0.9,
  1198. scrollbar: false
  1199. });
  1200. loadImage(data[start].src, function(img){
  1201. layer.close(dict.loadi);
  1202. dict.index = layer.open($.extend({
  1203. type: 1,
  1204. id: 'layui-layer-photos',
  1205. area: function(){
  1206. var imgarea = [img.width, img.height];
  1207. var winarea = [$(window).width() - 100, $(window).height() - 100];
  1208. //如果 实际图片的宽或者高比 屏幕大(那么进行缩放)
  1209. if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){
  1210. var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例
  1211. if(wh[0] > wh[1]){//取缩放比例最大的进行缩放
  1212. imgarea[0] = imgarea[0]/wh[0];
  1213. imgarea[1] = imgarea[1]/wh[0];
  1214. } else if(wh[0] < wh[1]){
  1215. imgarea[0] = imgarea[0]/wh[1];
  1216. imgarea[1] = imgarea[1]/wh[1];
  1217. }
  1218. }
  1219. return [imgarea[0]+'px', imgarea[1]+'px'];
  1220. }(),
  1221. title: false,
  1222. shade: 0.9,
  1223. shadeClose: true,
  1224. closeBtn: false,
  1225. move: '.layui-layer-phimg img',
  1226. moveType: 1,
  1227. scrollbar: false,
  1228. moveOut: true,
  1229. //anim: Math.random()*5|0,
  1230. isOutAnim: false,
  1231. skin: 'layui-layer-photos' + skin('photos'),
  1232. content: '<div class="layui-layer-phimg">'
  1233. +'<img src="'+ data[start].src +'" alt="'+ (data[start].alt||'') +'" layer-pid="'+ data[start].pid +'">'
  1234. +'<div class="layui-layer-imgsee">'
  1235. +(data.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>' : '')
  1236. +'<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="javascript:;">'+ (data[start].alt||'') +'</a><em>'+ dict.imgIndex +'/'+ data.length +'</em></span></div>'
  1237. +'</div>'
  1238. +'</div>',
  1239. success: function(layero, index){
  1240. dict.bigimg = layero.find('.layui-layer-phimg');
  1241. dict.imgsee = layero.find('.layui-layer-imguide,.layui-layer-imgbar');
  1242. dict.event(layero);
  1243. options.tab && options.tab(data[start], layero);
  1244. typeof success === 'function' && success(layero);
  1245. }, end: function(){
  1246. dict.end = true;
  1247. $(document).off('keyup', dict.keyup);
  1248. }
  1249. }, options));
  1250. }, function(){
  1251. layer.close(dict.loadi);
  1252. layer.msg('&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;', {
  1253. time: 30000,
  1254. btn: ['&#x4E0B;&#x4E00;&#x5F20;', '&#x4E0D;&#x770B;&#x4E86;'],
  1255. yes: function(){
  1256. data.length > 1 && dict.imgnext(true,true);
  1257. }
  1258. });
  1259. });
  1260. };
  1261. //主入口
  1262. ready.run = function(_$){
  1263. $ = _$;
  1264. win = $(window);
  1265. doms.html = $('html');
  1266. layer.open = function(deliver){
  1267. var o = new Class(deliver);
  1268. return o.index;
  1269. };
  1270. };
  1271. //加载方式
  1272. window.layui && layui.define ? (
  1273. layer.ready()
  1274. ,layui.define('jquery', function(exports){ //layui加载
  1275. layer.path = layui.cache.dir;
  1276. ready.run(layui.jquery);
  1277. //暴露模块
  1278. window.layer = layer;
  1279. exports('layer', layer);
  1280. })
  1281. ) : (
  1282. (typeof define === 'function' && define.amd) ? define('layer',['jquery'], function(){ //requirejs加载
  1283. ready.run(window.jQuery);
  1284. return layer;
  1285. }) : function(){ //普通script标签加载
  1286. ready.run(window.jQuery);
  1287. layer.ready();
  1288. }()
  1289. );
  1290. }(window);
  1291. /*
  1292. * Toastr
  1293. * Copyright 2012-2015
  1294. * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
  1295. * All Rights Reserved.
  1296. * Use, reproduction, distribution, and modification of this code is subject to the terms and
  1297. * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
  1298. *
  1299. * ARIA Support: Greta Krafsig
  1300. *
  1301. * Project: https://github.com/CodeSeven/toastr
  1302. */
  1303. /* global define */
  1304. (function (define) {
  1305. define('toastr',['jquery'], function ($) {
  1306. return (function () {
  1307. var $container;
  1308. var listener;
  1309. var toastId = 0;
  1310. var toastType = {
  1311. error: 'error',
  1312. info: 'info',
  1313. success: 'success',
  1314. warning: 'warning'
  1315. };
  1316. var toastr = {
  1317. clear: clear,
  1318. remove: remove,
  1319. error: error,
  1320. getContainer: getContainer,
  1321. info: info,
  1322. options: {},
  1323. subscribe: subscribe,
  1324. success: success,
  1325. version: '2.1.3',
  1326. warning: warning
  1327. };
  1328. var previousToast;
  1329. return toastr;
  1330. ////////////////
  1331. function error(message, title, optionsOverride) {
  1332. return notify({
  1333. type: toastType.error,
  1334. iconClass: getOptions().iconClasses.error,
  1335. message: message,
  1336. optionsOverride: optionsOverride,
  1337. title: title
  1338. });
  1339. }
  1340. function getContainer(options, create) {
  1341. if (!options) { options = getOptions(); }
  1342. $container = $('#' + options.containerId);
  1343. if ($container.length) {
  1344. return $container;
  1345. }
  1346. if (create) {
  1347. $container = createContainer(options);
  1348. }
  1349. return $container;
  1350. }
  1351. function info(message, title, optionsOverride) {
  1352. return notify({
  1353. type: toastType.info,
  1354. iconClass: getOptions().iconClasses.info,
  1355. message: message,
  1356. optionsOverride: optionsOverride,
  1357. title: title
  1358. });
  1359. }
  1360. function subscribe(callback) {
  1361. listener = callback;
  1362. }
  1363. function success(message, title, optionsOverride) {
  1364. return notify({
  1365. type: toastType.success,
  1366. iconClass: getOptions().iconClasses.success,
  1367. message: message,
  1368. optionsOverride: optionsOverride,
  1369. title: title
  1370. });
  1371. }
  1372. function warning(message, title, optionsOverride) {
  1373. return notify({
  1374. type: toastType.warning,
  1375. iconClass: getOptions().iconClasses.warning,
  1376. message: message,
  1377. optionsOverride: optionsOverride,
  1378. title: title
  1379. });
  1380. }
  1381. function clear($toastElement, clearOptions) {
  1382. var options = getOptions();
  1383. if (!$container) { getContainer(options); }
  1384. if (!clearToast($toastElement, options, clearOptions)) {
  1385. clearContainer(options);
  1386. }
  1387. }
  1388. function remove($toastElement) {
  1389. var options = getOptions();
  1390. if (!$container) { getContainer(options); }
  1391. if ($toastElement && $(':focus', $toastElement).length === 0) {
  1392. removeToast($toastElement);
  1393. return;
  1394. }
  1395. if ($container.children().length) {
  1396. $container.remove();
  1397. }
  1398. }
  1399. // internal functions
  1400. function clearContainer (options) {
  1401. var toastsToClear = $container.children();
  1402. for (var i = toastsToClear.length - 1; i >= 0; i--) {
  1403. clearToast($(toastsToClear[i]), options);
  1404. }
  1405. }
  1406. function clearToast ($toastElement, options, clearOptions) {
  1407. var force = clearOptions && clearOptions.force ? clearOptions.force : false;
  1408. if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
  1409. $toastElement[options.hideMethod]({
  1410. duration: options.hideDuration,
  1411. easing: options.hideEasing,
  1412. complete: function () { removeToast($toastElement); }
  1413. });
  1414. return true;
  1415. }
  1416. return false;
  1417. }
  1418. function createContainer(options) {
  1419. $container = $('<div/>')
  1420. .attr('id', options.containerId)
  1421. .addClass(options.positionClass);
  1422. $container.appendTo($(options.target));
  1423. return $container;
  1424. }
  1425. function getDefaults() {
  1426. return {
  1427. tapToDismiss: true,
  1428. toastClass: 'toast',
  1429. containerId: 'toast-container',
  1430. debug: false,
  1431. showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
  1432. showDuration: 300,
  1433. showEasing: 'swing', //swing and linear are built into jQuery
  1434. onShown: undefined,
  1435. hideMethod: 'fadeOut',
  1436. hideDuration: 1000,
  1437. hideEasing: 'swing',
  1438. onHidden: undefined,
  1439. closeMethod: false,
  1440. closeDuration: false,
  1441. closeEasing: false,
  1442. closeOnHover: true,
  1443. extendedTimeOut: 1000,
  1444. iconClasses: {
  1445. error: 'toast-error',
  1446. info: 'toast-info',
  1447. success: 'toast-success',
  1448. warning: 'toast-warning'
  1449. },
  1450. iconClass: 'toast-info',
  1451. positionClass: 'toast-top-right',
  1452. timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
  1453. titleClass: 'toast-title',
  1454. messageClass: 'toast-message',
  1455. escapeHtml: false,
  1456. target: 'body',
  1457. closeHtml: '<button type="button">&times;</button>',
  1458. closeClass: 'toast-close-button',
  1459. newestOnTop: true,
  1460. preventDuplicates: false,
  1461. progressBar: false,
  1462. progressClass: 'toast-progress',
  1463. rtl: false
  1464. };
  1465. }
  1466. function publish(args) {
  1467. if (!listener) { return; }
  1468. listener(args);
  1469. }
  1470. function notify(map) {
  1471. var options = getOptions();
  1472. var iconClass = map.iconClass || options.iconClass;
  1473. if (typeof (map.optionsOverride) !== 'undefined') {
  1474. options = $.extend(options, map.optionsOverride);
  1475. iconClass = map.optionsOverride.iconClass || iconClass;
  1476. }
  1477. if (shouldExit(options, map)) { return; }
  1478. toastId++;
  1479. $container = getContainer(options, true);
  1480. var intervalId = null;
  1481. var $toastElement = $('<div/>');
  1482. var $titleElement = $('<div/>');
  1483. var $messageElement = $('<div/>');
  1484. var $progressElement = $('<div/>');
  1485. var $closeElement = $(options.closeHtml);
  1486. var progressBar = {
  1487. intervalId: null,
  1488. hideEta: null,
  1489. maxHideTime: null
  1490. };
  1491. var response = {
  1492. toastId: toastId,
  1493. state: 'visible',
  1494. startTime: new Date(),
  1495. options: options,
  1496. map: map
  1497. };
  1498. personalizeToast();
  1499. displayToast();
  1500. handleEvents();
  1501. publish(response);
  1502. if (options.debug && console) {
  1503. console.log(response);
  1504. }
  1505. return $toastElement;
  1506. function escapeHtml(source) {
  1507. if (source == null) {
  1508. source = '';
  1509. }
  1510. return source
  1511. .replace(/&/g, '&amp;')
  1512. .replace(/"/g, '&quot;')
  1513. .replace(/'/g, '&#39;')
  1514. .replace(/</g, '&lt;')
  1515. .replace(/>/g, '&gt;');
  1516. }
  1517. function personalizeToast() {
  1518. setIcon();
  1519. setTitle();
  1520. setMessage();
  1521. setCloseButton();
  1522. setProgressBar();
  1523. setRTL();
  1524. setSequence();
  1525. setAria();
  1526. }
  1527. function setAria() {
  1528. var ariaValue = '';
  1529. switch (map.iconClass) {
  1530. case 'toast-success':
  1531. case 'toast-info':
  1532. ariaValue = 'polite';
  1533. break;
  1534. default:
  1535. ariaValue = 'assertive';
  1536. }
  1537. $toastElement.attr('aria-live', ariaValue);
  1538. }
  1539. function handleEvents() {
  1540. if (options.closeOnHover) {
  1541. $toastElement.hover(stickAround, delayedHideToast);
  1542. }
  1543. if (!options.onclick && options.tapToDismiss) {
  1544. $toastElement.click(hideToast);
  1545. }
  1546. if (options.closeButton && $closeElement) {
  1547. $closeElement.click(function (event) {
  1548. if (event.stopPropagation) {
  1549. event.stopPropagation();
  1550. } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
  1551. event.cancelBubble = true;
  1552. }
  1553. if (options.onCloseClick) {
  1554. options.onCloseClick(event);
  1555. }
  1556. hideToast(true);
  1557. });
  1558. }
  1559. if (options.onclick) {
  1560. $toastElement.click(function (event) {
  1561. options.onclick(event);
  1562. hideToast();
  1563. });
  1564. }
  1565. }
  1566. function displayToast() {
  1567. $toastElement.hide();
  1568. $toastElement[options.showMethod](
  1569. {duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
  1570. );
  1571. if (options.timeOut > 0) {
  1572. intervalId = setTimeout(hideToast, options.timeOut);
  1573. progressBar.maxHideTime = parseFloat(options.timeOut);
  1574. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  1575. if (options.progressBar) {
  1576. progressBar.intervalId = setInterval(updateProgress, 10);
  1577. }
  1578. }
  1579. }
  1580. function setIcon() {
  1581. if (map.iconClass) {
  1582. $toastElement.addClass(options.toastClass).addClass(iconClass);
  1583. }
  1584. }
  1585. function setSequence() {
  1586. if (options.newestOnTop) {
  1587. $container.prepend($toastElement);
  1588. } else {
  1589. $container.append($toastElement);
  1590. }
  1591. }
  1592. function setTitle() {
  1593. if (map.title) {
  1594. var suffix = map.title;
  1595. if (options.escapeHtml) {
  1596. suffix = escapeHtml(map.title);
  1597. }
  1598. $titleElement.append(suffix).addClass(options.titleClass);
  1599. $toastElement.append($titleElement);
  1600. }
  1601. }
  1602. function setMessage() {
  1603. if (map.message) {
  1604. var suffix = map.message;
  1605. if (options.escapeHtml) {
  1606. suffix = escapeHtml(map.message);
  1607. }
  1608. $messageElement.append(suffix).addClass(options.messageClass);
  1609. $toastElement.append($messageElement);
  1610. }
  1611. }
  1612. function setCloseButton() {
  1613. if (options.closeButton) {
  1614. $closeElement.addClass(options.closeClass).attr('role', 'button');
  1615. $toastElement.prepend($closeElement);
  1616. }
  1617. }
  1618. function setProgressBar() {
  1619. if (options.progressBar) {
  1620. $progressElement.addClass(options.progressClass);
  1621. $toastElement.prepend($progressElement);
  1622. }
  1623. }
  1624. function setRTL() {
  1625. if (options.rtl) {
  1626. $toastElement.addClass('rtl');
  1627. }
  1628. }
  1629. function shouldExit(options, map) {
  1630. if (options.preventDuplicates) {
  1631. if (map.message === previousToast) {
  1632. return true;
  1633. } else {
  1634. previousToast = map.message;
  1635. }
  1636. }
  1637. return false;
  1638. }
  1639. function hideToast(override) {
  1640. var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
  1641. var duration = override && options.closeDuration !== false ?
  1642. options.closeDuration : options.hideDuration;
  1643. var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
  1644. if ($(':focus', $toastElement).length && !override) {
  1645. return;
  1646. }
  1647. clearTimeout(progressBar.intervalId);
  1648. return $toastElement[method]({
  1649. duration: duration,
  1650. easing: easing,
  1651. complete: function () {
  1652. removeToast($toastElement);
  1653. clearTimeout(intervalId);
  1654. if (options.onHidden && response.state !== 'hidden') {
  1655. options.onHidden();
  1656. }
  1657. response.state = 'hidden';
  1658. response.endTime = new Date();
  1659. publish(response);
  1660. }
  1661. });
  1662. }
  1663. function delayedHideToast() {
  1664. if (options.timeOut > 0 || options.extendedTimeOut > 0) {
  1665. intervalId = setTimeout(hideToast, options.extendedTimeOut);
  1666. progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
  1667. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  1668. }
  1669. }
  1670. function stickAround() {
  1671. clearTimeout(intervalId);
  1672. progressBar.hideEta = 0;
  1673. $toastElement.stop(true, true)[options.showMethod](
  1674. {duration: options.showDuration, easing: options.showEasing}
  1675. );
  1676. }
  1677. function updateProgress() {
  1678. var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
  1679. $progressElement.width(percentage + '%');
  1680. }
  1681. }
  1682. function getOptions() {
  1683. return $.extend({}, getDefaults(), toastr.options);
  1684. }
  1685. function removeToast($toastElement) {
  1686. if (!$container) { $container = getContainer(); }
  1687. if ($toastElement.is(':visible')) {
  1688. return;
  1689. }
  1690. $toastElement.remove();
  1691. $toastElement = null;
  1692. if ($container.children().length === 0) {
  1693. $container.remove();
  1694. previousToast = undefined;
  1695. }
  1696. }
  1697. })();
  1698. });
  1699. }(typeof define === 'function' && define.amd ? define : function (deps, factory) {
  1700. if (typeof module !== 'undefined' && module.exports) { //Node
  1701. module.exports = factory(require('jquery'));
  1702. } else {
  1703. window.toastr = factory(window.jQuery);
  1704. }
  1705. }));
  1706. define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) {
  1707. var Fast = {
  1708. config: {
  1709. //toastr默认配置
  1710. toastr: {
  1711. "closeButton": true,
  1712. "debug": false,
  1713. "newestOnTop": false,
  1714. "progressBar": false,
  1715. "positionClass": "toast-top-center",
  1716. "preventDuplicates": false,
  1717. "onclick": null,
  1718. "showDuration": "300",
  1719. "hideDuration": "1000",
  1720. "timeOut": "5000",
  1721. "extendedTimeOut": "1000",
  1722. "showEasing": "swing",
  1723. "hideEasing": "linear",
  1724. "showMethod": "fadeIn",
  1725. "hideMethod": "fadeOut"
  1726. }
  1727. },
  1728. events: {
  1729. //请求成功的回调
  1730. onAjaxSuccess: function (ret, onAjaxSuccess) {
  1731. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  1732. var msg = typeof ret.msg !== 'undefined' && ret.msg ? ret.msg : __('Operation completed');
  1733. if (typeof onAjaxSuccess === 'function') {
  1734. var result = onAjaxSuccess.call(this, data, ret);
  1735. if (result === false)
  1736. return;
  1737. }
  1738. Toastr.success(msg);
  1739. },
  1740. //请求错误的回调
  1741. onAjaxError: function (ret, onAjaxError) {
  1742. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  1743. if (typeof onAjaxError === 'function') {
  1744. var result = onAjaxError.call(this, data, ret);
  1745. if (result === false) {
  1746. return;
  1747. }
  1748. }
  1749. Toastr.error(ret.msg + "(code:" + ret.code + ")");
  1750. },
  1751. //服务器响应数据后
  1752. onAjaxResponse: function (response) {
  1753. try {
  1754. var ret = typeof response === 'object' ? response : JSON.parse(response);
  1755. if (!ret.hasOwnProperty('code')) {
  1756. $.extend(ret, {code: -2, msg: response, data: null});
  1757. }
  1758. } catch (e) {
  1759. var ret = {code: -1, msg: e.message, data: null};
  1760. }
  1761. return ret;
  1762. }
  1763. },
  1764. api: {
  1765. //发送Ajax请求
  1766. ajax: function (options, success, error) {
  1767. options = typeof options === 'string' ? {url: options} : options;
  1768. var index = Layer.load();
  1769. options = $.extend({
  1770. type: "POST",
  1771. dataType: "json",
  1772. success: function (ret) {
  1773. Layer.close(index);
  1774. ret = Fast.events.onAjaxResponse(ret);
  1775. if (ret.code === 1) {
  1776. Fast.events.onAjaxSuccess(ret, success);
  1777. } else {
  1778. Fast.events.onAjaxError(ret, error);
  1779. }
  1780. },
  1781. error: function (err) {
  1782. Layer.close(index);
  1783. var ret = {code: err.code, msg: err.message, data: null};
  1784. Fast.events.onAjaxError(ret, error);
  1785. }
  1786. }, options);
  1787. $.ajax(options);
  1788. },
  1789. //修复URL
  1790. fixurl: function (url) {
  1791. if (url.substr(0, 1) !== "/") {
  1792. var r = new RegExp('^(?:[a-z]+:)?//', 'i');
  1793. if (!r.test(url)) {
  1794. url = Config.moduleurl + "/" + url;
  1795. }
  1796. }
  1797. return url;
  1798. },
  1799. //获取修复后可访问的cdn链接
  1800. cdnurl: function (url) {
  1801. return /^(?:[a-z]+:)?\/\//i.test(url) ? url : Config.upload.cdnurl + url;
  1802. },
  1803. //查询Url参数
  1804. query: function (name, url) {
  1805. if (!url) {
  1806. url = window.location.href;
  1807. }
  1808. name = name.replace(/[\[\]]/g, "\\$&");
  1809. var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
  1810. results = regex.exec(url);
  1811. if (!results)
  1812. return null;
  1813. if (!results[2])
  1814. return '';
  1815. return decodeURIComponent(results[2].replace(/\+/g, " "));
  1816. },
  1817. //打开一个弹出窗口
  1818. open: function (url, title, options) {
  1819. title = title ? title : "";
  1820. url = Fast.api.fixurl(url);
  1821. url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
  1822. var area = [$(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%'];
  1823. Layer.open($.extend({
  1824. type: 2,
  1825. title: title,
  1826. shadeClose: true,
  1827. shade: false,
  1828. maxmin: true,
  1829. moveOut: true,
  1830. area: area,
  1831. content: url,
  1832. zIndex: Layer.zIndex,
  1833. skin: 'layui-layer-noborder',
  1834. success: function (layero, index) {
  1835. var that = this;
  1836. //存储callback事件
  1837. $(layero).data("callback", that.callback);
  1838. //$(layero).removeClass("layui-layer-border");
  1839. Layer.setTop(layero);
  1840. var frame = Layer.getChildFrame('html', index);
  1841. var layerfooter = frame.find(".layer-footer");
  1842. Fast.api.layerfooter(layero, index, that);
  1843. //绑定事件
  1844. if (layerfooter.size() > 0) {
  1845. // 监听窗口内的元素及属性变化
  1846. // Firefox和Chrome早期版本中带有前缀
  1847. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver
  1848. // 选择目标节点
  1849. var target = layerfooter[0];
  1850. // 创建观察者对象
  1851. var observer = new MutationObserver(function (mutations) {
  1852. Fast.api.layerfooter(layero, index, that);
  1853. mutations.forEach(function (mutation) {
  1854. });
  1855. });
  1856. // 配置观察选项:
  1857. var config = {attributes: true, childList: true, characterData: true, subtree: true}
  1858. // 传入目标节点和观察选项
  1859. observer.observe(target, config);
  1860. // 随后,你还可以停止观察
  1861. // observer.disconnect();
  1862. }
  1863. }
  1864. }, options ? options : {}));
  1865. return false;
  1866. },
  1867. //关闭窗口并回传数据
  1868. close: function (data) {
  1869. var index = parent.Layer.getFrameIndex(window.name);
  1870. var callback = parent.$("#layui-layer" + index).data("callback");
  1871. //再执行关闭
  1872. parent.Layer.close(index);
  1873. //再调用回传函数
  1874. if (typeof callback === 'function') {
  1875. callback.call(undefined, data);
  1876. }
  1877. },
  1878. layerfooter: function (layero, index, that) {
  1879. var frame = Layer.getChildFrame('html', index);
  1880. var layerfooter = frame.find(".layer-footer");
  1881. if (layerfooter.size() > 0) {
  1882. $(".layui-layer-footer", layero).remove();
  1883. var footer = $("<div />").addClass('layui-layer-btn layui-layer-footer');
  1884. footer.html(layerfooter.html());
  1885. if ($(".row", footer).size() === 0) {
  1886. $(">", footer).wrapAll("<div class='row'></div>");
  1887. }
  1888. footer.insertAfter(layero.find('.layui-layer-content'));
  1889. }
  1890. var heg = frame.outerHeight();
  1891. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  1892. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  1893. var oldheg = heg + titHeight + btnHeight;
  1894. var maxheg = $(window).height() < 600 ? $(window).height() : 600;
  1895. if (frame.outerWidth() < 768 || that.area[0].indexOf("%") > -1) {
  1896. maxheg = $(window).height();
  1897. }
  1898. // 如果有.layer-footer或窗口小于600则重新排
  1899. if (layerfooter.size() > 0 || oldheg < maxheg || that.area[0].indexOf("%") > -1) {
  1900. var footerHeight = layero.find('.layui-layer-footer').outerHeight() || 0;
  1901. footerHeight = 0;
  1902. if (oldheg >= maxheg) {
  1903. heg = Math.min(maxheg, oldheg) - titHeight - btnHeight - footerHeight;
  1904. }
  1905. layero.css({height: heg + titHeight + btnHeight + footerHeight});
  1906. layero.find("iframe").css({height: heg});
  1907. }
  1908. if (layerfooter.size() > 0) {
  1909. footer.on("click", ".btn", function () {
  1910. if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
  1911. return;
  1912. }
  1913. $(".btn:eq(" + $(this).index() + ")", layerfooter).trigger("click");
  1914. });
  1915. }
  1916. },
  1917. success: function (options, callback) {
  1918. var type = typeof options === 'function';
  1919. if (type) {
  1920. callback = options;
  1921. }
  1922. return Layer.msg(__('Operation completed'), $.extend({
  1923. offset: 0, icon: 1
  1924. }, type ? {} : options), callback);
  1925. },
  1926. error: function (options, callback) {
  1927. var type = typeof options === 'function';
  1928. if (type) {
  1929. callback = options;
  1930. }
  1931. return Layer.msg(__('Operation failed'), $.extend({
  1932. offset: 0, icon: 2
  1933. }, type ? {} : options), callback);
  1934. },
  1935. toastr: Toastr,
  1936. layer: Layer
  1937. },
  1938. lang: function () {
  1939. var args = arguments,
  1940. string = args[0],
  1941. i = 1;
  1942. string = string.toLowerCase();
  1943. //string = typeof Lang[string] != 'undefined' ? Lang[string] : string;
  1944. if (typeof Lang[string] != 'undefined') {
  1945. if (typeof Lang[string] == 'object')
  1946. return Lang[string];
  1947. string = Lang[string];
  1948. } else if (string.indexOf('.') !== -1 && false) {
  1949. var arr = string.split('.');
  1950. var current = Lang[arr[0]];
  1951. for (var i = 1; i < arr.length; i++) {
  1952. current = typeof current[arr[i]] != 'undefined' ? current[arr[i]] : '';
  1953. if (typeof current != 'object')
  1954. break;
  1955. }
  1956. if (typeof current == 'object')
  1957. return current;
  1958. string = current;
  1959. } else {
  1960. string = args[0];
  1961. }
  1962. return string.replace(/%((%)|s|d)/g, function (m) {
  1963. // m is the matched format, e.g. %s, %d
  1964. var val = null;
  1965. if (m[2]) {
  1966. val = m[2];
  1967. } else {
  1968. val = args[i];
  1969. // A switch statement so that the formatter can be extended. Default is %s
  1970. switch (m) {
  1971. case '%d':
  1972. val = parseFloat(val);
  1973. if (isNaN(val)) {
  1974. val = 0;
  1975. }
  1976. break;
  1977. }
  1978. i++;
  1979. }
  1980. return val;
  1981. });
  1982. },
  1983. init: function () {
  1984. // 对相对地址进行处理
  1985. $.ajaxSetup({
  1986. beforeSend: function (xhr, setting) {
  1987. setting.url = Fast.api.fixurl(setting.url);
  1988. }
  1989. });
  1990. // 绑定ESC关闭窗口事件
  1991. $(window).keyup(function (e) {
  1992. if (e.keyCode == 27) {
  1993. if ($(".layui-layer").size() > 0) {
  1994. var index = 0;
  1995. $(".layui-layer").each(function () {
  1996. index = Math.max(index, parseInt($(this).attr("times")));
  1997. });
  1998. if (index) {
  1999. Layer.close(index);
  2000. }
  2001. }
  2002. }
  2003. });
  2004. //公共代码
  2005. //配置Toastr的参数
  2006. Toastr.options = Fast.config.toastr;
  2007. }
  2008. };
  2009. //将Layer暴露到全局中去
  2010. window.Layer = Layer;
  2011. //将Toastr暴露到全局中去
  2012. window.Toastr = Toastr;
  2013. //将语言方法暴露到全局中去
  2014. window.__ = Fast.lang;
  2015. //将Fast渲染至全局
  2016. window.Fast = Fast;
  2017. //默认初始化执行的代码
  2018. Fast.init();
  2019. return Fast;
  2020. });
  2021. //! moment.js
  2022. //! version : 2.18.1
  2023. //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
  2024. //! license : MIT
  2025. //! momentjs.com
  2026. ;(function (global, factory) {
  2027. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  2028. typeof define === 'function' && define.amd ? define('moment/moment',factory) :
  2029. global.moment = factory()
  2030. }(this, (function () { 'use strict';
  2031. var hookCallback;
  2032. function hooks () {
  2033. return hookCallback.apply(null, arguments);
  2034. }
  2035. // This is done to register the method called with moment()
  2036. // without creating circular dependencies.
  2037. function setHookCallback (callback) {
  2038. hookCallback = callback;
  2039. }
  2040. function isArray(input) {
  2041. return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
  2042. }
  2043. function isObject(input) {
  2044. // IE8 will treat undefined and null as object if it wasn't for
  2045. // input != null
  2046. return input != null && Object.prototype.toString.call(input) === '[object Object]';
  2047. }
  2048. function isObjectEmpty(obj) {
  2049. var k;
  2050. for (k in obj) {
  2051. // even if its not own property I'd still call it non-empty
  2052. return false;
  2053. }
  2054. return true;
  2055. }
  2056. function isUndefined(input) {
  2057. return input === void 0;
  2058. }
  2059. function isNumber(input) {
  2060. return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
  2061. }
  2062. function isDate(input) {
  2063. return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
  2064. }
  2065. function map(arr, fn) {
  2066. var res = [], i;
  2067. for (i = 0; i < arr.length; ++i) {
  2068. res.push(fn(arr[i], i));
  2069. }
  2070. return res;
  2071. }
  2072. function hasOwnProp(a, b) {
  2073. return Object.prototype.hasOwnProperty.call(a, b);
  2074. }
  2075. function extend(a, b) {
  2076. for (var i in b) {
  2077. if (hasOwnProp(b, i)) {
  2078. a[i] = b[i];
  2079. }
  2080. }
  2081. if (hasOwnProp(b, 'toString')) {
  2082. a.toString = b.toString;
  2083. }
  2084. if (hasOwnProp(b, 'valueOf')) {
  2085. a.valueOf = b.valueOf;
  2086. }
  2087. return a;
  2088. }
  2089. function createUTC (input, format, locale, strict) {
  2090. return createLocalOrUTC(input, format, locale, strict, true).utc();
  2091. }
  2092. function defaultParsingFlags() {
  2093. // We need to deep clone this object.
  2094. return {
  2095. empty : false,
  2096. unusedTokens : [],
  2097. unusedInput : [],
  2098. overflow : -2,
  2099. charsLeftOver : 0,
  2100. nullInput : false,
  2101. invalidMonth : null,
  2102. invalidFormat : false,
  2103. userInvalidated : false,
  2104. iso : false,
  2105. parsedDateParts : [],
  2106. meridiem : null,
  2107. rfc2822 : false,
  2108. weekdayMismatch : false
  2109. };
  2110. }
  2111. function getParsingFlags(m) {
  2112. if (m._pf == null) {
  2113. m._pf = defaultParsingFlags();
  2114. }
  2115. return m._pf;
  2116. }
  2117. var some;
  2118. if (Array.prototype.some) {
  2119. some = Array.prototype.some;
  2120. } else {
  2121. some = function (fun) {
  2122. var t = Object(this);
  2123. var len = t.length >>> 0;
  2124. for (var i = 0; i < len; i++) {
  2125. if (i in t && fun.call(this, t[i], i, t)) {
  2126. return true;
  2127. }
  2128. }
  2129. return false;
  2130. };
  2131. }
  2132. var some$1 = some;
  2133. function isValid(m) {
  2134. if (m._isValid == null) {
  2135. var flags = getParsingFlags(m);
  2136. var parsedParts = some$1.call(flags.parsedDateParts, function (i) {
  2137. return i != null;
  2138. });
  2139. var isNowValid = !isNaN(m._d.getTime()) &&
  2140. flags.overflow < 0 &&
  2141. !flags.empty &&
  2142. !flags.invalidMonth &&
  2143. !flags.invalidWeekday &&
  2144. !flags.nullInput &&
  2145. !flags.invalidFormat &&
  2146. !flags.userInvalidated &&
  2147. (!flags.meridiem || (flags.meridiem && parsedParts));
  2148. if (m._strict) {
  2149. isNowValid = isNowValid &&
  2150. flags.charsLeftOver === 0 &&
  2151. flags.unusedTokens.length === 0 &&
  2152. flags.bigHour === undefined;
  2153. }
  2154. if (Object.isFrozen == null || !Object.isFrozen(m)) {
  2155. m._isValid = isNowValid;
  2156. }
  2157. else {
  2158. return isNowValid;
  2159. }
  2160. }
  2161. return m._isValid;
  2162. }
  2163. function createInvalid (flags) {
  2164. var m = createUTC(NaN);
  2165. if (flags != null) {
  2166. extend(getParsingFlags(m), flags);
  2167. }
  2168. else {
  2169. getParsingFlags(m).userInvalidated = true;
  2170. }
  2171. return m;
  2172. }
  2173. // Plugins that add properties should also add the key here (null value),
  2174. // so we can properly clone ourselves.
  2175. var momentProperties = hooks.momentProperties = [];
  2176. function copyConfig(to, from) {
  2177. var i, prop, val;
  2178. if (!isUndefined(from._isAMomentObject)) {
  2179. to._isAMomentObject = from._isAMomentObject;
  2180. }
  2181. if (!isUndefined(from._i)) {
  2182. to._i = from._i;
  2183. }
  2184. if (!isUndefined(from._f)) {
  2185. to._f = from._f;
  2186. }
  2187. if (!isUndefined(from._l)) {
  2188. to._l = from._l;
  2189. }
  2190. if (!isUndefined(from._strict)) {
  2191. to._strict = from._strict;
  2192. }
  2193. if (!isUndefined(from._tzm)) {
  2194. to._tzm = from._tzm;
  2195. }
  2196. if (!isUndefined(from._isUTC)) {
  2197. to._isUTC = from._isUTC;
  2198. }
  2199. if (!isUndefined(from._offset)) {
  2200. to._offset = from._offset;
  2201. }
  2202. if (!isUndefined(from._pf)) {
  2203. to._pf = getParsingFlags(from);
  2204. }
  2205. if (!isUndefined(from._locale)) {
  2206. to._locale = from._locale;
  2207. }
  2208. if (momentProperties.length > 0) {
  2209. for (i = 0; i < momentProperties.length; i++) {
  2210. prop = momentProperties[i];
  2211. val = from[prop];
  2212. if (!isUndefined(val)) {
  2213. to[prop] = val;
  2214. }
  2215. }
  2216. }
  2217. return to;
  2218. }
  2219. var updateInProgress = false;
  2220. // Moment prototype object
  2221. function Moment(config) {
  2222. copyConfig(this, config);
  2223. this._d = new Date(config._d != null ? config._d.getTime() : NaN);
  2224. if (!this.isValid()) {
  2225. this._d = new Date(NaN);
  2226. }
  2227. // Prevent infinite loop in case updateOffset creates new moment
  2228. // objects.
  2229. if (updateInProgress === false) {
  2230. updateInProgress = true;
  2231. hooks.updateOffset(this);
  2232. updateInProgress = false;
  2233. }
  2234. }
  2235. function isMoment (obj) {
  2236. return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
  2237. }
  2238. function absFloor (number) {
  2239. if (number < 0) {
  2240. // -0 -> 0
  2241. return Math.ceil(number) || 0;
  2242. } else {
  2243. return Math.floor(number);
  2244. }
  2245. }
  2246. function toInt(argumentForCoercion) {
  2247. var coercedNumber = +argumentForCoercion,
  2248. value = 0;
  2249. if (coercedNumber !== 0 && isFinite(coercedNumber)) {
  2250. value = absFloor(coercedNumber);
  2251. }
  2252. return value;
  2253. }
  2254. // compare two arrays, return the number of differences
  2255. function compareArrays(array1, array2, dontConvert) {
  2256. var len = Math.min(array1.length, array2.length),
  2257. lengthDiff = Math.abs(array1.length - array2.length),
  2258. diffs = 0,
  2259. i;
  2260. for (i = 0; i < len; i++) {
  2261. if ((dontConvert && array1[i] !== array2[i]) ||
  2262. (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
  2263. diffs++;
  2264. }
  2265. }
  2266. return diffs + lengthDiff;
  2267. }
  2268. function warn(msg) {
  2269. if (hooks.suppressDeprecationWarnings === false &&
  2270. (typeof console !== 'undefined') && console.warn) {
  2271. console.warn('Deprecation warning: ' + msg);
  2272. }
  2273. }
  2274. function deprecate(msg, fn) {
  2275. var firstTime = true;
  2276. return extend(function () {
  2277. if (hooks.deprecationHandler != null) {
  2278. hooks.deprecationHandler(null, msg);
  2279. }
  2280. if (firstTime) {
  2281. var args = [];
  2282. var arg;
  2283. for (var i = 0; i < arguments.length; i++) {
  2284. arg = '';
  2285. if (typeof arguments[i] === 'object') {
  2286. arg += '\n[' + i + '] ';
  2287. for (var key in arguments[0]) {
  2288. arg += key + ': ' + arguments[0][key] + ', ';
  2289. }
  2290. arg = arg.slice(0, -2); // Remove trailing comma and space
  2291. } else {
  2292. arg = arguments[i];
  2293. }
  2294. args.push(arg);
  2295. }
  2296. warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack);
  2297. firstTime = false;
  2298. }
  2299. return fn.apply(this, arguments);
  2300. }, fn);
  2301. }
  2302. var deprecations = {};
  2303. function deprecateSimple(name, msg) {
  2304. if (hooks.deprecationHandler != null) {
  2305. hooks.deprecationHandler(name, msg);
  2306. }
  2307. if (!deprecations[name]) {
  2308. warn(msg);
  2309. deprecations[name] = true;
  2310. }
  2311. }
  2312. hooks.suppressDeprecationWarnings = false;
  2313. hooks.deprecationHandler = null;
  2314. function isFunction(input) {
  2315. return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
  2316. }
  2317. function set (config) {
  2318. var prop, i;
  2319. for (i in config) {
  2320. prop = config[i];
  2321. if (isFunction(prop)) {
  2322. this[i] = prop;
  2323. } else {
  2324. this['_' + i] = prop;
  2325. }
  2326. }
  2327. this._config = config;
  2328. // Lenient ordinal parsing accepts just a number in addition to
  2329. // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
  2330. // TODO: Remove "ordinalParse" fallback in next major release.
  2331. this._dayOfMonthOrdinalParseLenient = new RegExp(
  2332. (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
  2333. '|' + (/\d{1,2}/).source);
  2334. }
  2335. function mergeConfigs(parentConfig, childConfig) {
  2336. var res = extend({}, parentConfig), prop;
  2337. for (prop in childConfig) {
  2338. if (hasOwnProp(childConfig, prop)) {
  2339. if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
  2340. res[prop] = {};
  2341. extend(res[prop], parentConfig[prop]);
  2342. extend(res[prop], childConfig[prop]);
  2343. } else if (childConfig[prop] != null) {
  2344. res[prop] = childConfig[prop];
  2345. } else {
  2346. delete res[prop];
  2347. }
  2348. }
  2349. }
  2350. for (prop in parentConfig) {
  2351. if (hasOwnProp(parentConfig, prop) &&
  2352. !hasOwnProp(childConfig, prop) &&
  2353. isObject(parentConfig[prop])) {
  2354. // make sure changes to properties don't modify parent config
  2355. res[prop] = extend({}, res[prop]);
  2356. }
  2357. }
  2358. return res;
  2359. }
  2360. function Locale(config) {
  2361. if (config != null) {
  2362. this.set(config);
  2363. }
  2364. }
  2365. var keys;
  2366. if (Object.keys) {
  2367. keys = Object.keys;
  2368. } else {
  2369. keys = function (obj) {
  2370. var i, res = [];
  2371. for (i in obj) {
  2372. if (hasOwnProp(obj, i)) {
  2373. res.push(i);
  2374. }
  2375. }
  2376. return res;
  2377. };
  2378. }
  2379. var keys$1 = keys;
  2380. var defaultCalendar = {
  2381. sameDay : '[Today at] LT',
  2382. nextDay : '[Tomorrow at] LT',
  2383. nextWeek : 'dddd [at] LT',
  2384. lastDay : '[Yesterday at] LT',
  2385. lastWeek : '[Last] dddd [at] LT',
  2386. sameElse : 'L'
  2387. };
  2388. function calendar (key, mom, now) {
  2389. var output = this._calendar[key] || this._calendar['sameElse'];
  2390. return isFunction(output) ? output.call(mom, now) : output;
  2391. }
  2392. var defaultLongDateFormat = {
  2393. LTS : 'h:mm:ss A',
  2394. LT : 'h:mm A',
  2395. L : 'MM/DD/YYYY',
  2396. LL : 'MMMM D, YYYY',
  2397. LLL : 'MMMM D, YYYY h:mm A',
  2398. LLLL : 'dddd, MMMM D, YYYY h:mm A'
  2399. };
  2400. function longDateFormat (key) {
  2401. var format = this._longDateFormat[key],
  2402. formatUpper = this._longDateFormat[key.toUpperCase()];
  2403. if (format || !formatUpper) {
  2404. return format;
  2405. }
  2406. this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
  2407. return val.slice(1);
  2408. });
  2409. return this._longDateFormat[key];
  2410. }
  2411. var defaultInvalidDate = 'Invalid date';
  2412. function invalidDate () {
  2413. return this._invalidDate;
  2414. }
  2415. var defaultOrdinal = '%d';
  2416. var defaultDayOfMonthOrdinalParse = /\d{1,2}/;
  2417. function ordinal (number) {
  2418. return this._ordinal.replace('%d', number);
  2419. }
  2420. var defaultRelativeTime = {
  2421. future : 'in %s',
  2422. past : '%s ago',
  2423. s : 'a few seconds',
  2424. ss : '%d seconds',
  2425. m : 'a minute',
  2426. mm : '%d minutes',
  2427. h : 'an hour',
  2428. hh : '%d hours',
  2429. d : 'a day',
  2430. dd : '%d days',
  2431. M : 'a month',
  2432. MM : '%d months',
  2433. y : 'a year',
  2434. yy : '%d years'
  2435. };
  2436. function relativeTime (number, withoutSuffix, string, isFuture) {
  2437. var output = this._relativeTime[string];
  2438. return (isFunction(output)) ?
  2439. output(number, withoutSuffix, string, isFuture) :
  2440. output.replace(/%d/i, number);
  2441. }
  2442. function pastFuture (diff, output) {
  2443. var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
  2444. return isFunction(format) ? format(output) : format.replace(/%s/i, output);
  2445. }
  2446. var aliases = {};
  2447. function addUnitAlias (unit, shorthand) {
  2448. var lowerCase = unit.toLowerCase();
  2449. aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
  2450. }
  2451. function normalizeUnits(units) {
  2452. return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
  2453. }
  2454. function normalizeObjectUnits(inputObject) {
  2455. var normalizedInput = {},
  2456. normalizedProp,
  2457. prop;
  2458. for (prop in inputObject) {
  2459. if (hasOwnProp(inputObject, prop)) {
  2460. normalizedProp = normalizeUnits(prop);
  2461. if (normalizedProp) {
  2462. normalizedInput[normalizedProp] = inputObject[prop];
  2463. }
  2464. }
  2465. }
  2466. return normalizedInput;
  2467. }
  2468. var priorities = {};
  2469. function addUnitPriority(unit, priority) {
  2470. priorities[unit] = priority;
  2471. }
  2472. function getPrioritizedUnits(unitsObj) {
  2473. var units = [];
  2474. for (var u in unitsObj) {
  2475. units.push({unit: u, priority: priorities[u]});
  2476. }
  2477. units.sort(function (a, b) {
  2478. return a.priority - b.priority;
  2479. });
  2480. return units;
  2481. }
  2482. function makeGetSet (unit, keepTime) {
  2483. return function (value) {
  2484. if (value != null) {
  2485. set$1(this, unit, value);
  2486. hooks.updateOffset(this, keepTime);
  2487. return this;
  2488. } else {
  2489. return get(this, unit);
  2490. }
  2491. };
  2492. }
  2493. function get (mom, unit) {
  2494. return mom.isValid() ?
  2495. mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
  2496. }
  2497. function set$1 (mom, unit, value) {
  2498. if (mom.isValid()) {
  2499. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
  2500. }
  2501. }
  2502. // MOMENTS
  2503. function stringGet (units) {
  2504. units = normalizeUnits(units);
  2505. if (isFunction(this[units])) {
  2506. return this[units]();
  2507. }
  2508. return this;
  2509. }
  2510. function stringSet (units, value) {
  2511. if (typeof units === 'object') {
  2512. units = normalizeObjectUnits(units);
  2513. var prioritized = getPrioritizedUnits(units);
  2514. for (var i = 0; i < prioritized.length; i++) {
  2515. this[prioritized[i].unit](units[prioritized[i].unit]);
  2516. }
  2517. } else {
  2518. units = normalizeUnits(units);
  2519. if (isFunction(this[units])) {
  2520. return this[units](value);
  2521. }
  2522. }
  2523. return this;
  2524. }
  2525. function zeroFill(number, targetLength, forceSign) {
  2526. var absNumber = '' + Math.abs(number),
  2527. zerosToFill = targetLength - absNumber.length,
  2528. sign = number >= 0;
  2529. return (sign ? (forceSign ? '+' : '') : '-') +
  2530. Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
  2531. }
  2532. 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;
  2533. var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
  2534. var formatFunctions = {};
  2535. var formatTokenFunctions = {};
  2536. // token: 'M'
  2537. // padded: ['MM', 2]
  2538. // ordinal: 'Mo'
  2539. // callback: function () { this.month() + 1 }
  2540. function addFormatToken (token, padded, ordinal, callback) {
  2541. var func = callback;
  2542. if (typeof callback === 'string') {
  2543. func = function () {
  2544. return this[callback]();
  2545. };
  2546. }
  2547. if (token) {
  2548. formatTokenFunctions[token] = func;
  2549. }
  2550. if (padded) {
  2551. formatTokenFunctions[padded[0]] = function () {
  2552. return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
  2553. };
  2554. }
  2555. if (ordinal) {
  2556. formatTokenFunctions[ordinal] = function () {
  2557. return this.localeData().ordinal(func.apply(this, arguments), token);
  2558. };
  2559. }
  2560. }
  2561. function removeFormattingTokens(input) {
  2562. if (input.match(/\[[\s\S]/)) {
  2563. return input.replace(/^\[|\]$/g, '');
  2564. }
  2565. return input.replace(/\\/g, '');
  2566. }
  2567. function makeFormatFunction(format) {
  2568. var array = format.match(formattingTokens), i, length;
  2569. for (i = 0, length = array.length; i < length; i++) {
  2570. if (formatTokenFunctions[array[i]]) {
  2571. array[i] = formatTokenFunctions[array[i]];
  2572. } else {
  2573. array[i] = removeFormattingTokens(array[i]);
  2574. }
  2575. }
  2576. return function (mom) {
  2577. var output = '', i;
  2578. for (i = 0; i < length; i++) {
  2579. output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
  2580. }
  2581. return output;
  2582. };
  2583. }
  2584. // format date using native date object
  2585. function formatMoment(m, format) {
  2586. if (!m.isValid()) {
  2587. return m.localeData().invalidDate();
  2588. }
  2589. format = expandFormat(format, m.localeData());
  2590. formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
  2591. return formatFunctions[format](m);
  2592. }
  2593. function expandFormat(format, locale) {
  2594. var i = 5;
  2595. function replaceLongDateFormatTokens(input) {
  2596. return locale.longDateFormat(input) || input;
  2597. }
  2598. localFormattingTokens.lastIndex = 0;
  2599. while (i >= 0 && localFormattingTokens.test(format)) {
  2600. format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
  2601. localFormattingTokens.lastIndex = 0;
  2602. i -= 1;
  2603. }
  2604. return format;
  2605. }
  2606. var match1 = /\d/; // 0 - 9
  2607. var match2 = /\d\d/; // 00 - 99
  2608. var match3 = /\d{3}/; // 000 - 999
  2609. var match4 = /\d{4}/; // 0000 - 9999
  2610. var match6 = /[+-]?\d{6}/; // -999999 - 999999
  2611. var match1to2 = /\d\d?/; // 0 - 99
  2612. var match3to4 = /\d\d\d\d?/; // 999 - 9999
  2613. var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
  2614. var match1to3 = /\d{1,3}/; // 0 - 999
  2615. var match1to4 = /\d{1,4}/; // 0 - 9999
  2616. var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
  2617. var matchUnsigned = /\d+/; // 0 - inf
  2618. var matchSigned = /[+-]?\d+/; // -inf - inf
  2619. var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
  2620. var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
  2621. var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
  2622. // any word (or two) characters or numbers including two/three word month in arabic.
  2623. // includes scottish gaelic two word and hyphenated months
  2624. var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
  2625. var regexes = {};
  2626. function addRegexToken (token, regex, strictRegex) {
  2627. regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
  2628. return (isStrict && strictRegex) ? strictRegex : regex;
  2629. };
  2630. }
  2631. function getParseRegexForToken (token, config) {
  2632. if (!hasOwnProp(regexes, token)) {
  2633. return new RegExp(unescapeFormat(token));
  2634. }
  2635. return regexes[token](config._strict, config._locale);
  2636. }
  2637. // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
  2638. function unescapeFormat(s) {
  2639. return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
  2640. return p1 || p2 || p3 || p4;
  2641. }));
  2642. }
  2643. function regexEscape(s) {
  2644. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  2645. }
  2646. var tokens = {};
  2647. function addParseToken (token, callback) {
  2648. var i, func = callback;
  2649. if (typeof token === 'string') {
  2650. token = [token];
  2651. }
  2652. if (isNumber(callback)) {
  2653. func = function (input, array) {
  2654. array[callback] = toInt(input);
  2655. };
  2656. }
  2657. for (i = 0; i < token.length; i++) {
  2658. tokens[token[i]] = func;
  2659. }
  2660. }
  2661. function addWeekParseToken (token, callback) {
  2662. addParseToken(token, function (input, array, config, token) {
  2663. config._w = config._w || {};
  2664. callback(input, config._w, config, token);
  2665. });
  2666. }
  2667. function addTimeToArrayFromToken(token, input, config) {
  2668. if (input != null && hasOwnProp(tokens, token)) {
  2669. tokens[token](input, config._a, config, token);
  2670. }
  2671. }
  2672. var YEAR = 0;
  2673. var MONTH = 1;
  2674. var DATE = 2;
  2675. var HOUR = 3;
  2676. var MINUTE = 4;
  2677. var SECOND = 5;
  2678. var MILLISECOND = 6;
  2679. var WEEK = 7;
  2680. var WEEKDAY = 8;
  2681. var indexOf;
  2682. if (Array.prototype.indexOf) {
  2683. indexOf = Array.prototype.indexOf;
  2684. } else {
  2685. indexOf = function (o) {
  2686. // I know
  2687. var i;
  2688. for (i = 0; i < this.length; ++i) {
  2689. if (this[i] === o) {
  2690. return i;
  2691. }
  2692. }
  2693. return -1;
  2694. };
  2695. }
  2696. var indexOf$1 = indexOf;
  2697. function daysInMonth(year, month) {
  2698. return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
  2699. }
  2700. // FORMATTING
  2701. addFormatToken('M', ['MM', 2], 'Mo', function () {
  2702. return this.month() + 1;
  2703. });
  2704. addFormatToken('MMM', 0, 0, function (format) {
  2705. return this.localeData().monthsShort(this, format);
  2706. });
  2707. addFormatToken('MMMM', 0, 0, function (format) {
  2708. return this.localeData().months(this, format);
  2709. });
  2710. // ALIASES
  2711. addUnitAlias('month', 'M');
  2712. // PRIORITY
  2713. addUnitPriority('month', 8);
  2714. // PARSING
  2715. addRegexToken('M', match1to2);
  2716. addRegexToken('MM', match1to2, match2);
  2717. addRegexToken('MMM', function (isStrict, locale) {
  2718. return locale.monthsShortRegex(isStrict);
  2719. });
  2720. addRegexToken('MMMM', function (isStrict, locale) {
  2721. return locale.monthsRegex(isStrict);
  2722. });
  2723. addParseToken(['M', 'MM'], function (input, array) {
  2724. array[MONTH] = toInt(input) - 1;
  2725. });
  2726. addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
  2727. var month = config._locale.monthsParse(input, token, config._strict);
  2728. // if we didn't find a month name, mark the date as invalid.
  2729. if (month != null) {
  2730. array[MONTH] = month;
  2731. } else {
  2732. getParsingFlags(config).invalidMonth = input;
  2733. }
  2734. });
  2735. // LOCALES
  2736. var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
  2737. var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
  2738. function localeMonths (m, format) {
  2739. if (!m) {
  2740. return isArray(this._months) ? this._months :
  2741. this._months['standalone'];
  2742. }
  2743. return isArray(this._months) ? this._months[m.month()] :
  2744. this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
  2745. }
  2746. var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
  2747. function localeMonthsShort (m, format) {
  2748. if (!m) {
  2749. return isArray(this._monthsShort) ? this._monthsShort :
  2750. this._monthsShort['standalone'];
  2751. }
  2752. return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
  2753. this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
  2754. }
  2755. function handleStrictParse(monthName, format, strict) {
  2756. var i, ii, mom, llc = monthName.toLocaleLowerCase();
  2757. if (!this._monthsParse) {
  2758. // this is not used
  2759. this._monthsParse = [];
  2760. this._longMonthsParse = [];
  2761. this._shortMonthsParse = [];
  2762. for (i = 0; i < 12; ++i) {
  2763. mom = createUTC([2000, i]);
  2764. this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
  2765. this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
  2766. }
  2767. }
  2768. if (strict) {
  2769. if (format === 'MMM') {
  2770. ii = indexOf$1.call(this._shortMonthsParse, llc);
  2771. return ii !== -1 ? ii : null;
  2772. } else {
  2773. ii = indexOf$1.call(this._longMonthsParse, llc);
  2774. return ii !== -1 ? ii : null;
  2775. }
  2776. } else {
  2777. if (format === 'MMM') {
  2778. ii = indexOf$1.call(this._shortMonthsParse, llc);
  2779. if (ii !== -1) {
  2780. return ii;
  2781. }
  2782. ii = indexOf$1.call(this._longMonthsParse, llc);
  2783. return ii !== -1 ? ii : null;
  2784. } else {
  2785. ii = indexOf$1.call(this._longMonthsParse, llc);
  2786. if (ii !== -1) {
  2787. return ii;
  2788. }
  2789. ii = indexOf$1.call(this._shortMonthsParse, llc);
  2790. return ii !== -1 ? ii : null;
  2791. }
  2792. }
  2793. }
  2794. function localeMonthsParse (monthName, format, strict) {
  2795. var i, mom, regex;
  2796. if (this._monthsParseExact) {
  2797. return handleStrictParse.call(this, monthName, format, strict);
  2798. }
  2799. if (!this._monthsParse) {
  2800. this._monthsParse = [];
  2801. this._longMonthsParse = [];
  2802. this._shortMonthsParse = [];
  2803. }
  2804. // TODO: add sorting
  2805. // Sorting makes sure if one month (or abbr) is a prefix of another
  2806. // see sorting in computeMonthsParse
  2807. for (i = 0; i < 12; i++) {
  2808. // make the regex if we don't have it already
  2809. mom = createUTC([2000, i]);
  2810. if (strict && !this._longMonthsParse[i]) {
  2811. this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
  2812. this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
  2813. }
  2814. if (!strict && !this._monthsParse[i]) {
  2815. regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
  2816. this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
  2817. }
  2818. // test the regex
  2819. if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
  2820. return i;
  2821. } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
  2822. return i;
  2823. } else if (!strict && this._monthsParse[i].test(monthName)) {
  2824. return i;
  2825. }
  2826. }
  2827. }
  2828. // MOMENTS
  2829. function setMonth (mom, value) {
  2830. var dayOfMonth;
  2831. if (!mom.isValid()) {
  2832. // No op
  2833. return mom;
  2834. }
  2835. if (typeof value === 'string') {
  2836. if (/^\d+$/.test(value)) {
  2837. value = toInt(value);
  2838. } else {
  2839. value = mom.localeData().monthsParse(value);
  2840. // TODO: Another silent failure?
  2841. if (!isNumber(value)) {
  2842. return mom;
  2843. }
  2844. }
  2845. }
  2846. dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
  2847. mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
  2848. return mom;
  2849. }
  2850. function getSetMonth (value) {
  2851. if (value != null) {
  2852. setMonth(this, value);
  2853. hooks.updateOffset(this, true);
  2854. return this;
  2855. } else {
  2856. return get(this, 'Month');
  2857. }
  2858. }
  2859. function getDaysInMonth () {
  2860. return daysInMonth(this.year(), this.month());
  2861. }
  2862. var defaultMonthsShortRegex = matchWord;
  2863. function monthsShortRegex (isStrict) {
  2864. if (this._monthsParseExact) {
  2865. if (!hasOwnProp(this, '_monthsRegex')) {
  2866. computeMonthsParse.call(this);
  2867. }
  2868. if (isStrict) {
  2869. return this._monthsShortStrictRegex;
  2870. } else {
  2871. return this._monthsShortRegex;
  2872. }
  2873. } else {
  2874. if (!hasOwnProp(this, '_monthsShortRegex')) {
  2875. this._monthsShortRegex = defaultMonthsShortRegex;
  2876. }
  2877. return this._monthsShortStrictRegex && isStrict ?
  2878. this._monthsShortStrictRegex : this._monthsShortRegex;
  2879. }
  2880. }
  2881. var defaultMonthsRegex = matchWord;
  2882. function monthsRegex (isStrict) {
  2883. if (this._monthsParseExact) {
  2884. if (!hasOwnProp(this, '_monthsRegex')) {
  2885. computeMonthsParse.call(this);
  2886. }
  2887. if (isStrict) {
  2888. return this._monthsStrictRegex;
  2889. } else {
  2890. return this._monthsRegex;
  2891. }
  2892. } else {
  2893. if (!hasOwnProp(this, '_monthsRegex')) {
  2894. this._monthsRegex = defaultMonthsRegex;
  2895. }
  2896. return this._monthsStrictRegex && isStrict ?
  2897. this._monthsStrictRegex : this._monthsRegex;
  2898. }
  2899. }
  2900. function computeMonthsParse () {
  2901. function cmpLenRev(a, b) {
  2902. return b.length - a.length;
  2903. }
  2904. var shortPieces = [], longPieces = [], mixedPieces = [],
  2905. i, mom;
  2906. for (i = 0; i < 12; i++) {
  2907. // make the regex if we don't have it already
  2908. mom = createUTC([2000, i]);
  2909. shortPieces.push(this.monthsShort(mom, ''));
  2910. longPieces.push(this.months(mom, ''));
  2911. mixedPieces.push(this.months(mom, ''));
  2912. mixedPieces.push(this.monthsShort(mom, ''));
  2913. }
  2914. // Sorting makes sure if one month (or abbr) is a prefix of another it
  2915. // will match the longer piece.
  2916. shortPieces.sort(cmpLenRev);
  2917. longPieces.sort(cmpLenRev);
  2918. mixedPieces.sort(cmpLenRev);
  2919. for (i = 0; i < 12; i++) {
  2920. shortPieces[i] = regexEscape(shortPieces[i]);
  2921. longPieces[i] = regexEscape(longPieces[i]);
  2922. }
  2923. for (i = 0; i < 24; i++) {
  2924. mixedPieces[i] = regexEscape(mixedPieces[i]);
  2925. }
  2926. this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  2927. this._monthsShortRegex = this._monthsRegex;
  2928. this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
  2929. this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
  2930. }
  2931. // FORMATTING
  2932. addFormatToken('Y', 0, 0, function () {
  2933. var y = this.year();
  2934. return y <= 9999 ? '' + y : '+' + y;
  2935. });
  2936. addFormatToken(0, ['YY', 2], 0, function () {
  2937. return this.year() % 100;
  2938. });
  2939. addFormatToken(0, ['YYYY', 4], 0, 'year');
  2940. addFormatToken(0, ['YYYYY', 5], 0, 'year');
  2941. addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
  2942. // ALIASES
  2943. addUnitAlias('year', 'y');
  2944. // PRIORITIES
  2945. addUnitPriority('year', 1);
  2946. // PARSING
  2947. addRegexToken('Y', matchSigned);
  2948. addRegexToken('YY', match1to2, match2);
  2949. addRegexToken('YYYY', match1to4, match4);
  2950. addRegexToken('YYYYY', match1to6, match6);
  2951. addRegexToken('YYYYYY', match1to6, match6);
  2952. addParseToken(['YYYYY', 'YYYYYY'], YEAR);
  2953. addParseToken('YYYY', function (input, array) {
  2954. array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
  2955. });
  2956. addParseToken('YY', function (input, array) {
  2957. array[YEAR] = hooks.parseTwoDigitYear(input);
  2958. });
  2959. addParseToken('Y', function (input, array) {
  2960. array[YEAR] = parseInt(input, 10);
  2961. });
  2962. // HELPERS
  2963. function daysInYear(year) {
  2964. return isLeapYear(year) ? 366 : 365;
  2965. }
  2966. function isLeapYear(year) {
  2967. return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
  2968. }
  2969. // HOOKS
  2970. hooks.parseTwoDigitYear = function (input) {
  2971. return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
  2972. };
  2973. // MOMENTS
  2974. var getSetYear = makeGetSet('FullYear', true);
  2975. function getIsLeapYear () {
  2976. return isLeapYear(this.year());
  2977. }
  2978. function createDate (y, m, d, h, M, s, ms) {
  2979. // can't just apply() to create a date:
  2980. // https://stackoverflow.com/q/181348
  2981. var date = new Date(y, m, d, h, M, s, ms);
  2982. // the date constructor remaps years 0-99 to 1900-1999
  2983. if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
  2984. date.setFullYear(y);
  2985. }
  2986. return date;
  2987. }
  2988. function createUTCDate (y) {
  2989. var date = new Date(Date.UTC.apply(null, arguments));
  2990. // the Date.UTC function remaps years 0-99 to 1900-1999
  2991. if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
  2992. date.setUTCFullYear(y);
  2993. }
  2994. return date;
  2995. }
  2996. // start-of-first-week - start-of-year
  2997. function firstWeekOffset(year, dow, doy) {
  2998. var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
  2999. fwd = 7 + dow - doy,
  3000. // first-week day local weekday -- which local weekday is fwd
  3001. fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  3002. return -fwdlw + fwd - 1;
  3003. }
  3004. // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
  3005. function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  3006. var localWeekday = (7 + weekday - dow) % 7,
  3007. weekOffset = firstWeekOffset(year, dow, doy),
  3008. dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
  3009. resYear, resDayOfYear;
  3010. if (dayOfYear <= 0) {
  3011. resYear = year - 1;
  3012. resDayOfYear = daysInYear(resYear) + dayOfYear;
  3013. } else if (dayOfYear > daysInYear(year)) {
  3014. resYear = year + 1;
  3015. resDayOfYear = dayOfYear - daysInYear(year);
  3016. } else {
  3017. resYear = year;
  3018. resDayOfYear = dayOfYear;
  3019. }
  3020. return {
  3021. year: resYear,
  3022. dayOfYear: resDayOfYear
  3023. };
  3024. }
  3025. function weekOfYear(mom, dow, doy) {
  3026. var weekOffset = firstWeekOffset(mom.year(), dow, doy),
  3027. week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
  3028. resWeek, resYear;
  3029. if (week < 1) {
  3030. resYear = mom.year() - 1;
  3031. resWeek = week + weeksInYear(resYear, dow, doy);
  3032. } else if (week > weeksInYear(mom.year(), dow, doy)) {
  3033. resWeek = week - weeksInYear(mom.year(), dow, doy);
  3034. resYear = mom.year() + 1;
  3035. } else {
  3036. resYear = mom.year();
  3037. resWeek = week;
  3038. }
  3039. return {
  3040. week: resWeek,
  3041. year: resYear
  3042. };
  3043. }
  3044. function weeksInYear(year, dow, doy) {
  3045. var weekOffset = firstWeekOffset(year, dow, doy),
  3046. weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  3047. return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
  3048. }
  3049. // FORMATTING
  3050. addFormatToken('w', ['ww', 2], 'wo', 'week');
  3051. addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
  3052. // ALIASES
  3053. addUnitAlias('week', 'w');
  3054. addUnitAlias('isoWeek', 'W');
  3055. // PRIORITIES
  3056. addUnitPriority('week', 5);
  3057. addUnitPriority('isoWeek', 5);
  3058. // PARSING
  3059. addRegexToken('w', match1to2);
  3060. addRegexToken('ww', match1to2, match2);
  3061. addRegexToken('W', match1to2);
  3062. addRegexToken('WW', match1to2, match2);
  3063. addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
  3064. week[token.substr(0, 1)] = toInt(input);
  3065. });
  3066. // HELPERS
  3067. // LOCALES
  3068. function localeWeek (mom) {
  3069. return weekOfYear(mom, this._week.dow, this._week.doy).week;
  3070. }
  3071. var defaultLocaleWeek = {
  3072. dow : 0, // Sunday is the first day of the week.
  3073. doy : 6 // The week that contains Jan 1st is the first week of the year.
  3074. };
  3075. function localeFirstDayOfWeek () {
  3076. return this._week.dow;
  3077. }
  3078. function localeFirstDayOfYear () {
  3079. return this._week.doy;
  3080. }
  3081. // MOMENTS
  3082. function getSetWeek (input) {
  3083. var week = this.localeData().week(this);
  3084. return input == null ? week : this.add((input - week) * 7, 'd');
  3085. }
  3086. function getSetISOWeek (input) {
  3087. var week = weekOfYear(this, 1, 4).week;
  3088. return input == null ? week : this.add((input - week) * 7, 'd');
  3089. }
  3090. // FORMATTING
  3091. addFormatToken('d', 0, 'do', 'day');
  3092. addFormatToken('dd', 0, 0, function (format) {
  3093. return this.localeData().weekdaysMin(this, format);
  3094. });
  3095. addFormatToken('ddd', 0, 0, function (format) {
  3096. return this.localeData().weekdaysShort(this, format);
  3097. });
  3098. addFormatToken('dddd', 0, 0, function (format) {
  3099. return this.localeData().weekdays(this, format);
  3100. });
  3101. addFormatToken('e', 0, 0, 'weekday');
  3102. addFormatToken('E', 0, 0, 'isoWeekday');
  3103. // ALIASES
  3104. addUnitAlias('day', 'd');
  3105. addUnitAlias('weekday', 'e');
  3106. addUnitAlias('isoWeekday', 'E');
  3107. // PRIORITY
  3108. addUnitPriority('day', 11);
  3109. addUnitPriority('weekday', 11);
  3110. addUnitPriority('isoWeekday', 11);
  3111. // PARSING
  3112. addRegexToken('d', match1to2);
  3113. addRegexToken('e', match1to2);
  3114. addRegexToken('E', match1to2);
  3115. addRegexToken('dd', function (isStrict, locale) {
  3116. return locale.weekdaysMinRegex(isStrict);
  3117. });
  3118. addRegexToken('ddd', function (isStrict, locale) {
  3119. return locale.weekdaysShortRegex(isStrict);
  3120. });
  3121. addRegexToken('dddd', function (isStrict, locale) {
  3122. return locale.weekdaysRegex(isStrict);
  3123. });
  3124. addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
  3125. var weekday = config._locale.weekdaysParse(input, token, config._strict);
  3126. // if we didn't get a weekday name, mark the date as invalid
  3127. if (weekday != null) {
  3128. week.d = weekday;
  3129. } else {
  3130. getParsingFlags(config).invalidWeekday = input;
  3131. }
  3132. });
  3133. addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
  3134. week[token] = toInt(input);
  3135. });
  3136. // HELPERS
  3137. function parseWeekday(input, locale) {
  3138. if (typeof input !== 'string') {
  3139. return input;
  3140. }
  3141. if (!isNaN(input)) {
  3142. return parseInt(input, 10);
  3143. }
  3144. input = locale.weekdaysParse(input);
  3145. if (typeof input === 'number') {
  3146. return input;
  3147. }
  3148. return null;
  3149. }
  3150. function parseIsoWeekday(input, locale) {
  3151. if (typeof input === 'string') {
  3152. return locale.weekdaysParse(input) % 7 || 7;
  3153. }
  3154. return isNaN(input) ? null : input;
  3155. }
  3156. // LOCALES
  3157. var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
  3158. function localeWeekdays (m, format) {
  3159. if (!m) {
  3160. return isArray(this._weekdays) ? this._weekdays :
  3161. this._weekdays['standalone'];
  3162. }
  3163. return isArray(this._weekdays) ? this._weekdays[m.day()] :
  3164. this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()];
  3165. }
  3166. var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
  3167. function localeWeekdaysShort (m) {
  3168. return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
  3169. }
  3170. var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
  3171. function localeWeekdaysMin (m) {
  3172. return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
  3173. }
  3174. function handleStrictParse$1(weekdayName, format, strict) {
  3175. var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
  3176. if (!this._weekdaysParse) {
  3177. this._weekdaysParse = [];
  3178. this._shortWeekdaysParse = [];
  3179. this._minWeekdaysParse = [];
  3180. for (i = 0; i < 7; ++i) {
  3181. mom = createUTC([2000, 1]).day(i);
  3182. this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
  3183. this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
  3184. this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
  3185. }
  3186. }
  3187. if (strict) {
  3188. if (format === 'dddd') {
  3189. ii = indexOf$1.call(this._weekdaysParse, llc);
  3190. return ii !== -1 ? ii : null;
  3191. } else if (format === 'ddd') {
  3192. ii = indexOf$1.call(this._shortWeekdaysParse, llc);
  3193. return ii !== -1 ? ii : null;
  3194. } else {
  3195. ii = indexOf$1.call(this._minWeekdaysParse, llc);
  3196. return ii !== -1 ? ii : null;
  3197. }
  3198. } else {
  3199. if (format === 'dddd') {
  3200. ii = indexOf$1.call(this._weekdaysParse, llc);
  3201. if (ii !== -1) {
  3202. return ii;
  3203. }
  3204. ii = indexOf$1.call(this._shortWeekdaysParse, llc);
  3205. if (ii !== -1) {
  3206. return ii;
  3207. }
  3208. ii = indexOf$1.call(this._minWeekdaysParse, llc);
  3209. return ii !== -1 ? ii : null;
  3210. } else if (format === 'ddd') {
  3211. ii = indexOf$1.call(this._shortWeekdaysParse, llc);
  3212. if (ii !== -1) {
  3213. return ii;
  3214. }
  3215. ii = indexOf$1.call(this._weekdaysParse, llc);
  3216. if (ii !== -1) {
  3217. return ii;
  3218. }
  3219. ii = indexOf$1.call(this._minWeekdaysParse, llc);
  3220. return ii !== -1 ? ii : null;
  3221. } else {
  3222. ii = indexOf$1.call(this._minWeekdaysParse, llc);
  3223. if (ii !== -1) {
  3224. return ii;
  3225. }
  3226. ii = indexOf$1.call(this._weekdaysParse, llc);
  3227. if (ii !== -1) {
  3228. return ii;
  3229. }
  3230. ii = indexOf$1.call(this._shortWeekdaysParse, llc);
  3231. return ii !== -1 ? ii : null;
  3232. }
  3233. }
  3234. }
  3235. function localeWeekdaysParse (weekdayName, format, strict) {
  3236. var i, mom, regex;
  3237. if (this._weekdaysParseExact) {
  3238. return handleStrictParse$1.call(this, weekdayName, format, strict);
  3239. }
  3240. if (!this._weekdaysParse) {
  3241. this._weekdaysParse = [];
  3242. this._minWeekdaysParse = [];
  3243. this._shortWeekdaysParse = [];
  3244. this._fullWeekdaysParse = [];
  3245. }
  3246. for (i = 0; i < 7; i++) {
  3247. // make the regex if we don't have it already
  3248. mom = createUTC([2000, 1]).day(i);
  3249. if (strict && !this._fullWeekdaysParse[i]) {
  3250. this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
  3251. this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
  3252. this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
  3253. }
  3254. if (!this._weekdaysParse[i]) {
  3255. regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
  3256. this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
  3257. }
  3258. // test the regex
  3259. if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
  3260. return i;
  3261. } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
  3262. return i;
  3263. } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
  3264. return i;
  3265. } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
  3266. return i;
  3267. }
  3268. }
  3269. }
  3270. // MOMENTS
  3271. function getSetDayOfWeek (input) {
  3272. if (!this.isValid()) {
  3273. return input != null ? this : NaN;
  3274. }
  3275. var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
  3276. if (input != null) {
  3277. input = parseWeekday(input, this.localeData());
  3278. return this.add(input - day, 'd');
  3279. } else {
  3280. return day;
  3281. }
  3282. }
  3283. function getSetLocaleDayOfWeek (input) {
  3284. if (!this.isValid()) {
  3285. return input != null ? this : NaN;
  3286. }
  3287. var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  3288. return input == null ? weekday : this.add(input - weekday, 'd');
  3289. }
  3290. function getSetISODayOfWeek (input) {
  3291. if (!this.isValid()) {
  3292. return input != null ? this : NaN;
  3293. }
  3294. // behaves the same as moment#day except
  3295. // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
  3296. // as a setter, sunday should belong to the previous week.
  3297. if (input != null) {
  3298. var weekday = parseIsoWeekday(input, this.localeData());
  3299. return this.day(this.day() % 7 ? weekday : weekday - 7);
  3300. } else {
  3301. return this.day() || 7;
  3302. }
  3303. }
  3304. var defaultWeekdaysRegex = matchWord;
  3305. function weekdaysRegex (isStrict) {
  3306. if (this._weekdaysParseExact) {
  3307. if (!hasOwnProp(this, '_weekdaysRegex')) {
  3308. computeWeekdaysParse.call(this);
  3309. }
  3310. if (isStrict) {
  3311. return this._weekdaysStrictRegex;
  3312. } else {
  3313. return this._weekdaysRegex;
  3314. }
  3315. } else {
  3316. if (!hasOwnProp(this, '_weekdaysRegex')) {
  3317. this._weekdaysRegex = defaultWeekdaysRegex;
  3318. }
  3319. return this._weekdaysStrictRegex && isStrict ?
  3320. this._weekdaysStrictRegex : this._weekdaysRegex;
  3321. }
  3322. }
  3323. var defaultWeekdaysShortRegex = matchWord;
  3324. function weekdaysShortRegex (isStrict) {
  3325. if (this._weekdaysParseExact) {
  3326. if (!hasOwnProp(this, '_weekdaysRegex')) {
  3327. computeWeekdaysParse.call(this);
  3328. }
  3329. if (isStrict) {
  3330. return this._weekdaysShortStrictRegex;
  3331. } else {
  3332. return this._weekdaysShortRegex;
  3333. }
  3334. } else {
  3335. if (!hasOwnProp(this, '_weekdaysShortRegex')) {
  3336. this._weekdaysShortRegex = defaultWeekdaysShortRegex;
  3337. }
  3338. return this._weekdaysShortStrictRegex && isStrict ?
  3339. this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
  3340. }
  3341. }
  3342. var defaultWeekdaysMinRegex = matchWord;
  3343. function weekdaysMinRegex (isStrict) {
  3344. if (this._weekdaysParseExact) {
  3345. if (!hasOwnProp(this, '_weekdaysRegex')) {
  3346. computeWeekdaysParse.call(this);
  3347. }
  3348. if (isStrict) {
  3349. return this._weekdaysMinStrictRegex;
  3350. } else {
  3351. return this._weekdaysMinRegex;
  3352. }
  3353. } else {
  3354. if (!hasOwnProp(this, '_weekdaysMinRegex')) {
  3355. this._weekdaysMinRegex = defaultWeekdaysMinRegex;
  3356. }
  3357. return this._weekdaysMinStrictRegex && isStrict ?
  3358. this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
  3359. }
  3360. }
  3361. function computeWeekdaysParse () {
  3362. function cmpLenRev(a, b) {
  3363. return b.length - a.length;
  3364. }
  3365. var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [],
  3366. i, mom, minp, shortp, longp;
  3367. for (i = 0; i < 7; i++) {
  3368. // make the regex if we don't have it already
  3369. mom = createUTC([2000, 1]).day(i);
  3370. minp = this.weekdaysMin(mom, '');
  3371. shortp = this.weekdaysShort(mom, '');
  3372. longp = this.weekdays(mom, '');
  3373. minPieces.push(minp);
  3374. shortPieces.push(shortp);
  3375. longPieces.push(longp);
  3376. mixedPieces.push(minp);
  3377. mixedPieces.push(shortp);
  3378. mixedPieces.push(longp);
  3379. }
  3380. // Sorting makes sure if one weekday (or abbr) is a prefix of another it
  3381. // will match the longer piece.
  3382. minPieces.sort(cmpLenRev);
  3383. shortPieces.sort(cmpLenRev);
  3384. longPieces.sort(cmpLenRev);
  3385. mixedPieces.sort(cmpLenRev);
  3386. for (i = 0; i < 7; i++) {
  3387. shortPieces[i] = regexEscape(shortPieces[i]);
  3388. longPieces[i] = regexEscape(longPieces[i]);
  3389. mixedPieces[i] = regexEscape(mixedPieces[i]);
  3390. }
  3391. this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  3392. this._weekdaysShortRegex = this._weekdaysRegex;
  3393. this._weekdaysMinRegex = this._weekdaysRegex;
  3394. this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
  3395. this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
  3396. this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
  3397. }
  3398. // FORMATTING
  3399. function hFormat() {
  3400. return this.hours() % 12 || 12;
  3401. }
  3402. function kFormat() {
  3403. return this.hours() || 24;
  3404. }
  3405. addFormatToken('H', ['HH', 2], 0, 'hour');
  3406. addFormatToken('h', ['hh', 2], 0, hFormat);
  3407. addFormatToken('k', ['kk', 2], 0, kFormat);
  3408. addFormatToken('hmm', 0, 0, function () {
  3409. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
  3410. });
  3411. addFormatToken('hmmss', 0, 0, function () {
  3412. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
  3413. zeroFill(this.seconds(), 2);
  3414. });
  3415. addFormatToken('Hmm', 0, 0, function () {
  3416. return '' + this.hours() + zeroFill(this.minutes(), 2);
  3417. });
  3418. addFormatToken('Hmmss', 0, 0, function () {
  3419. return '' + this.hours() + zeroFill(this.minutes(), 2) +
  3420. zeroFill(this.seconds(), 2);
  3421. });
  3422. function meridiem (token, lowercase) {
  3423. addFormatToken(token, 0, 0, function () {
  3424. return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
  3425. });
  3426. }
  3427. meridiem('a', true);
  3428. meridiem('A', false);
  3429. // ALIASES
  3430. addUnitAlias('hour', 'h');
  3431. // PRIORITY
  3432. addUnitPriority('hour', 13);
  3433. // PARSING
  3434. function matchMeridiem (isStrict, locale) {
  3435. return locale._meridiemParse;
  3436. }
  3437. addRegexToken('a', matchMeridiem);
  3438. addRegexToken('A', matchMeridiem);
  3439. addRegexToken('H', match1to2);
  3440. addRegexToken('h', match1to2);
  3441. addRegexToken('k', match1to2);
  3442. addRegexToken('HH', match1to2, match2);
  3443. addRegexToken('hh', match1to2, match2);
  3444. addRegexToken('kk', match1to2, match2);
  3445. addRegexToken('hmm', match3to4);
  3446. addRegexToken('hmmss', match5to6);
  3447. addRegexToken('Hmm', match3to4);
  3448. addRegexToken('Hmmss', match5to6);
  3449. addParseToken(['H', 'HH'], HOUR);
  3450. addParseToken(['k', 'kk'], function (input, array, config) {
  3451. var kInput = toInt(input);
  3452. array[HOUR] = kInput === 24 ? 0 : kInput;
  3453. });
  3454. addParseToken(['a', 'A'], function (input, array, config) {
  3455. config._isPm = config._locale.isPM(input);
  3456. config._meridiem = input;
  3457. });
  3458. addParseToken(['h', 'hh'], function (input, array, config) {
  3459. array[HOUR] = toInt(input);
  3460. getParsingFlags(config).bigHour = true;
  3461. });
  3462. addParseToken('hmm', function (input, array, config) {
  3463. var pos = input.length - 2;
  3464. array[HOUR] = toInt(input.substr(0, pos));
  3465. array[MINUTE] = toInt(input.substr(pos));
  3466. getParsingFlags(config).bigHour = true;
  3467. });
  3468. addParseToken('hmmss', function (input, array, config) {
  3469. var pos1 = input.length - 4;
  3470. var pos2 = input.length - 2;
  3471. array[HOUR] = toInt(input.substr(0, pos1));
  3472. array[MINUTE] = toInt(input.substr(pos1, 2));
  3473. array[SECOND] = toInt(input.substr(pos2));
  3474. getParsingFlags(config).bigHour = true;
  3475. });
  3476. addParseToken('Hmm', function (input, array, config) {
  3477. var pos = input.length - 2;
  3478. array[HOUR] = toInt(input.substr(0, pos));
  3479. array[MINUTE] = toInt(input.substr(pos));
  3480. });
  3481. addParseToken('Hmmss', function (input, array, config) {
  3482. var pos1 = input.length - 4;
  3483. var pos2 = input.length - 2;
  3484. array[HOUR] = toInt(input.substr(0, pos1));
  3485. array[MINUTE] = toInt(input.substr(pos1, 2));
  3486. array[SECOND] = toInt(input.substr(pos2));
  3487. });
  3488. // LOCALES
  3489. function localeIsPM (input) {
  3490. // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
  3491. // Using charAt should be more compatible.
  3492. return ((input + '').toLowerCase().charAt(0) === 'p');
  3493. }
  3494. var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
  3495. function localeMeridiem (hours, minutes, isLower) {
  3496. if (hours > 11) {
  3497. return isLower ? 'pm' : 'PM';
  3498. } else {
  3499. return isLower ? 'am' : 'AM';
  3500. }
  3501. }
  3502. // MOMENTS
  3503. // Setting the hour should keep the time, because the user explicitly
  3504. // specified which hour he wants. So trying to maintain the same hour (in
  3505. // a new timezone) makes sense. Adding/subtracting hours does not follow
  3506. // this rule.
  3507. var getSetHour = makeGetSet('Hours', true);
  3508. // months
  3509. // week
  3510. // weekdays
  3511. // meridiem
  3512. var baseConfig = {
  3513. calendar: defaultCalendar,
  3514. longDateFormat: defaultLongDateFormat,
  3515. invalidDate: defaultInvalidDate,
  3516. ordinal: defaultOrdinal,
  3517. dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
  3518. relativeTime: defaultRelativeTime,
  3519. months: defaultLocaleMonths,
  3520. monthsShort: defaultLocaleMonthsShort,
  3521. week: defaultLocaleWeek,
  3522. weekdays: defaultLocaleWeekdays,
  3523. weekdaysMin: defaultLocaleWeekdaysMin,
  3524. weekdaysShort: defaultLocaleWeekdaysShort,
  3525. meridiemParse: defaultLocaleMeridiemParse
  3526. };
  3527. // internal storage for locale config files
  3528. var locales = {};
  3529. var localeFamilies = {};
  3530. var globalLocale;
  3531. function normalizeLocale(key) {
  3532. return key ? key.toLowerCase().replace('_', '-') : key;
  3533. }
  3534. // pick the locale from the array
  3535. // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
  3536. // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
  3537. function chooseLocale(names) {
  3538. var i = 0, j, next, locale, split;
  3539. while (i < names.length) {
  3540. split = normalizeLocale(names[i]).split('-');
  3541. j = split.length;
  3542. next = normalizeLocale(names[i + 1]);
  3543. next = next ? next.split('-') : null;
  3544. while (j > 0) {
  3545. locale = loadLocale(split.slice(0, j).join('-'));
  3546. if (locale) {
  3547. return locale;
  3548. }
  3549. if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
  3550. //the next array item is better than a shallower substring of this one
  3551. break;
  3552. }
  3553. j--;
  3554. }
  3555. i++;
  3556. }
  3557. return null;
  3558. }
  3559. function loadLocale(name) {
  3560. var oldLocale = null;
  3561. // TODO: Find a better way to register and load all the locales in Node
  3562. if (!locales[name] && (typeof module !== 'undefined') &&
  3563. module && module.exports) {
  3564. try {
  3565. oldLocale = globalLocale._abbr;
  3566. require('./locale/' + name);
  3567. // because defineLocale currently also sets the global locale, we
  3568. // want to undo that for lazy loaded locales
  3569. getSetGlobalLocale(oldLocale);
  3570. } catch (e) { }
  3571. }
  3572. return locales[name];
  3573. }
  3574. // This function will load locale and then set the global locale. If
  3575. // no arguments are passed in, it will simply return the current global
  3576. // locale key.
  3577. function getSetGlobalLocale (key, values) {
  3578. var data;
  3579. if (key) {
  3580. if (isUndefined(values)) {
  3581. data = getLocale(key);
  3582. }
  3583. else {
  3584. data = defineLocale(key, values);
  3585. }
  3586. if (data) {
  3587. // moment.duration._locale = moment._locale = data;
  3588. globalLocale = data;
  3589. }
  3590. }
  3591. return globalLocale._abbr;
  3592. }
  3593. function defineLocale (name, config) {
  3594. if (config !== null) {
  3595. var parentConfig = baseConfig;
  3596. config.abbr = name;
  3597. if (locales[name] != null) {
  3598. deprecateSimple('defineLocaleOverride',
  3599. 'use moment.updateLocale(localeName, config) to change ' +
  3600. 'an existing locale. moment.defineLocale(localeName, ' +
  3601. 'config) should only be used for creating a new locale ' +
  3602. 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
  3603. parentConfig = locales[name]._config;
  3604. } else if (config.parentLocale != null) {
  3605. if (locales[config.parentLocale] != null) {
  3606. parentConfig = locales[config.parentLocale]._config;
  3607. } else {
  3608. if (!localeFamilies[config.parentLocale]) {
  3609. localeFamilies[config.parentLocale] = [];
  3610. }
  3611. localeFamilies[config.parentLocale].push({
  3612. name: name,
  3613. config: config
  3614. });
  3615. return null;
  3616. }
  3617. }
  3618. locales[name] = new Locale(mergeConfigs(parentConfig, config));
  3619. if (localeFamilies[name]) {
  3620. localeFamilies[name].forEach(function (x) {
  3621. defineLocale(x.name, x.config);
  3622. });
  3623. }
  3624. // backwards compat for now: also set the locale
  3625. // make sure we set the locale AFTER all child locales have been
  3626. // created, so we won't end up with the child locale set.
  3627. getSetGlobalLocale(name);
  3628. return locales[name];
  3629. } else {
  3630. // useful for testing
  3631. delete locales[name];
  3632. return null;
  3633. }
  3634. }
  3635. function updateLocale(name, config) {
  3636. if (config != null) {
  3637. var locale, parentConfig = baseConfig;
  3638. // MERGE
  3639. if (locales[name] != null) {
  3640. parentConfig = locales[name]._config;
  3641. }
  3642. config = mergeConfigs(parentConfig, config);
  3643. locale = new Locale(config);
  3644. locale.parentLocale = locales[name];
  3645. locales[name] = locale;
  3646. // backwards compat for now: also set the locale
  3647. getSetGlobalLocale(name);
  3648. } else {
  3649. // pass null for config to unupdate, useful for tests
  3650. if (locales[name] != null) {
  3651. if (locales[name].parentLocale != null) {
  3652. locales[name] = locales[name].parentLocale;
  3653. } else if (locales[name] != null) {
  3654. delete locales[name];
  3655. }
  3656. }
  3657. }
  3658. return locales[name];
  3659. }
  3660. // returns locale data
  3661. function getLocale (key) {
  3662. var locale;
  3663. if (key && key._locale && key._locale._abbr) {
  3664. key = key._locale._abbr;
  3665. }
  3666. if (!key) {
  3667. return globalLocale;
  3668. }
  3669. if (!isArray(key)) {
  3670. //short-circuit everything else
  3671. locale = loadLocale(key);
  3672. if (locale) {
  3673. return locale;
  3674. }
  3675. key = [key];
  3676. }
  3677. return chooseLocale(key);
  3678. }
  3679. function listLocales() {
  3680. return keys$1(locales);
  3681. }
  3682. function checkOverflow (m) {
  3683. var overflow;
  3684. var a = m._a;
  3685. if (a && getParsingFlags(m).overflow === -2) {
  3686. overflow =
  3687. a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
  3688. a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
  3689. a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
  3690. a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
  3691. a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
  3692. a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
  3693. -1;
  3694. if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
  3695. overflow = DATE;
  3696. }
  3697. if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
  3698. overflow = WEEK;
  3699. }
  3700. if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
  3701. overflow = WEEKDAY;
  3702. }
  3703. getParsingFlags(m).overflow = overflow;
  3704. }
  3705. return m;
  3706. }
  3707. // iso 8601 regex
  3708. // 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)
  3709. 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)?)?$/;
  3710. 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)?)?$/;
  3711. var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
  3712. var isoDates = [
  3713. ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
  3714. ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
  3715. ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
  3716. ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
  3717. ['YYYY-DDD', /\d{4}-\d{3}/],
  3718. ['YYYY-MM', /\d{4}-\d\d/, false],
  3719. ['YYYYYYMMDD', /[+-]\d{10}/],
  3720. ['YYYYMMDD', /\d{8}/],
  3721. // YYYYMM is NOT allowed by the standard
  3722. ['GGGG[W]WWE', /\d{4}W\d{3}/],
  3723. ['GGGG[W]WW', /\d{4}W\d{2}/, false],
  3724. ['YYYYDDD', /\d{7}/]
  3725. ];
  3726. // iso time formats and regexes
  3727. var isoTimes = [
  3728. ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
  3729. ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
  3730. ['HH:mm:ss', /\d\d:\d\d:\d\d/],
  3731. ['HH:mm', /\d\d:\d\d/],
  3732. ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
  3733. ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
  3734. ['HHmmss', /\d\d\d\d\d\d/],
  3735. ['HHmm', /\d\d\d\d/],
  3736. ['HH', /\d\d/]
  3737. ];
  3738. var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
  3739. // date from iso format
  3740. function configFromISO(config) {
  3741. var i, l,
  3742. string = config._i,
  3743. match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
  3744. allowTime, dateFormat, timeFormat, tzFormat;
  3745. if (match) {
  3746. getParsingFlags(config).iso = true;
  3747. for (i = 0, l = isoDates.length; i < l; i++) {
  3748. if (isoDates[i][1].exec(match[1])) {
  3749. dateFormat = isoDates[i][0];
  3750. allowTime = isoDates[i][2] !== false;
  3751. break;
  3752. }
  3753. }
  3754. if (dateFormat == null) {
  3755. config._isValid = false;
  3756. return;
  3757. }
  3758. if (match[3]) {
  3759. for (i = 0, l = isoTimes.length; i < l; i++) {
  3760. if (isoTimes[i][1].exec(match[3])) {
  3761. // match[2] should be 'T' or space
  3762. timeFormat = (match[2] || ' ') + isoTimes[i][0];
  3763. break;
  3764. }
  3765. }
  3766. if (timeFormat == null) {
  3767. config._isValid = false;
  3768. return;
  3769. }
  3770. }
  3771. if (!allowTime && timeFormat != null) {
  3772. config._isValid = false;
  3773. return;
  3774. }
  3775. if (match[4]) {
  3776. if (tzRegex.exec(match[4])) {
  3777. tzFormat = 'Z';
  3778. } else {
  3779. config._isValid = false;
  3780. return;
  3781. }
  3782. }
  3783. config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
  3784. configFromStringAndFormat(config);
  3785. } else {
  3786. config._isValid = false;
  3787. }
  3788. }
  3789. // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
  3790. var basicRfcRegex = /^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/;
  3791. // date and time from ref 2822 format
  3792. function configFromRFC2822(config) {
  3793. var string, match, dayFormat,
  3794. dateFormat, timeFormat, tzFormat;
  3795. var timezones = {
  3796. ' GMT': ' +0000',
  3797. ' EDT': ' -0400',
  3798. ' EST': ' -0500',
  3799. ' CDT': ' -0500',
  3800. ' CST': ' -0600',
  3801. ' MDT': ' -0600',
  3802. ' MST': ' -0700',
  3803. ' PDT': ' -0700',
  3804. ' PST': ' -0800'
  3805. };
  3806. var military = 'YXWVUTSRQPONZABCDEFGHIKLM';
  3807. var timezone, timezoneIndex;
  3808. string = config._i
  3809. .replace(/\([^\)]*\)|[\n\t]/g, ' ') // Remove comments and folding whitespace
  3810. .replace(/(\s\s+)/g, ' ') // Replace multiple-spaces with a single space
  3811. .replace(/^\s|\s$/g, ''); // Remove leading and trailing spaces
  3812. match = basicRfcRegex.exec(string);
  3813. if (match) {
  3814. dayFormat = match[1] ? 'ddd' + ((match[1].length === 5) ? ', ' : ' ') : '';
  3815. dateFormat = 'D MMM ' + ((match[2].length > 10) ? 'YYYY ' : 'YY ');
  3816. timeFormat = 'HH:mm' + (match[4] ? ':ss' : '');
  3817. // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
  3818. if (match[1]) { // day of week given
  3819. var momentDate = new Date(match[2]);
  3820. var momentDay = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'][momentDate.getDay()];
  3821. if (match[1].substr(0,3) !== momentDay) {
  3822. getParsingFlags(config).weekdayMismatch = true;
  3823. config._isValid = false;
  3824. return;
  3825. }
  3826. }
  3827. switch (match[5].length) {
  3828. case 2: // military
  3829. if (timezoneIndex === 0) {
  3830. timezone = ' +0000';
  3831. } else {
  3832. timezoneIndex = military.indexOf(match[5][1].toUpperCase()) - 12;
  3833. timezone = ((timezoneIndex < 0) ? ' -' : ' +') +
  3834. (('' + timezoneIndex).replace(/^-?/, '0')).match(/..$/)[0] + '00';
  3835. }
  3836. break;
  3837. case 4: // Zone
  3838. timezone = timezones[match[5]];
  3839. break;
  3840. default: // UT or +/-9999
  3841. timezone = timezones[' GMT'];
  3842. }
  3843. match[5] = timezone;
  3844. config._i = match.splice(1).join('');
  3845. tzFormat = ' ZZ';
  3846. config._f = dayFormat + dateFormat + timeFormat + tzFormat;
  3847. configFromStringAndFormat(config);
  3848. getParsingFlags(config).rfc2822 = true;
  3849. } else {
  3850. config._isValid = false;
  3851. }
  3852. }
  3853. // date from iso format or fallback
  3854. function configFromString(config) {
  3855. var matched = aspNetJsonRegex.exec(config._i);
  3856. if (matched !== null) {
  3857. config._d = new Date(+matched[1]);
  3858. return;
  3859. }
  3860. configFromISO(config);
  3861. if (config._isValid === false) {
  3862. delete config._isValid;
  3863. } else {
  3864. return;
  3865. }
  3866. configFromRFC2822(config);
  3867. if (config._isValid === false) {
  3868. delete config._isValid;
  3869. } else {
  3870. return;
  3871. }
  3872. // Final attempt, use Input Fallback
  3873. hooks.createFromInputFallback(config);
  3874. }
  3875. hooks.createFromInputFallback = deprecate(
  3876. 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
  3877. 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
  3878. 'discouraged and will be removed in an upcoming major release. Please refer to ' +
  3879. 'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
  3880. function (config) {
  3881. config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
  3882. }
  3883. );
  3884. // Pick the first defined of two or three arguments.
  3885. function defaults(a, b, c) {
  3886. if (a != null) {
  3887. return a;
  3888. }
  3889. if (b != null) {
  3890. return b;
  3891. }
  3892. return c;
  3893. }
  3894. function currentDateArray(config) {
  3895. // hooks is actually the exported moment object
  3896. var nowValue = new Date(hooks.now());
  3897. if (config._useUTC) {
  3898. return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
  3899. }
  3900. return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
  3901. }
  3902. // convert an array to a date.
  3903. // the array should mirror the parameters below
  3904. // note: all values past the year are optional and will default to the lowest possible value.
  3905. // [year, month, day , hour, minute, second, millisecond]
  3906. function configFromArray (config) {
  3907. var i, date, input = [], currentDate, yearToUse;
  3908. if (config._d) {
  3909. return;
  3910. }
  3911. currentDate = currentDateArray(config);
  3912. //compute day of the year from weeks and weekdays
  3913. if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
  3914. dayOfYearFromWeekInfo(config);
  3915. }
  3916. //if the day of the year is set, figure out what it is
  3917. if (config._dayOfYear != null) {
  3918. yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
  3919. if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
  3920. getParsingFlags(config)._overflowDayOfYear = true;
  3921. }
  3922. date = createUTCDate(yearToUse, 0, config._dayOfYear);
  3923. config._a[MONTH] = date.getUTCMonth();
  3924. config._a[DATE] = date.getUTCDate();
  3925. }
  3926. // Default to current date.
  3927. // * if no year, month, day of month are given, default to today
  3928. // * if day of month is given, default month and year
  3929. // * if month is given, default only year
  3930. // * if year is given, don't default anything
  3931. for (i = 0; i < 3 && config._a[i] == null; ++i) {
  3932. config._a[i] = input[i] = currentDate[i];
  3933. }
  3934. // Zero out whatever was not defaulted, including time
  3935. for (; i < 7; i++) {
  3936. config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
  3937. }
  3938. // Check for 24:00:00.000
  3939. if (config._a[HOUR] === 24 &&
  3940. config._a[MINUTE] === 0 &&
  3941. config._a[SECOND] === 0 &&
  3942. config._a[MILLISECOND] === 0) {
  3943. config._nextDay = true;
  3944. config._a[HOUR] = 0;
  3945. }
  3946. config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
  3947. // Apply timezone offset from input. The actual utcOffset can be changed
  3948. // with parseZone.
  3949. if (config._tzm != null) {
  3950. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  3951. }
  3952. if (config._nextDay) {
  3953. config._a[HOUR] = 24;
  3954. }
  3955. }
  3956. function dayOfYearFromWeekInfo(config) {
  3957. var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
  3958. w = config._w;
  3959. if (w.GG != null || w.W != null || w.E != null) {
  3960. dow = 1;
  3961. doy = 4;
  3962. // TODO: We need to take the current isoWeekYear, but that depends on
  3963. // how we interpret now (local, utc, fixed offset). So create
  3964. // a now version of current config (take local/utc/offset flags, and
  3965. // create now).
  3966. weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
  3967. week = defaults(w.W, 1);
  3968. weekday = defaults(w.E, 1);
  3969. if (weekday < 1 || weekday > 7) {
  3970. weekdayOverflow = true;
  3971. }
  3972. } else {
  3973. dow = config._locale._week.dow;
  3974. doy = config._locale._week.doy;
  3975. var curWeek = weekOfYear(createLocal(), dow, doy);
  3976. weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
  3977. // Default to current week.
  3978. week = defaults(w.w, curWeek.week);
  3979. if (w.d != null) {
  3980. // weekday -- low day numbers are considered next week
  3981. weekday = w.d;
  3982. if (weekday < 0 || weekday > 6) {
  3983. weekdayOverflow = true;
  3984. }
  3985. } else if (w.e != null) {
  3986. // local weekday -- counting starts from begining of week
  3987. weekday = w.e + dow;
  3988. if (w.e < 0 || w.e > 6) {
  3989. weekdayOverflow = true;
  3990. }
  3991. } else {
  3992. // default to begining of week
  3993. weekday = dow;
  3994. }
  3995. }
  3996. if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
  3997. getParsingFlags(config)._overflowWeeks = true;
  3998. } else if (weekdayOverflow != null) {
  3999. getParsingFlags(config)._overflowWeekday = true;
  4000. } else {
  4001. temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
  4002. config._a[YEAR] = temp.year;
  4003. config._dayOfYear = temp.dayOfYear;
  4004. }
  4005. }
  4006. // constant that refers to the ISO standard
  4007. hooks.ISO_8601 = function () {};
  4008. // constant that refers to the RFC 2822 form
  4009. hooks.RFC_2822 = function () {};
  4010. // date from string and format string
  4011. function configFromStringAndFormat(config) {
  4012. // TODO: Move this to another part of the creation flow to prevent circular deps
  4013. if (config._f === hooks.ISO_8601) {
  4014. configFromISO(config);
  4015. return;
  4016. }
  4017. if (config._f === hooks.RFC_2822) {
  4018. configFromRFC2822(config);
  4019. return;
  4020. }
  4021. config._a = [];
  4022. getParsingFlags(config).empty = true;
  4023. // This array is used to make a Date, either with `new Date` or `Date.UTC`
  4024. var string = '' + config._i,
  4025. i, parsedInput, tokens, token, skipped,
  4026. stringLength = string.length,
  4027. totalParsedInputLength = 0;
  4028. tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
  4029. for (i = 0; i < tokens.length; i++) {
  4030. token = tokens[i];
  4031. parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
  4032. // console.log('token', token, 'parsedInput', parsedInput,
  4033. // 'regex', getParseRegexForToken(token, config));
  4034. if (parsedInput) {
  4035. skipped = string.substr(0, string.indexOf(parsedInput));
  4036. if (skipped.length > 0) {
  4037. getParsingFlags(config).unusedInput.push(skipped);
  4038. }
  4039. string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
  4040. totalParsedInputLength += parsedInput.length;
  4041. }
  4042. // don't parse if it's not a known token
  4043. if (formatTokenFunctions[token]) {
  4044. if (parsedInput) {
  4045. getParsingFlags(config).empty = false;
  4046. }
  4047. else {
  4048. getParsingFlags(config).unusedTokens.push(token);
  4049. }
  4050. addTimeToArrayFromToken(token, parsedInput, config);
  4051. }
  4052. else if (config._strict && !parsedInput) {
  4053. getParsingFlags(config).unusedTokens.push(token);
  4054. }
  4055. }
  4056. // add remaining unparsed input length to the string
  4057. getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
  4058. if (string.length > 0) {
  4059. getParsingFlags(config).unusedInput.push(string);
  4060. }
  4061. // clear _12h flag if hour is <= 12
  4062. if (config._a[HOUR] <= 12 &&
  4063. getParsingFlags(config).bigHour === true &&
  4064. config._a[HOUR] > 0) {
  4065. getParsingFlags(config).bigHour = undefined;
  4066. }
  4067. getParsingFlags(config).parsedDateParts = config._a.slice(0);
  4068. getParsingFlags(config).meridiem = config._meridiem;
  4069. // handle meridiem
  4070. config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
  4071. configFromArray(config);
  4072. checkOverflow(config);
  4073. }
  4074. function meridiemFixWrap (locale, hour, meridiem) {
  4075. var isPm;
  4076. if (meridiem == null) {
  4077. // nothing to do
  4078. return hour;
  4079. }
  4080. if (locale.meridiemHour != null) {
  4081. return locale.meridiemHour(hour, meridiem);
  4082. } else if (locale.isPM != null) {
  4083. // Fallback
  4084. isPm = locale.isPM(meridiem);
  4085. if (isPm && hour < 12) {
  4086. hour += 12;
  4087. }
  4088. if (!isPm && hour === 12) {
  4089. hour = 0;
  4090. }
  4091. return hour;
  4092. } else {
  4093. // this is not supposed to happen
  4094. return hour;
  4095. }
  4096. }
  4097. // date from string and array of format strings
  4098. function configFromStringAndArray(config) {
  4099. var tempConfig,
  4100. bestMoment,
  4101. scoreToBeat,
  4102. i,
  4103. currentScore;
  4104. if (config._f.length === 0) {
  4105. getParsingFlags(config).invalidFormat = true;
  4106. config._d = new Date(NaN);
  4107. return;
  4108. }
  4109. for (i = 0; i < config._f.length; i++) {
  4110. currentScore = 0;
  4111. tempConfig = copyConfig({}, config);
  4112. if (config._useUTC != null) {
  4113. tempConfig._useUTC = config._useUTC;
  4114. }
  4115. tempConfig._f = config._f[i];
  4116. configFromStringAndFormat(tempConfig);
  4117. if (!isValid(tempConfig)) {
  4118. continue;
  4119. }
  4120. // if there is any input that was not parsed add a penalty for that format
  4121. currentScore += getParsingFlags(tempConfig).charsLeftOver;
  4122. //or tokens
  4123. currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
  4124. getParsingFlags(tempConfig).score = currentScore;
  4125. if (scoreToBeat == null || currentScore < scoreToBeat) {
  4126. scoreToBeat = currentScore;
  4127. bestMoment = tempConfig;
  4128. }
  4129. }
  4130. extend(config, bestMoment || tempConfig);
  4131. }
  4132. function configFromObject(config) {
  4133. if (config._d) {
  4134. return;
  4135. }
  4136. var i = normalizeObjectUnits(config._i);
  4137. config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
  4138. return obj && parseInt(obj, 10);
  4139. });
  4140. configFromArray(config);
  4141. }
  4142. function createFromConfig (config) {
  4143. var res = new Moment(checkOverflow(prepareConfig(config)));
  4144. if (res._nextDay) {
  4145. // Adding is smart enough around DST
  4146. res.add(1, 'd');
  4147. res._nextDay = undefined;
  4148. }
  4149. return res;
  4150. }
  4151. function prepareConfig (config) {
  4152. var input = config._i,
  4153. format = config._f;
  4154. config._locale = config._locale || getLocale(config._l);
  4155. if (input === null || (format === undefined && input === '')) {
  4156. return createInvalid({nullInput: true});
  4157. }
  4158. if (typeof input === 'string') {
  4159. config._i = input = config._locale.preparse(input);
  4160. }
  4161. if (isMoment(input)) {
  4162. return new Moment(checkOverflow(input));
  4163. } else if (isDate(input)) {
  4164. config._d = input;
  4165. } else if (isArray(format)) {
  4166. configFromStringAndArray(config);
  4167. } else if (format) {
  4168. configFromStringAndFormat(config);
  4169. } else {
  4170. configFromInput(config);
  4171. }
  4172. if (!isValid(config)) {
  4173. config._d = null;
  4174. }
  4175. return config;
  4176. }
  4177. function configFromInput(config) {
  4178. var input = config._i;
  4179. if (isUndefined(input)) {
  4180. config._d = new Date(hooks.now());
  4181. } else if (isDate(input)) {
  4182. config._d = new Date(input.valueOf());
  4183. } else if (typeof input === 'string') {
  4184. configFromString(config);
  4185. } else if (isArray(input)) {
  4186. config._a = map(input.slice(0), function (obj) {
  4187. return parseInt(obj, 10);
  4188. });
  4189. configFromArray(config);
  4190. } else if (isObject(input)) {
  4191. configFromObject(config);
  4192. } else if (isNumber(input)) {
  4193. // from milliseconds
  4194. config._d = new Date(input);
  4195. } else {
  4196. hooks.createFromInputFallback(config);
  4197. }
  4198. }
  4199. function createLocalOrUTC (input, format, locale, strict, isUTC) {
  4200. var c = {};
  4201. if (locale === true || locale === false) {
  4202. strict = locale;
  4203. locale = undefined;
  4204. }
  4205. if ((isObject(input) && isObjectEmpty(input)) ||
  4206. (isArray(input) && input.length === 0)) {
  4207. input = undefined;
  4208. }
  4209. // object construction must be done this way.
  4210. // https://github.com/moment/moment/issues/1423
  4211. c._isAMomentObject = true;
  4212. c._useUTC = c._isUTC = isUTC;
  4213. c._l = locale;
  4214. c._i = input;
  4215. c._f = format;
  4216. c._strict = strict;
  4217. return createFromConfig(c);
  4218. }
  4219. function createLocal (input, format, locale, strict) {
  4220. return createLocalOrUTC(input, format, locale, strict, false);
  4221. }
  4222. var prototypeMin = deprecate(
  4223. 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
  4224. function () {
  4225. var other = createLocal.apply(null, arguments);
  4226. if (this.isValid() && other.isValid()) {
  4227. return other < this ? this : other;
  4228. } else {
  4229. return createInvalid();
  4230. }
  4231. }
  4232. );
  4233. var prototypeMax = deprecate(
  4234. 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
  4235. function () {
  4236. var other = createLocal.apply(null, arguments);
  4237. if (this.isValid() && other.isValid()) {
  4238. return other > this ? this : other;
  4239. } else {
  4240. return createInvalid();
  4241. }
  4242. }
  4243. );
  4244. // Pick a moment m from moments so that m[fn](other) is true for all
  4245. // other. This relies on the function fn to be transitive.
  4246. //
  4247. // moments should either be an array of moment objects or an array, whose
  4248. // first element is an array of moment objects.
  4249. function pickBy(fn, moments) {
  4250. var res, i;
  4251. if (moments.length === 1 && isArray(moments[0])) {
  4252. moments = moments[0];
  4253. }
  4254. if (!moments.length) {
  4255. return createLocal();
  4256. }
  4257. res = moments[0];
  4258. for (i = 1; i < moments.length; ++i) {
  4259. if (!moments[i].isValid() || moments[i][fn](res)) {
  4260. res = moments[i];
  4261. }
  4262. }
  4263. return res;
  4264. }
  4265. // TODO: Use [].sort instead?
  4266. function min () {
  4267. var args = [].slice.call(arguments, 0);
  4268. return pickBy('isBefore', args);
  4269. }
  4270. function max () {
  4271. var args = [].slice.call(arguments, 0);
  4272. return pickBy('isAfter', args);
  4273. }
  4274. var now = function () {
  4275. return Date.now ? Date.now() : +(new Date());
  4276. };
  4277. var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];
  4278. function isDurationValid(m) {
  4279. for (var key in m) {
  4280. if (!(ordering.indexOf(key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
  4281. return false;
  4282. }
  4283. }
  4284. var unitHasDecimal = false;
  4285. for (var i = 0; i < ordering.length; ++i) {
  4286. if (m[ordering[i]]) {
  4287. if (unitHasDecimal) {
  4288. return false; // only allow non-integers for smallest unit
  4289. }
  4290. if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
  4291. unitHasDecimal = true;
  4292. }
  4293. }
  4294. }
  4295. return true;
  4296. }
  4297. function isValid$1() {
  4298. return this._isValid;
  4299. }
  4300. function createInvalid$1() {
  4301. return createDuration(NaN);
  4302. }
  4303. function Duration (duration) {
  4304. var normalizedInput = normalizeObjectUnits(duration),
  4305. years = normalizedInput.year || 0,
  4306. quarters = normalizedInput.quarter || 0,
  4307. months = normalizedInput.month || 0,
  4308. weeks = normalizedInput.week || 0,
  4309. days = normalizedInput.day || 0,
  4310. hours = normalizedInput.hour || 0,
  4311. minutes = normalizedInput.minute || 0,
  4312. seconds = normalizedInput.second || 0,
  4313. milliseconds = normalizedInput.millisecond || 0;
  4314. this._isValid = isDurationValid(normalizedInput);
  4315. // representation for dateAddRemove
  4316. this._milliseconds = +milliseconds +
  4317. seconds * 1e3 + // 1000
  4318. minutes * 6e4 + // 1000 * 60
  4319. hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
  4320. // Because of dateAddRemove treats 24 hours as different from a
  4321. // day when working around DST, we need to store them separately
  4322. this._days = +days +
  4323. weeks * 7;
  4324. // It is impossible translate months into days without knowing
  4325. // which months you are are talking about, so we have to store
  4326. // it separately.
  4327. this._months = +months +
  4328. quarters * 3 +
  4329. years * 12;
  4330. this._data = {};
  4331. this._locale = getLocale();
  4332. this._bubble();
  4333. }
  4334. function isDuration (obj) {
  4335. return obj instanceof Duration;
  4336. }
  4337. function absRound (number) {
  4338. if (number < 0) {
  4339. return Math.round(-1 * number) * -1;
  4340. } else {
  4341. return Math.round(number);
  4342. }
  4343. }
  4344. // FORMATTING
  4345. function offset (token, separator) {
  4346. addFormatToken(token, 0, 0, function () {
  4347. var offset = this.utcOffset();
  4348. var sign = '+';
  4349. if (offset < 0) {
  4350. offset = -offset;
  4351. sign = '-';
  4352. }
  4353. return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
  4354. });
  4355. }
  4356. offset('Z', ':');
  4357. offset('ZZ', '');
  4358. // PARSING
  4359. addRegexToken('Z', matchShortOffset);
  4360. addRegexToken('ZZ', matchShortOffset);
  4361. addParseToken(['Z', 'ZZ'], function (input, array, config) {
  4362. config._useUTC = true;
  4363. config._tzm = offsetFromString(matchShortOffset, input);
  4364. });
  4365. // HELPERS
  4366. // timezone chunker
  4367. // '+10:00' > ['10', '00']
  4368. // '-1530' > ['-15', '30']
  4369. var chunkOffset = /([\+\-]|\d\d)/gi;
  4370. function offsetFromString(matcher, string) {
  4371. var matches = (string || '').match(matcher);
  4372. if (matches === null) {
  4373. return null;
  4374. }
  4375. var chunk = matches[matches.length - 1] || [];
  4376. var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
  4377. var minutes = +(parts[1] * 60) + toInt(parts[2]);
  4378. return minutes === 0 ?
  4379. 0 :
  4380. parts[0] === '+' ? minutes : -minutes;
  4381. }
  4382. // Return a moment from input, that is local/utc/zone equivalent to model.
  4383. function cloneWithOffset(input, model) {
  4384. var res, diff;
  4385. if (model._isUTC) {
  4386. res = model.clone();
  4387. diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
  4388. // Use low-level api, because this fn is low-level api.
  4389. res._d.setTime(res._d.valueOf() + diff);
  4390. hooks.updateOffset(res, false);
  4391. return res;
  4392. } else {
  4393. return createLocal(input).local();
  4394. }
  4395. }
  4396. function getDateOffset (m) {
  4397. // On Firefox.24 Date#getTimezoneOffset returns a floating point.
  4398. // https://github.com/moment/moment/pull/1871
  4399. return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
  4400. }
  4401. // HOOKS
  4402. // This function will be called whenever a moment is mutated.
  4403. // It is intended to keep the offset in sync with the timezone.
  4404. hooks.updateOffset = function () {};
  4405. // MOMENTS
  4406. // keepLocalTime = true means only change the timezone, without
  4407. // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
  4408. // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
  4409. // +0200, so we adjust the time as needed, to be valid.
  4410. //
  4411. // Keeping the time actually adds/subtracts (one hour)
  4412. // from the actual represented time. That is why we call updateOffset
  4413. // a second time. In case it wants us to change the offset again
  4414. // _changeInProgress == true case, then we have to adjust, because
  4415. // there is no such time in the given timezone.
  4416. function getSetOffset (input, keepLocalTime, keepMinutes) {
  4417. var offset = this._offset || 0,
  4418. localAdjust;
  4419. if (!this.isValid()) {
  4420. return input != null ? this : NaN;
  4421. }
  4422. if (input != null) {
  4423. if (typeof input === 'string') {
  4424. input = offsetFromString(matchShortOffset, input);
  4425. if (input === null) {
  4426. return this;
  4427. }
  4428. } else if (Math.abs(input) < 16 && !keepMinutes) {
  4429. input = input * 60;
  4430. }
  4431. if (!this._isUTC && keepLocalTime) {
  4432. localAdjust = getDateOffset(this);
  4433. }
  4434. this._offset = input;
  4435. this._isUTC = true;
  4436. if (localAdjust != null) {
  4437. this.add(localAdjust, 'm');
  4438. }
  4439. if (offset !== input) {
  4440. if (!keepLocalTime || this._changeInProgress) {
  4441. addSubtract(this, createDuration(input - offset, 'm'), 1, false);
  4442. } else if (!this._changeInProgress) {
  4443. this._changeInProgress = true;
  4444. hooks.updateOffset(this, true);
  4445. this._changeInProgress = null;
  4446. }
  4447. }
  4448. return this;
  4449. } else {
  4450. return this._isUTC ? offset : getDateOffset(this);
  4451. }
  4452. }
  4453. function getSetZone (input, keepLocalTime) {
  4454. if (input != null) {
  4455. if (typeof input !== 'string') {
  4456. input = -input;
  4457. }
  4458. this.utcOffset(input, keepLocalTime);
  4459. return this;
  4460. } else {
  4461. return -this.utcOffset();
  4462. }
  4463. }
  4464. function setOffsetToUTC (keepLocalTime) {
  4465. return this.utcOffset(0, keepLocalTime);
  4466. }
  4467. function setOffsetToLocal (keepLocalTime) {
  4468. if (this._isUTC) {
  4469. this.utcOffset(0, keepLocalTime);
  4470. this._isUTC = false;
  4471. if (keepLocalTime) {
  4472. this.subtract(getDateOffset(this), 'm');
  4473. }
  4474. }
  4475. return this;
  4476. }
  4477. function setOffsetToParsedOffset () {
  4478. if (this._tzm != null) {
  4479. this.utcOffset(this._tzm, false, true);
  4480. } else if (typeof this._i === 'string') {
  4481. var tZone = offsetFromString(matchOffset, this._i);
  4482. if (tZone != null) {
  4483. this.utcOffset(tZone);
  4484. }
  4485. else {
  4486. this.utcOffset(0, true);
  4487. }
  4488. }
  4489. return this;
  4490. }
  4491. function hasAlignedHourOffset (input) {
  4492. if (!this.isValid()) {
  4493. return false;
  4494. }
  4495. input = input ? createLocal(input).utcOffset() : 0;
  4496. return (this.utcOffset() - input) % 60 === 0;
  4497. }
  4498. function isDaylightSavingTime () {
  4499. return (
  4500. this.utcOffset() > this.clone().month(0).utcOffset() ||
  4501. this.utcOffset() > this.clone().month(5).utcOffset()
  4502. );
  4503. }
  4504. function isDaylightSavingTimeShifted () {
  4505. if (!isUndefined(this._isDSTShifted)) {
  4506. return this._isDSTShifted;
  4507. }
  4508. var c = {};
  4509. copyConfig(c, this);
  4510. c = prepareConfig(c);
  4511. if (c._a) {
  4512. var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
  4513. this._isDSTShifted = this.isValid() &&
  4514. compareArrays(c._a, other.toArray()) > 0;
  4515. } else {
  4516. this._isDSTShifted = false;
  4517. }
  4518. return this._isDSTShifted;
  4519. }
  4520. function isLocal () {
  4521. return this.isValid() ? !this._isUTC : false;
  4522. }
  4523. function isUtcOffset () {
  4524. return this.isValid() ? this._isUTC : false;
  4525. }
  4526. function isUtc () {
  4527. return this.isValid() ? this._isUTC && this._offset === 0 : false;
  4528. }
  4529. // ASP.NET json date format regex
  4530. var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
  4531. // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
  4532. // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
  4533. // and further modified to allow for strings containing both week and day
  4534. 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)?)?$/;
  4535. function createDuration (input, key) {
  4536. var duration = input,
  4537. // matching against regexp is expensive, do it on demand
  4538. match = null,
  4539. sign,
  4540. ret,
  4541. diffRes;
  4542. if (isDuration(input)) {
  4543. duration = {
  4544. ms : input._milliseconds,
  4545. d : input._days,
  4546. M : input._months
  4547. };
  4548. } else if (isNumber(input)) {
  4549. duration = {};
  4550. if (key) {
  4551. duration[key] = input;
  4552. } else {
  4553. duration.milliseconds = input;
  4554. }
  4555. } else if (!!(match = aspNetRegex.exec(input))) {
  4556. sign = (match[1] === '-') ? -1 : 1;
  4557. duration = {
  4558. y : 0,
  4559. d : toInt(match[DATE]) * sign,
  4560. h : toInt(match[HOUR]) * sign,
  4561. m : toInt(match[MINUTE]) * sign,
  4562. s : toInt(match[SECOND]) * sign,
  4563. ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
  4564. };
  4565. } else if (!!(match = isoRegex.exec(input))) {
  4566. sign = (match[1] === '-') ? -1 : 1;
  4567. duration = {
  4568. y : parseIso(match[2], sign),
  4569. M : parseIso(match[3], sign),
  4570. w : parseIso(match[4], sign),
  4571. d : parseIso(match[5], sign),
  4572. h : parseIso(match[6], sign),
  4573. m : parseIso(match[7], sign),
  4574. s : parseIso(match[8], sign)
  4575. };
  4576. } else if (duration == null) {// checks for null or undefined
  4577. duration = {};
  4578. } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
  4579. diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
  4580. duration = {};
  4581. duration.ms = diffRes.milliseconds;
  4582. duration.M = diffRes.months;
  4583. }
  4584. ret = new Duration(duration);
  4585. if (isDuration(input) && hasOwnProp(input, '_locale')) {
  4586. ret._locale = input._locale;
  4587. }
  4588. return ret;
  4589. }
  4590. createDuration.fn = Duration.prototype;
  4591. createDuration.invalid = createInvalid$1;
  4592. function parseIso (inp, sign) {
  4593. // We'd normally use ~~inp for this, but unfortunately it also
  4594. // converts floats to ints.
  4595. // inp may be undefined, so careful calling replace on it.
  4596. var res = inp && parseFloat(inp.replace(',', '.'));
  4597. // apply sign while we're at it
  4598. return (isNaN(res) ? 0 : res) * sign;
  4599. }
  4600. function positiveMomentsDifference(base, other) {
  4601. var res = {milliseconds: 0, months: 0};
  4602. res.months = other.month() - base.month() +
  4603. (other.year() - base.year()) * 12;
  4604. if (base.clone().add(res.months, 'M').isAfter(other)) {
  4605. --res.months;
  4606. }
  4607. res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
  4608. return res;
  4609. }
  4610. function momentsDifference(base, other) {
  4611. var res;
  4612. if (!(base.isValid() && other.isValid())) {
  4613. return {milliseconds: 0, months: 0};
  4614. }
  4615. other = cloneWithOffset(other, base);
  4616. if (base.isBefore(other)) {
  4617. res = positiveMomentsDifference(base, other);
  4618. } else {
  4619. res = positiveMomentsDifference(other, base);
  4620. res.milliseconds = -res.milliseconds;
  4621. res.months = -res.months;
  4622. }
  4623. return res;
  4624. }
  4625. // TODO: remove 'name' arg after deprecation is removed
  4626. function createAdder(direction, name) {
  4627. return function (val, period) {
  4628. var dur, tmp;
  4629. //invert the arguments, but complain about it
  4630. if (period !== null && !isNaN(+period)) {
  4631. deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
  4632. 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
  4633. tmp = val; val = period; period = tmp;
  4634. }
  4635. val = typeof val === 'string' ? +val : val;
  4636. dur = createDuration(val, period);
  4637. addSubtract(this, dur, direction);
  4638. return this;
  4639. };
  4640. }
  4641. function addSubtract (mom, duration, isAdding, updateOffset) {
  4642. var milliseconds = duration._milliseconds,
  4643. days = absRound(duration._days),
  4644. months = absRound(duration._months);
  4645. if (!mom.isValid()) {
  4646. // No op
  4647. return;
  4648. }
  4649. updateOffset = updateOffset == null ? true : updateOffset;
  4650. if (milliseconds) {
  4651. mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
  4652. }
  4653. if (days) {
  4654. set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
  4655. }
  4656. if (months) {
  4657. setMonth(mom, get(mom, 'Month') + months * isAdding);
  4658. }
  4659. if (updateOffset) {
  4660. hooks.updateOffset(mom, days || months);
  4661. }
  4662. }
  4663. var add = createAdder(1, 'add');
  4664. var subtract = createAdder(-1, 'subtract');
  4665. function getCalendarFormat(myMoment, now) {
  4666. var diff = myMoment.diff(now, 'days', true);
  4667. return diff < -6 ? 'sameElse' :
  4668. diff < -1 ? 'lastWeek' :
  4669. diff < 0 ? 'lastDay' :
  4670. diff < 1 ? 'sameDay' :
  4671. diff < 2 ? 'nextDay' :
  4672. diff < 7 ? 'nextWeek' : 'sameElse';
  4673. }
  4674. function calendar$1 (time, formats) {
  4675. // We want to compare the start of today, vs this.
  4676. // Getting start-of-today depends on whether we're local/utc/offset or not.
  4677. var now = time || createLocal(),
  4678. sod = cloneWithOffset(now, this).startOf('day'),
  4679. format = hooks.calendarFormat(this, sod) || 'sameElse';
  4680. var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
  4681. return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
  4682. }
  4683. function clone () {
  4684. return new Moment(this);
  4685. }
  4686. function isAfter (input, units) {
  4687. var localInput = isMoment(input) ? input : createLocal(input);
  4688. if (!(this.isValid() && localInput.isValid())) {
  4689. return false;
  4690. }
  4691. units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
  4692. if (units === 'millisecond') {
  4693. return this.valueOf() > localInput.valueOf();
  4694. } else {
  4695. return localInput.valueOf() < this.clone().startOf(units).valueOf();
  4696. }
  4697. }
  4698. function isBefore (input, units) {
  4699. var localInput = isMoment(input) ? input : createLocal(input);
  4700. if (!(this.isValid() && localInput.isValid())) {
  4701. return false;
  4702. }
  4703. units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
  4704. if (units === 'millisecond') {
  4705. return this.valueOf() < localInput.valueOf();
  4706. } else {
  4707. return this.clone().endOf(units).valueOf() < localInput.valueOf();
  4708. }
  4709. }
  4710. function isBetween (from, to, units, inclusivity) {
  4711. inclusivity = inclusivity || '()';
  4712. return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) &&
  4713. (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units));
  4714. }
  4715. function isSame (input, units) {
  4716. var localInput = isMoment(input) ? input : createLocal(input),
  4717. inputMs;
  4718. if (!(this.isValid() && localInput.isValid())) {
  4719. return false;
  4720. }
  4721. units = normalizeUnits(units || 'millisecond');
  4722. if (units === 'millisecond') {
  4723. return this.valueOf() === localInput.valueOf();
  4724. } else {
  4725. inputMs = localInput.valueOf();
  4726. return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
  4727. }
  4728. }
  4729. function isSameOrAfter (input, units) {
  4730. return this.isSame(input, units) || this.isAfter(input,units);
  4731. }
  4732. function isSameOrBefore (input, units) {
  4733. return this.isSame(input, units) || this.isBefore(input,units);
  4734. }
  4735. function diff (input, units, asFloat) {
  4736. var that,
  4737. zoneDelta,
  4738. delta, output;
  4739. if (!this.isValid()) {
  4740. return NaN;
  4741. }
  4742. that = cloneWithOffset(input, this);
  4743. if (!that.isValid()) {
  4744. return NaN;
  4745. }
  4746. zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  4747. units = normalizeUnits(units);
  4748. if (units === 'year' || units === 'month' || units === 'quarter') {
  4749. output = monthDiff(this, that);
  4750. if (units === 'quarter') {
  4751. output = output / 3;
  4752. } else if (units === 'year') {
  4753. output = output / 12;
  4754. }
  4755. } else {
  4756. delta = this - that;
  4757. output = units === 'second' ? delta / 1e3 : // 1000
  4758. units === 'minute' ? delta / 6e4 : // 1000 * 60
  4759. units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60
  4760. units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
  4761. units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
  4762. delta;
  4763. }
  4764. return asFloat ? output : absFloor(output);
  4765. }
  4766. function monthDiff (a, b) {
  4767. // difference in months
  4768. var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
  4769. // b is in (anchor - 1 month, anchor + 1 month)
  4770. anchor = a.clone().add(wholeMonthDiff, 'months'),
  4771. anchor2, adjust;
  4772. if (b - anchor < 0) {
  4773. anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
  4774. // linear across the month
  4775. adjust = (b - anchor) / (anchor - anchor2);
  4776. } else {
  4777. anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
  4778. // linear across the month
  4779. adjust = (b - anchor) / (anchor2 - anchor);
  4780. }
  4781. //check for negative zero, return zero if negative zero
  4782. return -(wholeMonthDiff + adjust) || 0;
  4783. }
  4784. hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
  4785. hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
  4786. function toString () {
  4787. return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
  4788. }
  4789. function toISOString() {
  4790. if (!this.isValid()) {
  4791. return null;
  4792. }
  4793. var m = this.clone().utc();
  4794. if (m.year() < 0 || m.year() > 9999) {
  4795. return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
  4796. }
  4797. if (isFunction(Date.prototype.toISOString)) {
  4798. // native implementation is ~50x faster, use it when we can
  4799. return this.toDate().toISOString();
  4800. }
  4801. return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
  4802. }
  4803. /**
  4804. * Return a human readable representation of a moment that can
  4805. * also be evaluated to get a new moment which is the same
  4806. *
  4807. * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
  4808. */
  4809. function inspect () {
  4810. if (!this.isValid()) {
  4811. return 'moment.invalid(/* ' + this._i + ' */)';
  4812. }
  4813. var func = 'moment';
  4814. var zone = '';
  4815. if (!this.isLocal()) {
  4816. func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
  4817. zone = 'Z';
  4818. }
  4819. var prefix = '[' + func + '("]';
  4820. var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';
  4821. var datetime = '-MM-DD[T]HH:mm:ss.SSS';
  4822. var suffix = zone + '[")]';
  4823. return this.format(prefix + year + datetime + suffix);
  4824. }
  4825. function format (inputString) {
  4826. if (!inputString) {
  4827. inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
  4828. }
  4829. var output = formatMoment(this, inputString);
  4830. return this.localeData().postformat(output);
  4831. }
  4832. function from (time, withoutSuffix) {
  4833. if (this.isValid() &&
  4834. ((isMoment(time) && time.isValid()) ||
  4835. createLocal(time).isValid())) {
  4836. return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
  4837. } else {
  4838. return this.localeData().invalidDate();
  4839. }
  4840. }
  4841. function fromNow (withoutSuffix) {
  4842. return this.from(createLocal(), withoutSuffix);
  4843. }
  4844. function to (time, withoutSuffix) {
  4845. if (this.isValid() &&
  4846. ((isMoment(time) && time.isValid()) ||
  4847. createLocal(time).isValid())) {
  4848. return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
  4849. } else {
  4850. return this.localeData().invalidDate();
  4851. }
  4852. }
  4853. function toNow (withoutSuffix) {
  4854. return this.to(createLocal(), withoutSuffix);
  4855. }
  4856. // If passed a locale key, it will set the locale for this
  4857. // instance. Otherwise, it will return the locale configuration
  4858. // variables for this instance.
  4859. function locale (key) {
  4860. var newLocaleData;
  4861. if (key === undefined) {
  4862. return this._locale._abbr;
  4863. } else {
  4864. newLocaleData = getLocale(key);
  4865. if (newLocaleData != null) {
  4866. this._locale = newLocaleData;
  4867. }
  4868. return this;
  4869. }
  4870. }
  4871. var lang = deprecate(
  4872. 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
  4873. function (key) {
  4874. if (key === undefined) {
  4875. return this.localeData();
  4876. } else {
  4877. return this.locale(key);
  4878. }
  4879. }
  4880. );
  4881. function localeData () {
  4882. return this._locale;
  4883. }
  4884. function startOf (units) {
  4885. units = normalizeUnits(units);
  4886. // the following switch intentionally omits break keywords
  4887. // to utilize falling through the cases.
  4888. switch (units) {
  4889. case 'year':
  4890. this.month(0);
  4891. /* falls through */
  4892. case 'quarter':
  4893. case 'month':
  4894. this.date(1);
  4895. /* falls through */
  4896. case 'week':
  4897. case 'isoWeek':
  4898. case 'day':
  4899. case 'date':
  4900. this.hours(0);
  4901. /* falls through */
  4902. case 'hour':
  4903. this.minutes(0);
  4904. /* falls through */
  4905. case 'minute':
  4906. this.seconds(0);
  4907. /* falls through */
  4908. case 'second':
  4909. this.milliseconds(0);
  4910. }
  4911. // weeks are a special case
  4912. if (units === 'week') {
  4913. this.weekday(0);
  4914. }
  4915. if (units === 'isoWeek') {
  4916. this.isoWeekday(1);
  4917. }
  4918. // quarters are also special
  4919. if (units === 'quarter') {
  4920. this.month(Math.floor(this.month() / 3) * 3);
  4921. }
  4922. return this;
  4923. }
  4924. function endOf (units) {
  4925. units = normalizeUnits(units);
  4926. if (units === undefined || units === 'millisecond') {
  4927. return this;
  4928. }
  4929. // 'date' is an alias for 'day', so it should be considered as such.
  4930. if (units === 'date') {
  4931. units = 'day';
  4932. }
  4933. return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
  4934. }
  4935. function valueOf () {
  4936. return this._d.valueOf() - ((this._offset || 0) * 60000);
  4937. }
  4938. function unix () {
  4939. return Math.floor(this.valueOf() / 1000);
  4940. }
  4941. function toDate () {
  4942. return new Date(this.valueOf());
  4943. }
  4944. function toArray () {
  4945. var m = this;
  4946. return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
  4947. }
  4948. function toObject () {
  4949. var m = this;
  4950. return {
  4951. years: m.year(),
  4952. months: m.month(),
  4953. date: m.date(),
  4954. hours: m.hours(),
  4955. minutes: m.minutes(),
  4956. seconds: m.seconds(),
  4957. milliseconds: m.milliseconds()
  4958. };
  4959. }
  4960. function toJSON () {
  4961. // new Date(NaN).toJSON() === null
  4962. return this.isValid() ? this.toISOString() : null;
  4963. }
  4964. function isValid$2 () {
  4965. return isValid(this);
  4966. }
  4967. function parsingFlags () {
  4968. return extend({}, getParsingFlags(this));
  4969. }
  4970. function invalidAt () {
  4971. return getParsingFlags(this).overflow;
  4972. }
  4973. function creationData() {
  4974. return {
  4975. input: this._i,
  4976. format: this._f,
  4977. locale: this._locale,
  4978. isUTC: this._isUTC,
  4979. strict: this._strict
  4980. };
  4981. }
  4982. // FORMATTING
  4983. addFormatToken(0, ['gg', 2], 0, function () {
  4984. return this.weekYear() % 100;
  4985. });
  4986. addFormatToken(0, ['GG', 2], 0, function () {
  4987. return this.isoWeekYear() % 100;
  4988. });
  4989. function addWeekYearFormatToken (token, getter) {
  4990. addFormatToken(0, [token, token.length], 0, getter);
  4991. }
  4992. addWeekYearFormatToken('gggg', 'weekYear');
  4993. addWeekYearFormatToken('ggggg', 'weekYear');
  4994. addWeekYearFormatToken('GGGG', 'isoWeekYear');
  4995. addWeekYearFormatToken('GGGGG', 'isoWeekYear');
  4996. // ALIASES
  4997. addUnitAlias('weekYear', 'gg');
  4998. addUnitAlias('isoWeekYear', 'GG');
  4999. // PRIORITY
  5000. addUnitPriority('weekYear', 1);
  5001. addUnitPriority('isoWeekYear', 1);
  5002. // PARSING
  5003. addRegexToken('G', matchSigned);
  5004. addRegexToken('g', matchSigned);
  5005. addRegexToken('GG', match1to2, match2);
  5006. addRegexToken('gg', match1to2, match2);
  5007. addRegexToken('GGGG', match1to4, match4);
  5008. addRegexToken('gggg', match1to4, match4);
  5009. addRegexToken('GGGGG', match1to6, match6);
  5010. addRegexToken('ggggg', match1to6, match6);
  5011. addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
  5012. week[token.substr(0, 2)] = toInt(input);
  5013. });
  5014. addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
  5015. week[token] = hooks.parseTwoDigitYear(input);
  5016. });
  5017. // MOMENTS
  5018. function getSetWeekYear (input) {
  5019. return getSetWeekYearHelper.call(this,
  5020. input,
  5021. this.week(),
  5022. this.weekday(),
  5023. this.localeData()._week.dow,
  5024. this.localeData()._week.doy);
  5025. }
  5026. function getSetISOWeekYear (input) {
  5027. return getSetWeekYearHelper.call(this,
  5028. input, this.isoWeek(), this.isoWeekday(), 1, 4);
  5029. }
  5030. function getISOWeeksInYear () {
  5031. return weeksInYear(this.year(), 1, 4);
  5032. }
  5033. function getWeeksInYear () {
  5034. var weekInfo = this.localeData()._week;
  5035. return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
  5036. }
  5037. function getSetWeekYearHelper(input, week, weekday, dow, doy) {
  5038. var weeksTarget;
  5039. if (input == null) {
  5040. return weekOfYear(this, dow, doy).year;
  5041. } else {
  5042. weeksTarget = weeksInYear(input, dow, doy);
  5043. if (week > weeksTarget) {
  5044. week = weeksTarget;
  5045. }
  5046. return setWeekAll.call(this, input, week, weekday, dow, doy);
  5047. }
  5048. }
  5049. function setWeekAll(weekYear, week, weekday, dow, doy) {
  5050. var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
  5051. date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  5052. this.year(date.getUTCFullYear());
  5053. this.month(date.getUTCMonth());
  5054. this.date(date.getUTCDate());
  5055. return this;
  5056. }
  5057. // FORMATTING
  5058. addFormatToken('Q', 0, 'Qo', 'quarter');
  5059. // ALIASES
  5060. addUnitAlias('quarter', 'Q');
  5061. // PRIORITY
  5062. addUnitPriority('quarter', 7);
  5063. // PARSING
  5064. addRegexToken('Q', match1);
  5065. addParseToken('Q', function (input, array) {
  5066. array[MONTH] = (toInt(input) - 1) * 3;
  5067. });
  5068. // MOMENTS
  5069. function getSetQuarter (input) {
  5070. return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
  5071. }
  5072. // FORMATTING
  5073. addFormatToken('D', ['DD', 2], 'Do', 'date');
  5074. // ALIASES
  5075. addUnitAlias('date', 'D');
  5076. // PRIOROITY
  5077. addUnitPriority('date', 9);
  5078. // PARSING
  5079. addRegexToken('D', match1to2);
  5080. addRegexToken('DD', match1to2, match2);
  5081. addRegexToken('Do', function (isStrict, locale) {
  5082. // TODO: Remove "ordinalParse" fallback in next major release.
  5083. return isStrict ?
  5084. (locale._dayOfMonthOrdinalParse || locale._ordinalParse) :
  5085. locale._dayOfMonthOrdinalParseLenient;
  5086. });
  5087. addParseToken(['D', 'DD'], DATE);
  5088. addParseToken('Do', function (input, array) {
  5089. array[DATE] = toInt(input.match(match1to2)[0], 10);
  5090. });
  5091. // MOMENTS
  5092. var getSetDayOfMonth = makeGetSet('Date', true);
  5093. // FORMATTING
  5094. addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
  5095. // ALIASES
  5096. addUnitAlias('dayOfYear', 'DDD');
  5097. // PRIORITY
  5098. addUnitPriority('dayOfYear', 4);
  5099. // PARSING
  5100. addRegexToken('DDD', match1to3);
  5101. addRegexToken('DDDD', match3);
  5102. addParseToken(['DDD', 'DDDD'], function (input, array, config) {
  5103. config._dayOfYear = toInt(input);
  5104. });
  5105. // HELPERS
  5106. // MOMENTS
  5107. function getSetDayOfYear (input) {
  5108. var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
  5109. return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
  5110. }
  5111. // FORMATTING
  5112. addFormatToken('m', ['mm', 2], 0, 'minute');
  5113. // ALIASES
  5114. addUnitAlias('minute', 'm');
  5115. // PRIORITY
  5116. addUnitPriority('minute', 14);
  5117. // PARSING
  5118. addRegexToken('m', match1to2);
  5119. addRegexToken('mm', match1to2, match2);
  5120. addParseToken(['m', 'mm'], MINUTE);
  5121. // MOMENTS
  5122. var getSetMinute = makeGetSet('Minutes', false);
  5123. // FORMATTING
  5124. addFormatToken('s', ['ss', 2], 0, 'second');
  5125. // ALIASES
  5126. addUnitAlias('second', 's');
  5127. // PRIORITY
  5128. addUnitPriority('second', 15);
  5129. // PARSING
  5130. addRegexToken('s', match1to2);
  5131. addRegexToken('ss', match1to2, match2);
  5132. addParseToken(['s', 'ss'], SECOND);
  5133. // MOMENTS
  5134. var getSetSecond = makeGetSet('Seconds', false);
  5135. // FORMATTING
  5136. addFormatToken('S', 0, 0, function () {
  5137. return ~~(this.millisecond() / 100);
  5138. });
  5139. addFormatToken(0, ['SS', 2], 0, function () {
  5140. return ~~(this.millisecond() / 10);
  5141. });
  5142. addFormatToken(0, ['SSS', 3], 0, 'millisecond');
  5143. addFormatToken(0, ['SSSS', 4], 0, function () {
  5144. return this.millisecond() * 10;
  5145. });
  5146. addFormatToken(0, ['SSSSS', 5], 0, function () {
  5147. return this.millisecond() * 100;
  5148. });
  5149. addFormatToken(0, ['SSSSSS', 6], 0, function () {
  5150. return this.millisecond() * 1000;
  5151. });
  5152. addFormatToken(0, ['SSSSSSS', 7], 0, function () {
  5153. return this.millisecond() * 10000;
  5154. });
  5155. addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
  5156. return this.millisecond() * 100000;
  5157. });
  5158. addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
  5159. return this.millisecond() * 1000000;
  5160. });
  5161. // ALIASES
  5162. addUnitAlias('millisecond', 'ms');
  5163. // PRIORITY
  5164. addUnitPriority('millisecond', 16);
  5165. // PARSING
  5166. addRegexToken('S', match1to3, match1);
  5167. addRegexToken('SS', match1to3, match2);
  5168. addRegexToken('SSS', match1to3, match3);
  5169. var token;
  5170. for (token = 'SSSS'; token.length <= 9; token += 'S') {
  5171. addRegexToken(token, matchUnsigned);
  5172. }
  5173. function parseMs(input, array) {
  5174. array[MILLISECOND] = toInt(('0.' + input) * 1000);
  5175. }
  5176. for (token = 'S'; token.length <= 9; token += 'S') {
  5177. addParseToken(token, parseMs);
  5178. }
  5179. // MOMENTS
  5180. var getSetMillisecond = makeGetSet('Milliseconds', false);
  5181. // FORMATTING
  5182. addFormatToken('z', 0, 0, 'zoneAbbr');
  5183. addFormatToken('zz', 0, 0, 'zoneName');
  5184. // MOMENTS
  5185. function getZoneAbbr () {
  5186. return this._isUTC ? 'UTC' : '';
  5187. }
  5188. function getZoneName () {
  5189. return this._isUTC ? 'Coordinated Universal Time' : '';
  5190. }
  5191. var proto = Moment.prototype;
  5192. proto.add = add;
  5193. proto.calendar = calendar$1;
  5194. proto.clone = clone;
  5195. proto.diff = diff;
  5196. proto.endOf = endOf;
  5197. proto.format = format;
  5198. proto.from = from;
  5199. proto.fromNow = fromNow;
  5200. proto.to = to;
  5201. proto.toNow = toNow;
  5202. proto.get = stringGet;
  5203. proto.invalidAt = invalidAt;
  5204. proto.isAfter = isAfter;
  5205. proto.isBefore = isBefore;
  5206. proto.isBetween = isBetween;
  5207. proto.isSame = isSame;
  5208. proto.isSameOrAfter = isSameOrAfter;
  5209. proto.isSameOrBefore = isSameOrBefore;
  5210. proto.isValid = isValid$2;
  5211. proto.lang = lang;
  5212. proto.locale = locale;
  5213. proto.localeData = localeData;
  5214. proto.max = prototypeMax;
  5215. proto.min = prototypeMin;
  5216. proto.parsingFlags = parsingFlags;
  5217. proto.set = stringSet;
  5218. proto.startOf = startOf;
  5219. proto.subtract = subtract;
  5220. proto.toArray = toArray;
  5221. proto.toObject = toObject;
  5222. proto.toDate = toDate;
  5223. proto.toISOString = toISOString;
  5224. proto.inspect = inspect;
  5225. proto.toJSON = toJSON;
  5226. proto.toString = toString;
  5227. proto.unix = unix;
  5228. proto.valueOf = valueOf;
  5229. proto.creationData = creationData;
  5230. // Year
  5231. proto.year = getSetYear;
  5232. proto.isLeapYear = getIsLeapYear;
  5233. // Week Year
  5234. proto.weekYear = getSetWeekYear;
  5235. proto.isoWeekYear = getSetISOWeekYear;
  5236. // Quarter
  5237. proto.quarter = proto.quarters = getSetQuarter;
  5238. // Month
  5239. proto.month = getSetMonth;
  5240. proto.daysInMonth = getDaysInMonth;
  5241. // Week
  5242. proto.week = proto.weeks = getSetWeek;
  5243. proto.isoWeek = proto.isoWeeks = getSetISOWeek;
  5244. proto.weeksInYear = getWeeksInYear;
  5245. proto.isoWeeksInYear = getISOWeeksInYear;
  5246. // Day
  5247. proto.date = getSetDayOfMonth;
  5248. proto.day = proto.days = getSetDayOfWeek;
  5249. proto.weekday = getSetLocaleDayOfWeek;
  5250. proto.isoWeekday = getSetISODayOfWeek;
  5251. proto.dayOfYear = getSetDayOfYear;
  5252. // Hour
  5253. proto.hour = proto.hours = getSetHour;
  5254. // Minute
  5255. proto.minute = proto.minutes = getSetMinute;
  5256. // Second
  5257. proto.second = proto.seconds = getSetSecond;
  5258. // Millisecond
  5259. proto.millisecond = proto.milliseconds = getSetMillisecond;
  5260. // Offset
  5261. proto.utcOffset = getSetOffset;
  5262. proto.utc = setOffsetToUTC;
  5263. proto.local = setOffsetToLocal;
  5264. proto.parseZone = setOffsetToParsedOffset;
  5265. proto.hasAlignedHourOffset = hasAlignedHourOffset;
  5266. proto.isDST = isDaylightSavingTime;
  5267. proto.isLocal = isLocal;
  5268. proto.isUtcOffset = isUtcOffset;
  5269. proto.isUtc = isUtc;
  5270. proto.isUTC = isUtc;
  5271. // Timezone
  5272. proto.zoneAbbr = getZoneAbbr;
  5273. proto.zoneName = getZoneName;
  5274. // Deprecations
  5275. proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
  5276. proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
  5277. proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
  5278. proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
  5279. proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
  5280. function createUnix (input) {
  5281. return createLocal(input * 1000);
  5282. }
  5283. function createInZone () {
  5284. return createLocal.apply(null, arguments).parseZone();
  5285. }
  5286. function preParsePostFormat (string) {
  5287. return string;
  5288. }
  5289. var proto$1 = Locale.prototype;
  5290. proto$1.calendar = calendar;
  5291. proto$1.longDateFormat = longDateFormat;
  5292. proto$1.invalidDate = invalidDate;
  5293. proto$1.ordinal = ordinal;
  5294. proto$1.preparse = preParsePostFormat;
  5295. proto$1.postformat = preParsePostFormat;
  5296. proto$1.relativeTime = relativeTime;
  5297. proto$1.pastFuture = pastFuture;
  5298. proto$1.set = set;
  5299. // Month
  5300. proto$1.months = localeMonths;
  5301. proto$1.monthsShort = localeMonthsShort;
  5302. proto$1.monthsParse = localeMonthsParse;
  5303. proto$1.monthsRegex = monthsRegex;
  5304. proto$1.monthsShortRegex = monthsShortRegex;
  5305. // Week
  5306. proto$1.week = localeWeek;
  5307. proto$1.firstDayOfYear = localeFirstDayOfYear;
  5308. proto$1.firstDayOfWeek = localeFirstDayOfWeek;
  5309. // Day of Week
  5310. proto$1.weekdays = localeWeekdays;
  5311. proto$1.weekdaysMin = localeWeekdaysMin;
  5312. proto$1.weekdaysShort = localeWeekdaysShort;
  5313. proto$1.weekdaysParse = localeWeekdaysParse;
  5314. proto$1.weekdaysRegex = weekdaysRegex;
  5315. proto$1.weekdaysShortRegex = weekdaysShortRegex;
  5316. proto$1.weekdaysMinRegex = weekdaysMinRegex;
  5317. // Hours
  5318. proto$1.isPM = localeIsPM;
  5319. proto$1.meridiem = localeMeridiem;
  5320. function get$1 (format, index, field, setter) {
  5321. var locale = getLocale();
  5322. var utc = createUTC().set(setter, index);
  5323. return locale[field](utc, format);
  5324. }
  5325. function listMonthsImpl (format, index, field) {
  5326. if (isNumber(format)) {
  5327. index = format;
  5328. format = undefined;
  5329. }
  5330. format = format || '';
  5331. if (index != null) {
  5332. return get$1(format, index, field, 'month');
  5333. }
  5334. var i;
  5335. var out = [];
  5336. for (i = 0; i < 12; i++) {
  5337. out[i] = get$1(format, i, field, 'month');
  5338. }
  5339. return out;
  5340. }
  5341. // ()
  5342. // (5)
  5343. // (fmt, 5)
  5344. // (fmt)
  5345. // (true)
  5346. // (true, 5)
  5347. // (true, fmt, 5)
  5348. // (true, fmt)
  5349. function listWeekdaysImpl (localeSorted, format, index, field) {
  5350. if (typeof localeSorted === 'boolean') {
  5351. if (isNumber(format)) {
  5352. index = format;
  5353. format = undefined;
  5354. }
  5355. format = format || '';
  5356. } else {
  5357. format = localeSorted;
  5358. index = format;
  5359. localeSorted = false;
  5360. if (isNumber(format)) {
  5361. index = format;
  5362. format = undefined;
  5363. }
  5364. format = format || '';
  5365. }
  5366. var locale = getLocale(),
  5367. shift = localeSorted ? locale._week.dow : 0;
  5368. if (index != null) {
  5369. return get$1(format, (index + shift) % 7, field, 'day');
  5370. }
  5371. var i;
  5372. var out = [];
  5373. for (i = 0; i < 7; i++) {
  5374. out[i] = get$1(format, (i + shift) % 7, field, 'day');
  5375. }
  5376. return out;
  5377. }
  5378. function listMonths (format, index) {
  5379. return listMonthsImpl(format, index, 'months');
  5380. }
  5381. function listMonthsShort (format, index) {
  5382. return listMonthsImpl(format, index, 'monthsShort');
  5383. }
  5384. function listWeekdays (localeSorted, format, index) {
  5385. return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
  5386. }
  5387. function listWeekdaysShort (localeSorted, format, index) {
  5388. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
  5389. }
  5390. function listWeekdaysMin (localeSorted, format, index) {
  5391. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
  5392. }
  5393. getSetGlobalLocale('en', {
  5394. dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  5395. ordinal : function (number) {
  5396. var b = number % 10,
  5397. output = (toInt(number % 100 / 10) === 1) ? 'th' :
  5398. (b === 1) ? 'st' :
  5399. (b === 2) ? 'nd' :
  5400. (b === 3) ? 'rd' : 'th';
  5401. return number + output;
  5402. }
  5403. });
  5404. // Side effect imports
  5405. hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
  5406. hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
  5407. var mathAbs = Math.abs;
  5408. function abs () {
  5409. var data = this._data;
  5410. this._milliseconds = mathAbs(this._milliseconds);
  5411. this._days = mathAbs(this._days);
  5412. this._months = mathAbs(this._months);
  5413. data.milliseconds = mathAbs(data.milliseconds);
  5414. data.seconds = mathAbs(data.seconds);
  5415. data.minutes = mathAbs(data.minutes);
  5416. data.hours = mathAbs(data.hours);
  5417. data.months = mathAbs(data.months);
  5418. data.years = mathAbs(data.years);
  5419. return this;
  5420. }
  5421. function addSubtract$1 (duration, input, value, direction) {
  5422. var other = createDuration(input, value);
  5423. duration._milliseconds += direction * other._milliseconds;
  5424. duration._days += direction * other._days;
  5425. duration._months += direction * other._months;
  5426. return duration._bubble();
  5427. }
  5428. // supports only 2.0-style add(1, 's') or add(duration)
  5429. function add$1 (input, value) {
  5430. return addSubtract$1(this, input, value, 1);
  5431. }
  5432. // supports only 2.0-style subtract(1, 's') or subtract(duration)
  5433. function subtract$1 (input, value) {
  5434. return addSubtract$1(this, input, value, -1);
  5435. }
  5436. function absCeil (number) {
  5437. if (number < 0) {
  5438. return Math.floor(number);
  5439. } else {
  5440. return Math.ceil(number);
  5441. }
  5442. }
  5443. function bubble () {
  5444. var milliseconds = this._milliseconds;
  5445. var days = this._days;
  5446. var months = this._months;
  5447. var data = this._data;
  5448. var seconds, minutes, hours, years, monthsFromDays;
  5449. // if we have a mix of positive and negative values, bubble down first
  5450. // check: https://github.com/moment/moment/issues/2166
  5451. if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
  5452. (milliseconds <= 0 && days <= 0 && months <= 0))) {
  5453. milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
  5454. days = 0;
  5455. months = 0;
  5456. }
  5457. // The following code bubbles up values, see the tests for
  5458. // examples of what that means.
  5459. data.milliseconds = milliseconds % 1000;
  5460. seconds = absFloor(milliseconds / 1000);
  5461. data.seconds = seconds % 60;
  5462. minutes = absFloor(seconds / 60);
  5463. data.minutes = minutes % 60;
  5464. hours = absFloor(minutes / 60);
  5465. data.hours = hours % 24;
  5466. days += absFloor(hours / 24);
  5467. // convert days to months
  5468. monthsFromDays = absFloor(daysToMonths(days));
  5469. months += monthsFromDays;
  5470. days -= absCeil(monthsToDays(monthsFromDays));
  5471. // 12 months -> 1 year
  5472. years = absFloor(months / 12);
  5473. months %= 12;
  5474. data.days = days;
  5475. data.months = months;
  5476. data.years = years;
  5477. return this;
  5478. }
  5479. function daysToMonths (days) {
  5480. // 400 years have 146097 days (taking into account leap year rules)
  5481. // 400 years have 12 months === 4800
  5482. return days * 4800 / 146097;
  5483. }
  5484. function monthsToDays (months) {
  5485. // the reverse of daysToMonths
  5486. return months * 146097 / 4800;
  5487. }
  5488. function as (units) {
  5489. if (!this.isValid()) {
  5490. return NaN;
  5491. }
  5492. var days;
  5493. var months;
  5494. var milliseconds = this._milliseconds;
  5495. units = normalizeUnits(units);
  5496. if (units === 'month' || units === 'year') {
  5497. days = this._days + milliseconds / 864e5;
  5498. months = this._months + daysToMonths(days);
  5499. return units === 'month' ? months : months / 12;
  5500. } else {
  5501. // handle milliseconds separately because of floating point math errors (issue #1867)
  5502. days = this._days + Math.round(monthsToDays(this._months));
  5503. switch (units) {
  5504. case 'week' : return days / 7 + milliseconds / 6048e5;
  5505. case 'day' : return days + milliseconds / 864e5;
  5506. case 'hour' : return days * 24 + milliseconds / 36e5;
  5507. case 'minute' : return days * 1440 + milliseconds / 6e4;
  5508. case 'second' : return days * 86400 + milliseconds / 1000;
  5509. // Math.floor prevents floating point math errors here
  5510. case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
  5511. default: throw new Error('Unknown unit ' + units);
  5512. }
  5513. }
  5514. }
  5515. // TODO: Use this.as('ms')?
  5516. function valueOf$1 () {
  5517. if (!this.isValid()) {
  5518. return NaN;
  5519. }
  5520. return (
  5521. this._milliseconds +
  5522. this._days * 864e5 +
  5523. (this._months % 12) * 2592e6 +
  5524. toInt(this._months / 12) * 31536e6
  5525. );
  5526. }
  5527. function makeAs (alias) {
  5528. return function () {
  5529. return this.as(alias);
  5530. };
  5531. }
  5532. var asMilliseconds = makeAs('ms');
  5533. var asSeconds = makeAs('s');
  5534. var asMinutes = makeAs('m');
  5535. var asHours = makeAs('h');
  5536. var asDays = makeAs('d');
  5537. var asWeeks = makeAs('w');
  5538. var asMonths = makeAs('M');
  5539. var asYears = makeAs('y');
  5540. function get$2 (units) {
  5541. units = normalizeUnits(units);
  5542. return this.isValid() ? this[units + 's']() : NaN;
  5543. }
  5544. function makeGetter(name) {
  5545. return function () {
  5546. return this.isValid() ? this._data[name] : NaN;
  5547. };
  5548. }
  5549. var milliseconds = makeGetter('milliseconds');
  5550. var seconds = makeGetter('seconds');
  5551. var minutes = makeGetter('minutes');
  5552. var hours = makeGetter('hours');
  5553. var days = makeGetter('days');
  5554. var months = makeGetter('months');
  5555. var years = makeGetter('years');
  5556. function weeks () {
  5557. return absFloor(this.days() / 7);
  5558. }
  5559. var round = Math.round;
  5560. var thresholds = {
  5561. ss: 44, // a few seconds to seconds
  5562. s : 45, // seconds to minute
  5563. m : 45, // minutes to hour
  5564. h : 22, // hours to day
  5565. d : 26, // days to month
  5566. M : 11 // months to year
  5567. };
  5568. // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
  5569. function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
  5570. return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
  5571. }
  5572. function relativeTime$1 (posNegDuration, withoutSuffix, locale) {
  5573. var duration = createDuration(posNegDuration).abs();
  5574. var seconds = round(duration.as('s'));
  5575. var minutes = round(duration.as('m'));
  5576. var hours = round(duration.as('h'));
  5577. var days = round(duration.as('d'));
  5578. var months = round(duration.as('M'));
  5579. var years = round(duration.as('y'));
  5580. var a = seconds <= thresholds.ss && ['s', seconds] ||
  5581. seconds < thresholds.s && ['ss', seconds] ||
  5582. minutes <= 1 && ['m'] ||
  5583. minutes < thresholds.m && ['mm', minutes] ||
  5584. hours <= 1 && ['h'] ||
  5585. hours < thresholds.h && ['hh', hours] ||
  5586. days <= 1 && ['d'] ||
  5587. days < thresholds.d && ['dd', days] ||
  5588. months <= 1 && ['M'] ||
  5589. months < thresholds.M && ['MM', months] ||
  5590. years <= 1 && ['y'] || ['yy', years];
  5591. a[2] = withoutSuffix;
  5592. a[3] = +posNegDuration > 0;
  5593. a[4] = locale;
  5594. return substituteTimeAgo.apply(null, a);
  5595. }
  5596. // This function allows you to set the rounding function for relative time strings
  5597. function getSetRelativeTimeRounding (roundingFunction) {
  5598. if (roundingFunction === undefined) {
  5599. return round;
  5600. }
  5601. if (typeof(roundingFunction) === 'function') {
  5602. round = roundingFunction;
  5603. return true;
  5604. }
  5605. return false;
  5606. }
  5607. // This function allows you to set a threshold for relative time strings
  5608. function getSetRelativeTimeThreshold (threshold, limit) {
  5609. if (thresholds[threshold] === undefined) {
  5610. return false;
  5611. }
  5612. if (limit === undefined) {
  5613. return thresholds[threshold];
  5614. }
  5615. thresholds[threshold] = limit;
  5616. if (threshold === 's') {
  5617. thresholds.ss = limit - 1;
  5618. }
  5619. return true;
  5620. }
  5621. function humanize (withSuffix) {
  5622. if (!this.isValid()) {
  5623. return this.localeData().invalidDate();
  5624. }
  5625. var locale = this.localeData();
  5626. var output = relativeTime$1(this, !withSuffix, locale);
  5627. if (withSuffix) {
  5628. output = locale.pastFuture(+this, output);
  5629. }
  5630. return locale.postformat(output);
  5631. }
  5632. var abs$1 = Math.abs;
  5633. function toISOString$1() {
  5634. // for ISO strings we do not use the normal bubbling rules:
  5635. // * milliseconds bubble up until they become hours
  5636. // * days do not bubble at all
  5637. // * months bubble up until they become years
  5638. // This is because there is no context-free conversion between hours and days
  5639. // (think of clock changes)
  5640. // and also not between days and months (28-31 days per month)
  5641. if (!this.isValid()) {
  5642. return this.localeData().invalidDate();
  5643. }
  5644. var seconds = abs$1(this._milliseconds) / 1000;
  5645. var days = abs$1(this._days);
  5646. var months = abs$1(this._months);
  5647. var minutes, hours, years;
  5648. // 3600 seconds -> 60 minutes -> 1 hour
  5649. minutes = absFloor(seconds / 60);
  5650. hours = absFloor(minutes / 60);
  5651. seconds %= 60;
  5652. minutes %= 60;
  5653. // 12 months -> 1 year
  5654. years = absFloor(months / 12);
  5655. months %= 12;
  5656. // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
  5657. var Y = years;
  5658. var M = months;
  5659. var D = days;
  5660. var h = hours;
  5661. var m = minutes;
  5662. var s = seconds;
  5663. var total = this.asSeconds();
  5664. if (!total) {
  5665. // this is the same as C#'s (Noda) and python (isodate)...
  5666. // but not other JS (goog.date)
  5667. return 'P0D';
  5668. }
  5669. return (total < 0 ? '-' : '') +
  5670. 'P' +
  5671. (Y ? Y + 'Y' : '') +
  5672. (M ? M + 'M' : '') +
  5673. (D ? D + 'D' : '') +
  5674. ((h || m || s) ? 'T' : '') +
  5675. (h ? h + 'H' : '') +
  5676. (m ? m + 'M' : '') +
  5677. (s ? s + 'S' : '');
  5678. }
  5679. var proto$2 = Duration.prototype;
  5680. proto$2.isValid = isValid$1;
  5681. proto$2.abs = abs;
  5682. proto$2.add = add$1;
  5683. proto$2.subtract = subtract$1;
  5684. proto$2.as = as;
  5685. proto$2.asMilliseconds = asMilliseconds;
  5686. proto$2.asSeconds = asSeconds;
  5687. proto$2.asMinutes = asMinutes;
  5688. proto$2.asHours = asHours;
  5689. proto$2.asDays = asDays;
  5690. proto$2.asWeeks = asWeeks;
  5691. proto$2.asMonths = asMonths;
  5692. proto$2.asYears = asYears;
  5693. proto$2.valueOf = valueOf$1;
  5694. proto$2._bubble = bubble;
  5695. proto$2.get = get$2;
  5696. proto$2.milliseconds = milliseconds;
  5697. proto$2.seconds = seconds;
  5698. proto$2.minutes = minutes;
  5699. proto$2.hours = hours;
  5700. proto$2.days = days;
  5701. proto$2.weeks = weeks;
  5702. proto$2.months = months;
  5703. proto$2.years = years;
  5704. proto$2.humanize = humanize;
  5705. proto$2.toISOString = toISOString$1;
  5706. proto$2.toString = toISOString$1;
  5707. proto$2.toJSON = toISOString$1;
  5708. proto$2.locale = locale;
  5709. proto$2.localeData = localeData;
  5710. // Deprecations
  5711. proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1);
  5712. proto$2.lang = lang;
  5713. // Side effect imports
  5714. // FORMATTING
  5715. addFormatToken('X', 0, 0, 'unix');
  5716. addFormatToken('x', 0, 0, 'valueOf');
  5717. // PARSING
  5718. addRegexToken('x', matchSigned);
  5719. addRegexToken('X', matchTimestamp);
  5720. addParseToken('X', function (input, array, config) {
  5721. config._d = new Date(parseFloat(input, 10) * 1000);
  5722. });
  5723. addParseToken('x', function (input, array, config) {
  5724. config._d = new Date(toInt(input));
  5725. });
  5726. // Side effect imports
  5727. hooks.version = '2.18.1';
  5728. setHookCallback(createLocal);
  5729. hooks.fn = proto;
  5730. hooks.min = min;
  5731. hooks.max = max;
  5732. hooks.now = now;
  5733. hooks.utc = createUTC;
  5734. hooks.unix = createUnix;
  5735. hooks.months = listMonths;
  5736. hooks.isDate = isDate;
  5737. hooks.locale = getSetGlobalLocale;
  5738. hooks.invalid = createInvalid;
  5739. hooks.duration = createDuration;
  5740. hooks.isMoment = isMoment;
  5741. hooks.weekdays = listWeekdays;
  5742. hooks.parseZone = createInZone;
  5743. hooks.localeData = getLocale;
  5744. hooks.isDuration = isDuration;
  5745. hooks.monthsShort = listMonthsShort;
  5746. hooks.weekdaysMin = listWeekdaysMin;
  5747. hooks.defineLocale = defineLocale;
  5748. hooks.updateLocale = updateLocale;
  5749. hooks.locales = listLocales;
  5750. hooks.weekdaysShort = listWeekdaysShort;
  5751. hooks.normalizeUnits = normalizeUnits;
  5752. hooks.relativeTimeRounding = getSetRelativeTimeRounding;
  5753. hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
  5754. hooks.calendarFormat = getCalendarFormat;
  5755. hooks.prototype = proto;
  5756. return hooks;
  5757. })));
  5758. define('moment', ['moment/moment'], function (main) { return main; });
  5759. define('backend',['fast', 'moment'], function (Fast, Moment) {
  5760. var Backend = {
  5761. api: {
  5762. sidebar: function (params) {
  5763. colorArr = ['red', 'green', 'yellow', 'blue', 'teal', 'orange', 'purple'];
  5764. $colorNums = colorArr.length;
  5765. badgeList = {};
  5766. $.each(params, function (k, v) {
  5767. $url = Fast.api.fixurl(k);
  5768. if ($.isArray(v))
  5769. {
  5770. $nums = typeof v[0] !== 'undefined' ? v[0] : 0;
  5771. $color = typeof v[1] !== 'undefined' ? v[1] : colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  5772. $class = typeof v[2] !== 'undefined' ? v[2] : 'label';
  5773. } else
  5774. {
  5775. $nums = v;
  5776. $color = colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  5777. $class = 'label';
  5778. }
  5779. //必须nums大于0才显示
  5780. badgeList[$url] = $nums > 0 ? '<small class="' + $class + ' pull-right bg-' + $color + '">' + $nums + '</small>' : '';
  5781. });
  5782. $.each(badgeList, function (k, v) {
  5783. var anchor = top.window.$("li a[addtabs][url='" + k + "']");
  5784. if (anchor) {
  5785. top.window.$(".pull-right-container", anchor).html(v);
  5786. top.window.$(".nav-addtabs li a[node-id='" + anchor.attr("addtabs") + "'] .pull-right-container").html(v);
  5787. }
  5788. });
  5789. },
  5790. addtabs: function (url, title, icon) {
  5791. var dom = "a[url='{url}']"
  5792. var leftlink = top.window.$(dom.replace(/\{url\}/, url));
  5793. if (leftlink.size() > 0) {
  5794. leftlink.trigger("click");
  5795. } else {
  5796. url = Fast.api.fixurl(url);
  5797. leftlink = top.window.$(dom.replace(/\{url\}/, url));
  5798. if (leftlink.size() > 0) {
  5799. var event = leftlink.parent().hasClass("active") ? "dblclick" : "click";
  5800. leftlink.trigger(event);
  5801. } else {
  5802. var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
  5803. leftlink = top.window.$(dom.replace(/\{url\}/, baseurl));
  5804. //能找到相对地址
  5805. if (leftlink.size() > 0) {
  5806. icon = typeof icon !== 'undefined' ? icon : leftlink.find("i").attr("class");
  5807. title = typeof title !== 'undefined' ? title : leftlink.find("span:first").text();
  5808. leftlink.trigger("fa.event.toggleitem");
  5809. }
  5810. var navnode = $(".nav-tabs ul li a[node-url='" + url + "']");
  5811. if (navnode.size() > 0) {
  5812. navnode.trigger("click");
  5813. } else {
  5814. //追加新的tab
  5815. var id = Math.floor(new Date().valueOf() * Math.random());
  5816. icon = typeof icon !== 'undefined' ? icon : 'fa fa-circle-o';
  5817. title = typeof title !== 'undefined' ? title : '';
  5818. 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");
  5819. }
  5820. }
  5821. }
  5822. },
  5823. },
  5824. init: function () {
  5825. //公共代码
  5826. //配置Toastr的参数
  5827. Toastr.options.positionClass = Config.controllername === 'index' ? "toast-top-right-index" : "toast-top-right";
  5828. //点击包含.btn-dialog的元素时弹出dialog
  5829. $(document).on('click', '.btn-dialog,.dialogit', function (e) {
  5830. e.preventDefault();
  5831. var options = $(this).data();
  5832. options = options ? options : {};
  5833. Backend.api.open(Backend.api.fixurl($(this).attr('href')), $(this).attr('title'), options);
  5834. });
  5835. //点击包含.btn-addtabs的元素时事件
  5836. $(document).on('click', '.btn-addtabs,.addtabsit', function (e) {
  5837. e.preventDefault();
  5838. Backend.api.addtabs($(this).attr("href"), $(this).attr("title"));
  5839. });
  5840. //点击包含.btn-ajax的元素时事件
  5841. $(document).on('click', '.btn-ajax,.ajaxit', function (e) {
  5842. e.preventDefault();
  5843. var options = $(this).data();
  5844. if (typeof options.url === 'undefined' && $(this).attr("href")) {
  5845. options.url = $(this).attr("href");
  5846. }
  5847. Backend.api.ajax(options);
  5848. });
  5849. //修复含有fixed-footer类的body边距
  5850. if ($(".fixed-footer").size() > 0) {
  5851. $(document.body).css("padding-bottom", $(".fixed-footer").height());
  5852. }
  5853. }
  5854. };
  5855. Backend.api = $.extend(Fast.api, Backend.api);
  5856. //将Moment渲染至全局,以便于在子框架中调用
  5857. window.Moment = Moment;
  5858. //将Backend渲染至全局,以便于在子框架中调用
  5859. window.Backend = Backend;
  5860. Backend.init();
  5861. return Backend;
  5862. });
  5863. //! moment.js locale configuration
  5864. //! locale : Chinese (China) [zh-cn]
  5865. //! author : suupic : https://github.com/suupic
  5866. //! author : Zeno Zeng : https://github.com/zenozeng
  5867. ;(function (global, factory) {
  5868. typeof exports === 'object' && typeof module !== 'undefined'
  5869. && typeof require === 'function' ? factory(require('../moment')) :
  5870. typeof define === 'function' && define.amd ? define('moment/locale/zh-cn',['../moment'], factory) :
  5871. factory(global.moment)
  5872. }(this, (function (moment) { 'use strict';
  5873. var zhCn = moment.defineLocale('zh-cn', {
  5874. months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
  5875. monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
  5876. weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  5877. weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  5878. weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
  5879. longDateFormat : {
  5880. LT : 'HH:mm',
  5881. LTS : 'HH:mm:ss',
  5882. L : 'YYYY年MMMD日',
  5883. LL : 'YYYY年MMMD日',
  5884. LLL : 'YYYY年MMMD日Ah点mm分',
  5885. LLLL : 'YYYY年MMMD日ddddAh点mm分',
  5886. l : 'YYYY年MMMD日',
  5887. ll : 'YYYY年MMMD日',
  5888. lll : 'YYYY年MMMD日 HH:mm',
  5889. llll : 'YYYY年MMMD日dddd HH:mm'
  5890. },
  5891. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  5892. meridiemHour: function (hour, meridiem) {
  5893. if (hour === 12) {
  5894. hour = 0;
  5895. }
  5896. if (meridiem === '凌晨' || meridiem === '早上' ||
  5897. meridiem === '上午') {
  5898. return hour;
  5899. } else if (meridiem === '下午' || meridiem === '晚上') {
  5900. return hour + 12;
  5901. } else {
  5902. // '中午'
  5903. return hour >= 11 ? hour : hour + 12;
  5904. }
  5905. },
  5906. meridiem : function (hour, minute, isLower) {
  5907. var hm = hour * 100 + minute;
  5908. if (hm < 600) {
  5909. return '凌晨';
  5910. } else if (hm < 900) {
  5911. return '早上';
  5912. } else if (hm < 1130) {
  5913. return '上午';
  5914. } else if (hm < 1230) {
  5915. return '中午';
  5916. } else if (hm < 1800) {
  5917. return '下午';
  5918. } else {
  5919. return '晚上';
  5920. }
  5921. },
  5922. calendar : {
  5923. sameDay : '[今天]LT',
  5924. nextDay : '[明天]LT',
  5925. nextWeek : '[下]ddddLT',
  5926. lastDay : '[昨天]LT',
  5927. lastWeek : '[上]ddddLT',
  5928. sameElse : 'L'
  5929. },
  5930. dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
  5931. ordinal : function (number, period) {
  5932. switch (period) {
  5933. case 'd':
  5934. case 'D':
  5935. case 'DDD':
  5936. return number + '日';
  5937. case 'M':
  5938. return number + '月';
  5939. case 'w':
  5940. case 'W':
  5941. return number + '周';
  5942. default:
  5943. return number;
  5944. }
  5945. },
  5946. relativeTime : {
  5947. future : '%s内',
  5948. past : '%s前',
  5949. s : '几秒',
  5950. m : '1 分钟',
  5951. mm : '%d 分钟',
  5952. h : '1 小时',
  5953. hh : '%d 小时',
  5954. d : '1 天',
  5955. dd : '%d 天',
  5956. M : '1 个月',
  5957. MM : '%d 个月',
  5958. y : '1 年',
  5959. yy : '%d 年'
  5960. },
  5961. week : {
  5962. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  5963. dow : 1, // Monday is the first day of the week.
  5964. doy : 4 // The week that contains Jan 4th is the first week of the year.
  5965. }
  5966. });
  5967. return zhCn;
  5968. })));
  5969. /*
  5970. * bootstrap-table - v1.11.1 - 2017-02-22
  5971. * https://github.com/wenzhixin/bootstrap-table
  5972. * Copyright (c) 2017 zhixin wen
  5973. * Licensed MIT License
  5974. */
  5975. !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++){
  5976. 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);
  5977. define("bootstrap-table", ["bootstrap"], (function (global) {
  5978. return function () {
  5979. var ret, fn;
  5980. return ret || global.$.fn.bootstrapTable;
  5981. };
  5982. }(this)));
  5983. /**
  5984. * Bootstrap Table Chinese translation
  5985. * Author: Zhixin Wen<wenzhixin2010@gmail.com>
  5986. */
  5987. (function ($) {
  5988. 'use strict';
  5989. $.fn.bootstrapTable.locales['zh-CN'] = {
  5990. formatLoadingMessage: function () {
  5991. return '正在努力地加载数据中,请稍候……';
  5992. },
  5993. formatRecordsPerPage: function (pageNumber) {
  5994. return '每页显示 ' + pageNumber + ' 条记录';
  5995. },
  5996. formatShowingRows: function (pageFrom, pageTo, totalRows) {
  5997. return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
  5998. },
  5999. formatSearch: function () {
  6000. return '搜索';
  6001. },
  6002. formatNoMatches: function () {
  6003. return '没有找到匹配的记录';
  6004. },
  6005. formatPaginationSwitch: function () {
  6006. return '隐藏/显示分页';
  6007. },
  6008. formatRefresh: function () {
  6009. return '刷新';
  6010. },
  6011. formatToggle: function () {
  6012. return '切换';
  6013. },
  6014. formatColumns: function () {
  6015. return '列';
  6016. },
  6017. formatExport: function () {
  6018. return '导出数据';
  6019. },
  6020. formatClearFilters: function () {
  6021. return '清空过滤';
  6022. }
  6023. };
  6024. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
  6025. })(jQuery);
  6026. define("bootstrap-table-lang", ["bootstrap-table"], (function (global) {
  6027. return function () {
  6028. var ret, fn;
  6029. return ret || global.$.fn.bootstrapTable.defaults;
  6030. };
  6031. }(this)));
  6032. /**
  6033. * @author: Dennis Hernández
  6034. * @webSite: http://djhvscf.github.io/Blog
  6035. * @version: v1.1.0
  6036. */
  6037. !function ($) {
  6038. 'use strict';
  6039. var showHideColumns = function (that, checked) {
  6040. if (that.options.columnsHidden.length > 0 ) {
  6041. $.each(that.columns, function (i, column) {
  6042. if (that.options.columnsHidden.indexOf(column.field) !== -1) {
  6043. if (column.visible !== checked) {
  6044. that.toggleColumn($.fn.bootstrapTable.utils.getFieldIndex(that.columns, column.field), checked, true);
  6045. }
  6046. }
  6047. });
  6048. }
  6049. };
  6050. var resetView = function (that) {
  6051. if (that.options.height || that.options.showFooter) {
  6052. setTimeout(function(){
  6053. that.resetView.call(that);
  6054. }, 1);
  6055. }
  6056. };
  6057. var changeView = function (that, width, height) {
  6058. if (that.options.minHeight) {
  6059. if ((width <= that.options.minWidth) && (height <= that.options.minHeight)) {
  6060. conditionCardView(that);
  6061. } else if ((width > that.options.minWidth) && (height > that.options.minHeight)) {
  6062. conditionFullView(that);
  6063. }
  6064. } else {
  6065. if (width <= that.options.minWidth) {
  6066. conditionCardView(that);
  6067. } else if (width > that.options.minWidth) {
  6068. conditionFullView(that);
  6069. }
  6070. }
  6071. resetView(that);
  6072. };
  6073. var conditionCardView = function (that) {
  6074. changeTableView(that, false);
  6075. showHideColumns(that, false);
  6076. };
  6077. var conditionFullView = function (that) {
  6078. changeTableView(that, true);
  6079. showHideColumns(that, true);
  6080. };
  6081. var changeTableView = function (that, cardViewState) {
  6082. that.options.cardView = cardViewState;
  6083. that.toggleView();
  6084. };
  6085. var debounce = function(func,wait) {
  6086. var timeout;
  6087. return function() {
  6088. var context = this,
  6089. args = arguments;
  6090. var later = function() {
  6091. timeout = null;
  6092. func.apply(context,args);
  6093. };
  6094. clearTimeout(timeout);
  6095. timeout = setTimeout(later, wait);
  6096. };
  6097. };
  6098. $.extend($.fn.bootstrapTable.defaults, {
  6099. mobileResponsive: false,
  6100. minWidth: 562,
  6101. minHeight: undefined,
  6102. heightThreshold: 100, // just slightly larger than mobile chrome's auto-hiding toolbar
  6103. checkOnInit: true,
  6104. columnsHidden: []
  6105. });
  6106. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  6107. _init = BootstrapTable.prototype.init;
  6108. BootstrapTable.prototype.init = function () {
  6109. _init.apply(this, Array.prototype.slice.apply(arguments));
  6110. if (!this.options.mobileResponsive) {
  6111. return;
  6112. }
  6113. if (!this.options.minWidth) {
  6114. return;
  6115. }
  6116. if (this.options.minWidth < 100 && this.options.resizable) {
  6117. console.log("The minWidth when the resizable extension is active should be greater or equal than 100");
  6118. this.options.minWidth = 100;
  6119. }
  6120. var that = this,
  6121. old = {
  6122. width: $(window).width(),
  6123. height: $(window).height()
  6124. };
  6125. $(window).on('resize orientationchange',debounce(function (evt) {
  6126. // reset view if height has only changed by at least the threshold.
  6127. var height = $(this).height(),
  6128. width = $(this).width();
  6129. if (Math.abs(old.height - height) > that.options.heightThreshold || old.width != width) {
  6130. changeView(that, width, height);
  6131. old = {
  6132. width: width,
  6133. height: height
  6134. };
  6135. }
  6136. },200));
  6137. if (this.options.checkOnInit) {
  6138. var height = $(window).height(),
  6139. width = $(window).width();
  6140. changeView(this, width, height);
  6141. old = {
  6142. width: width,
  6143. height: height
  6144. };
  6145. }
  6146. };
  6147. }(jQuery);
  6148. define("bootstrap-table-mobile", ["bootstrap-table"], (function (global) {
  6149. return function () {
  6150. var ret, fn;
  6151. return ret || global.$.fn.bootstrapTable.defaults;
  6152. };
  6153. }(this)));
  6154. /*
  6155. tableExport.jquery.plugin
  6156. Copyright (c) 2015-2017 hhurz, https://github.com/hhurz/
  6157. Multi Worksheets Support, Copyright (c) 2017 hejiheji001, https://github.com/hejiheji001/
  6158. Original Work, Copyright (c) 2014 Giri Raj, https://github.com/kayalshri/
  6159. Licensed under the MIT License, http://opensource.org/licenses/mit-license
  6160. */
  6161. (function(c){c.fn.extend({tableExport:function(n){function N(b){var a=[];c(b).find("thead").first().find("th").each(function(b,f){void 0!==c(f).attr("data-field")?a[b]=c(f).attr("data-field"):a[b]=b.toString()});return a}function x(b,m,e,f,z){if(-1==c.inArray(e,a.ignoreRow)&&-1==c.inArray(e-f,a.ignoreRow)){var F=c(b).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display")||"always"==c(this).closest("table").data("tableexport-display"))}).find(m),
  6162. l=0;F.each(function(b){if(("always"==c(this).data("tableexport-display")||"none"!=c(this).css("display")&&"hidden"!=c(this).css("visibility")&&"none"!=c(this).data("tableexport-display"))&&"function"===typeof z){var f,m=1,r=1;var d=F.length;if("undefined"!=typeof y[e]&&0<y[e].length){var g=b;for(f=0;f<=g;f++)"undefined"!=typeof y[e][f]&&(z(null,e,f),delete y[e][f],g++);b+=y[e].length;d+=y[e].length}c(this).is("[colspan]")&&(m=parseInt(c(this).attr("colspan"))||1,l+=0<m?m-1:0);c(this).is("[rowspan]")&&
  6163. (r=parseInt(c(this).attr("rowspan"))||1);f=d;d=b+l;g=!1;0<a.ignoreColumn.length&&("string"==typeof a.ignoreColumn[0]?I.length>d&&"undefined"!=typeof I[d]&&-1!=c.inArray(I[d],a.ignoreColumn)&&(g=!0):"number"!=typeof a.ignoreColumn[0]||-1==c.inArray(d,a.ignoreColumn)&&-1==c.inArray(d-f,a.ignoreColumn)||(g=!0));if(!1===g)for(z(this,e,b),f=1;f<m;f++)z(null,e,b+f);if(1<r)for(d=1;d<r;d++)for("undefined"==typeof y[e+d]&&(y[e+d]=[]),y[e+d][b+l]="",f=1;f<m;f++)y[e+d][b+l-f]=""}});if("undefined"!=typeof y[e]&&
  6164. 0<y[e].length)for(b=0;b<=y[e].length;b++)"undefined"!=typeof y[e][b]&&(z(null,e,b),delete y[e][b])}}function aa(b,m){!0===a.consoleLog&&console.log(b.output());if("string"===a.outputMode)return b.output();if("base64"===a.outputMode)return D(b.output());if("window"===a.outputMode)window.open(URL.createObjectURL(b.output("blob")));else try{var e=b.output("blob");saveAs(e,a.fileName+".pdf")}catch(f){A(a.fileName+".pdf","data:application/pdf"+(m?"":";base64")+",",m?e:b.output())}}function ba(b,a,e){var f=
  6165. 0;"undefined"!=typeof e&&(f=e.colspan);if(0<=f){for(var m=b.width,c=b.textPos.x,l=a.table.columns.indexOf(a.column),r=1;r<f;r++)m+=a.table.columns[l+r].width;1<f&&("right"===b.styles.halign?c=b.textPos.x+m-b.width:"center"===b.styles.halign&&(c=b.textPos.x+(m-b.width)/2));b.width=m;b.textPos.x=c;"undefined"!=typeof e&&1<e.rowspan&&(b.height*=e.rowspan);if("middle"===b.styles.valign||"bottom"===b.styles.valign)e=("string"===typeof b.text?b.text.split(/\r\n|\r|\n/g):b.text).length||1,2<e&&(b.textPos.y-=
  6166. (2-1.15)/2*a.row.styles.fontSize*(e-2)/3);return!0}return!1}function ca(b,a,e){"undefined"!=typeof e.images&&a.each(function(){var a=c(this).children();if(c(this).is("img")){var m=da(this.src);e.images[m]={url:this.src,src:this.src}}"undefined"!=typeof a&&0<a.length&&ca(b,a,e)})}function ma(b,a){function e(b){if(b.url){var f=new Image;m=++c;f.crossOrigin="Anonymous";f.onerror=f.onload=function(){if(f.complete&&(0===f.src.indexOf("data:image/")&&(f.width=b.width||f.width||0,f.height=b.height||f.height||
  6167. 0),f.width+f.height)){var e=document.createElement("canvas"),l=e.getContext("2d");e.width=f.width;e.height=f.height;l.drawImage(f,0,0);b.src=e.toDataURL("image/jpeg")}--c||a(m)};f.src=b.url}}var f,m=0,c=0;if("undefined"!=typeof b.images)for(f in b.images)b.images.hasOwnProperty(f)&&e(b.images[f]);(f=c)||(a(m),f=void 0);return f}function ea(b,m,e){m.each(function(){var f=c(this).children();if(c(this).is("div")){var m=O(E(this,"background-color"),[255,255,255]),F=O(E(this,"border-top-color"),[0,0,0]),
  6168. l=P(this,"border-top-width",a.jspdf.unit),r=this.getBoundingClientRect(),d=this.offsetLeft*e.dw;var g=this.offsetTop*e.dh;var h=r.width*e.dw,r=r.height*e.dh;e.doc.setDrawColor.apply(void 0,F);e.doc.setFillColor.apply(void 0,m);e.doc.setLineWidth(l);e.doc.rect(b.x+d,b.y+g,h,r,l?"FD":"F")}else if(c(this).is("img")&&"undefined"!=typeof e.images&&(g=da(this.src),m=e.images[g],"undefined"!=typeof m)){F=b.width/b.height;l=this.width/this.height;d=b.width;h=b.height;r=19.049976/25.4;g=0;l<=F?(h=Math.min(b.height,
  6169. this.height),d=this.width*h/this.height):l>F&&(d=Math.min(b.width,this.width),h=this.height*d/this.width);d*=r;h*=r;h<b.height&&(g=(b.height-h)/2);try{e.doc.addImage(m.src,b.textPos.x,b.y+g,d,h)}catch(qa){}b.textPos.x+=d}"undefined"!=typeof f&&0<f.length&&ea(b,f,e)})}function fa(b,a,e){if("function"===typeof e.onAutotableText)e.onAutotableText(e.doc,b,a);else{var f=b.textPos.x,m=b.textPos.y,d={halign:b.styles.halign,valign:b.styles.valign};if(a.length){for(a=a[0];a.previousSibling;)a=a.previousSibling;
  6170. for(var l=!1,r=!1;a;){var g=a.innerText||a.textContent||"",g=(g.length&&" "==g[0]?" ":"")+c.trim(g)+(1<g.length&&" "==g[g.length-1]?" ":"");c(a).is("br")&&(f=b.textPos.x,m+=e.doc.internal.getFontSize());c(a).is("b")?l=!0:c(a).is("i")&&(r=!0);(l||r)&&e.doc.setFontType(l&&r?"bolditalic":l?"bold":"italic");var h=e.doc.getStringUnitWidth(g)*e.doc.internal.getFontSize();if(h){if("linebreak"===b.styles.overflow&&f>b.textPos.x&&f+h>b.textPos.x+b.width){if(0<=".,!%*;:=-".indexOf(g.charAt(0))){var k=g.charAt(0),
  6171. h=e.doc.getStringUnitWidth(k)*e.doc.internal.getFontSize();f+h<=b.textPos.x+b.width&&(e.doc.autoTableText(k,f,m,d),g=g.substring(1,g.length));h=e.doc.getStringUnitWidth(g)*e.doc.internal.getFontSize()}f=b.textPos.x;m+=e.doc.internal.getFontSize()}for(;g.length&&f+h>b.textPos.x+b.width;)g=g.substring(0,g.length-1),h=e.doc.getStringUnitWidth(g)*e.doc.internal.getFontSize();e.doc.autoTableText(g,f,m,d);f+=h}if(l||r)c(a).is("b")?l=!1:c(a).is("i")&&(r=!1),e.doc.setFontType(l||r?l?"bold":"italic":"normal");
  6172. a=a.nextSibling}b.textPos.x=f;b.textPos.y=m}else e.doc.autoTableText(b.text,b.textPos.x,b.textPos.y,d)}}function Q(b,a,e){return b.replace(new RegExp(a.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),e)}function U(b){b=Q(b||"0",a.numbers.html.thousandsSeparator,"");b=Q(b,a.numbers.html.decimalMark,".");return"number"===typeof b||!1!==jQuery.isNumeric(b)?b:!1}function v(b,m,e){var f="";if(null!==b){var z=c(b);if(z[0].hasAttribute("data-tableexport-value"))var d=z.data("tableexport-value");else if(d=
  6173. z.html(),"function"===typeof a.onCellHtmlData)d=a.onCellHtmlData(z,m,e,d);else if(""!=d){b=c.parseHTML(d);var l=0,g=0;d="";c.each(b,function(){if(c(this).is("input"))d+=z.find("input").eq(l++).val();else if(c(this).is("select"))d+=z.find("select option:selected").eq(g++).text();else if("undefined"===typeof c(this).html())d+=c(this).text();else if(void 0===jQuery().bootstrapTable||!0!==c(this).hasClass("filterControl"))d+=c(this).html()})}if(!0===a.htmlContent)f=c.trim(d);else if(""!=d){var h=d.replace(/\n/g,
  6174. "\u2028").replace(/<br\s*[\/]?>/gi,"\u2060");b=c("<div/>").html(h).contents();h="";c.each(b.text().split("\u2028"),function(b,a){0<b&&(h+=" ");h+=c.trim(a)});c.each(h.split("\u2060"),function(b,a){0<b&&(f+="\n");f+=c.trim(a).replace(/\u00AD/g,"")});if("json"==a.type||"excel"===a.type&&"xmlss"===a.excelFileFormat||!1===a.numbers.output)b=U(f),!1!==b&&(f=Number(b));else if(a.numbers.html.decimalMark!=a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!=a.numbers.output.thousandsSeparator)if(b=
  6175. U(f),!1!==b){var k=(""+b).split(".");1==k.length&&(k[1]="");var n=3<k[0].length?k[0].length%3:0,f=(0>b?"-":"")+(a.numbers.output.thousandsSeparator?(n?k[0].substr(0,n)+a.numbers.output.thousandsSeparator:"")+k[0].substr(n).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):k[0])+(k[1].length?a.numbers.output.decimalMark+k[1]:"")}}!0===a.escape&&(f=escape(f));"function"===typeof a.onCellData&&(f=a.onCellData(z,m,e,f))}return f}function na(b,a,e){return a+"-"+e.toLowerCase()}function O(a,
  6176. m){var b=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(a),f=m;b&&(f=[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]);return f}function ga(b){var a=E(b,"text-align"),e=E(b,"font-weight"),f=E(b,"font-style"),d="";"start"==a&&(a="rtl"==E(b,"direction")?"right":"left");700<=e&&(d="bold");"italic"==f&&(d+=f);""===d&&(d="normal");a={style:{align:a,bcolor:O(E(b,"background-color"),[255,255,255]),color:O(E(b,"color"),[0,0,0]),fstyle:d},colspan:parseInt(c(b).attr("colspan"))||0,rowspan:parseInt(c(b).attr("rowspan"))||
  6177. 0};null!==b&&(b=b.getBoundingClientRect(),a.rect={width:b.width,height:b.height});return a}function E(a,c){try{return window.getComputedStyle?(c=c.replace(/([a-z])([A-Z])/,na),window.getComputedStyle(a,null).getPropertyValue(c)):a.currentStyle?a.currentStyle[c]:a.style[c]}catch(e){}return""}function P(a,c,e){c=E(a,c).match(/\d+/);if(null!==c){c=c[0];a=a.parentElement;var b=document.createElement("div");b.style.overflow="hidden";b.style.visibility="hidden";a.appendChild(b);b.style.width=100+e;e=100/
  6178. b.offsetWidth;a.removeChild(b);return c*e}return 0}function V(){if(!(this instanceof V))return new V;this.SheetNames=[];this.Sheets={}}function oa(a){for(var b=new ArrayBuffer(a.length),e=new Uint8Array(b),f=0;f!=a.length;++f)e[f]=a.charCodeAt(f)&255;return b}function pa(a){for(var b={},e={s:{c:1E7,r:1E7},e:{c:0,r:0}},f=0;f!=a.length;++f)for(var c=0;c!=a[f].length;++c){e.s.r>f&&(e.s.r=f);e.s.c>c&&(e.s.c=c);e.e.r<f&&(e.e.r=f);e.e.c<c&&(e.e.c=c);var d={v:a[f][c]};if(null!==d.v){var l=XLSX.utils.encode_cell({c:c,
  6179. r:f});if("number"===typeof d.v)d.t="n";else if("boolean"===typeof d.v)d.t="b";else if(d.v instanceof Date){d.t="n";d.z=XLSX.SSF._table[14];var g=d;var h=(Date.parse(d.v)-new Date(Date.UTC(1899,11,30)))/864E5;g.v=h}else d.t="s";b[l]=d}}1E7>e.s.c&&(b["!ref"]=XLSX.utils.encode_range(e));return b}function da(a){var b=0,c;if(0===a.length)return b;var f=0;for(c=a.length;f<c;f++){var d=a.charCodeAt(f);b=(b<<5)-b+d;b|=0}return b}function A(a,c,e){var b=window.navigator.userAgent;if(!1!==a&&(0<b.indexOf("MSIE ")||
  6180. b.match(/Trident.*rv\:11\./)))if(window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(new Blob([e]),a);else{if(c=document.createElement("iframe"))document.body.appendChild(c),c.setAttribute("style","display:none"),c.contentDocument.open("txt/html","replace"),c.contentDocument.write(e),c.contentDocument.close(),c.focus(),c.contentDocument.execCommand("SaveAs",!0,a),document.body.removeChild(c)}else if(b=document.createElement("a")){var d=null;b.style.display="none";!1!==a?b.download=
  6181. a:b.target="_blank";"object"==typeof e?(d=window.URL.createObjectURL(e),b.href=d):0<=c.toLowerCase().indexOf("base64,")?b.href=c+D(e):b.href=c+encodeURIComponent(e);document.body.appendChild(b);if(document.createEvent)null===R&&(R=document.createEvent("MouseEvents")),R.initEvent("click",!0,!1),b.dispatchEvent(R);else if(document.createEventObject)b.fireEvent("onclick");else if("function"==typeof b.onclick)b.onclick();d&&window.URL.revokeObjectURL(d);document.body.removeChild(b)}}function D(a){var b=
  6182. "",c,f=0;a=a.replace(/\x0d\x0a/g,"\n");var d="";for(c=0;c<a.length;c++){var g=a.charCodeAt(c);128>g?d+=String.fromCharCode(g):(127<g&&2048>g?d+=String.fromCharCode(g>>6|192):(d+=String.fromCharCode(g>>12|224),d+=String.fromCharCode(g>>6&63|128)),d+=String.fromCharCode(g&63|128))}for(a=d;f<a.length;){var l=a.charCodeAt(f++);d=a.charCodeAt(f++);c=a.charCodeAt(f++);g=l>>2;l=(l&3)<<4|d>>4;var r=(d&15)<<2|c>>6;var h=c&63;isNaN(d)?r=h=64:isNaN(c)&&(h=64);b=b+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)+
  6183. "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(r)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)}return b}var a={consoleLog:!1,csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,displayTableName:!1,escape:!1,excelFileFormat:"xlshtml",excelstyles:[],fileName:"tableExport",htmlContent:!1,ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",unit:"pt",format:"a4",
  6184. margins:{left:20,right:10,top:10,bottom:10},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:{onAfterAutotable:null,onBeforeAutotable:null,onAutotableText:null,onTable:null,outputImages:!0}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",
  6185. thousandsSeparator:","}},onCellData:null,onCellHtmlData:null,onMsoNumberFormat:null,outputMode:"file",pdfmake:{enabled:!1,docDefinition:{pageOrientation:"portrait",defaultStyle:{font:"Roboto"}},fonts:{}},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"myTableName",type:"csv",worksheetName:"Worksheet"},t=this,R=null,q=[],g=[],p=0,y=[],h="",I=[];c.extend(!0,a,n);I=N(t);if("csv"==a.type||"tsv"==a.type||"txt"==a.type){var C="",J=0,p=0,W=function(b,d,e){b.each(function(){h="";x(this,
  6186. d,p,e+b.length,function(b,c,e){var f=h,d="";if(null!==b)if(b=v(b,c,e),c=null===b||""===b?"":b.toString(),"tsv"==a.type)b instanceof Date&&b.toLocaleString(),d=Q(c,"\t"," ");else if(b instanceof Date)d=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else if(d=Q(c,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=d.indexOf(a.csvSeparator)||/[\r\n ]/g.test(d))d=a.csvEnclosure+d+a.csvEnclosure;h=f+(d+("tsv"==a.type?"\t":a.csvSeparator))});h=c.trim(h).substring(0,h.length-1);0<h.length&&(0<C.length&&(C+=
  6187. "\n"),C+=h);p++});return b.length},J=J+W(c(t).find("thead").first().find(a.theadSelector),"th,td",J);c(t).find("tbody").each(function(){J+=W(c(this).find(a.tbodySelector),"td,th",J)});a.tfootSelector.length&&W(c(t).find("tfoot").first().find(a.tfootSelector),"td,th",J);C+="\n";!0===a.consoleLog&&console.log(C);if("string"===a.outputMode)return C;if("base64"===a.outputMode)return D(C);if("window"===a.outputMode){A(!1,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,",C);return}try{var w=
  6188. new Blob([C],{type:"text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8"});saveAs(w,a.fileName+"."+a.type,"csv"!=a.type||!1===a.csvUseBOM)}catch(b){A(a.fileName+"."+a.type,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,"+("csv"==a.type&&a.csvUseBOM?"\ufeff":""),C)}}else if("sql"==a.type){var p=0,u="INSERT INTO `"+a.tableName+"` (",q=c(t).find("thead").first().find(a.theadSelector);q.each(function(){x(this,"th,td",p,q.length,function(a,c,e){u+="'"+v(a,c,e)+"',"});p++;u=c.trim(u);u=c.trim(u).substring(0,
  6189. u.length-1)});u+=") VALUES ";c(t).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(t).find("tfoot").find(a.tfootSelector));c(g).each(function(){h="";x(this,"td,th",p,q.length+g.length,function(a,c,e){h+="'"+v(a,c,e)+"',"});3<h.length&&(u+="("+h,u=c.trim(u).substring(0,u.length-1),u+="),");p++});u=c.trim(u).substring(0,u.length-1);u+=";";!0===a.consoleLog&&console.log(u);if("string"===a.outputMode)return u;if("base64"===a.outputMode)return D(u);
  6190. try{w=new Blob([u],{type:"text/plain;charset=utf-8"}),saveAs(w,a.fileName+".sql")}catch(b){A(a.fileName+".sql","data:application/sql;charset=utf-8,",u)}}else if("json"==a.type){var K=[],q=c(t).find("thead").first().find(a.theadSelector);q.each(function(){var a=[];x(this,"th,td",p,q.length,function(b,c,f){a.push(v(b,c,f))});K.push(a)});var X=[];c(t).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(t).find("tfoot").find(a.tfootSelector));
  6191. c(g).each(function(){var a={},d=0;x(this,"td,th",p,q.length+g.length,function(b,c,g){K.length?a[K[K.length-1][d]]=v(b,c,g):a[d]=v(b,c,g);d++});!1===c.isEmptyObject(a)&&X.push(a);p++});n="";n="head"==a.jsonScope?JSON.stringify(K):"data"==a.jsonScope?JSON.stringify(X):JSON.stringify({header:K,data:X});!0===a.consoleLog&&console.log(n);if("string"===a.outputMode)return n;if("base64"===a.outputMode)return D(n);try{w=new Blob([n],{type:"application/json;charset=utf-8"}),saveAs(w,a.fileName+".json")}catch(b){A(a.fileName+
  6192. ".json","data:application/json;charset=utf-8;base64,",n)}}else if("xml"===a.type){p=0;var B='<?xml version="1.0" encoding="utf-8"?>';B+="<tabledata><fields>";q=c(t).find("thead").first().find(a.theadSelector);q.each(function(){x(this,"th,td",p,q.length,function(a,c,e){B+="<field>"+v(a,c,e)+"</field>"});p++});B+="</fields><data>";var ha=1;c(t).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(t).find("tfoot").find(a.tfootSelector));
  6193. c(g).each(function(){var a=1;h="";x(this,"td,th",p,q.length+g.length,function(b,c,f){h+="<column-"+a+">"+v(b,c,f)+"</column-"+a+">";a++});0<h.length&&"<column-1></column-1>"!=h&&(B+='<row id="'+ha+'">'+h+"</row>",ha++);p++});B+="</data></tabledata>";!0===a.consoleLog&&console.log(B);if("string"===a.outputMode)return B;if("base64"===a.outputMode)return D(B);try{w=new Blob([B],{type:"application/xml;charset=utf-8"}),saveAs(w,a.fileName+".xml")}catch(b){A(a.fileName+".xml","data:application/xml;charset=utf-8;base64,",
  6194. B)}}else if("excel"===a.type&&"xmlss"===a.excelFileFormat){var k=c(t).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))});var Y=[];k.each(function(){var b=c(this),d="";p=0;I=N(this);q=b.find("thead").first().find(a.theadSelector);var d=d+"<Table>",e=0;q.each(function(){h="";x(this,"th,td",p,q.length,function(a,b,c){null!==a&&(h+='<Cell><Data ss:Type="String">'+v(a,b,c)+"</Data></Cell>",e++)});0<h.length&&(d+=
  6195. "<Row>"+h+"</Row>");p++});g=[];b.find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});c(g).each(function(){c(this);h="";x(this,"td,th",p,q.length+g.length,function(a,b,c){if(null!==a){var d="String",e="";a=v(a,b,c);!1!==jQuery.isNumeric(a)?d="Number":(b=a,-1<b.indexOf("%")?(b=U(b.replace(/%/g,"")),!1!==b&&(b/=100)):b=!1,number=b,!1!==number&&(a=number,d="Number",e=' ss:StyleID="pct1"'));"Number"!==d&&(a=a.replace(/\n/g,"<br>"));h+="<Cell"+e+'><Data ss:Type="'+d+'">'+a+"</Data></Cell>"}});
  6196. 0<h.length&&(d+="<Row>"+h+"</Row>");p++});d+="</Table>";Y.push(d);!0===a.consoleLog&&console.log(d)});k='<?xml version="1.0" encoding="UTF-8"?><?mso-application progid="Excel.Sheet"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"> <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> <Created>'+
  6197. (new Date).toISOString()+'</Created> </DocumentProperties> <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> <AllowPNG/> </OfficeDocumentSettings> <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> <WindowHeight>9000</WindowHeight> <WindowWidth>13860</WindowWidth> <WindowTopX>0</WindowTopX> <WindowTopY>0</WindowTopY> <ProtectStructure>False</ProtectStructure> <ProtectWindows>False</ProtectWindows> </ExcelWorkbook> <Styles> <Style ss:ID="Default" ss:Name="Default"> <Alignment ss:Vertical="Center"/> <Borders/> <Font/> <Interior/> <NumberFormat/> <Protection/> </Style> <Style ss:ID="Normal" ss:Name="Normal"/> <Style ss:ID="pct1"> <NumberFormat ss:Format="Percent"/> </Style> </Styles>';
  6198. for(n=0;n<Y.length;n++)k+='<Worksheet ss:Name="'+("string"===typeof a.worksheetName?a.worksheetName+" "+(n+1):"undefined"!==typeof a.worksheetName[n]?a.worksheetName[n]:"Table "+(n+1))+'">'+Y[n]+"<WorksheetOptions/> </Worksheet>";k+="</Workbook>";!0===a.consoleLog&&console.log(k);if("string"===a.outputMode)return k;if("base64"===a.outputMode)return D(k);try{w=new Blob([k],{type:"application/xml;charset=utf-8"}),saveAs(w,a.fileName+".xml")}catch(b){A(a.fileName+".xml","data:application/xml;charset=utf-8;base64,",
  6199. B)}}else if("excel"==a.type||"xls"==a.type||"word"==a.type||"doc"==a.type){n="excel"==a.type||"xls"==a.type?"excel":"word";var G="excel"==n?"xls":"doc",S='xmlns:x="urn:schemas-microsoft-com:office:'+n+'"';k=c(t).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))});var H="";k.each(function(){var b=c(this);p=0;I=N(this);H+="<table><thead>";q=b.find("thead").first().find(a.theadSelector);q.each(function(){h="";
  6200. x(this,"th,td",p,q.length,function(b,d,f){if(null!==b){var e="";h+="<th";for(var g in a.excelstyles)if(a.excelstyles.hasOwnProperty(g)){var l=c(b).css(a.excelstyles[g]);""!==l&&"0px none rgb(0, 0, 0)"!=l&&"rgba(0, 0, 0, 0)"!=l&&(e+=""===e?'style="':";",e+=a.excelstyles[g]+":"+l)}""!==e&&(h+=" "+e+'"');c(b).is("[colspan]")&&(h+=' colspan="'+c(b).attr("colspan")+'"');c(b).is("[rowspan]")&&(h+=' rowspan="'+c(b).attr("rowspan")+'"');h+=">"+v(b,d,f)+"</th>"}});0<h.length&&(H+="<tr>"+h+"</tr>");p++});H+=
  6201. "</thead><tbody>";b.find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,b.find("tfoot").find(a.tfootSelector));c(g).each(function(){var b=c(this);h="";x(this,"td,th",p,q.length+g.length,function(d,f,g){if(null!==d){var e="",l=c(d).data("tableexport-msonumberformat");"undefined"==typeof l&&"function"===typeof a.onMsoNumberFormat&&(l=a.onMsoNumberFormat(d,f,g));"undefined"!=typeof l&&""!==l&&(e="style=\"mso-number-format:'"+l+"'");for(var m in a.excelstyles)a.excelstyles.hasOwnProperty(m)&&
  6202. (l=c(d).css(a.excelstyles[m]),""===l&&(l=b.css(a.excelstyles[m])),""!==l&&"0px none rgb(0, 0, 0)"!=l&&"rgba(0, 0, 0, 0)"!=l&&(e+=""===e?'style="':";",e+=a.excelstyles[m]+":"+l));h+="<td";""!==e&&(h+=" "+e+'"');c(d).is("[colspan]")&&(h+=' colspan="'+c(d).attr("colspan")+'"');c(d).is("[rowspan]")&&(h+=' rowspan="'+c(d).attr("rowspan")+'"');h+=">"+v(d,f,g).replace(/\n/g,"<br>")+"</td>"}});0<h.length&&(H+="<tr>"+h+"</tr>");p++});a.displayTableName&&(H+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+v(c("<p>"+
  6203. a.tableName+"</p>"))+"</td></tr>");H+="</tbody></table>";!0===a.consoleLog&&console.log(H)});k='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+S+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta http-equiv="content-type" content="application/vnd.ms-'+n+'; charset=UTF-8">')+"<head>";"excel"===n&&(k+="\x3c!--[if gte mso 9]>",k+="<xml>",k+="<x:ExcelWorkbook>",k+="<x:ExcelWorksheets>",k+="<x:ExcelWorksheet>",k+="<x:Name>",k+=a.worksheetName,k+="</x:Name>",k+="<x:WorksheetOptions>",k+="<x:DisplayGridlines/>",
  6204. k+="</x:WorksheetOptions>",k+="</x:ExcelWorksheet>",k+="</x:ExcelWorksheets>",k+="</x:ExcelWorkbook>",k+="</xml>",k+="<![endif]--\x3e");k+="<style>br {mso-data-placement:same-cell;}</style>";k+="</head>";k+="<body>";k+=H;k+="</body>";k+="</html>";!0===a.consoleLog&&console.log(k);if("string"===a.outputMode)return k;if("base64"===a.outputMode)return D(k);try{w=new Blob([k],{type:"application/vnd.ms-"+a.type}),saveAs(w,a.fileName+"."+G)}catch(b){A(a.fileName+"."+G,"data:application/vnd.ms-"+n+";base64,",
  6205. k)}}else if("xlsx"==a.type){var ia=[],Z=[],p=0,g=c(t).find("thead").first().find(a.theadSelector);c(t).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(t).find("tfoot").find(a.tfootSelector));c(g).each(function(){var a=[];x(this,"th,td",p,g.length,function(b,c,d){if("undefined"!==typeof b&&null!==b){var e=parseInt(b.getAttribute("colspan")),f=parseInt(b.getAttribute("rowspan"));b=v(b,c,d);""!==b&&b==+b&&(b=+b);Z.forEach(function(b){if(p>=
  6206. b.s.r&&p<=b.e.r&&a.length>=b.s.c&&a.length<=b.e.c)for(var c=0;c<=b.e.c-b.s.c;++c)a.push(null)});if(f||e)e=e||1,Z.push({s:{r:p,c:a.length},e:{r:p+(f||1)-1,c:a.length+e-1}});a.push(""!==b?b:null);if(e)for(f=0;f<e-1;++f)a.push(null)}});ia.push(a);p++});n=new V;G=pa(ia);G["!merges"]=Z;n.SheetNames.push(a.worksheetName);n.Sheets[a.worksheetName]=G;n=XLSX.write(n,{bookType:a.type,bookSST:!1,type:"binary"});try{w=new Blob([oa(n)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"}),
  6207. saveAs(w,a.fileName+"."+a.type)}catch(b){A(a.fileName+"."+a.type,"data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8,",w)}}else if("png"==a.type)html2canvas(c(t)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),d=new ArrayBuffer(c.length),f=new Uint8Array(d),g=0;g<c.length;g++)f[g]=c.charCodeAt(g);!0===a.consoleLog&&console.log(c);if("string"===a.outputMode)return c;if("base64"===a.outputMode)return D(b);if("window"===a.outputMode)window.open(b);
  6208. else try{w=new Blob([d],{type:"image/png"}),saveAs(w,a.fileName+".png")}catch(F){A(a.fileName+".png","data:image/png,",w)}});else if("pdf"==a.type)if(!0===a.pdfmake.enabled){n=[];var ja=[],p=0,G=function(a,d,e){var b=0;c(a).each(function(){var a=[];x(this,d,p,e,function(b,c,d){if("undefined"!==typeof b&&null!==b){var e=parseInt(b.getAttribute("colspan")),f=parseInt(b.getAttribute("rowspan"));b=v(b,c,d)||" ";1<e||1<f?a.push({colSpan:e||1,rowSpan:f||1,text:b}):a.push(b)}else a.push(" ")});a.length&&
  6209. ja.push(a);b<a.length&&(b=a.length);p++});return b},q=c(this).find("thead").first().find(a.theadSelector);k=G(q,"th,td",q.length);for(S=n.length;S<k;S++)n.push("*");c(this).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(this).find("tfoot").find(a.tfootSelector));G(g,"th,td",q.length+g.length);n={content:[{table:{headerRows:q.length,widths:n,body:ja}}]};c.extend(!0,n,a.pdfmake.docDefinition);pdfMake.fonts={Roboto:{normal:"Roboto-Regular.ttf",
  6210. bold:"Roboto-Medium.ttf",italics:"Roboto-Italic.ttf",bolditalics:"Roboto-MediumItalic.ttf"}};c.extend(!0,pdfMake.fonts,a.pdfmake.fonts);pdfMake.createPdf(n).getBuffer(function(b){try{var c=new Blob([b],{type:"application/pdf"});saveAs(c,a.fileName+".pdf")}catch(e){A(a.fileName+".pdf","data:application/pdf;base64,",b)}})}else if(!1===a.jspdf.autotable){n={dim:{w:P(c(t).first().get(0),"width","mm"),h:P(c(t).first().get(0),"height","mm")},pagesplit:!1};var ka=new jsPDF(a.jspdf.orientation,a.jspdf.unit,
  6211. a.jspdf.format);ka.addHTML(c(t).first(),a.jspdf.margins.left,a.jspdf.margins.top,n,function(){aa(ka,!1)})}else{var d=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&"bestfit"===a.jspdf.format.toLowerCase()){var L={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]},T="",M="",la=0;c(t).filter(":visible").each(function(){if("none"!=c(this).css("display")){var a=P(c(this).get(0),"width","pt");if(a>la){a>L.a0[0]&&(T="a0",M="l");for(var d in L)L.hasOwnProperty(d)&&
  6212. L[d][1]>a&&(T=d,M="l",L[d][0]>a&&(M="p"));la=a}}});a.jspdf.format=""===T?"a4":T;a.jspdf.orientation=""===M?"w":M}d.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);!0===d.outputImages&&(d.images={});"undefined"!=typeof d.images&&(c(t).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))}).each(function(){var b=0;q=c(this).find("thead").find(a.theadSelector);c(this).find("tbody").each(function(){g.push.apply(g,
  6213. c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(this).find("tfoot").find(a.tfootSelector));c(g).each(function(){x(this,"td,th",q.length+b,q.length+g.length,function(a,b,f){"undefined"!==typeof a&&null!==a&&(b=c(a).children(),"undefined"!=typeof b&&0<b.length&&ca(a,b,d))});b++})}),q=[],g=[]);ma(d,function(b){c(t).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))}).each(function(){var b,
  6214. e=0;I=N(this);d.columns=[];d.rows=[];d.rowoptions={};if("function"===typeof d.onTable&&!1===d.onTable(c(this),a))return!0;a.jspdf.autotable.tableExport=null;var f=c.extend(!0,{},a.jspdf.autotable);a.jspdf.autotable.tableExport=d;f.margin={};c.extend(!0,f.margin,a.jspdf.margins);f.tableExport=d;"function"!==typeof f.beforePageContent&&(f.beforePageContent=function(a){1==a.pageCount&&a.table.rows.concat(a.table.headerRow).forEach(function(b){0<b.height&&(b.height+=(2-1.15)/2*b.styles.fontSize,a.table.height+=
  6215. (2-1.15)/2*b.styles.fontSize)})});"function"!==typeof f.createdHeaderCell&&(f.createdHeaderCell=function(a,b){a.styles=c.extend({},b.row.styles);if("undefined"!=typeof d.columns[b.column.dataKey]){var e=d.columns[b.column.dataKey];if("undefined"!=typeof e.rect){a.contentWidth=e.rect.width;if("undefined"==typeof d.heightRatio||0===d.heightRatio){var g=b.row.raw[b.column.dataKey].rowspan?b.row.raw[b.column.dataKey].rect.height/b.row.raw[b.column.dataKey].rowspan:b.row.raw[b.column.dataKey].rect.height;
  6216. d.heightRatio=a.styles.rowHeight/g}g=b.row.raw[b.column.dataKey].rect.height*d.heightRatio;g>a.styles.rowHeight&&(a.styles.rowHeight=g)}"undefined"!=typeof e.style&&!0!==e.style.hidden&&(a.styles.halign=e.style.align,"inherit"===f.styles.fillColor&&(a.styles.fillColor=e.style.bcolor),"inherit"===f.styles.textColor&&(a.styles.textColor=e.style.color),"inherit"===f.styles.fontStyle&&(a.styles.fontStyle=e.style.fstyle))}});"function"!==typeof f.createdCell&&(f.createdCell=function(a,b){var c=d.rowoptions[b.row.index+
  6217. ":"+b.column.dataKey];"undefined"!=typeof c&&"undefined"!=typeof c.style&&!0!==c.style.hidden&&(a.styles.halign=c.style.align,"inherit"===f.styles.fillColor&&(a.styles.fillColor=c.style.bcolor),"inherit"===f.styles.textColor&&(a.styles.textColor=c.style.color),"inherit"===f.styles.fontStyle&&(a.styles.fontStyle=c.style.fstyle))});"function"!==typeof f.drawHeaderCell&&(f.drawHeaderCell=function(a,b){var c=d.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&&
  6218. 0<=c.rowIndex?ba(a,b,c):!1});"function"!==typeof f.drawCell&&(f.drawCell=function(a,b){var c=d.rowoptions[b.row.index+":"+b.column.dataKey];if(ba(a,b,c))if(d.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle),"undefined"!=typeof c&&"undefined"!=typeof c.kids&&0<c.kids.length){var e=a.height/c.rect.height;if(e>d.dh||"undefined"==typeof d.dh)d.dh=e;d.dw=a.width/c.rect.width;e=a.textPos.y;ea(a,c.kids,d);a.textPos.y=e;fa(a,c.kids,d)}else fa(a,{},d);return!1});d.headerrows=[];q=c(this).find("thead").find(a.theadSelector);
  6219. q.each(function(){b=0;d.headerrows[e]=[];x(this,"th,td",e,q.length,function(a,c,f){var g=ga(a);g.title=v(a,c,f);g.key=b++;g.rowIndex=e;d.headerrows[e].push(g)});e++});if(0<e)for(var h=e-1;0<=h;)c.each(d.headerrows[h],function(){var a=this;0<h&&null===this.rect&&(a=d.headerrows[h-1][this.key]);null!==a&&0<=a.rowIndex&&(!0!==a.style.hasOwnProperty("hidden")||!0!==a.style.hidden)&&d.columns.push(a)}),h=0<d.columns.length?-1:h-1;var k=0;g=[];c(this).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});
  6220. a.tfootSelector.length&&g.push.apply(g,c(this).find("tfoot").find(a.tfootSelector));c(g).each(function(){var a=[];b=0;x(this,"td,th",e,q.length+g.length,function(e,f,g){if("undefined"===typeof d.columns[b]){var h={title:"",key:b,style:{hidden:!0}};d.columns.push(h)}"undefined"!==typeof e&&null!==e?(h=ga(e),h.kids=c(e).children()):(h=c.extend(!0,{},d.rowoptions[k+":"+(b-1)]),h.colspan=-1);d.rowoptions[k+":"+b++]=h;a.push(v(e,f,g))});a.length&&(d.rows.push(a),k++);e++});if("function"===typeof d.onBeforeAutotable)d.onBeforeAutotable(c(this),
  6221. d.columns,d.rows,f);d.doc.autoTable(d.columns,d.rows,f);if("function"===typeof d.onAfterAutotable)d.onAfterAutotable(c(this),f);a.jspdf.autotable.startY=d.doc.autoTableEndPosY()+f.margin.top});aa(d.doc,"undefined"!=typeof d.images&&!1===jQuery.isEmptyObject(d.images));"undefined"!=typeof d.headerrows&&(d.headerrows.length=0);"undefined"!=typeof d.columns&&(d.columns.length=0);"undefined"!=typeof d.rows&&(d.rows.length=0);delete d.doc;d.doc=null})}return this}})})(jQuery);
  6222. define("tableexport", ["jquery"], (function (global) {
  6223. return function () {
  6224. var ret, fn;
  6225. return ret || global.$.fn.extend;
  6226. };
  6227. }(this)));
  6228. /*
  6229. * bootstrap-table - v1.11.1 - 2017-02-22
  6230. * https://github.com/wenzhixin/bootstrap-table
  6231. * Copyright (c) 2017 zhixin wen
  6232. * Licensed MIT License
  6233. */
  6234. !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);
  6235. define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (global) {
  6236. return function () {
  6237. var ret, fn;
  6238. return ret || global.$.fn.bootstrapTable.defaults;
  6239. };
  6240. }(this)));
  6241. !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");
  6242. 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});
  6243. /**
  6244. * @author: pppscn <35696959@qq.com>
  6245. * @version: v0.0.1
  6246. *
  6247. * @update 2017-05-07 <http://git.oschina.net/pp/fastadmin>
  6248. */
  6249. !function ($) {
  6250. 'use strict';
  6251. var ColumnsForSearch = [];
  6252. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  6253. var initCommonSearch = function (pColumns, that) {
  6254. var vFormCommon = createFormCommon(pColumns, that);
  6255. var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden");
  6256. vModal += vFormCommon.join('');
  6257. vModal += "</div>";
  6258. that.$container.prepend($(vModal));
  6259. var form = $("form.form-commonsearch", that.$container);
  6260. //绑定日期时间元素事件
  6261. if ($(".datetimepicker", form).size() > 0) {
  6262. require(['bootstrap-datetimepicker'], function () {
  6263. $('.datetimepicker', form).parent().css('position', 'relative');
  6264. $('.datetimepicker', form).datetimepicker({
  6265. //format: 'YYYY-MM-DD',
  6266. icons: {
  6267. time: 'fa fa-clock-o',
  6268. date: 'fa fa-calendar',
  6269. up: 'fa fa-chevron-up',
  6270. down: 'fa fa-chevron-down',
  6271. previous: 'fa fa-chevron-left',
  6272. next: 'fa fa-chevron-right',
  6273. today: 'fa fa-history',
  6274. clear: 'fa fa-trash',
  6275. close: 'fa fa-remove'
  6276. },
  6277. showTodayButton: true,
  6278. showClose: true
  6279. });
  6280. });
  6281. }
  6282. // 表单提交
  6283. form.on("submit", function (event) {
  6284. event.preventDefault();
  6285. that.onColumnCommonSearch();
  6286. return false;
  6287. });
  6288. // 重置搜索
  6289. form.on("click", "button[type=reset]", function (event) {
  6290. form[0].reset();
  6291. that.onColumnCommonSearch();
  6292. });
  6293. };
  6294. var createFormCommon = function (pColumns, that) {
  6295. var htmlForm = [];
  6296. var opList = ['=', '>', '>=', '<', '<=', '!=', 'LIKE', 'LIKE %...%', 'NOT LIKE', 'IN(...)', 'NOT IN(...)', 'BETWEEN', 'NOT BETWEEN', 'IS NULL', 'IS NOT NULL'];
  6297. htmlForm.push(sprintf('<form class="form-inline form-commonsearch" action="%s" >', that.options.actionForm));
  6298. htmlForm.push('<fieldset>');
  6299. if (that.options.titleForm.length > 0)
  6300. htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
  6301. for (var i in pColumns) {
  6302. var vObjCol = pColumns[i];
  6303. if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
  6304. var query = Backend.api.query(vObjCol.field);
  6305. query = query ? query : '';
  6306. vObjCol.defaultValue = that.options.renderDefault && query != '' ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue);
  6307. ColumnsForSearch.push(vObjCol);
  6308. htmlForm.push('<div class="form-group" style="margin:5px">');
  6309. htmlForm.push(sprintf('<label for="%s" class="control-label" style="padding:0 10px">%s</label>', vObjCol.field, vObjCol.title));
  6310. vObjCol.operate = (typeof vObjCol.operate === 'undefined' || $.inArray(vObjCol.operate, opList) === -1) ? '=' : vObjCol.operate;
  6311. 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));
  6312. var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style);
  6313. if (vObjCol.searchList) {
  6314. if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') {
  6315. htmlForm.push(sprintf('<select class="form-control" name="%s" %s>%s</select>', vObjCol.field, style, sprintf('<option value="">%s</option>', that.options.formatCommonChoose())));
  6316. (function (vObjCol, that) {
  6317. $.when(vObjCol.searchList).done(function (ret) {
  6318. var isArray = false;
  6319. if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) {
  6320. var resultlist = {};
  6321. $.each(ret.data.searchlist, function (key, value) {
  6322. resultlist[value.id] = value.name;
  6323. });
  6324. } else if (ret.constructor === Array || ret.constructor === Object) {
  6325. var resultlist = ret;
  6326. isArray = ret.constructor === Array ? true : isArray;
  6327. }
  6328. var optionList = [];
  6329. $.each(resultlist, function (key, value) {
  6330. var isSelect = (isArray ? value : key) == vObjCol.defaultValue ? 'selected' : '';
  6331. optionList.push(sprintf("<option value='" + (isArray ? value : key) + "' %s>" + value + "</option>", isSelect));
  6332. });
  6333. $("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).append(optionList.join(''));
  6334. });
  6335. })(vObjCol, that);
  6336. } else if (typeof vObjCol.searchList == 'function') {
  6337. htmlForm.push(vObjCol.searchList.call(this, vObjCol));
  6338. } else {
  6339. var isArray = vObjCol.searchList.constructor === Array;
  6340. var searchList = [];
  6341. searchList.push(sprintf('<option value="">%s</option>', that.options.formatCommonChoose()));
  6342. $.each(vObjCol.searchList, function (key, value) {
  6343. var isSelect = (isArray ? value : key) == vObjCol.defaultValue ? 'selected' : '';
  6344. searchList.push(sprintf("<option value='" + (isArray ? value : key) + "' %s>" + value + "</option>", isSelect));
  6345. });
  6346. htmlForm.push(sprintf('<select class="form-control" name="%s" %s>%s</select>', vObjCol.field, style, searchList.join('')));
  6347. }
  6348. } else {
  6349. var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder;
  6350. var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type;
  6351. var addclass = typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass;
  6352. var data = typeof vObjCol.data === 'undefined' ? '' : vObjCol.data;
  6353. var defaultValue = typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue;
  6354. if (/BETWEEN$/.test(vObjCol.operate)) {
  6355. var defaultValueArr = /^.+|.+$/.test(defaultValue) ? defaultValue.split('|') : ['', ''];
  6356. htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>', type, addclass, vObjCol.field, defaultValueArr[0], placeholder, vObjCol.field, style, data));
  6357. htmlForm.push(sprintf('&nbsp;-&nbsp;<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>', type, addclass, vObjCol.field, defaultValueArr[1], placeholder, vObjCol.field, style, data));
  6358. } else {
  6359. htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>', type, addclass, vObjCol.field, defaultValue, placeholder, vObjCol.field, style, data));
  6360. }
  6361. }
  6362. htmlForm.push('</div>');
  6363. }
  6364. }
  6365. htmlForm.push(createFormBtn(that).join(''));
  6366. htmlForm.push('</fieldset>');
  6367. htmlForm.push('</form>');
  6368. return htmlForm;
  6369. };
  6370. var createFormBtn = function (that) {
  6371. var htmlBtn = [];
  6372. var searchSubmit = that.options.formatCommonSubmitButton();
  6373. var searchReset = that.options.formatCommonResetButton();
  6374. htmlBtn.push('<div class="form-group" style="margin:5px">');
  6375. htmlBtn.push('<div class="col-sm-12 text-center">');
  6376. htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" >%s</button> ', searchSubmit));
  6377. htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
  6378. htmlBtn.push('</div>');
  6379. htmlBtn.push('</div>');
  6380. return htmlBtn;
  6381. };
  6382. var isSearchAvailble = function (that) {
  6383. //只支持服务端搜索
  6384. if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) {
  6385. return false;
  6386. }
  6387. return true;
  6388. };
  6389. var getSearchQuery = function (that) {
  6390. var op = {};
  6391. var filter = {};
  6392. $("form.form-commonsearch input.operate", that.$container).each(function (i) {
  6393. var name = $(this).data("name");
  6394. var sym = $(this).val();
  6395. var obj = $("[name='" + name + "']");
  6396. if (obj.size() == 0)
  6397. return true;
  6398. var vObjCol = ColumnsForSearch[i];
  6399. if (obj.size() > 1) {
  6400. if (/BETWEEN$/.test(sym)) {
  6401. var value_begin = $.trim($("[name='" + name + "']:first").val()), value_end = $.trim($("[name='" + name + "']:last").val());
  6402. if (!value_begin.length || !value_end.length) {
  6403. return true;
  6404. }
  6405. if (typeof vObjCol.process === 'function') {
  6406. value_begin = vObjCol.process(value_begin, 'begin');
  6407. value_end = vObjCol.process(value_end, 'end');
  6408. } else if ($("[name='" + name + "']:first").attr('type') === 'datetime') { //datetime类型字段转换成时间戳
  6409. var Hms = Moment(value_begin).format("HH:mm:ss");
  6410. value_begin = parseInt(Moment(value_begin) / 1000);
  6411. value_end = parseInt(Moment(value_end) / 1000);
  6412. if (value_begin === value_end && '00:00:00' === Hms) {
  6413. value_end += 86399;
  6414. }
  6415. }
  6416. var value = value_begin + ',' + value_end;
  6417. } else {
  6418. var value = $("[name='" + name + "']:checked").val();
  6419. }
  6420. } else {
  6421. var value = (typeof vObjCol.process === 'function') ? vObjCol.process(obj.val()) : (sym == 'LIKE %...%' ? obj.val().replace(/\*/g, '%') : obj.val());
  6422. }
  6423. if (value == '' && sym.indexOf("NULL") == -1) {
  6424. return true;
  6425. }
  6426. op[name] = sym;
  6427. filter[name] = value;
  6428. });
  6429. return {op: op, filter: filter};
  6430. };
  6431. $.extend($.fn.bootstrapTable.defaults, {
  6432. commonSearch: false,
  6433. titleForm: "Common search",
  6434. actionForm: "",
  6435. searchFormVisible: true,
  6436. searchClass: 'searchit',
  6437. renderDefault: true,
  6438. onColumnCommonSearch: function (field, text) {
  6439. return false;
  6440. }
  6441. });
  6442. $.extend($.fn.bootstrapTable.defaults.icons, {
  6443. commonSearchIcon: 'glyphicon-search'
  6444. });
  6445. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  6446. 'column-common-search.bs.table': 'onColumnCommonSearch'
  6447. });
  6448. $.extend($.fn.bootstrapTable.locales[$.fn.bootstrapTable.defaults.locale], {
  6449. formatCommonSearch: function () {
  6450. return "Common search";
  6451. },
  6452. formatCommonSubmitButton: function () {
  6453. return "Submit";
  6454. },
  6455. formatCommonResetButton: function () {
  6456. return "Reset";
  6457. },
  6458. formatCommonCloseButton: function () {
  6459. return "Close";
  6460. },
  6461. formatCommonChoose: function () {
  6462. return "Choose";
  6463. }
  6464. });
  6465. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  6466. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  6467. _initToolbar = BootstrapTable.prototype.initToolbar,
  6468. _load = BootstrapTable.prototype.load,
  6469. _initSearch = BootstrapTable.prototype.initSearch;
  6470. BootstrapTable.prototype.initToolbar = function () {
  6471. _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
  6472. if (!isSearchAvailble(this)) {
  6473. return;
  6474. }
  6475. var that = this,
  6476. html = [];
  6477. html.push(sprintf('<div class="columns-%s pull-%s" style="margin-top:10px;">', this.options.buttonsAlign, this.options.buttonsAlign));
  6478. 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()));
  6479. html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.commonSearchIcon))
  6480. html.push('</button></div>');
  6481. that.$toolbar.prepend(html.join(''));
  6482. initCommonSearch(that.columns, that);
  6483. var searchContainer = $(".commonsearch-table", that.$container);
  6484. that.$toolbar.find('button[name="commonSearch"]')
  6485. .off('click').on('click', function () {
  6486. searchContainer.toggleClass("hidden");
  6487. return;
  6488. });
  6489. that.$container.on("click", "." + that.options.searchClass, function () {
  6490. var obj = $("form [name='" + $(this).data("field") + "']", searchContainer);
  6491. if (obj.size() > 0) {
  6492. obj.val($(this).data("value"));
  6493. $("form", searchContainer).trigger("submit");
  6494. }
  6495. });
  6496. var searchQuery = getSearchQuery(this);
  6497. var queryParams = this.options.queryParams;
  6498. this.options.queryParams = function () {
  6499. var params = queryParams.apply(this, arguments);
  6500. params.filter = JSON.stringify($.extend(params.filter || {}, searchQuery.filter));
  6501. params.op = JSON.stringify($.extend(params.op || {}, searchQuery.op));
  6502. return params;
  6503. };
  6504. };
  6505. BootstrapTable.prototype.load = function (data) {
  6506. _load.apply(this, Array.prototype.slice.apply(arguments));
  6507. if (!isSearchAvailble(this)) {
  6508. return;
  6509. }
  6510. };
  6511. BootstrapTable.prototype.initSearch = function () {
  6512. _initSearch.apply(this, Array.prototype.slice.apply(arguments));
  6513. if (!isSearchAvailble(this)) {
  6514. return;
  6515. }
  6516. var that = this;
  6517. var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
  6518. this.data = fp ? $.grep(this.data, function (item, i) {
  6519. for (var key in fp) {
  6520. var fval = fp[key].toLowerCase();
  6521. var value = item[key];
  6522. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
  6523. that.header.formatters[$.inArray(key, that.header.fields)],
  6524. [value, item, i], value);
  6525. if (!($.inArray(key, that.header.fields) !== -1 &&
  6526. (typeof value === 'string' || typeof value === 'number') &&
  6527. (value + '').toLowerCase().indexOf(fval) !== -1)) {
  6528. return false;
  6529. }
  6530. }
  6531. return true;
  6532. }) : this.data;
  6533. };
  6534. BootstrapTable.prototype.onColumnCommonSearch = function (event) {
  6535. if (typeof event === 'undefined') {
  6536. var searchquery = getSearchQuery(this);
  6537. // 追加查询关键字
  6538. this.options.pageNumber = 1;
  6539. this.options.queryParams = function (params) {
  6540. return {
  6541. search: params.search,
  6542. sort: params.sort,
  6543. order: params.order,
  6544. filter: JSON.stringify(searchquery.filter),
  6545. op: JSON.stringify(searchquery.op),
  6546. offset: params.offset,
  6547. limit: params.limit,
  6548. };
  6549. };
  6550. this.refresh({query: {filter: JSON.stringify(searchquery.filter), op: JSON.stringify(searchquery.op)}});
  6551. } else {
  6552. var text = $.trim($(event.currentTarget).val());
  6553. var $field = $(event.currentTarget)[0].id;
  6554. if ($.isEmptyObject(this.filterColumnsPartial)) {
  6555. this.filterColumnsPartial = {};
  6556. }
  6557. if (text) {
  6558. this.filterColumnsPartial[$field] = text;
  6559. } else {
  6560. delete this.filterColumnsPartial[$field];
  6561. }
  6562. this.options.pageNumber = 1;
  6563. this.onSearch(event);
  6564. // this.updatePagination();
  6565. this.trigger('column-common-search', $field, text);
  6566. }
  6567. };
  6568. }(jQuery);
  6569. define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) {
  6570. return function () {
  6571. var ret, fn;
  6572. return ret || global.$.fn.bootstrapTable.defaults;
  6573. };
  6574. }(this)));
  6575. /*!art-template - Template Engine | http://aui.github.com/artTemplate/*/
  6576. !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}();
  6577. /**
  6578. * 将BootstrapTable的行使用自定义的模板来渲染
  6579. *
  6580. * @author: karson
  6581. * @version: v0.0.1
  6582. *
  6583. * @update 2017-06-24 <http://github.com/karsonzhang/fastadmin>
  6584. */
  6585. !function ($) {
  6586. 'use strict';
  6587. $.extend($.fn.bootstrapTable.defaults, {
  6588. //是否启用模板渲染
  6589. templateView: false,
  6590. //数据格式化的模板ID或格式函数
  6591. templateFormatter: "itemtpl",
  6592. //添加的父类的class
  6593. templateParentClass: "row row-flex",
  6594. //向table添加的class
  6595. templateTableClass: "table-template",
  6596. });
  6597. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  6598. _initContainer = BootstrapTable.prototype.initContainer,
  6599. _initBody = BootstrapTable.prototype.initBody,
  6600. _initRow = BootstrapTable.prototype.initRow;
  6601. BootstrapTable.prototype.initContainer = function () {
  6602. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  6603. var that = this;
  6604. if (!that.options.templateView) {
  6605. return;
  6606. }
  6607. };
  6608. BootstrapTable.prototype.initBody = function () {
  6609. var that = this;
  6610. $.extend(that.options, {
  6611. showHeader: !that.options.templateView ? $.fn.bootstrapTable.defaults.showHeader : false,
  6612. showFooter: !that.options.templateView ? $.fn.bootstrapTable.defaults.showFooter : false,
  6613. });
  6614. $(that.$el).toggleClass(that.options.templateTableClass, that.options.templateView);
  6615. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  6616. if (!that.options.templateView) {
  6617. return;
  6618. } else {
  6619. //由于Bootstrap是基于Table的,添加一个父类容器
  6620. $("> *:not(.no-records-found)", that.$body).wrapAll($("<div />").addClass(that.options.templateParentClass));
  6621. }
  6622. };
  6623. BootstrapTable.prototype.initRow = function (item, i, data, parentDom) {
  6624. var that = this;
  6625. //如果未启用则使用原生的initRow方法
  6626. if (!that.options.templateView) {
  6627. return _initRow.apply(that, Array.prototype.slice.apply(arguments));
  6628. }
  6629. var $content = '';
  6630. if (typeof that.options.templateFormatter === 'function') {
  6631. $content = that.options.templateFormatter.call(that, item, i, data);
  6632. } else {
  6633. var Template = require('template');
  6634. $content = Template(that.options.templateFormatter, {item: item, i: i, data: data});
  6635. }
  6636. return $content;
  6637. };
  6638. }(jQuery);
  6639. define("bootstrap-table-template", ["bootstrap-table","template"], (function (global) {
  6640. return function () {
  6641. var ret, fn;
  6642. return ret || global.$.fn.bootstrapTable.defaults;
  6643. };
  6644. }(this)));
  6645. define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-mobile', 'bootstrap-table-export', 'bootstrap-table-commonsearch', 'bootstrap-table-template'], function ($, undefined, Moment) {
  6646. var Table = {
  6647. list: {},
  6648. // Bootstrap-table 基础配置
  6649. defaults: {
  6650. url: '',
  6651. sidePagination: 'server',
  6652. method: 'get',
  6653. toolbar: "#toolbar",
  6654. search: true,
  6655. cache: false,
  6656. commonSearch: true,
  6657. searchFormVisible: false,
  6658. titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
  6659. idTable: 'commonTable',
  6660. showExport: true,
  6661. exportDataType: "all",
  6662. exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
  6663. pageSize: 10,
  6664. pageList: [10, 25, 50, 'All'],
  6665. pagination: true,
  6666. clickToSelect: true,
  6667. showRefresh: false,
  6668. locale: 'zh-CN',
  6669. showToggle: true,
  6670. showColumns: true,
  6671. pk: 'id',
  6672. sortName: 'id',
  6673. sortOrder: 'desc',
  6674. paginationFirstText: __("First"),
  6675. paginationPreText: __("Previous"),
  6676. paginationNextText: __("Next"),
  6677. paginationLastText: __("Last"),
  6678. mobileResponsive: true,
  6679. cardView: true,
  6680. checkOnInit: true,
  6681. escape: true,
  6682. extend: {
  6683. index_url: '',
  6684. add_url: '',
  6685. edit_url: '',
  6686. del_url: '',
  6687. multi_url: '',
  6688. dragsort_url: 'ajax/weigh',
  6689. }
  6690. },
  6691. // Bootstrap-table 列配置
  6692. columnDefaults: {
  6693. align: 'center',
  6694. valign: 'middle',
  6695. },
  6696. config: {
  6697. firsttd: 'tbody tr td:first-child:not(:has(div.card-views))',
  6698. toolbar: '.toolbar',
  6699. refreshbtn: '.btn-refresh',
  6700. addbtn: '.btn-add',
  6701. editbtn: '.btn-edit',
  6702. delbtn: '.btn-del',
  6703. multibtn: '.btn-multi',
  6704. disabledbtn: '.btn-disabled',
  6705. editonebtn: '.btn-editone',
  6706. dragsortfield: 'weigh',
  6707. },
  6708. api: {
  6709. init: function (defaults, columnDefaults, locales) {
  6710. defaults = defaults ? defaults : {};
  6711. columnDefaults = columnDefaults ? columnDefaults : {};
  6712. locales = locales ? locales : {};
  6713. // 写入bootstrap-table默认配置
  6714. $.extend(true, $.fn.bootstrapTable.defaults, Table.defaults, defaults);
  6715. // 写入bootstrap-table column配置
  6716. $.extend($.fn.bootstrapTable.columnDefaults, Table.columnDefaults, columnDefaults);
  6717. // 写入bootstrap-table locale配置
  6718. $.extend($.fn.bootstrapTable.locales[Table.defaults.locale], {
  6719. formatCommonSearch: function () {
  6720. return __('Common search');
  6721. },
  6722. formatCommonSubmitButton: function () {
  6723. return __('Submit');
  6724. },
  6725. formatCommonResetButton: function () {
  6726. return __('Reset');
  6727. },
  6728. formatCommonCloseButton: function () {
  6729. return __('Close');
  6730. },
  6731. formatCommonChoose: function () {
  6732. return __('Choose');
  6733. }
  6734. }, locales);
  6735. },
  6736. // 绑定事件
  6737. bindevent: function (table) {
  6738. //Bootstrap-table的父元素,包含table,toolbar,pagnation
  6739. var parenttable = table.closest('.bootstrap-table');
  6740. //Bootstrap-table配置
  6741. var options = table.bootstrapTable('getOptions');
  6742. //Bootstrap操作区
  6743. var toolbar = $(options.toolbar, parenttable);
  6744. //当刷新表格时
  6745. table.on('load-error.bs.table', function (status, res) {
  6746. Toastr.error(__('Unknown data format'));
  6747. });
  6748. //当刷新表格时
  6749. table.on('refresh.bs.table', function (e, settings, data) {
  6750. $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
  6751. });
  6752. //当双击单元格时
  6753. table.on('dbl-click-row.bs.table', function (e, row, element, field) {
  6754. $(Table.config.editonebtn, element).trigger("click");
  6755. });
  6756. //当内容渲染完成后
  6757. table.on('post-body.bs.table', function (e, settings, json, xhr) {
  6758. $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
  6759. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', true);
  6760. if ($(Table.config.firsttd, table).find("input[type='checkbox'][data-index]").size() > 0) {
  6761. // 挺拽选择,需要重新绑定事件
  6762. require(['drag', 'drop'], function () {
  6763. $(Table.config.firsttd, table).drag("start", function (ev, dd) {
  6764. return $('<div class="selection" />').css('opacity', .65).appendTo(document.body);
  6765. }).drag(function (ev, dd) {
  6766. $(dd.proxy).css({
  6767. top: Math.min(ev.pageY, dd.startY),
  6768. left: Math.min(ev.pageX, dd.startX),
  6769. height: Math.abs(ev.pageY - dd.startY),
  6770. width: Math.abs(ev.pageX - dd.startX)
  6771. });
  6772. }).drag("end", function (ev, dd) {
  6773. $(dd.proxy).remove();
  6774. });
  6775. $(Table.config.firsttd, table).drop("start", function () {
  6776. Table.api.toggleattr(this);
  6777. }).drop(function () {
  6778. Table.api.toggleattr(this);
  6779. }).drop("end", function () {
  6780. Table.api.toggleattr(this);
  6781. });
  6782. $.drop({
  6783. multi: true
  6784. });
  6785. });
  6786. }
  6787. });
  6788. // 处理选中筛选框后按钮的状态统一变更
  6789. table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table fa.event.check', function () {
  6790. var ids = Table.api.selectedids(table);
  6791. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !ids.length);
  6792. });
  6793. // 刷新按钮事件
  6794. $(toolbar).on('click', Table.config.refreshbtn, function () {
  6795. table.bootstrapTable('refresh');
  6796. });
  6797. // 添加按钮事件
  6798. $(toolbar).on('click', Table.config.addbtn, function () {
  6799. var ids = Table.api.selectedids(table);
  6800. Fast.api.open(options.extend.add_url + "/ids" + (ids.length > 0 ? '/' : '') + ids.join(","), __('Add'));
  6801. });
  6802. // 批量编辑按钮事件
  6803. $(toolbar).on('click', Table.config.editbtn, function () {
  6804. var ids = Table.api.selectedids(table);
  6805. //循环弹出多个编辑框
  6806. $.each(ids, function (i, j) {
  6807. Fast.api.open(options.extend.edit_url + "/ids/" + j, __('Edit'));
  6808. });
  6809. });
  6810. // 批量操作按钮事件
  6811. $(toolbar).on('click', Table.config.multibtn, function () {
  6812. var ids = Table.api.selectedids(table);
  6813. Table.api.multi($(this).data("action"), ids, table, this);
  6814. });
  6815. // 批量删除按钮事件
  6816. $(toolbar).on('click', Table.config.delbtn, function () {
  6817. var that = this;
  6818. var ids = Table.api.selectedids(table);
  6819. var index = Layer.confirm(
  6820. __('Are you sure you want to delete the %s selected item?', ids.length),
  6821. {icon: 3, title: __('Warning'), offset: 0, shadeClose: true},
  6822. function () {
  6823. Table.api.multi("del", ids, table, that);
  6824. Layer.close(index);
  6825. }
  6826. );
  6827. });
  6828. // 拖拽排序
  6829. require(['dragsort'], function () {
  6830. //绑定拖动排序
  6831. $("tbody", table).dragsort({
  6832. itemSelector: 'tr',
  6833. dragSelector: "a.btn-dragsort",
  6834. dragEnd: function () {
  6835. var data = table.bootstrapTable('getData');
  6836. var current = data[parseInt($(this).data("index"))];
  6837. var options = table.bootstrapTable('getOptions');
  6838. //改变的值和改变的ID集合
  6839. var ids = $.map($("tbody tr:visible", table), function (tr) {
  6840. return data[parseInt($(tr).data("index"))][options.pk];
  6841. });
  6842. var changeid = current[options.pk];
  6843. var pid = typeof current.pid != 'undefined' ? current.pid : '';
  6844. var params = {
  6845. url: table.bootstrapTable('getOptions').extend.dragsort_url,
  6846. data: {
  6847. ids: ids.join(','),
  6848. changeid: changeid,
  6849. pid: pid,
  6850. field: Table.config.dragsortfield,
  6851. orderway: options.sortOrder,
  6852. table: options.extend.table
  6853. }
  6854. };
  6855. Fast.api.ajax(params, function (data) {
  6856. table.bootstrapTable('refresh');
  6857. });
  6858. },
  6859. placeHolderTemplate: ""
  6860. });
  6861. });
  6862. $(table).on("click", "input[data-id][name='checkbox']", function (e) {
  6863. table.trigger('fa.event.check');
  6864. });
  6865. $(table).on("click", "[data-id].btn-change", function (e) {
  6866. e.preventDefault();
  6867. Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this);
  6868. });
  6869. $(table).on("click", "[data-id].btn-edit", function (e) {
  6870. e.preventDefault();
  6871. Fast.api.open(options.extend.edit_url + "/ids/" + $(this).data("id"), __('Edit'));
  6872. });
  6873. $(table).on("click", "[data-id].btn-del", function (e) {
  6874. e.preventDefault();
  6875. var id = $(this).data("id");
  6876. var that = this;
  6877. var index = Layer.confirm(
  6878. __('Are you sure you want to delete this item?'),
  6879. {icon: 3, title: __('Warning'), shadeClose: true},
  6880. function () {
  6881. Table.api.multi("del", id, table, that);
  6882. Layer.close(index);
  6883. }
  6884. );
  6885. });
  6886. var id = table.attr("id");
  6887. Table.list[id] = table;
  6888. return table;
  6889. },
  6890. // 批量操作请求
  6891. multi: function (action, ids, table, element) {
  6892. var options = table.bootstrapTable('getOptions');
  6893. var data = element ? $(element).data() : {};
  6894. var url = typeof data.url !== "undefined" ? data.url : (action == "del" ? options.extend.del_url : options.extend.multi_url);
  6895. url = url + (url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + ($.isArray(ids) ? ids.join(",") : ids);
  6896. var params = typeof data.params !== "undefined" ? (typeof data.params == 'object' ? $.param(data.params) : data.params) : '';
  6897. var options = {url: url, data: {action: action, ids: ids, params: params}};
  6898. Fast.api.ajax(options, function (data) {
  6899. table.bootstrapTable('refresh');
  6900. });
  6901. },
  6902. // 单元格元素事件
  6903. events: {
  6904. operate: {
  6905. 'click .btn-editone': function (e, value, row, index) {
  6906. e.stopPropagation();
  6907. var options = $(this).closest('table').bootstrapTable('getOptions');
  6908. Fast.api.open(options.extend.edit_url + "/ids/" + row[options.pk], __('Edit'));
  6909. },
  6910. 'click .btn-delone': function (e, value, row, index) {
  6911. e.stopPropagation();
  6912. var that = this;
  6913. var top = $(that).offset().top - $(window).scrollTop();
  6914. var left = $(that).offset().left - $(window).scrollLeft() - 260;
  6915. if (top + 154 > $(window).height()) {
  6916. top = top - 154;
  6917. }
  6918. if ($(window).width() < 480) {
  6919. top = left = undefined;
  6920. }
  6921. var index = Layer.confirm(
  6922. __('Are you sure you want to delete this item?'),
  6923. {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true},
  6924. function () {
  6925. var table = $(that).closest('table');
  6926. var options = table.bootstrapTable('getOptions');
  6927. Table.api.multi("del", row[options.pk], table, that);
  6928. Layer.close(index);
  6929. }
  6930. );
  6931. }
  6932. }
  6933. },
  6934. // 单元格数据格式化
  6935. formatter: {
  6936. icon: function (value, row, index) {
  6937. if (!value)
  6938. return '';
  6939. value = value.indexOf(" ") > -1 ? value : "fa fa-" + value;
  6940. //渲染fontawesome图标
  6941. return '<i class="' + value + '"></i> ' + value;
  6942. },
  6943. image: function (value, row, index, custom) {
  6944. var classname = typeof custom !== 'undefined' ? custom : 'img-sm img-center';
  6945. return '<img class="' + classname + '" src="' + Fast.api.cdnurl(value) + '" />';
  6946. },
  6947. images: function (value, row, index, custom) {
  6948. var classname = typeof custom !== 'undefined' ? custom : 'img-sm img-center';
  6949. var arr = value.split(',');
  6950. var html = [];
  6951. $.each(arr, function (i, value) {
  6952. html.push('<img class="' + classname + '" src="' + Fast.api.cdnurl(value) + '" />');
  6953. });
  6954. return html.join(' ');
  6955. },
  6956. status: function (value, row, index, custom) {
  6957. //颜色状态数组,可使用red/yellow/aqua/blue/navy/teal/olive/lime/fuchsia/purple/maroon
  6958. var colorArr = {normal: 'success', hidden: 'grey', deleted: 'danger', locked: 'info'};
  6959. //如果有自定义状态,可以按需传入
  6960. if (typeof custom !== 'undefined') {
  6961. colorArr = $.extend(colorArr, custom);
  6962. }
  6963. value = value.toString();
  6964. var color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  6965. value = value.charAt(0).toUpperCase() + value.slice(1);
  6966. //渲染状态
  6967. var html = '<span class="text-' + color + '"><i class="fa fa-circle"></i> ' + __(value) + '</span>';
  6968. return html;
  6969. },
  6970. url: function (value, row, index) {
  6971. 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>';
  6972. },
  6973. search: function (value, row, index) {
  6974. return '<a href="javascript:;" class="searchit" data-field="' + this.field + '" data-value="' + value + '">' + value + '</a>';
  6975. },
  6976. addtabs: function (value, row, index, url) {
  6977. return '<a href="' + url + '" class="addtabsit" title="' + __("Search %s", value) + '">' + value + '</a>';
  6978. },
  6979. flag: function (value, row, index, custom) {
  6980. var colorArr = {index: 'success', hot: 'warning', recommend: 'danger', 'new': 'info'};
  6981. //如果有自定义状态,可以按需传入
  6982. if (typeof custom !== 'undefined') {
  6983. colorArr = $.extend(colorArr, custom);
  6984. }
  6985. //渲染Flag
  6986. var html = [];
  6987. var arr = value.split(',');
  6988. $.each(arr, function (i, value) {
  6989. value = value.toString();
  6990. if (value == '')
  6991. return true;
  6992. var color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  6993. value = value.charAt(0).toUpperCase() + value.slice(1);
  6994. html.push('<span class="label label-' + color + '">' + __(value) + '</span>');
  6995. });
  6996. return html.join(' ');
  6997. },
  6998. label: function (value, row, index, custom) {
  6999. var colorArr = ['success', 'warning', 'danger', 'info'];
  7000. //渲染Flag
  7001. var html = [];
  7002. var arr = value.split(',');
  7003. $.each(arr, function (i, value) {
  7004. value = value.toString();
  7005. var color = colorArr[i % colorArr.length];
  7006. html.push('<span class="label label-' + color + '">' + __(value) + '</span>');
  7007. });
  7008. return html.join(' ');
  7009. },
  7010. datetime: function (value, row, index) {
  7011. return value ? Moment(parseInt(value) * 1000).format("YYYY-MM-DD HH:mm:ss") : __('None');
  7012. },
  7013. operate: function (value, row, index, table) {
  7014. var showweigh = true;
  7015. var showedit = true;
  7016. var showdel = true;
  7017. if (typeof table != 'undefined') {
  7018. var options = table.bootstrapTable('getOptions');
  7019. if (options.extend.del_url == '')
  7020. showdel = false;
  7021. if (options.extend.edit_url == '')
  7022. showedit = false;
  7023. }
  7024. showweigh = typeof row[Table.config.dragsortfield] != 'undefined' ? true : false;
  7025. //行操作
  7026. var html = [];
  7027. if (showweigh)
  7028. html.push('<a href="javascript:;" class="btn btn-primary btn-dragsort btn-xs"><i class="fa fa-arrows"></i></a>');
  7029. if (showedit)
  7030. html.push('<a href="javascript:;" class="btn btn-success btn-editone btn-xs"><i class="fa fa-pencil"></i></a>');
  7031. if (showdel)
  7032. html.push('<a href="javascript:;" class="btn btn-danger btn-delone btn-xs"><i class="fa fa-trash"></i></a>');
  7033. return html.join(' ');
  7034. }
  7035. },
  7036. // 获取选中的条目ID集合
  7037. selectedids: function (table) {
  7038. var options = table.bootstrapTable('getOptions');
  7039. if (options.templateView) {
  7040. return $.map($("input[data-id][name='checkbox']:checked"), function (dom) {
  7041. return $(dom).data("id");
  7042. });
  7043. } else {
  7044. return $.map(table.bootstrapTable('getSelections'), function (row) {
  7045. return row[options.pk];
  7046. });
  7047. }
  7048. },
  7049. // 切换复选框状态
  7050. toggleattr: function (table) {
  7051. $("input[type='checkbox']", table).trigger('click');
  7052. }
  7053. },
  7054. };
  7055. return Table;
  7056. });
  7057. /**
  7058. * mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
  7059. * v1.5.3
  7060. *
  7061. * Copyright 2013, Moxiecode Systems AB
  7062. * Released under GPL License.
  7063. *
  7064. * License: http://www.plupload.com/license
  7065. * Contributing: http://www.plupload.com/contributing
  7066. *
  7067. * Date: 2017-02-02
  7068. */
  7069. !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 w(e,t){var i=this;setTimeout(function(){e.call(i)},t||1)}var y=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:y,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:w}}),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.toLowerCase().split(/\s*,\s*/),o=0;o<n.length;o++){if("*"===n[o])return[];if(a=s.mimes[n[o]],i&&/^\w+$/.test(n[o]))u.push("."+n[o]);else if(a&&-1===e.inArray(a,u))u.push(a);else if(!a)return[]}return u},mimes2exts:function(t){var i=this,n=[];return e.each(t,function(t){if(t=t.toLowerCase(),"*"===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;
  7070. 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",["moxie/core/utils/Basic"],function(e){var t=function(i,n){var r,o=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],a=o.length,s={http:80,https:443},u={},c=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[\da-fA-F:]+\]|[^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,l=c.exec(i||""),d=/^\/\/\w/.test(i);switch(e.typeOf(n)){case"undefined":n=t(document.location.href,!1);break;case"string":n=t(n,!1)}for(;a--;)l[a]&&(u[o[a]]=l[a]);if(r=!d&&!u.scheme,(d||r)&&(u.scheme=n.scheme),r){u.host=n.host,u.port=n.port;var m="";/^[^\/]/.test(u.path)&&(m=n.path,m=/\/[^\/]*\.[^\/]*$/.test(m)?m.replace(/\/[^\/]+$/,"/"):m.replace(/\/?$/,"/")),u.path=m+(u.path||"")}return u.port||(u.port=s[u.scheme]||80),u.port=parseInt(u.port,10),u.path||(u.path="/"),delete u.source,u},i=function(e){var i={http:80,https:443},n="object"==typeof e?e:t(e);return n.scheme+"://"+n.host+(n.port!==i[n.scheme]?":"+n.port:"")+n.path+(n.query?n.query:"")},n=function(e){function i(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof e&&(e=t(e)),i(t())===i(e)};return{parseUrl:t,resolveUrl:i,hasSameOrigin:n}}),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:w,password:y,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,w,y,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(w=u||l.user,y=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);return this.exec("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(){this.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.meta&&this.meta.thumb&&this.meta.thumb.data.destroy(),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;
  7071. 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();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"},w={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=w[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,y.type)}function h(e,t){var n,r=this;return window.FileReader?(n=new FileReader,n.onload=function(){t.call(r,this.result)},n.onerror=function(){r.trigger("error",i.ImageError.WRONG_FORMAT)},n.readAsDataURL(e),void 0):t.call(this,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),w=g=v=y=null,b=!1}var g,x,v,w,y,E=this,b=!1,R=!0;t.extend(this,{loadFromBlob:function(e){var t=this.getRuntime(),n=arguments.length>1?arguments[1]:!0;if(!t.can("access_binary"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);return y=e,e.isDetached()?(w=e.getSource(),m.call(this,w),void 0):(h.call(this,e.getSource(),function(e){n&&(w=l(e)),m.call(this,e)}),void 0)},loadFromImage:function(e,t){this.meta=e.meta,y=new o(null,{name:e.name,size:e.size,type:e.type}),m.call(this,t?w=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var t,i=this.getRuntime();return!x&&w&&i.can("access_image_binary")&&(x=new a(w)),t={width:e().width||0,height:e().height||0,type:y.type||u.getFileMime(y.name),size:w&&w.length||y.size||0,name:y.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:y.name||"",type:e,data:E.getAsDataURL(e,t)})):new o(null,{name:y.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 w||(w=l(E.getAsDataURL(e,t))),w;if("image/jpeg"!==e)w=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")}w=l(i),x&&(w=x.stripHeaders(w),R&&(x.meta&&x.meta.exif&&x.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),w=x.writeHeaders(w)),x.purge(),x=null)}return b=!1,w},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&&!(e.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)
  7072. }),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)}),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&&!(e.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=w.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,w=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"),w.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)});
  7073. define("../libs/plupload/js/moxie.min", function(){});
  7074. /**
  7075. * Plupload - multi-runtime File Uploader
  7076. * v2.3.1
  7077. *
  7078. * Copyright 2013, Moxiecode Systems AB
  7079. * Released under GPL License.
  7080. *
  7081. * License: http://www.plupload.com/license
  7082. * Contributing: http://www.plupload.com/contributing
  7083. *
  7084. * Date: 2017-02-06
  7085. */
  7086. !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&&e.chunk_size>0&&(n.slice_blob=!0),l.isEmptyObj(e.resize)&&e.multipart!==!1||(n.send_binary_string=!0),e.http_method&&(n.use_http_method=e.http_method),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.3.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<x.length;t++)e||x[t].status!=l.QUEUED?i++:(e=x[t],this.trigger("BeforeUpload",e)&&(e.status=l.UPLOADING,this.trigger("UploadFile",e)));i==x.length&&(this.state!==l.STOPPED&&(this.state=l.STOPPED,this.trigger("StateChanged")),this.trigger("UploadComplete",x))}}function u(e){e.percent=e.size>0?Math.ceil(100*(e.loaded/e.size)):100,d()}function d(){var e,t,n,r=0;for(w.reset(),e=0;e<x.length;e++)t=x[e],t.size!==i?(w.size+=t.origSize,n=t.loaded*t.origSize/t.size,(!t.completeTimestamp||t.completeTimestamp>I)&&(r+=n),w.loaded+=n):w.size=i,t.status==l.DONE?w.uploaded++:t.status==l.FAILED?w.failed++:w.queued++;w.size===i?w.percent=x.length>0?Math.ceil(100*(w.uploaded/x.length)):0:(w.bytesPerSec=Math.ceil(r/((+new Date-I||1)/1e3)),w.percent=w.size>0?Math.ceil(100*(w.loaded/w.size)):0)}function c(){var e=U[0]||F[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",_),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:P,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++,U.push(this),s()},u.onchange=function(){n.addFile(this.files)},u.bind("mouseenter mouseleave mousedown mouseup",function(t){A||(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++,F.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 m(e,i,r){function s(e,i,n){var r=S[e];switch(e){case"max_file_size":"max_file_size"===e&&(S.max_file_size=S.filters.max_file_size=i);break;case"chunk_size":(i=l.parseSize(i))&&(S[e]=i,S.send_file_name=!0);break;case"multipart":S[e]=i,i||(S.send_file_name=!0);break;case"http_method":S[e]="PUT"===i.toUpperCase()?"PUT":"POST";break;case"unique_names":S[e]=i,i&&(S.send_file_name=!0);break;case"filters":"array"===l.typeOf(i)&&(i={mime_types:i}),n?l.extend(S.filters,i):S.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),S.filters.mime_types=i.mime_types);break;case"resize":S.resize=i?l.extend({preserve_headers:!0,crop:!1},i):!1;break;case"prevent_duplicates":S.prevent_duplicates=S.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":S[e]=i,n||(u=!0);break;default:S[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?(S.required_features=n(l.extend({},S)),P=n(l.extend({},S,{required_features:!0}))):u&&(a.trigger("Destroy"),g.call(a,S,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 _(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(){c-->0?r(s,1e3):(i.loaded=g,e.trigger("Error",{code:l.HTTP_ERROR,message:l.translate("HTTP Error."),file:i,response:T.responseText,status:T.status,responseHeaders:T.getAllResponseHeaders()}))}function s(){var t,n,r={};i.status===l.UPLOADING&&e.state!==l.STOPPED&&(e.settings.send_file_name&&(r.name=i.target_name||i.name),d&&p.chunks&&o.size>d?(n=Math.min(d,o.size-g),t=o.slice(g,g+n)):(n=o.size,t=o),d&&p.chunks&&(e.settings.send_chunk_number?(r.chunk=Math.ceil(g/d),r.chunks=Math.ceil(o.size/d)):(r.offset=g,r.total=o.size)),e.trigger("BeforeChunkUpload",i,r,t,g)&&a(r,t,n))}function a(a,d,f){var h;T=new t.xhr.XMLHttpRequest,T.upload&&(T.upload.onprogress=function(t){i.loaded=Math.min(i.size,g+t.loaded),e.trigger("UploadProgress",i)}),T.onload=function(){return T.status>=400?(n(),void 0):(c=e.settings.max_retries,f<o.size?(d.destroy(),g+=f,i.loaded=Math.min(g,o.size),e.trigger("ChunkUploaded",i,{offset:i.loaded,total:o.size,response:T.responseText,status:T.status,responseHeaders:T.getAllResponseHeaders()}),"Android Browser"===l.ua.browser&&e.trigger("UploadProgress",i)):i.loaded=i.size,d=h=null,!g||g>=o.size?(i.size!=i.origSize&&(o.destroy(),o=null),e.trigger("UploadProgress",i),i.status=l.DONE,i.completeTimestamp=+new Date,e.trigger("FileUploaded",i,{response:T.responseText,status:T.status,responseHeaders:T.getAllResponseHeaders()})):r(s,1),void 0)},T.onerror=function(){n()},T.onloadend=function(){this.destroy(),T=null},e.settings.multipart&&p.multipart?(T.open(e.settings.http_method,u,!0),l.each(e.settings.headers,function(e,t){T.setRequestHeader(t,e)}),h=new t.xhr.FormData,l.each(l.extend(a,e.settings.multipart_params),function(e,t){h.append(t,e)}),h.append(e.settings.file_data_name,d),T.send(h,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:P,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})):(u=l.buildUrl(e.settings.url,l.extend(a,e.settings.multipart_params)),T.open(e.settings.http_method,u,!0),l.each(e.settings.headers,function(e,t){T.setRequestHeader(t,e)}),T.hasRequestHeader("Content-Type")||T.setRequestHeader("Content-Type","application/octet-stream"),T.send(d,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:P,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url}))}var o,u=e.settings.url,d=e.settings.chunk_size,c=e.settings.max_retries,p=e.features,g=0;i.loaded&&(g=i.loaded=d?d*Math.floor(i.loaded/d):0),o=i.getSource(),!l.isEmptyObj(e.settings.resize)&&f(o,"send_binary_string")&&-1!==l.inArray(o.type,["image/jpeg","image/png"])?h.call(this,o,e.settings.resize,function(e){o=e,i.size=e.size,s()}):s()}function v(e,t){u(t)}function b(e){if(e.state==l.STARTED)I=+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(){T&&T.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,t.file.completeTimestamp=+new Date,u(t.file),e.state==l.STARTED&&(e.trigger("CancelUpload"),r(function(){a.call(e)},1)))}function O(e){e.stop(),l.each(x,function(e){e.destroy()}),x=[],U.length&&(l.each(U,function(e){e.destroy()}),U=[]),F.length&&(l.each(F,function(e){e.destroy()}),F=[]),P={},A=!1,I=T=null,w.reset()}var S,I,w,T,D=l.guid(),x=[],P={},U=[],F=[],A=!1;S={chunk_size:0,file_data_name:"file",filters:{mime_types:[],prevent_duplicates:!1,max_file_size:0},flash_swf_url:"js/Moxie.swf",http_method:"POST",max_retries:0,multipart:!0,multi_selection:!0,resize:!1,runtimes:o.order,send_file_name:!0,send_chunk_number:!0,silverlight_xap_url:"js/Moxie.xap"},m.call(this,e,null,!0),w=new l.QueueProgress,l.extend(this,{id:D,uid:D,state:l.STOPPED,features:{},runtime:null,files:x,settings:S,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):S.browse_button||S.drop_element?(g.call(i,S,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){m.call(this,e,t,!this.runtime)},getOption:function(e){return e?S[e]:S},refresh:function(){U.length&&l.each(U,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(){A=arguments[0]!==i?arguments[0]:!0,U.length&&l.each(U,function(e){e.disable(A)}),this.trigger("DisableBrowse",A)},getFile:function(e){var t;for(t=x.length-1;t>=0;t--)if(x[t].id===e)return x[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||(x.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=x.length-1;i>=0;i--)if(x[i].id===t)return this.splice(i,1)[0]},splice:function(e,t){var n=x.splice(e===i?0:e,t===i?x.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"),S=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(),completeTimestamp:0,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)});
  7087. define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, undefined, Plupload, Template) {
  7088. var Upload = {
  7089. list: {},
  7090. config: {
  7091. container: document.body,
  7092. classname: '.plupload:not([initialized])',
  7093. 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>',
  7094. },
  7095. events: {
  7096. //上传成功的回调
  7097. onUploadSuccess: function (ret, onUploadSuccess, button) {
  7098. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  7099. //上传成功后回调
  7100. if (button) {
  7101. //如果有文本框则填充
  7102. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  7103. if (input_id) {
  7104. var urlArr = [];
  7105. var inputObj = $("#" + input_id);
  7106. if ($(button).data("multiple") && inputObj.val() !== "") {
  7107. urlArr.push(inputObj.val());
  7108. }
  7109. urlArr.push(data.url);
  7110. inputObj.val(urlArr.join(",")).trigger("change");
  7111. }
  7112. //如果有回调函数
  7113. var onDomUploadSuccess = $(button).data("upload-success");
  7114. if (onDomUploadSuccess) {
  7115. if (typeof onDomUploadSuccess !== 'function' && typeof Upload.api.custom[onDomUploadSuccess] === 'function') {
  7116. onDomUploadSuccess = Upload.api.custom[onDomUploadSuccess];
  7117. }
  7118. if (typeof onDomUploadSuccess === 'function') {
  7119. var result = onDomUploadSuccess.call(button, data, ret);
  7120. if (result === false)
  7121. return;
  7122. }
  7123. }
  7124. }
  7125. if (typeof onUploadSuccess === 'function') {
  7126. var result = onUploadSuccess.call(button, data, ret);
  7127. if (result === false)
  7128. return;
  7129. }
  7130. },
  7131. //上传错误的回调
  7132. onUploadError: function (ret, onUploadError, button) {
  7133. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  7134. if (button) {
  7135. var onDomUploadError = $(button).data("upload-error");
  7136. if (onDomUploadError) {
  7137. if (typeof onDomUploadError !== 'function' && typeof Upload.api.custom[onDomUploadError] === 'function') {
  7138. onDomUploadError = Upload.api.custom[onDomUploadError];
  7139. }
  7140. if (typeof onDomUploadError === 'function') {
  7141. var result = onDomUploadError.call(button, data, ret);
  7142. if (result === false)
  7143. return;
  7144. }
  7145. }
  7146. }
  7147. if (typeof onUploadError === 'function') {
  7148. var result = onUploadError.call(button, data, ret);
  7149. if (result === false) {
  7150. return;
  7151. }
  7152. }
  7153. Toastr.error(ret.msg + "(code:" + ret.code + ")");
  7154. },
  7155. //服务器响应数据后
  7156. onUploadResponse: function (response) {
  7157. try {
  7158. var ret = typeof response === 'object' ? response : JSON.parse(response);
  7159. if (!ret.hasOwnProperty('code')) {
  7160. $.extend(ret, {code: -2, msg: response, data: null});
  7161. }
  7162. } catch (e) {
  7163. var ret = {code: -1, msg: e.message, data: null};
  7164. }
  7165. return ret;
  7166. }
  7167. },
  7168. api: {
  7169. //Plupload上传
  7170. plupload: function (element, onUploadSuccess, onUploadError) {
  7171. element = typeof element === 'undefined' ? Upload.config.classname : element;
  7172. $(element, Upload.config.container).each(function () {
  7173. $(this).attr("initialized", true);
  7174. var that = this;
  7175. var id = $(this).prop("id");
  7176. var url = $(this).data("url");
  7177. var maxsize = $(this).data("maxsize");
  7178. var mimetype = $(this).data("mimetype");
  7179. var multipart = $(this).data("multipart");
  7180. var multiple = $(this).data("multiple");
  7181. //填充ID
  7182. var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
  7183. //预览ID
  7184. var preview_id = $(that).data("preview-id") ? $(that).data("preview-id") : "";
  7185. //上传URL
  7186. url = url ? url : Config.upload.uploadurl;
  7187. url = Fast.api.fixurl(url);
  7188. //最大可上传
  7189. maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize;
  7190. //文件类型
  7191. mimetype = typeof mimetype !== "undefined" ? mimetype : Config.upload.mimetype;
  7192. //请求的表单参数
  7193. multipart = typeof multipart !== "undefined" ? multipart : Config.upload.multipart;
  7194. //是否支持批量上传
  7195. multiple = typeof multiple !== "undefined" ? multiple : Config.upload.multiple;
  7196. //生成Plupload实例
  7197. Upload.list[id] = new Plupload.Uploader({
  7198. runtimes: 'html5,flash,silverlight,html4',
  7199. multi_selection: multiple, //是否允许多选批量上传
  7200. browse_button: id, // 浏览按钮的ID
  7201. container: $(this).parent().get(0), //取按钮的上级元素
  7202. flash_swf_url: '/assets/libs/plupload/js/Moxie.swf',
  7203. silverlight_xap_url: '/assets/libs/plupload/js/Moxie.xap',
  7204. filters: {
  7205. max_file_size: maxsize,
  7206. mime_types: mimetype
  7207. },
  7208. url: url,
  7209. multipart_params: multipart,
  7210. init: {
  7211. PostInit: function () {
  7212. },
  7213. FilesAdded: function (up, files) {
  7214. var button = up.settings.button;
  7215. $(button).data("bakup-html", $(button).html());
  7216. //添加后立即上传
  7217. setTimeout(function () {
  7218. up.start();
  7219. }, 1);
  7220. },
  7221. UploadProgress: function (up, file) {
  7222. var button = up.settings.button;
  7223. //这里可以改成其它的表现形式
  7224. //document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
  7225. $(button).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + file.percent + "%");
  7226. },
  7227. FileUploaded: function (up, file, info) {
  7228. var button = up.settings.button;
  7229. //还原按钮文字及状态
  7230. $(button).prop("disabled", false).html($(button).data("bakup-html"));
  7231. var ret = Upload.events.onUploadResponse(info.response);
  7232. if (ret.code === 1) {
  7233. Upload.events.onUploadSuccess(ret, onUploadSuccess, button);
  7234. } else {
  7235. Upload.events.onUploadError(ret, onUploadError, button);
  7236. }
  7237. },
  7238. Error: function (up, err) {
  7239. var button = up.settings.button;
  7240. $(button).prop("disabled", false).html($(button).data("bakup-html"));
  7241. var ret = {code: err.code, msg: err.message, data: null};
  7242. Upload.events.onUploadError(ret, onUploadError, button);
  7243. }
  7244. },
  7245. onUploadSuccess: onUploadSuccess,
  7246. onUploadError: onUploadError,
  7247. button: that
  7248. });
  7249. //拖动排序
  7250. if (preview_id && multiple) {
  7251. require(['dragsort'], function () {
  7252. $("#" + preview_id).dragsort({
  7253. dragSelector: "li",
  7254. dragEnd: function () {
  7255. $("#" + preview_id).trigger("fa.preview.change");
  7256. },
  7257. placeHolderTemplate: '<li class="col-xs-3"></li>'
  7258. });
  7259. });
  7260. }
  7261. if (preview_id && input_id) {
  7262. $(document.body).on("keyup change", "#" + input_id, function () {
  7263. var inputStr = $("#" + input_id).val();
  7264. var inputArr = inputStr.split(/\,/);
  7265. $("#" + preview_id).empty();
  7266. var tpl = $("#" + preview_id).data("template") ? $("#" + preview_id).data("template") : "";
  7267. $.each(inputArr, function (i, j) {
  7268. if (!j) {
  7269. return true;
  7270. }
  7271. var data = {url: j, fullurl: Fast.api.cdnurl(j), data: $(that).data()};
  7272. var html = tpl ? Template(tpl, data) : Template.render(Upload.config.previewtpl, data);
  7273. $("#" + preview_id).append(html);
  7274. });
  7275. });
  7276. $("#" + input_id).trigger("keyup");
  7277. }
  7278. if (preview_id) {
  7279. // 监听事件
  7280. $(document.body).on("fa.preview.change", "#" + preview_id, function () {
  7281. var urlArr = new Array();
  7282. $("#" + preview_id + " [data-url]").each(function (i, j) {
  7283. urlArr.push($(this).data("url"));
  7284. });
  7285. if (input_id) {
  7286. $("#" + input_id).val(urlArr.join(","));
  7287. }
  7288. });
  7289. // 移除按钮事件
  7290. $(document.body).on("click", "#" + preview_id + " .btn-trash", function () {
  7291. $(this).closest("li").remove();
  7292. $("#" + preview_id).trigger("fa.preview.change");
  7293. });
  7294. }
  7295. Upload.list[id].init();
  7296. });
  7297. },
  7298. // AJAX异步上传
  7299. send: function (file, onUploadSuccess, onUploadError) {
  7300. var data = new FormData();
  7301. data.append("file", file);
  7302. $.each(Config.upload.multipart, function (k, v) {
  7303. data.append(k, v);
  7304. });
  7305. $.ajax({
  7306. url: Config.upload.uploadurl,
  7307. data: data,
  7308. cache: false,
  7309. contentType: false,
  7310. processData: false,
  7311. type: 'POST',
  7312. success: function (ret) {
  7313. ret = Upload.events.onUploadResponse(ret);
  7314. if (ret.code === 1) {
  7315. Upload.events.onUploadSuccess(ret, onUploadSuccess);
  7316. } else {
  7317. Upload.events.onUploadError(ret, onUploadError);
  7318. }
  7319. }, error: function (e) {
  7320. var ret = {code: 500, msg: e.message, data: null};
  7321. Upload.events.onUploadError(ret, onUploadError);
  7322. }
  7323. });
  7324. },
  7325. custom: {
  7326. //自定义上传完成回调
  7327. afteruploadcallback: function (response) {
  7328. console.log(this, response);
  7329. alert("Custom Callback,Response URL:" + response.url);
  7330. },
  7331. },
  7332. }
  7333. };
  7334. return Upload;
  7335. });
  7336. /*! nice-validator 1.1.1
  7337. * (c) 2012-2017 Jony Zhang <niceue@live.com>, MIT Licensed
  7338. * https://github.com/niceue/nice-validator
  7339. */
  7340. ;(function(factory) {
  7341. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  7342. typeof define === 'function' && define.amd ? define('validator-core',['jquery'], factory) :
  7343. factory(jQuery);
  7344. }(function($, undefined) {
  7345. "use strict";
  7346. var NS = 'validator',
  7347. CLS_NS = '.' + NS,
  7348. CLS_NS_RULE = '.rule',
  7349. CLS_NS_FIELD = '.field',
  7350. CLS_NS_FORM = '.form',
  7351. CLS_WRAPPER = 'nice-' + NS,
  7352. CLS_MSG_BOX = 'msg-box',
  7353. ARIA_INVALID = 'aria-invalid',
  7354. DATA_RULE = 'data-rule',
  7355. DATA_MSG = 'data-msg',
  7356. DATA_TIP = 'data-tip',
  7357. DATA_OK = 'data-ok',
  7358. DATA_TIMELY = 'data-timely',
  7359. DATA_TARGET = 'data-target',
  7360. DATA_DISPLAY = 'data-display',
  7361. DATA_MUST = 'data-must',
  7362. NOVALIDATE = 'novalidate',
  7363. INPUT_SELECTOR = ':verifiable',
  7364. rRules = /(&)?(!)?\b(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?\s*(;|\|)?/g,
  7365. rRule = /(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?/,
  7366. rDisplay = /(?:([^:;\(\[]*):)?(.*)/,
  7367. rDoubleBytes = /[^\x00-\xff]/g,
  7368. rPos = /top|right|bottom|left/,
  7369. rAjaxType = /(?:(cors|jsonp):)?(?:(post|get):)?(.+)/i,
  7370. rUnsafe = /[<>'"`\\]|&#x?\d+[A-F]?;?|%3[A-F]/gmi,
  7371. noop = $.noop,
  7372. proxy = $.proxy,
  7373. trim = $.trim,
  7374. isFunction = $.isFunction,
  7375. isString = function(s) {
  7376. return typeof s === 'string';
  7377. },
  7378. isObject = function(o) {
  7379. return o && Object.prototype.toString.call(o) === '[object Object]';
  7380. },
  7381. isIE = document.documentMode || +(navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1),
  7382. attr = function(el, key, value) {
  7383. if (!el || !el.tagName) return null;
  7384. if (value !== undefined) {
  7385. if (value === null) el.removeAttribute(key);
  7386. else el.setAttribute(key, '' + value);
  7387. } else {
  7388. return el.getAttribute(key);
  7389. }
  7390. },
  7391. novalidateonce,
  7392. preinitialized = {},
  7393. defaults = {
  7394. debug: 0,
  7395. theme: 'default',
  7396. ignore: '',
  7397. focusInvalid: true,
  7398. focusCleanup: false,
  7399. stopOnError: false,
  7400. beforeSubmit: null,
  7401. valid: null,
  7402. invalid: null,
  7403. validation: null,
  7404. formClass: 'n-default',
  7405. validClass: 'n-valid',
  7406. invalidClass: 'n-invalid',
  7407. bindClassTo: null
  7408. },
  7409. fieldDefaults = {
  7410. timely: 1,
  7411. display: null,
  7412. target: null,
  7413. ignoreBlank: false,
  7414. showOk: true,
  7415. // Translate ajax response to validation result
  7416. dataFilter: function (data) {
  7417. if ( isString(data) || ( isObject(data) && ('error' in data || 'ok' in data) ) ) {
  7418. return data;
  7419. }
  7420. },
  7421. msgMaker: function(opt) {
  7422. var html;
  7423. html = '<span role="alert" class="msg-wrap n-'+ opt.type + '">' + opt.arrow;
  7424. if (opt.result) {
  7425. $.each(opt.result, function(i, obj){
  7426. html += '<span class="n-'+ obj.type +'">' + opt.icon + '<span class="n-msg">' + obj.msg + '</span></span>';
  7427. });
  7428. } else {
  7429. html += opt.icon + '<span class="n-msg">' + opt.msg + '</span>';
  7430. }
  7431. html += '</span>';
  7432. return html;
  7433. },
  7434. msgWrapper: 'span',
  7435. msgArrow: '',
  7436. msgIcon: '<span class="n-icon"></span>',
  7437. msgClass: 'n-right',
  7438. msgStyle: '',
  7439. msgShow: null,
  7440. msgHide: null
  7441. },
  7442. themes = {};
  7443. /** jQuery Plugin
  7444. * @param {Object} options
  7445. debug {Boolean} 0 Whether to enable debug mode
  7446. timely {Number} 1 Whether to enable timely validation
  7447. theme {String} 'default' Theme name
  7448. stopOnError {Boolean} false Whether to stop validate when found an error input
  7449. focusCleanup {Boolean} false Whether to clean up the field message when focus the field
  7450. focusInvalid {Boolean} true Whether to focus the field that is invalid
  7451. ignoreBlank {Boolean} false When the field has no value, whether to ignore validation
  7452. ignore {jqSelector} '' Ignored fields (Using jQuery selector)
  7453. beforeSubmit {Function} Do something before submit form
  7454. dataFilter {Function} Convert ajax results
  7455. valid {Function} Triggered when the form is valid
  7456. invalid {Function} Triggered when the form is invalid
  7457. validClass {String} 'n-valid' Add this class name to a valid field
  7458. invalidClass {String} 'n-invalid' Add this class name to a invalid field
  7459. bindClassTo {jqSelector} ':verifiable' Which element should the className binding to
  7460. display {Function} Callback function to get dynamic display
  7461. target {Function} Callback function to get dynamic target
  7462. msgShow {Function} Trigger this callback when show message
  7463. msgHide {Function} Trigger this callback when hide message
  7464. msgWrapper {String} 'span' Message wrapper tag name
  7465. msgMaker {Function} Callback function to make message HTML
  7466. msgArrow {String} Message arrow template
  7467. msgIcon {String} Message icon template
  7468. msgStyle {String} Custom message css style
  7469. msgClass {String} Additional added to the message class names
  7470. formClass {String} Additional added to the form class names
  7471. messages {Object} Custom messages for the current instance
  7472. rules {Object} Custom rules for the current instance
  7473. fields {Object} Field validation configuration
  7474. {String} key name|#id
  7475. {String|Object} value Rule string or an object which can pass more arguments
  7476. fields[key][rule] {String} Rule string
  7477. fields[key][display] {String|Function}
  7478. fields[key][tip] {String} Custom tip message
  7479. fields[key][ok] {String} Custom success message
  7480. fields[key][msg] {Object} Custom error message
  7481. fields[key][msgStyle] {String} Custom message style
  7482. fields[key][msgClass] {String} A className which added to message placeholder element
  7483. fields[key][msgWrapper] {String} Tag name of the message placeholder element
  7484. fields[key][msgMaker] {Function} A function to custom message HTML
  7485. fields[key][dataFilter] {Function} A function to convert ajax results
  7486. fields[key][valid] {Function} A function triggered when field is valid
  7487. fields[key][invalid] {Function} A function triggered when field is invalid
  7488. fields[key][must] {Boolean} If set true, we always check the field even has remote checking
  7489. fields[key][timely] {Boolean} Whether to enable timely validation
  7490. fields[key][target] {jqSelector} Define placement of a message
  7491. */
  7492. $.fn.validator = function(options) {
  7493. var that = this,
  7494. args = arguments;
  7495. if (that.is(INPUT_SELECTOR)) return that;
  7496. if (!that.is('form')) that = this.find('form');
  7497. if (!that.length) that = this;
  7498. that.each(function() {
  7499. var instance = $(this).data(NS);
  7500. if (instance) {
  7501. if ( isString(options) ) {
  7502. if ( options.charAt(0) === '_' ) return;
  7503. instance[options].apply(instance, [].slice.call(args, 1));
  7504. }
  7505. else if (options) {
  7506. instance._reset(true);
  7507. instance._init(this, options);
  7508. }
  7509. } else {
  7510. new Validator(this, options);
  7511. }
  7512. });
  7513. return this;
  7514. };
  7515. // Validate a field, or an area
  7516. $.fn.isValid = function(callback, hideMsg) {
  7517. var me = _getInstance(this[0]),
  7518. hasCallback = isFunction(callback),
  7519. ret, opt;
  7520. if (!me) return true;
  7521. if (!hasCallback && hideMsg === undefined) hideMsg = callback;
  7522. me.checkOnly = !!hideMsg;
  7523. opt = me.options;
  7524. ret = me._multiValidate(
  7525. this.is(INPUT_SELECTOR) ? this : this.find(INPUT_SELECTOR),
  7526. function(isValid){
  7527. if (!isValid && opt.focusInvalid && !me.checkOnly) {
  7528. // navigate to the error element
  7529. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  7530. }
  7531. if (hasCallback) {
  7532. if (callback.length) {
  7533. callback(isValid);
  7534. } else if (isValid) {
  7535. callback();
  7536. }
  7537. }
  7538. me.checkOnly = false;
  7539. }
  7540. );
  7541. // If you pass a callback, we maintain the jQuery object chain
  7542. return hasCallback ? this : ret;
  7543. };
  7544. $.extend($.expr.pseudos || $.expr[':'], {
  7545. // A faster selector than ":input:not(:submit,:button,:reset,:image,:disabled,[contenteditable])"
  7546. verifiable: function(elem) {
  7547. var name = elem.nodeName.toLowerCase();
  7548. return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
  7549. name === 'select' ||
  7550. name === 'textarea' ||
  7551. elem.contentEditable === 'true'
  7552. ) && !elem.disabled;
  7553. },
  7554. // any value, but not only whitespace
  7555. filled: function(elem) {
  7556. return !!trim($(elem).val());
  7557. }
  7558. });
  7559. /**
  7560. * Creates a new Validator
  7561. *
  7562. * @class
  7563. * @param {Element} element - form element
  7564. * @param {Object} options - options for validator
  7565. */
  7566. function Validator(element, options) {
  7567. var me = this;
  7568. if ( !(me instanceof Validator) ) {
  7569. return new Validator(element, options);
  7570. }
  7571. if (Validator.pending) {
  7572. $(window).on('validatorready', init);
  7573. } else {
  7574. init();
  7575. }
  7576. function init() {
  7577. me.$el = $(element);
  7578. if (me.$el.length) {
  7579. me._init(me.$el[0], options);
  7580. }
  7581. else if (isString(element)) {
  7582. preinitialized[element] = options;
  7583. }
  7584. }
  7585. }
  7586. Validator.prototype = {
  7587. _init: function(element, options) {
  7588. var me = this,
  7589. opt, themeOpt, dataOpt;
  7590. // Initialization options
  7591. if ( isFunction(options) ) {
  7592. options = {
  7593. valid: options
  7594. };
  7595. }
  7596. options = me._opt = options || {};
  7597. dataOpt = attr(element, 'data-'+ NS +'-option');
  7598. dataOpt = me._dataOpt = dataOpt && dataOpt.charAt(0) === '{' ? (new Function("return " + dataOpt))() : {};
  7599. themeOpt = me._themeOpt = themes[ options.theme || dataOpt.theme || defaults.theme ];
  7600. opt = me.options = $.extend({}, defaults, fieldDefaults, themeOpt, me.options, options, dataOpt);
  7601. me.rules = new Rules(opt.rules, true);
  7602. me.messages = new Messages(opt.messages, true);
  7603. me.Field = _createFieldFactory(me);
  7604. me.elements = me.elements || {};
  7605. me.deferred = {};
  7606. me.errors = {};
  7607. me.fields = {};
  7608. // Initialization fields
  7609. me._initFields(opt.fields);
  7610. // Initialization events and make a cache
  7611. if ( !me.$el.data(NS) ) {
  7612. me.$el.data(NS, me).addClass(CLS_WRAPPER +' '+ opt.formClass)
  7613. .on('form-submit-validate', function(e, a, $form, opts, veto) {
  7614. me.vetoed = veto.veto = !me.isValid;
  7615. me.ajaxFormOptions = opts;
  7616. })
  7617. .on('submit'+ CLS_NS +' validate'+ CLS_NS, proxy(me, '_submit'))
  7618. .on('reset'+ CLS_NS, proxy(me, '_reset'))
  7619. .on('showmsg'+ CLS_NS, proxy(me, '_showmsg'))
  7620. .on('hidemsg'+ CLS_NS, proxy(me, '_hidemsg'))
  7621. .on('focusin'+ CLS_NS + ' click'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusin'))
  7622. .on('focusout'+ CLS_NS +' validate'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusout'))
  7623. .on('keyup'+ CLS_NS +' input'+ CLS_NS + ' compositionstart compositionend', INPUT_SELECTOR, proxy(me, '_focusout'))
  7624. .on('click'+ CLS_NS, ':radio,:checkbox', 'click', proxy(me, '_focusout'))
  7625. .on('change'+ CLS_NS, 'select,input[type="file"]', 'change', proxy(me, '_focusout'));
  7626. // cache the novalidate attribute value
  7627. me._NOVALIDATE = attr(element, NOVALIDATE);
  7628. // Initialization is complete, stop off default HTML5 form validation
  7629. // If use "jQuery.attr('novalidate')" in IE7 will complain: "SCRIPT3: Member not found."
  7630. attr(element, NOVALIDATE, NOVALIDATE);
  7631. }
  7632. // Display all messages in target container
  7633. if ( isString(opt.target) ) {
  7634. me.$el.find(opt.target).addClass('msg-container');
  7635. }
  7636. },
  7637. // Guess whether the form use ajax submit
  7638. _guessAjax: function(form) {
  7639. var me = this;
  7640. if ( !(me.isAjaxSubmit = !!me.options.valid) ) {
  7641. // if there is a "valid.form" event
  7642. var events = ($._data || $.data)(form, "events");
  7643. me.isAjaxSubmit = issetEvent(events, 'valid', 'form') || issetEvent(events, 'submit', 'form-plugin');
  7644. }
  7645. function issetEvent(events, name, namespace) {
  7646. if ( events && events[name] &&
  7647. $.map(events[name], function(e){
  7648. return ~e.namespace.indexOf(namespace) ? 1 : null;
  7649. }).length
  7650. ) {
  7651. return true;
  7652. }
  7653. return false;
  7654. }
  7655. },
  7656. _initFields: function(fields) {
  7657. var me = this, k, arr, i,
  7658. clear = fields === null;
  7659. // Processing field information
  7660. if (clear) fields = me.fields;
  7661. if ( isObject(fields) ) {
  7662. for (k in fields) {
  7663. if (~k.indexOf(',')) {
  7664. arr = k.split(',');
  7665. i = arr.length;
  7666. while (i--) {
  7667. initField(trim(arr[i]), fields[k]);
  7668. }
  7669. } else {
  7670. initField(k, fields[k]);
  7671. }
  7672. }
  7673. }
  7674. // Parsing DOM rules
  7675. me.$el.find(INPUT_SELECTOR).each(function() {
  7676. me._parse(this);
  7677. });
  7678. function initField(k, v) {
  7679. // delete a field from settings
  7680. if ( v === null || clear ) {
  7681. var el = me.elements[k];
  7682. if (el) me._resetElement(el, true);
  7683. delete me.fields[k];
  7684. } else {
  7685. me.fields[k] = new me.Field(k, isString(v) ? {rule: v} : v, me.fields[k]);
  7686. }
  7687. }
  7688. },
  7689. // Parsing a field
  7690. _parse: function(el) {
  7691. var me = this,
  7692. field,
  7693. key = el.name,
  7694. display,
  7695. timely,
  7696. dataRule = attr(el, DATA_RULE);
  7697. dataRule && attr(el, DATA_RULE, null);
  7698. // If the field has passed the key as id mode, or it doesn't has a name
  7699. if ( el.id && (
  7700. ('#' + el.id in me.fields) ||
  7701. !key ||
  7702. // If dataRule and element are diffrent from old's, we use ID mode.
  7703. (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
  7704. )
  7705. ) {
  7706. key = '#' + el.id;
  7707. }
  7708. // Generate id
  7709. if (!key) {
  7710. key = '#' + (el.id = 'N' + String(Math.random()).slice(-12));
  7711. }
  7712. field = me.getField(key, true);
  7713. // The priority of passing parameter by DOM is higher than by JS.
  7714. field.rule = dataRule || field.rule;
  7715. if (display = attr(el, DATA_DISPLAY)) {
  7716. field.display = display;
  7717. }
  7718. if (field.rule) {
  7719. if ( attr(el, DATA_MUST) !== null || /\b(?:match|checked)\b/.test(field.rule) ) {
  7720. field.must = true;
  7721. }
  7722. if ( /\brequired\b/.test(field.rule) ) {
  7723. field.required = true;
  7724. }
  7725. if (timely = attr(el, DATA_TIMELY)) {
  7726. field.timely = +timely;
  7727. } else if (field.timely > 3) {
  7728. attr(el, DATA_TIMELY, field.timely);
  7729. }
  7730. me._parseRule(field);
  7731. field.old = {};
  7732. }
  7733. if ( isString(field.target) ) {
  7734. attr(el, DATA_TARGET, field.target);
  7735. }
  7736. if ( isString(field.tip) ) {
  7737. attr(el, DATA_TIP, field.tip);
  7738. }
  7739. return me.fields[key] = field;
  7740. },
  7741. // Parsing field rules
  7742. _parseRule: function(field) {
  7743. var arr = rDisplay.exec(field.rule);
  7744. if (!arr) return;
  7745. // current rule index
  7746. field._i = 0;
  7747. if (arr[1]) {
  7748. field.display = arr[1];
  7749. }
  7750. if (arr[2]) {
  7751. field._rules = [];
  7752. arr[2].replace(rRules, function(){
  7753. var args = arguments;
  7754. args[4] = args[4] || args[5];
  7755. field._rules.push({
  7756. and: args[1] === "&",
  7757. not: args[2] === "!",
  7758. or: args[6] === "|",
  7759. method: args[3],
  7760. params: args[4] ? $.map( args[4].split(', '), trim ) : undefined
  7761. });
  7762. });
  7763. }
  7764. },
  7765. // Verify a zone
  7766. _multiValidate: function($inputs, doneCallback){
  7767. var me = this,
  7768. opt = me.options;
  7769. me.hasError = false;
  7770. if (opt.ignore) {
  7771. $inputs = $inputs.not(opt.ignore);
  7772. }
  7773. $inputs.each(function() {
  7774. me._validate(this);
  7775. if (me.hasError && opt.stopOnError) {
  7776. // stop the validation
  7777. return false;
  7778. }
  7779. });
  7780. // Need to wait for all fields validation complete, especially asynchronous validation
  7781. if (doneCallback) {
  7782. me.validating = true;
  7783. $.when.apply(
  7784. null,
  7785. $.map(me.deferred, function(v){return v;})
  7786. ).done(function(){
  7787. doneCallback.call(me, !me.hasError);
  7788. me.validating = false;
  7789. });
  7790. }
  7791. // If the form does not contain asynchronous validation, the return value is correct.
  7792. // Otherwise, you should detect form validation result through "doneCallback".
  7793. return !$.isEmptyObject(me.deferred) ? undefined : !me.hasError;
  7794. },
  7795. // Validate the whole form
  7796. _submit: function(e) {
  7797. var me = this,
  7798. opt = me.options,
  7799. form = e.target,
  7800. canSubmit = e.type === 'submit' && !e.isDefaultPrevented();
  7801. e.preventDefault();
  7802. if (
  7803. novalidateonce && ~(novalidateonce = false) ||
  7804. // Prevent duplicate submission
  7805. me.submiting ||
  7806. // Receive the "validate" event only from the form.
  7807. e.type === 'validate' && me.$el[0] !== form ||
  7808. // trigger the beforeSubmit callback.
  7809. isFunction(opt.beforeSubmit) && opt.beforeSubmit.call(me, form) === false
  7810. ) {
  7811. return;
  7812. }
  7813. if (me.isAjaxSubmit === undefined) {
  7814. me._guessAjax(form);
  7815. }
  7816. me._debug('log', '\n<<< event: ' + e.type);
  7817. me._reset();
  7818. me.submiting = true;
  7819. me._multiValidate(
  7820. me.$el.find(INPUT_SELECTOR),
  7821. function(isValid){
  7822. var ret = (isValid || opt.debug === 2) ? 'valid' : 'invalid',
  7823. errors;
  7824. if (!isValid) {
  7825. if (opt.focusInvalid) {
  7826. // navigate to the error element
  7827. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  7828. }
  7829. errors = $.map(me.errors, function(err){return err;});
  7830. }
  7831. // releasing submit
  7832. me.submiting = false;
  7833. me.isValid = isValid;
  7834. // trigger callback and event
  7835. isFunction(opt[ret]) && opt[ret].call(me, form, errors);
  7836. me.$el.trigger(ret + CLS_NS_FORM, [form, errors]);
  7837. me._debug('log', '>>> ' + ret);
  7838. if (!isValid) return;
  7839. // For jquery.form plugin
  7840. if (me.vetoed) {
  7841. $(form).ajaxSubmit(me.ajaxFormOptions);
  7842. }
  7843. else if (canSubmit && !me.isAjaxSubmit) {
  7844. document.createElement('form').submit.call(form);
  7845. }
  7846. }
  7847. );
  7848. },
  7849. _reset: function(e) {
  7850. var me = this;
  7851. me.errors = {};
  7852. if (e) {
  7853. me.reseting = true;
  7854. me.$el.find(INPUT_SELECTOR).each( function(){
  7855. me._resetElement(this);
  7856. });
  7857. delete me.reseting;
  7858. }
  7859. },
  7860. _resetElement: function(el, all) {
  7861. this._setClass(el, null);
  7862. this.hideMsg(el);
  7863. },
  7864. // Handle events: "focusin/click"
  7865. _focusin: function(e) {
  7866. var me = this,
  7867. opt = me.options,
  7868. el = e.target,
  7869. timely,
  7870. msg;
  7871. if ( me.validating || ( e.type==='click' && document.activeElement === el ) ) {
  7872. return;
  7873. }
  7874. if (opt.focusCleanup) {
  7875. if ( attr(el, ARIA_INVALID) === 'true' ) {
  7876. me._setClass(el, null);
  7877. me.hideMsg(el);
  7878. }
  7879. }
  7880. msg = attr(el, DATA_TIP);
  7881. if (msg) {
  7882. me.showMsg(el, {
  7883. type: 'tip',
  7884. msg: msg
  7885. });
  7886. } else {
  7887. if (attr(el, DATA_RULE)) {
  7888. me._parse(el);
  7889. }
  7890. if (timely = attr(el, DATA_TIMELY)) {
  7891. if ( timely === 8 || timely === 9 ) {
  7892. me._focusout(e);
  7893. }
  7894. }
  7895. }
  7896. },
  7897. // Handle events: "focusout/validate/keyup/click/change/input/compositionstart/compositionend"
  7898. _focusout: function(e) {
  7899. var me = this,
  7900. opt = me.options,
  7901. el = e.target,
  7902. etype = e.type,
  7903. etype0,
  7904. focusin = etype === 'focusin',
  7905. special = etype === 'validate',
  7906. elem,
  7907. field,
  7908. old,
  7909. value,
  7910. timestamp,
  7911. key, specialKey,
  7912. timely,
  7913. timer = 0;
  7914. if (etype === 'compositionstart') {
  7915. me.pauseValidate = true;
  7916. }
  7917. if (etype === 'compositionend') {
  7918. me.pauseValidate = false;
  7919. }
  7920. if (me.pauseValidate) {
  7921. return;
  7922. }
  7923. // For checkbox and radio
  7924. elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
  7925. // Get field
  7926. if (!(field = me.getField(elem)) || !field.rule) {
  7927. return;
  7928. }
  7929. // Cache event type
  7930. etype0 = field._e;
  7931. field._e = etype;
  7932. timely = field.timely;
  7933. if (!special) {
  7934. if (!timely || (_checkable(el) && etype !== 'click')) {
  7935. return;
  7936. }
  7937. value = field.getValue();
  7938. // not validate field unless fill a value
  7939. if ( field.ignoreBlank && !value && !focusin ) {
  7940. me.hideMsg(el);
  7941. return;
  7942. }
  7943. if ( etype === 'focusout' ) {
  7944. if (etype0 === 'change') {
  7945. return;
  7946. }
  7947. if ( timely === 2 || timely === 8 ) {
  7948. old = field.old;
  7949. if (value && old) {
  7950. if (field.isValid && !old.showOk) {
  7951. me.hideMsg(el);
  7952. } else {
  7953. me._makeMsg(el, field, old);
  7954. }
  7955. } else {
  7956. return;
  7957. }
  7958. }
  7959. }
  7960. else {
  7961. if ( timely < 2 && !e.data ) {
  7962. return;
  7963. }
  7964. // mark timestamp to reduce the frequency of the received event
  7965. timestamp = +new Date();
  7966. if ( timestamp - (el._ts || 0) < 100 ) {
  7967. return;
  7968. }
  7969. el._ts = timestamp;
  7970. // handle keyup
  7971. if ( etype === 'keyup' ) {
  7972. if (etype0 === 'input') {
  7973. return;
  7974. }
  7975. key = e.keyCode;
  7976. specialKey = {
  7977. 8: 1, // Backspace
  7978. 9: 1, // Tab
  7979. 16: 1, // Shift
  7980. 32: 1, // Space
  7981. 46: 1 // Delete
  7982. };
  7983. // only gets focus, no validation
  7984. if ( key === 9 && !value ) {
  7985. return;
  7986. }
  7987. // do not validate, if triggered by these keys
  7988. if ( key < 48 && !specialKey[key] ) {
  7989. return;
  7990. }
  7991. }
  7992. if ( !focusin ) {
  7993. // keyboard events, reducing the frequency of validation
  7994. timer = timely <100 ? (etype === 'click' || el.tagName === 'SELECT') ? 0 : 400 : timely;
  7995. }
  7996. }
  7997. }
  7998. // if the current field is ignored
  7999. if ( opt.ignore && $(el).is(opt.ignore) ) {
  8000. return;
  8001. }
  8002. clearTimeout(field._t);
  8003. if (timer) {
  8004. field._t = setTimeout(function() {
  8005. me._validate(el, field);
  8006. }, timer);
  8007. } else {
  8008. if (special) field.old = {};
  8009. me._validate(el, field);
  8010. }
  8011. },
  8012. _setClass: function(el, isValid) {
  8013. var $el = $(el), opt = this.options;
  8014. if (opt.bindClassTo) {
  8015. $el = $el.closest(opt.bindClassTo);
  8016. }
  8017. $el.removeClass( opt.invalidClass + ' ' + opt.validClass );
  8018. if (isValid !== null) {
  8019. $el.addClass( isValid ? opt.validClass : opt.invalidClass );
  8020. }
  8021. },
  8022. _showmsg: function(e, type, msg) {
  8023. var me = this,
  8024. el = e.target;
  8025. if ( me.$el.is(el) ) {
  8026. if (isObject(type)) {
  8027. me.showMsg(type)
  8028. }
  8029. else if ( type === 'tip' ) {
  8030. me.$el.find(INPUT_SELECTOR +"["+ DATA_TIP +"]", el).each(function(){
  8031. me.showMsg(this, {type: type, msg: msg});
  8032. });
  8033. }
  8034. }
  8035. else {
  8036. me.showMsg(el, {type: type, msg: msg});
  8037. }
  8038. },
  8039. _hidemsg: function(e) {
  8040. var $el = $(e.target);
  8041. if ( $el.is(INPUT_SELECTOR) ) {
  8042. this.hideMsg($el);
  8043. }
  8044. },
  8045. // Validated a field
  8046. _validatedField: function(el, field, ret) {
  8047. var me = this,
  8048. opt = me.options,
  8049. isValid = field.isValid = ret.isValid = !!ret.isValid,
  8050. callback = isValid ? 'valid' : 'invalid';
  8051. ret.key = field.key;
  8052. ret.ruleName = field._r;
  8053. ret.id = el.id;
  8054. ret.value = field.value;
  8055. me.elements[field.key] = ret.element = el;
  8056. me.isValid = me.$el[0].isValid = isValid ? me.isFormValid() : isValid;
  8057. if (isValid) {
  8058. ret.type = 'ok';
  8059. } else {
  8060. if (me.submiting) {
  8061. me.errors[field.key] = ret.msg;
  8062. }
  8063. me.hasError = true;
  8064. }
  8065. // cache result
  8066. field.old = ret;
  8067. // trigger callback
  8068. isFunction(field[callback]) && field[callback].call(me, el, ret);
  8069. isFunction(opt.validation) && opt.validation.call(me, el, ret);
  8070. // trigger event
  8071. $(el).attr( ARIA_INVALID, isValid ? null : true )
  8072. .trigger( callback + CLS_NS_FIELD, [ret, me] );
  8073. me.$el.triggerHandler('validation', [ret, me]);
  8074. if (me.checkOnly) return;
  8075. // set className
  8076. me._setClass(el, ret.skip || ret.type === 'tip' ? null : isValid);
  8077. me._makeMsg.apply(me, arguments);
  8078. },
  8079. _makeMsg: function(el, field, ret) {
  8080. // show or hide the message
  8081. if (field.msgMaker) {
  8082. ret = $.extend({}, ret);
  8083. if (field._e === 'focusin') {
  8084. ret.type = 'tip';
  8085. }
  8086. this[ ret.showOk || ret.msg || ret.type === 'tip' ? 'showMsg' : 'hideMsg' ](el, ret, field);
  8087. }
  8088. },
  8089. // Validated a rule
  8090. _validatedRule: function(el, field, ret, msgOpt) {
  8091. field = field || me.getField(el);
  8092. msgOpt = msgOpt || {};
  8093. var me = this,
  8094. msg,
  8095. rule,
  8096. method = field._r,
  8097. timely = field.timely,
  8098. special = timely === 9 || timely === 8,
  8099. transfer,
  8100. temp,
  8101. isValid = false;
  8102. // use null to break validation from a field
  8103. if (ret === null) {
  8104. me._validatedField(el, field, {isValid: true, skip: true});
  8105. field._i = 0;
  8106. return;
  8107. }
  8108. else if (ret === undefined) {
  8109. transfer = true;
  8110. }
  8111. else if (ret === true || ret === '') {
  8112. isValid = true;
  8113. }
  8114. else if (isString(ret)) {
  8115. msg = ret;
  8116. }
  8117. else if (isObject(ret)) {
  8118. if (ret.error) {
  8119. msg = ret.error;
  8120. } else {
  8121. msg = ret.ok;
  8122. isValid = true;
  8123. }
  8124. }
  8125. rule = field._rules[field._i];
  8126. if (rule.not) {
  8127. msg = undefined;
  8128. isValid = method === "required" || !isValid;
  8129. }
  8130. if (rule.or) {
  8131. if (isValid) {
  8132. while ( field._i < field._rules.length && field._rules[field._i].or ) {
  8133. field._i++;
  8134. }
  8135. } else {
  8136. transfer = true;
  8137. }
  8138. }
  8139. else if (rule.and) {
  8140. if (!field.isValid) transfer = true;
  8141. }
  8142. if (transfer) {
  8143. isValid = true;
  8144. }
  8145. // message analysis, and throw rule level event
  8146. else {
  8147. if (isValid) {
  8148. if (field.showOk !== false) {
  8149. temp = attr(el, DATA_OK);
  8150. msg = temp === null ? isString(field.ok) ? field.ok : msg : temp;
  8151. if (!isString(msg) && isString(field.showOk)) {
  8152. msg = field.showOk;
  8153. }
  8154. if (isString(msg)) {
  8155. msgOpt.showOk = isValid;
  8156. }
  8157. }
  8158. }
  8159. if (!isValid || special) {
  8160. /* rule message priority:
  8161. 1. custom DOM message
  8162. 2. custom field message;
  8163. 3. global defined message;
  8164. 4. rule returned message;
  8165. 5. default message;
  8166. */
  8167. msg = (_getDataMsg(el, field, msg || rule.msg || me.messages[method]) || me.messages.fallback).replace(/\{0\|?([^\}]*)\}/, function(m, defaultDisplay){
  8168. return me._getDisplay(el, field.display) || defaultDisplay || me.messages[0];
  8169. });
  8170. }
  8171. if (!isValid) field.isValid = isValid;
  8172. msgOpt.msg = msg;
  8173. $(el).trigger( (isValid ? 'valid' : 'invalid') + CLS_NS_RULE, [method, msg]);
  8174. }
  8175. if (special && (!transfer || rule.and)) {
  8176. if (!isValid && !field._m) field._m = msg;
  8177. field._v = field._v || [];
  8178. field._v.push({
  8179. type: isValid ? !transfer ? 'ok' : 'tip' : 'error',
  8180. msg: msg || rule.msg
  8181. });
  8182. }
  8183. me._debug('log', ' ' + field._i + ': ' + method + ' => ' + (isValid || msg));
  8184. // the current rule has passed, continue to validate
  8185. if ( (isValid || special) && field._i < field._rules.length - 1) {
  8186. field._i++;
  8187. me._checkRule(el, field);
  8188. }
  8189. // field was invalid, or all fields was valid
  8190. else {
  8191. field._i = 0;
  8192. if (special) {
  8193. msgOpt.isValid = field.isValid;
  8194. msgOpt.result = field._v;
  8195. msgOpt.msg = field._m || '';
  8196. if (!field.value && (field._e === 'focusin')) {
  8197. msgOpt.type = 'tip';
  8198. }
  8199. } else {
  8200. msgOpt.isValid = isValid;
  8201. }
  8202. me._validatedField(el, field, msgOpt);
  8203. delete field._m;
  8204. delete field._v;
  8205. }
  8206. },
  8207. // Verify a rule form a field
  8208. _checkRule: function(el, field) {
  8209. var me = this,
  8210. ret,
  8211. fn,
  8212. old,
  8213. key = field.key,
  8214. rule = field._rules[field._i],
  8215. method = rule.method,
  8216. params = rule.params;
  8217. // request has been sent, wait it
  8218. if (me.submiting && me.deferred[key]) {
  8219. return;
  8220. }
  8221. old = field.old;
  8222. field._r = method;
  8223. if (old && !field.must && !rule.must && rule.result !== undefined &&
  8224. old.ruleName === method && old.id === el.id &&
  8225. field.value && old.value === field.value )
  8226. {
  8227. // get result from cache
  8228. ret = rule.result;
  8229. }
  8230. else {
  8231. // get result from current rule
  8232. fn = _getDataRule(el, method) || me.rules[method] || noop;
  8233. ret = fn.call(field, el, params, field);
  8234. if (fn.msg) rule.msg = fn.msg;
  8235. }
  8236. // asynchronous validation
  8237. if (isObject(ret) && isFunction(ret.then)) {
  8238. me.deferred[key] = ret;
  8239. // whether the field valid is unknown
  8240. field.isValid = undefined;
  8241. // show loading message
  8242. !me.checkOnly && me.showMsg(el, {
  8243. type: 'loading',
  8244. msg: me.messages.loading
  8245. }, field);
  8246. // waiting to parse the response data
  8247. ret.then(
  8248. function(d, textStatus, jqXHR) {
  8249. var data = trim(jqXHR.responseText),
  8250. result,
  8251. dataFilter = field.dataFilter;
  8252. // detect if data is json or jsonp format
  8253. if (/jsonp?/.test(this.dataType)) {
  8254. data = d;
  8255. } else if (data.charAt(0) === '{') {
  8256. data = $.parseJSON(data);
  8257. }
  8258. // filter data
  8259. result = dataFilter.call(this, data, field);
  8260. if (result === undefined) result = dataFilter.call(this, data.data, field);
  8261. rule.data = this.data;
  8262. rule.result = field.old ? result : undefined;
  8263. me._validatedRule(el, field, result);
  8264. },
  8265. function(jqXHR, textStatus){
  8266. me._validatedRule(el, field, me.messages[textStatus] || textStatus);
  8267. }
  8268. ).always(function(){
  8269. delete me.deferred[key];
  8270. });
  8271. }
  8272. // other result
  8273. else {
  8274. me._validatedRule(el, field, ret);
  8275. }
  8276. },
  8277. // Processing the validation
  8278. _validate: function(el, field) {
  8279. var me = this;
  8280. // doesn't validate the element that has "disabled" or "novalidate" attribute
  8281. if ( el.disabled || attr(el, NOVALIDATE) !== null ) {
  8282. return;
  8283. }
  8284. field = field || me.getField(el);
  8285. if (!field) return;
  8286. if (!field._rules) me._parse(el);
  8287. if (!field._rules) return;
  8288. me._debug('info', field.key);
  8289. field.isValid = true;
  8290. field.element = el;
  8291. // Cache the value
  8292. field.value = field.getValue();
  8293. // if the field is not required, and that has a blank value
  8294. if (!field.required && !field.must && !field.value) {
  8295. if (!_checkable(el)) {
  8296. me._validatedField(el, field, {isValid: true});
  8297. return true;
  8298. }
  8299. }
  8300. me._checkRule(el, field);
  8301. return field.isValid;
  8302. },
  8303. _debug: function(type, messages) {
  8304. if (window.console && this.options.debug) {
  8305. console[type](messages);
  8306. }
  8307. },
  8308. /**
  8309. * Detecting whether the value of an element that matches a rule
  8310. *
  8311. * @method test
  8312. * @param {Element} el - input element
  8313. * @param {String} rule - rule name
  8314. */
  8315. test: function(el, rule) {
  8316. var me = this,
  8317. ret,
  8318. parts = rRule.exec(rule),
  8319. field,
  8320. method,
  8321. params;
  8322. if (parts) {
  8323. method = parts[1];
  8324. if (method in me.rules) {
  8325. params = parts[2] || parts[3];
  8326. params = params ? params.split(', ') : undefined;
  8327. field = me.getField(el, true);
  8328. field._r = method;
  8329. field.value = field.getValue();
  8330. ret = me.rules[method].call(field, el, params);
  8331. }
  8332. }
  8333. return ret === true || ret === undefined || ret === null;
  8334. },
  8335. _getDisplay: function(el, str) {
  8336. return !isString(str) ? isFunction(str) ? str.call(this, el) : '' : str;
  8337. },
  8338. _getMsgOpt: function(obj, field) {
  8339. var opt = field ? field : this.options;
  8340. return $.extend({
  8341. type: 'error',
  8342. pos: _getPos(opt.msgClass),
  8343. target: opt.target,
  8344. wrapper: opt.msgWrapper,
  8345. style: opt.msgStyle,
  8346. cls: opt.msgClass,
  8347. arrow: opt.msgArrow,
  8348. icon: opt.msgIcon
  8349. }, isString(obj) ? {msg: obj} : obj);
  8350. },
  8351. _getMsgDOM: function(el, msgOpt) {
  8352. var $el = $(el), $msgbox, datafor, tgt, container;
  8353. if ( $el.is(INPUT_SELECTOR) ) {
  8354. tgt = msgOpt.target || attr(el, DATA_TARGET);
  8355. if (tgt) {
  8356. tgt = !isFunction(tgt) ? tgt.charAt(0) === '#' ? $(tgt) : this.$el.find(tgt) : tgt.call(this, el);
  8357. if (tgt.length) {
  8358. if ( tgt.is(INPUT_SELECTOR) ) {
  8359. $el = tgt
  8360. el = tgt.get(0);
  8361. } else if ( tgt.hasClass(CLS_MSG_BOX) ) {
  8362. $msgbox = tgt;
  8363. } else {
  8364. container = tgt;
  8365. }
  8366. }
  8367. }
  8368. if (!$msgbox) {
  8369. datafor = (!_checkable(el) || !el.name) && el.id ? el.id : el.name;
  8370. $msgbox = (container || this.$el).find(msgOpt.wrapper + '.' + CLS_MSG_BOX + '[for="' + datafor + '"]');
  8371. }
  8372. } else {
  8373. $msgbox = $el;
  8374. }
  8375. // Create new message box
  8376. if (!msgOpt.hide && !$msgbox.length) {
  8377. $msgbox = $('<'+ msgOpt.wrapper + '>').attr({
  8378. 'class': CLS_MSG_BOX + (msgOpt.cls ? ' ' + msgOpt.cls : ''),
  8379. 'style': msgOpt.style || undefined,
  8380. 'for': datafor
  8381. });
  8382. if ( _checkable(el) ) {
  8383. var $parent = $el.parent();
  8384. $msgbox.appendTo( $parent.is('label') ? $parent.parent() : $parent );
  8385. } else {
  8386. if (container) {
  8387. $msgbox.appendTo(container);
  8388. } else {
  8389. $msgbox[!msgOpt.pos || msgOpt.pos === 'right' ? 'insertAfter' : 'insertBefore']($el);
  8390. }
  8391. }
  8392. }
  8393. return $msgbox;
  8394. },
  8395. /**
  8396. * Show validation message
  8397. *
  8398. * @method showMsg
  8399. * @param {Element} el - input element
  8400. * @param {Object} msgOpt
  8401. */
  8402. showMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  8403. if (!el) return;
  8404. var me = this,
  8405. opt = me.options,
  8406. msgShow,
  8407. msgMaker,
  8408. temp,
  8409. $msgbox;
  8410. if (isObject(el) && !el.jquery && !msgOpt) {
  8411. $.each(el, function(key, msg) {
  8412. var el = me.elements[key] || me.$el.find(_key2selector(key))[0];
  8413. me.showMsg(el, msg);
  8414. });
  8415. return;
  8416. }
  8417. if ($(el).is(INPUT_SELECTOR)) {
  8418. field = field || me.getField(el);
  8419. }
  8420. if (!(msgMaker = (field || opt).msgMaker)) {
  8421. return;
  8422. }
  8423. msgOpt = me._getMsgOpt(msgOpt, field);
  8424. el = (el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]') : $(el)).get(0);
  8425. // ok or tip
  8426. if (!msgOpt.msg && msgOpt.type !== 'error') {
  8427. temp = attr(el, 'data-' + msgOpt.type);
  8428. if (temp !== null) msgOpt.msg = temp;
  8429. }
  8430. if ( !isString(msgOpt.msg) ) {
  8431. return;
  8432. }
  8433. $msgbox = me._getMsgDOM(el, msgOpt);
  8434. !rPos.test($msgbox[0].className) && $msgbox.addClass(msgOpt.cls);
  8435. if ( isIE === 6 && msgOpt.pos === 'bottom' ) {
  8436. $msgbox[0].style.marginTop = $(el).outerHeight() + 'px';
  8437. }
  8438. $msgbox.html( msgMaker.call(me, msgOpt) )[0].style.display = '';
  8439. if (isFunction(msgShow = field && field.msgShow || opt.msgShow)) {
  8440. msgShow.call(me, $msgbox, msgOpt.type);
  8441. }
  8442. },
  8443. /**
  8444. * Hide validation message
  8445. *
  8446. * @method hideMsg
  8447. * @param {Element} el - input element
  8448. * @param {Object} msgOpt optional
  8449. */
  8450. hideMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  8451. var me = this,
  8452. opt = me.options,
  8453. msgHide,
  8454. $msgbox;
  8455. el = $(el).get(0);
  8456. if ($(el).is(INPUT_SELECTOR)) {
  8457. field = field || me.getField(el);
  8458. if (field) {
  8459. if (field.isValid || me.reseting) attr(el, ARIA_INVALID, null);
  8460. }
  8461. }
  8462. msgOpt = me._getMsgOpt(msgOpt, field);
  8463. msgOpt.hide = true;
  8464. $msgbox = me._getMsgDOM(el, msgOpt);
  8465. if (!$msgbox.length) return;
  8466. if ( isFunction(msgHide = field && field.msgHide || opt.msgHide) ) {
  8467. msgHide.call(me, $msgbox, msgOpt.type);
  8468. } else {
  8469. $msgbox[0].style.display = 'none';
  8470. $msgbox[0].innerHTML = null;
  8471. }
  8472. },
  8473. /**
  8474. * Get field information
  8475. *
  8476. * @method getField
  8477. * @param {Element} - input element
  8478. * @return {Object} field
  8479. */
  8480. getField: function(el, must) {
  8481. var me = this,
  8482. key,
  8483. field;
  8484. if (isString(el)) {
  8485. key = el;
  8486. el = undefined;
  8487. } else {
  8488. if (attr(el, DATA_RULE)) {
  8489. return me._parse(el);
  8490. }
  8491. if (el.id && '#' + el.id in me.fields || !el.name) {
  8492. key = '#' + el.id;
  8493. } else {
  8494. key = el.name;
  8495. }
  8496. }
  8497. if ( (field = me.fields[key]) || must && (field = new me.Field(key)) ) {
  8498. field.element = el;
  8499. }
  8500. return field;
  8501. },
  8502. /**
  8503. * Config a field
  8504. *
  8505. * @method: setField
  8506. * @param {String} key
  8507. * @param {Object} obj
  8508. */
  8509. setField: function(key, obj) {
  8510. var fields = {};
  8511. if (!key) return;
  8512. // update this field
  8513. if (isString(key)) {
  8514. fields[key] = obj;
  8515. }
  8516. // update fields
  8517. else {
  8518. fields = key;
  8519. }
  8520. this._initFields(fields);
  8521. },
  8522. /**
  8523. * Detecting whether the form is valid
  8524. *
  8525. * @method isFormValid
  8526. * @return {Boolean}
  8527. */
  8528. isFormValid: function() {
  8529. var fields = this.fields, k, field;
  8530. for (k in fields) {
  8531. field = fields[k];
  8532. if (!field._rules || !field.required && !field.must && !field.value) continue;
  8533. if (!field.isValid) return false;
  8534. }
  8535. return true;
  8536. },
  8537. /**
  8538. * Prevent submission form
  8539. *
  8540. * @method holdSubmit
  8541. * @param {Boolean} hold - If set to false, will release the hold
  8542. */
  8543. holdSubmit: function(hold) {
  8544. this.submiting = hold === undefined || hold;
  8545. },
  8546. /**
  8547. * Clean validation messages
  8548. *
  8549. * @method cleanUp
  8550. */
  8551. cleanUp: function() {
  8552. this._reset(1);
  8553. },
  8554. /**
  8555. * Destroy the validation
  8556. *
  8557. * @method destroy
  8558. */
  8559. destroy: function() {
  8560. this._reset(1);
  8561. this.$el.off(CLS_NS).removeData(NS);
  8562. attr(this.$el[0], NOVALIDATE, this._NOVALIDATE);
  8563. }
  8564. };
  8565. /**
  8566. * Create Field Factory
  8567. *
  8568. * @class
  8569. * @param {Object} context
  8570. * @return {Function} Factory
  8571. */
  8572. function _createFieldFactory(context) {
  8573. function FieldFactory() {
  8574. var options = this.options;
  8575. for (var i in options) {
  8576. if (i in fieldDefaults) this[i] = options[i];
  8577. }
  8578. $.extend(this, {
  8579. _valHook: function() {
  8580. return this.element.contentEditable === 'true' ? 'text' : 'val';
  8581. },
  8582. getValue: function() {
  8583. var elem = this.element;
  8584. if (elem.type === "number" && elem.validity && elem.validity.badInput) {
  8585. return 'NaN';
  8586. }
  8587. return $(elem)[this._valHook()]();
  8588. },
  8589. setValue: function(value) {
  8590. $(this.element)[this._valHook()](this.value = value);
  8591. },
  8592. // Get a range of validation messages
  8593. getRangeMsg: function(value, params, suffix) {
  8594. if (!params) return;
  8595. var me = this,
  8596. msg = me.messages[me._r] || '',
  8597. result,
  8598. p = params[0].split('~'),
  8599. e = params[1] === 'false',
  8600. a = p[0],
  8601. b = p[1],
  8602. c = 'rg',
  8603. args = [''],
  8604. isNumber = trim(value) && +value === +value;
  8605. function compare(large, small) {
  8606. return !e ? large >= small : large > small;
  8607. }
  8608. if (p.length === 2) {
  8609. if (a && b) {
  8610. if (isNumber && compare(value, +a) && compare(+b, value)) {
  8611. result = true;
  8612. }
  8613. args = args.concat(p);
  8614. c = e ? 'gtlt' : 'rg';
  8615. }
  8616. else if (a && !b) {
  8617. if (isNumber && compare(value, +a)) {
  8618. result = true;
  8619. }
  8620. args.push(a);
  8621. c = e ? 'gt' : 'gte';
  8622. }
  8623. else if (!a && b) {
  8624. if (isNumber && compare(+b, value)) {
  8625. result = true;
  8626. }
  8627. args.push(b);
  8628. c = e ? 'lt' : 'lte';
  8629. }
  8630. }
  8631. else {
  8632. if (value === +a) {
  8633. result = true;
  8634. }
  8635. args.push(a);
  8636. c = 'eq';
  8637. }
  8638. if (msg) {
  8639. if (suffix && msg[c + suffix]) {
  8640. c += suffix;
  8641. }
  8642. args[0] = msg[c];
  8643. }
  8644. return result || me._rules && ( me._rules[me._i].msg = me.renderMsg.apply(null, args) );
  8645. },
  8646. // Render message template
  8647. renderMsg: function() {
  8648. var args = arguments,
  8649. tpl = args[0],
  8650. i = args.length;
  8651. if (!tpl) return;
  8652. while (--i) {
  8653. tpl = tpl.replace('{' + i + '}', args[i]);
  8654. }
  8655. return tpl;
  8656. }
  8657. });
  8658. }
  8659. function Field(key, obj, oldField) {
  8660. this.key = key;
  8661. this.validator = context;
  8662. $.extend(this, oldField, obj);
  8663. }
  8664. FieldFactory.prototype = context;
  8665. Field.prototype = new FieldFactory();
  8666. return Field;
  8667. }
  8668. /**
  8669. * Create Rules
  8670. *
  8671. * @class
  8672. * @param {Object} obj rules
  8673. * @param {Object} context context
  8674. */
  8675. function Rules(obj, context) {
  8676. if (!isObject(obj)) return;
  8677. var k, that = context ? context === true ? this : context : Rules.prototype;
  8678. for (k in obj) {
  8679. if (_checkRuleName(k))
  8680. that[k] = _getRule(obj[k]);
  8681. }
  8682. }
  8683. /**
  8684. * Create Messages
  8685. *
  8686. * @class
  8687. * @param {Object} obj rules
  8688. * @param {Object} context context
  8689. */
  8690. function Messages(obj, context) {
  8691. if (!isObject(obj)) return;
  8692. var k, that = context ? context === true ? this : context : Messages.prototype;
  8693. for (k in obj) {
  8694. that[k] = obj[k];
  8695. }
  8696. }
  8697. // Rule converted factory
  8698. function _getRule(fn) {
  8699. switch ($.type(fn)) {
  8700. case 'function':
  8701. return fn;
  8702. case 'array':
  8703. var f = function() {
  8704. return fn[0].test(this.value) || fn[1] || false;
  8705. };
  8706. f.msg = fn[1];
  8707. return f;
  8708. case 'regexp':
  8709. return function() {
  8710. return fn.test(this.value);
  8711. };
  8712. }
  8713. }
  8714. // Get instance by an element
  8715. function _getInstance(el) {
  8716. var wrap, k, options;
  8717. if (!el || !el.tagName) return;
  8718. switch (el.tagName) {
  8719. case 'INPUT':
  8720. case 'SELECT':
  8721. case 'TEXTAREA':
  8722. case 'BUTTON':
  8723. case 'FIELDSET':
  8724. wrap = el.form || $(el).closest('.' + CLS_WRAPPER);
  8725. break;
  8726. case 'FORM':
  8727. wrap = el;
  8728. break;
  8729. default:
  8730. wrap = $(el).closest('.' + CLS_WRAPPER);
  8731. }
  8732. for (k in preinitialized) {
  8733. if ($(wrap).is(k)) {
  8734. options = preinitialized[k];
  8735. break;
  8736. }
  8737. }
  8738. return $(wrap).data(NS) || $(wrap)[NS](options).data(NS);
  8739. }
  8740. // Get custom rules on the node
  8741. function _getDataRule(el, method) {
  8742. var fn = trim(attr(el, DATA_RULE + '-' + method));
  8743. if ( fn && (fn = new Function("return " + fn)()) ) {
  8744. return _getRule(fn);
  8745. }
  8746. }
  8747. // Get custom messages on the node
  8748. function _getDataMsg(el, field, m) {
  8749. var msg = field.msg,
  8750. item = field._r;
  8751. if ( isObject(msg) ) msg = msg[item];
  8752. if ( !isString(msg) ) {
  8753. msg = attr(el, DATA_MSG + '-' + item) || attr(el, DATA_MSG) || ( m ? isString(m) ? m : m[item] : '');
  8754. }
  8755. return msg;
  8756. }
  8757. // Get message position
  8758. function _getPos(str) {
  8759. var pos;
  8760. if (str) pos = rPos.exec(str);
  8761. return pos && pos[0];
  8762. }
  8763. // Check whether the element is checkbox or radio
  8764. function _checkable(el) {
  8765. return el.tagName === 'INPUT' && el.type === 'checkbox' || el.type === 'radio';
  8766. }
  8767. // Parse date string to timestamp
  8768. function _parseDate(str) {
  8769. return Date.parse(str.replace(/\.|\-/g, '/'));
  8770. }
  8771. // Rule name only allows alphanumeric characters and underscores
  8772. function _checkRuleName(name) {
  8773. return /^\w+$/.test(name);
  8774. }
  8775. // Translate field key to jQuery selector.
  8776. function _key2selector(key) {
  8777. var isID = key.charAt(0) === "#";
  8778. key = key.replace(/([:.{(|)}/\[\]])/g, "\\$1");
  8779. return isID ? key : '[name="'+ key +'"]:first';
  8780. }
  8781. // Fixed a issue cause by refresh page in IE.
  8782. $(window).on('beforeunload', function(){
  8783. this.focus();
  8784. });
  8785. $(document)
  8786. .on('click', ':submit', function(){
  8787. var input = this, attrNode;
  8788. if (!input.form) return;
  8789. // Shim for "formnovalidate"
  8790. attrNode = input.getAttributeNode('formnovalidate');
  8791. if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
  8792. novalidateonce = true;
  8793. }
  8794. })
  8795. // Automatic initializing form validation
  8796. .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
  8797. if ( attr(this, NOVALIDATE) !== null ) return;
  8798. var $form = $(this), me;
  8799. if ( !$form.data(NS) && (me = _getInstance(this)) ) {
  8800. if ( !$.isEmptyObject(me.fields) ) {
  8801. // Execute event handler
  8802. if (e.type === 'focusin') {
  8803. me._focusin(e);
  8804. } else {
  8805. me._submit(e);
  8806. }
  8807. } else {
  8808. attr(this, NOVALIDATE, NOVALIDATE);
  8809. $form.off(CLS_NS).removeData(NS);
  8810. }
  8811. }
  8812. });
  8813. new Messages({
  8814. fallback: "This field is not valid.",
  8815. loading: 'Validating...'
  8816. });
  8817. // Built-in rules (global)
  8818. new Rules({
  8819. /**
  8820. * required
  8821. *
  8822. * @example:
  8823. required
  8824. required(anotherRule)
  8825. required(not, -1)
  8826. required(from, .contact)
  8827. */
  8828. required: function(element, params) {
  8829. var me = this,
  8830. val = trim(me.value),
  8831. isValid = true;
  8832. if (params) {
  8833. if ( params.length === 1 ) {
  8834. if ( !_checkRuleName(params[0]) ) {
  8835. if (!val && !$(params[0], me.$el).length ) {
  8836. return null;
  8837. }
  8838. }
  8839. else if ( me.rules[params[0]] ) {
  8840. if ( !val && !me.test(element, params[0]) ) {
  8841. return null;
  8842. }
  8843. }
  8844. }
  8845. else if ( params[0] === 'not' ) {
  8846. $.each(params.slice(1), function() {
  8847. return (isValid = val !== trim(this));
  8848. });
  8849. }
  8850. else if ( params[0] === 'from' ) {
  8851. var $elements = me.$el.find(params[1]),
  8852. VALIDATED = '_validated_',
  8853. ret;
  8854. isValid = $elements.filter(function(){
  8855. var field = me.getField(this);
  8856. return field && !!trim(field.getValue());
  8857. }).length >= (params[2] || 1);
  8858. if (isValid) {
  8859. if (!val) ret = null;
  8860. } else {
  8861. ret = _getDataMsg($elements[0], me) || false;
  8862. }
  8863. if ( !$(element).data(VALIDATED) ) {
  8864. $elements.data(VALIDATED, 1).each(function(){
  8865. if (element !== this) {
  8866. me._validate(this);
  8867. }
  8868. }).removeData(VALIDATED);
  8869. }
  8870. return ret;
  8871. }
  8872. }
  8873. return isValid && !!val;
  8874. },
  8875. /**
  8876. * integer
  8877. *
  8878. * @example:
  8879. integer
  8880. integer[+]
  8881. integer[+0]
  8882. integer[-]
  8883. integer[-0]
  8884. */
  8885. integer: function(element, params) {
  8886. var re, z = '0|',
  8887. p = '[1-9]\\d*',
  8888. key = params ? params[0] : '*';
  8889. switch (key) {
  8890. case '+':
  8891. re = p;
  8892. break;
  8893. case '-':
  8894. re = '-' + p;
  8895. break;
  8896. case '+0':
  8897. re = z + p;
  8898. break;
  8899. case '-0':
  8900. re = z + '-' + p;
  8901. break;
  8902. default:
  8903. re = z + '-?' + p;
  8904. }
  8905. re = '^(?:' + re + ')$';
  8906. return new RegExp(re).test(this.value) || this.messages.integer[key];
  8907. },
  8908. /**
  8909. * match another field
  8910. *
  8911. * @example:
  8912. match[password] Match the password field (two values ​​must be the same)
  8913. match[eq, password] Ditto
  8914. match[neq, count] The value must be not equal to the value of the count field
  8915. match[lt, count] The value must be less than the value of the count field
  8916. match[lte, count] The value must be less than or equal to the value of the count field
  8917. match[gt, count] The value must be greater than the value of the count field
  8918. match[gte, count] The value must be greater than or equal to the value of the count field
  8919. match[gte, startDate, date]
  8920. match[gte, startTime, time]
  8921. **/
  8922. match: function(element, params) {
  8923. if (!params) return;
  8924. var me = this,
  8925. a, b,
  8926. key, msg, type = 'eq', parser,
  8927. selector2, elem2, field2;
  8928. if (params.length === 1) {
  8929. key = params[0];
  8930. } else {
  8931. type = params[0];
  8932. key = params[1];
  8933. }
  8934. selector2 = _key2selector(key);
  8935. elem2 = me.$el.find(selector2)[0];
  8936. // If the compared field is not exist
  8937. if (!elem2) return;
  8938. field2 = me.getField(elem2);
  8939. a = me.value;
  8940. b = field2.getValue();
  8941. if (!me._match) {
  8942. me.$el.on('valid'+CLS_NS_FIELD+CLS_NS, selector2, function(){
  8943. $(element).trigger('validate');
  8944. });
  8945. me._match = field2._match = 1;
  8946. }
  8947. // If both fields are blank
  8948. if (!me.required && a === "" && b === "") {
  8949. return null;
  8950. }
  8951. parser = params[2];
  8952. if (parser) {
  8953. if (/^date(time)?$/i.test(parser)) {
  8954. a = _parseDate(a);
  8955. b = _parseDate(b);
  8956. } else if (parser === 'time') {
  8957. a = +a.replace(/:/g, '');
  8958. b = +b.replace(/:/g, '');
  8959. }
  8960. }
  8961. // If the compared field is incorrect, we only ensure that this field is correct.
  8962. if (type !== "eq" && !isNaN(+a) && isNaN(+b)) {
  8963. return true;
  8964. }
  8965. msg = me.messages.match[type].replace( '{1}', me._getDisplay( element, field2.display || key ) );
  8966. switch (type) {
  8967. case 'lt':
  8968. return (+a < +b) || msg;
  8969. case 'lte':
  8970. return (+a <= +b) || msg;
  8971. case 'gte':
  8972. return (+a >= +b) || msg;
  8973. case 'gt':
  8974. return (+a > +b) || msg;
  8975. case 'neq':
  8976. return (a !== b) || msg;
  8977. default:
  8978. return (a === b) || msg;
  8979. }
  8980. },
  8981. /**
  8982. * range numbers
  8983. *
  8984. * @example:
  8985. range[0~99] Number 0-99
  8986. range[0~] Number greater than or equal to 0
  8987. range[~100] Number less than or equal to 100
  8988. **/
  8989. range: function(element, params) {
  8990. return this.getRangeMsg(this.value, params);
  8991. },
  8992. /**
  8993. * how many checkbox or radio inputs that checked
  8994. *
  8995. * @example:
  8996. checked; no empty, same to required
  8997. checked[1~3] 1-3 items
  8998. checked[1~] greater than 1 item
  8999. checked[~3] less than 3 items
  9000. checked[3] 3 items
  9001. **/
  9002. checked: function(element, params) {
  9003. if ( !_checkable(element) ) return;
  9004. var me = this,
  9005. elem, count;
  9006. if (element.name) {
  9007. count = me.$el.find('input[name="' + element.name + '"]').filter(function() {
  9008. var el = this;
  9009. if (!elem && _checkable(el)) elem = el;
  9010. return !el.disabled && el.checked;
  9011. }).length;
  9012. } else {
  9013. elem = element;
  9014. count = elem.checked;
  9015. }
  9016. if (params) {
  9017. return me.getRangeMsg(count, params);
  9018. } else {
  9019. return !!count || _getDataMsg(elem, me, '') || me.messages.required;
  9020. }
  9021. },
  9022. /**
  9023. * length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
  9024. *
  9025. * @example:
  9026. length[6~16] 6-16 characters
  9027. length[6~] Greater than 6 characters
  9028. length[~16] Less than 16 characters
  9029. length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
  9030. **/
  9031. length: function(element, params) {
  9032. var value = this.value,
  9033. len = (params[1] === 'true' ? value.replace(rDoubleBytes, 'xx') : value).length;
  9034. return this.getRangeMsg(len, params, (params[1] ? '_2' : ''));
  9035. },
  9036. /**
  9037. * remote validation
  9038. *
  9039. * @description
  9040. * remote([get:]url [, name1, [name2 ...]]);
  9041. * Adaptation three kinds of results (Front for the successful, followed by a failure):
  9042. 1. text:
  9043. '' 'Error Message'
  9044. 2. json:
  9045. {"ok": ""} {"error": "Error Message"}
  9046. 3. json wrapper:
  9047. {"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
  9048. * @example
  9049. The simplest: remote(path/to/server);
  9050. With parameters: remote(path/to/server, name1, name2, ...);
  9051. By GET: remote(get:path/to/server, name1, name2, ...);
  9052. Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
  9053. Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)
  9054. */
  9055. remote: function(element, params) {
  9056. if (!params) return;
  9057. var me = this,
  9058. arr = rAjaxType.exec(params[0]),
  9059. rule = me._rules[me._i],
  9060. data = {},
  9061. queryString = '',
  9062. url = arr[3],
  9063. type = arr[2] || 'POST', // GET / POST
  9064. rType = (arr[1]||'').toLowerCase(), // CORS / JSONP
  9065. dataType;
  9066. rule.must = true;
  9067. data[element.name] = me.value;
  9068. // There are extra fields
  9069. if (params[1]) {
  9070. $.map(params.slice(1), function(name) {
  9071. var arr, key;
  9072. if (~name.indexOf('=')) {
  9073. queryString += '&' + name;
  9074. } else {
  9075. arr = name.split(':');
  9076. name = trim(arr[0]);
  9077. key = trim(arr[1]) || name;
  9078. data[ name ] = me.$el.find( _key2selector(key) ).val();
  9079. }
  9080. });
  9081. }
  9082. data = $.param(data) + queryString;
  9083. if (!me.must && rule.data && rule.data === data) {
  9084. return rule.result;
  9085. }
  9086. // Cross-domain request, force jsonp dataType
  9087. if (rType !== 'cors' && /^https?:/.test(url) && !~url.indexOf(location.host)) {
  9088. dataType = 'jsonp';
  9089. }
  9090. // Asynchronous validation need return jqXHR objects
  9091. return $.ajax({
  9092. url: url,
  9093. type: type,
  9094. data: data,
  9095. dataType: dataType
  9096. });
  9097. },
  9098. /**
  9099. * filter characters, direct filtration without prompting error (support custom regular expressions)
  9100. *
  9101. * @example
  9102. * filter filtering unsafe characters
  9103. * filter(regexp) filtering the "regexp" matched characters
  9104. */
  9105. filter: function(element, params) {
  9106. var value = this.value,
  9107. temp = value.replace( params ? (new RegExp("[" + params[0] + "]", "gm")) : rUnsafe, '' );
  9108. if (temp !== value) this.setValue(temp);
  9109. }
  9110. });
  9111. /**
  9112. * Config global options
  9113. *
  9114. * @static config
  9115. * @param {Object} options
  9116. */
  9117. Validator.config = function(key, value) {
  9118. if (isObject(key)) {
  9119. $.each(key, _config);
  9120. }
  9121. else if (isString(key)) {
  9122. _config(key, value);
  9123. }
  9124. function _config(k, o) {
  9125. if (k === 'rules') {
  9126. new Rules(o);
  9127. }
  9128. else if (k === 'messages') {
  9129. new Messages(o);
  9130. }
  9131. else if (k in fieldDefaults) {
  9132. fieldDefaults[k] = o;
  9133. }
  9134. else {
  9135. defaults[k] = o;
  9136. }
  9137. }
  9138. };
  9139. /**
  9140. * Config themes
  9141. *
  9142. * @static setTheme
  9143. * @param {String|Object} name
  9144. * @param {Object} obj
  9145. * @example
  9146. .setTheme( themeName, themeOptions )
  9147. .setTheme( multiThemes )
  9148. */
  9149. Validator.setTheme = function(name, obj) {
  9150. if ( isObject(name) ) {
  9151. $.extend(true, themes, name);
  9152. }
  9153. else if ( isString(name) && isObject(obj) ) {
  9154. themes[name] = $.extend(themes[name], obj);
  9155. }
  9156. };
  9157. /**
  9158. * Resource loader
  9159. *
  9160. * @static load
  9161. * @param {String} str
  9162. * @example
  9163. .load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css
  9164. .load('local=zh-CN&css=') // load: local/zh-CN.js
  9165. .load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css
  9166. .load('local') // dito
  9167. */
  9168. Validator.load = function(str) {
  9169. if (!str) return;
  9170. var doc = document,
  9171. params = {},
  9172. node = doc.scripts[0],
  9173. dir, el, ONLOAD;
  9174. str.replace(/([^?=&]+)=([^&#]*)/g, function(m, key, value){
  9175. params[key] = value;
  9176. });
  9177. dir = params.dir || Validator.dir;
  9178. if (!Validator.css && params.css !== '') {
  9179. el = doc.createElement('link');
  9180. el.rel = 'stylesheet';
  9181. el.href = Validator.css = dir + 'jquery.validator.css';
  9182. node.parentNode.insertBefore(el, node);
  9183. }
  9184. if (!Validator.local && ~str.indexOf('local') && params.local !== '') {
  9185. Validator.local = (params.local || doc.documentElement.lang || 'en').replace('_','-');
  9186. Validator.pending = 1;
  9187. el = doc.createElement('script');
  9188. el.src = dir + 'local/' + Validator.local + '.js';
  9189. ONLOAD = 'onload' in el ? 'onload' : 'onreadystatechange';
  9190. el[ONLOAD] = function() {
  9191. if (!el.readyState || /loaded|complete/.test(el.readyState)) {
  9192. el = el[ONLOAD] = null;
  9193. delete Validator.pending;
  9194. $(window).triggerHandler('validatorready');
  9195. }
  9196. };
  9197. node.parentNode.insertBefore(el, node);
  9198. }
  9199. };
  9200. // Auto loading resources
  9201. (function(){
  9202. var scripts = document.scripts,
  9203. i = scripts.length, node, arr,
  9204. re = /(.*validator(?:\.min)?.js)(\?.*(?:local|css|dir)(?:=[\w\-]*)?)?/;
  9205. while (i-- && !arr) {
  9206. node = scripts[i];
  9207. arr = (node.hasAttribute ? node.src : node.getAttribute('src',4)||'').match(re);
  9208. }
  9209. if (!arr) return;
  9210. Validator.dir = arr[1].split('/').slice(0, -1).join('/')+'/';
  9211. Validator.load(arr[2]);
  9212. })();
  9213. return $[NS] = Validator;
  9214. }));
  9215. /*********************************
  9216. * Themes, rules, and i18n support
  9217. * Locale: Chinese; 中文
  9218. *********************************/
  9219. (function(factory) {
  9220. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  9221. typeof define === 'function' && define.amd ? define('validator-lang',['jquery'], factory) :
  9222. factory(jQuery);
  9223. }(function($) {
  9224. /* Global configuration
  9225. */
  9226. $.validator.config({
  9227. //stopOnError: true,
  9228. //focusCleanup: true,
  9229. //theme: 'yellow_right',
  9230. //timely: 2,
  9231. // Custom rules
  9232. rules: {
  9233. digits: [/^\d+$/, "请填写数字"]
  9234. ,letters: [/^[a-z]+$/i, "请填写字母"]
  9235. ,date: [/^\d{4}-\d{2}-\d{2}$/, "请填写有效的日期,格式:yyyy-mm-dd"]
  9236. ,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请填写有效的时间,00:00到23:59之间"]
  9237. ,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "请填写有效的邮箱"]
  9238. ,url: [/^(https?|s?ftp):\/\/\S+$/i, "请填写有效的网址"]
  9239. ,qq: [/^[1-9]\d{4,}$/, "请填写有效的QQ号"]
  9240. ,IDcard: [/^\d{6}(19|2\d)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)?$/, "请填写正确的身份证号码"]
  9241. ,tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "请填写有效的电话号码"]
  9242. ,mobile: [/^1[3-9]\d{9}$/, "请填写有效的手机号"]
  9243. ,zipcode: [/^\d{6}$/, "请检查邮政编码格式"]
  9244. ,chinese: [/^[\u0391-\uFFE5]+$/, "请填写中文字符"]
  9245. ,username: [/^\w{3,12}$/, "请填写3-12位数字、字母、下划线"]
  9246. ,password: [/^[\S]{6,16}$/, "请填写6-16位字符,不能包含空格"]
  9247. ,accept: function (element, params){
  9248. if (!params) return true;
  9249. var ext = params[0],
  9250. value = $(element).val();
  9251. return (ext === '*') ||
  9252. (new RegExp(".(?:" + ext + ")$", "i")).test(value) ||
  9253. this.renderMsg("只接受{1}后缀的文件", ext.replace(/\|/g, ','));
  9254. }
  9255. },
  9256. // Default error messages
  9257. messages: {
  9258. 0: "此处",
  9259. fallback: "{0}格式不正确",
  9260. loading: "正在验证...",
  9261. error: "网络异常",
  9262. timeout: "请求超时",
  9263. required: "{0}不能为空",
  9264. remote: "{0}已被使用",
  9265. integer: {
  9266. '*': "请填写整数",
  9267. '+': "请填写正整数",
  9268. '+0': "请填写正整数或0",
  9269. '-': "请填写负整数",
  9270. '-0': "请填写负整数或0"
  9271. },
  9272. match: {
  9273. eq: "{0}与{1}不一致",
  9274. neq: "{0}与{1}不能相同",
  9275. lt: "{0}必须小于{1}",
  9276. gt: "{0}必须大于{1}",
  9277. lte: "{0}不能大于{1}",
  9278. gte: "{0}不能小于{1}"
  9279. },
  9280. range: {
  9281. rg: "请填写{1}到{2}的数",
  9282. gte: "请填写不小于{1}的数",
  9283. lte: "请填写最大{1}的数",
  9284. gtlt: "请填写{1}到{2}之间的数",
  9285. gt: "请填写大于{1}的数",
  9286. lt: "请填写小于{1}的数"
  9287. },
  9288. checked: {
  9289. eq: "请选择{1}项",
  9290. rg: "请选择{1}到{2}项",
  9291. gte: "请至少选择{1}项",
  9292. lte: "请最多选择{1}项"
  9293. },
  9294. length: {
  9295. eq: "请填写{1}个字符",
  9296. rg: "请填写{1}到{2}个字符",
  9297. gte: "请至少填写{1}个字符",
  9298. lte: "请最多填写{1}个字符",
  9299. eq_2: "",
  9300. rg_2: "",
  9301. gte_2: "",
  9302. lte_2: ""
  9303. }
  9304. }
  9305. });
  9306. /* Themes
  9307. */
  9308. var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
  9309. $.validator.setTheme({
  9310. 'simple_right': {
  9311. formClass: 'n-simple',
  9312. msgClass: 'n-right'
  9313. },
  9314. 'simple_bottom': {
  9315. formClass: 'n-simple',
  9316. msgClass: 'n-bottom'
  9317. },
  9318. 'yellow_top': {
  9319. formClass: 'n-yellow',
  9320. msgClass: 'n-top',
  9321. msgArrow: TPL_ARROW
  9322. },
  9323. 'yellow_right': {
  9324. formClass: 'n-yellow',
  9325. msgClass: 'n-right',
  9326. msgArrow: TPL_ARROW
  9327. },
  9328. 'yellow_right_effect': {
  9329. formClass: 'n-yellow',
  9330. msgClass: 'n-right',
  9331. msgArrow: TPL_ARROW,
  9332. msgShow: function($msgbox, type){
  9333. var $el = $msgbox.children();
  9334. if ($el.is(':animated')) return;
  9335. if (type === 'error') {
  9336. $el.css({left: '20px', opacity: 0})
  9337. .delay(100).show().stop()
  9338. .animate({left: '-4px', opacity: 1}, 150)
  9339. .animate({left: '3px'}, 80)
  9340. .animate({left: 0}, 80);
  9341. } else {
  9342. $el.css({left: 0, opacity: 1}).fadeIn(200);
  9343. }
  9344. },
  9345. msgHide: function($msgbox, type){
  9346. var $el = $msgbox.children();
  9347. $el.stop().delay(100).show()
  9348. .animate({left: '20px', opacity: 0}, 300, function(){
  9349. $msgbox.hide();
  9350. });
  9351. }
  9352. }
  9353. });
  9354. }));
  9355. define('validator',['validator-core', 'validator-lang'], function (Validator, undefined) {
  9356. return Validator;
  9357. });
  9358. define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, Upload, Validator) {
  9359. var Form = {
  9360. config: {
  9361. },
  9362. events: {
  9363. validator: function (form, success, error, submit) {
  9364. //绑定表单事件
  9365. form.validator($.extend({
  9366. validClass: 'has-success',
  9367. invalidClass: 'has-error',
  9368. bindClassTo: '.form-group',
  9369. formClass: 'n-default n-bootstrap',
  9370. msgClass: 'n-right',
  9371. stopOnError: true,
  9372. display: function (elem) {
  9373. return $(elem).closest('.form-group').find(".control-label").text().replace(/\:/, '');
  9374. },
  9375. target: function (input) {
  9376. var $formitem = $(input).closest('.form-group'),
  9377. $msgbox = $formitem.find('span.msg-box');
  9378. if (!$msgbox.length) {
  9379. return [];
  9380. }
  9381. return $msgbox;
  9382. },
  9383. valid: function (ret) {
  9384. //验证通过提交表单
  9385. Form.api.submit($(ret), function (data, ret) {
  9386. if (typeof success === 'function') {
  9387. if (!success.call($(this), data, ret)) {
  9388. return false;
  9389. }
  9390. }
  9391. //提示及关闭当前窗口
  9392. var msg = ret.hasOwnProperty("msg") && ret.msg !== "" ? ret.msg : __('Operation completed');
  9393. parent.Toastr.success(msg);
  9394. parent.$(".btn-refresh").trigger("click");
  9395. var index = parent.Layer.getFrameIndex(window.name);
  9396. parent.Layer.close(index);
  9397. }, error, submit);
  9398. return false;
  9399. }
  9400. }, form.data("validator-options") || {}));
  9401. //移除提交按钮的disabled类
  9402. $(".layer-footer .btn.disabled", form).removeClass("disabled");
  9403. },
  9404. selectpicker: function (form) {
  9405. //绑定select元素事件
  9406. if ($(".selectpicker", form).size() > 0) {
  9407. require(['bootstrap-select', 'bootstrap-select-lang'], function () {
  9408. $('.selectpicker', form).selectpicker();
  9409. });
  9410. }
  9411. },
  9412. selectpage: function (form) {
  9413. //绑定selectpage元素事件
  9414. if ($(".selectpage", form).size() > 0) {
  9415. require(['selectpage'], function () {
  9416. $('.selectpage', form).selectPage({
  9417. source: 'ajax/selectpage',
  9418. });
  9419. });
  9420. //给隐藏的元素添加上validate验证触发事件
  9421. $(form).on("change", ".selectpage-input-hidden", function () {
  9422. $(this).trigger("validate");
  9423. });
  9424. }
  9425. },
  9426. cxselect: function (form) {
  9427. //绑定cxselect元素事件
  9428. if ($("[data-toggle='cxselect']", form).size() > 0) {
  9429. require(['cxselect'], function () {
  9430. $.cxSelect.defaults.jsonName = 'name';
  9431. $.cxSelect.defaults.jsonValue = 'value';
  9432. $.cxSelect.defaults.jsonSpace = 'data';
  9433. $("[data-toggle='cxselect']", form).cxSelect();
  9434. });
  9435. }
  9436. },
  9437. citypicker: function (form) {
  9438. //绑定城市远程插件
  9439. if ($("[data-toggle='city-picker']", form).size() > 0) {
  9440. require(['citypicker'], function () {});
  9441. }
  9442. },
  9443. datetimepicker: function (form) {
  9444. //绑定日期时间元素事件
  9445. if ($(".datetimepicker", form).size() > 0) {
  9446. require(['bootstrap-datetimepicker'], function () {
  9447. var options = {
  9448. format: 'YYYY-MM-DD HH:mm:ss',
  9449. icons: {
  9450. time: 'fa fa-clock-o',
  9451. date: 'fa fa-calendar',
  9452. up: 'fa fa-chevron-up',
  9453. down: 'fa fa-chevron-down',
  9454. previous: 'fa fa-chevron-left',
  9455. next: 'fa fa-chevron-right',
  9456. today: 'fa fa-history',
  9457. clear: 'fa fa-trash',
  9458. close: 'fa fa-remove'
  9459. },
  9460. showTodayButton: true,
  9461. showClose: true
  9462. };
  9463. $('.datetimepicker', form).parent().css('position', 'relative');
  9464. $('.datetimepicker', form).datetimepicker(options);
  9465. });
  9466. }
  9467. },
  9468. plupload: function (form) {
  9469. //绑定plupload上传元素事件
  9470. if ($(".plupload", form).size() > 0) {
  9471. Upload.api.plupload();
  9472. }
  9473. },
  9474. faselect: function (form) {
  9475. //绑定fachoose选择附件事件
  9476. if ($(".fachoose", form).size() > 0) {
  9477. $(document).on('click', ".fachoose", function () {
  9478. var that = this;
  9479. var multiple = $(this).data("multiple") ? $(this).data("multiple") : false;
  9480. var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : '';
  9481. parent.Fast.api.open("general/attachment/select?element_id=" + $(this).attr("id") + "&multiple=" + multiple + "&mimetype=" + mimetype, __('Choose'), {
  9482. callback: function (data) {
  9483. var input_id = $("#" + $(that).attr("id")).data("input-id");
  9484. if (data.multiple) {
  9485. var urlArr = [];
  9486. var inputObj = $("#" + input_id);
  9487. if (inputObj.val() !== "") {
  9488. urlArr.push(inputObj.val());
  9489. }
  9490. urlArr.push(data.url);
  9491. inputObj.val(urlArr.join(",")).trigger("change");
  9492. } else {
  9493. $("#" + input_id).val(data.url).trigger("change");
  9494. }
  9495. }
  9496. });
  9497. return false;
  9498. });
  9499. }
  9500. },
  9501. bindevent: function (form) {
  9502. }
  9503. },
  9504. api: {
  9505. submit: function (form, success, error, submit) {
  9506. if (form.size() === 0)
  9507. return Toastr.error("表单未初始化完成,无法提交");
  9508. if (typeof submit === 'function') {
  9509. if (!submit.call(form)) {
  9510. return false;
  9511. }
  9512. }
  9513. var type = form.attr("method").toUpperCase();
  9514. type = type && (type === 'GET' || type === 'POST') ? type : 'GET';
  9515. url = form.attr("action");
  9516. url = url ? url : location.href;
  9517. //调用Ajax请求方法
  9518. Fast.api.ajax({
  9519. type: type,
  9520. url: url,
  9521. data: form.serialize(),
  9522. dataType: 'json'
  9523. }, function (data, ret) {
  9524. $('.form-group', form).removeClass('has-feedback has-success has-error');
  9525. if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
  9526. $("input[name='__token__']", form).val(data.token);
  9527. }
  9528. if (typeof success === 'function') {
  9529. if (!success.call(form, data, ret)) {
  9530. return false;
  9531. }
  9532. }
  9533. }, function (data, ret) {
  9534. if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
  9535. $("input[name='__token__']", form).val(data.token);
  9536. }
  9537. if (typeof error === 'function') {
  9538. if (!error.call(form, data, ret)) {
  9539. return false;
  9540. }
  9541. }
  9542. });
  9543. return false;
  9544. },
  9545. bindevent: function (form, success, error, submit) {
  9546. form = typeof form === 'object' ? form : $(form);
  9547. var events = Form.events;
  9548. events.bindevent(form);
  9549. events.validator(form, success, error, submit);
  9550. events.selectpicker(form);
  9551. events.selectpage(form);
  9552. events.cxselect(form);
  9553. events.citypicker(form);
  9554. events.datetimepicker(form);
  9555. events.plupload(form);
  9556. events.faselect(form);
  9557. },
  9558. custom: {}
  9559. },
  9560. };
  9561. return Form;
  9562. });
  9563. // jQuery List DragSort v0.5.2
  9564. // Website: http://dragsort.codeplex.com/
  9565. // License: http://dragsort.codeplex.com/license
  9566. (function($) {
  9567. $.fn.dragsort = function(options) {
  9568. if (options == "destroy") {
  9569. $(this.selector).trigger("dragsort-uninit");
  9570. return;
  9571. }
  9572. var opts = $.extend({}, $.fn.dragsort.defaults, options);
  9573. var lists = [];
  9574. var list = null, lastPos = null;
  9575. this.each(function(i, cont) {
  9576. //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
  9577. if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody"))
  9578. cont = $(cont).children().get(0);
  9579. var newList = {
  9580. draggedItem: null,
  9581. placeHolderItem: null,
  9582. pos: null,
  9583. offset: null,
  9584. offsetLimit: null,
  9585. scroll: null,
  9586. container: cont,
  9587. init: function() {
  9588. //set options to default values if not set
  9589. opts.tagName = opts.tagName == "" ? ($(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase()) : opts.tagName;
  9590. if (opts.itemSelector == "")
  9591. opts.itemSelector = opts.tagName;
  9592. if (opts.dragSelector == "")
  9593. opts.dragSelector = opts.tagName;
  9594. if (opts.placeHolderTemplate == "")
  9595. opts.placeHolderTemplate = "<" + opts.tagName + ">&nbsp;</" + opts.tagName + ">";
  9596. //listidx allows reference back to correct list variable instance
  9597. $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit);
  9598. this.styleDragHandlers(true);
  9599. },
  9600. uninit: function() {
  9601. var list = lists[$(this).attr("data-listidx")];
  9602. $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit");
  9603. list.styleDragHandlers(false);
  9604. },
  9605. getItems: function() {
  9606. return $(this.container).children(opts.itemSelector);
  9607. },
  9608. styleDragHandlers: function(cursor) {
  9609. this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : "");
  9610. },
  9611. grabItem: function(e) {
  9612. var list = lists[$(this).attr("data-listidx")];
  9613. var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0);
  9614. var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0;
  9615. //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return
  9616. if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem)
  9617. return;
  9618. //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,
  9619. //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude
  9620. //e.preventDefault();
  9621. //change cursor to move while dragging
  9622. var dragHandle = e.target;
  9623. while (!$(dragHandle).is(opts.dragSelector)) {
  9624. if (dragHandle == this) return;
  9625. dragHandle = dragHandle.parentNode;
  9626. }
  9627. $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor"));
  9628. $(dragHandle).css("cursor", "move");
  9629. //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work
  9630. var listElem = this;
  9631. var trigger = function() {
  9632. list.dragStart.call(listElem, e);
  9633. $(list.container).unbind("mousemove", trigger);
  9634. };
  9635. $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); });
  9636. },
  9637. dragStart: function(e) {
  9638. if (list != null && list.draggedItem != null)
  9639. list.dropItem();
  9640. list = lists[$(this).attr("data-listidx")];
  9641. list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName)
  9642. //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
  9643. list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem));
  9644. //calculate mouse offset relative to draggedItem
  9645. var mt = parseInt(list.draggedItem.css("marginTop"));
  9646. var ml = parseInt(list.draggedItem.css("marginLeft"));
  9647. list.offset = list.draggedItem.offset();
  9648. list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1;
  9649. list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1;
  9650. //calculate box the dragged item can't be dragged outside of
  9651. if (!opts.dragBetween) {
  9652. 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();
  9653. list.offsetLimit = $(list.container).offset();
  9654. list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth();
  9655. list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
  9656. }
  9657. //create placeholder item
  9658. var h = list.draggedItem.height();
  9659. var w = list.draggedItem.width();
  9660. if (opts.tagName == "tr") {
  9661. list.draggedItem.children().each(function() { $(this).width($(this).width()); });
  9662. list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true);
  9663. list.draggedItem.after(list.placeHolderItem);
  9664. //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html("&nbsp;"); });
  9665. list.placeHolderItem.children().each(function() { $(this).html("&nbsp;"); });
  9666. } else {
  9667. list.draggedItem.after(opts.placeHolderTemplate);
  9668. list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true);
  9669. }
  9670. if (opts.tagName == "td") {
  9671. var listTable = list.draggedItem.closest("table").get(0);
  9672. $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").appendTo("body").children().append(list.draggedItem);
  9673. }
  9674. //style draggedItem while dragging
  9675. var orig = list.draggedItem.attr("style");
  9676. list.draggedItem.attr("data-origstyle", orig ? orig : "");
  9677. list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w });
  9678. //auto-scroll setup
  9679. list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() };
  9680. list.scroll.scrollY = window.setInterval(function() {
  9681. if (opts.scrollContainer != window) {
  9682. $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY);
  9683. return;
  9684. }
  9685. var t = $(opts.scrollContainer).scrollTop();
  9686. if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) {
  9687. $(opts.scrollContainer).scrollTop(t + list.scroll.moveY);
  9688. list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1);
  9689. }
  9690. }, 10);
  9691. list.scroll.scrollX = window.setInterval(function() {
  9692. if (opts.scrollContainer != window) {
  9693. $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX);
  9694. return;
  9695. }
  9696. var l = $(opts.scrollContainer).scrollLeft();
  9697. if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) {
  9698. $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX);
  9699. list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1);
  9700. }
  9701. }, 10);
  9702. //misc
  9703. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  9704. list.setPos(e.pageX, e.pageY);
  9705. $(document).bind("mousemove", list.swapItems);
  9706. $(document).bind("mouseup", list.dropItem);
  9707. if (opts.scrollContainer != window)
  9708. $(window).bind("wheel", list.wheel);
  9709. },
  9710. //set position of draggedItem
  9711. setPos: function(x, y) {
  9712. //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner
  9713. var top = y - this.offset.top;
  9714. var left = x - this.offset.left;
  9715. //limit top, left to within box draggedItem can't be dragged outside of
  9716. if (!opts.dragBetween) {
  9717. top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
  9718. left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
  9719. }
  9720. //adjust top & left calculations to parent offset
  9721. var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin
  9722. if (parent != null) {
  9723. top -= parent.top;
  9724. left -= parent.left;
  9725. }
  9726. //set x or y auto-scroll amount
  9727. if (opts.scrollContainer == window) {
  9728. y -= $(window).scrollTop();
  9729. x -= $(window).scrollLeft();
  9730. y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5);
  9731. x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5);
  9732. } else {
  9733. var cont = $(opts.scrollContainer);
  9734. var offset = cont.offset();
  9735. y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top);
  9736. x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left);
  9737. }
  9738. list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x);
  9739. list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y);
  9740. //move draggedItem to new mouse cursor location
  9741. this.draggedItem.css({ top: top, left: left });
  9742. },
  9743. //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over
  9744. wheel: function(e) {
  9745. if (list && opts.scrollContainer != window) {
  9746. var cont = $(opts.scrollContainer);
  9747. var offset = cont.offset();
  9748. e = e.originalEvent;
  9749. if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) {
  9750. var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY;
  9751. cont.scrollTop(cont.scrollTop() + deltaY);
  9752. e.preventDefault();
  9753. }
  9754. }
  9755. },
  9756. //build a table recording all the positions of the moveable list items
  9757. buildPositionTable: function() {
  9758. var pos = [];
  9759. this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) {
  9760. var loc = $(this).offset();
  9761. loc.right = loc.left + $(this).outerWidth();
  9762. loc.bottom = loc.top + $(this).outerHeight();
  9763. loc.elm = this;
  9764. pos[i] = loc;
  9765. });
  9766. this.pos = pos;
  9767. },
  9768. dropItem: function() {
  9769. if (list.draggedItem == null)
  9770. return;
  9771. //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower
  9772. //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower)
  9773. var orig = list.draggedItem.attr("data-origstyle");
  9774. list.draggedItem.attr("style", orig);
  9775. if (orig == "")
  9776. list.draggedItem.removeAttr("style");
  9777. list.draggedItem.removeAttr("data-origstyle");
  9778. list.styleDragHandlers(true);
  9779. list.placeHolderItem.before(list.draggedItem);
  9780. list.placeHolderItem.remove();
  9781. $("[data-droptarget], .dragSortItem").remove();
  9782. window.clearInterval(list.scroll.scrollY);
  9783. window.clearInterval(list.scroll.scrollX);
  9784. //if position changed call dragEnd
  9785. if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem))
  9786. if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order
  9787. var pos = list.draggedItem.attr("data-origpos").split('-');
  9788. var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]);
  9789. if (nextItem.size() > 0)
  9790. nextItem.before(list.draggedItem);
  9791. else if (pos[1] == 0) //was the only item in list
  9792. $(lists[pos[0]].container).prepend(list.draggedItem);
  9793. else //was the last item in list
  9794. $(lists[pos[0]].container).append(list.draggedItem);
  9795. }
  9796. list.draggedItem.removeAttr("data-origpos");
  9797. list.draggedItem = null;
  9798. $(document).unbind("mousemove", list.swapItems);
  9799. $(document).unbind("mouseup", list.dropItem);
  9800. if (opts.scrollContainer != window)
  9801. $(window).unbind("wheel", list.wheel);
  9802. return false;
  9803. },
  9804. //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of
  9805. swapItems: function(e) {
  9806. if (list.draggedItem == null)
  9807. return false;
  9808. //move draggedItem to mouse location
  9809. list.setPos(e.pageX, e.pageY);
  9810. //retrieve list and item position mouse cursor is over
  9811. var ei = list.findPos(e.pageX, e.pageY);
  9812. var nlist = list;
  9813. for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) {
  9814. ei = lists[i].findPos(e.pageX, e.pageY);
  9815. nlist = lists[i];
  9816. }
  9817. //if not over another moveable list item return
  9818. if (ei == -1)
  9819. return false;
  9820. //save fixed items locations
  9821. var children = function() { return $(nlist.container).children().not(nlist.draggedItem); };
  9822. var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); });
  9823. //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after
  9824. if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left)
  9825. $(nlist.pos[ei].elm).before(list.placeHolderItem);
  9826. else
  9827. $(nlist.pos[ei].elm).after(list.placeHolderItem);
  9828. //restore fixed items location
  9829. fixed.each(function() {
  9830. var elm = children().eq(this.idx).get(0);
  9831. if (this != elm && children().index(this) < this.idx)
  9832. $(this).insertAfter(elm);
  9833. else if (this != elm)
  9834. $(this).insertBefore(elm);
  9835. });
  9836. //misc
  9837. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  9838. lastPos = list.draggedItem.offset();
  9839. return false;
  9840. },
  9841. //returns the index of the list item the mouse is over
  9842. findPos: function(x, y) {
  9843. for (var i = 0; i < this.pos.length; i++) {
  9844. if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y)
  9845. return i;
  9846. }
  9847. return -1;
  9848. },
  9849. //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position
  9850. createDropTargets: function() {
  9851. if (!opts.dragBetween)
  9852. return;
  9853. $(lists).each(function() {
  9854. var ph = $(this.container).find("[data-placeholder]");
  9855. var dt = $(this.container).find("[data-droptarget]");
  9856. if (ph.size() > 0 && dt.size() > 0)
  9857. dt.remove();
  9858. else if (ph.size() == 0 && dt.size() == 0) {
  9859. if (opts.tagName == "td")
  9860. $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container);
  9861. else
  9862. //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8)
  9863. $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true));
  9864. list.placeHolderItem.attr("data-placeholder", true);
  9865. }
  9866. });
  9867. }
  9868. };
  9869. newList.init();
  9870. lists.push(newList);
  9871. });
  9872. return this;
  9873. };
  9874. $.fn.dragsort.defaults = {
  9875. tagName:"",
  9876. itemSelector: "",
  9877. dragSelector: "",
  9878. dragSelectorExclude: "input, textarea",
  9879. dragEnd: function() { },
  9880. dragBetween: false,
  9881. placeHolderTemplate: "",
  9882. scrollContainer: window,
  9883. scrollSpeed: 5
  9884. };
  9885. })(jQuery);
  9886. define("dragsort", function(){});
  9887. /*!
  9888. * jquery.event.drag - v 2.2
  9889. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  9890. * Open Source MIT License - http://threedubmedia.com/code/license
  9891. */
  9892. ;(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);
  9893. define("drag", function(){});
  9894. /*!
  9895. * jquery.event.drop - v 2.2
  9896. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  9897. * Open Source MIT License - http://threedubmedia.com/code/license
  9898. */
  9899. ;(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);
  9900. define("drop", function(){});
  9901. /**
  9902. * http://git.oschina.net/hbbcs/bootStrap-addTabs
  9903. * Created by joe on 2015-12-19.
  9904. * @param {type} options {
  9905. * content string||html 直接指定内容
  9906. * close bool 是否可以关闭
  9907. * monitor 监视的区域
  9908. * }
  9909. *
  9910. * @returns
  9911. */
  9912. $.fn.addtabs = function (options) {
  9913. var obj = $(this);
  9914. options = $.extend({
  9915. content: '', //直接指定所有页面TABS内容
  9916. close: true, //是否可以关闭
  9917. monitor: 'body', //监视的区域
  9918. nav: '.nav-addtabs',
  9919. tab: '.tab-addtabs',
  9920. iframeUse: true, //使用iframe还是ajax
  9921. iframeHeight: $(window).height() - 50, //固定TAB中IFRAME高度,根据需要自己修改
  9922. callback: function () {
  9923. //关闭后回调函数
  9924. }
  9925. }, options || {});
  9926. var navobj = $(options.nav);
  9927. var tabobj = $(options.tab);
  9928. if (history.pushState) {
  9929. //浏览器前进后退事件
  9930. $(window).on("popstate", function (e) {
  9931. var state = e.originalEvent.state;
  9932. if (state) {
  9933. $("a[addtabs=" + state.id + "]", options.monitor).data("pushstate", true).trigger("click");
  9934. }
  9935. });
  9936. }
  9937. $(options.monitor).on('click', '[addtabs]', function (e) {
  9938. if ($(this).attr('url').indexOf("javascript") !== 0) {
  9939. if ($(this).is("a")) {
  9940. e.preventDefault();
  9941. }
  9942. var id = $(this).attr('addtabs');
  9943. var title = $(this).attr('title') ? $(this).attr('title') : $.trim($(this).text());
  9944. var url = $(this).attr('url');
  9945. var content = options.content ? options.content : $(this).attr('content');
  9946. var ajax = $(this).attr('ajax') ? true : false;
  9947. var state = ({
  9948. url: url, title: title, id: id, content: content, ajax: ajax
  9949. });
  9950. document.title = title;
  9951. if (history.pushState && !$(this).data("pushstate")) {
  9952. var pushurl = url.indexOf("ref=addtabs") == -1 ? (url + (url.indexOf("?") > -1 ? "&" : "?") + "ref=addtabs") : url;
  9953. window.history.pushState(state, title, pushurl);
  9954. }
  9955. $(this).data("pushstate", null);
  9956. _add({
  9957. id: id,
  9958. title: $(this).attr('title') ? $(this).attr('title') : $(this).html(),
  9959. content: content,
  9960. url: url,
  9961. ajax: ajax
  9962. });
  9963. }
  9964. });
  9965. navobj.on('click', '.close-tab', function (e) {
  9966. id = $(this).prev("a").attr("aria-controls");
  9967. _close(id);
  9968. return false;
  9969. });
  9970. navobj.on('dblclick', 'li[role=presentation]', function (e) {
  9971. $(this).find(".close-tab").trigger("click");
  9972. });
  9973. navobj.on('click', 'li[role=presentation]', function (e) {
  9974. $("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click");
  9975. });
  9976. $(window).resize(function () {
  9977. $("#nav").width($("#header > .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20);
  9978. _drop();
  9979. });
  9980. _add = function (opts) {
  9981. id = 'tab_' + opts.id;
  9982. url = opts.url;
  9983. url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1");
  9984. navobj.find("[role='presentation']").removeClass('active');
  9985. tabobj.find("[role='tabpanel']").removeClass('active');
  9986. //如果TAB不存在,创建一个新的TAB
  9987. if ($("#" + id).size() == 0) {
  9988. //创建新TAB的title
  9989. title = $('<li role="presentation" id="tab_' + id + '"><a href="#' + id + '" node-id="' + opts.id + '" aria-controls="' + id + '" role="tab" data-toggle="tab">' + opts.title + '</a></li>');
  9990. //是否允许关闭
  9991. if (options.close && $("li", navobj).size() > 0) {
  9992. title.append(' <i class="close-tab fa fa-remove"></i>');
  9993. }
  9994. //创建新TAB的内容
  9995. content = $('<div role="tabpanel" class="tab-pane" id="' + id + '"></div>');
  9996. //是否指定TAB内容
  9997. if (opts.content) {
  9998. content.append(opts.content);
  9999. } else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接
  10000. var height = options.iframeHeight;
  10001. 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>');
  10002. } else {
  10003. $.get(url, function (data) {
  10004. content.append(data);
  10005. });
  10006. }
  10007. //加入TABS
  10008. if ($('.tabdrop li').size() > 0) {
  10009. $('.tabdrop ul').append(title);
  10010. } else {
  10011. navobj.append(title);
  10012. }
  10013. tabobj.append(content);
  10014. }
  10015. //激活TAB
  10016. $("#tab_" + id).addClass('active');
  10017. $("#" + id).addClass("active");
  10018. _drop();
  10019. };
  10020. _close = function (id) {
  10021. //如果关闭的是当前激活的TAB,激活他的前一个TAB
  10022. if (obj.find("li.active").attr('id') == "tab_" + id) {
  10023. if ($("#tab_" + id).prev().not(".tabdrop").size() > 0) {
  10024. $("#tab_" + id).prev().not(".tabdrop").find("a").trigger("click");
  10025. } else if ($("#tab_" + id).next().size() > 0) {
  10026. $("#tab_" + id).next().trigger("click");
  10027. }
  10028. }
  10029. //关闭TAB
  10030. $("#tab_" + id).remove();
  10031. $("#" + id).remove();
  10032. _drop();
  10033. options.callback();
  10034. };
  10035. _drop = function () {
  10036. //创建下拉标签
  10037. var dropdown = $('<li class="dropdown pull-right hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;">' +
  10038. '<i class="glyphicon glyphicon-align-justify"></i>' +
  10039. ' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>');
  10040. //检测是否已增加
  10041. if (!$('.tabdrop').html()) {
  10042. dropdown.prependTo(navobj);
  10043. } else {
  10044. dropdown = navobj.find('.tabdrop');
  10045. }
  10046. //检测是否有下拉样式
  10047. if (navobj.parent().is('.tabs-below')) {
  10048. dropdown.addClass('dropup');
  10049. }
  10050. var collection = 0;
  10051. var maxwidth = navobj.width() - 60;
  10052. var liwidth = 0;
  10053. //检查超过一行的标签页
  10054. var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop');
  10055. var lisize = litabs.size();
  10056. litabs.each(function (i, j) {
  10057. liwidth += $(this).width();
  10058. if (collection == 0 && i == lisize - 1 && liwidth <= navobj.width()) {
  10059. return true;
  10060. }
  10061. if (liwidth > maxwidth) {
  10062. dropdown.find('ul').append($(this));
  10063. collection++;
  10064. }
  10065. });
  10066. //如果有超出的,显示下拉标签
  10067. if (collection > 0) {
  10068. dropdown.removeClass('hide');
  10069. if (dropdown.find('.active').length == 1) {
  10070. dropdown.addClass('active');
  10071. } else {
  10072. dropdown.removeClass('active');
  10073. }
  10074. } else {
  10075. dropdown.addClass('hide');
  10076. }
  10077. };
  10078. };
  10079. define("addtabs", function(){});
  10080. /**
  10081. * @file jQuery Plugin: SelectPage
  10082. * @version 0.1
  10083. * @author TerryZeng
  10084. * @license MIT License
  10085. *
  10086. * 插件的部分功能使用、借鉴了
  10087. * jQuery Plugin: jquery.ajax-combobox
  10088. * 作者:Yuusaku Miyazaki <toumin.m7@gmail.com>(宮崎 雄策)
  10089. *
  10090. */
  10091. ;
  10092. (function (factory) {
  10093. if (typeof define === "function" && define.amd) {
  10094. // AMD模式
  10095. define('selectpage',["jquery"], factory);
  10096. } else {
  10097. // 全局模式
  10098. factory(jQuery);
  10099. }
  10100. }(function ($) {
  10101. "use strict";
  10102. /**
  10103. * 内部使用常量
  10104. */
  10105. var constants = {
  10106. dataKey: 'selectPageObject', //插件缓存内部对象的KEY
  10107. objStatusKey: 'selectPage-self-mark', //全局范围设置当前点击是否为插件自身的标识
  10108. objStatusIndex: 'selectPage-self-index' //全局范围设置当前点击的selectpage的索引下标
  10109. };
  10110. /**
  10111. * @desc 下拉分页查询控件初始化入口
  10112. * @global
  10113. * @memberof jQuery
  10114. * @param {string|Object} source - 数据源(String:Ajax查询的URL|Object:JSON格式的数据源)
  10115. * @param {Object} option - 初始化参数集
  10116. *
  10117. *
  10118. * option参数集内容
  10119. * @param {boolean} [option.instance] - 是否返回插件内部对象(true:返回内部对象,false:返回输入框自身)
  10120. * @param {string} [option.lang='cn'] - 插件显示语言 ('en','cn'等)
  10121. * @param {boolean} [option.multiple] - 是否为多选模式(多选模式下,选中的项目将会以Tag标签的形式展现)
  10122. * @param {string} [option.field='name'] - 结果集中用于显示的属性名
  10123. * @param {string} [option.search_field=option.field] - 使用ajax作为数据源情况下的查询字段指定。 (e.g.: 'id, name, job')
  10124. * @param {string|Array} [option.order_by=option.search_field] - 排序字段指定,若不指定则自动使用查询字段 (e.g.: 'name DESC' or ['name ASC', 'age DESC'])
  10125. * @param {number} [option.per_page=10] - 每页显示的记录数
  10126. * @param {string} [option.init_record=false] - 插件初始值指定,该值会与option.primary_key字段进行匹配,若匹配到,则自动设置选中并高亮
  10127. * @param {string} [option.bind_to] - 指定事件名称,用于在选择项目后进行触发(必须已自行绑定好事件)
  10128. * @param {string} [option.and_or='AND'] - 查询方式 ('AND' or 'OR')
  10129. * @param {boolean} [option.select_only=false] - 仅选择,不能输入查询关键字
  10130. * @param {string} [option.primary_key='id'] - 值字段,通常该字段的内容会自动保存在隐藏域中
  10131. */
  10132. $.fn.selectPage = function (option) {
  10133. var arr = [];
  10134. this.each(function () {
  10135. arr.push(new SelectPage(this, option));
  10136. });
  10137. return (option !== undefined && option.instance !== undefined && option.instance) ? $(arr) : this;
  10138. };
  10139. /**
  10140. * @global
  10141. * @constructor
  10142. * @classdesc 插件初始化
  10143. * @param {Object} combo_input - 插件的初始化输入框元素。
  10144. * @param {string|Object} source - 数据来源
  10145. * string:服务端请求的URL地址
  10146. * Object:JSON格式数组,推荐格式:[{a:1,b:2,c:3},{...}]
  10147. * @param {Object} option - 初始化参数
  10148. */
  10149. function SelectPage(combo_input, option) {
  10150. var option = $.extend({}, option, $(combo_input).data());
  10151. option = this._setCamelcaseToUnderscore(option);
  10152. this._setOption(option);
  10153. this._setLanguage();
  10154. this._setCssClass();
  10155. this._setProp();
  10156. this._setElem(combo_input, option);
  10157. this._setButtonAttrDefault();
  10158. this._setInitRecord();
  10159. this._ehButton();
  10160. this._ehComboInput();
  10161. this._ehWhole();
  10162. //缓存内部对象
  10163. $(this.elem.container).data(constants.dataKey, this);
  10164. }
  10165. /**
  10166. * 内部函数定义
  10167. */
  10168. $.extend(SelectPage.prototype, {
  10169. /**
  10170. * @private
  10171. * @desc 参数初始化
  10172. * @param {string|Object} source - 数据源
  10173. * @param {Object} option - 参数集
  10174. */
  10175. _setOption: function (option) {
  10176. option = this._setOption1st(option);
  10177. option = this._setOption2nd(option);
  10178. this.option = option;
  10179. },
  10180. /**
  10181. * @private
  10182. * @desc 参数使用默认值进行初始化与合并
  10183. * @param {Object} option - 初始化参数
  10184. * @return {Object} - 合并后的参数
  10185. */
  10186. _setOption1st: function (option) {
  10187. option = $.extend({
  10188. lang: 'cn',
  10189. multiple: false,
  10190. init_record: false,
  10191. field: 'name',
  10192. and_or: 'AND',
  10193. per_page: 10,
  10194. primary_key: 'id',
  10195. bind_to: false,
  10196. /**
  10197. * 是否在输入框获得焦点时,展开下拉窗口
  10198. * 默认:true
  10199. */
  10200. focus_drop_list: true,
  10201. /**
  10202. * 是否自动选择列表中的第一项内容(输入关键字查询模式,直接使用鼠标下拉并不触发)
  10203. * 默认:false
  10204. */
  10205. auto_select_first: false,
  10206. /**
  10207. * 是否自动填充内容
  10208. * 若有列表项目被高亮显示,在焦点离开控件后,自动设置该项为选中内容
  10209. * 默认:false
  10210. */
  10211. auto_fill_result: false,
  10212. /**
  10213. * 是否清空输入关键字
  10214. * 在输入框中输入内容进行查询,但没有匹配的内容返回,在焦点离开控件后,自动清空输入框输入的内容
  10215. * 默认:false
  10216. */
  10217. no_result_clean: false,
  10218. /**
  10219. * 列表项目显示内容格式化
  10220. * 参数类型:function
  10221. * 参数1:data,行数据object格式
  10222. * 返回:string
  10223. */
  10224. format_item: false,
  10225. /**
  10226. * 是否使用Formatter的text文本来填充文本框
  10227. */
  10228. format_fill: false,
  10229. /**
  10230. * 只选择模式
  10231. */
  10232. select_only: true,
  10233. }, option);
  10234. //特殊字段处理
  10235. $.each({data: 'source', key_field: 'primary_key', show_field: 'field', init_code: 'init_record', page_size: 'per_page'}, function (i, j) {
  10236. if (typeof option[i] !== 'undefined') {
  10237. option[j] = option[i];
  10238. delete option[i];
  10239. }
  10240. });
  10241. return option;
  10242. },
  10243. /**
  10244. * @private
  10245. * @desc 参数初始化后的调整
  10246. * @param {Object} option - 参数集
  10247. * @return {Object} - 处理后的参数集
  10248. */
  10249. _setOption2nd: function (option) {
  10250. //若没有设置搜索字段,则使用显示字段作为搜索字段
  10251. option.search_field = (option.search_field === undefined) ? option.field : option.search_field;
  10252. //统一大写
  10253. option.and_or = option.and_or.toUpperCase();
  10254. var arr = ['hide_field', 'show_field', 'search_field'];
  10255. for (var i = 0; i < arr.length; i++) {
  10256. option[arr[i]] = this._strToArray(option[arr[i]]);
  10257. }
  10258. //设置排序字段
  10259. option.order_by = (option.order_by === undefined) ? option.search_field : option.order_by;
  10260. //设置多字段排序
  10261. //例: [ ['id', 'ASC'], ['name', 'DESC'] ]
  10262. option.order_by = this._setOrderbyOption(option.order_by, option.field);
  10263. return option;
  10264. },
  10265. /**
  10266. * 设置峰驼至下划线
  10267. * @param {object} option
  10268. * @returns {object}
  10269. */
  10270. _setCamelcaseToUnderscore: function (option) {
  10271. $.each(option, function (i, j) {
  10272. var field = i.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();
  10273. if (field !== i) {
  10274. option[field] = j;
  10275. delete option[i];
  10276. }
  10277. });
  10278. return option;
  10279. },
  10280. /**
  10281. * @private
  10282. * @desc 字符串转换为数组
  10283. * @param {string} str - 字符串
  10284. * @return {Array} - 数组
  10285. */
  10286. _strToArray: function (str) {
  10287. if (!str)
  10288. return '';
  10289. return str.replace(/[\s ]+/g, '').split(',');
  10290. },
  10291. /**
  10292. * @private
  10293. * @desc 设置多字段排序
  10294. * @param {Array} arg_order - 排序顺序
  10295. * @param {string} arg_field - 字段
  10296. * @return {Array} - 处理后的排序字段内容
  10297. */
  10298. _setOrderbyOption: function (arg_order, arg_field) {
  10299. var arr = [], orders = [];
  10300. if (typeof arg_order == 'object') {
  10301. for (var i = 0; i < arg_order.length; i++) {
  10302. orders = $.trim(arg_order[i]).split(' ');
  10303. arr[i] = (orders.length == 2) ? orders : [orders[0], 'ASC'];
  10304. }
  10305. } else {
  10306. orders = $.trim(arg_order).split(' ');
  10307. arr[0] = (orders.length == 2) ? orders : (orders[0].match(/^(ASC|DESC)$/i)) ? [arg_field, orders[0]] : [orders[0], 'ASC'];
  10308. }
  10309. return arr;
  10310. },
  10311. /**
  10312. * @private
  10313. * @desc 界面文字国际化
  10314. */
  10315. _setLanguage: function () {
  10316. var message;
  10317. switch (this.option.lang) {
  10318. // English
  10319. case 'en':
  10320. message = {
  10321. add_btn: 'Add button',
  10322. add_title: 'add a box',
  10323. del_btn: 'Del button',
  10324. del_title: 'delete a box',
  10325. next: 'Next',
  10326. next_title: 'Next' + this.option.per_page + ' (Right key)',
  10327. prev: 'Prev',
  10328. prev_title: 'Prev' + this.option.per_page + ' (Left key)',
  10329. first_title: 'First (Shift + Left key)',
  10330. last_title: 'Last (Shift + Right key)',
  10331. get_all_btn: 'Get All (Down key)',
  10332. get_all_alt: '(button)',
  10333. close_btn: 'Close (Tab key)',
  10334. close_alt: '(button)',
  10335. loading: 'loading...',
  10336. loading_alt: '(loading)',
  10337. page_info: 'num_page_top - num_page_end of cnt_whole',
  10338. select_ng: 'Attention : Please choose from among the list.',
  10339. select_ok: 'OK : Correctly selected.',
  10340. not_found: 'not found',
  10341. ajax_error: 'An error occurred while connecting to server. (ajax-combobox)'
  10342. };
  10343. break;
  10344. // 中文
  10345. case 'cn':
  10346. message = {
  10347. add_btn: '添加按钮',
  10348. add_title: '添加区域',
  10349. del_btn: '删除按钮',
  10350. del_title: '删除区域',
  10351. next: '下一页',
  10352. next_title: '下' + this.option.per_page + ' (→)',
  10353. prev: '上一页',
  10354. prev_title: '上' + this.option.per_page + ' (←)',
  10355. first_title: '首页 (Shift + ←)',
  10356. last_title: '尾页 (Shift + →)',
  10357. get_all_btn: '获得全部 (↓)',
  10358. get_all_alt: '(按钮)',
  10359. close_btn: '关闭 (Tab键)',
  10360. close_alt: '(按钮)',
  10361. loading: '读取中...',
  10362. loading_alt: '(读取中)',
  10363. page_info: 'num_page_top - num_page_end (共 cnt_whole)',
  10364. select_ng: '请注意:请从列表中选择.',
  10365. select_ok: 'OK : 已经选择.',
  10366. not_found: '无查询结果',
  10367. ajax_error: '连接到服务器时发生错误!'
  10368. };
  10369. break;
  10370. }
  10371. this.message = message;
  10372. },
  10373. /**
  10374. * @private
  10375. * @desc CSS样式表名称字义
  10376. */
  10377. _setCssClass: function () {
  10378. var css_class = {
  10379. container: 'sp_container',
  10380. // SelectPage最外层DIV的打开状态
  10381. container_open: 'sp_container_open',
  10382. selected: 'sp_selected',
  10383. re_area: 'sp_result_area',
  10384. //标签及输入框的
  10385. element_box: 'sp_element_box',
  10386. // 分页导航
  10387. navi: 'pagination',
  10388. // 下拉结果列表
  10389. results: 'sp_results',
  10390. re_off: 'sp_results_off',
  10391. select: 'sp_over',
  10392. select_ok: 'sp_select_ok',
  10393. select_ng: 'sp_select_ng',
  10394. input_off: 'sp_input_off',
  10395. button: 'sp_button',
  10396. btn_on: 'sp_btn_on',
  10397. btn_out: 'sp_btn_out',
  10398. input: 'sp_input'
  10399. };
  10400. this.css_class = css_class;
  10401. },
  10402. /**
  10403. * @private
  10404. * @desc 设置属性默认值
  10405. */
  10406. _setProp: function () {
  10407. this.prop = {
  10408. is_suggest: false,
  10409. //当前页
  10410. page_all: 1,
  10411. page_suggest: 1,
  10412. //总页数
  10413. max_all: 1,
  10414. max_suggest: 1,
  10415. //正在分页状态
  10416. is_paging: false,
  10417. //是否正在Ajax请求
  10418. is_loading: false,
  10419. xhr: false,
  10420. //使用键盘进行分页
  10421. key_paging: false,
  10422. //使用键盘进行选择
  10423. key_select: false,
  10424. //上一个选择的项目值
  10425. prev_value: ''
  10426. };
  10427. this.template = {
  10428. tag: {
  10429. content: '<li class="selected_tag" itemvalue="#item_value#">#item_text#<span class="tag_close">&times;</span></li>',
  10430. textKey: '#item_text#',
  10431. valueKey: '#item_value#'
  10432. }
  10433. };
  10434. },
  10435. /**
  10436. * @private
  10437. * @desc 插件HTML结构生成
  10438. * @param {Object} combo_input - 输入框源对象
  10439. */
  10440. _setElem: function (combo_input, option) {
  10441. //如果当前元素有默认值,且init_record为false时自动从元素取
  10442. var value = $(combo_input).val();
  10443. if (value && !option.init_record) {
  10444. this.option.init_record = $.isArray(value) ? value.join(',') : value;
  10445. }
  10446. // 1. 生成、替换DOM对象
  10447. var elem = {};//本体
  10448. //将原始输入框中,用户设置的样式提取,并放到最外层的容器中,'class':''
  10449. var outerWidth = $(combo_input).outerWidth();
  10450. elem.combo_input = $(combo_input).attr({'autocomplete': 'off'}).addClass(this.css_class.input).wrap('<div>'); // This "div" is "container".
  10451. elem.container = $(elem.combo_input).parent().addClass(this.css_class.container);
  10452. elem.button = $('<div>').addClass(this.css_class.button);
  10453. //更换为bootstrap风格的向下三角箭头
  10454. elem.img = $('<span class="bs-caret"><span class="caret"></span></span>');
  10455. //多选模式下带标签显示及文本输入的组合框
  10456. elem.element_box = $('<ul>').addClass(this.css_class.element_box);
  10457. //结果集列表
  10458. elem.result_area = $('<div>').addClass(this.css_class.re_area);
  10459. //分页栏
  10460. elem.navi = $('<ul>').addClass(this.css_class.navi).addClass("hide");
  10461. //elem.navi_info = $('<div>').addClass('info');
  10462. //elem.navi_p = $('<p>');
  10463. elem.results = $('<ul>').addClass(this.css_class.results);
  10464. /**
  10465. * 将原输入框的Name交换到Hidden中,因为具体需要保存传递到后端的是ID,而非Title
  10466. */
  10467. var namePrefix = '_text';
  10468. //将primary_key的值放入"input:hidden"
  10469. var input_id = ($(elem.combo_input).attr('id') !== undefined) ? $(elem.combo_input).attr('id') : $(elem.combo_input).attr('name');
  10470. var input_name = ($(elem.combo_input).attr('name') !== undefined) ? $(elem.combo_input).attr('name') : 'selectPage';
  10471. var hidden_name = input_name,
  10472. hidden_id = input_id;
  10473. if (input_name.match(/\]$/))
  10474. input_name = input_name.replace(/\]?$/, namePrefix);
  10475. else
  10476. input_name += namePrefix;
  10477. if (input_id.match(/\]$/))
  10478. input_id = input_id.replace(/\]?$/, namePrefix);
  10479. else
  10480. input_id += namePrefix;
  10481. if ($(elem.combo_input).is("select")) {
  10482. //将输入框的Name与Hidden的Name进行交换,使得可以将项目的具体ID被保存到后端进行处理
  10483. elem.hidden = $('<select class="hide" />').attr({
  10484. name: hidden_name,
  10485. id: hidden_id
  10486. }).prop("multiple", $(elem.combo_input).prop("multiple")).empty();
  10487. var newinput = $('<input type="text" class="form-control" />').attr({
  10488. name: input_name,
  10489. id: input_id
  10490. }).addClass(this.css_class.input);
  10491. if (!option.source) {
  10492. var source = [];
  10493. $("option", elem.combo_input).each(function (i, j) {
  10494. source.push({id: i, name: $(this).text()});
  10495. });
  10496. this.option.source = source;
  10497. }
  10498. $(elem.combo_input).replaceWith(newinput);
  10499. elem.combo_input = newinput;
  10500. } else {
  10501. //将输入框的Name与Hidden的Name进行交换,使得可以将项目的具体ID被保存到后端进行处理
  10502. elem.hidden = $('<input type="hidden" class="hide" />').attr({
  10503. name: hidden_name,
  10504. id: hidden_id
  10505. }).val('');
  10506. $(elem.combo_input).attr({
  10507. name: input_name,
  10508. id: input_id
  10509. });
  10510. }
  10511. $(elem.hidden).addClass("selectpage-input-hidden");
  10512. // 2. DOM内容放置
  10513. $(elem.container).append(elem.button).append(elem.result_area).append(elem.hidden);
  10514. $(elem.button).append(elem.img);
  10515. $(elem.result_area).append(elem.results).append(elem.navi);
  10516. //多选模式下的特殊处理
  10517. if (option.multiple) {
  10518. $(elem.container).addClass('sp_container_combo');
  10519. $(elem.combo_input).addClass('sp_combo_input').before($(elem.element_box));
  10520. var li = $('<li>').addClass('input_box');
  10521. $(li).append($(elem.combo_input));
  10522. $(elem.element_box).append($(li));
  10523. if ($(elem.combo_input).attr('placeholder'))
  10524. $(elem.combo_input).attr('placeholder_bak', $(elem.combo_input).attr('placeholder'));
  10525. }
  10526. if ($(elem.container).parent().hasClass("input-group")) {
  10527. $(elem.container).height($(elem.container).parent().height());
  10528. }
  10529. this.elem = elem;
  10530. },
  10531. /**
  10532. * @private
  10533. * @desc 将控件的部分内容设置为默认状态
  10534. */
  10535. _setButtonAttrDefault: function () {
  10536. if (this.option.select_only) {
  10537. if ($(this.elem.combo_input).val() !== '') {
  10538. if ($(this.elem.hidden).val()) {
  10539. //选择条件
  10540. $(this.elem.combo_input).prop('title', this.message.select_ok).removeClass(this.css_class.select_ng).addClass(this.css_class.select_ok);
  10541. } else {
  10542. //输入方式
  10543. $(this.elem.combo_input).prop('title', this.message.select_ng).removeClass(this.css_class.select_ok).addClass(this.css_class.select_ng);
  10544. }
  10545. } else {
  10546. $(this.elem.combo_input).prop('title', '').removeClass(this.css_class.select_ng);
  10547. }
  10548. }
  10549. $(this.elem.button).prop('title', this.message.get_all_btn);
  10550. },
  10551. /**
  10552. * @private
  10553. * @desc 为插件设置初始化的选中值(若有指定的话)
  10554. */
  10555. _setInitRecord: function () {
  10556. var self = this;
  10557. //初始化外框宽度
  10558. //$(self.elem.container).width($(self.elem.combo_input).outerWidth());
  10559. if (this.option.init_record === false)
  10560. return;
  10561. // 初始的KEY值放入隐藏域
  10562. self._setHiddenValue(self.option.init_record);
  10563. //将初始值放入控件
  10564. if (typeof self.option.source == 'object') {
  10565. var data = new Array();
  10566. var keyarr = self.option.init_record.split(',');
  10567. $.each(keyarr, function (index, row) {
  10568. for (var i = 0; i < self.option.source.length; i++) {
  10569. if (self.option.source[i][self.option.primary_key] == row) {
  10570. data.push(self.option.source[i]);
  10571. break;
  10572. }
  10573. }
  10574. });
  10575. //在单选模式下,若使用了多选模式的初始化值(“key1,key2,...”多选方式),则不进行初始化选中操作
  10576. if (!self.option.multiple && data.length > 1)
  10577. data = null;
  10578. self._afterInit(self, data);
  10579. } else {
  10580. var _paramsFunc = self.option.params;
  10581. var _params = {};
  10582. //原始参数
  10583. var _orgParams = {
  10584. field: self.option.field,
  10585. order_by: self.option.order_by,
  10586. pkey_name: self.option.primary_key,
  10587. pkey_value: self.option.init_record
  10588. };
  10589. if (_paramsFunc) {
  10590. var result = $.isFunction(_paramsFunc) ? _paramsFunc() : _paramsFunc;
  10591. if (result && $.isPlainObject(result)) {
  10592. _params = $.extend({}, _orgParams, result);
  10593. } else {
  10594. _params = _orgParams;
  10595. }
  10596. } else {
  10597. _params = _orgParams;
  10598. }
  10599. $.ajax({
  10600. dataType: 'json',
  10601. url: self.option.source,
  10602. data: _params,
  10603. success: function (returnData) {
  10604. if (typeof returnData.list === 'undefined' || !$.isArray(returnData.list)) {
  10605. if (typeof returnData.rows === 'undefined' || !$.isArray(returnData.rows)) {
  10606. self.prop.xhr = null;
  10607. self._notFoundSearch(self);
  10608. return;
  10609. } else {
  10610. returnData.list = returnData.rows;
  10611. }
  10612. }
  10613. if (typeof returnData.total === 'undefined') {
  10614. returnData.total = returnData.list.length;
  10615. }
  10616. self._afterInit(self, returnData.list);
  10617. },
  10618. error: function (jqXHR, textStatus, errorThrown) {
  10619. self._ajaxErrorNotify(self, errorThrown);
  10620. }
  10621. });
  10622. }
  10623. },
  10624. /**
  10625. * @private
  10626. * @desc 初始化后的处理
  10627. * @param {Object} self - 插件的内部对象
  10628. * @param {Object} data - 列表数据
  10629. */
  10630. _afterInit: function (self, data) {
  10631. if (!data)
  10632. return;
  10633. if (!$.isArray(data))
  10634. data = [data];
  10635. if (self.option.multiple) {//多选模式初始化
  10636. $(self.elem.combo_input).val('');
  10637. $.each(data, function (i, row) {
  10638. var item = {text: row[self.option.field], value: row[self.option.primary_key]};
  10639. if (!self._isAlreadySelected(self, item))
  10640. self._addNewTag(self, item);
  10641. });
  10642. self._tagValuesSet(self);
  10643. self._inputResize(self);
  10644. } else {//单选模式初始化
  10645. var row = data[0];
  10646. $(self.elem.combo_input).val(row[self.option.field]);
  10647. self._setHiddenValue(row[self.option.primary_key]);
  10648. self.prop.prev_value = row[self.option.field];
  10649. if (self.option.select_only) {
  10650. $(self.elem.combo_input).attr('title', self.message.select_ok).removeClass(self.css_class.select_ng).addClass(self.css_class.select_ok);
  10651. }
  10652. }
  10653. },
  10654. /**
  10655. * @private
  10656. * @desc 下拉按钮的事件处理
  10657. */
  10658. _ehButton: function () {
  10659. var self = this;
  10660. $(self.elem.button).mouseup(function (ev) {
  10661. if ($(self.elem.result_area).is(':hidden') && !$(self.elem.combo_input).prop('disabled')) {
  10662. //self.prop.is_suggest = false;
  10663. //self._checkValue(self);
  10664. //self._suggest(self);
  10665. $(self.elem.combo_input).focus();
  10666. } else {
  10667. self._hideResults(self);
  10668. }
  10669. ev.stopPropagation();
  10670. }).mouseover(function () {
  10671. $(self.elem.button).addClass(self.css_class.btn_on).removeClass(self.css_class.btn_out);
  10672. }).mouseout(function () {
  10673. $(self.elem.button).addClass(self.css_class.btn_out).removeClass(self.css_class.btn_on);
  10674. }).mouseout(); // default: mouseout
  10675. },
  10676. /**
  10677. * @private
  10678. * @desc 输入框的事件绑定
  10679. */
  10680. _ehComboInput: function () {
  10681. var self = this;
  10682. $(self.elem.combo_input).keyup(function (ev) {
  10683. self._processKey(self, ev);
  10684. }).keydown(function (e) {
  10685. if (e.keyCode === 8 && self.option.multiple && $(self.elem.combo_input).val() == '') {
  10686. $(self.elem.combo_input).parent().prev().find(".tag_close").trigger("click");
  10687. }
  10688. }).focus(function (e) {
  10689. //增加输入框获得焦点后,显示数据列表
  10690. if ($(self.elem.result_area).is(':hidden')) {
  10691. e.stopPropagation();
  10692. self.elem.navi.addClass("hide");
  10693. self.prop.first_show = true;
  10694. self.prop.page_move = false;
  10695. //self._checkValue(self);
  10696. self.prop.is_suggest = false;
  10697. self._suggest(self);
  10698. //self.prop.first_show = false;
  10699. }
  10700. }).click(function () {
  10701. self._setCssFocusedInput(self);
  10702. //该句会去除当前高亮项目的显示,暂时屏蔽
  10703. //$(self.elem.results).children('li').removeClass(self.css_class.select);
  10704. }).blur(function () {
  10705. $(self.elem.hidden).trigger("blur");
  10706. });
  10707. if (self.option.multiple) {
  10708. $(self.elem.element_box).click(function (e) {
  10709. var srcEl = e.target || e.srcElement;
  10710. if ($(srcEl).is('ul'))
  10711. $(self.elem.combo_input).focus();
  10712. });
  10713. //标签关闭操作
  10714. //关闭同时需要将该标签的key从已保存的隐藏域中删除
  10715. $(self.elem.element_box).on('click', 'span.tag_close', function () {
  10716. var li = $(this).closest('li');
  10717. var key = $(li).attr('itemvalue');
  10718. var keys = $(self.elem.hidden).val();
  10719. //从已保存的key列表中删除该标签对应的项目
  10720. if ($.type(key) != 'undefined' && keys) {
  10721. var keyarr = $.isArray(keys) ? keys : (keys ? keys.split(',') : new Array());
  10722. var index = $.inArray(key.toString(), keyarr);
  10723. if (index != -1) {
  10724. keyarr.splice(index, 1);
  10725. self._setHiddenValue(keyarr.toString());
  10726. }
  10727. }
  10728. $(li).remove();
  10729. self._inputResize(self);
  10730. $("li[pkey='" + key + "']", self.elem.results).removeClass(self.css_class.selected);
  10731. });
  10732. self._inputResize(self);
  10733. }
  10734. },
  10735. /**
  10736. * 设置隐藏元素的值
  10737. * @param {type} value
  10738. * @returns {undefined}
  10739. */
  10740. _setHiddenValue: function (value) {
  10741. var self = this;
  10742. if ($(self.elem.hidden).is("select")) {
  10743. $(self.elem.hidden).empty();
  10744. value = $.isArray(value) ? value : ($(self.elem.hidden).prop("multiple") ? (value + "").split(",") : value);
  10745. $.each(value, function (i, j) {
  10746. $(self.elem.hidden).append($("<option />").prop("selected", true).val(j).text(j));
  10747. });
  10748. } else {
  10749. value = $.isArray(value) ? value.join(",") : value;
  10750. $(self.elem.hidden).val(value);
  10751. }
  10752. },
  10753. /**
  10754. * @private
  10755. * @desc 插件整体的事件处理
  10756. */
  10757. _ehWhole: function () {
  10758. var self = this;
  10759. //如果是点击了控件本身则不响应外部鼠标点击事件
  10760. $(self.elem.container).mousedown(function () {
  10761. var thisindex = $('div.sp_container').index(this);
  10762. var lastindex = $(document.body).data(constants.objStatusIndex);
  10763. if (lastindex != undefined && thisindex != lastindex) {
  10764. $(document.body).data(constants.objStatusKey, false);
  10765. } else {
  10766. $(document.body).data(constants.objStatusKey, true);
  10767. }
  10768. $(document.body).data(constants.objStatusIndex, thisindex);
  10769. });
  10770. //控件外部的鼠标点击事件处理
  10771. $(document).off('mousedown.selectPage').on('mousedown.selectPage', function (e) {
  10772. if ($(document.body).data(constants.objStatusKey))
  10773. $(document.body).data(constants.objStatusKey, false);
  10774. else {
  10775. //清除内容
  10776. var cleanContent = function (obj) {
  10777. $(obj.elem.combo_input).val('');
  10778. if (!obj.option.multiple)
  10779. $(obj.elem.hidden).val('');
  10780. };
  10781. $('div.sp_container').each(function () {
  10782. var d = $(this).data(constants.dataKey);
  10783. //列表是打开的状态
  10784. if ($(this).hasClass(d.css_class.container_open)) {
  10785. //若控件已有选中的的项目,而文本输入框中清空了关键字,则清空控件已选中的项目
  10786. if (!$(d.elem.combo_input).val() && $(d.elem.hidden).val() && !d.option.multiple) {
  10787. d.prop.page_all = 1;//重置当前页为1
  10788. cleanContent(d);
  10789. d._hideResults(d);
  10790. return true;
  10791. }
  10792. //匹配项且高亮时,下拉分页控件失去焦点后,自动选择该项目
  10793. if ($('li', $(d.elem.results)).size() > 0) {
  10794. if (d.option.auto_fill_result) {//打开自动内容填充功能
  10795. //若已有选中项目,则直接隐藏列表
  10796. if ($('li.sp_selected', $(d.elem.results)).size() > 0) {
  10797. d._hideResults(d);
  10798. } else if ($('li.sp_over', $(d.elem.results)).size() > 0) {
  10799. //若控件已有选中的值,则忽略高亮的项目
  10800. if ($(d.elem.hidden).val())
  10801. d._hideResults(d);
  10802. //若没有已选中的项目,且列表中有高亮项目时,选中当前高亮的行
  10803. else
  10804. d._selectCurrentLine(d, true);
  10805. } else if (d.option.auto_select_first) {
  10806. //若控件已有选中的值,则忽略自动选择第一项的功能
  10807. if ($(d.elem.hidden).val())
  10808. d._hideResults(d);
  10809. else {
  10810. //对于没有选中,没有高亮的情况,若插件设置了自动选中第一项时,则选中第一项
  10811. d._nextLine(d);
  10812. //self._nextLine(self);
  10813. d._selectCurrentLine(d, true);
  10814. }
  10815. } else {
  10816. d._hideResults(d);
  10817. }
  10818. } else
  10819. d._hideResults(d);
  10820. } else {
  10821. //无匹配项目时,自动清空用户输入的关键词
  10822. if (d.option.no_result_clean)
  10823. cleanContent(d);
  10824. else {
  10825. if (!d.option.multiple)
  10826. $(d.elem.hidden).val('');
  10827. }
  10828. d._hideResults(d);
  10829. }
  10830. }
  10831. });
  10832. }
  10833. });
  10834. },
  10835. /**
  10836. * @private
  10837. * @desc 结果列表的事件处理
  10838. */
  10839. _ehResults: function () {
  10840. var self = this;
  10841. $(self.elem.results).children('li').mouseover(function () {
  10842. if (self.prop.key_select) {
  10843. self.prop.key_select = false;
  10844. return;
  10845. }
  10846. $(self.elem.results).children('li').removeClass(self.css_class.select);
  10847. $(this).addClass(self.css_class.select);
  10848. self._setCssFocusedResults(self);
  10849. }).click(function (e) {
  10850. if (self.prop.key_select) {
  10851. self.prop.key_select = false;
  10852. return;
  10853. }
  10854. e.preventDefault();
  10855. e.stopPropagation();
  10856. self._selectCurrentLine(self, false);
  10857. });
  10858. },
  10859. /**
  10860. * @private
  10861. * @desc 分页导航按钮的事件处理
  10862. * @param {Object} self - 插件内部对象
  10863. */
  10864. _ehNaviPaging: function (self) {
  10865. $('li.csFirstPage', $(self.elem.navi)).off('click').on('click', function (ev) {
  10866. $(self.elem.combo_input).focus();
  10867. ev.preventDefault();
  10868. self._firstPage(self);
  10869. });
  10870. $('li.csPreviousPage', $(self.elem.navi)).off('click').on('click', function (ev) {
  10871. $(self.elem.combo_input).focus();
  10872. ev.preventDefault();
  10873. self._prevPage(self);
  10874. });
  10875. // the number of page
  10876. /*
  10877. $(self.elem.navi).find('.navi_page').mouseup(function(ev) {
  10878. $(self.elem.combo_input).focus();
  10879. ev.preventDefault();
  10880. if (!self.prop.is_suggest) self.prop.page_all = parseInt($(this).text(), 10);
  10881. else self.prop.page_suggest = parseInt($(this).text(), 10);
  10882. self.prop.is_paging = true;
  10883. self._suggest(self);
  10884. });
  10885. */
  10886. $('li.csNextPage', $(self.elem.navi)).off('click').on('click', function (ev) {
  10887. $(self.elem.combo_input).focus();
  10888. ev.preventDefault();
  10889. self._nextPage(self);
  10890. });
  10891. $('li.csLastPage', $(self.elem.navi)).off('click').on('click', function (ev) {
  10892. $(self.elem.combo_input).focus();
  10893. ev.preventDefault();
  10894. self._lastPage(self);
  10895. });
  10896. },
  10897. /**
  10898. * @private
  10899. * @desc Ajax请求失败的处理
  10900. * @param {Object} self - 插件内部对象
  10901. * @errorThrom {string} errorThrown - Ajax的错误输出内容
  10902. */
  10903. _ajaxErrorNotify: function (self, errorThrown) {
  10904. console.log(self.message.ajax_error);
  10905. },
  10906. /**
  10907. * @private
  10908. * @desc 窗口滚动处理
  10909. * @param {Object} self - 插件内部对象
  10910. * @param {boolean} enforce - 是否定位到输入框的位置
  10911. */
  10912. _scrollWindow: function (self, enforce) {
  10913. var current_result = self._getCurrentLine(self);
  10914. var target_top = (current_result && !enforce) ? current_result.offset().top : $(self.elem.container).offset().top;
  10915. var target_size;
  10916. self.prop.size_li = $(self.elem.results).children('li:first').outerHeight();
  10917. target_size = self.prop.size_li;
  10918. var client_height = $(window).height();
  10919. var scroll_top = $(window).scrollTop();
  10920. var scroll_bottom = scroll_top + client_height - target_size;
  10921. // 滚动处理
  10922. var gap;
  10923. if ($(current_result).length) {
  10924. if (target_top < scroll_top || target_size > client_height) {
  10925. //滚动到顶部
  10926. gap = target_top - scroll_top;
  10927. } else if (target_top > scroll_bottom) {
  10928. //向下滚动
  10929. gap = target_top - scroll_bottom;
  10930. } else {
  10931. //不进行滚动
  10932. return;
  10933. }
  10934. } else if (target_top < scroll_top)
  10935. gap = target_top - scroll_top;
  10936. window.scrollBy(0, gap);
  10937. },
  10938. /**
  10939. * @private
  10940. * @desc 输入框获得焦点的样式设置
  10941. * @param {Object} self - 插件内部对象
  10942. */
  10943. _setCssFocusedInput: function (self) {
  10944. $(self.elem.results).addClass(self.css_class.re_off);
  10945. $(self.elem.combo_input).removeClass(self.css_class.input_off);
  10946. },
  10947. /**
  10948. * @private
  10949. * @desc 设置结果列表高亮,输入框失去焦点
  10950. * @param {Object} self - 插件内部对象
  10951. */
  10952. _setCssFocusedResults: function (self) {
  10953. $(self.elem.results).removeClass(self.css_class.re_off);
  10954. $(self.elem.combo_input).addClass(self.css_class.input_off);
  10955. },
  10956. /**
  10957. * @private
  10958. * @desc 输入框输入值的变化监控
  10959. * @param {Object} self - 插件内部对象
  10960. */
  10961. _checkValue: function (self) {
  10962. var now_value = $(self.elem.combo_input).val();
  10963. if (now_value != self.prop.prev_value) {
  10964. self.prop.prev_value = now_value;
  10965. self.prop.first_show = false;
  10966. //原来的设计是在值变化时,都会清空隐藏域的内容,目前去除该功能
  10967. //if (self.option.plugin_type != 'textarea') $(self.elem.hidden).val('');
  10968. if (self.option.select_only)
  10969. self._setButtonAttrDefault();
  10970. //重置页数
  10971. self.prop.page_suggest = 1;
  10972. self.prop.is_suggest = true;
  10973. self._suggest(self);
  10974. }
  10975. },
  10976. /**
  10977. * @private
  10978. * @desc 文本输入框键盘事件处理
  10979. * @param {Object} self - 插件内部对象
  10980. * @param {Object} e - 事件event对象
  10981. */
  10982. _processKey: function (self, e) {
  10983. if (($.inArray(e.keyCode, [27, 38, 40, 9]) > -1 && $(self.elem.result_area).is(':visible')) || ($.inArray(e.keyCode, [37, 39, 13, 9]) > -1 && self._getCurrentLine(self)) || (e.keyCode == 40)) {
  10984. e.preventDefault();
  10985. e.stopPropagation();
  10986. e.cancelBubble = true;
  10987. e.returnValue = false;
  10988. switch (e.keyCode) {
  10989. case 37:
  10990. // left
  10991. if (e.shiftKey)
  10992. self._firstPage(self);
  10993. else
  10994. self._prevPage(self);
  10995. break;
  10996. case 38:
  10997. // up
  10998. self.prop.key_select = true;
  10999. self._prevLine(self);
  11000. break;
  11001. case 39:
  11002. // right
  11003. if (e.shiftKey)
  11004. self._lastPage(self);
  11005. else
  11006. self._nextPage(self);
  11007. break;
  11008. case 40:
  11009. // down
  11010. if ($(self.elem.results).children('li').length) {
  11011. self.prop.key_select = true;
  11012. self._nextLine(self);
  11013. } else {
  11014. self.prop.is_suggest = false;
  11015. self._suggest(self);
  11016. }
  11017. break;
  11018. case 9:
  11019. // tab
  11020. self.prop.key_paging = true;
  11021. self._selectCurrentLine(self, true);
  11022. //self._hideResults(self);
  11023. break;
  11024. case 13:
  11025. // return
  11026. self._selectCurrentLine(self, true);
  11027. break;
  11028. case 27:
  11029. // escape
  11030. self.prop.key_paging = true;
  11031. self._hideResults(self);
  11032. break;
  11033. }
  11034. } else {
  11035. if (e.keyCode != 16)
  11036. self._setCssFocusedInput(self); // except Shift(16)
  11037. self._inputResize(self);
  11038. self._checkValue(self);
  11039. }
  11040. },
  11041. /**
  11042. * @private
  11043. * @desc 中断Ajax请求
  11044. * @param {Object} self - 插件内部对象
  11045. */
  11046. _abortAjax: function (self) {
  11047. if (self.prop.xhr) {
  11048. self.prop.xhr.abort();
  11049. self.prop.xhr = false;
  11050. }
  11051. },
  11052. /**
  11053. * @private
  11054. * @desc 数据查询
  11055. * @param {Object} self - 插件内部对象
  11056. */
  11057. _suggest: function (self) {
  11058. //搜索关键字
  11059. var q_word;
  11060. //q_word = (self.prop.is_suggest) ? $.trim($(self.elem.combo_input).val()) : '';
  11061. //q_word = $.trim($(self.elem.combo_input).val());
  11062. q_word = (self.prop.first_show) ? '' : $.trim($(self.elem.combo_input).val());
  11063. /*
  11064. //取消在输入状态时,判断到输入框里内容为空时,隐藏下拉列表的操作
  11065. if (q_word.length < 1 && self.prop.is_suggest) {
  11066. self._hideResults(self);
  11067. return;
  11068. }
  11069. */
  11070. q_word = q_word.split(/[\s ]+/);
  11071. self._abortAjax(self);
  11072. self._setLoading(self);
  11073. if (self.prop.is_paging) {
  11074. var obj = self._getCurrentLine(self);
  11075. self.prop.is_paging = (obj) ? $(self.elem.results).children('li').index(obj) : -1;
  11076. } else if (!self.prop.is_suggest) {
  11077. self.prop.is_paging = 0;
  11078. }
  11079. //var which_page_num = (self.prop.is_suggest) ? self.prop.page_suggest: self.prop.page_all;
  11080. //var which_page_num = (q_word == '' && !self.prop.page_move) ? 1 : self.prop.page_all;
  11081. //var which_page_num = (self.prop.first_show) ? 1 : self.prop.page_all;
  11082. var which_page_num = self.prop.page_all;
  11083. // 数据查询
  11084. if (typeof self.option.source == 'object')
  11085. self._searchForJson(self, q_word, which_page_num);
  11086. else
  11087. self._searchForDb(self, q_word, which_page_num);
  11088. },
  11089. /**
  11090. * @private
  11091. * @desc 读取中状态显示
  11092. * @param {Object} self - 插件内部对象
  11093. */
  11094. _setLoading: function (self) {
  11095. $(self.elem.navi_info).text(self.message.loading);
  11096. if ($(self.elem.results).html() === '') {
  11097. $(self.elem.navi).children('p').empty();
  11098. self._calcWidthResults(self);
  11099. $(self.elem.container).addClass(self.css_class.container_open);
  11100. }
  11101. },
  11102. /**
  11103. * @private
  11104. * @desc 服务端数据查询
  11105. * @param {Object} self - 插件内部对象
  11106. * @param {Array} q_word - 查询关键字
  11107. * @param {number} which_page_num - 目标页
  11108. */
  11109. _searchForDb: function (self, q_word, which_page_num) {
  11110. /**
  11111. * 增加自定义查询参数
  11112. */
  11113. var _paramsFunc = self.option.params;
  11114. var _params = {};
  11115. //原始参数
  11116. var searchKey = self.option.search_field;
  11117. var _orgParams = {
  11118. q_word: q_word,
  11119. page: which_page_num,
  11120. per_page: self.option.per_page,
  11121. and_or: self.option.and_or,
  11122. order_by: self.option.order_by,
  11123. field: self.option.field,
  11124. pkey_name: self.option.primary_key,
  11125. search_field: searchKey
  11126. };
  11127. _orgParams[searchKey] = q_word[0];
  11128. if (_paramsFunc) {
  11129. var result = $.isFunction(_paramsFunc) ? _paramsFunc() : _paramsFunc;
  11130. if (result && $.isPlainObject(result)) {
  11131. _params = $.extend({}, _orgParams, result);
  11132. } else {
  11133. _params = _orgParams;
  11134. }
  11135. } else {
  11136. _params = _orgParams;
  11137. }
  11138. //增加自定义查询参数End
  11139. self.prop.xhr = $.ajax({
  11140. dataType: 'json',
  11141. url: self.option.source,
  11142. data: _params,
  11143. success: function (returnData) {
  11144. if (typeof returnData.list === 'undefined' || !$.isArray(returnData.list)) {
  11145. if (typeof returnData.rows === 'undefined' || !$.isArray(returnData.rows)) {
  11146. self.prop.xhr = null;
  11147. self._notFoundSearch(self);
  11148. return;
  11149. } else {
  11150. returnData.list = returnData.rows;
  11151. }
  11152. }
  11153. if (typeof returnData.total === 'undefined') {
  11154. returnData.total = returnData.list.length;
  11155. }
  11156. //数据结构处理
  11157. var json = {};
  11158. json.originalResult = returnData.list;
  11159. json.cnt_whole = returnData.total;
  11160. json.candidate = [];
  11161. json.primary_key = [];
  11162. json.cnt_page = json.originalResult.length;
  11163. for (var i = 0; i < json.cnt_page; i++) {
  11164. for (var key in json.originalResult[i]) {
  11165. if (key == self.option.primary_key) {
  11166. json.primary_key.push(json.originalResult[i][key]);
  11167. }
  11168. if (key == self.option.field) {
  11169. json.candidate.push(json.originalResult[i][key]);
  11170. }
  11171. }
  11172. }
  11173. self._prepareResults(self, json, q_word, which_page_num);
  11174. },
  11175. error: function (jqXHR, textStatus, errorThrown) {
  11176. if (textStatus != 'abort') {
  11177. self._hideResults(self);
  11178. self._ajaxErrorNotify(self, errorThrown);
  11179. }
  11180. },
  11181. complete: function () {
  11182. self.prop.xhr = null;
  11183. }
  11184. });
  11185. },
  11186. /**
  11187. * @private
  11188. * @desc 对JSON源数据进行搜索
  11189. * @param {Object} self - 插件内部对象
  11190. * @param {Array} q_word - 搜索关键字
  11191. * @param {number} which_page_num - 目标页数
  11192. */
  11193. _searchForJson: function (self, q_word, which_page_num) {
  11194. var matched = [];
  11195. var esc_q = [];
  11196. var sorted = [];
  11197. var json = {};
  11198. var i = 0;
  11199. var arr_reg = [];
  11200. //查询条件过滤
  11201. do {
  11202. //'/\W/g'正则代表全部不是字母,数字,下划线,汉字的字符
  11203. //将非法字符进行转义
  11204. esc_q[i] = q_word[i].replace(/\W/g, '\\$&').toString();
  11205. arr_reg[i] = new RegExp(esc_q[i], 'gi');
  11206. i++;
  11207. } while (i < q_word.length);
  11208. // SELECT * FROM source WHERE field LIKE q_word;
  11209. for (i = 0; i < self.option.source.length; i++) {
  11210. var flag = false;
  11211. var row = self.option.source[i];
  11212. for (var j = 0; j < arr_reg.length; j++) {
  11213. var itemText = row[self.option.field];//默认获取showField字段的文本
  11214. if (self.option.format_item && $.isFunction(self.option.format_item))
  11215. itemText = self.option.format_item(row);
  11216. if (itemText.match(arr_reg[j])) {
  11217. flag = true;
  11218. if (self.option.and_or == 'OR')
  11219. break;
  11220. } else {
  11221. flag = false;
  11222. if (self.option.and_or == 'AND')
  11223. break;
  11224. }
  11225. }
  11226. if (flag)
  11227. matched.push(row);
  11228. }
  11229. //若没有匹配项目,则结束搜索
  11230. if (matched.length === undefined) {
  11231. self._notFoundSearch(self);
  11232. return;
  11233. }
  11234. json.cnt_whole = matched.length;
  11235. // (CASE WHEN ...) 然后 く order 指定列
  11236. var reg1 = new RegExp('^' + esc_q[0] + '$', 'gi');
  11237. var reg2 = new RegExp('^' + esc_q[0], 'gi');
  11238. var matched1 = [];
  11239. var matched2 = [];
  11240. var matched3 = [];
  11241. for (i = 0; i < matched.length; i++) {
  11242. if (matched[i][self.option.order_by[0][0]].match(reg1)) {
  11243. matched1.push(matched[i]);
  11244. } else if (matched[i][self.option.order_by[0][0]].match(reg2)) {
  11245. matched2.push(matched[i]);
  11246. } else {
  11247. matched3.push(matched[i]);
  11248. }
  11249. }
  11250. if (self.option.order_by[0][1].match(/^asc$/i)) {
  11251. matched1 = self._sortAsc(self, matched1);
  11252. matched2 = self._sortAsc(self, matched2);
  11253. matched3 = self._sortAsc(self, matched3);
  11254. } else {
  11255. matched1 = self._sortDesc(self, matched1);
  11256. matched2 = self._sortDesc(self, matched2);
  11257. matched3 = self._sortDesc(self, matched3);
  11258. }
  11259. sorted = sorted.concat(matched1).concat(matched2).concat(matched3);
  11260. //page_move参数用于区别数据加载是在初始化列表还是在进行分页的翻页操作
  11261. if (!self.prop.page_move) {
  11262. //仅单选模式进行选中项目定位页功能
  11263. if (!self.option.multiple) {
  11264. //若控件当前已有选中值,则获得该项目所在的页数,并跳转到该页进行显示
  11265. var currentValue = $(self.elem.hidden).val();
  11266. if (typeof (currentValue) != 'undefined' && $.trim(currentValue) != '') {
  11267. var index = 0;
  11268. $.each(sorted, function (i, row) {
  11269. if (row[self.option.primary_key] == currentValue) {
  11270. index = i + 1;
  11271. return false;
  11272. }
  11273. });
  11274. which_page_num = Math.ceil(index / self.option.per_page);
  11275. if (which_page_num < 1)
  11276. which_page_num = 1;
  11277. self.prop.page_all = which_page_num;
  11278. }
  11279. }
  11280. } else {
  11281. //过滤后的数据个数不足一页显示的个数时,强制设置页码
  11282. if (sorted.length <= ((which_page_num - 1) * self.option.per_page)) {
  11283. which_page_num = 1;
  11284. self.prop.page_all = 1;
  11285. }
  11286. }
  11287. // LIMIT xx OFFSET xx
  11288. var start = (which_page_num - 1) * self.option.per_page;
  11289. var end = start + self.option.per_page;
  11290. //储存原始行数据,包括所有属性
  11291. json.originalResult = [];
  11292. // 查询后的数据处理
  11293. for (i = start; i < end; i++) {
  11294. if (sorted[i] === undefined)
  11295. break;
  11296. json.originalResult.push(sorted[i]);
  11297. for (var key in sorted[i]) {
  11298. if (key == self.option.primary_key) {
  11299. if (json.primary_key === undefined)
  11300. json.primary_key = [];
  11301. json.primary_key.push(sorted[i][key]);
  11302. }
  11303. if (key == self.option.field) {
  11304. if (json.candidate === undefined)
  11305. json.candidate = [];
  11306. json.candidate.push(sorted[i][key]);
  11307. }
  11308. }
  11309. }
  11310. if (json.candidate === undefined)
  11311. json.candidate = [];
  11312. json.cnt_page = json.candidate.length;
  11313. self._prepareResults(self, json, q_word, which_page_num);
  11314. },
  11315. /**
  11316. * @private
  11317. * @desc 升充排序
  11318. * @param {Object} self - 插件内部对象
  11319. * @param {Array} arr - 结果集数组
  11320. */
  11321. _sortAsc: function (self, arr) {
  11322. arr.sort(function (a, b) {
  11323. return a[self.option.order_by[0][0]].localeCompare(b[self.option.order_by[0][0]]);
  11324. });
  11325. return arr;
  11326. },
  11327. /**
  11328. * @private
  11329. * @desc 降充排序
  11330. * @param {Object} self - 插件内部对象
  11331. * @param {Array} arr - 结果集数组
  11332. */
  11333. _sortDesc: function (self, arr) {
  11334. arr.sort(function (a, b) {
  11335. return b[self.option.order_by[0][0]].localeCompare(a[self.option.order_by[0][0]]);
  11336. });
  11337. return arr;
  11338. },
  11339. /**
  11340. * @private
  11341. * @desc 查询无结果的处理
  11342. * @param {Object} self - 插件内部对象
  11343. */
  11344. _notFoundSearch: function (self) {
  11345. $(self.elem.navi_info).text(self.message.not_found);
  11346. $(self.elem.navi_p).hide();
  11347. $(self.elem.results).empty();
  11348. self._calcWidthResults(self);
  11349. $(self.elem.container).addClass(self.css_class.container_open);
  11350. self._setCssFocusedInput(self);
  11351. },
  11352. /**
  11353. * @private
  11354. * @desc 查询结果处理
  11355. * @param {Object} self - 插件内部对象
  11356. * @param {Object} json - 数据结果
  11357. * @param {Array} q_word - 查询关键字
  11358. * @param {number} which_page_num - 目标页
  11359. */
  11360. _prepareResults: function (self, json, q_word, which_page_num) {
  11361. //处理分页栏
  11362. self._setNavi(self, json.cnt_whole, json.cnt_page, which_page_num);
  11363. if (!json.primary_key)
  11364. json.primary_key = false;
  11365. //仅选择模式
  11366. if (self.option.select_only && json.candidate.length === 1 && json.candidate[0] == q_word[0]) {
  11367. self._setHiddenValue(json.primary_key[0]);
  11368. this._setButtonAttrDefault();
  11369. }
  11370. //是否是输入关键词进行查找
  11371. var is_query = false;
  11372. if (q_word && q_word.length > 0 && q_word[0])
  11373. is_query = true;
  11374. //显示结果列表
  11375. self._displayResults(self, json, is_query);
  11376. if (self.prop.is_paging === false)
  11377. self._setCssFocusedInput(self);
  11378. else {
  11379. //修复单选模式下如果有选择项,则高亮选中项,而不是高亮第一项
  11380. if (!self.option.multiple) {
  11381. var liSelected = $('li.sp_selected', $(self.elem.results));
  11382. if ($(liSelected).size() == 0) {
  11383. var idx = self.prop.is_paging;
  11384. var limit = $(self.elem.results).children('li').length - 1;
  11385. if (idx > limit)
  11386. idx = limit;
  11387. var obj = $(self.elem.results).children('li').eq(idx);
  11388. $(obj).addClass(self.css_class.select);
  11389. } else
  11390. $(liSelected).addClass(self.css_class.select);
  11391. }
  11392. self.prop.is_paging = false; //重置参数,为下次做准备
  11393. self._setCssFocusedResults(self);
  11394. }
  11395. },
  11396. /**
  11397. * @private
  11398. * @desc 生成分页栏
  11399. * @param {Object} self - 插件内部对象
  11400. * @param {number} cnt_whole - 数据总条数
  11401. * @param {number} cnt_page - 页面显示记录数
  11402. * @param {number} page_num - 当前页数
  11403. */
  11404. _setNavi: function (self, cnt_whole, cnt_page, page_num) {
  11405. /**
  11406. * 生成分页条
  11407. */
  11408. var buildPageNav = function (self, pagebar, page_num, last_page) {
  11409. if ($('li', $(pagebar)).size() == 0) {
  11410. $(pagebar).empty();
  11411. //处理当当前页码为1时,首页和上一页按钮不允许点击
  11412. var btnclass = '', isNewFontAwesome = true;
  11413. //判断是否使用了font-awesome3.2.1
  11414. $.each(document.styleSheets, function (i, n) {
  11415. if (n && n.href && n.href.indexOf('font-awesome-3.2.1') != -1) {
  11416. isNewFontAwesome = false;
  11417. return false;
  11418. }
  11419. });
  11420. //为不同版本图标设置样式
  11421. var iconFist = 'fa fa-step-backward', iconPrev = 'fa fa-backward', iconNext = 'fa fa-forward', iconLast = 'fa fa-step-forward';
  11422. if (!isNewFontAwesome) {
  11423. iconFist = 'icon-step-backward';
  11424. iconPrev = 'icon-backward';
  11425. iconNext = 'icon-forward';
  11426. iconLast = 'icon-step-forward';
  11427. }
  11428. if (page_num == 1)
  11429. btnclass = ' disabled ';
  11430. //首页
  11431. $(pagebar).append('<li class="csFirstPage' + btnclass + '" title="' + self.message.first_title + '" ><a href="javascript:void(0);"> <i class="' + iconFist + '"></i> </a></li>');
  11432. //上一页
  11433. $(pagebar).append('<li class="csPreviousPage' + btnclass + '" title="' + self.message.prev_title + '" ><a href="javascript:void(0);"><i class="' + iconPrev + '"></i></a></li>');
  11434. var pageInfo = '第 ' + page_num + ' 页(共' + last_page + '页)';
  11435. //设置分页信息
  11436. $(pagebar).append('<li class="disabled pageInfoBox"><a href="javascript:void(0);"> ' + pageInfo + ' </a></li>');
  11437. if (page_num == last_page)
  11438. btnclass = ' disabled ';
  11439. else
  11440. btnclass = '';
  11441. //首页
  11442. $(pagebar).append('<li class="csNextPage' + btnclass + '" title="' + self.message.next_title + '" ><a href="javascript:void(0);"><i class="' + iconNext + '"></i></a></li>');
  11443. //上一页
  11444. $(pagebar).append('<li class="csLastPage' + btnclass + '" title="' + self.message.last_title + '" ><a href="javascript:void(0);"> <i class="' + iconLast + '"></i> </a></li>');
  11445. }
  11446. };
  11447. var pagebar = $(self.elem.navi);
  11448. pagebar.toggleClass("hide", cnt_whole < self.option.per_page)
  11449. var last_page = Math.ceil(cnt_whole / self.option.per_page); //计算总页数
  11450. if (last_page == 0)
  11451. page_num = 0;
  11452. else {
  11453. if (page_num == 0)
  11454. page_num = 1;
  11455. }
  11456. buildPageNav(self, pagebar, page_num, last_page);
  11457. //刷新分页信息
  11458. var pageInfoBox = $('li.pageInfoBox', $(pagebar));
  11459. var pageInfo = '第 ' + page_num + ' 页(共' + last_page + '页)';
  11460. $(pageInfoBox).html('<a href="javascript:void(0);"> ' + pageInfo + ' </a>');
  11461. //更新分页样式
  11462. var dClass = 'disabled';
  11463. var first = $('li.csFirstPage', $(pagebar));
  11464. var previous = $('li.csPreviousPage', $(pagebar));
  11465. var next = $('li.csNextPage', $(pagebar));
  11466. var last = $('li.csLastPage', $(pagebar));
  11467. //处理首页,上一页按钮样式
  11468. if (page_num == 1 || page_num == 0) {
  11469. if (!$(first).hasClass(dClass))
  11470. $(first).addClass(dClass);
  11471. if (!$(previous).hasClass(dClass))
  11472. $(previous).addClass(dClass);
  11473. } else {
  11474. if ($(first).hasClass(dClass))
  11475. $(first).removeClass(dClass);
  11476. if ($(previous).hasClass(dClass))
  11477. $(previous).removeClass(dClass);
  11478. }
  11479. //处理下一页,最后一页按钮的样式
  11480. if (page_num == last_page || last_page == 0) {
  11481. if (!$(next).hasClass(dClass))
  11482. $(next).addClass(dClass);
  11483. if (!$(last).hasClass(dClass))
  11484. $(last).addClass(dClass);
  11485. } else {
  11486. if ($(next).hasClass(dClass))
  11487. $(next).removeClass(dClass);
  11488. if ($(last).hasClass(dClass))
  11489. $(last).removeClass(dClass);
  11490. }
  11491. if (last_page > 1) {
  11492. if (self.prop.is_suggest)
  11493. self.prop.max_suggest = last_page;
  11494. else
  11495. self.prop.max_all = last_page;
  11496. self._ehNaviPaging(self); // 导航按钮的事件设置
  11497. } else {
  11498. //$(self.elem.navi).hide();
  11499. }
  11500. },
  11501. /**
  11502. * @private
  11503. * @desc 显示结果集列表
  11504. * @param {Object} self - 插件内部对象
  11505. * @param {Object} json 源数据
  11506. * @param {boolean} is_query - 是否是通过关键字搜索(用于区分是鼠标点击下拉还是输入框输入关键字进行查找)
  11507. */
  11508. _displayResults: function (self, json, is_query) {
  11509. $(self.elem.results).empty();
  11510. var arr_candidate = json.candidate;
  11511. var arr_primary_key = json.primary_key;
  11512. var keystr = $(self.elem.hidden).val();
  11513. var keyArr = $.isArray(keystr) ? keystr : (keystr ? keyArr = keystr.split(',') : new Array());
  11514. for (var i = 0; i < arr_candidate.length; i++) {
  11515. var itemText = '';
  11516. if (self.option.format_item && $.isFunction(self.option.format_item)) {
  11517. try {
  11518. itemText = self.option.format_item(json.originalResult[i]);
  11519. } catch (e) {
  11520. console.error('formatItem内容格式化函数内容设置不正确!');
  11521. itemText = arr_candidate[i];
  11522. }
  11523. } else
  11524. itemText = arr_candidate[i];
  11525. //XSS対策
  11526. var list = $('<li>').html(itemText).attr({
  11527. pkey: arr_primary_key[i],
  11528. pvalue: arr_candidate[i],
  11529. title: itemText
  11530. });
  11531. if (typeof arr_primary_key[i] !== 'undefined' && $.inArray(arr_primary_key[i].toString(), keyArr) != -1) {
  11532. $(list).addClass(self.css_class.selected);
  11533. }
  11534. //缓存原始行对象
  11535. $(list).data('dataObj', json.originalResult[i]);
  11536. $(self.elem.results).append(list);
  11537. }
  11538. //显示结果集列表并调整位置
  11539. self._calcWidthResults(self);
  11540. $(self.elem.container).addClass(self.css_class.container_open);
  11541. //结果集列表事件绑定
  11542. self._ehResults();
  11543. //若是键盘输入关键字进行查询且有内容时,列表自动选中第一行(auto_select_first为true时)
  11544. if (is_query && arr_candidate.length > 0 && self.option.auto_select_first)
  11545. self._nextLine(self);
  11546. //按钮的title属性修改
  11547. $(self.elem.button).attr('title', self.message.close_btn);
  11548. },
  11549. /**
  11550. * @private
  11551. * @desc 处理结果列表尺寸及位置
  11552. * @param {Object} self - 插件内部对象
  11553. */
  11554. _calcWidthResults: function (self) {
  11555. //若列表已展现,则不再处理
  11556. //###代码已禁用###若启用,在翻页时,会不计算位置,导致数据量不一致时列表不会自动定位
  11557. //if($(self.elem.result_area).is(":visible")) return;
  11558. //设置下拉列表与输入框同宽
  11559. //###代码已禁用###因为分页栏是固定宽度的原因,列表与输入框宽度同步功能不能再使用
  11560. /*
  11561. $(self.elem.result_area)
  11562. .width(
  11563. $(self.elem.container).width() -
  11564. ($(self.elem.result_area).outerWidth() - $(self.elem.result_area).innerWidth())
  11565. )
  11566. .show();
  11567. */
  11568. $(self.elem.result_area).show(1, function () {
  11569. /*
  11570. //设置外框宽度,只需要初始化时设置即可,不需要在每次展开列表时进行设置,这里暂时屏蔽该功能
  11571. //单选模式下,设置外框与输入框尺寸一致
  11572. if(!self.option.multiple){
  11573. $(self.elem.container).width($(self.elem.combo_input).outerWidth());
  11574. }
  11575. */
  11576. if ($(self.elem.container).css('position') == 'static') {
  11577. // position: static
  11578. var offset = $(self.elem.combo_input).offset();
  11579. $(self.elem.result_area).css({
  11580. top: offset.top + $(self.elem.combo_input).outerHeight() + 'px',
  11581. left: offset.left + 'px'
  11582. });
  11583. } else {
  11584. //在展示下拉列表时,判断默认与输入框左对齐的列表是否会超出屏幕边界,是则右对齐,否则默认左对齐
  11585. var browserWidth = document.body.clientWidth;
  11586. var browserHeight = document.body.clientHeight;
  11587. var offset = $(self.elem.container).offset();
  11588. var listWidth = $(self.elem.result_area).outerWidth();
  11589. //当前状态,列表并未被显示,数据未被填充,列表并未展现最终高度,所以只能使用默认一页显示10条数据的固定高度进行计算
  11590. var listHeight = $(self.elem.result_area).outerHeight();
  11591. //默认方向的坐标,在多选模式下,因为外框架是DIV,所以需要向左靠一个像素
  11592. var defaultLeft = self.option.multiple ? -1 : 0;
  11593. var left = (offset.left + listWidth) > browserWidth ? -(listWidth - $(self.elem.container).outerWidth()) : defaultLeft;
  11594. //控件在当前可视区域中的高度
  11595. var screenTop = offset.top - $(window).scrollTop();
  11596. var top = 0;
  11597. if ((screenTop + $(self.elem.container).outerHeight() + listHeight) > browserHeight) {
  11598. top = -(listHeight + 1);
  11599. $(self.elem.result_area).removeClass('shadowUp shadowDown').addClass('shadowUp');
  11600. } else {
  11601. top = self.option.multiple ? $(self.elem.container).innerHeight() + 1 : $(self.elem.container).outerHeight();
  11602. $(self.elem.result_area).removeClass('shadowUp shadowDown').addClass('shadowDown');
  11603. }
  11604. // position: relative, absolute, fixed
  11605. $(self.elem.result_area).css({
  11606. top: top + 'px',
  11607. left: left + 'px'
  11608. });
  11609. }
  11610. });
  11611. },
  11612. /**
  11613. * @private
  11614. * @desc 隐藏结果列表
  11615. * @param {Object} self - 插件内部对象
  11616. */
  11617. _hideResults: function (self) {
  11618. if (self.prop.key_paging) {
  11619. self._scrollWindow(self, true);
  11620. self.prop.key_paging = false;
  11621. }
  11622. self._setCssFocusedInput(self);
  11623. if (self.option.auto_fill_result) {
  11624. //self._selectCurrentLine(self, true);
  11625. }
  11626. $(self.elem.results).empty();
  11627. $(self.elem.result_area).hide();
  11628. $(self.elem.container).removeClass(self.css_class.container_open);
  11629. self._abortAjax(self);
  11630. self._setButtonAttrDefault(); // 按钮title属性初期化
  11631. },
  11632. /**
  11633. * @private
  11634. * @desc 跳转到首页
  11635. * @param {Object} self - 插件内部对象
  11636. */
  11637. _firstPage: function (self) {
  11638. if (self.prop.page_all > 1) {
  11639. self.prop.page_all = 1;
  11640. self.prop.is_paging = true;
  11641. self.prop.page_move = true;
  11642. self._suggest(self);
  11643. }
  11644. /*
  11645. if (!self.prop.is_suggest) {
  11646. if (self.prop.page_all > 1) {
  11647. self.prop.page_all = 1;
  11648. self.prop.is_paging = true;
  11649. self.prop.page_move = true;
  11650. self._suggest(self);
  11651. }
  11652. } else {
  11653. if (self.prop.page_suggest > 1) {
  11654. self.prop.page_suggest = 1;
  11655. self.prop.is_paging = true;
  11656. self._suggest(self);
  11657. }
  11658. }
  11659. */
  11660. },
  11661. /**
  11662. * @private
  11663. * @desc 跳转到上一页
  11664. * @param {Object} self - 插件内部对象
  11665. */
  11666. _prevPage: function (self) {
  11667. if (self.prop.page_all > 1) {
  11668. self.prop.page_all--;
  11669. self.prop.is_paging = true;
  11670. self.prop.page_move = true;
  11671. self._suggest(self);
  11672. }
  11673. /*
  11674. if (!self.prop.is_suggest) {
  11675. if (self.prop.page_all > 1) {
  11676. self.prop.page_all--;
  11677. self.prop.is_paging = true;
  11678. self.prop.page_move = true;
  11679. self._suggest(self);
  11680. }
  11681. } else {
  11682. if (self.prop.page_suggest > 1) {
  11683. self.prop.page_suggest--;
  11684. self.prop.is_paging = true;
  11685. self._suggest(self);
  11686. }
  11687. }
  11688. */
  11689. },
  11690. /**
  11691. * @private
  11692. * @desc 跳转到下一页
  11693. * @param {Object} self - 插件内部对象
  11694. */
  11695. _nextPage: function (self) {
  11696. if (self.prop.page_all < self.prop.max_all) {
  11697. self.prop.page_all++;
  11698. self.prop.is_paging = true;
  11699. self.prop.page_move = true;
  11700. self._suggest(self);
  11701. }
  11702. /*
  11703. if (self.prop.is_suggest) {
  11704. if (self.prop.page_suggest < self.prop.max_suggest) {
  11705. self.prop.page_suggest++;
  11706. self.prop.is_paging = true;
  11707. self._suggest(self);
  11708. }
  11709. } else {
  11710. if (self.prop.page_all < self.prop.max_all) {
  11711. self.prop.page_all++;
  11712. self.prop.is_paging = true;
  11713. self.prop.page_move = true;
  11714. self._suggest(self);
  11715. }
  11716. }
  11717. */
  11718. },
  11719. /**
  11720. * @private
  11721. * @desc 跳转到尾页
  11722. * @param {Object} self - 插件内部对象
  11723. */
  11724. _lastPage: function (self) {
  11725. if (self.prop.page_all < self.prop.max_all) {
  11726. self.prop.page_all = self.prop.max_all;
  11727. self.prop.is_paging = true;
  11728. self.prop.page_move = true;
  11729. self._suggest(self);
  11730. }
  11731. /*
  11732. if (!self.prop.is_suggest) {
  11733. if (self.prop.page_all < self.prop.max_all) {
  11734. self.prop.page_all = self.prop.max_all;
  11735. self.prop.is_paging = true;
  11736. self.prop.page_move = true;
  11737. self._suggest(self);
  11738. }
  11739. } else {
  11740. if (self.prop.page_suggest < self.prop.max_suggest) {
  11741. self.prop.page_suggest = self.prop.max_suggest;
  11742. self.prop.is_paging = true;
  11743. self._suggest(self);
  11744. }
  11745. }
  11746. */
  11747. },
  11748. /**
  11749. * @private
  11750. * @desc 跳转到指定页
  11751. * @param {Object} self
  11752. * @param {number} page 目标页数
  11753. */
  11754. _goPage: function (self, page) {
  11755. if (typeof (page) == 'undefined')
  11756. page = 1;
  11757. if (self.prop.page_all < self.prop.max_all) {
  11758. self.prop.page_all = page;
  11759. self.prop.is_paging = true;
  11760. self.prop.page_move = true;
  11761. self._suggest(self);
  11762. }
  11763. /*
  11764. if (self.prop.is_suggest) {
  11765. if (self.prop.page_suggest < self.prop.max_suggest) {
  11766. self.prop.page_suggest = page;
  11767. self.prop.is_paging = true;
  11768. self._suggest(self);
  11769. }
  11770. } else {
  11771. if (self.prop.page_all < self.prop.max_all) {
  11772. self.prop.page_all = page;
  11773. self.prop.is_paging = true;
  11774. self.prop.page_move = true;
  11775. self._suggest(self);
  11776. }
  11777. }
  11778. */
  11779. },
  11780. /**
  11781. * @private
  11782. * @desc 选择当前行
  11783. * @param {Object} self - 插件内部对象
  11784. * @param {boolean} is_enter_key - 是否为回车键
  11785. */
  11786. _selectCurrentLine: function (self, is_enter_key) {
  11787. self._scrollWindow(self, true);
  11788. var current = self._getCurrentLine(self);
  11789. if (current) {
  11790. var pkey = $(current).attr('pkey');
  11791. var text = self.option.format_fill ? $(current).text() : $(current).attr("pvalue");
  11792. if (!self.option.multiple) {
  11793. $(self.elem.combo_input).val(text);
  11794. self._setHiddenValue(pkey);
  11795. } else {
  11796. //多选模式的项目选择处理
  11797. $(self.elem.combo_input).val('');
  11798. var item = {text: text, value: pkey};
  11799. if (!self._isAlreadySelected(self, item)) {
  11800. self._addNewTag(self, item);
  11801. self._tagValuesSet(self);
  11802. }
  11803. }
  11804. if (self.option.select_only)
  11805. self._setButtonAttrDefault();
  11806. //触发元素的事件
  11807. $(self.elem.hidden).trigger("change");
  11808. //回调函数触发
  11809. if (typeof self.option.callback === 'function') {
  11810. self.option.callback.call(self, $(current).data('dataObj'));
  11811. }
  11812. //触发指定事件
  11813. if (self.option.bind_to) {
  11814. $(self.elem.combo_input).trigger(self.option.bind_to, $(current).data('dataObj'));
  11815. }
  11816. self.prop.prev_value = $(self.elem.combo_input).val();
  11817. self._hideResults(self);
  11818. }
  11819. //$(self.elem.combo_input).focus();
  11820. $(self.elem.combo_input).trigger("change");
  11821. $(self.elem.combo_input).trigger("blur");
  11822. self._setCssFocusedInput(self);
  11823. self._inputResize(self);
  11824. },
  11825. /**
  11826. * @private
  11827. * @desc 获得当前行对象
  11828. * @param {Object} self - 插件内部对象
  11829. */
  11830. _getCurrentLine: function (self) {
  11831. if ($(self.elem.result_area).is(':hidden'))
  11832. return false;
  11833. var obj = $(self.elem.results).children('li.' + self.css_class.select);
  11834. if ($(obj).length)
  11835. return obj;
  11836. else
  11837. return false;
  11838. },
  11839. /**
  11840. * @private
  11841. * @desc 多选模式下判断当前选中项目是否已经存在已选中列表中
  11842. * @param {Object} self - 插件内部对象
  11843. * @param {Object} item - 选中行对象
  11844. */
  11845. _isAlreadySelected: function (self, item) {
  11846. var isExist = false;
  11847. if (item.value) {
  11848. var keys = $(self.elem.hidden).val();
  11849. if (keys) {
  11850. var karr = $.isArray(keys) ? keys : (keys ? keys.split(',') : new Array());
  11851. if (karr && karr.length > 0 && $.inArray(item.value, karr) != -1)
  11852. isExist = true;
  11853. }
  11854. }
  11855. return isExist;
  11856. },
  11857. /**
  11858. * @private
  11859. * @desc 多选模式下增加一个标签
  11860. * @param {Object} self - 插件内部对象
  11861. * @param {Object} item - 选中行对象
  11862. */
  11863. _addNewTag: function (self, item) {
  11864. if (!self.option.multiple || !item)
  11865. return;
  11866. var tmp = self.template.tag.content;
  11867. tmp = tmp.replace(self.template.tag.textKey, item.text);
  11868. tmp = tmp.replace(self.template.tag.valueKey, item.value);
  11869. $(self.elem.combo_input).closest('li').before($(tmp));
  11870. },
  11871. /**
  11872. * @private
  11873. * @desc 多选模式下标签结果值放入隐藏域
  11874. * @param {Object} self - 插件内部对象
  11875. */
  11876. _tagValuesSet: function (self) {
  11877. if (!self.option.multiple)
  11878. return;
  11879. var tags = $('li.selected_tag', $(self.elem.element_box));
  11880. if (tags && $(tags).size() > 0) {
  11881. var result = new Array();
  11882. $.each(tags, function (i, li) {
  11883. var v = $(li).attr('itemvalue');
  11884. if ($.type(v) != 'undefined')
  11885. result.push(v);
  11886. });
  11887. if (result.length > 0) {
  11888. self._setHiddenValue(result);
  11889. }
  11890. }
  11891. },
  11892. /**
  11893. * @private
  11894. * @desc 多选模式下输入框根据输入内容调整输入框宽度
  11895. * @param {Object} self - 插件内部对象
  11896. */
  11897. _inputResize: function (self) {
  11898. if (!self.option.multiple)
  11899. return;
  11900. var width = '';
  11901. var inputLi = self.elem.combo_input.closest('li');
  11902. //设置默认宽度
  11903. var setDefaultSize = function (self, inputLi) {
  11904. inputLi.removeClass('full_width');
  11905. var minimumWidth = self.elem.combo_input.val().length + 1;
  11906. var width = (minimumWidth * 0.75) + 'em';
  11907. self.elem.combo_input.css('width', width);
  11908. self.elem.combo_input.removeAttr('placeholder');
  11909. };
  11910. if ($('li.selected_tag', $(self.elem.element_box)).size() == 0) {
  11911. if (self.elem.combo_input.attr('placeholder_bak')) {
  11912. if (!inputLi.hasClass('full_width'))
  11913. inputLi.addClass('full_width');
  11914. self.elem.combo_input.attr('placeholder', self.elem.combo_input.attr('placeholder_bak'));
  11915. } else
  11916. setDefaultSize(self, inputLi);
  11917. } else
  11918. setDefaultSize(self, inputLi);
  11919. },
  11920. /**
  11921. * @private
  11922. * @desc 选择下一行
  11923. * @param {Object} self - 插件内部对象
  11924. */
  11925. _nextLine: function (self) {
  11926. var obj = self._getCurrentLine(self);
  11927. var idx;
  11928. if (!obj)
  11929. idx = -1;
  11930. else {
  11931. idx = $(self.elem.results).children('li').index(obj);
  11932. $(obj).removeClass(self.css_class.select);
  11933. }
  11934. idx++;
  11935. if (idx < $(self.elem.results).children('li').length) {
  11936. var next = $(self.elem.results).children('li').eq(idx);
  11937. $(next).addClass(self.css_class.select);
  11938. self._setCssFocusedResults(self);
  11939. } else
  11940. self._setCssFocusedInput(self);
  11941. self._scrollWindow(self, false);
  11942. },
  11943. /**
  11944. * @private
  11945. * @desc 选择上一行
  11946. * @param {Object} self - 插件内部对象
  11947. */
  11948. _prevLine: function (self) {
  11949. var obj = self._getCurrentLine(self);
  11950. var idx;
  11951. if (!obj)
  11952. idx = $(self.elem.results).children('li').length;
  11953. else {
  11954. idx = $(self.elem.results).children('li').index(obj);
  11955. $(obj).removeClass(self.css_class.select);
  11956. }
  11957. idx--;
  11958. if (idx > -1) {
  11959. var prev = $(self.elem.results).children('li').eq(idx);
  11960. $(prev).addClass(self.css_class.select);
  11961. self._setCssFocusedResults(self);
  11962. } else
  11963. self._setCssFocusedInput(self);
  11964. self._scrollWindow(self, false);
  11965. }
  11966. });
  11967. return SelectPage;
  11968. }));