require-backend.min.js 901 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353
  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.4.1 (https://getbootstrap.com/)
  7. * Copyright 2011-2019 Twitter, Inc.
  8. * Licensed under the MIT license
  9. */
  10. if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");!function(t){"use strict";var e=jQuery.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1||3<e[0])throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(),function(n){"use strict";n.fn.emulateTransitionEnd=function(t){var e=!1,i=this;n(this).one("bsTransitionEnd",function(){e=!0});return setTimeout(function(){e||n(i).trigger(n.support.transition.end)},t),this},n(function(){n.support.transition=function o(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(t.style[i]!==undefined)return{end:e[i]};return!1}(),n.support.transition&&(n.event.special.bsTransitionEnd={bindType:n.support.transition.end,delegateType:n.support.transition.end,handle:function(t){if(n(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}})})}(jQuery),function(s){"use strict";var e='[data-dismiss="alert"]',a=function(t){s(t).on("click",e,this.close)};a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.close=function(t){var e=s(this),i=e.attr("data-target");i||(i=(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),i="#"===i?[]:i;var o=s(document).find(i);function n(){o.detach().trigger("closed.bs.alert").remove()}t&&t.preventDefault(),o.length||(o=e.closest(".alert")),o.trigger(t=s.Event("close.bs.alert")),t.isDefaultPrevented()||(o.removeClass("in"),s.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",n).emulateTransitionEnd(a.TRANSITION_DURATION):n())};var t=s.fn.alert;s.fn.alert=function o(i){return this.each(function(){var t=s(this),e=t.data("bs.alert");e||t.data("bs.alert",e=new a(this)),"string"==typeof i&&e[i].call(t)})},s.fn.alert.Constructor=a,s.fn.alert.noConflict=function(){return s.fn.alert=t,this},s(document).on("click.bs.alert.data-api",e,a.prototype.close)}(jQuery),function(s){"use strict";var n=function(t,e){this.$element=s(t),this.options=s.extend({},n.DEFAULTS,e),this.isLoading=!1};function i(o){return this.each(function(){var t=s(this),e=t.data("bs.button"),i="object"==typeof o&&o;e||t.data("bs.button",e=new n(this,i)),"toggle"==o?e.toggle():o&&e.setState(o)})}n.VERSION="3.4.1",n.DEFAULTS={loadingText:"loading..."},n.prototype.setState=function(t){var e="disabled",i=this.$element,o=i.is("input")?"val":"html",n=i.data();t+="Text",null==n.resetText&&i.data("resetText",i[o]()),setTimeout(s.proxy(function(){i[o](null==n[t]?this.options[t]:n[t]),"loadingText"==t?(this.isLoading=!0,i.addClass(e).attr(e,e).prop(e,!0)):this.isLoading&&(this.isLoading=!1,i.removeClass(e).removeAttr(e).prop(e,!1))},this),0)},n.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var i=this.$element.find("input");"radio"==i.prop("type")?(i.prop("checked")&&(t=!1),e.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==i.prop("type")&&(i.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),i.prop("checked",this.$element.hasClass("active")),t&&i.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var t=s.fn.button;s.fn.button=i,s.fn.button.Constructor=n,s.fn.button.noConflict=function(){return s.fn.button=t,this},s(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(t){var e=s(t.target).closest(".btn");i.call(e,"toggle"),s(t.target).is('input[type="radio"], input[type="checkbox"]')||(t.preventDefault(),e.is("input,button")?e.trigger("focus"):e.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){s(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),function(p){"use strict";var c=function(t,e){this.$element=p(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=e,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",p.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",p.proxy(this.pause,this)).on("mouseleave.bs.carousel",p.proxy(this.cycle,this))};function r(n){return this.each(function(){var t=p(this),e=t.data("bs.carousel"),i=p.extend({},c.DEFAULTS,t.data(),"object"==typeof n&&n),o="string"==typeof n?n:i.slide;e||t.data("bs.carousel",e=new c(this,i)),"number"==typeof n?e.to(n):o?e[o]():i.interval&&e.pause().cycle()})}c.VERSION="3.4.1",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(t){if(!/input|textarea/i.test(t.target.tagName)){switch(t.which){case 37:this.prev();break;case 39:this.next();break;default:return}t.preventDefault()}},c.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(p.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(t){return this.$items=t.parent().children(".item"),this.$items.index(t||this.$active)},c.prototype.getItemForDirection=function(t,e){var i=this.getItemIndex(e);if(("prev"==t&&0===i||"next"==t&&i==this.$items.length-1)&&!this.options.wrap)return e;var o=(i+("prev"==t?-1:1))%this.$items.length;return this.$items.eq(o)},c.prototype.to=function(t){var e=this,i=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(t>this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):i==t?this.pause().cycle():this.slide(i<t?"next":"prev",this.$items.eq(t))},c.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&p.support.transition&&(this.$element.trigger(p.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(t,e){var i=this.$element.find(".item.active"),o=e||this.getItemForDirection(t,i),n=this.interval,s="next"==t?"left":"right",a=this;if(o.hasClass("active"))return this.sliding=!1;var r=o[0],l=p.Event("slide.bs.carousel",{relatedTarget:r,direction:s});if(this.$element.trigger(l),!l.isDefaultPrevented()){if(this.sliding=!0,n&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var h=p(this.$indicators.children()[this.getItemIndex(o)]);h&&h.addClass("active")}var d=p.Event("slid.bs.carousel",{relatedTarget:r,direction:s});return p.support.transition&&this.$element.hasClass("slide")?(o.addClass(t),"object"==typeof o&&o.length&&o[0].offsetWidth,i.addClass(s),o.addClass(s),i.one("bsTransitionEnd",function(){o.removeClass([t,s].join(" ")).addClass("active"),i.removeClass(["active",s].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger(d)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(i.removeClass("active"),o.addClass("active"),this.sliding=!1,this.$element.trigger(d)),n&&this.cycle(),this}};var t=p.fn.carousel;p.fn.carousel=r,p.fn.carousel.Constructor=c,p.fn.carousel.noConflict=function(){return p.fn.carousel=t,this};var e=function(t){var e=p(this),i=e.attr("href");i&&(i=i.replace(/.*(?=#[^\s]+$)/,""));var o=e.attr("data-target")||i,n=p(document).find(o);if(n.hasClass("carousel")){var s=p.extend({},n.data(),e.data()),a=e.attr("data-slide-to");a&&(s.interval=!1),r.call(n,s),a&&n.data("bs.carousel").to(a),t.preventDefault()}};p(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),p(window).on("load",function(){p('[data-ride="carousel"]').each(function(){var t=p(this);r.call(t,t.data())})})}(jQuery),function(a){"use strict";var r=function(t,e){this.$element=a(t),this.options=a.extend({},r.DEFAULTS,e),this.$trigger=a('[data-toggle="collapse"][href="#'+t.id+'"],[data-toggle="collapse"][data-target="#'+t.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};function n(t){var e,i=t.attr("data-target")||(e=t.attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"");return a(document).find(i)}function l(o){return this.each(function(){var t=a(this),e=t.data("bs.collapse"),i=a.extend({},r.DEFAULTS,t.data(),"object"==typeof o&&o);!e&&i.toggle&&/show|hide/.test(o)&&(i.toggle=!1),e||t.data("bs.collapse",e=new r(this,i)),"string"==typeof o&&e[o]()})}r.VERSION="3.4.1",r.TRANSITION_DURATION=350,r.DEFAULTS={toggle:!0},r.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"},r.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(t=e.data("bs.collapse"))&&t.transitioning)){var i=a.Event("show.bs.collapse");if(this.$element.trigger(i),!i.isDefaultPrevented()){e&&e.length&&(l.call(e,"hide"),t||e.data("bs.collapse",null));var o=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[o](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var n=function(){this.$element.removeClass("collapsing").addClass("collapse in")[o](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return n.call(this);var s=a.camelCase(["scroll",o].join("-"));this.$element.one("bsTransitionEnd",a.proxy(n,this)).emulateTransitionEnd(r.TRANSITION_DURATION)[o](this.$element[0][s])}}}},r.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var t=a.Event("hide.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var e=this.dimension();this.$element[e](this.$element[e]())[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 i=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};if(!a.support.transition)return i.call(this);this.$element[e](0).one("bsTransitionEnd",a.proxy(i,this)).emulateTransitionEnd(r.TRANSITION_DURATION)}}},r.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},r.prototype.getParent=function(){return a(document).find(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(t,e){var i=a(e);this.addAriaAndCollapsedClass(n(i),i)},this)).end()},r.prototype.addAriaAndCollapsedClass=function(t,e){var i=t.hasClass("in");t.attr("aria-expanded",i),e.toggleClass("collapsed",!i).attr("aria-expanded",i)};var t=a.fn.collapse;a.fn.collapse=l,a.fn.collapse.Constructor=r,a.fn.collapse.noConflict=function(){return a.fn.collapse=t,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(t){var e=a(this);e.attr("data-target")||t.preventDefault();var i=n(e),o=i.data("bs.collapse")?"toggle":e.data();l.call(i,o)})}(jQuery),function(a){"use strict";var r='[data-toggle="dropdown"]',o=function(t){a(t).on("click.bs.dropdown",this.toggle)};function l(t){var e=t.attr("data-target");e||(e=(e=t.attr("href"))&&/#[A-Za-z]/.test(e)&&e.replace(/.*(?=#[^\s]*$)/,""));var i="#"!==e?a(document).find(e):null;return i&&i.length?i:t.parent()}function s(o){o&&3===o.which||(a(".dropdown-backdrop").remove(),a(r).each(function(){var t=a(this),e=l(t),i={relatedTarget:this};e.hasClass("open")&&(o&&"click"==o.type&&/input|textarea/i.test(o.target.tagName)&&a.contains(e[0],o.target)||(e.trigger(o=a.Event("hide.bs.dropdown",i)),o.isDefaultPrevented()||(t.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",i)))))}))}o.VERSION="3.4.1",o.prototype.toggle=function(t){var e=a(this);if(!e.is(".disabled, :disabled")){var i=l(e),o=i.hasClass("open");if(s(),!o){"ontouchstart"in document.documentElement&&!i.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",s);var n={relatedTarget:this};if(i.trigger(t=a.Event("show.bs.dropdown",n)),t.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),i.toggleClass("open").trigger(a.Event("shown.bs.dropdown",n))}return!1}},o.prototype.keydown=function(t){if(/(38|40|27|32)/.test(t.which)&&!/input|textarea/i.test(t.target.tagName)){var e=a(this);if(t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled")){var i=l(e),o=i.hasClass("open");if(!o&&27!=t.which||o&&27==t.which)return 27==t.which&&i.find(r).trigger("focus"),e.trigger("click");var n=i.find(".dropdown-menu li:not(.disabled):visible a");if(n.length){var s=n.index(t.target);38==t.which&&0<s&&s--,40==t.which&&s<n.length-1&&s++,~s||(s=0),n.eq(s).trigger("focus")}}}};var t=a.fn.dropdown;a.fn.dropdown=function e(i){return this.each(function(){var t=a(this),e=t.data("bs.dropdown");e||t.data("bs.dropdown",e=new o(this)),"string"==typeof i&&e[i].call(t)})},a.fn.dropdown.Constructor=o,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=t,this},a(document).on("click.bs.dropdown.data-api",s).on("click.bs.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.bs.dropdown.data-api",r,o.prototype.toggle).on("keydown.bs.dropdown.data-api",r,o.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",o.prototype.keydown)}(jQuery),function(a){"use strict";var s=function(t,e){this.options=e,this.$body=a(document.body),this.$element=a(t),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.fixedContent=".navbar-fixed-top, .navbar-fixed-bottom",this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};function r(o,n){return this.each(function(){var t=a(this),e=t.data("bs.modal"),i=a.extend({},s.DEFAULTS,t.data(),"object"==typeof o&&o);e||t.data("bs.modal",e=new s(this,i)),"string"==typeof o?e[o](n):i.show&&e.show(n)})}s.VERSION="3.4.1",s.TRANSITION_DURATION=300,s.BACKDROP_TRANSITION_DURATION=150,s.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},s.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},s.prototype.show=function(i){var o=this,t=a.Event("show.bs.modal",{relatedTarget:i});this.$element.trigger(t),this.isShown||t.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(){o.$element.one("mouseup.dismiss.bs.modal",function(t){a(t.target).is(o.$element)&&(o.ignoreBackdropClick=!0)})}),this.backdrop(function(){var t=a.support.transition&&o.$element.hasClass("fade");o.$element.parent().length||o.$element.appendTo(o.$body),o.$element.show().scrollTop(0),o.adjustDialog(),t&&o.$element[0].offsetWidth,o.$element.addClass("in"),o.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:i});t?o.$dialog.one("bsTransitionEnd",function(){o.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(s.TRANSITION_DURATION):o.$element.trigger("focus").trigger(e)}))},s.prototype.hide=function(t){t&&t.preventDefault(),t=a.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.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(s.TRANSITION_DURATION):this.hideModal())},s.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(t){document===t.target||this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")},this))},s.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},s.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},s.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.$body.removeClass("modal-open"),t.resetAdjustments(),t.resetScrollbar(),t.$element.trigger("hidden.bs.modal")})},s.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},s.prototype.backdrop=function(t){var e=this,i=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var o=a.support.transition&&i;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+i).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(t){this.ignoreBackdropClick?this.ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide())},this)),o&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;o?this.$backdrop.one("bsTransitionEnd",t).emulateTransitionEnd(s.BACKDROP_TRANSITION_DURATION):t()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var n=function(){e.removeBackdrop(),t&&t()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",n).emulateTransitionEnd(s.BACKDROP_TRANSITION_DURATION):n()}else t&&t()},s.prototype.handleUpdate=function(){this.adjustDialog()},s.prototype.adjustDialog=function(){var t=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},s.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},s.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth<t,this.scrollbarWidth=this.measureScrollbar()},s.prototype.setScrollbar=function(){var t=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"";var n=this.scrollbarWidth;this.bodyIsOverflowing&&(this.$body.css("padding-right",t+n),a(this.fixedContent).each(function(t,e){var i=e.style.paddingRight,o=a(e).css("padding-right");a(e).data("padding-right",i).css("padding-right",parseFloat(o)+n+"px")}))},s.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad),a(this.fixedContent).each(function(t,e){var i=a(e).data("padding-right");a(e).removeData("padding-right"),e.style.paddingRight=i||""})},s.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var t=a.fn.modal;a.fn.modal=r,a.fn.modal.Constructor=s,a.fn.modal.noConflict=function(){return a.fn.modal=t,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var e=a(this),i=e.attr("href"),o=e.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,""),n=a(document).find(o),s=n.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(i)&&i},n.data(),e.data());e.is("a")&&t.preventDefault(),n.one("show.bs.modal",function(t){t.isDefaultPrevented()||n.one("hidden.bs.modal",function(){e.is(":visible")&&e.trigger("focus")})}),r.call(n,s,this)})}(jQuery),function(g){"use strict";var o=["sanitize","whiteList","sanitizeFn"],a=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],t={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},r=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,l=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function u(t,e){var i=t.nodeName.toLowerCase();if(-1!==g.inArray(i,e))return-1===g.inArray(i,a)||Boolean(t.nodeValue.match(r)||t.nodeValue.match(l));for(var o=g(e).filter(function(t,e){return e instanceof RegExp}),n=0,s=o.length;n<s;n++)if(i.match(o[n]))return!0;return!1}function n(t,e,i){if(0===t.length)return t;if(i&&"function"==typeof i)return i(t);if(!document.implementation||!document.implementation.createHTMLDocument)return t;var o=document.implementation.createHTMLDocument("sanitization");o.body.innerHTML=t;for(var n=g.map(e,function(t,e){return e}),s=g(o.body).find("*"),a=0,r=s.length;a<r;a++){var l=s[a],h=l.nodeName.toLowerCase();if(-1!==g.inArray(h,n))for(var d=g.map(l.attributes,function(t){return t}),p=[].concat(e["*"]||[],e[h]||[]),c=0,f=d.length;c<f;c++)u(d[c],p)||l.removeAttribute(d[c].nodeName);else l.parentNode.removeChild(l)}return o.body.innerHTML}var m=function(t,e){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",t,e)};m.VERSION="3.4.1",m.TRANSITION_DURATION=150,m.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},sanitize:!0,sanitizeFn:null,whiteList:t},m.prototype.init=function(t,e,i){if(this.enabled=!0,this.type=t,this.$element=g(e),this.options=this.getOptions(i),this.$viewport=this.options.viewport&&g(document).find(g.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 o=this.options.trigger.split(" "),n=o.length;n--;){var s=o[n];if("click"==s)this.$element.on("click."+this.type,this.options.selector,g.proxy(this.toggle,this));else if("manual"!=s){var a="hover"==s?"mouseenter":"focusin",r="hover"==s?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,g.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,g.proxy(this.leave,this))}}this.options.selector?this._options=g.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},m.prototype.getDefaults=function(){return m.DEFAULTS},m.prototype.getOptions=function(t){var e=this.$element.data();for(var i in e)e.hasOwnProperty(i)&&-1!==g.inArray(i,o)&&delete e[i];return(t=g.extend({},this.getDefaults(),e,t)).delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t.sanitize&&(t.template=n(t.template,t.whiteList,t.sanitizeFn)),t},m.prototype.getDelegateOptions=function(){var i={},o=this.getDefaults();return this._options&&g.each(this._options,function(t,e){o[t]!=e&&(i[t]=e)}),i},m.prototype.enter=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusin"==t.type?"focus":"hover"]=!0),e.tip().hasClass("in")||"in"==e.hoverState)e.hoverState="in";else{if(clearTimeout(e.timeout),e.hoverState="in",!e.options.delay||!e.options.delay.show)return e.show();e.timeout=setTimeout(function(){"in"==e.hoverState&&e.show()},e.options.delay.show)}},m.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},m.prototype.leave=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusout"==t.type?"focus":"hover"]=!1),!e.isInStateTrue()){if(clearTimeout(e.timeout),e.hoverState="out",!e.options.delay||!e.options.delay.hide)return e.hide();e.timeout=setTimeout(function(){"out"==e.hoverState&&e.hide()},e.options.delay.hide)}},m.prototype.show=function(){var t=g.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(t);var e=g.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(t.isDefaultPrevented()||!e)return;var i=this,o=this.tip(),n=this.getUID(this.type);this.setContent(),o.attr("id",n),this.$element.attr("aria-describedby",n),this.options.animation&&o.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,o[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,r=a.test(s);r&&(s=s.replace(a,"")||"top"),o.detach().css({top:0,left:0,display:"block"}).addClass(s).data("bs."+this.type,this),this.options.container?o.appendTo(g(document).find(this.options.container)):o.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var l=this.getPosition(),h=o[0].offsetWidth,d=o[0].offsetHeight;if(r){var p=s,c=this.getPosition(this.$viewport);s="bottom"==s&&l.bottom+d>c.bottom?"top":"top"==s&&l.top-d<c.top?"bottom":"right"==s&&l.right+h>c.width?"left":"left"==s&&l.left-h<c.left?"right":s,o.removeClass(p).addClass(s)}var f=this.getCalculatedOffset(s,l,h,d);this.applyPlacement(f,s);var u=function(){var t=i.hoverState;i.$element.trigger("shown.bs."+i.type),i.hoverState=null,"out"==t&&i.leave(i)};g.support.transition&&this.$tip.hasClass("fade")?o.one("bsTransitionEnd",u).emulateTransitionEnd(m.TRANSITION_DURATION):u()}},m.prototype.applyPlacement=function(t,e){var i=this.tip(),o=i[0].offsetWidth,n=i[0].offsetHeight,s=parseInt(i.css("margin-top"),10),a=parseInt(i.css("margin-left"),10);isNaN(s)&&(s=0),isNaN(a)&&(a=0),t.top+=s,t.left+=a,g.offset.setOffset(i[0],g.extend({using:function(t){i.css({top:Math.round(t.top),left:Math.round(t.left)})}},t),0),i.addClass("in");var r=i[0].offsetWidth,l=i[0].offsetHeight;"top"==e&&l!=n&&(t.top=t.top+n-l);var h=this.getViewportAdjustedDelta(e,t,r,l);h.left?t.left+=h.left:t.top+=h.top;var d=/top|bottom/.test(e),p=d?2*h.left-o+r:2*h.top-n+l,c=d?"offsetWidth":"offsetHeight";i.offset(t),this.replaceArrow(p,i[0][c],d)},m.prototype.replaceArrow=function(t,e,i){this.arrow().css(i?"left":"top",50*(1-t/e)+"%").css(i?"top":"left","")},m.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();this.options.html?(this.options.sanitize&&(e=n(e,this.options.whiteList,this.options.sanitizeFn)),t.find(".tooltip-inner").html(e)):t.find(".tooltip-inner").text(e),t.removeClass("fade in top bottom left right")},m.prototype.hide=function(t){var e=this,i=g(this.$tip),o=g.Event("hide.bs."+this.type);function n(){"in"!=e.hoverState&&i.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),t&&t()}if(this.$element.trigger(o),!o.isDefaultPrevented())return i.removeClass("in"),g.support.transition&&i.hasClass("fade")?i.one("bsTransitionEnd",n).emulateTransitionEnd(m.TRANSITION_DURATION):n(),this.hoverState=null,this},m.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},m.prototype.hasContent=function(){return this.getTitle()},m.prototype.getPosition=function(t){var e=(t=t||this.$element)[0],i="BODY"==e.tagName,o=e.getBoundingClientRect();null==o.width&&(o=g.extend({},o,{width:o.right-o.left,height:o.bottom-o.top}));var n=window.SVGElement&&e instanceof window.SVGElement,s=i?{top:0,left:0}:n?null:t.offset(),a={scroll:i?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},r=i?{width:g(window).width(),height:g(window).height()}:null;return g.extend({},o,a,r,s)},m.prototype.getCalculatedOffset=function(t,e,i,o){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-i/2}:"top"==t?{top:e.top-o,left:e.left+e.width/2-i/2}:"left"==t?{top:e.top+e.height/2-o/2,left:e.left-i}:{top:e.top+e.height/2-o/2,left:e.left+e.width}},m.prototype.getViewportAdjustedDelta=function(t,e,i,o){var n={top:0,left:0};if(!this.$viewport)return n;var s=this.options.viewport&&this.options.viewport.padding||0,a=this.getPosition(this.$viewport);if(/right|left/.test(t)){var r=e.top-s-a.scroll,l=e.top+s-a.scroll+o;r<a.top?n.top=a.top-r:l>a.top+a.height&&(n.top=a.top+a.height-l)}else{var h=e.left-s,d=e.left+s+i;h<a.left?n.left=a.left-h:d>a.right&&(n.left=a.left+a.width-d)}return n},m.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},m.prototype.getUID=function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},m.prototype.tip=function(){if(!this.$tip&&(this.$tip=g(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},m.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},m.prototype.enable=function(){this.enabled=!0},m.prototype.disable=function(){this.enabled=!1},m.prototype.toggleEnabled=function(){this.enabled=!this.enabled},m.prototype.toggle=function(t){var e=this;t&&((e=g(t.currentTarget).data("bs."+this.type))||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e))),t?(e.inState.click=!e.inState.click,e.isInStateTrue()?e.enter(e):e.leave(e)):e.tip().hasClass("in")?e.leave(e):e.enter(e)},m.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null})},m.prototype.sanitizeHtml=function(t){return n(t,this.options.whiteList,this.options.sanitizeFn)};var e=g.fn.tooltip;g.fn.tooltip=function i(o){return this.each(function(){var t=g(this),e=t.data("bs.tooltip"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.tooltip",e=new m(this,i)),"string"==typeof o&&e[o]())})},g.fn.tooltip.Constructor=m,g.fn.tooltip.noConflict=function(){return g.fn.tooltip=e,this}}(jQuery),function(n){"use strict";var s=function(t,e){this.init("popover",t,e)};if(!n.fn.tooltip)throw new Error("Popover requires tooltip.js");s.VERSION="3.4.1",s.DEFAULTS=n.extend({},n.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>'}),((s.prototype=n.extend({},n.fn.tooltip.Constructor.prototype)).constructor=s).prototype.getDefaults=function(){return s.DEFAULTS},s.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();if(this.options.html){var o=typeof i;this.options.sanitize&&(e=this.sanitizeHtml(e),"string"===o&&(i=this.sanitizeHtml(i))),t.find(".popover-title").html(e),t.find(".popover-content").children().detach().end()["string"===o?"html":"append"](i)}else t.find(".popover-title").text(e),t.find(".popover-content").children().detach().end().text(i);t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},s.prototype.hasContent=function(){return this.getTitle()||this.getContent()},s.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},s.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var t=n.fn.popover;n.fn.popover=function e(o){return this.each(function(){var t=n(this),e=t.data("bs.popover"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.popover",e=new s(this,i)),"string"==typeof o&&e[o]())})},n.fn.popover.Constructor=s,n.fn.popover.noConflict=function(){return n.fn.popover=t,this}}(jQuery),function(s){"use strict";function n(t,e){this.$body=s(document.body),this.$scrollElement=s(t).is(document.body)?s(window):s(t),this.options=s.extend({},n.DEFAULTS,e),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",s.proxy(this.process,this)),this.refresh(),this.process()}function e(o){return this.each(function(){var t=s(this),e=t.data("bs.scrollspy"),i="object"==typeof o&&o;e||t.data("bs.scrollspy",e=new n(this,i)),"string"==typeof o&&e[o]()})}n.VERSION="3.4.1",n.DEFAULTS={offset:10},n.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},n.prototype.refresh=function(){var t=this,o="offset",n=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),s.isWindow(this.$scrollElement[0])||(o="position",n=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var t=s(this),e=t.data("target")||t.attr("href"),i=/^#./.test(e)&&s(e);return i&&i.length&&i.is(":visible")&&[[i[o]().top+n,e]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},n.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.getScrollHeight(),o=this.options.offset+i-this.$scrollElement.height(),n=this.offsets,s=this.targets,a=this.activeTarget;if(this.scrollHeight!=i&&this.refresh(),o<=e)return a!=(t=s[s.length-1])&&this.activate(t);if(a&&e<n[0])return this.activeTarget=null,this.clear();for(t=n.length;t--;)a!=s[t]&&e>=n[t]&&(n[t+1]===undefined||e<n[t+1])&&this.activate(s[t])},n.prototype.activate=function(t){this.activeTarget=t,this.clear();var e=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',i=s(e).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active")),i.trigger("activate.bs.scrollspy")},n.prototype.clear=function(){s(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var t=s.fn.scrollspy;s.fn.scrollspy=e,s.fn.scrollspy.Constructor=n,s.fn.scrollspy.noConflict=function(){return s.fn.scrollspy=t,this},s(window).on("load.bs.scrollspy.data-api",function(){s('[data-spy="scroll"]').each(function(){var t=s(this);e.call(t,t.data())})})}(jQuery),function(r){"use strict";var a=function(t){this.element=r(t)};function e(i){return this.each(function(){var t=r(this),e=t.data("bs.tab");e||t.data("bs.tab",e=new a(this)),"string"==typeof i&&e[i]()})}a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.show=function(){var t=this.element,e=t.closest("ul:not(.dropdown-menu)"),i=t.data("target");if(i||(i=(i=t.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var o=e.find(".active:last a"),n=r.Event("hide.bs.tab",{relatedTarget:t[0]}),s=r.Event("show.bs.tab",{relatedTarget:o[0]});if(o.trigger(n),t.trigger(s),!s.isDefaultPrevented()&&!n.isDefaultPrevented()){var a=r(document).find(i);this.activate(t.closest("li"),e),this.activate(a,a.parent(),function(){o.trigger({type:"hidden.bs.tab",relatedTarget:t[0]}),t.trigger({type:"shown.bs.tab",relatedTarget:o[0]})})}}},a.prototype.activate=function(t,e,i){var o=e.find("> .active"),n=i&&r.support.transition&&(o.length&&o.hasClass("fade")||!!e.find("> .fade").length);function s(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),t.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),n?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu").length&&t.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),i&&i()}o.length&&n?o.one("bsTransitionEnd",s).emulateTransitionEnd(a.TRANSITION_DURATION):s(),o.removeClass("in")};var t=r.fn.tab;r.fn.tab=e,r.fn.tab.Constructor=a,r.fn.tab.noConflict=function(){return r.fn.tab=t,this};var i=function(t){t.preventDefault(),e.call(r(this),"show")};r(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),function(l){"use strict";var h=function(t,e){this.options=l.extend({},h.DEFAULTS,e);var i=this.options.target===h.DEFAULTS.target?l(this.options.target):l(document).find(this.options.target);this.$target=i.on("scroll.bs.affix.data-api",l.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",l.proxy(this.checkPositionWithEventLoop,this)),this.$element=l(t),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};function i(o){return this.each(function(){var t=l(this),e=t.data("bs.affix"),i="object"==typeof o&&o;e||t.data("bs.affix",e=new h(this,i)),"string"==typeof o&&e[o]()})}h.VERSION="3.4.1",h.RESET="affix affix-top affix-bottom",h.DEFAULTS={offset:0,target:window},h.prototype.getState=function(t,e,i,o){var n=this.$target.scrollTop(),s=this.$element.offset(),a=this.$target.height();if(null!=i&&"top"==this.affixed)return n<i&&"top";if("bottom"==this.affixed)return null!=i?!(n+this.unpin<=s.top)&&"bottom":!(n+a<=t-o)&&"bottom";var r=null==this.affixed,l=r?n:s.top;return null!=i&&n<=i?"top":null!=o&&t-o<=l+(r?a:e)&&"bottom"},h.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(h.RESET).addClass("affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},h.prototype.checkPositionWithEventLoop=function(){setTimeout(l.proxy(this.checkPosition,this),1)},h.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t=this.$element.height(),e=this.options.offset,i=e.top,o=e.bottom,n=Math.max(l(document).height(),l(document.body).height());"object"!=typeof e&&(o=i=e),"function"==typeof i&&(i=e.top(this.$element)),"function"==typeof o&&(o=e.bottom(this.$element));var s=this.getState(n,t,i,o);if(this.affixed!=s){null!=this.unpin&&this.$element.css("top","");var a="affix"+(s?"-"+s:""),r=l.Event(a+".bs.affix");if(this.$element.trigger(r),r.isDefaultPrevented())return;this.affixed=s,this.unpin="bottom"==s?this.getPinnedOffset():null,this.$element.removeClass(h.RESET).addClass(a).trigger(a.replace("affix","affixed")+".bs.affix")}"bottom"==s&&this.$element.offset({top:n-t-o})}};var t=l.fn.affix;l.fn.affix=i,l.fn.affix.Constructor=h,l.fn.affix.noConflict=function(){return l.fn.affix=t,this},l(window).on("load",function(){l('[data-spy="affix"]').each(function(){var t=l(this),e=t.data();e.offset=e.offset||{},null!=e.offsetBottom&&(e.offset.bottom=e.offsetBottom),null!=e.offsetTop&&(e.offset.top=e.offsetTop),i.call(t,e)})})}(jQuery);
  11. define("bootstrap", ["jquery"], function(){});
  12. require.config({
  13. urlArgs: "v=" + requirejs.s.contexts._.config.config.site.version,
  14. packages: [{
  15. name: 'moment',
  16. location: '../libs/moment',
  17. main: 'moment'
  18. }],
  19. //在打包压缩时将会把include中的模块合并到主文件中
  20. include: ['css', 'layer', 'toastr', 'fast', 'backend', 'backend-init', 'table', 'form', 'dragsort', 'drag', 'drop', 'addtabs', 'selectpage'],
  21. paths: {
  22. 'lang': "empty:",
  23. 'form': 'require-form',
  24. 'table': 'require-table',
  25. 'upload': 'require-upload',
  26. 'drag': 'jquery.drag.min',
  27. 'drop': 'jquery.drop.min',
  28. 'dropzone': 'dropzone.min',
  29. 'echarts': 'echarts.min',
  30. 'echarts-theme': 'echarts-theme',
  31. 'adminlte': 'adminlte',
  32. 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch',
  33. 'bootstrap-table-template': 'bootstrap-table-template',
  34. //
  35. // 以下的包从bower的libs目录加载
  36. 'jquery': '../libs/jquery/dist/jquery.min',
  37. 'bootstrap': '../libs/bootstrap/dist/js/bootstrap.min',
  38. 'bootstrap-datetimepicker': '../libs/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min',
  39. 'bootstrap-daterangepicker': '../libs/bootstrap-daterangepicker/daterangepicker',
  40. 'bootstrap-select': '../libs/bootstrap-select/dist/js/bootstrap-select.min',
  41. 'bootstrap-select-lang': '../libs/bootstrap-select/dist/js/i18n/defaults-zh_CN',
  42. 'bootstrap-table': '../libs/bootstrap-table/dist/bootstrap-table.min',
  43. 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
  44. 'bootstrap-table-fixed-columns': '../libs/bootstrap-table/dist/extensions/fixed-columns/bootstrap-table-fixed-columns',
  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. 'bootstrap-table-jumpto': '../libs/bootstrap-table/dist/extensions/page-jumpto/bootstrap-table-jumpto',
  48. 'bootstrap-slider': '../libs/bootstrap-slider/bootstrap-slider',
  49. 'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',
  50. 'dragsort': '../libs/fastadmin-dragsort/jquery.dragsort',
  51. 'sortable': '../libs/Sortable/Sortable.min',
  52. 'addtabs': '../libs/fastadmin-addtabs/jquery.addtabs',
  53. 'slimscroll': '../libs/jquery-slimscroll/jquery.slimscroll',
  54. 'validator': '../libs/nice-validator/dist/jquery.validator',
  55. 'validator-lang': '../libs/nice-validator/dist/local/zh-CN',
  56. 'toastr': '../libs/toastr/toastr',
  57. 'jstree': '../libs/jstree/dist/jstree.min',
  58. 'layer': '../libs/fastadmin-layer/dist/layer',
  59. 'cookie': '../libs/jquery.cookie/jquery.cookie',
  60. 'cxselect': '../libs/fastadmin-cxselect/js/jquery.cxselect',
  61. 'template': '../libs/art-template/dist/template-native',
  62. 'selectpage': '../libs/fastadmin-selectpage/selectpage',
  63. 'citypicker': '../libs/fastadmin-citypicker/dist/js/city-picker.min',
  64. 'citypicker-data': '../libs/fastadmin-citypicker/dist/js/city-picker.data',
  65. },
  66. // shim依赖配置
  67. shim: {
  68. 'addons': ['backend'],
  69. 'bootstrap': ['jquery'],
  70. 'bootstrap-table': {
  71. deps: ['bootstrap'],
  72. exports: '$.fn.bootstrapTable'
  73. },
  74. 'bootstrap-table-lang': {
  75. deps: ['bootstrap-table'],
  76. exports: '$.fn.bootstrapTable.defaults'
  77. },
  78. 'bootstrap-table-export': {
  79. deps: ['bootstrap-table', 'tableexport'],
  80. exports: '$.fn.bootstrapTable.defaults'
  81. },
  82. 'bootstrap-table-fixed-columns': {
  83. deps: ['bootstrap-table'],
  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. 'bootstrap-table-jumpto': {
  103. deps: ['bootstrap-table'],
  104. exports: '$.fn.bootstrapTable.defaults'
  105. },
  106. 'tableexport': {
  107. deps: ['jquery'],
  108. exports: '$.fn.extend'
  109. },
  110. 'slimscroll': {
  111. deps: ['jquery'],
  112. exports: '$.fn.extend'
  113. },
  114. 'adminlte': {
  115. deps: ['bootstrap', 'slimscroll'],
  116. exports: '$.AdminLTE'
  117. },
  118. 'bootstrap-daterangepicker': [
  119. 'moment/locale/zh-cn'
  120. ],
  121. 'bootstrap-datetimepicker': [
  122. 'moment/locale/zh-cn',
  123. ],
  124. 'bootstrap-select-lang': ['bootstrap-select'],
  125. 'jstree': ['css!../libs/jstree/dist/themes/default/style.css'],
  126. 'validator-lang': ['validator'],
  127. 'citypicker': ['citypicker-data', 'css!../libs/fastadmin-citypicker/dist/css/city-picker.css']
  128. },
  129. baseUrl: requirejs.s.contexts._.config.config.site.cdnurl + '/assets/js/', //资源基础路径
  130. map: {
  131. '*': {
  132. 'css': '../libs/require-css/css.min'
  133. }
  134. },
  135. waitSeconds: 60,
  136. charset: 'utf-8' // 文件编码
  137. });
  138. require(['jquery', 'bootstrap'], function ($, undefined) {
  139. //初始配置
  140. var Config = requirejs.s.contexts._.config.config;
  141. //将Config渲染到全局
  142. window.Config = Config;
  143. // 配置语言包的路径
  144. var paths = {};
  145. paths['lang'] = Config.moduleurl + '/ajax/lang?callback=define&controllername=' + Config.controllername + '&lang=' + Config.language + '&v=' + Config.site.version;
  146. // 避免目录冲突
  147. paths['backend/'] = 'backend/';
  148. require.config({paths: paths});
  149. // 初始化
  150. $(function () {
  151. require(['fast'], function (Fast) {
  152. require(['backend', 'backend-init', 'addons'], function (Backend, undefined, Addons) {
  153. //加载相应模块
  154. if (Config.jsname) {
  155. require([Config.jsname], function (Controller) {
  156. if (Controller.hasOwnProperty(Config.actionname)) {
  157. Controller[Config.actionname]();
  158. } else {
  159. if (Controller.hasOwnProperty("_empty")) {
  160. Controller._empty();
  161. }
  162. }
  163. }, function (e) {
  164. console.error(e);
  165. // 这里可捕获模块加载的错误
  166. });
  167. }
  168. });
  169. });
  170. });
  171. });
  172. define("require-backend", function(){});
  173. 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});
  174. /*! layer-v3.5.1 Web 通用弹出层组件 MIT License http://layer.layui.com/ By 贤心 */
  175. ;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var t=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}(),i=e.LAYUI_GLOBAL||{};return i.layer_dir||t.substring(0,t.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c="creating",u=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function d(t){var n=100,a=document.getElementById(f);return++u>1e4/n?e.console&&console.error(l+".css: Invalid"):void(1989===parseInt(o.getStyle(a,"width"))?(t===c&&a.removeAttribute("lay-status"),a.getAttribute("lay-status")===c?setTimeout(d,n):i()):(a.setAttribute("lay-status",c),setTimeout(function(){d(c)},n)))}()}}},r={v:"3.5.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},f=r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},n.icon!==-1&&n.icon!==t||(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:260},n))}},s=function(e){var t=this,n=function(){t.creat()};t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?n():setTimeout(function(){n()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],l.SHADE="layui-layer-shade",l.MOVE="layui-layer-move",s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"&#x4FE1;&#x606F;",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,minStack:!0,focusBtn:0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'<div class="layui-layer-title" style="'+(f?r.title[1]:"")+'">'+(f?r.title[0]:r.title)+"</div>":"";return r.zIndex=s,t([r.shade?'<div class="'+l.SHADE+'" id="'+l.SHADE+a+'" times="'+a+'" style="'+("z-index:"+(s-1)+"; ")+'"></div>':"",'<div class="'+l[0]+(" layui-layer-"+o.type[r.type])+(0!=r.type&&2!=r.type||r.shade?"":" layui-layer-border")+" "+(r.skin||"")+'" id="'+l[0]+a+'" type="'+o.type[r.type]+'" times="'+a+'" showtime="'+r.time+'" conType="'+(e?"object":"string")+'" style="z-index: '+s+"; width:"+r.area[0]+";height:"+r.area[1]+";position:"+(r.fixed?"fixed;":"absolute;")+'">'+(e&&2!=r.type?"":u)+'<div id="'+(r.id||"")+'" class="layui-layer-content'+(0==r.type&&r.icon!==-1?" layui-layer-padding":"")+(3==r.type?" layui-layer-loading"+r.icon:"")+'">'+(0==r.type&&r.icon!==-1?'<i class="layui-layer-ico layui-layer-ico'+r.icon+'"></i>':"")+(1==r.type&&e?"":r.content||"")+'</div><span class="layui-layer-setwin">'+function(){var e=c?'<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>':"";return r.closeBtn&&(e+='<a class="layui-layer-ico '+l[7]+" "+l[7]+(r.title?r.closeBtn:4==r.type?"1":"2")+'" href="javascript:;"></a>'),e}()+"</span>"+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t<i;t++)e+='<a class="'+l[6]+t+'" href="javascript:">'+r.btn[t]+"</a>";return'<div class="'+l[6]+" layui-layer-btn-"+(r.btnAlign||"")+'">'+e+"</div>"}():"")+(r.resize?'<span class="layui-layer-resize"></span>':"")+"</div>"],u,i('<div class="'+l.MOVE+'" id="'+l.MOVE+'"></div>')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"","auto"];t.content='<iframe scrolling="'+(t.content[1]||"auto")+'" allowtransparency="true" id="'+l[4]+a+'" name="'+l[4]+a+'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="'+t.content[0]+'"></iframe>';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'<i class="layui-layer-TipsG"></i>',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i("#"+l.MOVE)[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),e.shadeo=i("#"+l.SHADE+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),e.shadeo.css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():function(){e.offset(),parseInt(o.getStyle(document.getElementById(l.MOVE),"z-index"))||function(){e.layero.css("visibility","hidden"),r.ready(function(){e.offset(),e.layero.css("visibility","visible")})}()}(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;a<c.stX&&(a=c.stX),a>f&&(a=f),o<c.stY&&(o=c.stY),o>u&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;if(t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),"number"==typeof a.focusBtn){var s=n.find("."+l[6]).children("a").eq(a.focusBtn);if(s.size()>0){n.find("."+l[6]).css("position","relative");var f=s.position(),c={width:s.outerWidth(),height:s.outerHeight(),left:f.left,top:f.top,marginTop:s.css("marginTop"),marginLeft:s.css("marginLeft")},u=i("<button class='layui-layer-confirm'></button>").css(c);if(a.resize){var d=a.resizing;a.resizing=function(e){d&&d(e);var t=s.position();u.size()>0&&u.css({left:t.left,top:t.top})}}n.find("."+l[6]).append(u),u.focus().click(function(){return s.trigger("click"),!1}).on("focus blur",function(e){s.toggleClass("focus","focus"===e.type),"blur"===e.type&&u.remove()})}}n.find("."+l[7]).on("click",e),a.shadeClose&&t.shadeo.on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n,t.index);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n,t.index)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n,t.index)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){t=t||{};var a=i("#"+l[0]+e),s=i("#"+l.SHADE+e),f=a.find(l[1]).outerHeight()||0,c=a.attr("minLeft")||181*o.minIndex+"px",u=a.css("position"),d={width:180,height:f,position:"fixed",overflow:"hidden"};o.record(a),o.minLeft[0]&&(c=o.minLeft[0],o.minLeft.shift()),t.minStack&&(d.left=c,d.top=n.height()-f,a.attr("minLeft")||o.minIndex++,a.attr("minLeft",c)),a.attr("position",u),r.style(e,d,!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),s.hide()},r.restore=function(e){var t=i("#"+l[0]+e),n=i("#"+l.SHADE+e),a=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(a[0]),height:parseFloat(a[1]),top:parseFloat(a[2]),left:parseFloat(a[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e),n.show()},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e,t){var n=i("#"+l[0]+e),a=n.attr("type"),s="layer-anim-close";if(n[0]){var f="layui-layer-wrap",c=function(){if(a===o.type[1]&&"object"===n.attr("conType")){n.children(":not(."+l[5]+")").remove();for(var r=n.find("."+f),s=0;s<2;s++)r.unwrap();r.css("display",r.data("display")).removeClass(f)}else{if(a===o.type[2])try{var c=i("#"+l[4]+e)[0];c.contentWindow.document.write(""),c.contentWindow.close(),n.find("."+l[5])[0].removeChild(c)}catch(u){}n[0].innerHTML="",n.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e],"function"==typeof t&&t()};n.data("isOutAnim")&&n.addClass("layer-anim "+s),i("#layui-layer-moves, #"+l.SHADE+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),n.attr("minLeft")&&(o.minIndex--,o.minLeft.push(n.attr("minLeft"))),r.ie&&r.ie<10||!n.data("isOutAnim")?c():setTimeout(function(){c()},200)}},r.closeAll=function(e,t){"function"==typeof e&&(t=e,e=null);var n=i("."+l[0]);i.each(n,function(a){var o=i(this),s=e?o.attr("type")===e:1;s&&r.close(o.attr("times"),a===n.length-1?t:null),s=null}),0===n.length&&"function"==typeof t&&t()};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'<textarea class="layui-layer-input"'+a+"></textarea>":function(){return'<input type="'+(1==e.formType?"password":"text")+'" class="layui-layer-input">'}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(t){s=t.find(".layui-layer-input"),s.val(e.value||"").focus(),"function"==typeof f&&f(t)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("&#x6700;&#x591A;&#x8F93;&#x5165;"+(e.maxlength||500)+"&#x4E2A;&#x5B57;&#x6570;",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a='<span class="'+n+'">'+t[0].title+"</span>";i<e;i++)a+="<span>"+t[i].title+"</span>";return a}(),content:'<ul class="layui-layer-tabmain">'+function(){var e=t.length,i=1,a="";if(e>0)for(a='<li class="layui-layer-tabli '+n+'">'+(t[0].content||"no content")+"</li>";i<e;i++)a+='<li class="layui-layer-tabli">'+(t[i].content||"no content")+"</li>";return a}()+"</ul>",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=!("string"==typeof t.photos||t.photos instanceof i),f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("&#x6CA1;&#x6709;&#x56FE;&#x7247;")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){h();var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0)}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev(!0)}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext(!0)}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),a&&(t.anim=-1),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]<r[1]&&(a[0]=a[0]/r[1],a[1]=a[1]/r[1])}return[a[0]+"px",a[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,anim:5,isOutAnim:!1,skin:"layui-layer-photos"+c("photos"),content:'<div class="layui-layer-phimg"><img src="'+u[d].src+'" alt="'+(u[d].alt||"")+'" layer-pid="'+u[d].pid+'">'+function(){return u.length>1?'<div class="layui-layer-imgsee"><span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span><div class="layui-layer-imgbar" style="display:'+(a?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(u[d].alt||"")+"</a><em>"+s.imgIndex+" / "+u.length+"</em></span></div></div>":""}()+"</div>",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;",{time:3e4,btn:["&#x4E0B;&#x4E00;&#x5F20;","&#x4E0D;&#x770B;&#x4E86;"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define('layer',["jquery"],function(){return o.run(e.jQuery),r}):function(){r.ready(),o.run(e.jQuery)}()}(window);
  176. /*
  177. * Toastr
  178. * Copyright 2012-2015
  179. * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
  180. * All Rights Reserved.
  181. * Use, reproduction, distribution, and modification of this code is subject to the terms and
  182. * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
  183. *
  184. * ARIA Support: Greta Krafsig
  185. *
  186. * Project: https://github.com/CodeSeven/toastr
  187. */
  188. /* global define */
  189. (function (define) {
  190. define('toastr',['jquery'], function ($) {
  191. return (function () {
  192. var $container;
  193. var listener;
  194. var toastId = 0;
  195. var toastType = {
  196. error: 'error',
  197. info: 'info',
  198. success: 'success',
  199. warning: 'warning'
  200. };
  201. var toastr = {
  202. clear: clear,
  203. remove: remove,
  204. error: error,
  205. getContainer: getContainer,
  206. info: info,
  207. options: {},
  208. subscribe: subscribe,
  209. success: success,
  210. version: '2.1.3',
  211. warning: warning
  212. };
  213. var previousToast;
  214. return toastr;
  215. ////////////////
  216. function error(message, title, optionsOverride) {
  217. return notify({
  218. type: toastType.error,
  219. iconClass: getOptions().iconClasses.error,
  220. message: message,
  221. optionsOverride: optionsOverride,
  222. title: title
  223. });
  224. }
  225. function getContainer(options, create) {
  226. if (!options) { options = getOptions(); }
  227. $container = $('#' + options.containerId);
  228. if ($container.length) {
  229. return $container;
  230. }
  231. if (create) {
  232. $container = createContainer(options);
  233. }
  234. return $container;
  235. }
  236. function info(message, title, optionsOverride) {
  237. return notify({
  238. type: toastType.info,
  239. iconClass: getOptions().iconClasses.info,
  240. message: message,
  241. optionsOverride: optionsOverride,
  242. title: title
  243. });
  244. }
  245. function subscribe(callback) {
  246. listener = callback;
  247. }
  248. function success(message, title, optionsOverride) {
  249. return notify({
  250. type: toastType.success,
  251. iconClass: getOptions().iconClasses.success,
  252. message: message,
  253. optionsOverride: optionsOverride,
  254. title: title
  255. });
  256. }
  257. function warning(message, title, optionsOverride) {
  258. return notify({
  259. type: toastType.warning,
  260. iconClass: getOptions().iconClasses.warning,
  261. message: message,
  262. optionsOverride: optionsOverride,
  263. title: title
  264. });
  265. }
  266. function clear($toastElement, clearOptions) {
  267. var options = getOptions();
  268. if (!$container) { getContainer(options); }
  269. if (!clearToast($toastElement, options, clearOptions)) {
  270. clearContainer(options);
  271. }
  272. }
  273. function remove($toastElement) {
  274. var options = getOptions();
  275. if (!$container) { getContainer(options); }
  276. if ($toastElement && $(':focus', $toastElement).length === 0) {
  277. removeToast($toastElement);
  278. return;
  279. }
  280. if ($container.children().length) {
  281. $container.remove();
  282. }
  283. }
  284. // internal functions
  285. function clearContainer (options) {
  286. var toastsToClear = $container.children();
  287. for (var i = toastsToClear.length - 1; i >= 0; i--) {
  288. clearToast($(toastsToClear[i]), options);
  289. }
  290. }
  291. function clearToast ($toastElement, options, clearOptions) {
  292. var force = clearOptions && clearOptions.force ? clearOptions.force : false;
  293. if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
  294. $toastElement[options.hideMethod]({
  295. duration: options.hideDuration,
  296. easing: options.hideEasing,
  297. complete: function () { removeToast($toastElement); }
  298. });
  299. return true;
  300. }
  301. return false;
  302. }
  303. function createContainer(options) {
  304. $container = $('<div/>')
  305. .attr('id', options.containerId)
  306. .addClass(options.positionClass);
  307. $container.appendTo($(options.target));
  308. return $container;
  309. }
  310. function getDefaults() {
  311. return {
  312. tapToDismiss: true,
  313. toastClass: 'toast',
  314. containerId: 'toast-container',
  315. debug: false,
  316. showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
  317. showDuration: 300,
  318. showEasing: 'swing', //swing and linear are built into jQuery
  319. onShown: undefined,
  320. hideMethod: 'fadeOut',
  321. hideDuration: 1000,
  322. hideEasing: 'swing',
  323. onHidden: undefined,
  324. closeMethod: false,
  325. closeDuration: false,
  326. closeEasing: false,
  327. closeOnHover: true,
  328. extendedTimeOut: 1000,
  329. iconClasses: {
  330. error: 'toast-error',
  331. info: 'toast-info',
  332. success: 'toast-success',
  333. warning: 'toast-warning'
  334. },
  335. iconClass: 'toast-info',
  336. positionClass: 'toast-top-right',
  337. timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
  338. titleClass: 'toast-title',
  339. messageClass: 'toast-message',
  340. escapeHtml: false,
  341. target: 'body',
  342. closeHtml: '<button type="button">&times;</button>',
  343. closeClass: 'toast-close-button',
  344. newestOnTop: true,
  345. preventDuplicates: false,
  346. progressBar: false,
  347. progressClass: 'toast-progress',
  348. rtl: false
  349. };
  350. }
  351. function publish(args) {
  352. if (!listener) { return; }
  353. listener(args);
  354. }
  355. function notify(map) {
  356. var options = getOptions();
  357. var iconClass = map.iconClass || options.iconClass;
  358. if (typeof (map.optionsOverride) !== 'undefined') {
  359. options = $.extend(options, map.optionsOverride);
  360. iconClass = map.optionsOverride.iconClass || iconClass;
  361. }
  362. if (shouldExit(options, map)) { return; }
  363. toastId++;
  364. $container = getContainer(options, true);
  365. var intervalId = null;
  366. var $toastElement = $('<div/>');
  367. var $titleElement = $('<div/>');
  368. var $messageElement = $('<div/>');
  369. var $progressElement = $('<div/>');
  370. var $closeElement = $(options.closeHtml);
  371. var progressBar = {
  372. intervalId: null,
  373. hideEta: null,
  374. maxHideTime: null
  375. };
  376. var response = {
  377. toastId: toastId,
  378. state: 'visible',
  379. startTime: new Date(),
  380. options: options,
  381. map: map
  382. };
  383. personalizeToast();
  384. displayToast();
  385. handleEvents();
  386. publish(response);
  387. if (options.debug && console) {
  388. console.log(response);
  389. }
  390. return $toastElement;
  391. function escapeHtml(source) {
  392. if (source == null) {
  393. source = '';
  394. }
  395. return source
  396. .replace(/&/g, '&amp;')
  397. .replace(/"/g, '&quot;')
  398. .replace(/'/g, '&#39;')
  399. .replace(/</g, '&lt;')
  400. .replace(/>/g, '&gt;');
  401. }
  402. function personalizeToast() {
  403. setIcon();
  404. setTitle();
  405. setMessage();
  406. setCloseButton();
  407. setProgressBar();
  408. setRTL();
  409. setSequence();
  410. setAria();
  411. }
  412. function setAria() {
  413. var ariaValue = '';
  414. switch (map.iconClass) {
  415. case 'toast-success':
  416. case 'toast-info':
  417. ariaValue = 'polite';
  418. break;
  419. default:
  420. ariaValue = 'assertive';
  421. }
  422. $toastElement.attr('aria-live', ariaValue);
  423. }
  424. function handleEvents() {
  425. if (options.closeOnHover) {
  426. $toastElement.hover(stickAround, delayedHideToast);
  427. }
  428. if (!options.onclick && options.tapToDismiss) {
  429. $toastElement.click(hideToast);
  430. }
  431. if (options.closeButton && $closeElement) {
  432. $closeElement.click(function (event) {
  433. if (event.stopPropagation) {
  434. event.stopPropagation();
  435. } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
  436. event.cancelBubble = true;
  437. }
  438. if (options.onCloseClick) {
  439. options.onCloseClick(event);
  440. }
  441. hideToast(true);
  442. });
  443. }
  444. if (options.onclick) {
  445. $toastElement.click(function (event) {
  446. options.onclick(event);
  447. hideToast();
  448. });
  449. }
  450. }
  451. function displayToast() {
  452. $toastElement.hide();
  453. $toastElement[options.showMethod](
  454. {duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
  455. );
  456. if (options.timeOut > 0) {
  457. intervalId = setTimeout(hideToast, options.timeOut);
  458. progressBar.maxHideTime = parseFloat(options.timeOut);
  459. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  460. if (options.progressBar) {
  461. progressBar.intervalId = setInterval(updateProgress, 10);
  462. }
  463. }
  464. }
  465. function setIcon() {
  466. if (map.iconClass) {
  467. $toastElement.addClass(options.toastClass).addClass(iconClass);
  468. }
  469. }
  470. function setSequence() {
  471. if (options.newestOnTop) {
  472. $container.prepend($toastElement);
  473. } else {
  474. $container.append($toastElement);
  475. }
  476. }
  477. function setTitle() {
  478. if (map.title) {
  479. var suffix = map.title;
  480. if (options.escapeHtml) {
  481. suffix = escapeHtml(map.title);
  482. }
  483. $titleElement.append(suffix).addClass(options.titleClass);
  484. $toastElement.append($titleElement);
  485. }
  486. }
  487. function setMessage() {
  488. if (map.message) {
  489. var suffix = map.message;
  490. if (options.escapeHtml) {
  491. suffix = escapeHtml(map.message);
  492. }
  493. $messageElement.append(suffix).addClass(options.messageClass);
  494. $toastElement.append($messageElement);
  495. }
  496. }
  497. function setCloseButton() {
  498. if (options.closeButton) {
  499. $closeElement.addClass(options.closeClass).attr('role', 'button');
  500. $toastElement.prepend($closeElement);
  501. }
  502. }
  503. function setProgressBar() {
  504. if (options.progressBar) {
  505. $progressElement.addClass(options.progressClass);
  506. $toastElement.prepend($progressElement);
  507. }
  508. }
  509. function setRTL() {
  510. if (options.rtl) {
  511. $toastElement.addClass('rtl');
  512. }
  513. }
  514. function shouldExit(options, map) {
  515. if (options.preventDuplicates) {
  516. if (map.message === previousToast) {
  517. return true;
  518. } else {
  519. previousToast = map.message;
  520. }
  521. }
  522. return false;
  523. }
  524. function hideToast(override) {
  525. var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
  526. var duration = override && options.closeDuration !== false ?
  527. options.closeDuration : options.hideDuration;
  528. var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
  529. if ($(':focus', $toastElement).length && !override) {
  530. return;
  531. }
  532. clearTimeout(progressBar.intervalId);
  533. return $toastElement[method]({
  534. duration: duration,
  535. easing: easing,
  536. complete: function () {
  537. removeToast($toastElement);
  538. clearTimeout(intervalId);
  539. if (options.onHidden && response.state !== 'hidden') {
  540. options.onHidden();
  541. }
  542. response.state = 'hidden';
  543. response.endTime = new Date();
  544. publish(response);
  545. }
  546. });
  547. }
  548. function delayedHideToast() {
  549. if (options.timeOut > 0 || options.extendedTimeOut > 0) {
  550. intervalId = setTimeout(hideToast, options.extendedTimeOut);
  551. progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
  552. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  553. }
  554. }
  555. function stickAround() {
  556. clearTimeout(intervalId);
  557. progressBar.hideEta = 0;
  558. $toastElement.stop(true, true)[options.showMethod](
  559. {duration: options.showDuration, easing: options.showEasing}
  560. );
  561. }
  562. function updateProgress() {
  563. var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
  564. $progressElement.width(percentage + '%');
  565. }
  566. }
  567. function getOptions() {
  568. return $.extend({}, getDefaults(), toastr.options);
  569. }
  570. function removeToast($toastElement) {
  571. if (!$container) { $container = getContainer(); }
  572. if ($toastElement.is(':visible')) {
  573. return;
  574. }
  575. $toastElement.remove();
  576. $toastElement = null;
  577. if ($container.children().length === 0) {
  578. $container.remove();
  579. previousToast = undefined;
  580. }
  581. }
  582. })();
  583. });
  584. }(typeof define === 'function' && define.amd ? define : function (deps, factory) {
  585. if (typeof module !== 'undefined' && module.exports) { //Node
  586. module.exports = factory(require('jquery'));
  587. } else {
  588. window.toastr = factory(window.jQuery);
  589. }
  590. }));
  591. define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) {
  592. var Fast = {
  593. config: {
  594. //toastr默认配置
  595. toastr: {
  596. "closeButton": true,
  597. "debug": false,
  598. "newestOnTop": false,
  599. "progressBar": false,
  600. "positionClass": "toast-top-center",
  601. "preventDuplicates": false,
  602. "onclick": null,
  603. "showDuration": "300",
  604. "hideDuration": "1000",
  605. "timeOut": "5000",
  606. "extendedTimeOut": "1000",
  607. "showEasing": "swing",
  608. "hideEasing": "linear",
  609. "showMethod": "fadeIn",
  610. "hideMethod": "fadeOut"
  611. }
  612. },
  613. events: {
  614. //请求成功的回调
  615. onAjaxSuccess: function (ret, onAjaxSuccess) {
  616. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  617. var msg = typeof ret.msg !== 'undefined' && ret.msg ? ret.msg : __('Operation completed');
  618. if (typeof onAjaxSuccess === 'function') {
  619. var result = onAjaxSuccess.call(this, data, ret);
  620. if (result === false)
  621. return;
  622. }
  623. Toastr.success(msg);
  624. },
  625. //请求错误的回调
  626. onAjaxError: function (ret, onAjaxError) {
  627. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  628. if (typeof onAjaxError === 'function') {
  629. var result = onAjaxError.call(this, data, ret);
  630. if (result === false) {
  631. return;
  632. }
  633. }
  634. Toastr.error(ret.msg);
  635. },
  636. //服务器响应数据后
  637. onAjaxResponse: function (response) {
  638. try {
  639. var ret = typeof response === 'object' ? response : JSON.parse(response);
  640. if (!ret.hasOwnProperty('code')) {
  641. $.extend(ret, {code: -2, msg: response, data: null});
  642. }
  643. } catch (e) {
  644. var ret = {code: -1, msg: e.message, data: null};
  645. }
  646. return ret;
  647. }
  648. },
  649. api: {
  650. //发送Ajax请求
  651. ajax: function (options, success, error) {
  652. options = typeof options === 'string' ? {url: options} : options;
  653. var index;
  654. if (typeof options.loading === 'undefined' || options.loading) {
  655. index = Layer.load(options.loading || 0);
  656. }
  657. options = $.extend({
  658. type: "POST",
  659. dataType: "json",
  660. xhrFields: {
  661. withCredentials: true
  662. },
  663. success: function (ret) {
  664. index && Layer.close(index);
  665. ret = Fast.events.onAjaxResponse(ret);
  666. if (ret.code === 1) {
  667. Fast.events.onAjaxSuccess(ret, success);
  668. } else {
  669. Fast.events.onAjaxError(ret, error);
  670. }
  671. },
  672. error: function (xhr) {
  673. index && Layer.close(index);
  674. var ret = {code: xhr.status, msg: xhr.statusText, data: null};
  675. Fast.events.onAjaxError(ret, error);
  676. }
  677. }, options);
  678. return $.ajax(options);
  679. },
  680. //修复URL
  681. fixurl: function (url) {
  682. if (url.substr(0, 1) !== "/") {
  683. var r = new RegExp('^(?:[a-z]+:)?//', 'i');
  684. if (!r.test(url)) {
  685. url = Config.moduleurl + "/" + url;
  686. }
  687. } else if (url.substr(0, 8) === "/addons/") {
  688. url = Config.__PUBLIC__.replace(/(\/*$)/g, "") + url;
  689. }
  690. return url;
  691. },
  692. //获取修复后可访问的cdn链接
  693. cdnurl: function (url, domain) {
  694. var rule = new RegExp("^((?:[a-z]+:)?\\/\\/|data:image\\/)", "i");
  695. var cdnurl = Config.upload.cdnurl;
  696. url = rule.test(url) || (cdnurl && url.indexOf(cdnurl) === 0) ? url : cdnurl + url;
  697. if (domain && !rule.test(url)) {
  698. domain = typeof domain === 'string' ? domain : location.origin;
  699. url = domain + url;
  700. }
  701. return url;
  702. },
  703. //查询Url参数
  704. query: function (name, url) {
  705. if (!url) {
  706. url = window.location.href;
  707. }
  708. name = name.replace(/[\[\]]/g, "\\$&");
  709. var regex = new RegExp("[?&/]" + name + "([=/]([^&#/?]*)|&|#|$)"),
  710. results = regex.exec(url);
  711. if (!results)
  712. return null;
  713. if (!results[2])
  714. return '';
  715. return decodeURIComponent(results[2].replace(/\+/g, " "));
  716. },
  717. //打开一个弹出窗口
  718. open: function (url, title, options) {
  719. title = options && options.title ? options.title : (title ? title : "");
  720. url = Fast.api.fixurl(url);
  721. url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
  722. var area = Fast.config.openArea != undefined ? Fast.config.openArea : [$(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%'];
  723. options = $.extend({
  724. type: 2,
  725. title: title,
  726. shadeClose: true,
  727. shade: false,
  728. maxmin: true,
  729. moveOut: true,
  730. area: area,
  731. content: url,
  732. zIndex: Layer.zIndex,
  733. success: function (layero, index) {
  734. var that = this;
  735. //存储callback事件
  736. $(layero).data("callback", that.callback);
  737. //$(layero).removeClass("layui-layer-border");
  738. Layer.setTop(layero);
  739. try {
  740. var frame = Layer.getChildFrame('html', index);
  741. var layerfooter = frame.find(".layer-footer");
  742. Fast.api.layerfooter(layero, index, that);
  743. //绑定事件
  744. if (layerfooter.size() > 0) {
  745. // 监听窗口内的元素及属性变化
  746. // Firefox和Chrome早期版本中带有前缀
  747. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
  748. if (MutationObserver) {
  749. // 选择目标节点
  750. var target = layerfooter[0];
  751. // 创建观察者对象
  752. var observer = new MutationObserver(function (mutations) {
  753. Fast.api.layerfooter(layero, index, that);
  754. mutations.forEach(function (mutation) {
  755. });
  756. });
  757. // 配置观察选项:
  758. var config = {attributes: true, childList: true, characterData: true, subtree: true}
  759. // 传入目标节点和观察选项
  760. observer.observe(target, config);
  761. // 随后,你还可以停止观察
  762. // observer.disconnect();
  763. }
  764. }
  765. } catch (e) {
  766. }
  767. if ($(layero).height() > $(window).height()) {
  768. //当弹出窗口大于浏览器可视高度时,重定位
  769. Layer.style(index, {
  770. top: 0,
  771. height: $(window).height()
  772. });
  773. }
  774. }
  775. }, options ? options : {});
  776. if ($(window).width() < 480 || (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && top.$(".tab-pane.active").size() > 0)) {
  777. options.area = [top.$(".tab-pane.active").width() + "px", top.$(".tab-pane.active").height() + "px"];
  778. options.offset = [top.$(".tab-pane.active").scrollTop() + "px", "0px"];
  779. }
  780. return Layer.open(options);
  781. },
  782. //关闭窗口并回传数据
  783. close: function (data) {
  784. var index = parent.Layer.getFrameIndex(window.name);
  785. var callback = parent.$("#layui-layer" + index).data("callback");
  786. //再执行关闭
  787. parent.Layer.close(index);
  788. //再调用回传函数
  789. if (typeof callback === 'function') {
  790. callback.call(undefined, data);
  791. }
  792. },
  793. layerfooter: function (layero, index, that) {
  794. var frame = Layer.getChildFrame('html', index);
  795. var layerfooter = frame.find(".layer-footer");
  796. if (layerfooter.size() > 0) {
  797. $(".layui-layer-footer", layero).remove();
  798. var footer = $("<div />").addClass('layui-layer-btn layui-layer-footer');
  799. footer.html(layerfooter.html());
  800. if ($(".row", footer).size() === 0) {
  801. $(">", footer).wrapAll("<div class='row'></div>");
  802. }
  803. footer.insertAfter(layero.find('.layui-layer-content'));
  804. //绑定事件
  805. footer.on("click", ".btn", function () {
  806. if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
  807. return;
  808. }
  809. var index = footer.find('.btn').index(this);
  810. $(".btn:eq(" + index + ")", layerfooter).trigger("click");
  811. });
  812. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  813. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  814. //重设iframe高度
  815. $("iframe", layero).height(layero.height() - titHeight - btnHeight);
  816. }
  817. //修复iOS下弹出窗口的高度和iOS下iframe无法滚动的BUG
  818. if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
  819. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  820. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  821. $("iframe", layero).parent().css("height", layero.height() - titHeight - btnHeight);
  822. $("iframe", layero).css("height", "100%");
  823. }
  824. },
  825. success: function (options, callback) {
  826. var type = typeof options === 'function';
  827. if (type) {
  828. callback = options;
  829. }
  830. return Layer.msg(__('Operation completed'), $.extend({
  831. offset: 0, icon: 1
  832. }, type ? {} : options), callback);
  833. },
  834. error: function (options, callback) {
  835. var type = typeof options === 'function';
  836. if (type) {
  837. callback = options;
  838. }
  839. return Layer.msg(__('Operation failed'), $.extend({
  840. offset: 0, icon: 2
  841. }, type ? {} : options), callback);
  842. },
  843. msg: function (message, url) {
  844. var callback = typeof url === 'function' ? url : function () {
  845. if (typeof url !== 'undefined' && url) {
  846. location.href = url;
  847. }
  848. };
  849. Layer.msg(message, {
  850. time: 2000
  851. }, callback);
  852. },
  853. toastr: Toastr,
  854. layer: Layer
  855. },
  856. lang: function () {
  857. var args = arguments,
  858. string = args[0],
  859. i = 1;
  860. string = string.toLowerCase();
  861. //string = typeof Lang[string] != 'undefined' ? Lang[string] : string;
  862. if (typeof Lang !== 'undefined' && typeof Lang[string] !== 'undefined') {
  863. if (typeof Lang[string] == 'object')
  864. return Lang[string];
  865. string = Lang[string];
  866. } else if (string.indexOf('.') !== -1 && false) {
  867. var arr = string.split('.');
  868. var current = Lang[arr[0]];
  869. for (var i = 1; i < arr.length; i++) {
  870. current = typeof current[arr[i]] != 'undefined' ? current[arr[i]] : '';
  871. if (typeof current != 'object')
  872. break;
  873. }
  874. if (typeof current == 'object')
  875. return current;
  876. string = current;
  877. } else {
  878. string = args[0];
  879. }
  880. return string.replace(/%((%)|s|d)/g, function (m) {
  881. // m is the matched format, e.g. %s, %d
  882. var val = null;
  883. if (m[2]) {
  884. val = m[2];
  885. } else {
  886. val = args[i];
  887. // A switch statement so that the formatter can be extended. Default is %s
  888. switch (m) {
  889. case '%d':
  890. val = parseFloat(val);
  891. if (isNaN(val)) {
  892. val = 0;
  893. }
  894. break;
  895. }
  896. i++;
  897. }
  898. return val;
  899. });
  900. },
  901. init: function () {
  902. // 对相对地址进行处理
  903. $.ajaxSetup({
  904. beforeSend: function (xhr, setting) {
  905. setting.url = Fast.api.fixurl(setting.url);
  906. }
  907. });
  908. Layer.config({
  909. skin: 'layui-layer-fast'
  910. });
  911. // 绑定ESC关闭窗口事件
  912. $(window).keyup(function (e) {
  913. if (e.keyCode == 27) {
  914. if ($(".layui-layer").size() > 0) {
  915. var index = 0;
  916. $(".layui-layer").each(function () {
  917. index = Math.max(index, parseInt($(this).attr("times")));
  918. });
  919. if (index) {
  920. Layer.close(index);
  921. }
  922. }
  923. }
  924. });
  925. //公共代码
  926. //配置Toastr的参数
  927. Toastr.options = Fast.config.toastr;
  928. }
  929. };
  930. //将Layer暴露到全局中去
  931. window.Layer = Layer;
  932. //将Toastr暴露到全局中去
  933. window.Toastr = Toastr;
  934. //将语言方法暴露到全局中去
  935. window.__ = Fast.lang;
  936. //将Fast渲染至全局
  937. window.Fast = Fast;
  938. //默认初始化执行的代码
  939. Fast.init();
  940. return Fast;
  941. });
  942. /*!art-template - Template Engine | http://aui.github.com/artTemplate/*/
  943. !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}();
  944. //! moment.js
  945. //! version : 2.29.1
  946. //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
  947. //! license : MIT
  948. //! momentjs.com
  949. ;(function (global, factory) {
  950. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  951. typeof define === 'function' && define.amd ? define('moment/moment',factory) :
  952. global.moment = factory()
  953. }(this, (function () { 'use strict';
  954. var hookCallback;
  955. function hooks() {
  956. return hookCallback.apply(null, arguments);
  957. }
  958. // This is done to register the method called with moment()
  959. // without creating circular dependencies.
  960. function setHookCallback(callback) {
  961. hookCallback = callback;
  962. }
  963. function isArray(input) {
  964. return (
  965. input instanceof Array ||
  966. Object.prototype.toString.call(input) === '[object Array]'
  967. );
  968. }
  969. function isObject(input) {
  970. // IE8 will treat undefined and null as object if it wasn't for
  971. // input != null
  972. return (
  973. input != null &&
  974. Object.prototype.toString.call(input) === '[object Object]'
  975. );
  976. }
  977. function hasOwnProp(a, b) {
  978. return Object.prototype.hasOwnProperty.call(a, b);
  979. }
  980. function isObjectEmpty(obj) {
  981. if (Object.getOwnPropertyNames) {
  982. return Object.getOwnPropertyNames(obj).length === 0;
  983. } else {
  984. var k;
  985. for (k in obj) {
  986. if (hasOwnProp(obj, k)) {
  987. return false;
  988. }
  989. }
  990. return true;
  991. }
  992. }
  993. function isUndefined(input) {
  994. return input === void 0;
  995. }
  996. function isNumber(input) {
  997. return (
  998. typeof input === 'number' ||
  999. Object.prototype.toString.call(input) === '[object Number]'
  1000. );
  1001. }
  1002. function isDate(input) {
  1003. return (
  1004. input instanceof Date ||
  1005. Object.prototype.toString.call(input) === '[object Date]'
  1006. );
  1007. }
  1008. function map(arr, fn) {
  1009. var res = [],
  1010. i;
  1011. for (i = 0; i < arr.length; ++i) {
  1012. res.push(fn(arr[i], i));
  1013. }
  1014. return res;
  1015. }
  1016. function extend(a, b) {
  1017. for (var i in b) {
  1018. if (hasOwnProp(b, i)) {
  1019. a[i] = b[i];
  1020. }
  1021. }
  1022. if (hasOwnProp(b, 'toString')) {
  1023. a.toString = b.toString;
  1024. }
  1025. if (hasOwnProp(b, 'valueOf')) {
  1026. a.valueOf = b.valueOf;
  1027. }
  1028. return a;
  1029. }
  1030. function createUTC(input, format, locale, strict) {
  1031. return createLocalOrUTC(input, format, locale, strict, true).utc();
  1032. }
  1033. function defaultParsingFlags() {
  1034. // We need to deep clone this object.
  1035. return {
  1036. empty: false,
  1037. unusedTokens: [],
  1038. unusedInput: [],
  1039. overflow: -2,
  1040. charsLeftOver: 0,
  1041. nullInput: false,
  1042. invalidEra: null,
  1043. invalidMonth: null,
  1044. invalidFormat: false,
  1045. userInvalidated: false,
  1046. iso: false,
  1047. parsedDateParts: [],
  1048. era: null,
  1049. meridiem: null,
  1050. rfc2822: false,
  1051. weekdayMismatch: false,
  1052. };
  1053. }
  1054. function getParsingFlags(m) {
  1055. if (m._pf == null) {
  1056. m._pf = defaultParsingFlags();
  1057. }
  1058. return m._pf;
  1059. }
  1060. var some;
  1061. if (Array.prototype.some) {
  1062. some = Array.prototype.some;
  1063. } else {
  1064. some = function (fun) {
  1065. var t = Object(this),
  1066. len = t.length >>> 0,
  1067. i;
  1068. for (i = 0; i < len; i++) {
  1069. if (i in t && fun.call(this, t[i], i, t)) {
  1070. return true;
  1071. }
  1072. }
  1073. return false;
  1074. };
  1075. }
  1076. function isValid(m) {
  1077. if (m._isValid == null) {
  1078. var flags = getParsingFlags(m),
  1079. parsedParts = some.call(flags.parsedDateParts, function (i) {
  1080. return i != null;
  1081. }),
  1082. isNowValid =
  1083. !isNaN(m._d.getTime()) &&
  1084. flags.overflow < 0 &&
  1085. !flags.empty &&
  1086. !flags.invalidEra &&
  1087. !flags.invalidMonth &&
  1088. !flags.invalidWeekday &&
  1089. !flags.weekdayMismatch &&
  1090. !flags.nullInput &&
  1091. !flags.invalidFormat &&
  1092. !flags.userInvalidated &&
  1093. (!flags.meridiem || (flags.meridiem && parsedParts));
  1094. if (m._strict) {
  1095. isNowValid =
  1096. isNowValid &&
  1097. flags.charsLeftOver === 0 &&
  1098. flags.unusedTokens.length === 0 &&
  1099. flags.bigHour === undefined;
  1100. }
  1101. if (Object.isFrozen == null || !Object.isFrozen(m)) {
  1102. m._isValid = isNowValid;
  1103. } else {
  1104. return isNowValid;
  1105. }
  1106. }
  1107. return m._isValid;
  1108. }
  1109. function createInvalid(flags) {
  1110. var m = createUTC(NaN);
  1111. if (flags != null) {
  1112. extend(getParsingFlags(m), flags);
  1113. } else {
  1114. getParsingFlags(m).userInvalidated = true;
  1115. }
  1116. return m;
  1117. }
  1118. // Plugins that add properties should also add the key here (null value),
  1119. // so we can properly clone ourselves.
  1120. var momentProperties = (hooks.momentProperties = []),
  1121. updateInProgress = false;
  1122. function copyConfig(to, from) {
  1123. var i, prop, val;
  1124. if (!isUndefined(from._isAMomentObject)) {
  1125. to._isAMomentObject = from._isAMomentObject;
  1126. }
  1127. if (!isUndefined(from._i)) {
  1128. to._i = from._i;
  1129. }
  1130. if (!isUndefined(from._f)) {
  1131. to._f = from._f;
  1132. }
  1133. if (!isUndefined(from._l)) {
  1134. to._l = from._l;
  1135. }
  1136. if (!isUndefined(from._strict)) {
  1137. to._strict = from._strict;
  1138. }
  1139. if (!isUndefined(from._tzm)) {
  1140. to._tzm = from._tzm;
  1141. }
  1142. if (!isUndefined(from._isUTC)) {
  1143. to._isUTC = from._isUTC;
  1144. }
  1145. if (!isUndefined(from._offset)) {
  1146. to._offset = from._offset;
  1147. }
  1148. if (!isUndefined(from._pf)) {
  1149. to._pf = getParsingFlags(from);
  1150. }
  1151. if (!isUndefined(from._locale)) {
  1152. to._locale = from._locale;
  1153. }
  1154. if (momentProperties.length > 0) {
  1155. for (i = 0; i < momentProperties.length; i++) {
  1156. prop = momentProperties[i];
  1157. val = from[prop];
  1158. if (!isUndefined(val)) {
  1159. to[prop] = val;
  1160. }
  1161. }
  1162. }
  1163. return to;
  1164. }
  1165. // Moment prototype object
  1166. function Moment(config) {
  1167. copyConfig(this, config);
  1168. this._d = new Date(config._d != null ? config._d.getTime() : NaN);
  1169. if (!this.isValid()) {
  1170. this._d = new Date(NaN);
  1171. }
  1172. // Prevent infinite loop in case updateOffset creates new moment
  1173. // objects.
  1174. if (updateInProgress === false) {
  1175. updateInProgress = true;
  1176. hooks.updateOffset(this);
  1177. updateInProgress = false;
  1178. }
  1179. }
  1180. function isMoment(obj) {
  1181. return (
  1182. obj instanceof Moment || (obj != null && obj._isAMomentObject != null)
  1183. );
  1184. }
  1185. function warn(msg) {
  1186. if (
  1187. hooks.suppressDeprecationWarnings === false &&
  1188. typeof console !== 'undefined' &&
  1189. console.warn
  1190. ) {
  1191. console.warn('Deprecation warning: ' + msg);
  1192. }
  1193. }
  1194. function deprecate(msg, fn) {
  1195. var firstTime = true;
  1196. return extend(function () {
  1197. if (hooks.deprecationHandler != null) {
  1198. hooks.deprecationHandler(null, msg);
  1199. }
  1200. if (firstTime) {
  1201. var args = [],
  1202. arg,
  1203. i,
  1204. key;
  1205. for (i = 0; i < arguments.length; i++) {
  1206. arg = '';
  1207. if (typeof arguments[i] === 'object') {
  1208. arg += '\n[' + i + '] ';
  1209. for (key in arguments[0]) {
  1210. if (hasOwnProp(arguments[0], key)) {
  1211. arg += key + ': ' + arguments[0][key] + ', ';
  1212. }
  1213. }
  1214. arg = arg.slice(0, -2); // Remove trailing comma and space
  1215. } else {
  1216. arg = arguments[i];
  1217. }
  1218. args.push(arg);
  1219. }
  1220. warn(
  1221. msg +
  1222. '\nArguments: ' +
  1223. Array.prototype.slice.call(args).join('') +
  1224. '\n' +
  1225. new Error().stack
  1226. );
  1227. firstTime = false;
  1228. }
  1229. return fn.apply(this, arguments);
  1230. }, fn);
  1231. }
  1232. var deprecations = {};
  1233. function deprecateSimple(name, msg) {
  1234. if (hooks.deprecationHandler != null) {
  1235. hooks.deprecationHandler(name, msg);
  1236. }
  1237. if (!deprecations[name]) {
  1238. warn(msg);
  1239. deprecations[name] = true;
  1240. }
  1241. }
  1242. hooks.suppressDeprecationWarnings = false;
  1243. hooks.deprecationHandler = null;
  1244. function isFunction(input) {
  1245. return (
  1246. (typeof Function !== 'undefined' && input instanceof Function) ||
  1247. Object.prototype.toString.call(input) === '[object Function]'
  1248. );
  1249. }
  1250. function set(config) {
  1251. var prop, i;
  1252. for (i in config) {
  1253. if (hasOwnProp(config, i)) {
  1254. prop = config[i];
  1255. if (isFunction(prop)) {
  1256. this[i] = prop;
  1257. } else {
  1258. this['_' + i] = prop;
  1259. }
  1260. }
  1261. }
  1262. this._config = config;
  1263. // Lenient ordinal parsing accepts just a number in addition to
  1264. // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
  1265. // TODO: Remove "ordinalParse" fallback in next major release.
  1266. this._dayOfMonthOrdinalParseLenient = new RegExp(
  1267. (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
  1268. '|' +
  1269. /\d{1,2}/.source
  1270. );
  1271. }
  1272. function mergeConfigs(parentConfig, childConfig) {
  1273. var res = extend({}, parentConfig),
  1274. prop;
  1275. for (prop in childConfig) {
  1276. if (hasOwnProp(childConfig, prop)) {
  1277. if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
  1278. res[prop] = {};
  1279. extend(res[prop], parentConfig[prop]);
  1280. extend(res[prop], childConfig[prop]);
  1281. } else if (childConfig[prop] != null) {
  1282. res[prop] = childConfig[prop];
  1283. } else {
  1284. delete res[prop];
  1285. }
  1286. }
  1287. }
  1288. for (prop in parentConfig) {
  1289. if (
  1290. hasOwnProp(parentConfig, prop) &&
  1291. !hasOwnProp(childConfig, prop) &&
  1292. isObject(parentConfig[prop])
  1293. ) {
  1294. // make sure changes to properties don't modify parent config
  1295. res[prop] = extend({}, res[prop]);
  1296. }
  1297. }
  1298. return res;
  1299. }
  1300. function Locale(config) {
  1301. if (config != null) {
  1302. this.set(config);
  1303. }
  1304. }
  1305. var keys;
  1306. if (Object.keys) {
  1307. keys = Object.keys;
  1308. } else {
  1309. keys = function (obj) {
  1310. var i,
  1311. res = [];
  1312. for (i in obj) {
  1313. if (hasOwnProp(obj, i)) {
  1314. res.push(i);
  1315. }
  1316. }
  1317. return res;
  1318. };
  1319. }
  1320. var defaultCalendar = {
  1321. sameDay: '[Today at] LT',
  1322. nextDay: '[Tomorrow at] LT',
  1323. nextWeek: 'dddd [at] LT',
  1324. lastDay: '[Yesterday at] LT',
  1325. lastWeek: '[Last] dddd [at] LT',
  1326. sameElse: 'L',
  1327. };
  1328. function calendar(key, mom, now) {
  1329. var output = this._calendar[key] || this._calendar['sameElse'];
  1330. return isFunction(output) ? output.call(mom, now) : output;
  1331. }
  1332. function zeroFill(number, targetLength, forceSign) {
  1333. var absNumber = '' + Math.abs(number),
  1334. zerosToFill = targetLength - absNumber.length,
  1335. sign = number >= 0;
  1336. return (
  1337. (sign ? (forceSign ? '+' : '') : '-') +
  1338. Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +
  1339. absNumber
  1340. );
  1341. }
  1342. var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,
  1343. localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
  1344. formatFunctions = {},
  1345. formatTokenFunctions = {};
  1346. // token: 'M'
  1347. // padded: ['MM', 2]
  1348. // ordinal: 'Mo'
  1349. // callback: function () { this.month() + 1 }
  1350. function addFormatToken(token, padded, ordinal, callback) {
  1351. var func = callback;
  1352. if (typeof callback === 'string') {
  1353. func = function () {
  1354. return this[callback]();
  1355. };
  1356. }
  1357. if (token) {
  1358. formatTokenFunctions[token] = func;
  1359. }
  1360. if (padded) {
  1361. formatTokenFunctions[padded[0]] = function () {
  1362. return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
  1363. };
  1364. }
  1365. if (ordinal) {
  1366. formatTokenFunctions[ordinal] = function () {
  1367. return this.localeData().ordinal(
  1368. func.apply(this, arguments),
  1369. token
  1370. );
  1371. };
  1372. }
  1373. }
  1374. function removeFormattingTokens(input) {
  1375. if (input.match(/\[[\s\S]/)) {
  1376. return input.replace(/^\[|\]$/g, '');
  1377. }
  1378. return input.replace(/\\/g, '');
  1379. }
  1380. function makeFormatFunction(format) {
  1381. var array = format.match(formattingTokens),
  1382. i,
  1383. length;
  1384. for (i = 0, length = array.length; i < length; i++) {
  1385. if (formatTokenFunctions[array[i]]) {
  1386. array[i] = formatTokenFunctions[array[i]];
  1387. } else {
  1388. array[i] = removeFormattingTokens(array[i]);
  1389. }
  1390. }
  1391. return function (mom) {
  1392. var output = '',
  1393. i;
  1394. for (i = 0; i < length; i++) {
  1395. output += isFunction(array[i])
  1396. ? array[i].call(mom, format)
  1397. : array[i];
  1398. }
  1399. return output;
  1400. };
  1401. }
  1402. // format date using native date object
  1403. function formatMoment(m, format) {
  1404. if (!m.isValid()) {
  1405. return m.localeData().invalidDate();
  1406. }
  1407. format = expandFormat(format, m.localeData());
  1408. formatFunctions[format] =
  1409. formatFunctions[format] || makeFormatFunction(format);
  1410. return formatFunctions[format](m);
  1411. }
  1412. function expandFormat(format, locale) {
  1413. var i = 5;
  1414. function replaceLongDateFormatTokens(input) {
  1415. return locale.longDateFormat(input) || input;
  1416. }
  1417. localFormattingTokens.lastIndex = 0;
  1418. while (i >= 0 && localFormattingTokens.test(format)) {
  1419. format = format.replace(
  1420. localFormattingTokens,
  1421. replaceLongDateFormatTokens
  1422. );
  1423. localFormattingTokens.lastIndex = 0;
  1424. i -= 1;
  1425. }
  1426. return format;
  1427. }
  1428. var defaultLongDateFormat = {
  1429. LTS: 'h:mm:ss A',
  1430. LT: 'h:mm A',
  1431. L: 'MM/DD/YYYY',
  1432. LL: 'MMMM D, YYYY',
  1433. LLL: 'MMMM D, YYYY h:mm A',
  1434. LLLL: 'dddd, MMMM D, YYYY h:mm A',
  1435. };
  1436. function longDateFormat(key) {
  1437. var format = this._longDateFormat[key],
  1438. formatUpper = this._longDateFormat[key.toUpperCase()];
  1439. if (format || !formatUpper) {
  1440. return format;
  1441. }
  1442. this._longDateFormat[key] = formatUpper
  1443. .match(formattingTokens)
  1444. .map(function (tok) {
  1445. if (
  1446. tok === 'MMMM' ||
  1447. tok === 'MM' ||
  1448. tok === 'DD' ||
  1449. tok === 'dddd'
  1450. ) {
  1451. return tok.slice(1);
  1452. }
  1453. return tok;
  1454. })
  1455. .join('');
  1456. return this._longDateFormat[key];
  1457. }
  1458. var defaultInvalidDate = 'Invalid date';
  1459. function invalidDate() {
  1460. return this._invalidDate;
  1461. }
  1462. var defaultOrdinal = '%d',
  1463. defaultDayOfMonthOrdinalParse = /\d{1,2}/;
  1464. function ordinal(number) {
  1465. return this._ordinal.replace('%d', number);
  1466. }
  1467. var defaultRelativeTime = {
  1468. future: 'in %s',
  1469. past: '%s ago',
  1470. s: 'a few seconds',
  1471. ss: '%d seconds',
  1472. m: 'a minute',
  1473. mm: '%d minutes',
  1474. h: 'an hour',
  1475. hh: '%d hours',
  1476. d: 'a day',
  1477. dd: '%d days',
  1478. w: 'a week',
  1479. ww: '%d weeks',
  1480. M: 'a month',
  1481. MM: '%d months',
  1482. y: 'a year',
  1483. yy: '%d years',
  1484. };
  1485. function relativeTime(number, withoutSuffix, string, isFuture) {
  1486. var output = this._relativeTime[string];
  1487. return isFunction(output)
  1488. ? output(number, withoutSuffix, string, isFuture)
  1489. : output.replace(/%d/i, number);
  1490. }
  1491. function pastFuture(diff, output) {
  1492. var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
  1493. return isFunction(format) ? format(output) : format.replace(/%s/i, output);
  1494. }
  1495. var aliases = {};
  1496. function addUnitAlias(unit, shorthand) {
  1497. var lowerCase = unit.toLowerCase();
  1498. aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
  1499. }
  1500. function normalizeUnits(units) {
  1501. return typeof units === 'string'
  1502. ? aliases[units] || aliases[units.toLowerCase()]
  1503. : undefined;
  1504. }
  1505. function normalizeObjectUnits(inputObject) {
  1506. var normalizedInput = {},
  1507. normalizedProp,
  1508. prop;
  1509. for (prop in inputObject) {
  1510. if (hasOwnProp(inputObject, prop)) {
  1511. normalizedProp = normalizeUnits(prop);
  1512. if (normalizedProp) {
  1513. normalizedInput[normalizedProp] = inputObject[prop];
  1514. }
  1515. }
  1516. }
  1517. return normalizedInput;
  1518. }
  1519. var priorities = {};
  1520. function addUnitPriority(unit, priority) {
  1521. priorities[unit] = priority;
  1522. }
  1523. function getPrioritizedUnits(unitsObj) {
  1524. var units = [],
  1525. u;
  1526. for (u in unitsObj) {
  1527. if (hasOwnProp(unitsObj, u)) {
  1528. units.push({ unit: u, priority: priorities[u] });
  1529. }
  1530. }
  1531. units.sort(function (a, b) {
  1532. return a.priority - b.priority;
  1533. });
  1534. return units;
  1535. }
  1536. function isLeapYear(year) {
  1537. return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
  1538. }
  1539. function absFloor(number) {
  1540. if (number < 0) {
  1541. // -0 -> 0
  1542. return Math.ceil(number) || 0;
  1543. } else {
  1544. return Math.floor(number);
  1545. }
  1546. }
  1547. function toInt(argumentForCoercion) {
  1548. var coercedNumber = +argumentForCoercion,
  1549. value = 0;
  1550. if (coercedNumber !== 0 && isFinite(coercedNumber)) {
  1551. value = absFloor(coercedNumber);
  1552. }
  1553. return value;
  1554. }
  1555. function makeGetSet(unit, keepTime) {
  1556. return function (value) {
  1557. if (value != null) {
  1558. set$1(this, unit, value);
  1559. hooks.updateOffset(this, keepTime);
  1560. return this;
  1561. } else {
  1562. return get(this, unit);
  1563. }
  1564. };
  1565. }
  1566. function get(mom, unit) {
  1567. return mom.isValid()
  1568. ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]()
  1569. : NaN;
  1570. }
  1571. function set$1(mom, unit, value) {
  1572. if (mom.isValid() && !isNaN(value)) {
  1573. if (
  1574. unit === 'FullYear' &&
  1575. isLeapYear(mom.year()) &&
  1576. mom.month() === 1 &&
  1577. mom.date() === 29
  1578. ) {
  1579. value = toInt(value);
  1580. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](
  1581. value,
  1582. mom.month(),
  1583. daysInMonth(value, mom.month())
  1584. );
  1585. } else {
  1586. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
  1587. }
  1588. }
  1589. }
  1590. // MOMENTS
  1591. function stringGet(units) {
  1592. units = normalizeUnits(units);
  1593. if (isFunction(this[units])) {
  1594. return this[units]();
  1595. }
  1596. return this;
  1597. }
  1598. function stringSet(units, value) {
  1599. if (typeof units === 'object') {
  1600. units = normalizeObjectUnits(units);
  1601. var prioritized = getPrioritizedUnits(units),
  1602. i;
  1603. for (i = 0; i < prioritized.length; i++) {
  1604. this[prioritized[i].unit](units[prioritized[i].unit]);
  1605. }
  1606. } else {
  1607. units = normalizeUnits(units);
  1608. if (isFunction(this[units])) {
  1609. return this[units](value);
  1610. }
  1611. }
  1612. return this;
  1613. }
  1614. var match1 = /\d/, // 0 - 9
  1615. match2 = /\d\d/, // 00 - 99
  1616. match3 = /\d{3}/, // 000 - 999
  1617. match4 = /\d{4}/, // 0000 - 9999
  1618. match6 = /[+-]?\d{6}/, // -999999 - 999999
  1619. match1to2 = /\d\d?/, // 0 - 99
  1620. match3to4 = /\d\d\d\d?/, // 999 - 9999
  1621. match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999
  1622. match1to3 = /\d{1,3}/, // 0 - 999
  1623. match1to4 = /\d{1,4}/, // 0 - 9999
  1624. match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999
  1625. matchUnsigned = /\d+/, // 0 - inf
  1626. matchSigned = /[+-]?\d+/, // -inf - inf
  1627. matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
  1628. matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z
  1629. matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
  1630. // any word (or two) characters or numbers including two/three word month in arabic.
  1631. // includes scottish gaelic two word and hyphenated months
  1632. matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,
  1633. regexes;
  1634. regexes = {};
  1635. function addRegexToken(token, regex, strictRegex) {
  1636. regexes[token] = isFunction(regex)
  1637. ? regex
  1638. : function (isStrict, localeData) {
  1639. return isStrict && strictRegex ? strictRegex : regex;
  1640. };
  1641. }
  1642. function getParseRegexForToken(token, config) {
  1643. if (!hasOwnProp(regexes, token)) {
  1644. return new RegExp(unescapeFormat(token));
  1645. }
  1646. return regexes[token](config._strict, config._locale);
  1647. }
  1648. // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
  1649. function unescapeFormat(s) {
  1650. return regexEscape(
  1651. s
  1652. .replace('\\', '')
  1653. .replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (
  1654. matched,
  1655. p1,
  1656. p2,
  1657. p3,
  1658. p4
  1659. ) {
  1660. return p1 || p2 || p3 || p4;
  1661. })
  1662. );
  1663. }
  1664. function regexEscape(s) {
  1665. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  1666. }
  1667. var tokens = {};
  1668. function addParseToken(token, callback) {
  1669. var i,
  1670. func = callback;
  1671. if (typeof token === 'string') {
  1672. token = [token];
  1673. }
  1674. if (isNumber(callback)) {
  1675. func = function (input, array) {
  1676. array[callback] = toInt(input);
  1677. };
  1678. }
  1679. for (i = 0; i < token.length; i++) {
  1680. tokens[token[i]] = func;
  1681. }
  1682. }
  1683. function addWeekParseToken(token, callback) {
  1684. addParseToken(token, function (input, array, config, token) {
  1685. config._w = config._w || {};
  1686. callback(input, config._w, config, token);
  1687. });
  1688. }
  1689. function addTimeToArrayFromToken(token, input, config) {
  1690. if (input != null && hasOwnProp(tokens, token)) {
  1691. tokens[token](input, config._a, config, token);
  1692. }
  1693. }
  1694. var YEAR = 0,
  1695. MONTH = 1,
  1696. DATE = 2,
  1697. HOUR = 3,
  1698. MINUTE = 4,
  1699. SECOND = 5,
  1700. MILLISECOND = 6,
  1701. WEEK = 7,
  1702. WEEKDAY = 8;
  1703. function mod(n, x) {
  1704. return ((n % x) + x) % x;
  1705. }
  1706. var indexOf;
  1707. if (Array.prototype.indexOf) {
  1708. indexOf = Array.prototype.indexOf;
  1709. } else {
  1710. indexOf = function (o) {
  1711. // I know
  1712. var i;
  1713. for (i = 0; i < this.length; ++i) {
  1714. if (this[i] === o) {
  1715. return i;
  1716. }
  1717. }
  1718. return -1;
  1719. };
  1720. }
  1721. function daysInMonth(year, month) {
  1722. if (isNaN(year) || isNaN(month)) {
  1723. return NaN;
  1724. }
  1725. var modMonth = mod(month, 12);
  1726. year += (month - modMonth) / 12;
  1727. return modMonth === 1
  1728. ? isLeapYear(year)
  1729. ? 29
  1730. : 28
  1731. : 31 - ((modMonth % 7) % 2);
  1732. }
  1733. // FORMATTING
  1734. addFormatToken('M', ['MM', 2], 'Mo', function () {
  1735. return this.month() + 1;
  1736. });
  1737. addFormatToken('MMM', 0, 0, function (format) {
  1738. return this.localeData().monthsShort(this, format);
  1739. });
  1740. addFormatToken('MMMM', 0, 0, function (format) {
  1741. return this.localeData().months(this, format);
  1742. });
  1743. // ALIASES
  1744. addUnitAlias('month', 'M');
  1745. // PRIORITY
  1746. addUnitPriority('month', 8);
  1747. // PARSING
  1748. addRegexToken('M', match1to2);
  1749. addRegexToken('MM', match1to2, match2);
  1750. addRegexToken('MMM', function (isStrict, locale) {
  1751. return locale.monthsShortRegex(isStrict);
  1752. });
  1753. addRegexToken('MMMM', function (isStrict, locale) {
  1754. return locale.monthsRegex(isStrict);
  1755. });
  1756. addParseToken(['M', 'MM'], function (input, array) {
  1757. array[MONTH] = toInt(input) - 1;
  1758. });
  1759. addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
  1760. var month = config._locale.monthsParse(input, token, config._strict);
  1761. // if we didn't find a month name, mark the date as invalid.
  1762. if (month != null) {
  1763. array[MONTH] = month;
  1764. } else {
  1765. getParsingFlags(config).invalidMonth = input;
  1766. }
  1767. });
  1768. // LOCALES
  1769. var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
  1770. '_'
  1771. ),
  1772. defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split(
  1773. '_'
  1774. ),
  1775. MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
  1776. defaultMonthsShortRegex = matchWord,
  1777. defaultMonthsRegex = matchWord;
  1778. function localeMonths(m, format) {
  1779. if (!m) {
  1780. return isArray(this._months)
  1781. ? this._months
  1782. : this._months['standalone'];
  1783. }
  1784. return isArray(this._months)
  1785. ? this._months[m.month()]
  1786. : this._months[
  1787. (this._months.isFormat || MONTHS_IN_FORMAT).test(format)
  1788. ? 'format'
  1789. : 'standalone'
  1790. ][m.month()];
  1791. }
  1792. function localeMonthsShort(m, format) {
  1793. if (!m) {
  1794. return isArray(this._monthsShort)
  1795. ? this._monthsShort
  1796. : this._monthsShort['standalone'];
  1797. }
  1798. return isArray(this._monthsShort)
  1799. ? this._monthsShort[m.month()]
  1800. : this._monthsShort[
  1801. MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'
  1802. ][m.month()];
  1803. }
  1804. function handleStrictParse(monthName, format, strict) {
  1805. var i,
  1806. ii,
  1807. mom,
  1808. llc = monthName.toLocaleLowerCase();
  1809. if (!this._monthsParse) {
  1810. // this is not used
  1811. this._monthsParse = [];
  1812. this._longMonthsParse = [];
  1813. this._shortMonthsParse = [];
  1814. for (i = 0; i < 12; ++i) {
  1815. mom = createUTC([2000, i]);
  1816. this._shortMonthsParse[i] = this.monthsShort(
  1817. mom,
  1818. ''
  1819. ).toLocaleLowerCase();
  1820. this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
  1821. }
  1822. }
  1823. if (strict) {
  1824. if (format === 'MMM') {
  1825. ii = indexOf.call(this._shortMonthsParse, llc);
  1826. return ii !== -1 ? ii : null;
  1827. } else {
  1828. ii = indexOf.call(this._longMonthsParse, llc);
  1829. return ii !== -1 ? ii : null;
  1830. }
  1831. } else {
  1832. if (format === 'MMM') {
  1833. ii = indexOf.call(this._shortMonthsParse, llc);
  1834. if (ii !== -1) {
  1835. return ii;
  1836. }
  1837. ii = indexOf.call(this._longMonthsParse, llc);
  1838. return ii !== -1 ? ii : null;
  1839. } else {
  1840. ii = indexOf.call(this._longMonthsParse, llc);
  1841. if (ii !== -1) {
  1842. return ii;
  1843. }
  1844. ii = indexOf.call(this._shortMonthsParse, llc);
  1845. return ii !== -1 ? ii : null;
  1846. }
  1847. }
  1848. }
  1849. function localeMonthsParse(monthName, format, strict) {
  1850. var i, mom, regex;
  1851. if (this._monthsParseExact) {
  1852. return handleStrictParse.call(this, monthName, format, strict);
  1853. }
  1854. if (!this._monthsParse) {
  1855. this._monthsParse = [];
  1856. this._longMonthsParse = [];
  1857. this._shortMonthsParse = [];
  1858. }
  1859. // TODO: add sorting
  1860. // Sorting makes sure if one month (or abbr) is a prefix of another
  1861. // see sorting in computeMonthsParse
  1862. for (i = 0; i < 12; i++) {
  1863. // make the regex if we don't have it already
  1864. mom = createUTC([2000, i]);
  1865. if (strict && !this._longMonthsParse[i]) {
  1866. this._longMonthsParse[i] = new RegExp(
  1867. '^' + this.months(mom, '').replace('.', '') + '$',
  1868. 'i'
  1869. );
  1870. this._shortMonthsParse[i] = new RegExp(
  1871. '^' + this.monthsShort(mom, '').replace('.', '') + '$',
  1872. 'i'
  1873. );
  1874. }
  1875. if (!strict && !this._monthsParse[i]) {
  1876. regex =
  1877. '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
  1878. this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
  1879. }
  1880. // test the regex
  1881. if (
  1882. strict &&
  1883. format === 'MMMM' &&
  1884. this._longMonthsParse[i].test(monthName)
  1885. ) {
  1886. return i;
  1887. } else if (
  1888. strict &&
  1889. format === 'MMM' &&
  1890. this._shortMonthsParse[i].test(monthName)
  1891. ) {
  1892. return i;
  1893. } else if (!strict && this._monthsParse[i].test(monthName)) {
  1894. return i;
  1895. }
  1896. }
  1897. }
  1898. // MOMENTS
  1899. function setMonth(mom, value) {
  1900. var dayOfMonth;
  1901. if (!mom.isValid()) {
  1902. // No op
  1903. return mom;
  1904. }
  1905. if (typeof value === 'string') {
  1906. if (/^\d+$/.test(value)) {
  1907. value = toInt(value);
  1908. } else {
  1909. value = mom.localeData().monthsParse(value);
  1910. // TODO: Another silent failure?
  1911. if (!isNumber(value)) {
  1912. return mom;
  1913. }
  1914. }
  1915. }
  1916. dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
  1917. mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
  1918. return mom;
  1919. }
  1920. function getSetMonth(value) {
  1921. if (value != null) {
  1922. setMonth(this, value);
  1923. hooks.updateOffset(this, true);
  1924. return this;
  1925. } else {
  1926. return get(this, 'Month');
  1927. }
  1928. }
  1929. function getDaysInMonth() {
  1930. return daysInMonth(this.year(), this.month());
  1931. }
  1932. function monthsShortRegex(isStrict) {
  1933. if (this._monthsParseExact) {
  1934. if (!hasOwnProp(this, '_monthsRegex')) {
  1935. computeMonthsParse.call(this);
  1936. }
  1937. if (isStrict) {
  1938. return this._monthsShortStrictRegex;
  1939. } else {
  1940. return this._monthsShortRegex;
  1941. }
  1942. } else {
  1943. if (!hasOwnProp(this, '_monthsShortRegex')) {
  1944. this._monthsShortRegex = defaultMonthsShortRegex;
  1945. }
  1946. return this._monthsShortStrictRegex && isStrict
  1947. ? this._monthsShortStrictRegex
  1948. : this._monthsShortRegex;
  1949. }
  1950. }
  1951. function monthsRegex(isStrict) {
  1952. if (this._monthsParseExact) {
  1953. if (!hasOwnProp(this, '_monthsRegex')) {
  1954. computeMonthsParse.call(this);
  1955. }
  1956. if (isStrict) {
  1957. return this._monthsStrictRegex;
  1958. } else {
  1959. return this._monthsRegex;
  1960. }
  1961. } else {
  1962. if (!hasOwnProp(this, '_monthsRegex')) {
  1963. this._monthsRegex = defaultMonthsRegex;
  1964. }
  1965. return this._monthsStrictRegex && isStrict
  1966. ? this._monthsStrictRegex
  1967. : this._monthsRegex;
  1968. }
  1969. }
  1970. function computeMonthsParse() {
  1971. function cmpLenRev(a, b) {
  1972. return b.length - a.length;
  1973. }
  1974. var shortPieces = [],
  1975. longPieces = [],
  1976. mixedPieces = [],
  1977. i,
  1978. mom;
  1979. for (i = 0; i < 12; i++) {
  1980. // make the regex if we don't have it already
  1981. mom = createUTC([2000, i]);
  1982. shortPieces.push(this.monthsShort(mom, ''));
  1983. longPieces.push(this.months(mom, ''));
  1984. mixedPieces.push(this.months(mom, ''));
  1985. mixedPieces.push(this.monthsShort(mom, ''));
  1986. }
  1987. // Sorting makes sure if one month (or abbr) is a prefix of another it
  1988. // will match the longer piece.
  1989. shortPieces.sort(cmpLenRev);
  1990. longPieces.sort(cmpLenRev);
  1991. mixedPieces.sort(cmpLenRev);
  1992. for (i = 0; i < 12; i++) {
  1993. shortPieces[i] = regexEscape(shortPieces[i]);
  1994. longPieces[i] = regexEscape(longPieces[i]);
  1995. }
  1996. for (i = 0; i < 24; i++) {
  1997. mixedPieces[i] = regexEscape(mixedPieces[i]);
  1998. }
  1999. this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  2000. this._monthsShortRegex = this._monthsRegex;
  2001. this._monthsStrictRegex = new RegExp(
  2002. '^(' + longPieces.join('|') + ')',
  2003. 'i'
  2004. );
  2005. this._monthsShortStrictRegex = new RegExp(
  2006. '^(' + shortPieces.join('|') + ')',
  2007. 'i'
  2008. );
  2009. }
  2010. // FORMATTING
  2011. addFormatToken('Y', 0, 0, function () {
  2012. var y = this.year();
  2013. return y <= 9999 ? zeroFill(y, 4) : '+' + y;
  2014. });
  2015. addFormatToken(0, ['YY', 2], 0, function () {
  2016. return this.year() % 100;
  2017. });
  2018. addFormatToken(0, ['YYYY', 4], 0, 'year');
  2019. addFormatToken(0, ['YYYYY', 5], 0, 'year');
  2020. addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
  2021. // ALIASES
  2022. addUnitAlias('year', 'y');
  2023. // PRIORITIES
  2024. addUnitPriority('year', 1);
  2025. // PARSING
  2026. addRegexToken('Y', matchSigned);
  2027. addRegexToken('YY', match1to2, match2);
  2028. addRegexToken('YYYY', match1to4, match4);
  2029. addRegexToken('YYYYY', match1to6, match6);
  2030. addRegexToken('YYYYYY', match1to6, match6);
  2031. addParseToken(['YYYYY', 'YYYYYY'], YEAR);
  2032. addParseToken('YYYY', function (input, array) {
  2033. array[YEAR] =
  2034. input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
  2035. });
  2036. addParseToken('YY', function (input, array) {
  2037. array[YEAR] = hooks.parseTwoDigitYear(input);
  2038. });
  2039. addParseToken('Y', function (input, array) {
  2040. array[YEAR] = parseInt(input, 10);
  2041. });
  2042. // HELPERS
  2043. function daysInYear(year) {
  2044. return isLeapYear(year) ? 366 : 365;
  2045. }
  2046. // HOOKS
  2047. hooks.parseTwoDigitYear = function (input) {
  2048. return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
  2049. };
  2050. // MOMENTS
  2051. var getSetYear = makeGetSet('FullYear', true);
  2052. function getIsLeapYear() {
  2053. return isLeapYear(this.year());
  2054. }
  2055. function createDate(y, m, d, h, M, s, ms) {
  2056. // can't just apply() to create a date:
  2057. // https://stackoverflow.com/q/181348
  2058. var date;
  2059. // the date constructor remaps years 0-99 to 1900-1999
  2060. if (y < 100 && y >= 0) {
  2061. // preserve leap years using a full 400 year cycle, then reset
  2062. date = new Date(y + 400, m, d, h, M, s, ms);
  2063. if (isFinite(date.getFullYear())) {
  2064. date.setFullYear(y);
  2065. }
  2066. } else {
  2067. date = new Date(y, m, d, h, M, s, ms);
  2068. }
  2069. return date;
  2070. }
  2071. function createUTCDate(y) {
  2072. var date, args;
  2073. // the Date.UTC function remaps years 0-99 to 1900-1999
  2074. if (y < 100 && y >= 0) {
  2075. args = Array.prototype.slice.call(arguments);
  2076. // preserve leap years using a full 400 year cycle, then reset
  2077. args[0] = y + 400;
  2078. date = new Date(Date.UTC.apply(null, args));
  2079. if (isFinite(date.getUTCFullYear())) {
  2080. date.setUTCFullYear(y);
  2081. }
  2082. } else {
  2083. date = new Date(Date.UTC.apply(null, arguments));
  2084. }
  2085. return date;
  2086. }
  2087. // start-of-first-week - start-of-year
  2088. function firstWeekOffset(year, dow, doy) {
  2089. var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
  2090. fwd = 7 + dow - doy,
  2091. // first-week day local weekday -- which local weekday is fwd
  2092. fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  2093. return -fwdlw + fwd - 1;
  2094. }
  2095. // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
  2096. function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  2097. var localWeekday = (7 + weekday - dow) % 7,
  2098. weekOffset = firstWeekOffset(year, dow, doy),
  2099. dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
  2100. resYear,
  2101. resDayOfYear;
  2102. if (dayOfYear <= 0) {
  2103. resYear = year - 1;
  2104. resDayOfYear = daysInYear(resYear) + dayOfYear;
  2105. } else if (dayOfYear > daysInYear(year)) {
  2106. resYear = year + 1;
  2107. resDayOfYear = dayOfYear - daysInYear(year);
  2108. } else {
  2109. resYear = year;
  2110. resDayOfYear = dayOfYear;
  2111. }
  2112. return {
  2113. year: resYear,
  2114. dayOfYear: resDayOfYear,
  2115. };
  2116. }
  2117. function weekOfYear(mom, dow, doy) {
  2118. var weekOffset = firstWeekOffset(mom.year(), dow, doy),
  2119. week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
  2120. resWeek,
  2121. resYear;
  2122. if (week < 1) {
  2123. resYear = mom.year() - 1;
  2124. resWeek = week + weeksInYear(resYear, dow, doy);
  2125. } else if (week > weeksInYear(mom.year(), dow, doy)) {
  2126. resWeek = week - weeksInYear(mom.year(), dow, doy);
  2127. resYear = mom.year() + 1;
  2128. } else {
  2129. resYear = mom.year();
  2130. resWeek = week;
  2131. }
  2132. return {
  2133. week: resWeek,
  2134. year: resYear,
  2135. };
  2136. }
  2137. function weeksInYear(year, dow, doy) {
  2138. var weekOffset = firstWeekOffset(year, dow, doy),
  2139. weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  2140. return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
  2141. }
  2142. // FORMATTING
  2143. addFormatToken('w', ['ww', 2], 'wo', 'week');
  2144. addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
  2145. // ALIASES
  2146. addUnitAlias('week', 'w');
  2147. addUnitAlias('isoWeek', 'W');
  2148. // PRIORITIES
  2149. addUnitPriority('week', 5);
  2150. addUnitPriority('isoWeek', 5);
  2151. // PARSING
  2152. addRegexToken('w', match1to2);
  2153. addRegexToken('ww', match1to2, match2);
  2154. addRegexToken('W', match1to2);
  2155. addRegexToken('WW', match1to2, match2);
  2156. addWeekParseToken(['w', 'ww', 'W', 'WW'], function (
  2157. input,
  2158. week,
  2159. config,
  2160. token
  2161. ) {
  2162. week[token.substr(0, 1)] = toInt(input);
  2163. });
  2164. // HELPERS
  2165. // LOCALES
  2166. function localeWeek(mom) {
  2167. return weekOfYear(mom, this._week.dow, this._week.doy).week;
  2168. }
  2169. var defaultLocaleWeek = {
  2170. dow: 0, // Sunday is the first day of the week.
  2171. doy: 6, // The week that contains Jan 6th is the first week of the year.
  2172. };
  2173. function localeFirstDayOfWeek() {
  2174. return this._week.dow;
  2175. }
  2176. function localeFirstDayOfYear() {
  2177. return this._week.doy;
  2178. }
  2179. // MOMENTS
  2180. function getSetWeek(input) {
  2181. var week = this.localeData().week(this);
  2182. return input == null ? week : this.add((input - week) * 7, 'd');
  2183. }
  2184. function getSetISOWeek(input) {
  2185. var week = weekOfYear(this, 1, 4).week;
  2186. return input == null ? week : this.add((input - week) * 7, 'd');
  2187. }
  2188. // FORMATTING
  2189. addFormatToken('d', 0, 'do', 'day');
  2190. addFormatToken('dd', 0, 0, function (format) {
  2191. return this.localeData().weekdaysMin(this, format);
  2192. });
  2193. addFormatToken('ddd', 0, 0, function (format) {
  2194. return this.localeData().weekdaysShort(this, format);
  2195. });
  2196. addFormatToken('dddd', 0, 0, function (format) {
  2197. return this.localeData().weekdays(this, format);
  2198. });
  2199. addFormatToken('e', 0, 0, 'weekday');
  2200. addFormatToken('E', 0, 0, 'isoWeekday');
  2201. // ALIASES
  2202. addUnitAlias('day', 'd');
  2203. addUnitAlias('weekday', 'e');
  2204. addUnitAlias('isoWeekday', 'E');
  2205. // PRIORITY
  2206. addUnitPriority('day', 11);
  2207. addUnitPriority('weekday', 11);
  2208. addUnitPriority('isoWeekday', 11);
  2209. // PARSING
  2210. addRegexToken('d', match1to2);
  2211. addRegexToken('e', match1to2);
  2212. addRegexToken('E', match1to2);
  2213. addRegexToken('dd', function (isStrict, locale) {
  2214. return locale.weekdaysMinRegex(isStrict);
  2215. });
  2216. addRegexToken('ddd', function (isStrict, locale) {
  2217. return locale.weekdaysShortRegex(isStrict);
  2218. });
  2219. addRegexToken('dddd', function (isStrict, locale) {
  2220. return locale.weekdaysRegex(isStrict);
  2221. });
  2222. addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
  2223. var weekday = config._locale.weekdaysParse(input, token, config._strict);
  2224. // if we didn't get a weekday name, mark the date as invalid
  2225. if (weekday != null) {
  2226. week.d = weekday;
  2227. } else {
  2228. getParsingFlags(config).invalidWeekday = input;
  2229. }
  2230. });
  2231. addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
  2232. week[token] = toInt(input);
  2233. });
  2234. // HELPERS
  2235. function parseWeekday(input, locale) {
  2236. if (typeof input !== 'string') {
  2237. return input;
  2238. }
  2239. if (!isNaN(input)) {
  2240. return parseInt(input, 10);
  2241. }
  2242. input = locale.weekdaysParse(input);
  2243. if (typeof input === 'number') {
  2244. return input;
  2245. }
  2246. return null;
  2247. }
  2248. function parseIsoWeekday(input, locale) {
  2249. if (typeof input === 'string') {
  2250. return locale.weekdaysParse(input) % 7 || 7;
  2251. }
  2252. return isNaN(input) ? null : input;
  2253. }
  2254. // LOCALES
  2255. function shiftWeekdays(ws, n) {
  2256. return ws.slice(n, 7).concat(ws.slice(0, n));
  2257. }
  2258. var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
  2259. '_'
  2260. ),
  2261. defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  2262. defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  2263. defaultWeekdaysRegex = matchWord,
  2264. defaultWeekdaysShortRegex = matchWord,
  2265. defaultWeekdaysMinRegex = matchWord;
  2266. function localeWeekdays(m, format) {
  2267. var weekdays = isArray(this._weekdays)
  2268. ? this._weekdays
  2269. : this._weekdays[
  2270. m && m !== true && this._weekdays.isFormat.test(format)
  2271. ? 'format'
  2272. : 'standalone'
  2273. ];
  2274. return m === true
  2275. ? shiftWeekdays(weekdays, this._week.dow)
  2276. : m
  2277. ? weekdays[m.day()]
  2278. : weekdays;
  2279. }
  2280. function localeWeekdaysShort(m) {
  2281. return m === true
  2282. ? shiftWeekdays(this._weekdaysShort, this._week.dow)
  2283. : m
  2284. ? this._weekdaysShort[m.day()]
  2285. : this._weekdaysShort;
  2286. }
  2287. function localeWeekdaysMin(m) {
  2288. return m === true
  2289. ? shiftWeekdays(this._weekdaysMin, this._week.dow)
  2290. : m
  2291. ? this._weekdaysMin[m.day()]
  2292. : this._weekdaysMin;
  2293. }
  2294. function handleStrictParse$1(weekdayName, format, strict) {
  2295. var i,
  2296. ii,
  2297. mom,
  2298. llc = weekdayName.toLocaleLowerCase();
  2299. if (!this._weekdaysParse) {
  2300. this._weekdaysParse = [];
  2301. this._shortWeekdaysParse = [];
  2302. this._minWeekdaysParse = [];
  2303. for (i = 0; i < 7; ++i) {
  2304. mom = createUTC([2000, 1]).day(i);
  2305. this._minWeekdaysParse[i] = this.weekdaysMin(
  2306. mom,
  2307. ''
  2308. ).toLocaleLowerCase();
  2309. this._shortWeekdaysParse[i] = this.weekdaysShort(
  2310. mom,
  2311. ''
  2312. ).toLocaleLowerCase();
  2313. this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
  2314. }
  2315. }
  2316. if (strict) {
  2317. if (format === 'dddd') {
  2318. ii = indexOf.call(this._weekdaysParse, llc);
  2319. return ii !== -1 ? ii : null;
  2320. } else if (format === 'ddd') {
  2321. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2322. return ii !== -1 ? ii : null;
  2323. } else {
  2324. ii = indexOf.call(this._minWeekdaysParse, llc);
  2325. return ii !== -1 ? ii : null;
  2326. }
  2327. } else {
  2328. if (format === 'dddd') {
  2329. ii = indexOf.call(this._weekdaysParse, llc);
  2330. if (ii !== -1) {
  2331. return ii;
  2332. }
  2333. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2334. if (ii !== -1) {
  2335. return ii;
  2336. }
  2337. ii = indexOf.call(this._minWeekdaysParse, llc);
  2338. return ii !== -1 ? ii : null;
  2339. } else if (format === 'ddd') {
  2340. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2341. if (ii !== -1) {
  2342. return ii;
  2343. }
  2344. ii = indexOf.call(this._weekdaysParse, llc);
  2345. if (ii !== -1) {
  2346. return ii;
  2347. }
  2348. ii = indexOf.call(this._minWeekdaysParse, llc);
  2349. return ii !== -1 ? ii : null;
  2350. } else {
  2351. ii = indexOf.call(this._minWeekdaysParse, llc);
  2352. if (ii !== -1) {
  2353. return ii;
  2354. }
  2355. ii = indexOf.call(this._weekdaysParse, llc);
  2356. if (ii !== -1) {
  2357. return ii;
  2358. }
  2359. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2360. return ii !== -1 ? ii : null;
  2361. }
  2362. }
  2363. }
  2364. function localeWeekdaysParse(weekdayName, format, strict) {
  2365. var i, mom, regex;
  2366. if (this._weekdaysParseExact) {
  2367. return handleStrictParse$1.call(this, weekdayName, format, strict);
  2368. }
  2369. if (!this._weekdaysParse) {
  2370. this._weekdaysParse = [];
  2371. this._minWeekdaysParse = [];
  2372. this._shortWeekdaysParse = [];
  2373. this._fullWeekdaysParse = [];
  2374. }
  2375. for (i = 0; i < 7; i++) {
  2376. // make the regex if we don't have it already
  2377. mom = createUTC([2000, 1]).day(i);
  2378. if (strict && !this._fullWeekdaysParse[i]) {
  2379. this._fullWeekdaysParse[i] = new RegExp(
  2380. '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$',
  2381. 'i'
  2382. );
  2383. this._shortWeekdaysParse[i] = new RegExp(
  2384. '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$',
  2385. 'i'
  2386. );
  2387. this._minWeekdaysParse[i] = new RegExp(
  2388. '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$',
  2389. 'i'
  2390. );
  2391. }
  2392. if (!this._weekdaysParse[i]) {
  2393. regex =
  2394. '^' +
  2395. this.weekdays(mom, '') +
  2396. '|^' +
  2397. this.weekdaysShort(mom, '') +
  2398. '|^' +
  2399. this.weekdaysMin(mom, '');
  2400. this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
  2401. }
  2402. // test the regex
  2403. if (
  2404. strict &&
  2405. format === 'dddd' &&
  2406. this._fullWeekdaysParse[i].test(weekdayName)
  2407. ) {
  2408. return i;
  2409. } else if (
  2410. strict &&
  2411. format === 'ddd' &&
  2412. this._shortWeekdaysParse[i].test(weekdayName)
  2413. ) {
  2414. return i;
  2415. } else if (
  2416. strict &&
  2417. format === 'dd' &&
  2418. this._minWeekdaysParse[i].test(weekdayName)
  2419. ) {
  2420. return i;
  2421. } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
  2422. return i;
  2423. }
  2424. }
  2425. }
  2426. // MOMENTS
  2427. function getSetDayOfWeek(input) {
  2428. if (!this.isValid()) {
  2429. return input != null ? this : NaN;
  2430. }
  2431. var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
  2432. if (input != null) {
  2433. input = parseWeekday(input, this.localeData());
  2434. return this.add(input - day, 'd');
  2435. } else {
  2436. return day;
  2437. }
  2438. }
  2439. function getSetLocaleDayOfWeek(input) {
  2440. if (!this.isValid()) {
  2441. return input != null ? this : NaN;
  2442. }
  2443. var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  2444. return input == null ? weekday : this.add(input - weekday, 'd');
  2445. }
  2446. function getSetISODayOfWeek(input) {
  2447. if (!this.isValid()) {
  2448. return input != null ? this : NaN;
  2449. }
  2450. // behaves the same as moment#day except
  2451. // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
  2452. // as a setter, sunday should belong to the previous week.
  2453. if (input != null) {
  2454. var weekday = parseIsoWeekday(input, this.localeData());
  2455. return this.day(this.day() % 7 ? weekday : weekday - 7);
  2456. } else {
  2457. return this.day() || 7;
  2458. }
  2459. }
  2460. function weekdaysRegex(isStrict) {
  2461. if (this._weekdaysParseExact) {
  2462. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2463. computeWeekdaysParse.call(this);
  2464. }
  2465. if (isStrict) {
  2466. return this._weekdaysStrictRegex;
  2467. } else {
  2468. return this._weekdaysRegex;
  2469. }
  2470. } else {
  2471. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2472. this._weekdaysRegex = defaultWeekdaysRegex;
  2473. }
  2474. return this._weekdaysStrictRegex && isStrict
  2475. ? this._weekdaysStrictRegex
  2476. : this._weekdaysRegex;
  2477. }
  2478. }
  2479. function weekdaysShortRegex(isStrict) {
  2480. if (this._weekdaysParseExact) {
  2481. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2482. computeWeekdaysParse.call(this);
  2483. }
  2484. if (isStrict) {
  2485. return this._weekdaysShortStrictRegex;
  2486. } else {
  2487. return this._weekdaysShortRegex;
  2488. }
  2489. } else {
  2490. if (!hasOwnProp(this, '_weekdaysShortRegex')) {
  2491. this._weekdaysShortRegex = defaultWeekdaysShortRegex;
  2492. }
  2493. return this._weekdaysShortStrictRegex && isStrict
  2494. ? this._weekdaysShortStrictRegex
  2495. : this._weekdaysShortRegex;
  2496. }
  2497. }
  2498. function weekdaysMinRegex(isStrict) {
  2499. if (this._weekdaysParseExact) {
  2500. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2501. computeWeekdaysParse.call(this);
  2502. }
  2503. if (isStrict) {
  2504. return this._weekdaysMinStrictRegex;
  2505. } else {
  2506. return this._weekdaysMinRegex;
  2507. }
  2508. } else {
  2509. if (!hasOwnProp(this, '_weekdaysMinRegex')) {
  2510. this._weekdaysMinRegex = defaultWeekdaysMinRegex;
  2511. }
  2512. return this._weekdaysMinStrictRegex && isStrict
  2513. ? this._weekdaysMinStrictRegex
  2514. : this._weekdaysMinRegex;
  2515. }
  2516. }
  2517. function computeWeekdaysParse() {
  2518. function cmpLenRev(a, b) {
  2519. return b.length - a.length;
  2520. }
  2521. var minPieces = [],
  2522. shortPieces = [],
  2523. longPieces = [],
  2524. mixedPieces = [],
  2525. i,
  2526. mom,
  2527. minp,
  2528. shortp,
  2529. longp;
  2530. for (i = 0; i < 7; i++) {
  2531. // make the regex if we don't have it already
  2532. mom = createUTC([2000, 1]).day(i);
  2533. minp = regexEscape(this.weekdaysMin(mom, ''));
  2534. shortp = regexEscape(this.weekdaysShort(mom, ''));
  2535. longp = regexEscape(this.weekdays(mom, ''));
  2536. minPieces.push(minp);
  2537. shortPieces.push(shortp);
  2538. longPieces.push(longp);
  2539. mixedPieces.push(minp);
  2540. mixedPieces.push(shortp);
  2541. mixedPieces.push(longp);
  2542. }
  2543. // Sorting makes sure if one weekday (or abbr) is a prefix of another it
  2544. // will match the longer piece.
  2545. minPieces.sort(cmpLenRev);
  2546. shortPieces.sort(cmpLenRev);
  2547. longPieces.sort(cmpLenRev);
  2548. mixedPieces.sort(cmpLenRev);
  2549. this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  2550. this._weekdaysShortRegex = this._weekdaysRegex;
  2551. this._weekdaysMinRegex = this._weekdaysRegex;
  2552. this._weekdaysStrictRegex = new RegExp(
  2553. '^(' + longPieces.join('|') + ')',
  2554. 'i'
  2555. );
  2556. this._weekdaysShortStrictRegex = new RegExp(
  2557. '^(' + shortPieces.join('|') + ')',
  2558. 'i'
  2559. );
  2560. this._weekdaysMinStrictRegex = new RegExp(
  2561. '^(' + minPieces.join('|') + ')',
  2562. 'i'
  2563. );
  2564. }
  2565. // FORMATTING
  2566. function hFormat() {
  2567. return this.hours() % 12 || 12;
  2568. }
  2569. function kFormat() {
  2570. return this.hours() || 24;
  2571. }
  2572. addFormatToken('H', ['HH', 2], 0, 'hour');
  2573. addFormatToken('h', ['hh', 2], 0, hFormat);
  2574. addFormatToken('k', ['kk', 2], 0, kFormat);
  2575. addFormatToken('hmm', 0, 0, function () {
  2576. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
  2577. });
  2578. addFormatToken('hmmss', 0, 0, function () {
  2579. return (
  2580. '' +
  2581. hFormat.apply(this) +
  2582. zeroFill(this.minutes(), 2) +
  2583. zeroFill(this.seconds(), 2)
  2584. );
  2585. });
  2586. addFormatToken('Hmm', 0, 0, function () {
  2587. return '' + this.hours() + zeroFill(this.minutes(), 2);
  2588. });
  2589. addFormatToken('Hmmss', 0, 0, function () {
  2590. return (
  2591. '' +
  2592. this.hours() +
  2593. zeroFill(this.minutes(), 2) +
  2594. zeroFill(this.seconds(), 2)
  2595. );
  2596. });
  2597. function meridiem(token, lowercase) {
  2598. addFormatToken(token, 0, 0, function () {
  2599. return this.localeData().meridiem(
  2600. this.hours(),
  2601. this.minutes(),
  2602. lowercase
  2603. );
  2604. });
  2605. }
  2606. meridiem('a', true);
  2607. meridiem('A', false);
  2608. // ALIASES
  2609. addUnitAlias('hour', 'h');
  2610. // PRIORITY
  2611. addUnitPriority('hour', 13);
  2612. // PARSING
  2613. function matchMeridiem(isStrict, locale) {
  2614. return locale._meridiemParse;
  2615. }
  2616. addRegexToken('a', matchMeridiem);
  2617. addRegexToken('A', matchMeridiem);
  2618. addRegexToken('H', match1to2);
  2619. addRegexToken('h', match1to2);
  2620. addRegexToken('k', match1to2);
  2621. addRegexToken('HH', match1to2, match2);
  2622. addRegexToken('hh', match1to2, match2);
  2623. addRegexToken('kk', match1to2, match2);
  2624. addRegexToken('hmm', match3to4);
  2625. addRegexToken('hmmss', match5to6);
  2626. addRegexToken('Hmm', match3to4);
  2627. addRegexToken('Hmmss', match5to6);
  2628. addParseToken(['H', 'HH'], HOUR);
  2629. addParseToken(['k', 'kk'], function (input, array, config) {
  2630. var kInput = toInt(input);
  2631. array[HOUR] = kInput === 24 ? 0 : kInput;
  2632. });
  2633. addParseToken(['a', 'A'], function (input, array, config) {
  2634. config._isPm = config._locale.isPM(input);
  2635. config._meridiem = input;
  2636. });
  2637. addParseToken(['h', 'hh'], function (input, array, config) {
  2638. array[HOUR] = toInt(input);
  2639. getParsingFlags(config).bigHour = true;
  2640. });
  2641. addParseToken('hmm', function (input, array, config) {
  2642. var pos = input.length - 2;
  2643. array[HOUR] = toInt(input.substr(0, pos));
  2644. array[MINUTE] = toInt(input.substr(pos));
  2645. getParsingFlags(config).bigHour = true;
  2646. });
  2647. addParseToken('hmmss', function (input, array, config) {
  2648. var pos1 = input.length - 4,
  2649. pos2 = input.length - 2;
  2650. array[HOUR] = toInt(input.substr(0, pos1));
  2651. array[MINUTE] = toInt(input.substr(pos1, 2));
  2652. array[SECOND] = toInt(input.substr(pos2));
  2653. getParsingFlags(config).bigHour = true;
  2654. });
  2655. addParseToken('Hmm', function (input, array, config) {
  2656. var pos = input.length - 2;
  2657. array[HOUR] = toInt(input.substr(0, pos));
  2658. array[MINUTE] = toInt(input.substr(pos));
  2659. });
  2660. addParseToken('Hmmss', function (input, array, config) {
  2661. var pos1 = input.length - 4,
  2662. pos2 = input.length - 2;
  2663. array[HOUR] = toInt(input.substr(0, pos1));
  2664. array[MINUTE] = toInt(input.substr(pos1, 2));
  2665. array[SECOND] = toInt(input.substr(pos2));
  2666. });
  2667. // LOCALES
  2668. function localeIsPM(input) {
  2669. // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
  2670. // Using charAt should be more compatible.
  2671. return (input + '').toLowerCase().charAt(0) === 'p';
  2672. }
  2673. var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i,
  2674. // Setting the hour should keep the time, because the user explicitly
  2675. // specified which hour they want. So trying to maintain the same hour (in
  2676. // a new timezone) makes sense. Adding/subtracting hours does not follow
  2677. // this rule.
  2678. getSetHour = makeGetSet('Hours', true);
  2679. function localeMeridiem(hours, minutes, isLower) {
  2680. if (hours > 11) {
  2681. return isLower ? 'pm' : 'PM';
  2682. } else {
  2683. return isLower ? 'am' : 'AM';
  2684. }
  2685. }
  2686. var baseConfig = {
  2687. calendar: defaultCalendar,
  2688. longDateFormat: defaultLongDateFormat,
  2689. invalidDate: defaultInvalidDate,
  2690. ordinal: defaultOrdinal,
  2691. dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
  2692. relativeTime: defaultRelativeTime,
  2693. months: defaultLocaleMonths,
  2694. monthsShort: defaultLocaleMonthsShort,
  2695. week: defaultLocaleWeek,
  2696. weekdays: defaultLocaleWeekdays,
  2697. weekdaysMin: defaultLocaleWeekdaysMin,
  2698. weekdaysShort: defaultLocaleWeekdaysShort,
  2699. meridiemParse: defaultLocaleMeridiemParse,
  2700. };
  2701. // internal storage for locale config files
  2702. var locales = {},
  2703. localeFamilies = {},
  2704. globalLocale;
  2705. function commonPrefix(arr1, arr2) {
  2706. var i,
  2707. minl = Math.min(arr1.length, arr2.length);
  2708. for (i = 0; i < minl; i += 1) {
  2709. if (arr1[i] !== arr2[i]) {
  2710. return i;
  2711. }
  2712. }
  2713. return minl;
  2714. }
  2715. function normalizeLocale(key) {
  2716. return key ? key.toLowerCase().replace('_', '-') : key;
  2717. }
  2718. // pick the locale from the array
  2719. // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
  2720. // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
  2721. function chooseLocale(names) {
  2722. var i = 0,
  2723. j,
  2724. next,
  2725. locale,
  2726. split;
  2727. while (i < names.length) {
  2728. split = normalizeLocale(names[i]).split('-');
  2729. j = split.length;
  2730. next = normalizeLocale(names[i + 1]);
  2731. next = next ? next.split('-') : null;
  2732. while (j > 0) {
  2733. locale = loadLocale(split.slice(0, j).join('-'));
  2734. if (locale) {
  2735. return locale;
  2736. }
  2737. if (
  2738. next &&
  2739. next.length >= j &&
  2740. commonPrefix(split, next) >= j - 1
  2741. ) {
  2742. //the next array item is better than a shallower substring of this one
  2743. break;
  2744. }
  2745. j--;
  2746. }
  2747. i++;
  2748. }
  2749. return globalLocale;
  2750. }
  2751. function loadLocale(name) {
  2752. var oldLocale = null,
  2753. aliasedRequire;
  2754. // TODO: Find a better way to register and load all the locales in Node
  2755. if (
  2756. locales[name] === undefined &&
  2757. typeof module !== 'undefined' &&
  2758. module &&
  2759. module.exports
  2760. ) {
  2761. try {
  2762. oldLocale = globalLocale._abbr;
  2763. aliasedRequire = require;
  2764. aliasedRequire('./locale/' + name);
  2765. getSetGlobalLocale(oldLocale);
  2766. } catch (e) {
  2767. // mark as not found to avoid repeating expensive file require call causing high CPU
  2768. // when trying to find en-US, en_US, en-us for every format call
  2769. locales[name] = null; // null means not found
  2770. }
  2771. }
  2772. return locales[name];
  2773. }
  2774. // This function will load locale and then set the global locale. If
  2775. // no arguments are passed in, it will simply return the current global
  2776. // locale key.
  2777. function getSetGlobalLocale(key, values) {
  2778. var data;
  2779. if (key) {
  2780. if (isUndefined(values)) {
  2781. data = getLocale(key);
  2782. } else {
  2783. data = defineLocale(key, values);
  2784. }
  2785. if (data) {
  2786. // moment.duration._locale = moment._locale = data;
  2787. globalLocale = data;
  2788. } else {
  2789. if (typeof console !== 'undefined' && console.warn) {
  2790. //warn user if arguments are passed but the locale could not be set
  2791. console.warn(
  2792. 'Locale ' + key + ' not found. Did you forget to load it?'
  2793. );
  2794. }
  2795. }
  2796. }
  2797. return globalLocale._abbr;
  2798. }
  2799. function defineLocale(name, config) {
  2800. if (config !== null) {
  2801. var locale,
  2802. parentConfig = baseConfig;
  2803. config.abbr = name;
  2804. if (locales[name] != null) {
  2805. deprecateSimple(
  2806. 'defineLocaleOverride',
  2807. 'use moment.updateLocale(localeName, config) to change ' +
  2808. 'an existing locale. moment.defineLocale(localeName, ' +
  2809. 'config) should only be used for creating a new locale ' +
  2810. 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'
  2811. );
  2812. parentConfig = locales[name]._config;
  2813. } else if (config.parentLocale != null) {
  2814. if (locales[config.parentLocale] != null) {
  2815. parentConfig = locales[config.parentLocale]._config;
  2816. } else {
  2817. locale = loadLocale(config.parentLocale);
  2818. if (locale != null) {
  2819. parentConfig = locale._config;
  2820. } else {
  2821. if (!localeFamilies[config.parentLocale]) {
  2822. localeFamilies[config.parentLocale] = [];
  2823. }
  2824. localeFamilies[config.parentLocale].push({
  2825. name: name,
  2826. config: config,
  2827. });
  2828. return null;
  2829. }
  2830. }
  2831. }
  2832. locales[name] = new Locale(mergeConfigs(parentConfig, config));
  2833. if (localeFamilies[name]) {
  2834. localeFamilies[name].forEach(function (x) {
  2835. defineLocale(x.name, x.config);
  2836. });
  2837. }
  2838. // backwards compat for now: also set the locale
  2839. // make sure we set the locale AFTER all child locales have been
  2840. // created, so we won't end up with the child locale set.
  2841. getSetGlobalLocale(name);
  2842. return locales[name];
  2843. } else {
  2844. // useful for testing
  2845. delete locales[name];
  2846. return null;
  2847. }
  2848. }
  2849. function updateLocale(name, config) {
  2850. if (config != null) {
  2851. var locale,
  2852. tmpLocale,
  2853. parentConfig = baseConfig;
  2854. if (locales[name] != null && locales[name].parentLocale != null) {
  2855. // Update existing child locale in-place to avoid memory-leaks
  2856. locales[name].set(mergeConfigs(locales[name]._config, config));
  2857. } else {
  2858. // MERGE
  2859. tmpLocale = loadLocale(name);
  2860. if (tmpLocale != null) {
  2861. parentConfig = tmpLocale._config;
  2862. }
  2863. config = mergeConfigs(parentConfig, config);
  2864. if (tmpLocale == null) {
  2865. // updateLocale is called for creating a new locale
  2866. // Set abbr so it will have a name (getters return
  2867. // undefined otherwise).
  2868. config.abbr = name;
  2869. }
  2870. locale = new Locale(config);
  2871. locale.parentLocale = locales[name];
  2872. locales[name] = locale;
  2873. }
  2874. // backwards compat for now: also set the locale
  2875. getSetGlobalLocale(name);
  2876. } else {
  2877. // pass null for config to unupdate, useful for tests
  2878. if (locales[name] != null) {
  2879. if (locales[name].parentLocale != null) {
  2880. locales[name] = locales[name].parentLocale;
  2881. if (name === getSetGlobalLocale()) {
  2882. getSetGlobalLocale(name);
  2883. }
  2884. } else if (locales[name] != null) {
  2885. delete locales[name];
  2886. }
  2887. }
  2888. }
  2889. return locales[name];
  2890. }
  2891. // returns locale data
  2892. function getLocale(key) {
  2893. var locale;
  2894. if (key && key._locale && key._locale._abbr) {
  2895. key = key._locale._abbr;
  2896. }
  2897. if (!key) {
  2898. return globalLocale;
  2899. }
  2900. if (!isArray(key)) {
  2901. //short-circuit everything else
  2902. locale = loadLocale(key);
  2903. if (locale) {
  2904. return locale;
  2905. }
  2906. key = [key];
  2907. }
  2908. return chooseLocale(key);
  2909. }
  2910. function listLocales() {
  2911. return keys(locales);
  2912. }
  2913. function checkOverflow(m) {
  2914. var overflow,
  2915. a = m._a;
  2916. if (a && getParsingFlags(m).overflow === -2) {
  2917. overflow =
  2918. a[MONTH] < 0 || a[MONTH] > 11
  2919. ? MONTH
  2920. : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
  2921. ? DATE
  2922. : a[HOUR] < 0 ||
  2923. a[HOUR] > 24 ||
  2924. (a[HOUR] === 24 &&
  2925. (a[MINUTE] !== 0 ||
  2926. a[SECOND] !== 0 ||
  2927. a[MILLISECOND] !== 0))
  2928. ? HOUR
  2929. : a[MINUTE] < 0 || a[MINUTE] > 59
  2930. ? MINUTE
  2931. : a[SECOND] < 0 || a[SECOND] > 59
  2932. ? SECOND
  2933. : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
  2934. ? MILLISECOND
  2935. : -1;
  2936. if (
  2937. getParsingFlags(m)._overflowDayOfYear &&
  2938. (overflow < YEAR || overflow > DATE)
  2939. ) {
  2940. overflow = DATE;
  2941. }
  2942. if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
  2943. overflow = WEEK;
  2944. }
  2945. if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
  2946. overflow = WEEKDAY;
  2947. }
  2948. getParsingFlags(m).overflow = overflow;
  2949. }
  2950. return m;
  2951. }
  2952. // iso 8601 regex
  2953. // 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)
  2954. 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)?)?$/,
  2955. 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)?)?$/,
  2956. tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
  2957. isoDates = [
  2958. ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
  2959. ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
  2960. ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
  2961. ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
  2962. ['YYYY-DDD', /\d{4}-\d{3}/],
  2963. ['YYYY-MM', /\d{4}-\d\d/, false],
  2964. ['YYYYYYMMDD', /[+-]\d{10}/],
  2965. ['YYYYMMDD', /\d{8}/],
  2966. ['GGGG[W]WWE', /\d{4}W\d{3}/],
  2967. ['GGGG[W]WW', /\d{4}W\d{2}/, false],
  2968. ['YYYYDDD', /\d{7}/],
  2969. ['YYYYMM', /\d{6}/, false],
  2970. ['YYYY', /\d{4}/, false],
  2971. ],
  2972. // iso time formats and regexes
  2973. isoTimes = [
  2974. ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
  2975. ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
  2976. ['HH:mm:ss', /\d\d:\d\d:\d\d/],
  2977. ['HH:mm', /\d\d:\d\d/],
  2978. ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
  2979. ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
  2980. ['HHmmss', /\d\d\d\d\d\d/],
  2981. ['HHmm', /\d\d\d\d/],
  2982. ['HH', /\d\d/],
  2983. ],
  2984. aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
  2985. // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
  2986. rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,
  2987. obsOffsets = {
  2988. UT: 0,
  2989. GMT: 0,
  2990. EDT: -4 * 60,
  2991. EST: -5 * 60,
  2992. CDT: -5 * 60,
  2993. CST: -6 * 60,
  2994. MDT: -6 * 60,
  2995. MST: -7 * 60,
  2996. PDT: -7 * 60,
  2997. PST: -8 * 60,
  2998. };
  2999. // date from iso format
  3000. function configFromISO(config) {
  3001. var i,
  3002. l,
  3003. string = config._i,
  3004. match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
  3005. allowTime,
  3006. dateFormat,
  3007. timeFormat,
  3008. tzFormat;
  3009. if (match) {
  3010. getParsingFlags(config).iso = true;
  3011. for (i = 0, l = isoDates.length; i < l; i++) {
  3012. if (isoDates[i][1].exec(match[1])) {
  3013. dateFormat = isoDates[i][0];
  3014. allowTime = isoDates[i][2] !== false;
  3015. break;
  3016. }
  3017. }
  3018. if (dateFormat == null) {
  3019. config._isValid = false;
  3020. return;
  3021. }
  3022. if (match[3]) {
  3023. for (i = 0, l = isoTimes.length; i < l; i++) {
  3024. if (isoTimes[i][1].exec(match[3])) {
  3025. // match[2] should be 'T' or space
  3026. timeFormat = (match[2] || ' ') + isoTimes[i][0];
  3027. break;
  3028. }
  3029. }
  3030. if (timeFormat == null) {
  3031. config._isValid = false;
  3032. return;
  3033. }
  3034. }
  3035. if (!allowTime && timeFormat != null) {
  3036. config._isValid = false;
  3037. return;
  3038. }
  3039. if (match[4]) {
  3040. if (tzRegex.exec(match[4])) {
  3041. tzFormat = 'Z';
  3042. } else {
  3043. config._isValid = false;
  3044. return;
  3045. }
  3046. }
  3047. config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
  3048. configFromStringAndFormat(config);
  3049. } else {
  3050. config._isValid = false;
  3051. }
  3052. }
  3053. function extractFromRFC2822Strings(
  3054. yearStr,
  3055. monthStr,
  3056. dayStr,
  3057. hourStr,
  3058. minuteStr,
  3059. secondStr
  3060. ) {
  3061. var result = [
  3062. untruncateYear(yearStr),
  3063. defaultLocaleMonthsShort.indexOf(monthStr),
  3064. parseInt(dayStr, 10),
  3065. parseInt(hourStr, 10),
  3066. parseInt(minuteStr, 10),
  3067. ];
  3068. if (secondStr) {
  3069. result.push(parseInt(secondStr, 10));
  3070. }
  3071. return result;
  3072. }
  3073. function untruncateYear(yearStr) {
  3074. var year = parseInt(yearStr, 10);
  3075. if (year <= 49) {
  3076. return 2000 + year;
  3077. } else if (year <= 999) {
  3078. return 1900 + year;
  3079. }
  3080. return year;
  3081. }
  3082. function preprocessRFC2822(s) {
  3083. // Remove comments and folding whitespace and replace multiple-spaces with a single space
  3084. return s
  3085. .replace(/\([^)]*\)|[\n\t]/g, ' ')
  3086. .replace(/(\s\s+)/g, ' ')
  3087. .replace(/^\s\s*/, '')
  3088. .replace(/\s\s*$/, '');
  3089. }
  3090. function checkWeekday(weekdayStr, parsedInput, config) {
  3091. if (weekdayStr) {
  3092. // TODO: Replace the vanilla JS Date object with an independent day-of-week check.
  3093. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
  3094. weekdayActual = new Date(
  3095. parsedInput[0],
  3096. parsedInput[1],
  3097. parsedInput[2]
  3098. ).getDay();
  3099. if (weekdayProvided !== weekdayActual) {
  3100. getParsingFlags(config).weekdayMismatch = true;
  3101. config._isValid = false;
  3102. return false;
  3103. }
  3104. }
  3105. return true;
  3106. }
  3107. function calculateOffset(obsOffset, militaryOffset, numOffset) {
  3108. if (obsOffset) {
  3109. return obsOffsets[obsOffset];
  3110. } else if (militaryOffset) {
  3111. // the only allowed military tz is Z
  3112. return 0;
  3113. } else {
  3114. var hm = parseInt(numOffset, 10),
  3115. m = hm % 100,
  3116. h = (hm - m) / 100;
  3117. return h * 60 + m;
  3118. }
  3119. }
  3120. // date and time from ref 2822 format
  3121. function configFromRFC2822(config) {
  3122. var match = rfc2822.exec(preprocessRFC2822(config._i)),
  3123. parsedArray;
  3124. if (match) {
  3125. parsedArray = extractFromRFC2822Strings(
  3126. match[4],
  3127. match[3],
  3128. match[2],
  3129. match[5],
  3130. match[6],
  3131. match[7]
  3132. );
  3133. if (!checkWeekday(match[1], parsedArray, config)) {
  3134. return;
  3135. }
  3136. config._a = parsedArray;
  3137. config._tzm = calculateOffset(match[8], match[9], match[10]);
  3138. config._d = createUTCDate.apply(null, config._a);
  3139. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  3140. getParsingFlags(config).rfc2822 = true;
  3141. } else {
  3142. config._isValid = false;
  3143. }
  3144. }
  3145. // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict
  3146. function configFromString(config) {
  3147. var matched = aspNetJsonRegex.exec(config._i);
  3148. if (matched !== null) {
  3149. config._d = new Date(+matched[1]);
  3150. return;
  3151. }
  3152. configFromISO(config);
  3153. if (config._isValid === false) {
  3154. delete config._isValid;
  3155. } else {
  3156. return;
  3157. }
  3158. configFromRFC2822(config);
  3159. if (config._isValid === false) {
  3160. delete config._isValid;
  3161. } else {
  3162. return;
  3163. }
  3164. if (config._strict) {
  3165. config._isValid = false;
  3166. } else {
  3167. // Final attempt, use Input Fallback
  3168. hooks.createFromInputFallback(config);
  3169. }
  3170. }
  3171. hooks.createFromInputFallback = deprecate(
  3172. 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
  3173. 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
  3174. 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',
  3175. function (config) {
  3176. config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
  3177. }
  3178. );
  3179. // Pick the first defined of two or three arguments.
  3180. function defaults(a, b, c) {
  3181. if (a != null) {
  3182. return a;
  3183. }
  3184. if (b != null) {
  3185. return b;
  3186. }
  3187. return c;
  3188. }
  3189. function currentDateArray(config) {
  3190. // hooks is actually the exported moment object
  3191. var nowValue = new Date(hooks.now());
  3192. if (config._useUTC) {
  3193. return [
  3194. nowValue.getUTCFullYear(),
  3195. nowValue.getUTCMonth(),
  3196. nowValue.getUTCDate(),
  3197. ];
  3198. }
  3199. return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
  3200. }
  3201. // convert an array to a date.
  3202. // the array should mirror the parameters below
  3203. // note: all values past the year are optional and will default to the lowest possible value.
  3204. // [year, month, day , hour, minute, second, millisecond]
  3205. function configFromArray(config) {
  3206. var i,
  3207. date,
  3208. input = [],
  3209. currentDate,
  3210. expectedWeekday,
  3211. yearToUse;
  3212. if (config._d) {
  3213. return;
  3214. }
  3215. currentDate = currentDateArray(config);
  3216. //compute day of the year from weeks and weekdays
  3217. if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
  3218. dayOfYearFromWeekInfo(config);
  3219. }
  3220. //if the day of the year is set, figure out what it is
  3221. if (config._dayOfYear != null) {
  3222. yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
  3223. if (
  3224. config._dayOfYear > daysInYear(yearToUse) ||
  3225. config._dayOfYear === 0
  3226. ) {
  3227. getParsingFlags(config)._overflowDayOfYear = true;
  3228. }
  3229. date = createUTCDate(yearToUse, 0, config._dayOfYear);
  3230. config._a[MONTH] = date.getUTCMonth();
  3231. config._a[DATE] = date.getUTCDate();
  3232. }
  3233. // Default to current date.
  3234. // * if no year, month, day of month are given, default to today
  3235. // * if day of month is given, default month and year
  3236. // * if month is given, default only year
  3237. // * if year is given, don't default anything
  3238. for (i = 0; i < 3 && config._a[i] == null; ++i) {
  3239. config._a[i] = input[i] = currentDate[i];
  3240. }
  3241. // Zero out whatever was not defaulted, including time
  3242. for (; i < 7; i++) {
  3243. config._a[i] = input[i] =
  3244. config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];
  3245. }
  3246. // Check for 24:00:00.000
  3247. if (
  3248. config._a[HOUR] === 24 &&
  3249. config._a[MINUTE] === 0 &&
  3250. config._a[SECOND] === 0 &&
  3251. config._a[MILLISECOND] === 0
  3252. ) {
  3253. config._nextDay = true;
  3254. config._a[HOUR] = 0;
  3255. }
  3256. config._d = (config._useUTC ? createUTCDate : createDate).apply(
  3257. null,
  3258. input
  3259. );
  3260. expectedWeekday = config._useUTC
  3261. ? config._d.getUTCDay()
  3262. : config._d.getDay();
  3263. // Apply timezone offset from input. The actual utcOffset can be changed
  3264. // with parseZone.
  3265. if (config._tzm != null) {
  3266. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  3267. }
  3268. if (config._nextDay) {
  3269. config._a[HOUR] = 24;
  3270. }
  3271. // check for mismatching day of week
  3272. if (
  3273. config._w &&
  3274. typeof config._w.d !== 'undefined' &&
  3275. config._w.d !== expectedWeekday
  3276. ) {
  3277. getParsingFlags(config).weekdayMismatch = true;
  3278. }
  3279. }
  3280. function dayOfYearFromWeekInfo(config) {
  3281. var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
  3282. w = config._w;
  3283. if (w.GG != null || w.W != null || w.E != null) {
  3284. dow = 1;
  3285. doy = 4;
  3286. // TODO: We need to take the current isoWeekYear, but that depends on
  3287. // how we interpret now (local, utc, fixed offset). So create
  3288. // a now version of current config (take local/utc/offset flags, and
  3289. // create now).
  3290. weekYear = defaults(
  3291. w.GG,
  3292. config._a[YEAR],
  3293. weekOfYear(createLocal(), 1, 4).year
  3294. );
  3295. week = defaults(w.W, 1);
  3296. weekday = defaults(w.E, 1);
  3297. if (weekday < 1 || weekday > 7) {
  3298. weekdayOverflow = true;
  3299. }
  3300. } else {
  3301. dow = config._locale._week.dow;
  3302. doy = config._locale._week.doy;
  3303. curWeek = weekOfYear(createLocal(), dow, doy);
  3304. weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
  3305. // Default to current week.
  3306. week = defaults(w.w, curWeek.week);
  3307. if (w.d != null) {
  3308. // weekday -- low day numbers are considered next week
  3309. weekday = w.d;
  3310. if (weekday < 0 || weekday > 6) {
  3311. weekdayOverflow = true;
  3312. }
  3313. } else if (w.e != null) {
  3314. // local weekday -- counting starts from beginning of week
  3315. weekday = w.e + dow;
  3316. if (w.e < 0 || w.e > 6) {
  3317. weekdayOverflow = true;
  3318. }
  3319. } else {
  3320. // default to beginning of week
  3321. weekday = dow;
  3322. }
  3323. }
  3324. if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
  3325. getParsingFlags(config)._overflowWeeks = true;
  3326. } else if (weekdayOverflow != null) {
  3327. getParsingFlags(config)._overflowWeekday = true;
  3328. } else {
  3329. temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
  3330. config._a[YEAR] = temp.year;
  3331. config._dayOfYear = temp.dayOfYear;
  3332. }
  3333. }
  3334. // constant that refers to the ISO standard
  3335. hooks.ISO_8601 = function () {};
  3336. // constant that refers to the RFC 2822 form
  3337. hooks.RFC_2822 = function () {};
  3338. // date from string and format string
  3339. function configFromStringAndFormat(config) {
  3340. // TODO: Move this to another part of the creation flow to prevent circular deps
  3341. if (config._f === hooks.ISO_8601) {
  3342. configFromISO(config);
  3343. return;
  3344. }
  3345. if (config._f === hooks.RFC_2822) {
  3346. configFromRFC2822(config);
  3347. return;
  3348. }
  3349. config._a = [];
  3350. getParsingFlags(config).empty = true;
  3351. // This array is used to make a Date, either with `new Date` or `Date.UTC`
  3352. var string = '' + config._i,
  3353. i,
  3354. parsedInput,
  3355. tokens,
  3356. token,
  3357. skipped,
  3358. stringLength = string.length,
  3359. totalParsedInputLength = 0,
  3360. era;
  3361. tokens =
  3362. expandFormat(config._f, config._locale).match(formattingTokens) || [];
  3363. for (i = 0; i < tokens.length; i++) {
  3364. token = tokens[i];
  3365. parsedInput = (string.match(getParseRegexForToken(token, config)) ||
  3366. [])[0];
  3367. if (parsedInput) {
  3368. skipped = string.substr(0, string.indexOf(parsedInput));
  3369. if (skipped.length > 0) {
  3370. getParsingFlags(config).unusedInput.push(skipped);
  3371. }
  3372. string = string.slice(
  3373. string.indexOf(parsedInput) + parsedInput.length
  3374. );
  3375. totalParsedInputLength += parsedInput.length;
  3376. }
  3377. // don't parse if it's not a known token
  3378. if (formatTokenFunctions[token]) {
  3379. if (parsedInput) {
  3380. getParsingFlags(config).empty = false;
  3381. } else {
  3382. getParsingFlags(config).unusedTokens.push(token);
  3383. }
  3384. addTimeToArrayFromToken(token, parsedInput, config);
  3385. } else if (config._strict && !parsedInput) {
  3386. getParsingFlags(config).unusedTokens.push(token);
  3387. }
  3388. }
  3389. // add remaining unparsed input length to the string
  3390. getParsingFlags(config).charsLeftOver =
  3391. stringLength - totalParsedInputLength;
  3392. if (string.length > 0) {
  3393. getParsingFlags(config).unusedInput.push(string);
  3394. }
  3395. // clear _12h flag if hour is <= 12
  3396. if (
  3397. config._a[HOUR] <= 12 &&
  3398. getParsingFlags(config).bigHour === true &&
  3399. config._a[HOUR] > 0
  3400. ) {
  3401. getParsingFlags(config).bigHour = undefined;
  3402. }
  3403. getParsingFlags(config).parsedDateParts = config._a.slice(0);
  3404. getParsingFlags(config).meridiem = config._meridiem;
  3405. // handle meridiem
  3406. config._a[HOUR] = meridiemFixWrap(
  3407. config._locale,
  3408. config._a[HOUR],
  3409. config._meridiem
  3410. );
  3411. // handle era
  3412. era = getParsingFlags(config).era;
  3413. if (era !== null) {
  3414. config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);
  3415. }
  3416. configFromArray(config);
  3417. checkOverflow(config);
  3418. }
  3419. function meridiemFixWrap(locale, hour, meridiem) {
  3420. var isPm;
  3421. if (meridiem == null) {
  3422. // nothing to do
  3423. return hour;
  3424. }
  3425. if (locale.meridiemHour != null) {
  3426. return locale.meridiemHour(hour, meridiem);
  3427. } else if (locale.isPM != null) {
  3428. // Fallback
  3429. isPm = locale.isPM(meridiem);
  3430. if (isPm && hour < 12) {
  3431. hour += 12;
  3432. }
  3433. if (!isPm && hour === 12) {
  3434. hour = 0;
  3435. }
  3436. return hour;
  3437. } else {
  3438. // this is not supposed to happen
  3439. return hour;
  3440. }
  3441. }
  3442. // date from string and array of format strings
  3443. function configFromStringAndArray(config) {
  3444. var tempConfig,
  3445. bestMoment,
  3446. scoreToBeat,
  3447. i,
  3448. currentScore,
  3449. validFormatFound,
  3450. bestFormatIsValid = false;
  3451. if (config._f.length === 0) {
  3452. getParsingFlags(config).invalidFormat = true;
  3453. config._d = new Date(NaN);
  3454. return;
  3455. }
  3456. for (i = 0; i < config._f.length; i++) {
  3457. currentScore = 0;
  3458. validFormatFound = false;
  3459. tempConfig = copyConfig({}, config);
  3460. if (config._useUTC != null) {
  3461. tempConfig._useUTC = config._useUTC;
  3462. }
  3463. tempConfig._f = config._f[i];
  3464. configFromStringAndFormat(tempConfig);
  3465. if (isValid(tempConfig)) {
  3466. validFormatFound = true;
  3467. }
  3468. // if there is any input that was not parsed add a penalty for that format
  3469. currentScore += getParsingFlags(tempConfig).charsLeftOver;
  3470. //or tokens
  3471. currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
  3472. getParsingFlags(tempConfig).score = currentScore;
  3473. if (!bestFormatIsValid) {
  3474. if (
  3475. scoreToBeat == null ||
  3476. currentScore < scoreToBeat ||
  3477. validFormatFound
  3478. ) {
  3479. scoreToBeat = currentScore;
  3480. bestMoment = tempConfig;
  3481. if (validFormatFound) {
  3482. bestFormatIsValid = true;
  3483. }
  3484. }
  3485. } else {
  3486. if (currentScore < scoreToBeat) {
  3487. scoreToBeat = currentScore;
  3488. bestMoment = tempConfig;
  3489. }
  3490. }
  3491. }
  3492. extend(config, bestMoment || tempConfig);
  3493. }
  3494. function configFromObject(config) {
  3495. if (config._d) {
  3496. return;
  3497. }
  3498. var i = normalizeObjectUnits(config._i),
  3499. dayOrDate = i.day === undefined ? i.date : i.day;
  3500. config._a = map(
  3501. [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],
  3502. function (obj) {
  3503. return obj && parseInt(obj, 10);
  3504. }
  3505. );
  3506. configFromArray(config);
  3507. }
  3508. function createFromConfig(config) {
  3509. var res = new Moment(checkOverflow(prepareConfig(config)));
  3510. if (res._nextDay) {
  3511. // Adding is smart enough around DST
  3512. res.add(1, 'd');
  3513. res._nextDay = undefined;
  3514. }
  3515. return res;
  3516. }
  3517. function prepareConfig(config) {
  3518. var input = config._i,
  3519. format = config._f;
  3520. config._locale = config._locale || getLocale(config._l);
  3521. if (input === null || (format === undefined && input === '')) {
  3522. return createInvalid({ nullInput: true });
  3523. }
  3524. if (typeof input === 'string') {
  3525. config._i = input = config._locale.preparse(input);
  3526. }
  3527. if (isMoment(input)) {
  3528. return new Moment(checkOverflow(input));
  3529. } else if (isDate(input)) {
  3530. config._d = input;
  3531. } else if (isArray(format)) {
  3532. configFromStringAndArray(config);
  3533. } else if (format) {
  3534. configFromStringAndFormat(config);
  3535. } else {
  3536. configFromInput(config);
  3537. }
  3538. if (!isValid(config)) {
  3539. config._d = null;
  3540. }
  3541. return config;
  3542. }
  3543. function configFromInput(config) {
  3544. var input = config._i;
  3545. if (isUndefined(input)) {
  3546. config._d = new Date(hooks.now());
  3547. } else if (isDate(input)) {
  3548. config._d = new Date(input.valueOf());
  3549. } else if (typeof input === 'string') {
  3550. configFromString(config);
  3551. } else if (isArray(input)) {
  3552. config._a = map(input.slice(0), function (obj) {
  3553. return parseInt(obj, 10);
  3554. });
  3555. configFromArray(config);
  3556. } else if (isObject(input)) {
  3557. configFromObject(config);
  3558. } else if (isNumber(input)) {
  3559. // from milliseconds
  3560. config._d = new Date(input);
  3561. } else {
  3562. hooks.createFromInputFallback(config);
  3563. }
  3564. }
  3565. function createLocalOrUTC(input, format, locale, strict, isUTC) {
  3566. var c = {};
  3567. if (format === true || format === false) {
  3568. strict = format;
  3569. format = undefined;
  3570. }
  3571. if (locale === true || locale === false) {
  3572. strict = locale;
  3573. locale = undefined;
  3574. }
  3575. if (
  3576. (isObject(input) && isObjectEmpty(input)) ||
  3577. (isArray(input) && input.length === 0)
  3578. ) {
  3579. input = undefined;
  3580. }
  3581. // object construction must be done this way.
  3582. // https://github.com/moment/moment/issues/1423
  3583. c._isAMomentObject = true;
  3584. c._useUTC = c._isUTC = isUTC;
  3585. c._l = locale;
  3586. c._i = input;
  3587. c._f = format;
  3588. c._strict = strict;
  3589. return createFromConfig(c);
  3590. }
  3591. function createLocal(input, format, locale, strict) {
  3592. return createLocalOrUTC(input, format, locale, strict, false);
  3593. }
  3594. var prototypeMin = deprecate(
  3595. 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
  3596. function () {
  3597. var other = createLocal.apply(null, arguments);
  3598. if (this.isValid() && other.isValid()) {
  3599. return other < this ? this : other;
  3600. } else {
  3601. return createInvalid();
  3602. }
  3603. }
  3604. ),
  3605. prototypeMax = deprecate(
  3606. 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
  3607. function () {
  3608. var other = createLocal.apply(null, arguments);
  3609. if (this.isValid() && other.isValid()) {
  3610. return other > this ? this : other;
  3611. } else {
  3612. return createInvalid();
  3613. }
  3614. }
  3615. );
  3616. // Pick a moment m from moments so that m[fn](other) is true for all
  3617. // other. This relies on the function fn to be transitive.
  3618. //
  3619. // moments should either be an array of moment objects or an array, whose
  3620. // first element is an array of moment objects.
  3621. function pickBy(fn, moments) {
  3622. var res, i;
  3623. if (moments.length === 1 && isArray(moments[0])) {
  3624. moments = moments[0];
  3625. }
  3626. if (!moments.length) {
  3627. return createLocal();
  3628. }
  3629. res = moments[0];
  3630. for (i = 1; i < moments.length; ++i) {
  3631. if (!moments[i].isValid() || moments[i][fn](res)) {
  3632. res = moments[i];
  3633. }
  3634. }
  3635. return res;
  3636. }
  3637. // TODO: Use [].sort instead?
  3638. function min() {
  3639. var args = [].slice.call(arguments, 0);
  3640. return pickBy('isBefore', args);
  3641. }
  3642. function max() {
  3643. var args = [].slice.call(arguments, 0);
  3644. return pickBy('isAfter', args);
  3645. }
  3646. var now = function () {
  3647. return Date.now ? Date.now() : +new Date();
  3648. };
  3649. var ordering = [
  3650. 'year',
  3651. 'quarter',
  3652. 'month',
  3653. 'week',
  3654. 'day',
  3655. 'hour',
  3656. 'minute',
  3657. 'second',
  3658. 'millisecond',
  3659. ];
  3660. function isDurationValid(m) {
  3661. var key,
  3662. unitHasDecimal = false,
  3663. i;
  3664. for (key in m) {
  3665. if (
  3666. hasOwnProp(m, key) &&
  3667. !(
  3668. indexOf.call(ordering, key) !== -1 &&
  3669. (m[key] == null || !isNaN(m[key]))
  3670. )
  3671. ) {
  3672. return false;
  3673. }
  3674. }
  3675. for (i = 0; i < ordering.length; ++i) {
  3676. if (m[ordering[i]]) {
  3677. if (unitHasDecimal) {
  3678. return false; // only allow non-integers for smallest unit
  3679. }
  3680. if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
  3681. unitHasDecimal = true;
  3682. }
  3683. }
  3684. }
  3685. return true;
  3686. }
  3687. function isValid$1() {
  3688. return this._isValid;
  3689. }
  3690. function createInvalid$1() {
  3691. return createDuration(NaN);
  3692. }
  3693. function Duration(duration) {
  3694. var normalizedInput = normalizeObjectUnits(duration),
  3695. years = normalizedInput.year || 0,
  3696. quarters = normalizedInput.quarter || 0,
  3697. months = normalizedInput.month || 0,
  3698. weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
  3699. days = normalizedInput.day || 0,
  3700. hours = normalizedInput.hour || 0,
  3701. minutes = normalizedInput.minute || 0,
  3702. seconds = normalizedInput.second || 0,
  3703. milliseconds = normalizedInput.millisecond || 0;
  3704. this._isValid = isDurationValid(normalizedInput);
  3705. // representation for dateAddRemove
  3706. this._milliseconds =
  3707. +milliseconds +
  3708. seconds * 1e3 + // 1000
  3709. minutes * 6e4 + // 1000 * 60
  3710. hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
  3711. // Because of dateAddRemove treats 24 hours as different from a
  3712. // day when working around DST, we need to store them separately
  3713. this._days = +days + weeks * 7;
  3714. // It is impossible to translate months into days without knowing
  3715. // which months you are are talking about, so we have to store
  3716. // it separately.
  3717. this._months = +months + quarters * 3 + years * 12;
  3718. this._data = {};
  3719. this._locale = getLocale();
  3720. this._bubble();
  3721. }
  3722. function isDuration(obj) {
  3723. return obj instanceof Duration;
  3724. }
  3725. function absRound(number) {
  3726. if (number < 0) {
  3727. return Math.round(-1 * number) * -1;
  3728. } else {
  3729. return Math.round(number);
  3730. }
  3731. }
  3732. // compare two arrays, return the number of differences
  3733. function compareArrays(array1, array2, dontConvert) {
  3734. var len = Math.min(array1.length, array2.length),
  3735. lengthDiff = Math.abs(array1.length - array2.length),
  3736. diffs = 0,
  3737. i;
  3738. for (i = 0; i < len; i++) {
  3739. if (
  3740. (dontConvert && array1[i] !== array2[i]) ||
  3741. (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))
  3742. ) {
  3743. diffs++;
  3744. }
  3745. }
  3746. return diffs + lengthDiff;
  3747. }
  3748. // FORMATTING
  3749. function offset(token, separator) {
  3750. addFormatToken(token, 0, 0, function () {
  3751. var offset = this.utcOffset(),
  3752. sign = '+';
  3753. if (offset < 0) {
  3754. offset = -offset;
  3755. sign = '-';
  3756. }
  3757. return (
  3758. sign +
  3759. zeroFill(~~(offset / 60), 2) +
  3760. separator +
  3761. zeroFill(~~offset % 60, 2)
  3762. );
  3763. });
  3764. }
  3765. offset('Z', ':');
  3766. offset('ZZ', '');
  3767. // PARSING
  3768. addRegexToken('Z', matchShortOffset);
  3769. addRegexToken('ZZ', matchShortOffset);
  3770. addParseToken(['Z', 'ZZ'], function (input, array, config) {
  3771. config._useUTC = true;
  3772. config._tzm = offsetFromString(matchShortOffset, input);
  3773. });
  3774. // HELPERS
  3775. // timezone chunker
  3776. // '+10:00' > ['10', '00']
  3777. // '-1530' > ['-15', '30']
  3778. var chunkOffset = /([\+\-]|\d\d)/gi;
  3779. function offsetFromString(matcher, string) {
  3780. var matches = (string || '').match(matcher),
  3781. chunk,
  3782. parts,
  3783. minutes;
  3784. if (matches === null) {
  3785. return null;
  3786. }
  3787. chunk = matches[matches.length - 1] || [];
  3788. parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
  3789. minutes = +(parts[1] * 60) + toInt(parts[2]);
  3790. return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
  3791. }
  3792. // Return a moment from input, that is local/utc/zone equivalent to model.
  3793. function cloneWithOffset(input, model) {
  3794. var res, diff;
  3795. if (model._isUTC) {
  3796. res = model.clone();
  3797. diff =
  3798. (isMoment(input) || isDate(input)
  3799. ? input.valueOf()
  3800. : createLocal(input).valueOf()) - res.valueOf();
  3801. // Use low-level api, because this fn is low-level api.
  3802. res._d.setTime(res._d.valueOf() + diff);
  3803. hooks.updateOffset(res, false);
  3804. return res;
  3805. } else {
  3806. return createLocal(input).local();
  3807. }
  3808. }
  3809. function getDateOffset(m) {
  3810. // On Firefox.24 Date#getTimezoneOffset returns a floating point.
  3811. // https://github.com/moment/moment/pull/1871
  3812. return -Math.round(m._d.getTimezoneOffset());
  3813. }
  3814. // HOOKS
  3815. // This function will be called whenever a moment is mutated.
  3816. // It is intended to keep the offset in sync with the timezone.
  3817. hooks.updateOffset = function () {};
  3818. // MOMENTS
  3819. // keepLocalTime = true means only change the timezone, without
  3820. // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
  3821. // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
  3822. // +0200, so we adjust the time as needed, to be valid.
  3823. //
  3824. // Keeping the time actually adds/subtracts (one hour)
  3825. // from the actual represented time. That is why we call updateOffset
  3826. // a second time. In case it wants us to change the offset again
  3827. // _changeInProgress == true case, then we have to adjust, because
  3828. // there is no such time in the given timezone.
  3829. function getSetOffset(input, keepLocalTime, keepMinutes) {
  3830. var offset = this._offset || 0,
  3831. localAdjust;
  3832. if (!this.isValid()) {
  3833. return input != null ? this : NaN;
  3834. }
  3835. if (input != null) {
  3836. if (typeof input === 'string') {
  3837. input = offsetFromString(matchShortOffset, input);
  3838. if (input === null) {
  3839. return this;
  3840. }
  3841. } else if (Math.abs(input) < 16 && !keepMinutes) {
  3842. input = input * 60;
  3843. }
  3844. if (!this._isUTC && keepLocalTime) {
  3845. localAdjust = getDateOffset(this);
  3846. }
  3847. this._offset = input;
  3848. this._isUTC = true;
  3849. if (localAdjust != null) {
  3850. this.add(localAdjust, 'm');
  3851. }
  3852. if (offset !== input) {
  3853. if (!keepLocalTime || this._changeInProgress) {
  3854. addSubtract(
  3855. this,
  3856. createDuration(input - offset, 'm'),
  3857. 1,
  3858. false
  3859. );
  3860. } else if (!this._changeInProgress) {
  3861. this._changeInProgress = true;
  3862. hooks.updateOffset(this, true);
  3863. this._changeInProgress = null;
  3864. }
  3865. }
  3866. return this;
  3867. } else {
  3868. return this._isUTC ? offset : getDateOffset(this);
  3869. }
  3870. }
  3871. function getSetZone(input, keepLocalTime) {
  3872. if (input != null) {
  3873. if (typeof input !== 'string') {
  3874. input = -input;
  3875. }
  3876. this.utcOffset(input, keepLocalTime);
  3877. return this;
  3878. } else {
  3879. return -this.utcOffset();
  3880. }
  3881. }
  3882. function setOffsetToUTC(keepLocalTime) {
  3883. return this.utcOffset(0, keepLocalTime);
  3884. }
  3885. function setOffsetToLocal(keepLocalTime) {
  3886. if (this._isUTC) {
  3887. this.utcOffset(0, keepLocalTime);
  3888. this._isUTC = false;
  3889. if (keepLocalTime) {
  3890. this.subtract(getDateOffset(this), 'm');
  3891. }
  3892. }
  3893. return this;
  3894. }
  3895. function setOffsetToParsedOffset() {
  3896. if (this._tzm != null) {
  3897. this.utcOffset(this._tzm, false, true);
  3898. } else if (typeof this._i === 'string') {
  3899. var tZone = offsetFromString(matchOffset, this._i);
  3900. if (tZone != null) {
  3901. this.utcOffset(tZone);
  3902. } else {
  3903. this.utcOffset(0, true);
  3904. }
  3905. }
  3906. return this;
  3907. }
  3908. function hasAlignedHourOffset(input) {
  3909. if (!this.isValid()) {
  3910. return false;
  3911. }
  3912. input = input ? createLocal(input).utcOffset() : 0;
  3913. return (this.utcOffset() - input) % 60 === 0;
  3914. }
  3915. function isDaylightSavingTime() {
  3916. return (
  3917. this.utcOffset() > this.clone().month(0).utcOffset() ||
  3918. this.utcOffset() > this.clone().month(5).utcOffset()
  3919. );
  3920. }
  3921. function isDaylightSavingTimeShifted() {
  3922. if (!isUndefined(this._isDSTShifted)) {
  3923. return this._isDSTShifted;
  3924. }
  3925. var c = {},
  3926. other;
  3927. copyConfig(c, this);
  3928. c = prepareConfig(c);
  3929. if (c._a) {
  3930. other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
  3931. this._isDSTShifted =
  3932. this.isValid() && compareArrays(c._a, other.toArray()) > 0;
  3933. } else {
  3934. this._isDSTShifted = false;
  3935. }
  3936. return this._isDSTShifted;
  3937. }
  3938. function isLocal() {
  3939. return this.isValid() ? !this._isUTC : false;
  3940. }
  3941. function isUtcOffset() {
  3942. return this.isValid() ? this._isUTC : false;
  3943. }
  3944. function isUtc() {
  3945. return this.isValid() ? this._isUTC && this._offset === 0 : false;
  3946. }
  3947. // ASP.NET json date format regex
  3948. var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,
  3949. // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
  3950. // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
  3951. // and further modified to allow for strings containing both week and day
  3952. isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
  3953. function createDuration(input, key) {
  3954. var duration = input,
  3955. // matching against regexp is expensive, do it on demand
  3956. match = null,
  3957. sign,
  3958. ret,
  3959. diffRes;
  3960. if (isDuration(input)) {
  3961. duration = {
  3962. ms: input._milliseconds,
  3963. d: input._days,
  3964. M: input._months,
  3965. };
  3966. } else if (isNumber(input) || !isNaN(+input)) {
  3967. duration = {};
  3968. if (key) {
  3969. duration[key] = +input;
  3970. } else {
  3971. duration.milliseconds = +input;
  3972. }
  3973. } else if ((match = aspNetRegex.exec(input))) {
  3974. sign = match[1] === '-' ? -1 : 1;
  3975. duration = {
  3976. y: 0,
  3977. d: toInt(match[DATE]) * sign,
  3978. h: toInt(match[HOUR]) * sign,
  3979. m: toInt(match[MINUTE]) * sign,
  3980. s: toInt(match[SECOND]) * sign,
  3981. ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match
  3982. };
  3983. } else if ((match = isoRegex.exec(input))) {
  3984. sign = match[1] === '-' ? -1 : 1;
  3985. duration = {
  3986. y: parseIso(match[2], sign),
  3987. M: parseIso(match[3], sign),
  3988. w: parseIso(match[4], sign),
  3989. d: parseIso(match[5], sign),
  3990. h: parseIso(match[6], sign),
  3991. m: parseIso(match[7], sign),
  3992. s: parseIso(match[8], sign),
  3993. };
  3994. } else if (duration == null) {
  3995. // checks for null or undefined
  3996. duration = {};
  3997. } else if (
  3998. typeof duration === 'object' &&
  3999. ('from' in duration || 'to' in duration)
  4000. ) {
  4001. diffRes = momentsDifference(
  4002. createLocal(duration.from),
  4003. createLocal(duration.to)
  4004. );
  4005. duration = {};
  4006. duration.ms = diffRes.milliseconds;
  4007. duration.M = diffRes.months;
  4008. }
  4009. ret = new Duration(duration);
  4010. if (isDuration(input) && hasOwnProp(input, '_locale')) {
  4011. ret._locale = input._locale;
  4012. }
  4013. if (isDuration(input) && hasOwnProp(input, '_isValid')) {
  4014. ret._isValid = input._isValid;
  4015. }
  4016. return ret;
  4017. }
  4018. createDuration.fn = Duration.prototype;
  4019. createDuration.invalid = createInvalid$1;
  4020. function parseIso(inp, sign) {
  4021. // We'd normally use ~~inp for this, but unfortunately it also
  4022. // converts floats to ints.
  4023. // inp may be undefined, so careful calling replace on it.
  4024. var res = inp && parseFloat(inp.replace(',', '.'));
  4025. // apply sign while we're at it
  4026. return (isNaN(res) ? 0 : res) * sign;
  4027. }
  4028. function positiveMomentsDifference(base, other) {
  4029. var res = {};
  4030. res.months =
  4031. other.month() - base.month() + (other.year() - base.year()) * 12;
  4032. if (base.clone().add(res.months, 'M').isAfter(other)) {
  4033. --res.months;
  4034. }
  4035. res.milliseconds = +other - +base.clone().add(res.months, 'M');
  4036. return res;
  4037. }
  4038. function momentsDifference(base, other) {
  4039. var res;
  4040. if (!(base.isValid() && other.isValid())) {
  4041. return { milliseconds: 0, months: 0 };
  4042. }
  4043. other = cloneWithOffset(other, base);
  4044. if (base.isBefore(other)) {
  4045. res = positiveMomentsDifference(base, other);
  4046. } else {
  4047. res = positiveMomentsDifference(other, base);
  4048. res.milliseconds = -res.milliseconds;
  4049. res.months = -res.months;
  4050. }
  4051. return res;
  4052. }
  4053. // TODO: remove 'name' arg after deprecation is removed
  4054. function createAdder(direction, name) {
  4055. return function (val, period) {
  4056. var dur, tmp;
  4057. //invert the arguments, but complain about it
  4058. if (period !== null && !isNaN(+period)) {
  4059. deprecateSimple(
  4060. name,
  4061. 'moment().' +
  4062. name +
  4063. '(period, number) is deprecated. Please use moment().' +
  4064. name +
  4065. '(number, period). ' +
  4066. 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'
  4067. );
  4068. tmp = val;
  4069. val = period;
  4070. period = tmp;
  4071. }
  4072. dur = createDuration(val, period);
  4073. addSubtract(this, dur, direction);
  4074. return this;
  4075. };
  4076. }
  4077. function addSubtract(mom, duration, isAdding, updateOffset) {
  4078. var milliseconds = duration._milliseconds,
  4079. days = absRound(duration._days),
  4080. months = absRound(duration._months);
  4081. if (!mom.isValid()) {
  4082. // No op
  4083. return;
  4084. }
  4085. updateOffset = updateOffset == null ? true : updateOffset;
  4086. if (months) {
  4087. setMonth(mom, get(mom, 'Month') + months * isAdding);
  4088. }
  4089. if (days) {
  4090. set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
  4091. }
  4092. if (milliseconds) {
  4093. mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
  4094. }
  4095. if (updateOffset) {
  4096. hooks.updateOffset(mom, days || months);
  4097. }
  4098. }
  4099. var add = createAdder(1, 'add'),
  4100. subtract = createAdder(-1, 'subtract');
  4101. function isString(input) {
  4102. return typeof input === 'string' || input instanceof String;
  4103. }
  4104. // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined
  4105. function isMomentInput(input) {
  4106. return (
  4107. isMoment(input) ||
  4108. isDate(input) ||
  4109. isString(input) ||
  4110. isNumber(input) ||
  4111. isNumberOrStringArray(input) ||
  4112. isMomentInputObject(input) ||
  4113. input === null ||
  4114. input === undefined
  4115. );
  4116. }
  4117. function isMomentInputObject(input) {
  4118. var objectTest = isObject(input) && !isObjectEmpty(input),
  4119. propertyTest = false,
  4120. properties = [
  4121. 'years',
  4122. 'year',
  4123. 'y',
  4124. 'months',
  4125. 'month',
  4126. 'M',
  4127. 'days',
  4128. 'day',
  4129. 'd',
  4130. 'dates',
  4131. 'date',
  4132. 'D',
  4133. 'hours',
  4134. 'hour',
  4135. 'h',
  4136. 'minutes',
  4137. 'minute',
  4138. 'm',
  4139. 'seconds',
  4140. 'second',
  4141. 's',
  4142. 'milliseconds',
  4143. 'millisecond',
  4144. 'ms',
  4145. ],
  4146. i,
  4147. property;
  4148. for (i = 0; i < properties.length; i += 1) {
  4149. property = properties[i];
  4150. propertyTest = propertyTest || hasOwnProp(input, property);
  4151. }
  4152. return objectTest && propertyTest;
  4153. }
  4154. function isNumberOrStringArray(input) {
  4155. var arrayTest = isArray(input),
  4156. dataTypeTest = false;
  4157. if (arrayTest) {
  4158. dataTypeTest =
  4159. input.filter(function (item) {
  4160. return !isNumber(item) && isString(input);
  4161. }).length === 0;
  4162. }
  4163. return arrayTest && dataTypeTest;
  4164. }
  4165. function isCalendarSpec(input) {
  4166. var objectTest = isObject(input) && !isObjectEmpty(input),
  4167. propertyTest = false,
  4168. properties = [
  4169. 'sameDay',
  4170. 'nextDay',
  4171. 'lastDay',
  4172. 'nextWeek',
  4173. 'lastWeek',
  4174. 'sameElse',
  4175. ],
  4176. i,
  4177. property;
  4178. for (i = 0; i < properties.length; i += 1) {
  4179. property = properties[i];
  4180. propertyTest = propertyTest || hasOwnProp(input, property);
  4181. }
  4182. return objectTest && propertyTest;
  4183. }
  4184. function getCalendarFormat(myMoment, now) {
  4185. var diff = myMoment.diff(now, 'days', true);
  4186. return diff < -6
  4187. ? 'sameElse'
  4188. : diff < -1
  4189. ? 'lastWeek'
  4190. : diff < 0
  4191. ? 'lastDay'
  4192. : diff < 1
  4193. ? 'sameDay'
  4194. : diff < 2
  4195. ? 'nextDay'
  4196. : diff < 7
  4197. ? 'nextWeek'
  4198. : 'sameElse';
  4199. }
  4200. function calendar$1(time, formats) {
  4201. // Support for single parameter, formats only overload to the calendar function
  4202. if (arguments.length === 1) {
  4203. if (!arguments[0]) {
  4204. time = undefined;
  4205. formats = undefined;
  4206. } else if (isMomentInput(arguments[0])) {
  4207. time = arguments[0];
  4208. formats = undefined;
  4209. } else if (isCalendarSpec(arguments[0])) {
  4210. formats = arguments[0];
  4211. time = undefined;
  4212. }
  4213. }
  4214. // We want to compare the start of today, vs this.
  4215. // Getting start-of-today depends on whether we're local/utc/offset or not.
  4216. var now = time || createLocal(),
  4217. sod = cloneWithOffset(now, this).startOf('day'),
  4218. format = hooks.calendarFormat(this, sod) || 'sameElse',
  4219. output =
  4220. formats &&
  4221. (isFunction(formats[format])
  4222. ? formats[format].call(this, now)
  4223. : formats[format]);
  4224. return this.format(
  4225. output || this.localeData().calendar(format, this, createLocal(now))
  4226. );
  4227. }
  4228. function clone() {
  4229. return new Moment(this);
  4230. }
  4231. function isAfter(input, units) {
  4232. var localInput = isMoment(input) ? input : createLocal(input);
  4233. if (!(this.isValid() && localInput.isValid())) {
  4234. return false;
  4235. }
  4236. units = normalizeUnits(units) || 'millisecond';
  4237. if (units === 'millisecond') {
  4238. return this.valueOf() > localInput.valueOf();
  4239. } else {
  4240. return localInput.valueOf() < this.clone().startOf(units).valueOf();
  4241. }
  4242. }
  4243. function isBefore(input, units) {
  4244. var localInput = isMoment(input) ? input : createLocal(input);
  4245. if (!(this.isValid() && localInput.isValid())) {
  4246. return false;
  4247. }
  4248. units = normalizeUnits(units) || 'millisecond';
  4249. if (units === 'millisecond') {
  4250. return this.valueOf() < localInput.valueOf();
  4251. } else {
  4252. return this.clone().endOf(units).valueOf() < localInput.valueOf();
  4253. }
  4254. }
  4255. function isBetween(from, to, units, inclusivity) {
  4256. var localFrom = isMoment(from) ? from : createLocal(from),
  4257. localTo = isMoment(to) ? to : createLocal(to);
  4258. if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
  4259. return false;
  4260. }
  4261. inclusivity = inclusivity || '()';
  4262. return (
  4263. (inclusivity[0] === '('
  4264. ? this.isAfter(localFrom, units)
  4265. : !this.isBefore(localFrom, units)) &&
  4266. (inclusivity[1] === ')'
  4267. ? this.isBefore(localTo, units)
  4268. : !this.isAfter(localTo, units))
  4269. );
  4270. }
  4271. function isSame(input, units) {
  4272. var localInput = isMoment(input) ? input : createLocal(input),
  4273. inputMs;
  4274. if (!(this.isValid() && localInput.isValid())) {
  4275. return false;
  4276. }
  4277. units = normalizeUnits(units) || 'millisecond';
  4278. if (units === 'millisecond') {
  4279. return this.valueOf() === localInput.valueOf();
  4280. } else {
  4281. inputMs = localInput.valueOf();
  4282. return (
  4283. this.clone().startOf(units).valueOf() <= inputMs &&
  4284. inputMs <= this.clone().endOf(units).valueOf()
  4285. );
  4286. }
  4287. }
  4288. function isSameOrAfter(input, units) {
  4289. return this.isSame(input, units) || this.isAfter(input, units);
  4290. }
  4291. function isSameOrBefore(input, units) {
  4292. return this.isSame(input, units) || this.isBefore(input, units);
  4293. }
  4294. function diff(input, units, asFloat) {
  4295. var that, zoneDelta, output;
  4296. if (!this.isValid()) {
  4297. return NaN;
  4298. }
  4299. that = cloneWithOffset(input, this);
  4300. if (!that.isValid()) {
  4301. return NaN;
  4302. }
  4303. zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  4304. units = normalizeUnits(units);
  4305. switch (units) {
  4306. case 'year':
  4307. output = monthDiff(this, that) / 12;
  4308. break;
  4309. case 'month':
  4310. output = monthDiff(this, that);
  4311. break;
  4312. case 'quarter':
  4313. output = monthDiff(this, that) / 3;
  4314. break;
  4315. case 'second':
  4316. output = (this - that) / 1e3;
  4317. break; // 1000
  4318. case 'minute':
  4319. output = (this - that) / 6e4;
  4320. break; // 1000 * 60
  4321. case 'hour':
  4322. output = (this - that) / 36e5;
  4323. break; // 1000 * 60 * 60
  4324. case 'day':
  4325. output = (this - that - zoneDelta) / 864e5;
  4326. break; // 1000 * 60 * 60 * 24, negate dst
  4327. case 'week':
  4328. output = (this - that - zoneDelta) / 6048e5;
  4329. break; // 1000 * 60 * 60 * 24 * 7, negate dst
  4330. default:
  4331. output = this - that;
  4332. }
  4333. return asFloat ? output : absFloor(output);
  4334. }
  4335. function monthDiff(a, b) {
  4336. if (a.date() < b.date()) {
  4337. // end-of-month calculations work correct when the start month has more
  4338. // days than the end month.
  4339. return -monthDiff(b, a);
  4340. }
  4341. // difference in months
  4342. var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
  4343. // b is in (anchor - 1 month, anchor + 1 month)
  4344. anchor = a.clone().add(wholeMonthDiff, 'months'),
  4345. anchor2,
  4346. adjust;
  4347. if (b - anchor < 0) {
  4348. anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
  4349. // linear across the month
  4350. adjust = (b - anchor) / (anchor - anchor2);
  4351. } else {
  4352. anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
  4353. // linear across the month
  4354. adjust = (b - anchor) / (anchor2 - anchor);
  4355. }
  4356. //check for negative zero, return zero if negative zero
  4357. return -(wholeMonthDiff + adjust) || 0;
  4358. }
  4359. hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
  4360. hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
  4361. function toString() {
  4362. return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
  4363. }
  4364. function toISOString(keepOffset) {
  4365. if (!this.isValid()) {
  4366. return null;
  4367. }
  4368. var utc = keepOffset !== true,
  4369. m = utc ? this.clone().utc() : this;
  4370. if (m.year() < 0 || m.year() > 9999) {
  4371. return formatMoment(
  4372. m,
  4373. utc
  4374. ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'
  4375. : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'
  4376. );
  4377. }
  4378. if (isFunction(Date.prototype.toISOString)) {
  4379. // native implementation is ~50x faster, use it when we can
  4380. if (utc) {
  4381. return this.toDate().toISOString();
  4382. } else {
  4383. return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)
  4384. .toISOString()
  4385. .replace('Z', formatMoment(m, 'Z'));
  4386. }
  4387. }
  4388. return formatMoment(
  4389. m,
  4390. utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'
  4391. );
  4392. }
  4393. /**
  4394. * Return a human readable representation of a moment that can
  4395. * also be evaluated to get a new moment which is the same
  4396. *
  4397. * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
  4398. */
  4399. function inspect() {
  4400. if (!this.isValid()) {
  4401. return 'moment.invalid(/* ' + this._i + ' */)';
  4402. }
  4403. var func = 'moment',
  4404. zone = '',
  4405. prefix,
  4406. year,
  4407. datetime,
  4408. suffix;
  4409. if (!this.isLocal()) {
  4410. func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
  4411. zone = 'Z';
  4412. }
  4413. prefix = '[' + func + '("]';
  4414. year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';
  4415. datetime = '-MM-DD[T]HH:mm:ss.SSS';
  4416. suffix = zone + '[")]';
  4417. return this.format(prefix + year + datetime + suffix);
  4418. }
  4419. function format(inputString) {
  4420. if (!inputString) {
  4421. inputString = this.isUtc()
  4422. ? hooks.defaultFormatUtc
  4423. : hooks.defaultFormat;
  4424. }
  4425. var output = formatMoment(this, inputString);
  4426. return this.localeData().postformat(output);
  4427. }
  4428. function from(time, withoutSuffix) {
  4429. if (
  4430. this.isValid() &&
  4431. ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
  4432. ) {
  4433. return createDuration({ to: this, from: time })
  4434. .locale(this.locale())
  4435. .humanize(!withoutSuffix);
  4436. } else {
  4437. return this.localeData().invalidDate();
  4438. }
  4439. }
  4440. function fromNow(withoutSuffix) {
  4441. return this.from(createLocal(), withoutSuffix);
  4442. }
  4443. function to(time, withoutSuffix) {
  4444. if (
  4445. this.isValid() &&
  4446. ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
  4447. ) {
  4448. return createDuration({ from: this, to: time })
  4449. .locale(this.locale())
  4450. .humanize(!withoutSuffix);
  4451. } else {
  4452. return this.localeData().invalidDate();
  4453. }
  4454. }
  4455. function toNow(withoutSuffix) {
  4456. return this.to(createLocal(), withoutSuffix);
  4457. }
  4458. // If passed a locale key, it will set the locale for this
  4459. // instance. Otherwise, it will return the locale configuration
  4460. // variables for this instance.
  4461. function locale(key) {
  4462. var newLocaleData;
  4463. if (key === undefined) {
  4464. return this._locale._abbr;
  4465. } else {
  4466. newLocaleData = getLocale(key);
  4467. if (newLocaleData != null) {
  4468. this._locale = newLocaleData;
  4469. }
  4470. return this;
  4471. }
  4472. }
  4473. var lang = deprecate(
  4474. 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
  4475. function (key) {
  4476. if (key === undefined) {
  4477. return this.localeData();
  4478. } else {
  4479. return this.locale(key);
  4480. }
  4481. }
  4482. );
  4483. function localeData() {
  4484. return this._locale;
  4485. }
  4486. var MS_PER_SECOND = 1000,
  4487. MS_PER_MINUTE = 60 * MS_PER_SECOND,
  4488. MS_PER_HOUR = 60 * MS_PER_MINUTE,
  4489. MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
  4490. // actual modulo - handles negative numbers (for dates before 1970):
  4491. function mod$1(dividend, divisor) {
  4492. return ((dividend % divisor) + divisor) % divisor;
  4493. }
  4494. function localStartOfDate(y, m, d) {
  4495. // the date constructor remaps years 0-99 to 1900-1999
  4496. if (y < 100 && y >= 0) {
  4497. // preserve leap years using a full 400 year cycle, then reset
  4498. return new Date(y + 400, m, d) - MS_PER_400_YEARS;
  4499. } else {
  4500. return new Date(y, m, d).valueOf();
  4501. }
  4502. }
  4503. function utcStartOfDate(y, m, d) {
  4504. // Date.UTC remaps years 0-99 to 1900-1999
  4505. if (y < 100 && y >= 0) {
  4506. // preserve leap years using a full 400 year cycle, then reset
  4507. return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
  4508. } else {
  4509. return Date.UTC(y, m, d);
  4510. }
  4511. }
  4512. function startOf(units) {
  4513. var time, startOfDate;
  4514. units = normalizeUnits(units);
  4515. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  4516. return this;
  4517. }
  4518. startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  4519. switch (units) {
  4520. case 'year':
  4521. time = startOfDate(this.year(), 0, 1);
  4522. break;
  4523. case 'quarter':
  4524. time = startOfDate(
  4525. this.year(),
  4526. this.month() - (this.month() % 3),
  4527. 1
  4528. );
  4529. break;
  4530. case 'month':
  4531. time = startOfDate(this.year(), this.month(), 1);
  4532. break;
  4533. case 'week':
  4534. time = startOfDate(
  4535. this.year(),
  4536. this.month(),
  4537. this.date() - this.weekday()
  4538. );
  4539. break;
  4540. case 'isoWeek':
  4541. time = startOfDate(
  4542. this.year(),
  4543. this.month(),
  4544. this.date() - (this.isoWeekday() - 1)
  4545. );
  4546. break;
  4547. case 'day':
  4548. case 'date':
  4549. time = startOfDate(this.year(), this.month(), this.date());
  4550. break;
  4551. case 'hour':
  4552. time = this._d.valueOf();
  4553. time -= mod$1(
  4554. time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
  4555. MS_PER_HOUR
  4556. );
  4557. break;
  4558. case 'minute':
  4559. time = this._d.valueOf();
  4560. time -= mod$1(time, MS_PER_MINUTE);
  4561. break;
  4562. case 'second':
  4563. time = this._d.valueOf();
  4564. time -= mod$1(time, MS_PER_SECOND);
  4565. break;
  4566. }
  4567. this._d.setTime(time);
  4568. hooks.updateOffset(this, true);
  4569. return this;
  4570. }
  4571. function endOf(units) {
  4572. var time, startOfDate;
  4573. units = normalizeUnits(units);
  4574. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  4575. return this;
  4576. }
  4577. startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  4578. switch (units) {
  4579. case 'year':
  4580. time = startOfDate(this.year() + 1, 0, 1) - 1;
  4581. break;
  4582. case 'quarter':
  4583. time =
  4584. startOfDate(
  4585. this.year(),
  4586. this.month() - (this.month() % 3) + 3,
  4587. 1
  4588. ) - 1;
  4589. break;
  4590. case 'month':
  4591. time = startOfDate(this.year(), this.month() + 1, 1) - 1;
  4592. break;
  4593. case 'week':
  4594. time =
  4595. startOfDate(
  4596. this.year(),
  4597. this.month(),
  4598. this.date() - this.weekday() + 7
  4599. ) - 1;
  4600. break;
  4601. case 'isoWeek':
  4602. time =
  4603. startOfDate(
  4604. this.year(),
  4605. this.month(),
  4606. this.date() - (this.isoWeekday() - 1) + 7
  4607. ) - 1;
  4608. break;
  4609. case 'day':
  4610. case 'date':
  4611. time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
  4612. break;
  4613. case 'hour':
  4614. time = this._d.valueOf();
  4615. time +=
  4616. MS_PER_HOUR -
  4617. mod$1(
  4618. time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
  4619. MS_PER_HOUR
  4620. ) -
  4621. 1;
  4622. break;
  4623. case 'minute':
  4624. time = this._d.valueOf();
  4625. time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
  4626. break;
  4627. case 'second':
  4628. time = this._d.valueOf();
  4629. time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
  4630. break;
  4631. }
  4632. this._d.setTime(time);
  4633. hooks.updateOffset(this, true);
  4634. return this;
  4635. }
  4636. function valueOf() {
  4637. return this._d.valueOf() - (this._offset || 0) * 60000;
  4638. }
  4639. function unix() {
  4640. return Math.floor(this.valueOf() / 1000);
  4641. }
  4642. function toDate() {
  4643. return new Date(this.valueOf());
  4644. }
  4645. function toArray() {
  4646. var m = this;
  4647. return [
  4648. m.year(),
  4649. m.month(),
  4650. m.date(),
  4651. m.hour(),
  4652. m.minute(),
  4653. m.second(),
  4654. m.millisecond(),
  4655. ];
  4656. }
  4657. function toObject() {
  4658. var m = this;
  4659. return {
  4660. years: m.year(),
  4661. months: m.month(),
  4662. date: m.date(),
  4663. hours: m.hours(),
  4664. minutes: m.minutes(),
  4665. seconds: m.seconds(),
  4666. milliseconds: m.milliseconds(),
  4667. };
  4668. }
  4669. function toJSON() {
  4670. // new Date(NaN).toJSON() === null
  4671. return this.isValid() ? this.toISOString() : null;
  4672. }
  4673. function isValid$2() {
  4674. return isValid(this);
  4675. }
  4676. function parsingFlags() {
  4677. return extend({}, getParsingFlags(this));
  4678. }
  4679. function invalidAt() {
  4680. return getParsingFlags(this).overflow;
  4681. }
  4682. function creationData() {
  4683. return {
  4684. input: this._i,
  4685. format: this._f,
  4686. locale: this._locale,
  4687. isUTC: this._isUTC,
  4688. strict: this._strict,
  4689. };
  4690. }
  4691. addFormatToken('N', 0, 0, 'eraAbbr');
  4692. addFormatToken('NN', 0, 0, 'eraAbbr');
  4693. addFormatToken('NNN', 0, 0, 'eraAbbr');
  4694. addFormatToken('NNNN', 0, 0, 'eraName');
  4695. addFormatToken('NNNNN', 0, 0, 'eraNarrow');
  4696. addFormatToken('y', ['y', 1], 'yo', 'eraYear');
  4697. addFormatToken('y', ['yy', 2], 0, 'eraYear');
  4698. addFormatToken('y', ['yyy', 3], 0, 'eraYear');
  4699. addFormatToken('y', ['yyyy', 4], 0, 'eraYear');
  4700. addRegexToken('N', matchEraAbbr);
  4701. addRegexToken('NN', matchEraAbbr);
  4702. addRegexToken('NNN', matchEraAbbr);
  4703. addRegexToken('NNNN', matchEraName);
  4704. addRegexToken('NNNNN', matchEraNarrow);
  4705. addParseToken(['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function (
  4706. input,
  4707. array,
  4708. config,
  4709. token
  4710. ) {
  4711. var era = config._locale.erasParse(input, token, config._strict);
  4712. if (era) {
  4713. getParsingFlags(config).era = era;
  4714. } else {
  4715. getParsingFlags(config).invalidEra = input;
  4716. }
  4717. });
  4718. addRegexToken('y', matchUnsigned);
  4719. addRegexToken('yy', matchUnsigned);
  4720. addRegexToken('yyy', matchUnsigned);
  4721. addRegexToken('yyyy', matchUnsigned);
  4722. addRegexToken('yo', matchEraYearOrdinal);
  4723. addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);
  4724. addParseToken(['yo'], function (input, array, config, token) {
  4725. var match;
  4726. if (config._locale._eraYearOrdinalRegex) {
  4727. match = input.match(config._locale._eraYearOrdinalRegex);
  4728. }
  4729. if (config._locale.eraYearOrdinalParse) {
  4730. array[YEAR] = config._locale.eraYearOrdinalParse(input, match);
  4731. } else {
  4732. array[YEAR] = parseInt(input, 10);
  4733. }
  4734. });
  4735. function localeEras(m, format) {
  4736. var i,
  4737. l,
  4738. date,
  4739. eras = this._eras || getLocale('en')._eras;
  4740. for (i = 0, l = eras.length; i < l; ++i) {
  4741. switch (typeof eras[i].since) {
  4742. case 'string':
  4743. // truncate time
  4744. date = hooks(eras[i].since).startOf('day');
  4745. eras[i].since = date.valueOf();
  4746. break;
  4747. }
  4748. switch (typeof eras[i].until) {
  4749. case 'undefined':
  4750. eras[i].until = +Infinity;
  4751. break;
  4752. case 'string':
  4753. // truncate time
  4754. date = hooks(eras[i].until).startOf('day').valueOf();
  4755. eras[i].until = date.valueOf();
  4756. break;
  4757. }
  4758. }
  4759. return eras;
  4760. }
  4761. function localeErasParse(eraName, format, strict) {
  4762. var i,
  4763. l,
  4764. eras = this.eras(),
  4765. name,
  4766. abbr,
  4767. narrow;
  4768. eraName = eraName.toUpperCase();
  4769. for (i = 0, l = eras.length; i < l; ++i) {
  4770. name = eras[i].name.toUpperCase();
  4771. abbr = eras[i].abbr.toUpperCase();
  4772. narrow = eras[i].narrow.toUpperCase();
  4773. if (strict) {
  4774. switch (format) {
  4775. case 'N':
  4776. case 'NN':
  4777. case 'NNN':
  4778. if (abbr === eraName) {
  4779. return eras[i];
  4780. }
  4781. break;
  4782. case 'NNNN':
  4783. if (name === eraName) {
  4784. return eras[i];
  4785. }
  4786. break;
  4787. case 'NNNNN':
  4788. if (narrow === eraName) {
  4789. return eras[i];
  4790. }
  4791. break;
  4792. }
  4793. } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
  4794. return eras[i];
  4795. }
  4796. }
  4797. }
  4798. function localeErasConvertYear(era, year) {
  4799. var dir = era.since <= era.until ? +1 : -1;
  4800. if (year === undefined) {
  4801. return hooks(era.since).year();
  4802. } else {
  4803. return hooks(era.since).year() + (year - era.offset) * dir;
  4804. }
  4805. }
  4806. function getEraName() {
  4807. var i,
  4808. l,
  4809. val,
  4810. eras = this.localeData().eras();
  4811. for (i = 0, l = eras.length; i < l; ++i) {
  4812. // truncate time
  4813. val = this.clone().startOf('day').valueOf();
  4814. if (eras[i].since <= val && val <= eras[i].until) {
  4815. return eras[i].name;
  4816. }
  4817. if (eras[i].until <= val && val <= eras[i].since) {
  4818. return eras[i].name;
  4819. }
  4820. }
  4821. return '';
  4822. }
  4823. function getEraNarrow() {
  4824. var i,
  4825. l,
  4826. val,
  4827. eras = this.localeData().eras();
  4828. for (i = 0, l = eras.length; i < l; ++i) {
  4829. // truncate time
  4830. val = this.clone().startOf('day').valueOf();
  4831. if (eras[i].since <= val && val <= eras[i].until) {
  4832. return eras[i].narrow;
  4833. }
  4834. if (eras[i].until <= val && val <= eras[i].since) {
  4835. return eras[i].narrow;
  4836. }
  4837. }
  4838. return '';
  4839. }
  4840. function getEraAbbr() {
  4841. var i,
  4842. l,
  4843. val,
  4844. eras = this.localeData().eras();
  4845. for (i = 0, l = eras.length; i < l; ++i) {
  4846. // truncate time
  4847. val = this.clone().startOf('day').valueOf();
  4848. if (eras[i].since <= val && val <= eras[i].until) {
  4849. return eras[i].abbr;
  4850. }
  4851. if (eras[i].until <= val && val <= eras[i].since) {
  4852. return eras[i].abbr;
  4853. }
  4854. }
  4855. return '';
  4856. }
  4857. function getEraYear() {
  4858. var i,
  4859. l,
  4860. dir,
  4861. val,
  4862. eras = this.localeData().eras();
  4863. for (i = 0, l = eras.length; i < l; ++i) {
  4864. dir = eras[i].since <= eras[i].until ? +1 : -1;
  4865. // truncate time
  4866. val = this.clone().startOf('day').valueOf();
  4867. if (
  4868. (eras[i].since <= val && val <= eras[i].until) ||
  4869. (eras[i].until <= val && val <= eras[i].since)
  4870. ) {
  4871. return (
  4872. (this.year() - hooks(eras[i].since).year()) * dir +
  4873. eras[i].offset
  4874. );
  4875. }
  4876. }
  4877. return this.year();
  4878. }
  4879. function erasNameRegex(isStrict) {
  4880. if (!hasOwnProp(this, '_erasNameRegex')) {
  4881. computeErasParse.call(this);
  4882. }
  4883. return isStrict ? this._erasNameRegex : this._erasRegex;
  4884. }
  4885. function erasAbbrRegex(isStrict) {
  4886. if (!hasOwnProp(this, '_erasAbbrRegex')) {
  4887. computeErasParse.call(this);
  4888. }
  4889. return isStrict ? this._erasAbbrRegex : this._erasRegex;
  4890. }
  4891. function erasNarrowRegex(isStrict) {
  4892. if (!hasOwnProp(this, '_erasNarrowRegex')) {
  4893. computeErasParse.call(this);
  4894. }
  4895. return isStrict ? this._erasNarrowRegex : this._erasRegex;
  4896. }
  4897. function matchEraAbbr(isStrict, locale) {
  4898. return locale.erasAbbrRegex(isStrict);
  4899. }
  4900. function matchEraName(isStrict, locale) {
  4901. return locale.erasNameRegex(isStrict);
  4902. }
  4903. function matchEraNarrow(isStrict, locale) {
  4904. return locale.erasNarrowRegex(isStrict);
  4905. }
  4906. function matchEraYearOrdinal(isStrict, locale) {
  4907. return locale._eraYearOrdinalRegex || matchUnsigned;
  4908. }
  4909. function computeErasParse() {
  4910. var abbrPieces = [],
  4911. namePieces = [],
  4912. narrowPieces = [],
  4913. mixedPieces = [],
  4914. i,
  4915. l,
  4916. eras = this.eras();
  4917. for (i = 0, l = eras.length; i < l; ++i) {
  4918. namePieces.push(regexEscape(eras[i].name));
  4919. abbrPieces.push(regexEscape(eras[i].abbr));
  4920. narrowPieces.push(regexEscape(eras[i].narrow));
  4921. mixedPieces.push(regexEscape(eras[i].name));
  4922. mixedPieces.push(regexEscape(eras[i].abbr));
  4923. mixedPieces.push(regexEscape(eras[i].narrow));
  4924. }
  4925. this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  4926. this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');
  4927. this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');
  4928. this._erasNarrowRegex = new RegExp(
  4929. '^(' + narrowPieces.join('|') + ')',
  4930. 'i'
  4931. );
  4932. }
  4933. // FORMATTING
  4934. addFormatToken(0, ['gg', 2], 0, function () {
  4935. return this.weekYear() % 100;
  4936. });
  4937. addFormatToken(0, ['GG', 2], 0, function () {
  4938. return this.isoWeekYear() % 100;
  4939. });
  4940. function addWeekYearFormatToken(token, getter) {
  4941. addFormatToken(0, [token, token.length], 0, getter);
  4942. }
  4943. addWeekYearFormatToken('gggg', 'weekYear');
  4944. addWeekYearFormatToken('ggggg', 'weekYear');
  4945. addWeekYearFormatToken('GGGG', 'isoWeekYear');
  4946. addWeekYearFormatToken('GGGGG', 'isoWeekYear');
  4947. // ALIASES
  4948. addUnitAlias('weekYear', 'gg');
  4949. addUnitAlias('isoWeekYear', 'GG');
  4950. // PRIORITY
  4951. addUnitPriority('weekYear', 1);
  4952. addUnitPriority('isoWeekYear', 1);
  4953. // PARSING
  4954. addRegexToken('G', matchSigned);
  4955. addRegexToken('g', matchSigned);
  4956. addRegexToken('GG', match1to2, match2);
  4957. addRegexToken('gg', match1to2, match2);
  4958. addRegexToken('GGGG', match1to4, match4);
  4959. addRegexToken('gggg', match1to4, match4);
  4960. addRegexToken('GGGGG', match1to6, match6);
  4961. addRegexToken('ggggg', match1to6, match6);
  4962. addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (
  4963. input,
  4964. week,
  4965. config,
  4966. token
  4967. ) {
  4968. week[token.substr(0, 2)] = toInt(input);
  4969. });
  4970. addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
  4971. week[token] = hooks.parseTwoDigitYear(input);
  4972. });
  4973. // MOMENTS
  4974. function getSetWeekYear(input) {
  4975. return getSetWeekYearHelper.call(
  4976. this,
  4977. input,
  4978. this.week(),
  4979. this.weekday(),
  4980. this.localeData()._week.dow,
  4981. this.localeData()._week.doy
  4982. );
  4983. }
  4984. function getSetISOWeekYear(input) {
  4985. return getSetWeekYearHelper.call(
  4986. this,
  4987. input,
  4988. this.isoWeek(),
  4989. this.isoWeekday(),
  4990. 1,
  4991. 4
  4992. );
  4993. }
  4994. function getISOWeeksInYear() {
  4995. return weeksInYear(this.year(), 1, 4);
  4996. }
  4997. function getISOWeeksInISOWeekYear() {
  4998. return weeksInYear(this.isoWeekYear(), 1, 4);
  4999. }
  5000. function getWeeksInYear() {
  5001. var weekInfo = this.localeData()._week;
  5002. return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
  5003. }
  5004. function getWeeksInWeekYear() {
  5005. var weekInfo = this.localeData()._week;
  5006. return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
  5007. }
  5008. function getSetWeekYearHelper(input, week, weekday, dow, doy) {
  5009. var weeksTarget;
  5010. if (input == null) {
  5011. return weekOfYear(this, dow, doy).year;
  5012. } else {
  5013. weeksTarget = weeksInYear(input, dow, doy);
  5014. if (week > weeksTarget) {
  5015. week = weeksTarget;
  5016. }
  5017. return setWeekAll.call(this, input, week, weekday, dow, doy);
  5018. }
  5019. }
  5020. function setWeekAll(weekYear, week, weekday, dow, doy) {
  5021. var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
  5022. date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  5023. this.year(date.getUTCFullYear());
  5024. this.month(date.getUTCMonth());
  5025. this.date(date.getUTCDate());
  5026. return this;
  5027. }
  5028. // FORMATTING
  5029. addFormatToken('Q', 0, 'Qo', 'quarter');
  5030. // ALIASES
  5031. addUnitAlias('quarter', 'Q');
  5032. // PRIORITY
  5033. addUnitPriority('quarter', 7);
  5034. // PARSING
  5035. addRegexToken('Q', match1);
  5036. addParseToken('Q', function (input, array) {
  5037. array[MONTH] = (toInt(input) - 1) * 3;
  5038. });
  5039. // MOMENTS
  5040. function getSetQuarter(input) {
  5041. return input == null
  5042. ? Math.ceil((this.month() + 1) / 3)
  5043. : this.month((input - 1) * 3 + (this.month() % 3));
  5044. }
  5045. // FORMATTING
  5046. addFormatToken('D', ['DD', 2], 'Do', 'date');
  5047. // ALIASES
  5048. addUnitAlias('date', 'D');
  5049. // PRIORITY
  5050. addUnitPriority('date', 9);
  5051. // PARSING
  5052. addRegexToken('D', match1to2);
  5053. addRegexToken('DD', match1to2, match2);
  5054. addRegexToken('Do', function (isStrict, locale) {
  5055. // TODO: Remove "ordinalParse" fallback in next major release.
  5056. return isStrict
  5057. ? locale._dayOfMonthOrdinalParse || locale._ordinalParse
  5058. : locale._dayOfMonthOrdinalParseLenient;
  5059. });
  5060. addParseToken(['D', 'DD'], DATE);
  5061. addParseToken('Do', function (input, array) {
  5062. array[DATE] = toInt(input.match(match1to2)[0]);
  5063. });
  5064. // MOMENTS
  5065. var getSetDayOfMonth = makeGetSet('Date', true);
  5066. // FORMATTING
  5067. addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
  5068. // ALIASES
  5069. addUnitAlias('dayOfYear', 'DDD');
  5070. // PRIORITY
  5071. addUnitPriority('dayOfYear', 4);
  5072. // PARSING
  5073. addRegexToken('DDD', match1to3);
  5074. addRegexToken('DDDD', match3);
  5075. addParseToken(['DDD', 'DDDD'], function (input, array, config) {
  5076. config._dayOfYear = toInt(input);
  5077. });
  5078. // HELPERS
  5079. // MOMENTS
  5080. function getSetDayOfYear(input) {
  5081. var dayOfYear =
  5082. Math.round(
  5083. (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5
  5084. ) + 1;
  5085. return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
  5086. }
  5087. // FORMATTING
  5088. addFormatToken('m', ['mm', 2], 0, 'minute');
  5089. // ALIASES
  5090. addUnitAlias('minute', 'm');
  5091. // PRIORITY
  5092. addUnitPriority('minute', 14);
  5093. // PARSING
  5094. addRegexToken('m', match1to2);
  5095. addRegexToken('mm', match1to2, match2);
  5096. addParseToken(['m', 'mm'], MINUTE);
  5097. // MOMENTS
  5098. var getSetMinute = makeGetSet('Minutes', false);
  5099. // FORMATTING
  5100. addFormatToken('s', ['ss', 2], 0, 'second');
  5101. // ALIASES
  5102. addUnitAlias('second', 's');
  5103. // PRIORITY
  5104. addUnitPriority('second', 15);
  5105. // PARSING
  5106. addRegexToken('s', match1to2);
  5107. addRegexToken('ss', match1to2, match2);
  5108. addParseToken(['s', 'ss'], SECOND);
  5109. // MOMENTS
  5110. var getSetSecond = makeGetSet('Seconds', false);
  5111. // FORMATTING
  5112. addFormatToken('S', 0, 0, function () {
  5113. return ~~(this.millisecond() / 100);
  5114. });
  5115. addFormatToken(0, ['SS', 2], 0, function () {
  5116. return ~~(this.millisecond() / 10);
  5117. });
  5118. addFormatToken(0, ['SSS', 3], 0, 'millisecond');
  5119. addFormatToken(0, ['SSSS', 4], 0, function () {
  5120. return this.millisecond() * 10;
  5121. });
  5122. addFormatToken(0, ['SSSSS', 5], 0, function () {
  5123. return this.millisecond() * 100;
  5124. });
  5125. addFormatToken(0, ['SSSSSS', 6], 0, function () {
  5126. return this.millisecond() * 1000;
  5127. });
  5128. addFormatToken(0, ['SSSSSSS', 7], 0, function () {
  5129. return this.millisecond() * 10000;
  5130. });
  5131. addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
  5132. return this.millisecond() * 100000;
  5133. });
  5134. addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
  5135. return this.millisecond() * 1000000;
  5136. });
  5137. // ALIASES
  5138. addUnitAlias('millisecond', 'ms');
  5139. // PRIORITY
  5140. addUnitPriority('millisecond', 16);
  5141. // PARSING
  5142. addRegexToken('S', match1to3, match1);
  5143. addRegexToken('SS', match1to3, match2);
  5144. addRegexToken('SSS', match1to3, match3);
  5145. var token, getSetMillisecond;
  5146. for (token = 'SSSS'; token.length <= 9; token += 'S') {
  5147. addRegexToken(token, matchUnsigned);
  5148. }
  5149. function parseMs(input, array) {
  5150. array[MILLISECOND] = toInt(('0.' + input) * 1000);
  5151. }
  5152. for (token = 'S'; token.length <= 9; token += 'S') {
  5153. addParseToken(token, parseMs);
  5154. }
  5155. getSetMillisecond = makeGetSet('Milliseconds', false);
  5156. // FORMATTING
  5157. addFormatToken('z', 0, 0, 'zoneAbbr');
  5158. addFormatToken('zz', 0, 0, 'zoneName');
  5159. // MOMENTS
  5160. function getZoneAbbr() {
  5161. return this._isUTC ? 'UTC' : '';
  5162. }
  5163. function getZoneName() {
  5164. return this._isUTC ? 'Coordinated Universal Time' : '';
  5165. }
  5166. var proto = Moment.prototype;
  5167. proto.add = add;
  5168. proto.calendar = calendar$1;
  5169. proto.clone = clone;
  5170. proto.diff = diff;
  5171. proto.endOf = endOf;
  5172. proto.format = format;
  5173. proto.from = from;
  5174. proto.fromNow = fromNow;
  5175. proto.to = to;
  5176. proto.toNow = toNow;
  5177. proto.get = stringGet;
  5178. proto.invalidAt = invalidAt;
  5179. proto.isAfter = isAfter;
  5180. proto.isBefore = isBefore;
  5181. proto.isBetween = isBetween;
  5182. proto.isSame = isSame;
  5183. proto.isSameOrAfter = isSameOrAfter;
  5184. proto.isSameOrBefore = isSameOrBefore;
  5185. proto.isValid = isValid$2;
  5186. proto.lang = lang;
  5187. proto.locale = locale;
  5188. proto.localeData = localeData;
  5189. proto.max = prototypeMax;
  5190. proto.min = prototypeMin;
  5191. proto.parsingFlags = parsingFlags;
  5192. proto.set = stringSet;
  5193. proto.startOf = startOf;
  5194. proto.subtract = subtract;
  5195. proto.toArray = toArray;
  5196. proto.toObject = toObject;
  5197. proto.toDate = toDate;
  5198. proto.toISOString = toISOString;
  5199. proto.inspect = inspect;
  5200. if (typeof Symbol !== 'undefined' && Symbol.for != null) {
  5201. proto[Symbol.for('nodejs.util.inspect.custom')] = function () {
  5202. return 'Moment<' + this.format() + '>';
  5203. };
  5204. }
  5205. proto.toJSON = toJSON;
  5206. proto.toString = toString;
  5207. proto.unix = unix;
  5208. proto.valueOf = valueOf;
  5209. proto.creationData = creationData;
  5210. proto.eraName = getEraName;
  5211. proto.eraNarrow = getEraNarrow;
  5212. proto.eraAbbr = getEraAbbr;
  5213. proto.eraYear = getEraYear;
  5214. proto.year = getSetYear;
  5215. proto.isLeapYear = getIsLeapYear;
  5216. proto.weekYear = getSetWeekYear;
  5217. proto.isoWeekYear = getSetISOWeekYear;
  5218. proto.quarter = proto.quarters = getSetQuarter;
  5219. proto.month = getSetMonth;
  5220. proto.daysInMonth = getDaysInMonth;
  5221. proto.week = proto.weeks = getSetWeek;
  5222. proto.isoWeek = proto.isoWeeks = getSetISOWeek;
  5223. proto.weeksInYear = getWeeksInYear;
  5224. proto.weeksInWeekYear = getWeeksInWeekYear;
  5225. proto.isoWeeksInYear = getISOWeeksInYear;
  5226. proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
  5227. proto.date = getSetDayOfMonth;
  5228. proto.day = proto.days = getSetDayOfWeek;
  5229. proto.weekday = getSetLocaleDayOfWeek;
  5230. proto.isoWeekday = getSetISODayOfWeek;
  5231. proto.dayOfYear = getSetDayOfYear;
  5232. proto.hour = proto.hours = getSetHour;
  5233. proto.minute = proto.minutes = getSetMinute;
  5234. proto.second = proto.seconds = getSetSecond;
  5235. proto.millisecond = proto.milliseconds = getSetMillisecond;
  5236. proto.utcOffset = getSetOffset;
  5237. proto.utc = setOffsetToUTC;
  5238. proto.local = setOffsetToLocal;
  5239. proto.parseZone = setOffsetToParsedOffset;
  5240. proto.hasAlignedHourOffset = hasAlignedHourOffset;
  5241. proto.isDST = isDaylightSavingTime;
  5242. proto.isLocal = isLocal;
  5243. proto.isUtcOffset = isUtcOffset;
  5244. proto.isUtc = isUtc;
  5245. proto.isUTC = isUtc;
  5246. proto.zoneAbbr = getZoneAbbr;
  5247. proto.zoneName = getZoneName;
  5248. proto.dates = deprecate(
  5249. 'dates accessor is deprecated. Use date instead.',
  5250. getSetDayOfMonth
  5251. );
  5252. proto.months = deprecate(
  5253. 'months accessor is deprecated. Use month instead',
  5254. getSetMonth
  5255. );
  5256. proto.years = deprecate(
  5257. 'years accessor is deprecated. Use year instead',
  5258. getSetYear
  5259. );
  5260. proto.zone = deprecate(
  5261. 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',
  5262. getSetZone
  5263. );
  5264. proto.isDSTShifted = deprecate(
  5265. 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',
  5266. isDaylightSavingTimeShifted
  5267. );
  5268. function createUnix(input) {
  5269. return createLocal(input * 1000);
  5270. }
  5271. function createInZone() {
  5272. return createLocal.apply(null, arguments).parseZone();
  5273. }
  5274. function preParsePostFormat(string) {
  5275. return string;
  5276. }
  5277. var proto$1 = Locale.prototype;
  5278. proto$1.calendar = calendar;
  5279. proto$1.longDateFormat = longDateFormat;
  5280. proto$1.invalidDate = invalidDate;
  5281. proto$1.ordinal = ordinal;
  5282. proto$1.preparse = preParsePostFormat;
  5283. proto$1.postformat = preParsePostFormat;
  5284. proto$1.relativeTime = relativeTime;
  5285. proto$1.pastFuture = pastFuture;
  5286. proto$1.set = set;
  5287. proto$1.eras = localeEras;
  5288. proto$1.erasParse = localeErasParse;
  5289. proto$1.erasConvertYear = localeErasConvertYear;
  5290. proto$1.erasAbbrRegex = erasAbbrRegex;
  5291. proto$1.erasNameRegex = erasNameRegex;
  5292. proto$1.erasNarrowRegex = erasNarrowRegex;
  5293. proto$1.months = localeMonths;
  5294. proto$1.monthsShort = localeMonthsShort;
  5295. proto$1.monthsParse = localeMonthsParse;
  5296. proto$1.monthsRegex = monthsRegex;
  5297. proto$1.monthsShortRegex = monthsShortRegex;
  5298. proto$1.week = localeWeek;
  5299. proto$1.firstDayOfYear = localeFirstDayOfYear;
  5300. proto$1.firstDayOfWeek = localeFirstDayOfWeek;
  5301. proto$1.weekdays = localeWeekdays;
  5302. proto$1.weekdaysMin = localeWeekdaysMin;
  5303. proto$1.weekdaysShort = localeWeekdaysShort;
  5304. proto$1.weekdaysParse = localeWeekdaysParse;
  5305. proto$1.weekdaysRegex = weekdaysRegex;
  5306. proto$1.weekdaysShortRegex = weekdaysShortRegex;
  5307. proto$1.weekdaysMinRegex = weekdaysMinRegex;
  5308. proto$1.isPM = localeIsPM;
  5309. proto$1.meridiem = localeMeridiem;
  5310. function get$1(format, index, field, setter) {
  5311. var locale = getLocale(),
  5312. utc = createUTC().set(setter, index);
  5313. return locale[field](utc, format);
  5314. }
  5315. function listMonthsImpl(format, index, field) {
  5316. if (isNumber(format)) {
  5317. index = format;
  5318. format = undefined;
  5319. }
  5320. format = format || '';
  5321. if (index != null) {
  5322. return get$1(format, index, field, 'month');
  5323. }
  5324. var i,
  5325. out = [];
  5326. for (i = 0; i < 12; i++) {
  5327. out[i] = get$1(format, i, field, 'month');
  5328. }
  5329. return out;
  5330. }
  5331. // ()
  5332. // (5)
  5333. // (fmt, 5)
  5334. // (fmt)
  5335. // (true)
  5336. // (true, 5)
  5337. // (true, fmt, 5)
  5338. // (true, fmt)
  5339. function listWeekdaysImpl(localeSorted, format, index, field) {
  5340. if (typeof localeSorted === 'boolean') {
  5341. if (isNumber(format)) {
  5342. index = format;
  5343. format = undefined;
  5344. }
  5345. format = format || '';
  5346. } else {
  5347. format = localeSorted;
  5348. index = format;
  5349. localeSorted = false;
  5350. if (isNumber(format)) {
  5351. index = format;
  5352. format = undefined;
  5353. }
  5354. format = format || '';
  5355. }
  5356. var locale = getLocale(),
  5357. shift = localeSorted ? locale._week.dow : 0,
  5358. i,
  5359. out = [];
  5360. if (index != null) {
  5361. return get$1(format, (index + shift) % 7, field, 'day');
  5362. }
  5363. for (i = 0; i < 7; i++) {
  5364. out[i] = get$1(format, (i + shift) % 7, field, 'day');
  5365. }
  5366. return out;
  5367. }
  5368. function listMonths(format, index) {
  5369. return listMonthsImpl(format, index, 'months');
  5370. }
  5371. function listMonthsShort(format, index) {
  5372. return listMonthsImpl(format, index, 'monthsShort');
  5373. }
  5374. function listWeekdays(localeSorted, format, index) {
  5375. return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
  5376. }
  5377. function listWeekdaysShort(localeSorted, format, index) {
  5378. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
  5379. }
  5380. function listWeekdaysMin(localeSorted, format, index) {
  5381. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
  5382. }
  5383. getSetGlobalLocale('en', {
  5384. eras: [
  5385. {
  5386. since: '0001-01-01',
  5387. until: +Infinity,
  5388. offset: 1,
  5389. name: 'Anno Domini',
  5390. narrow: 'AD',
  5391. abbr: 'AD',
  5392. },
  5393. {
  5394. since: '0000-12-31',
  5395. until: -Infinity,
  5396. offset: 1,
  5397. name: 'Before Christ',
  5398. narrow: 'BC',
  5399. abbr: 'BC',
  5400. },
  5401. ],
  5402. dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  5403. ordinal: function (number) {
  5404. var b = number % 10,
  5405. output =
  5406. toInt((number % 100) / 10) === 1
  5407. ? 'th'
  5408. : b === 1
  5409. ? 'st'
  5410. : b === 2
  5411. ? 'nd'
  5412. : b === 3
  5413. ? 'rd'
  5414. : 'th';
  5415. return number + output;
  5416. },
  5417. });
  5418. // Side effect imports
  5419. hooks.lang = deprecate(
  5420. 'moment.lang is deprecated. Use moment.locale instead.',
  5421. getSetGlobalLocale
  5422. );
  5423. hooks.langData = deprecate(
  5424. 'moment.langData is deprecated. Use moment.localeData instead.',
  5425. getLocale
  5426. );
  5427. var mathAbs = Math.abs;
  5428. function abs() {
  5429. var data = this._data;
  5430. this._milliseconds = mathAbs(this._milliseconds);
  5431. this._days = mathAbs(this._days);
  5432. this._months = mathAbs(this._months);
  5433. data.milliseconds = mathAbs(data.milliseconds);
  5434. data.seconds = mathAbs(data.seconds);
  5435. data.minutes = mathAbs(data.minutes);
  5436. data.hours = mathAbs(data.hours);
  5437. data.months = mathAbs(data.months);
  5438. data.years = mathAbs(data.years);
  5439. return this;
  5440. }
  5441. function addSubtract$1(duration, input, value, direction) {
  5442. var other = createDuration(input, value);
  5443. duration._milliseconds += direction * other._milliseconds;
  5444. duration._days += direction * other._days;
  5445. duration._months += direction * other._months;
  5446. return duration._bubble();
  5447. }
  5448. // supports only 2.0-style add(1, 's') or add(duration)
  5449. function add$1(input, value) {
  5450. return addSubtract$1(this, input, value, 1);
  5451. }
  5452. // supports only 2.0-style subtract(1, 's') or subtract(duration)
  5453. function subtract$1(input, value) {
  5454. return addSubtract$1(this, input, value, -1);
  5455. }
  5456. function absCeil(number) {
  5457. if (number < 0) {
  5458. return Math.floor(number);
  5459. } else {
  5460. return Math.ceil(number);
  5461. }
  5462. }
  5463. function bubble() {
  5464. var milliseconds = this._milliseconds,
  5465. days = this._days,
  5466. months = this._months,
  5467. data = this._data,
  5468. seconds,
  5469. minutes,
  5470. hours,
  5471. years,
  5472. monthsFromDays;
  5473. // if we have a mix of positive and negative values, bubble down first
  5474. // check: https://github.com/moment/moment/issues/2166
  5475. if (
  5476. !(
  5477. (milliseconds >= 0 && days >= 0 && months >= 0) ||
  5478. (milliseconds <= 0 && days <= 0 && months <= 0)
  5479. )
  5480. ) {
  5481. milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
  5482. days = 0;
  5483. months = 0;
  5484. }
  5485. // The following code bubbles up values, see the tests for
  5486. // examples of what that means.
  5487. data.milliseconds = milliseconds % 1000;
  5488. seconds = absFloor(milliseconds / 1000);
  5489. data.seconds = seconds % 60;
  5490. minutes = absFloor(seconds / 60);
  5491. data.minutes = minutes % 60;
  5492. hours = absFloor(minutes / 60);
  5493. data.hours = hours % 24;
  5494. days += absFloor(hours / 24);
  5495. // convert days to months
  5496. monthsFromDays = absFloor(daysToMonths(days));
  5497. months += monthsFromDays;
  5498. days -= absCeil(monthsToDays(monthsFromDays));
  5499. // 12 months -> 1 year
  5500. years = absFloor(months / 12);
  5501. months %= 12;
  5502. data.days = days;
  5503. data.months = months;
  5504. data.years = years;
  5505. return this;
  5506. }
  5507. function daysToMonths(days) {
  5508. // 400 years have 146097 days (taking into account leap year rules)
  5509. // 400 years have 12 months === 4800
  5510. return (days * 4800) / 146097;
  5511. }
  5512. function monthsToDays(months) {
  5513. // the reverse of daysToMonths
  5514. return (months * 146097) / 4800;
  5515. }
  5516. function as(units) {
  5517. if (!this.isValid()) {
  5518. return NaN;
  5519. }
  5520. var days,
  5521. months,
  5522. milliseconds = this._milliseconds;
  5523. units = normalizeUnits(units);
  5524. if (units === 'month' || units === 'quarter' || units === 'year') {
  5525. days = this._days + milliseconds / 864e5;
  5526. months = this._months + daysToMonths(days);
  5527. switch (units) {
  5528. case 'month':
  5529. return months;
  5530. case 'quarter':
  5531. return months / 3;
  5532. case 'year':
  5533. return months / 12;
  5534. }
  5535. } else {
  5536. // handle milliseconds separately because of floating point math errors (issue #1867)
  5537. days = this._days + Math.round(monthsToDays(this._months));
  5538. switch (units) {
  5539. case 'week':
  5540. return days / 7 + milliseconds / 6048e5;
  5541. case 'day':
  5542. return days + milliseconds / 864e5;
  5543. case 'hour':
  5544. return days * 24 + milliseconds / 36e5;
  5545. case 'minute':
  5546. return days * 1440 + milliseconds / 6e4;
  5547. case 'second':
  5548. return days * 86400 + milliseconds / 1000;
  5549. // Math.floor prevents floating point math errors here
  5550. case 'millisecond':
  5551. return Math.floor(days * 864e5) + milliseconds;
  5552. default:
  5553. throw new Error('Unknown unit ' + units);
  5554. }
  5555. }
  5556. }
  5557. // TODO: Use this.as('ms')?
  5558. function valueOf$1() {
  5559. if (!this.isValid()) {
  5560. return NaN;
  5561. }
  5562. return (
  5563. this._milliseconds +
  5564. this._days * 864e5 +
  5565. (this._months % 12) * 2592e6 +
  5566. toInt(this._months / 12) * 31536e6
  5567. );
  5568. }
  5569. function makeAs(alias) {
  5570. return function () {
  5571. return this.as(alias);
  5572. };
  5573. }
  5574. var asMilliseconds = makeAs('ms'),
  5575. asSeconds = makeAs('s'),
  5576. asMinutes = makeAs('m'),
  5577. asHours = makeAs('h'),
  5578. asDays = makeAs('d'),
  5579. asWeeks = makeAs('w'),
  5580. asMonths = makeAs('M'),
  5581. asQuarters = makeAs('Q'),
  5582. asYears = makeAs('y');
  5583. function clone$1() {
  5584. return createDuration(this);
  5585. }
  5586. function get$2(units) {
  5587. units = normalizeUnits(units);
  5588. return this.isValid() ? this[units + 's']() : NaN;
  5589. }
  5590. function makeGetter(name) {
  5591. return function () {
  5592. return this.isValid() ? this._data[name] : NaN;
  5593. };
  5594. }
  5595. var milliseconds = makeGetter('milliseconds'),
  5596. seconds = makeGetter('seconds'),
  5597. minutes = makeGetter('minutes'),
  5598. hours = makeGetter('hours'),
  5599. days = makeGetter('days'),
  5600. months = makeGetter('months'),
  5601. years = makeGetter('years');
  5602. function weeks() {
  5603. return absFloor(this.days() / 7);
  5604. }
  5605. var round = Math.round,
  5606. thresholds = {
  5607. ss: 44, // a few seconds to seconds
  5608. s: 45, // seconds to minute
  5609. m: 45, // minutes to hour
  5610. h: 22, // hours to day
  5611. d: 26, // days to month/week
  5612. w: null, // weeks to month
  5613. M: 11, // months to year
  5614. };
  5615. // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
  5616. function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
  5617. return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
  5618. }
  5619. function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {
  5620. var duration = createDuration(posNegDuration).abs(),
  5621. seconds = round(duration.as('s')),
  5622. minutes = round(duration.as('m')),
  5623. hours = round(duration.as('h')),
  5624. days = round(duration.as('d')),
  5625. months = round(duration.as('M')),
  5626. weeks = round(duration.as('w')),
  5627. years = round(duration.as('y')),
  5628. a =
  5629. (seconds <= thresholds.ss && ['s', seconds]) ||
  5630. (seconds < thresholds.s && ['ss', seconds]) ||
  5631. (minutes <= 1 && ['m']) ||
  5632. (minutes < thresholds.m && ['mm', minutes]) ||
  5633. (hours <= 1 && ['h']) ||
  5634. (hours < thresholds.h && ['hh', hours]) ||
  5635. (days <= 1 && ['d']) ||
  5636. (days < thresholds.d && ['dd', days]);
  5637. if (thresholds.w != null) {
  5638. a =
  5639. a ||
  5640. (weeks <= 1 && ['w']) ||
  5641. (weeks < thresholds.w && ['ww', weeks]);
  5642. }
  5643. a = a ||
  5644. (months <= 1 && ['M']) ||
  5645. (months < thresholds.M && ['MM', months]) ||
  5646. (years <= 1 && ['y']) || ['yy', years];
  5647. a[2] = withoutSuffix;
  5648. a[3] = +posNegDuration > 0;
  5649. a[4] = locale;
  5650. return substituteTimeAgo.apply(null, a);
  5651. }
  5652. // This function allows you to set the rounding function for relative time strings
  5653. function getSetRelativeTimeRounding(roundingFunction) {
  5654. if (roundingFunction === undefined) {
  5655. return round;
  5656. }
  5657. if (typeof roundingFunction === 'function') {
  5658. round = roundingFunction;
  5659. return true;
  5660. }
  5661. return false;
  5662. }
  5663. // This function allows you to set a threshold for relative time strings
  5664. function getSetRelativeTimeThreshold(threshold, limit) {
  5665. if (thresholds[threshold] === undefined) {
  5666. return false;
  5667. }
  5668. if (limit === undefined) {
  5669. return thresholds[threshold];
  5670. }
  5671. thresholds[threshold] = limit;
  5672. if (threshold === 's') {
  5673. thresholds.ss = limit - 1;
  5674. }
  5675. return true;
  5676. }
  5677. function humanize(argWithSuffix, argThresholds) {
  5678. if (!this.isValid()) {
  5679. return this.localeData().invalidDate();
  5680. }
  5681. var withSuffix = false,
  5682. th = thresholds,
  5683. locale,
  5684. output;
  5685. if (typeof argWithSuffix === 'object') {
  5686. argThresholds = argWithSuffix;
  5687. argWithSuffix = false;
  5688. }
  5689. if (typeof argWithSuffix === 'boolean') {
  5690. withSuffix = argWithSuffix;
  5691. }
  5692. if (typeof argThresholds === 'object') {
  5693. th = Object.assign({}, thresholds, argThresholds);
  5694. if (argThresholds.s != null && argThresholds.ss == null) {
  5695. th.ss = argThresholds.s - 1;
  5696. }
  5697. }
  5698. locale = this.localeData();
  5699. output = relativeTime$1(this, !withSuffix, th, locale);
  5700. if (withSuffix) {
  5701. output = locale.pastFuture(+this, output);
  5702. }
  5703. return locale.postformat(output);
  5704. }
  5705. var abs$1 = Math.abs;
  5706. function sign(x) {
  5707. return (x > 0) - (x < 0) || +x;
  5708. }
  5709. function toISOString$1() {
  5710. // for ISO strings we do not use the normal bubbling rules:
  5711. // * milliseconds bubble up until they become hours
  5712. // * days do not bubble at all
  5713. // * months bubble up until they become years
  5714. // This is because there is no context-free conversion between hours and days
  5715. // (think of clock changes)
  5716. // and also not between days and months (28-31 days per month)
  5717. if (!this.isValid()) {
  5718. return this.localeData().invalidDate();
  5719. }
  5720. var seconds = abs$1(this._milliseconds) / 1000,
  5721. days = abs$1(this._days),
  5722. months = abs$1(this._months),
  5723. minutes,
  5724. hours,
  5725. years,
  5726. s,
  5727. total = this.asSeconds(),
  5728. totalSign,
  5729. ymSign,
  5730. daysSign,
  5731. hmsSign;
  5732. if (!total) {
  5733. // this is the same as C#'s (Noda) and python (isodate)...
  5734. // but not other JS (goog.date)
  5735. return 'P0D';
  5736. }
  5737. // 3600 seconds -> 60 minutes -> 1 hour
  5738. minutes = absFloor(seconds / 60);
  5739. hours = absFloor(minutes / 60);
  5740. seconds %= 60;
  5741. minutes %= 60;
  5742. // 12 months -> 1 year
  5743. years = absFloor(months / 12);
  5744. months %= 12;
  5745. // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
  5746. s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
  5747. totalSign = total < 0 ? '-' : '';
  5748. ymSign = sign(this._months) !== sign(total) ? '-' : '';
  5749. daysSign = sign(this._days) !== sign(total) ? '-' : '';
  5750. hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
  5751. return (
  5752. totalSign +
  5753. 'P' +
  5754. (years ? ymSign + years + 'Y' : '') +
  5755. (months ? ymSign + months + 'M' : '') +
  5756. (days ? daysSign + days + 'D' : '') +
  5757. (hours || minutes || seconds ? 'T' : '') +
  5758. (hours ? hmsSign + hours + 'H' : '') +
  5759. (minutes ? hmsSign + minutes + 'M' : '') +
  5760. (seconds ? hmsSign + s + 'S' : '')
  5761. );
  5762. }
  5763. var proto$2 = Duration.prototype;
  5764. proto$2.isValid = isValid$1;
  5765. proto$2.abs = abs;
  5766. proto$2.add = add$1;
  5767. proto$2.subtract = subtract$1;
  5768. proto$2.as = as;
  5769. proto$2.asMilliseconds = asMilliseconds;
  5770. proto$2.asSeconds = asSeconds;
  5771. proto$2.asMinutes = asMinutes;
  5772. proto$2.asHours = asHours;
  5773. proto$2.asDays = asDays;
  5774. proto$2.asWeeks = asWeeks;
  5775. proto$2.asMonths = asMonths;
  5776. proto$2.asQuarters = asQuarters;
  5777. proto$2.asYears = asYears;
  5778. proto$2.valueOf = valueOf$1;
  5779. proto$2._bubble = bubble;
  5780. proto$2.clone = clone$1;
  5781. proto$2.get = get$2;
  5782. proto$2.milliseconds = milliseconds;
  5783. proto$2.seconds = seconds;
  5784. proto$2.minutes = minutes;
  5785. proto$2.hours = hours;
  5786. proto$2.days = days;
  5787. proto$2.weeks = weeks;
  5788. proto$2.months = months;
  5789. proto$2.years = years;
  5790. proto$2.humanize = humanize;
  5791. proto$2.toISOString = toISOString$1;
  5792. proto$2.toString = toISOString$1;
  5793. proto$2.toJSON = toISOString$1;
  5794. proto$2.locale = locale;
  5795. proto$2.localeData = localeData;
  5796. proto$2.toIsoString = deprecate(
  5797. 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',
  5798. toISOString$1
  5799. );
  5800. proto$2.lang = lang;
  5801. // FORMATTING
  5802. addFormatToken('X', 0, 0, 'unix');
  5803. addFormatToken('x', 0, 0, 'valueOf');
  5804. // PARSING
  5805. addRegexToken('x', matchSigned);
  5806. addRegexToken('X', matchTimestamp);
  5807. addParseToken('X', function (input, array, config) {
  5808. config._d = new Date(parseFloat(input) * 1000);
  5809. });
  5810. addParseToken('x', function (input, array, config) {
  5811. config._d = new Date(toInt(input));
  5812. });
  5813. //! moment.js
  5814. hooks.version = '2.29.1';
  5815. setHookCallback(createLocal);
  5816. hooks.fn = proto;
  5817. hooks.min = min;
  5818. hooks.max = max;
  5819. hooks.now = now;
  5820. hooks.utc = createUTC;
  5821. hooks.unix = createUnix;
  5822. hooks.months = listMonths;
  5823. hooks.isDate = isDate;
  5824. hooks.locale = getSetGlobalLocale;
  5825. hooks.invalid = createInvalid;
  5826. hooks.duration = createDuration;
  5827. hooks.isMoment = isMoment;
  5828. hooks.weekdays = listWeekdays;
  5829. hooks.parseZone = createInZone;
  5830. hooks.localeData = getLocale;
  5831. hooks.isDuration = isDuration;
  5832. hooks.monthsShort = listMonthsShort;
  5833. hooks.weekdaysMin = listWeekdaysMin;
  5834. hooks.defineLocale = defineLocale;
  5835. hooks.updateLocale = updateLocale;
  5836. hooks.locales = listLocales;
  5837. hooks.weekdaysShort = listWeekdaysShort;
  5838. hooks.normalizeUnits = normalizeUnits;
  5839. hooks.relativeTimeRounding = getSetRelativeTimeRounding;
  5840. hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
  5841. hooks.calendarFormat = getCalendarFormat;
  5842. hooks.prototype = proto;
  5843. // currently HTML5 input type only supports 24-hour formats
  5844. hooks.HTML5_FMT = {
  5845. DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
  5846. DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
  5847. DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
  5848. DATE: 'YYYY-MM-DD', // <input type="date" />
  5849. TIME: 'HH:mm', // <input type="time" />
  5850. TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
  5851. TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
  5852. WEEK: 'GGGG-[W]WW', // <input type="week" />
  5853. MONTH: 'YYYY-MM', // <input type="month" />
  5854. };
  5855. return hooks;
  5856. })));
  5857. define('moment', ['moment/moment'], function (main) { return main; });
  5858. define('backend',['fast', 'template', 'moment'], function (Fast, Template, Moment) {
  5859. var Backend = {
  5860. api: {
  5861. sidebar: function (params) {
  5862. colorArr = ['red', 'green', 'yellow', 'blue', 'teal', 'orange', 'purple'];
  5863. $colorNums = colorArr.length;
  5864. badgeList = {};
  5865. $.each(params, function (k, v) {
  5866. $url = Fast.api.fixurl(k);
  5867. if ($.isArray(v)) {
  5868. $nums = typeof v[0] !== 'undefined' ? v[0] : 0;
  5869. $color = typeof v[1] !== 'undefined' ? v[1] : colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  5870. $class = typeof v[2] !== 'undefined' ? v[2] : 'label';
  5871. } else {
  5872. $nums = v;
  5873. $color = colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  5874. $class = 'label';
  5875. }
  5876. //必须nums大于0才显示
  5877. badgeList[$url] = $nums > 0 ? '<small class="' + $class + ' pull-right bg-' + $color + '">' + $nums + '</small>' : '';
  5878. });
  5879. $.each(badgeList, function (k, v) {
  5880. var anchor = top.window.$("li a[addtabs][url='" + k + "']");
  5881. if (anchor) {
  5882. top.window.$(".pull-right-container", anchor).html(v);
  5883. top.window.$(".nav-addtabs li a[node-id='" + anchor.attr("addtabs") + "'] .pull-right-container").html(v);
  5884. }
  5885. });
  5886. },
  5887. addtabs: function (url, title, icon) {
  5888. var dom = "a[url='{url}']"
  5889. var leftlink = top.window.$(dom.replace(/\{url\}/, url));
  5890. if (leftlink.size() > 0) {
  5891. leftlink.trigger("click");
  5892. } else {
  5893. url = Fast.api.fixurl(url);
  5894. leftlink = top.window.$(dom.replace(/\{url\}/, url));
  5895. if (leftlink.size() > 0) {
  5896. var event = leftlink.parent().hasClass("active") ? "dblclick" : "click";
  5897. leftlink.trigger(event);
  5898. } else {
  5899. var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
  5900. leftlink = top.window.$(dom.replace(/\{url\}/, baseurl));
  5901. //能找到相对地址
  5902. if (leftlink.size() > 0) {
  5903. icon = typeof icon !== 'undefined' ? icon : leftlink.find("i").attr("class");
  5904. title = typeof title !== 'undefined' ? title : leftlink.find("span:first").text();
  5905. leftlink.trigger("fa.event.toggleitem");
  5906. }
  5907. var navnode = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
  5908. if (navnode.size() > 0) {
  5909. navnode.trigger("click");
  5910. } else {
  5911. //追加新的tab
  5912. var id = Math.floor(new Date().valueOf() * Math.random());
  5913. icon = typeof icon !== 'undefined' ? icon : 'fa fa-circle-o';
  5914. title = typeof title !== 'undefined' ? title : '';
  5915. top.window.$("<a />").append('<i class="' + icon + '"></i> <span>' + title + '</span>').prop("href", url).attr({
  5916. url: url,
  5917. addtabs: id
  5918. }).addClass("hide").appendTo(top.window.document.body).trigger("click");
  5919. }
  5920. }
  5921. }
  5922. },
  5923. closetabs: function (url) {
  5924. if (typeof url === 'undefined') {
  5925. top.window.$("ul.nav-addtabs li.active .close-tab").trigger("click");
  5926. } else {
  5927. var dom = "a[url='{url}']"
  5928. var navlink = top.window.$(dom.replace(/\{url\}/, url));
  5929. if (navlink.size() === 0) {
  5930. url = Fast.api.fixurl(url);
  5931. navlink = top.window.$(dom.replace(/\{url\}/, url));
  5932. if (navlink.size() === 0) {
  5933. } else {
  5934. var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
  5935. navlink = top.window.$(dom.replace(/\{url\}/, baseurl));
  5936. //能找到相对地址
  5937. if (navlink.size() === 0) {
  5938. navlink = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
  5939. }
  5940. }
  5941. }
  5942. if (navlink.size() > 0 && navlink.attr('addtabs')) {
  5943. top.window.$("ul.nav-addtabs li#tab_" + navlink.attr('addtabs') + " .close-tab").trigger("click");
  5944. }
  5945. }
  5946. },
  5947. replaceids: function (elem, url) {
  5948. //如果有需要替换ids的
  5949. if (url.indexOf("{ids}") > -1) {
  5950. var ids = 0;
  5951. var tableId = $(elem).data("table-id");
  5952. if (tableId && $("#" + tableId).size() > 0 && $("#" + tableId).data("bootstrap.table")) {
  5953. var Table = require("table");
  5954. ids = Table.api.selectedids($("#" + tableId)).join(",");
  5955. }
  5956. url = url.replace(/\{ids\}/g, ids);
  5957. }
  5958. return url;
  5959. },
  5960. refreshmenu: function () {
  5961. top.window.$(".sidebar-menu").trigger("refresh");
  5962. },
  5963. gettablecolumnbutton: function (options) {
  5964. if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
  5965. var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
  5966. if (tableOptions) {
  5967. var columnObj = null;
  5968. $.each(tableOptions.columns, function (i, columns) {
  5969. $.each(columns, function (j, column) {
  5970. if (typeof column.fieldIndex !== 'undefined' && column.fieldIndex === options.fieldIndex) {
  5971. columnObj = column;
  5972. return false;
  5973. }
  5974. });
  5975. if (columnObj) {
  5976. return false;
  5977. }
  5978. });
  5979. if (columnObj) {
  5980. return columnObj['buttons'][options.buttonIndex];
  5981. }
  5982. }
  5983. }
  5984. return null;
  5985. },
  5986. },
  5987. init: function () {
  5988. //公共代码
  5989. //添加ios-fix兼容iOS下的iframe
  5990. if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
  5991. $("html").addClass("ios-fix");
  5992. }
  5993. //配置Toastr的参数
  5994. Toastr.options.positionClass = Config.controllername === 'index' ? "toast-top-right-index" : "toast-top-right";
  5995. //点击包含.btn-dialog的元素时弹出dialog
  5996. $(document).on('click', '.btn-dialog,.dialogit', function (e) {
  5997. var that = this;
  5998. var options = $.extend({}, $(that).data() || {});
  5999. var url = Backend.api.replaceids(that, $(that).data("url") || $(that).attr('href'));
  6000. var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
  6001. var button = Backend.api.gettablecolumnbutton(options);
  6002. if (button && typeof button.callback === 'function') {
  6003. options.callback = button.callback;
  6004. }
  6005. if (typeof options.confirm !== 'undefined') {
  6006. Layer.confirm(options.confirm, function (index) {
  6007. Backend.api.open(url, title, options);
  6008. Layer.close(index);
  6009. });
  6010. } else {
  6011. window[$(that).data("window") || 'self'].Backend.api.open(url, title, options);
  6012. }
  6013. return false;
  6014. });
  6015. //点击包含.btn-addtabs的元素时新增选项卡
  6016. $(document).on('click', '.btn-addtabs,.addtabsit', function (e) {
  6017. var that = this;
  6018. var options = $.extend({}, $(that).data() || {});
  6019. var url = Backend.api.replaceids(that, $(that).data("url") || $(that).attr('href'));
  6020. var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
  6021. var icon = $(that).attr("icon") || $(that).data("icon");
  6022. if (typeof options.confirm !== 'undefined') {
  6023. Layer.confirm(options.confirm, function (index) {
  6024. Backend.api.addtabs(url, title, icon);
  6025. Layer.close(index);
  6026. });
  6027. } else {
  6028. Backend.api.addtabs(url, title, icon);
  6029. }
  6030. return false;
  6031. });
  6032. //点击包含.btn-ajax的元素时发送Ajax请求
  6033. $(document).on('click', '.btn-ajax,.ajaxit', function (e) {
  6034. var that = this;
  6035. var options = $.extend({}, $(that).data() || {});
  6036. if (typeof options.url === 'undefined' && $(that).attr("href")) {
  6037. options.url = $(that).attr("href");
  6038. }
  6039. options.url = Backend.api.replaceids(this, options.url);
  6040. var success = typeof options.success === 'function' ? options.success : null;
  6041. var error = typeof options.error === 'function' ? options.error : null;
  6042. delete options.success;
  6043. delete options.error;
  6044. var button = Backend.api.gettablecolumnbutton(options);
  6045. if (button) {
  6046. if (typeof button.success === 'function') {
  6047. success = button.success;
  6048. }
  6049. if (typeof button.error === 'function') {
  6050. error = button.error;
  6051. }
  6052. }
  6053. //如果未设备成功的回调,设定了自动刷新的情况下自动进行刷新
  6054. if (!success && typeof options.tableId !== 'undefined' && typeof options.refresh !== 'undefined' && options.refresh) {
  6055. success = function () {
  6056. $("#" + options.tableId).bootstrapTable('refresh');
  6057. }
  6058. }
  6059. if (typeof options.confirm !== 'undefined') {
  6060. Layer.confirm(options.confirm, function (index) {
  6061. Backend.api.ajax(options, success, error);
  6062. Layer.close(index);
  6063. });
  6064. } else {
  6065. Backend.api.ajax(options, success, error);
  6066. }
  6067. return false;
  6068. });
  6069. $(document).on('click', '.btn-click,.clickit', function (e) {
  6070. var that = this;
  6071. var options = $.extend({}, $(that).data() || {});
  6072. var row = {};
  6073. if (typeof options.tableId !== 'undefined') {
  6074. var index = parseInt(options.rowIndex);
  6075. var data = $("#" + options.tableId).bootstrapTable('getData');
  6076. row = typeof data[index] !== 'undefined' ? data[index] : {};
  6077. }
  6078. var button = Backend.api.gettablecolumnbutton(options);
  6079. var click = typeof button.click === 'function' ? button.click : $.noop;
  6080. if (typeof options.confirm !== 'undefined') {
  6081. Layer.confirm(options.confirm, function (index) {
  6082. click.apply(that, [options, row, button]);
  6083. Layer.close(index);
  6084. });
  6085. } else {
  6086. click.apply(that, [options, row, button]);
  6087. }
  6088. return false;
  6089. });
  6090. //修复含有fixed-footer类的body边距
  6091. if ($(".fixed-footer").size() > 0) {
  6092. $(document.body).css("padding-bottom", $(".fixed-footer").outerHeight());
  6093. }
  6094. //修复不在iframe时layer-footer隐藏的问题
  6095. if ($(".layer-footer").size() > 0 && self === top) {
  6096. $(".layer-footer").show();
  6097. }
  6098. //tooltip和popover
  6099. if (!('ontouchstart' in document.documentElement)) {
  6100. $('body').tooltip({selector: '[data-toggle="tooltip"]'});
  6101. }
  6102. $('body').popover({selector: '[data-toggle="popover"]'});
  6103. }
  6104. };
  6105. Backend.api = $.extend(Fast.api, Backend.api);
  6106. //将Template渲染至全局,以便于在子框架中调用
  6107. window.Template = Template;
  6108. //将Moment渲染至全局,以便于在子框架中调用
  6109. window.Moment = Moment;
  6110. //将Backend渲染至全局,以便于在子框架中调用
  6111. window.Backend = Backend;
  6112. Backend.init();
  6113. return Backend;
  6114. });
  6115. define('backend-init',['backend'], function (Backend) {
  6116. // Layer.config({focusBtn: false});
  6117. // Fast.config.openArea = ["100%", "100%"];
  6118. });
  6119. //! moment.js locale configuration
  6120. //! locale : Chinese (China) [zh-cn]
  6121. //! author : suupic : https://github.com/suupic
  6122. //! author : Zeno Zeng : https://github.com/zenozeng
  6123. //! author : uu109 : https://github.com/uu109
  6124. ;(function (global, factory) {
  6125. typeof exports === 'object' && typeof module !== 'undefined'
  6126. && typeof require === 'function' ? factory(require('../moment')) :
  6127. typeof define === 'function' && define.amd ? define('moment/locale/zh-cn',['../moment'], factory) :
  6128. factory(global.moment)
  6129. }(this, (function (moment) { 'use strict';
  6130. //! moment.js locale configuration
  6131. var zhCn = moment.defineLocale('zh-cn', {
  6132. months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split(
  6133. '_'
  6134. ),
  6135. monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
  6136. '_'
  6137. ),
  6138. weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  6139. weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  6140. weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
  6141. longDateFormat: {
  6142. LT: 'HH:mm',
  6143. LTS: 'HH:mm:ss',
  6144. L: 'YYYY/MM/DD',
  6145. LL: 'YYYY年M月D日',
  6146. LLL: 'YYYY年M月D日Ah点mm分',
  6147. LLLL: 'YYYY年M月D日ddddAh点mm分',
  6148. l: 'YYYY/M/D',
  6149. ll: 'YYYY年M月D日',
  6150. lll: 'YYYY年M月D日 HH:mm',
  6151. llll: 'YYYY年M月D日dddd HH:mm',
  6152. },
  6153. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  6154. meridiemHour: function (hour, meridiem) {
  6155. if (hour === 12) {
  6156. hour = 0;
  6157. }
  6158. if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
  6159. return hour;
  6160. } else if (meridiem === '下午' || meridiem === '晚上') {
  6161. return hour + 12;
  6162. } else {
  6163. // '中午'
  6164. return hour >= 11 ? hour : hour + 12;
  6165. }
  6166. },
  6167. meridiem: function (hour, minute, isLower) {
  6168. var hm = hour * 100 + minute;
  6169. if (hm < 600) {
  6170. return '凌晨';
  6171. } else if (hm < 900) {
  6172. return '早上';
  6173. } else if (hm < 1130) {
  6174. return '上午';
  6175. } else if (hm < 1230) {
  6176. return '中午';
  6177. } else if (hm < 1800) {
  6178. return '下午';
  6179. } else {
  6180. return '晚上';
  6181. }
  6182. },
  6183. calendar: {
  6184. sameDay: '[今天]LT',
  6185. nextDay: '[明天]LT',
  6186. nextWeek: function (now) {
  6187. if (now.week() !== this.week()) {
  6188. return '[下]dddLT';
  6189. } else {
  6190. return '[本]dddLT';
  6191. }
  6192. },
  6193. lastDay: '[昨天]LT',
  6194. lastWeek: function (now) {
  6195. if (this.week() !== now.week()) {
  6196. return '[上]dddLT';
  6197. } else {
  6198. return '[本]dddLT';
  6199. }
  6200. },
  6201. sameElse: 'L',
  6202. },
  6203. dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
  6204. ordinal: function (number, period) {
  6205. switch (period) {
  6206. case 'd':
  6207. case 'D':
  6208. case 'DDD':
  6209. return number + '日';
  6210. case 'M':
  6211. return number + '月';
  6212. case 'w':
  6213. case 'W':
  6214. return number + '周';
  6215. default:
  6216. return number;
  6217. }
  6218. },
  6219. relativeTime: {
  6220. future: '%s后',
  6221. past: '%s前',
  6222. s: '几秒',
  6223. ss: '%d 秒',
  6224. m: '1 分钟',
  6225. mm: '%d 分钟',
  6226. h: '1 小时',
  6227. hh: '%d 小时',
  6228. d: '1 天',
  6229. dd: '%d 天',
  6230. w: '1 周',
  6231. ww: '%d 周',
  6232. M: '1 个月',
  6233. MM: '%d 个月',
  6234. y: '1 年',
  6235. yy: '%d 年',
  6236. },
  6237. week: {
  6238. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  6239. dow: 1, // Monday is the first day of the week.
  6240. doy: 4, // The week that contains Jan 4th is the first week of the year.
  6241. },
  6242. });
  6243. return zhCn;
  6244. })));
  6245. (function($){"use strict";var cachedWidth=null;var sprintf=function(str){var args=arguments,flag=true,i=1;str=str.replace(/%s/g,function(){var arg=args[i++];if(typeof arg==="undefined"){flag=false;return""}return arg});return flag?str:""};var getPropertyFromOther=function(list,from,to,value){var result="";$.each(list,function(i,item){if(item[from]===value){result=item[to];return false}return true});return result};var getFieldIndex=function(columns,field){var index=-1;$.each(columns,function(i,column){if(column.field===field){index=i;return false}return true});return index};var setFieldIndex=function(columns){var i,j,k,totalCol=0,flag=[];for(i=0;i<columns[0].length;i++){totalCol+=columns[0][i].colspan||1}for(i=0;i<columns.length;i++){flag[i]=[];for(j=0;j<totalCol;j++){flag[i][j]=false}}for(i=0;i<columns.length;i++){for(j=0;j<columns[i].length;j++){var r=columns[i][j],rowspan=r.rowspan||1,colspan=r.colspan||1,index=$.inArray(false,flag[i]);if(colspan===1){r.fieldIndex=index;if(typeof r.field==="undefined"){r.field=index}}for(k=0;k<rowspan;k++){flag[i+k][index]=true}for(k=0;k<colspan;k++){flag[i][index+k]=true}}}};var getScrollBarWidth=function(){if(cachedWidth===null){var inner=$("<p/>").addClass("fixed-table-scroll-inner"),outer=$("<div/>").addClass("fixed-table-scroll-outer"),w1,w2;outer.append(inner);$("body").append(outer);w1=inner[0].offsetWidth;outer.css("overflow","scroll");w2=inner[0].offsetWidth;if(w1===w2){w2=outer[0].clientWidth}outer.remove();cachedWidth=w1-w2}return cachedWidth};var calculateObjectValue=function(self,name,args,defaultValue){var func=name;if(typeof name==="string"){var names=name.split(".");if(names.length>1){func=window;$.each(names,function(i,f){func=func[f]})}else{func=window[name]}}if(typeof func==="object"){return func}if(typeof func==="function"){return func.apply(self,args||[])}if(!func&&typeof name==="string"&&sprintf.apply(this,[name].concat(args))){return sprintf.apply(this,[name].concat(args))}return defaultValue};var compareObjects=function(objectA,objectB,compareLength){var objectAProperties=Object.getOwnPropertyNames(objectA),objectBProperties=Object.getOwnPropertyNames(objectB),propName="";if(compareLength){if(objectAProperties.length!==objectBProperties.length){return false}}for(var i=0;i<objectAProperties.length;i++){propName=objectAProperties[i];if($.inArray(propName,objectBProperties)>-1){if(objectA[propName]!==objectB[propName]){return false}}}return true};var escapeHTML=function(text){if(typeof text==="string"){return text.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/`/g,"&#x60;")}return text};var getRealDataAttr=function(dataAttr){for(var attr in dataAttr){var auxAttr=attr.split(/(?=[A-Z])/).join("-").toLowerCase();if(auxAttr!==attr){dataAttr[auxAttr]=dataAttr[attr];delete dataAttr[attr]}}return dataAttr};var getItemField=function(item,field,escape){var value=item;if(typeof field!=="string"||item.hasOwnProperty(field)){return escape?escapeHTML(item[field]):item[field]}var props=field.split(".");for(var p in props){if(props.hasOwnProperty(p)){value=value&&value[props[p]]}}return escape?escapeHTML(value):value};var isIEBrowser=function(){return!!(navigator.userAgent.indexOf("MSIE ")>0||!!navigator.userAgent.match(/Trident.*rv\:11\./))};var objectKeys=function(){if(!Object.keys){Object.keys=function(){var hasOwnProperty=Object.prototype.hasOwnProperty,hasDontEnumBug=!{toString:null}.propertyIsEnumerable("toString"),dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length;return function(obj){if(typeof obj!=="object"&&(typeof obj!=="function"||obj===null)){throw new TypeError("Object.keys called on non-object")}var result=[],prop,i;for(prop in obj){if(hasOwnProperty.call(obj,prop)){result.push(prop)}}if(hasDontEnumBug){for(i=0;i<dontEnumsLength;i++){if(hasOwnProperty.call(obj,dontEnums[i])){result.push(dontEnums[i])}}}return result}}()}};var BootstrapTable=function(el,options){this.options=options;this.$el=$(el);this.$el_=this.$el.clone();this.timeoutId_=0;this.timeoutFooter_=0;this.init()};BootstrapTable.DEFAULTS={classes:"table table-hover",sortClass:undefined,locale:undefined,height:undefined,undefinedText:"-",sortName:undefined,sortOrder:"asc",sortStable:false,striped:false,columns:[[]],data:[],totalField:"total",dataField:"rows",method:"get",url:undefined,ajax:undefined,cache:true,contentType:"application/json",dataType:"json",ajaxOptions:{},queryParams:function(params){return params},queryParamsType:"limit",responseHandler:function(res){return res},pagination:false,onlyInfoPagination:false,paginationLoop:true,sidePagination:"client",totalRows:0,pageNumber:1,pageSize:10,pageList:[10,25,50,100],paginationHAlign:"right",paginationVAlign:"bottom",paginationDetailHAlign:"left",paginationPreText:"&lsaquo;",paginationNextText:"&rsaquo;",search:false,searchOnEnterKey:false,strictSearch:false,searchAlign:"right",selectItemName:"btSelectItem",showHeader:true,showFooter:false,showColumns:false,showPaginationSwitch:false,showRefresh:false,showToggle:false,buttonsAlign:"right",smartDisplay:true,escape:false,minimumCountColumns:1,idField:undefined,uniqueId:undefined,cardView:false,detailView:false,detailFormatter:function(index,row){return""},trimOnSearch:true,clickToSelect:false,singleSelect:false,toolbar:undefined,toolbarAlign:"left",checkboxHeader:true,sortable:true,silentSort:true,maintainSelected:false,searchTimeOut:500,searchText:"",iconSize:undefined,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:$.noop,customSort:$.noop,rowStyle:function(row,index){return{}},rowAttributes:function(row,index){return{}},footerStyle:function(row,index){return{}},onAll:function(name,args){return false},onClickCell:function(field,value,row,$element){return false},onDblClickCell:function(field,value,row,$element){return false},onClickRow:function(item,$element){return false},onDblClickRow:function(item,$element){return false},onSort:function(name,order){return false},onCheck:function(row){return false},onUncheck:function(row){return false},onCheckAll:function(rows){return false},onUncheckAll:function(rows){return false},onCheckSome:function(rows){return false},onUncheckSome:function(rows){return false},onLoadSuccess:function(data){return false},onLoadError:function(status){return false},onColumnSwitch:function(field,checked){return false},onPageChange:function(number,size){return false},onSearch:function(text){return false},onToggle:function(cardView){return false},onPreBody:function(data){return false},onPostBody:function(){return false},onPostHeader:function(){return false},onExpandRow:function(index,row,$detail){return false},onCollapseRow:function(index,row){return false},onRefreshOptions:function(options){return false},onRefresh:function(params){return false},onResetView:function(){return false}};BootstrapTable.LOCALES={};BootstrapTable.LOCALES["en-US"]=BootstrapTable.LOCALES.en={formatLoadingMessage:function(){return"Loading, please wait..."},formatRecordsPerPage:function(pageNumber){return sprintf("%s rows per page",pageNumber)},formatShowingRows:function(pageFrom,pageTo,totalRows){return sprintf("Showing %s to %s of %s rows",pageFrom,pageTo,totalRows)},formatDetailPagination:function(totalRows){return sprintf("Showing %s rows",totalRows)},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"}};$.extend(BootstrapTable.DEFAULTS,BootstrapTable.LOCALES["en-US"]);BootstrapTable.COLUMN_DEFAULTS={radio:false,checkbox:false,checkboxEnabled:true,field:undefined,title:undefined,titleTooltip:undefined,class:undefined,align:undefined,halign:undefined,falign:undefined,valign:undefined,width:undefined,sortable:false,order:"asc",visible:true,switchable:true,clickToSelect:true,formatter:undefined,footerFormatter:undefined,events:undefined,sorter:undefined,sortName:undefined,cellStyle:undefined,searchable:true,searchFormatter:true,cardVisible:true,escape:false};BootstrapTable.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"};BootstrapTable.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()};BootstrapTable.prototype.initLocale=function(){if(this.options.locale){var parts=this.options.locale.split(/-|_/);parts[0].toLowerCase();if(parts[1])parts[1].toUpperCase();if($.fn.bootstrapTable.locales[this.options.locale]){$.extend(this.options,$.fn.bootstrapTable.locales[this.options.locale])}else if($.fn.bootstrapTable.locales[parts.join("-")]){$.extend(this.options,$.fn.bootstrapTable.locales[parts.join("-")])}else if($.fn.bootstrapTable.locales[parts[0]]){$.extend(this.options,$.fn.bootstrapTable.locales[parts[0]])}}};BootstrapTable.prototype.initContainer=function(){this.$container=$(['<div class="bootstrap-table">','<div class="fixed-table-toolbar"></div>',this.options.paginationVAlign==="top"||this.options.paginationVAlign==="both"?'<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>',this.options.paginationVAlign==="bottom"||this.options.paginationVAlign==="both"?'<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);if(this.options.striped){this.$el.addClass("table-striped")}if($.inArray("table-no-bordered",this.options.classes.split(" "))!==-1){this.$tableContainer.addClass("table-no-bordered")}};BootstrapTable.prototype.initTable=function(){var that=this,columns=[],data=[];this.$header=this.$el.find(">thead");if(!this.$header.length){this.$header=$("<thead></thead>").appendTo(this.$el)}this.$header.find("tr").each(function(){var column=[];$(this).find("th").each(function(){if(typeof $(this).data("field")!=="undefined"){$(this).data("field",$(this).data("field")+"")}column.push($.extend({},{title:$(this).html(),class:$(this).attr("class"),titleTooltip:$(this).attr("title"),rowspan:$(this).attr("rowspan")?+$(this).attr("rowspan"):undefined,colspan:$(this).attr("colspan")?+$(this).attr("colspan"):undefined},$(this).data()))});columns.push(column)});if(!$.isArray(this.options.columns[0])){this.options.columns=[this.options.columns]}this.options.columns=$.extend(true,[],columns,this.options.columns);this.columns=[];setFieldIndex(this.options.columns);$.each(this.options.columns,function(i,columns){$.each(columns,function(j,column){column=$.extend({},BootstrapTable.COLUMN_DEFAULTS,column);if(typeof column.fieldIndex!=="undefined"){that.columns[column.fieldIndex]=column}that.options.columns[i][j]=column})});if(this.options.data.length){return}var m=[];this.$el.find(">tbody>tr").each(function(y){var row={};row._id=$(this).attr("id");row._class=$(this).attr("class");row._data=getRealDataAttr($(this).data());$(this).find(">td").each(function(x){var $this=$(this),cspan=+$this.attr("colspan")||1,rspan=+$this.attr("rowspan")||1,tx,ty;for(;m[y]&&m[y][x];x++);for(tx=x;tx<x+cspan;tx++){for(ty=y;ty<y+rspan;ty++){if(!m[ty]){m[ty]=[]}m[ty][tx]=true}}var field=that.columns[x].field;row[field]=$(this).html();row["_"+field+"_id"]=$(this).attr("id");row["_"+field+"_class"]=$(this).attr("class");row["_"+field+"_rowspan"]=$(this).attr("rowspan");row["_"+field+"_colspan"]=$(this).attr("colspan");row["_"+field+"_title"]=$(this).attr("title");row["_"+field+"_data"]=getRealDataAttr($(this).data())});data.push(row)});this.options.data=data;if(data.length)this.fromHtml=true};BootstrapTable.prototype.initHeader=function(){var that=this,visibleColumns={},html=[];this.header={fields:[],styles:[],classes:[],formatters:[],events:[],sorters:[],sortNames:[],cellStyles:[],searchables:[]};$.each(this.options.columns,function(i,columns){html.push("<tr>");if(i===0&&!that.options.cardView&&that.options.detailView){html.push(sprintf('<th class="detail" rowspan="%s"><div class="fht-cell"></div></th>',that.options.columns.length))}$.each(columns,function(j,column){var text="",halign="",align="",style="",class_=sprintf(' class="%s"',column["class"]),order=that.options.sortOrder||column.order,unitWidth="px",width=column.width;if(column.width!==undefined&&!that.options.cardView){if(typeof column.width==="string"){if(column.width.indexOf("%")!==-1){unitWidth="%"}}}if(column.width&&typeof column.width==="string"){width=column.width.replace("%","").replace("px","")}halign=sprintf("text-align: %s; ",column.halign?column.halign:column.align);align=sprintf("text-align: %s; ",column.align);style=sprintf("vertical-align: %s; ",column.valign);style+=sprintf("width: %s; ",(column.checkbox||column.radio)&&!width?"36px":width?width+unitWidth:undefined);if(typeof column.fieldIndex!=="undefined"){that.header.fields[column.fieldIndex]=column.field;that.header.styles[column.fieldIndex]=align+style;that.header.classes[column.fieldIndex]=class_;that.header.formatters[column.fieldIndex]=column.formatter;that.header.events[column.fieldIndex]=column.events;that.header.sorters[column.fieldIndex]=column.sorter;that.header.sortNames[column.fieldIndex]=column.sortName;that.header.cellStyles[column.fieldIndex]=column.cellStyle;that.header.searchables[column.fieldIndex]=column.searchable;if(!column.visible){return}if(that.options.cardView&&!column.cardVisible){return}visibleColumns[column.field]=column}html.push("<th"+sprintf(' title="%s"',column.titleTooltip),column.checkbox||column.radio?sprintf(' class="bs-checkbox %s"',column["class"]||""):class_,sprintf(' style="%s"',halign+style),sprintf(' rowspan="%s"',column.rowspan),sprintf(' colspan="%s"',column.colspan),sprintf(' data-field="%s"',column.field),">");html.push(sprintf('<div class="th-inner %s">',that.options.sortable&&column.sortable?"sortable both":""));text=that.options.escape?escapeHTML(column.title):column.title;if(column.checkbox){if(!that.options.singleSelect&&that.options.checkboxHeader){text='<input name="btSelectAll" type="checkbox" />'}that.header.stateField=column.field}if(column.radio){text="";that.header.stateField=column.field;that.options.singleSelect=true}html.push(text);html.push("</div>");html.push('<div class="fht-cell"></div>');html.push("</div>");html.push("</th>")});html.push("</tr>")});this.$header.html(html.join(""));this.$header.find("th[data-field]").each(function(i){$(this).data(visibleColumns[$(this).data("field")])});this.$container.off("click",".th-inner").on("click",".th-inner",function(event){var target=$(this);if(that.options.detailView){if(target.closest(".bootstrap-table")[0]!==that.$container[0])return false}if(that.options.sortable&&target.parent().data().sortable){that.onSort(event)}});this.$header.children().children().off("keypress").on("keypress",function(event){if(that.options.sortable&&$(this).data().sortable){var code=event.keyCode||event.which;if(code==13){that.onSort(event)}}});$(window).off("resize.bootstrap-table");if(!this.options.showHeader||this.options.cardView){this.$header.hide();this.$tableHeader.hide();this.$tableLoading.css("top",0)}else{this.$header.show();this.$tableHeader.show();this.$tableLoading.css("top",this.$header.outerHeight()+1);this.getCaret();$(window).on("resize.bootstrap-table",$.proxy(this.resetWidth,this))}this.$selectAll=this.$header.find('[name="btSelectAll"]');this.$selectAll.off("click").on("click",function(){var checked=$(this).prop("checked");that[checked?"checkAll":"uncheckAll"]();that.updateSelected()})};BootstrapTable.prototype.initFooter=function(){if(!this.options.showFooter||this.options.cardView){this.$tableFooter.hide()}else{this.$tableFooter.show()}};BootstrapTable.prototype.initData=function(data,type){if(type==="append"){this.data=this.data.concat(data)}else if(type==="prepend"){this.data=[].concat(data).concat(this.data)}else{this.data=data||this.options.data}if(type==="append"){this.options.data=this.options.data.concat(data)}else if(type==="prepend"){this.options.data=[].concat(data).concat(this.options.data)}else{this.options.data=this.data}if(this.options.sidePagination==="server"){return}this.initSort()};BootstrapTable.prototype.initSort=function(){var that=this,name=this.options.sortName,order=this.options.sortOrder==="desc"?-1:1,index=$.inArray(this.options.sortName,this.header.fields),timeoutId=0;if(this.options.customSort!==$.noop){this.options.customSort.apply(this,[this.options.sortName,this.options.sortOrder]);return}if(index!==-1){if(this.options.sortStable){$.each(this.data,function(i,row){if(!row.hasOwnProperty("_position"))row._position=i})}this.data.sort(function(a,b){if(that.header.sortNames[index]){name=that.header.sortNames[index]}var aa=getItemField(a,name,that.options.escape),bb=getItemField(b,name,that.options.escape),value=calculateObjectValue(that.header,that.header.sorters[index],[aa,bb]);if(value!==undefined){return order*value}if(aa===undefined||aa===null){aa=""}if(bb===undefined||bb===null){bb=""}if(that.options.sortStable&&aa===bb){aa=a._position;bb=b._position}if($.isNumeric(aa)&&$.isNumeric(bb)){aa=parseFloat(aa);bb=parseFloat(bb);if(aa<bb){return order*-1}return order}if(aa===bb){return 0}if(typeof aa!=="string"){aa=aa.toString()}if(aa.localeCompare(bb)===-1){return order*-1}return order});if(this.options.sortClass!==undefined){clearTimeout(timeoutId);timeoutId=setTimeout(function(){that.$el.removeClass(that.options.sortClass);var index=that.$header.find(sprintf('[data-field="%s"]',that.options.sortName).index()+1);that.$el.find(sprintf("tr td:nth-child(%s)",index)).addClass(that.options.sortClass)},250)}}};BootstrapTable.prototype.onSort=function(event){var $this=event.type==="keypress"?$(event.currentTarget):$(event.currentTarget).parent(),$this_=this.$header.find("th").eq($this.index());this.$header.add(this.$header_).find("span.order").remove();if(this.options.sortName===$this.data("field")){this.options.sortOrder=this.options.sortOrder==="asc"?"desc":"asc"}else{this.options.sortName=$this.data("field");this.options.sortOrder=$this.data("order")==="asc"?"desc":"asc"}this.trigger("sort",this.options.sortName,this.options.sortOrder);$this.add($this_).data("order",this.options.sortOrder);this.getCaret();if(this.options.sidePagination==="server"){this.initServer(this.options.silentSort);return}this.initSort();this.initBody()};BootstrapTable.prototype.initToolbar=function(){var that=this,html=[],timeoutId=0,$keepOpen,$search,switchableCount=0;if(this.$toolbar.find(".bs-bars").children().length){$("body").append($(this.options.toolbar))}this.$toolbar.html("");if(typeof this.options.toolbar==="string"||typeof this.options.toolbar==="object"){$(sprintf('<div class="bs-bars pull-%s"></div>',this.options.toolbarAlign)).appendTo(this.$toolbar).append($(this.options.toolbar))}html=[sprintf('<div class="columns columns-%s btn-group pull-%s">',this.options.buttonsAlign,this.options.buttonsAlign)];if(typeof this.options.icons==="string"){this.options.icons=calculateObjectValue(null,this.options.icons)}if(this.options.showPaginationSwitch){html.push(sprintf('<button class="btn'+sprintf(" btn-%s",this.options.buttonsClass)+sprintf(" btn-%s",this.options.iconSize)+'" type="button" name="paginationSwitch" aria-label="pagination Switch" title="%s">',this.options.formatPaginationSwitch()),sprintf('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.paginationSwitchDown),"</button>")}if(this.options.showRefresh){html.push(sprintf('<button class="btn'+sprintf(" btn-%s",this.options.buttonsClass)+sprintf(" btn-%s",this.options.iconSize)+'" type="button" name="refresh" aria-label="refresh" title="%s">',this.options.formatRefresh()),sprintf('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.refresh),"</button>")}if(this.options.showToggle){html.push(sprintf('<button class="btn'+sprintf(" btn-%s",this.options.buttonsClass)+sprintf(" btn-%s",this.options.iconSize)+'" type="button" name="toggle" aria-label="toggle" title="%s">',this.options.formatToggle()),sprintf('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.toggle),"</button>")}if(this.options.showColumns){html.push(sprintf('<div class="keep-open btn-group" title="%s">',this.options.formatColumns()),'<button type="button" aria-label="columns" class="btn'+sprintf(" btn-%s",this.options.buttonsClass)+sprintf(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">',sprintf('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.columns),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">');$.each(this.columns,function(i,column){if(column.radio||column.checkbox){return}if(that.options.cardView&&!column.cardVisible){return}var checked=column.visible?' checked="checked"':"";if(column.switchable){html.push(sprintf('<li role="menuitem">'+'<label><input type="checkbox" data-field="%s" value="%s"%s> %s</label>'+"</li>",column.field,i,checked,column.title));switchableCount++}});html.push("</ul>","</div>")}html.push("</div>");if(this.showToolbar||html.length>2){this.$toolbar.append(html.join(""))}if(this.options.showPaginationSwitch){this.$toolbar.find('button[name="paginationSwitch"]').off("click").on("click",$.proxy(this.togglePagination,this))}if(this.options.showRefresh){this.$toolbar.find('button[name="refresh"]').off("click").on("click",$.proxy(this.refresh,this))}if(this.options.showToggle){this.$toolbar.find('button[name="toggle"]').off("click").on("click",function(){that.toggleView()})}if(this.options.showColumns){$keepOpen=this.$toolbar.find(".keep-open");if(switchableCount<=this.options.minimumCountColumns){$keepOpen.find("input").prop("disabled",true)}$keepOpen.find("li").off("click").on("click",function(event){event.stopImmediatePropagation()});$keepOpen.find("input").off("click").on("click",function(){var $this=$(this);that.toggleColumn($(this).val(),$this.prop("checked"),false);that.trigger("column-switch",$(this).data("field"),$this.prop("checked"))})}if(this.options.search){html=[];html.push('<div class="pull-'+this.options.searchAlign+' search">',sprintf('<input class="form-control'+sprintf(" input-%s",this.options.iconSize)+'" type="text" placeholder="%s">',this.options.formatSearch()),"</div>");this.$toolbar.append(html.join(""));$search=this.$toolbar.find(".search input");$search.off("keyup drop blur").on("keyup drop blur",function(event){if(that.options.searchOnEnterKey&&event.keyCode!==13){return}if($.inArray(event.keyCode,[37,38,39,40])>-1){return}clearTimeout(timeoutId);timeoutId=setTimeout(function(){that.onSearch(event)},that.options.searchTimeOut)});if(isIEBrowser()){$search.off("mouseup").on("mouseup",function(event){clearTimeout(timeoutId);timeoutId=setTimeout(function(){that.onSearch(event)},that.options.searchTimeOut)})}}};BootstrapTable.prototype.onSearch=function(event){var text=$.trim($(event.currentTarget).val());if(this.options.trimOnSearch&&$(event.currentTarget).val()!==text){$(event.currentTarget).val(text)}if(text===this.searchText){return}this.searchText=text;this.options.searchText=text;this.options.pageNumber=1;this.initSearch();this.updatePagination();this.trigger("search",text)};BootstrapTable.prototype.initSearch=function(){var that=this;if(this.options.sidePagination!=="server"){if(this.options.customSearch!==$.noop){this.options.customSearch.apply(this,[this.searchText]);return}var s=this.searchText&&(this.options.escape?escapeHTML(this.searchText):this.searchText).toLowerCase();var f=$.isEmptyObject(this.filterColumns)?null:this.filterColumns;this.data=f?$.grep(this.options.data,function(item,i){for(var key in f){if($.isArray(f[key])&&$.inArray(item[key],f[key])===-1||!$.isArray(f[key])&&item[key]!==f[key]){return false}}return true}):this.options.data;this.data=s?$.grep(this.data,function(item,i){for(var j=0;j<that.header.fields.length;j++){if(!that.header.searchables[j]){continue}var key=$.isNumeric(that.header.fields[j])?parseInt(that.header.fields[j],10):that.header.fields[j];var column=that.columns[getFieldIndex(that.columns,key)];var value;if(typeof key==="string"){value=item;var props=key.split(".");for(var prop_index=0;prop_index<props.length;prop_index++){value=value[props[prop_index]]}if(column&&column.searchFormatter){value=calculateObjectValue(column,that.header.formatters[j],[value,item,i],value)}}else{value=item[key]}if(typeof value==="string"||typeof value==="number"){if(that.options.strictSearch){if((value+"").toLowerCase()===s){return true}}else{if((value+"").toLowerCase().indexOf(s)!==-1){return true}}}}return false}):this.data}};BootstrapTable.prototype.initPagination=function(){if(!this.options.pagination){this.$pagination.hide();return}else{this.$pagination.show()}var that=this,html=[],$allSelected=false,i,from,to,$pageList,$first,$pre,$next,$last,$number,data=this.getData(),pageList=this.options.pageList;if(this.options.sidePagination!=="server"){this.options.totalRows=data.length}this.totalPages=0;if(this.options.totalRows){if(this.options.pageSize===this.options.formatAllRows()){this.options.pageSize=this.options.totalRows;$allSelected=true}else if(this.options.pageSize===this.options.totalRows){var pageLst=typeof this.options.pageList==="string"?this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").toLowerCase().split(","):this.options.pageList;if($.inArray(this.options.formatAllRows().toLowerCase(),pageLst)>-1){$allSelected=true}}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;if(this.pageTo>this.options.totalRows){this.pageTo=this.options.totalRows}html.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>");if(!this.options.onlyInfoPagination){html.push('<span class="page-list">');var pageNumber=[sprintf('<span class="btn-group %s">',this.options.paginationVAlign==="top"||this.options.paginationVAlign==="both"?"dropdown":"dropup"),'<button type="button" class="btn'+sprintf(" btn-%s",this.options.buttonsClass)+sprintf(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">','<span class="page-size">',$allSelected?this.options.formatAllRows():this.options.pageSize,"</span>",' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'];if(typeof this.options.pageList==="string"){var list=this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").split(",");pageList=[];$.each(list,function(i,value){pageList.push(value.toUpperCase()===that.options.formatAllRows().toUpperCase()?that.options.formatAllRows():+value)})}$.each(pageList,function(i,page){if(!that.options.smartDisplay||i===0||pageList[i-1]<that.options.totalRows){var active;if($allSelected){active=page===that.options.formatAllRows()?' class="active"':""}else{active=page===that.options.pageSize?' class="active"':""}pageNumber.push(sprintf('<li role="menuitem"%s><a href="#">%s</a></li>',active,page))}});pageNumber.push("</ul></span>");html.push(this.options.formatRecordsPerPage(pageNumber.join("")));html.push("</span>");html.push("</div>",'<div class="pull-'+this.options.paginationHAlign+' pagination">','<ul class="pagination'+sprintf(" pagination-%s",this.options.iconSize)+'">','<li class="page-pre"><a href="#">'+this.options.paginationPreText+"</a></li>");if(this.totalPages<5){from=1;to=this.totalPages}else{from=this.options.pageNumber-2;to=from+4;if(from<1){from=1;to=5}if(to>this.totalPages){to=this.totalPages;from=to-4}}if(this.totalPages>=6){if(this.options.pageNumber>=3){html.push('<li class="page-first'+(1===this.options.pageNumber?" active":"")+'">','<a href="#">',1,"</a>","</li>");from++}if(this.options.pageNumber>=4){if(this.options.pageNumber==4||this.totalPages==6||this.totalPages==7){from--}else{html.push('<li class="page-first-separator disabled">','<a href="#">...</a>',"</li>")}to--}}if(this.totalPages>=7){if(this.options.pageNumber>=this.totalPages-2){from--}}if(this.totalPages==6){if(this.options.pageNumber>=this.totalPages-2){to++}}else if(this.totalPages>=7){if(this.totalPages==7||this.options.pageNumber>=this.totalPages-3){to++}}for(i=from;i<=to;i++){html.push('<li class="page-number'+(i===this.options.pageNumber?" active":"")+'">','<a href="#">',i,"</a>","</li>")}if(this.totalPages>=8){if(this.options.pageNumber<=this.totalPages-4){html.push('<li class="page-last-separator disabled">','<a href="#">...</a>',"</li>")}}if(this.totalPages>=6){if(this.options.pageNumber<=this.totalPages-3){html.push('<li class="page-last'+(this.totalPages===this.options.pageNumber?" active":"")+'">','<a href="#">',this.totalPages,"</a>","</li>")}}html.push('<li class="page-next"><a href="#">'+this.options.paginationNextText+"</a></li>","</ul>","</div>")}this.$pagination.html(html.join(""));if(!this.options.onlyInfoPagination){$pageList=this.$pagination.find(".page-list a");$first=this.$pagination.find(".page-first");$pre=this.$pagination.find(".page-pre");$next=this.$pagination.find(".page-next");$last=this.$pagination.find(".page-last");$number=this.$pagination.find(".page-number");if(this.options.smartDisplay){if(this.totalPages<=1){this.$pagination.find("div.pagination").hide()}if(pageList.length<2||this.options.totalRows<=pageList[0]){this.$pagination.find("span.page-list").hide()}this.$pagination[this.getData().length?"show":"hide"]()}if(!this.options.paginationLoop){if(this.options.pageNumber===1){$pre.addClass("disabled")}if(this.options.pageNumber===this.totalPages){$next.addClass("disabled")}}if($allSelected){this.options.pageSize=this.options.formatAllRows()}$pageList.off("click").on("click",$.proxy(this.onPageListChange,this));$first.off("click").on("click",$.proxy(this.onPageFirst,this));$pre.off("click").on("click",$.proxy(this.onPagePre,this));$next.off("click").on("click",$.proxy(this.onPageNext,this));$last.off("click").on("click",$.proxy(this.onPageLast,this));$number.off("click").on("click",$.proxy(this.onPageNumber,this))}};BootstrapTable.prototype.updatePagination=function(event){if(event&&$(event.currentTarget).hasClass("disabled")){return}if(!this.options.maintainSelected){this.resetRows()}this.initPagination();if(this.options.sidePagination==="server"){this.initServer()}else{this.initBody()}this.trigger("page-change",this.options.pageNumber,this.options.pageSize)};BootstrapTable.prototype.onPageListChange=function(event){var $this=$(event.currentTarget);$this.parent().addClass("active").siblings().removeClass("active");this.options.pageSize=$this.text().toUpperCase()===this.options.formatAllRows().toUpperCase()?this.options.formatAllRows():+$this.text();this.$toolbar.find(".page-size").text(this.options.pageSize);this.updatePagination(event);return false};BootstrapTable.prototype.onPageFirst=function(event){this.options.pageNumber=1;this.updatePagination(event);return false};BootstrapTable.prototype.onPagePre=function(event){if(this.options.pageNumber-1===0){this.options.pageNumber=this.options.totalPages}else{this.options.pageNumber--}this.updatePagination(event);return false};BootstrapTable.prototype.onPageNext=function(event){if(this.options.pageNumber+1>this.options.totalPages){this.options.pageNumber=1}else{this.options.pageNumber++}this.updatePagination(event);return false};BootstrapTable.prototype.onPageLast=function(event){this.options.pageNumber=this.totalPages;this.updatePagination(event);return false};BootstrapTable.prototype.onPageNumber=function(event){if(this.options.pageNumber===+$(event.currentTarget).text()){return}this.options.pageNumber=+$(event.currentTarget).text();this.updatePagination(event);return false};BootstrapTable.prototype.initRow=function(item,i,data,parentDom){var that=this,key,html=[],style={},csses=[],data_="",attributes={},htmlAttributes=[];if($.inArray(item,this.hiddenRows)>-1){return}style=calculateObjectValue(this.options,this.options.rowStyle,[item,i],style);if(style&&style.css){for(key in style.css){csses.push(key+": "+style.css[key])}}attributes=calculateObjectValue(this.options,this.options.rowAttributes,[item,i],attributes);if(attributes){for(key in attributes){htmlAttributes.push(sprintf('%s="%s"',key,escapeHTML(attributes[key])))}}if(item._data&&!$.isEmptyObject(item._data)){$.each(item._data,function(k,v){if(k==="index"){return}data_+=sprintf(' data-%s="%s"',k,v)})}html.push("<tr",sprintf(" %s",htmlAttributes.join(" ")),sprintf(' id="%s"',$.isArray(item)?undefined:item._id),sprintf(' class="%s"',style.classes||($.isArray(item)?undefined:item._class)),sprintf(' data-index="%s"',i),sprintf(' data-uniqueid="%s"',item[this.options.uniqueId]),sprintf("%s",data_),">");if(this.options.cardView){html.push(sprintf('<td colspan="%s"><div class="card-views">',this.header.fields.length))}if(!this.options.cardView&&this.options.detailView){html.push("<td>",'<a class="detail-icon" href="#">',sprintf('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.detailOpen),"</a>","</td>")}$.each(this.header.fields,function(j,field){var text="",value_=getItemField(item,field,that.options.escape),value="",type="",cellStyle={},id_="",class_=that.header.classes[j],data_="",rowspan_="",colspan_="",title_="",column=that.columns[j];if(that.fromHtml&&typeof value_==="undefined"){return}if(!column.visible){return}if(that.options.cardView&&!column.cardVisible){return}if(column.escape){value_=escapeHTML(value_)}style=sprintf('style="%s"',csses.concat(that.header.styles[j]).join("; "));if(item["_"+field+"_id"]){id_=sprintf(' id="%s"',item["_"+field+"_id"])}if(item["_"+field+"_class"]){class_=sprintf(' class="%s"',item["_"+field+"_class"])}if(item["_"+field+"_rowspan"]){rowspan_=sprintf(' rowspan="%s"',item["_"+field+"_rowspan"])}if(item["_"+field+"_colspan"]){colspan_=sprintf(' colspan="%s"',item["_"+field+"_colspan"])}if(item["_"+field+"_title"]){title_=sprintf(' title="%s"',item["_"+field+"_title"])}cellStyle=calculateObjectValue(that.header,that.header.cellStyles[j],[value_,item,i,field],cellStyle);if(cellStyle.classes){class_=sprintf(' class="%s"',cellStyle.classes)}if(cellStyle.css){var csses_=[];for(var key in cellStyle.css){csses_.push(key+": "+cellStyle.css[key])}style=sprintf('style="%s"',csses_.concat(that.header.styles[j]).join("; "))}value=calculateObjectValue(column,that.header.formatters[j],[value_,item,i],value_);if(item["_"+field+"_data"]&&!$.isEmptyObject(item["_"+field+"_data"])){$.each(item["_"+field+"_data"],function(k,v){if(k==="index"){return}data_+=sprintf(' data-%s="%s"',k,v)})}if(column.checkbox||column.radio){type=column.checkbox?"checkbox":type;type=column.radio?"radio":type;text=[sprintf(that.options.cardView?'<div class="card-view %s">':'<td class="bs-checkbox %s">',column["class"]||""),"<input"+sprintf(' data-index="%s"',i)+sprintf(' name="%s"',that.options.selectItemName)+sprintf(' type="%s"',type)+sprintf(' value="%s"',item[that.options.idField])+sprintf(' checked="%s"',value===true||(value_||value&&value.checked)?"checked":undefined)+sprintf(' disabled="%s"',!column.checkboxEnabled||value&&value.disabled?"disabled":undefined)+" />",that.header.formatters[j]&&typeof value==="string"?value:"",that.options.cardView?"</div>":"</td>"].join("");item[that.header.stateField]=value===true||value&&value.checked}else{value=typeof value==="undefined"||value===null?that.options.undefinedText:value;text=that.options.cardView?['<div class="card-view">',that.options.showHeader?sprintf('<span class="title" %s>%s</span>',style,getPropertyFromOther(that.columns,"field","title",field)):"",sprintf('<span class="value">%s</span>',value),"</div>"].join(""):[sprintf("<td%s %s %s %s %s %s %s>",id_,class_,style,data_,rowspan_,colspan_,title_),value,"</td>"].join("");if(that.options.cardView&&that.options.smartDisplay&&value===""){text='<div class="card-view"></div>'}}html.push(text)});if(this.options.cardView){html.push("</div></td>")}html.push("</tr>");return html.join(" ")};BootstrapTable.prototype.initBody=function(fixedScroll){var that=this,html=[],data=this.getData();this.trigger("pre-body",data);this.$body=this.$el.find(">tbody");if(!this.$body.length){this.$body=$("<tbody></tbody>").appendTo(this.$el)}if(!this.options.pagination||this.options.sidePagination==="server"){this.pageFrom=1;this.pageTo=data.length}var trFragments=$(document.createDocumentFragment());var hasTr;for(var i=this.pageFrom-1;i<this.pageTo;i++){var item=data[i];var tr=this.initRow(item,i,data,trFragments);hasTr=hasTr||!!tr;if(tr&&tr!==true){trFragments.append(tr)}}if(!hasTr){trFragments.append('<tr class="no-records-found">'+sprintf('<td colspan="%s">%s</td>',this.$header.find("th").length,this.options.formatNoMatches())+"</tr>")}this.$body.html(trFragments);if(!fixedScroll){this.scrollTo(0)}this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(e){var $td=$(this),$tr=$td.parent(),item=that.data[$tr.data("index")],index=$td[0].cellIndex,fields=that.getVisibleFields(),field=fields[that.options.detailView&&!that.options.cardView?index-1:index],column=that.columns[getFieldIndex(that.columns,field)],value=getItemField(item,field,that.options.escape);if($td.find(".detail-icon").length){return}that.trigger(e.type==="click"?"click-cell":"dbl-click-cell",field,value,item,$td);that.trigger(e.type==="click"?"click-row":"dbl-click-row",item,$tr,field);if(e.type==="click"&&that.options.clickToSelect&&column.clickToSelect){var $selectItem=$tr.find(sprintf('[name="%s"]',that.options.selectItemName));if($selectItem.length){$selectItem[0].click()}}});this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click",function(){var $this=$(this),$tr=$this.parent().parent(),index=$tr.data("index"),row=data[index];if($tr.next().is("tr.detail-view")){$this.find("i").attr("class",sprintf("%s %s",that.options.iconsPrefix,that.options.icons.detailOpen));that.trigger("collapse-row",index,row);$tr.next().remove()}else{$this.find("i").attr("class",sprintf("%s %s",that.options.iconsPrefix,that.options.icons.detailClose));$tr.after(sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>',$tr.find("td").length));var $element=$tr.next().find("td");var content=calculateObjectValue(that.options,that.options.detailFormatter,[index,row,$element],"");if($element.length===1){$element.append(content)}that.trigger("expand-row",index,row,$element)}that.resetView();return false});this.$selectItem=this.$body.find(sprintf('[name="%s"]',this.options.selectItemName));this.$selectItem.off("click").on("click",function(event){event.stopImmediatePropagation();var $this=$(this),checked=$this.prop("checked"),row=that.data[$this.data("index")];if(that.options.maintainSelected&&$(this).is(":radio")){$.each(that.options.data,function(i,row){row[that.header.stateField]=false})}row[that.header.stateField]=checked;if(that.options.singleSelect){that.$selectItem.not(this).each(function(){that.data[$(this).data("index")][that.header.stateField]=false});that.$selectItem.filter(":checked").not(this).prop("checked",false)}that.updateSelected();that.trigger(checked?"check":"uncheck",row,$this)});$.each(this.header.events,function(i,events){if(!events){return}if(typeof events==="string"){events=calculateObjectValue(null,events)}var field=that.header.fields[i],fieldIndex=$.inArray(field,that.getVisibleFields());if(that.options.detailView&&!that.options.cardView){fieldIndex+=1}for(var key in events){that.$body.find(">tr:not(.no-records-found)").each(function(){var $tr=$(this),$td=$tr.find(that.options.cardView?".card-view":"td").eq(fieldIndex),index=key.indexOf(" "),name=key.substring(0,index),el=key.substring(index+1),func=events[key];$td.find(el).off(name).on(name,function(e){var index=$tr.data("index"),row=that.data[index],value=row[field];var props=field.split(".");if(props.length>1){value=row;for(var prop_index=0;prop_index<props.length;prop_index++){value=value[props[prop_index]]}}func.apply(this,[e,value,row,index])})})}});this.updateSelected();this.resetView();this.trigger("post-body",data)};BootstrapTable.prototype.initServer=function(silent,query,url){var that=this,data={},params={searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder},request;if(this.options.pagination){params.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize;params.pageNumber=this.options.pageNumber}if(!(url||this.options.url)&&!this.options.ajax){return}if(this.options.queryParamsType==="limit"){params={search:params.searchText,sort:params.sortName,order:params.sortOrder};if(this.options.pagination){params.offset=this.options.pageSize===this.options.formatAllRows()?0:this.options.pageSize*(this.options.pageNumber-1);params.limit=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize}}if(!$.isEmptyObject(this.filterColumnsPartial)){params.filter=JSON.stringify(this.filterColumnsPartial,null)}data=calculateObjectValue(this.options,this.options.queryParams,[params],data);$.extend(data,query||{});if(data===false){return}if(!silent){this.$tableLoading.show()}request=$.extend({},calculateObjectValue(null,this.options.ajaxOptions),{type:this.options.method,url:url||this.options.url,data:this.options.contentType==="application/json"&&this.options.method==="post"?JSON.stringify(data):data,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function(res){res=calculateObjectValue(that.options,that.options.responseHandler,[res],res);that.load(res);that.trigger("load-success",res);if(!silent)that.$tableLoading.hide()},error:function(res){that.trigger("load-error",res.status,res);if(!silent)that.$tableLoading.hide()}});if(this.options.ajax){calculateObjectValue(this,this.options.ajax,[request],null)}else{if(this._xhr&&this._xhr.readyState!==4){this._xhr.abort()}this._xhr=$.ajax(request)}};BootstrapTable.prototype.initSearchText=function(){if(this.options.search){if(this.options.searchText!==""){var $search=this.$toolbar.find(".search input");$search.val(this.options.searchText);this.onSearch({currentTarget:$search})}}};BootstrapTable.prototype.getCaret=function(){var that=this;$.each(this.$header.find("th"),function(i,th){$(th).find(".sortable").removeClass("desc asc").addClass($(th).data("field")===that.options.sortName?that.options.sortOrder:"both")})};BootstrapTable.prototype.updateSelected=function(){var checkAll=this.$selectItem.filter(":enabled").length&&this.$selectItem.filter(":enabled").length===this.$selectItem.filter(":enabled").filter(":checked").length;this.$selectAll.add(this.$selectAll_).prop("checked",checkAll);this.$selectItem.each(function(){$(this).closest("tr")[$(this).prop("checked")?"addClass":"removeClass"]("selected")})};BootstrapTable.prototype.updateRows=function(){var that=this;this.$selectItem.each(function(){that.data[$(this).data("index")][that.header.stateField]=$(this).prop("checked")})};BootstrapTable.prototype.resetRows=function(){var that=this;$.each(this.data,function(i,row){that.$selectAll.prop("checked",false);that.$selectItem.prop("checked",false);if(that.header.stateField){row[that.header.stateField]=false}});this.initHiddenRows()};BootstrapTable.prototype.trigger=function(name){var args=Array.prototype.slice.call(arguments,1);name+=".bs.table";this.options[BootstrapTable.EVENTS[name]].apply(this.options,args);this.$el.trigger($.Event(name),args);this.options.onAll(name,args);this.$el.trigger($.Event("all.bs.table"),[name,args])};BootstrapTable.prototype.resetHeader=function(){clearTimeout(this.timeoutId_);this.timeoutId_=setTimeout($.proxy(this.fitHeader,this),this.$el.is(":hidden")?100:0)};BootstrapTable.prototype.fitHeader=function(){var that=this,fixedBody,scrollWidth,focused,focusedTemp;if(that.$el.is(":hidden")){that.timeoutId_=setTimeout($.proxy(that.fitHeader,that),100);return}fixedBody=this.$tableBody.get(0);scrollWidth=fixedBody.scrollWidth>fixedBody.clientWidth&&fixedBody.scrollHeight>fixedBody.clientHeight+this.$header.outerHeight()?getScrollBarWidth():0;this.$el.css("margin-top",-this.$header.outerHeight());focused=$(":focus");if(focused.length>0){var $th=focused.parents("th");if($th.length>0){var dataField=$th.attr("data-field");if(dataField!==undefined){var $headerTh=this.$header.find("[data-field='"+dataField+"']");if($headerTh.length>0){$headerTh.find(":input").addClass("focus-temp")}}}}this.$header_=this.$header.clone(true,true);this.$selectAll_=this.$header_.find('[name="btSelectAll"]');this.$tableHeader.css({"margin-right":scrollWidth}).find("table").css("width",this.$el.outerWidth()).html("").attr("class",this.$el.attr("class")).append(this.$header_);focusedTemp=$(".focus-temp:visible:eq(0)");if(focusedTemp.length>0){focusedTemp.focus();this.$header.find(".focus-temp").removeClass("focus-temp")}this.$header.find("th[data-field]").each(function(i){that.$header_.find(sprintf('th[data-field="%s"]',$(this).data("field"))).data($(this).data())});var visibleFields=this.getVisibleFields(),$ths=this.$header_.find("th");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(i){var $this=$(this),index=i;if(that.options.detailView&&!that.options.cardView){if(i===0){that.$header_.find("th.detail").find(".fht-cell").width($this.innerWidth())}index=i-1}var $th=that.$header_.find(sprintf('th[data-field="%s"]',visibleFields[index]));if($th.length>1){$th=$($ths[$this[0].cellIndex])}$th.find(".fht-cell").width($this.innerWidth())});this.$tableBody.off("scroll").on("scroll",function(){that.$tableHeader.scrollLeft($(this).scrollLeft());if(that.options.showFooter&&!that.options.cardView){that.$tableFooter.scrollLeft($(this).scrollLeft())}});that.trigger("post-header")};BootstrapTable.prototype.resetFooter=function(){var that=this,data=that.getData(),html=[];if(!this.options.showFooter||this.options.cardView){return}if(!this.options.cardView&&this.options.detailView){html.push('<td><div class="th-inner">&nbsp;</div><div class="fht-cell"></div></td>')}$.each(this.columns,function(i,column){var key,falign="",valign="",csses=[],style={},class_=sprintf(' class="%s"',column["class"]);if(!column.visible){return}if(that.options.cardView&&!column.cardVisible){return}falign=sprintf("text-align: %s; ",column.falign?column.falign:column.align);valign=sprintf("vertical-align: %s; ",column.valign);style=calculateObjectValue(null,that.options.footerStyle);if(style&&style.css){for(key in style.css){csses.push(key+": "+style.css[key])}}html.push("<td",class_,sprintf(' style="%s"',falign+valign+csses.concat().join("; ")),">");html.push('<div class="th-inner">');html.push(calculateObjectValue(column,column.footerFormatter,[data],"&nbsp;")||"&nbsp;");html.push("</div>");html.push('<div class="fht-cell"></div>');html.push("</div>");html.push("</td>")});this.$tableFooter.find("tr").html(html.join(""));this.$tableFooter.show();clearTimeout(this.timeoutFooter_);this.timeoutFooter_=setTimeout($.proxy(this.fitFooter,this),this.$el.is(":hidden")?100:0)};BootstrapTable.prototype.fitFooter=function(){var that=this,$footerTd,elWidth,scrollWidth;clearTimeout(this.timeoutFooter_);if(this.$el.is(":hidden")){this.timeoutFooter_=setTimeout($.proxy(this.fitFooter,this),100);return}elWidth=this.$el.css("width");scrollWidth=elWidth>this.$tableBody.width()?getScrollBarWidth():0;this.$tableFooter.css({"margin-right":scrollWidth}).find("table").css("width",elWidth).attr("class",this.$el.attr("class"));$footerTd=this.$tableFooter.find("td");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(i){var $this=$(this);$footerTd.eq(i).find(".fht-cell").width($this.innerWidth())})};BootstrapTable.prototype.toggleColumn=function(index,checked,needUpdate){if(index===-1){return}this.columns[index].visible=checked;this.initHeader();this.initSearch();this.initPagination();this.initBody();if(this.options.showColumns){var $items=this.$toolbar.find(".keep-open input").prop("disabled",false);if(needUpdate){$items.filter(sprintf('[value="%s"]',index)).prop("checked",checked)}if($items.filter(":checked").length<=this.options.minimumCountColumns){$items.filter(":checked").prop("disabled",true)}}};BootstrapTable.prototype.getVisibleFields=function(){var that=this,visibleFields=[];$.each(this.header.fields,function(j,field){var column=that.columns[getFieldIndex(that.columns,field)];if(!column.visible){return}visibleFields.push(field)});return visibleFields};BootstrapTable.prototype.resetView=function(params){var padding=0;if(params&&params.height){this.options.height=params.height}this.$selectAll.prop("checked",this.$selectItem.length>0&&this.$selectItem.length===this.$selectItem.filter(":checked").length);if(this.options.height){var toolbarHeight=this.$toolbar.outerHeight(true),paginationHeight=this.$pagination.outerHeight(true),height=this.options.height-toolbarHeight-paginationHeight;this.$tableContainer.css("height",height+"px")}if(this.options.cardView){this.$el.css("margin-top","0");this.$tableContainer.css("padding-bottom","0");this.$tableFooter.hide();return}if(this.options.showHeader&&this.options.height){this.$tableHeader.show();this.resetHeader();padding+=this.$header.outerHeight()}else{this.$tableHeader.hide();this.trigger("post-header")}if(this.options.showFooter){this.resetFooter();if(this.options.height){padding+=this.$tableFooter.outerHeight()+1}}this.getCaret();this.$tableContainer.css("padding-bottom",padding+"px");this.trigger("reset-view")};BootstrapTable.prototype.getData=function(useCurrentPage){return this.searchText||!$.isEmptyObject(this.filterColumns)||!$.isEmptyObject(this.filterColumnsPartial)?useCurrentPage?this.data.slice(this.pageFrom-1,this.pageTo):this.data:useCurrentPage?this.options.data.slice(this.pageFrom-1,this.pageTo):this.options.data};BootstrapTable.prototype.load=function(data){var fixedScroll=false;if(this.options.sidePagination==="server"){this.options.totalRows=data[this.options.totalField];fixedScroll=data.fixedScroll;data=data[this.options.dataField]}else if(!$.isArray(data)){fixedScroll=data.fixedScroll;data=data.data}this.initData(data);this.initSearch();this.initPagination();this.initBody(fixedScroll)};BootstrapTable.prototype.append=function(data){this.initData(data,"append");this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.prepend=function(data){this.initData(data,"prepend");this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.remove=function(params){var len=this.options.data.length,i,row;if(!params.hasOwnProperty("field")||!params.hasOwnProperty("values")){return}for(i=len-1;i>=0;i--){row=this.options.data[i];if(!row.hasOwnProperty(params.field)){continue}if($.inArray(row[params.field],params.values)!==-1){this.options.data.splice(i,1);if(this.options.sidePagination==="server"){this.options.totalRows-=1}}}if(len===this.options.data.length){return}this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.removeAll=function(){if(this.options.data.length>0){this.options.data.splice(0,this.options.data.length);this.initSearch();this.initPagination();this.initBody(true)}};BootstrapTable.prototype.getRowByUniqueId=function(id){var uniqueId=this.options.uniqueId,len=this.options.data.length,dataRow=null,i,row,rowUniqueId;for(i=len-1;i>=0;i--){row=this.options.data[i];if(row.hasOwnProperty(uniqueId)){rowUniqueId=row[uniqueId]}else if(row._data.hasOwnProperty(uniqueId)){rowUniqueId=row._data[uniqueId]}else{continue}if(typeof rowUniqueId==="string"){id=id.toString()}else if(typeof rowUniqueId==="number"){if(Number(rowUniqueId)===rowUniqueId&&rowUniqueId%1===0){id=parseInt(id)}else if(rowUniqueId===Number(rowUniqueId)&&rowUniqueId!==0){id=parseFloat(id)}}if(rowUniqueId===id){dataRow=row;break}}return dataRow};BootstrapTable.prototype.removeByUniqueId=function(id){var len=this.options.data.length,row=this.getRowByUniqueId(id);if(row){this.options.data.splice(this.options.data.indexOf(row),1)}if(len===this.options.data.length){return}this.initSearch();this.initPagination();this.initBody(true)};BootstrapTable.prototype.updateByUniqueId=function(params){var that=this;var allParams=$.isArray(params)?params:[params];$.each(allParams,function(i,params){var rowId;if(!params.hasOwnProperty("id")||!params.hasOwnProperty("row")){return}rowId=$.inArray(that.getRowByUniqueId(params.id),that.options.data);if(rowId===-1){return}$.extend(that.options.data[rowId],params.row)});this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.insertRow=function(params){if(!params.hasOwnProperty("index")||!params.hasOwnProperty("row")){return}this.data.splice(params.index,0,params.row);this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.updateRow=function(params){var that=this;var allParams=$.isArray(params)?params:[params];$.each(allParams,function(i,params){if(!params.hasOwnProperty("index")||!params.hasOwnProperty("row")){return}$.extend(that.options.data[params.index],params.row)});this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.initHiddenRows=function(){this.hiddenRows=[]};BootstrapTable.prototype.showRow=function(params){this.toggleRow(params,true)};BootstrapTable.prototype.hideRow=function(params){this.toggleRow(params,false)};BootstrapTable.prototype.toggleRow=function(params,visible){var row,index;if(params.hasOwnProperty("index")){row=this.getData()[params.index]}else if(params.hasOwnProperty("uniqueId")){row=this.getRowByUniqueId(params.uniqueId)}if(!row){return}index=$.inArray(row,this.hiddenRows);if(!visible&&index===-1){this.hiddenRows.push(row)}else if(visible&&index>-1){this.hiddenRows.splice(index,1)}this.initBody(true)};BootstrapTable.prototype.getHiddenRows=function(show){var that=this,data=this.getData(),rows=[];$.each(data,function(i,row){if($.inArray(row,that.hiddenRows)>-1){rows.push(row)}});this.hiddenRows=rows;return rows};BootstrapTable.prototype.mergeCells=function(options){var row=options.index,col=$.inArray(options.field,this.getVisibleFields()),rowspan=options.rowspan||1,colspan=options.colspan||1,i,j,$tr=this.$body.find(">tr"),$td;if(this.options.detailView&&!this.options.cardView){col+=1}$td=$tr.eq(row).find(">td").eq(col);if(row<0||col<0||row>=this.data.length){return}for(i=row;i<row+rowspan;i++){for(j=col;j<col+colspan;j++){$tr.eq(i).find(">td").eq(j).hide()}}$td.attr("rowspan",rowspan).attr("colspan",colspan).show()};BootstrapTable.prototype.updateCell=function(params){if(!params.hasOwnProperty("index")||!params.hasOwnProperty("field")||!params.hasOwnProperty("value")){return}this.data[params.index][params.field]=params.value;if(params.reinit===false){return}this.initSort();this.initBody(true)};BootstrapTable.prototype.getOptions=function(){return this.options};BootstrapTable.prototype.getSelections=function(){var that=this;return $.grep(this.options.data,function(row){return row[that.header.stateField]===true})};BootstrapTable.prototype.getAllSelections=function(){var that=this;return $.grep(this.options.data,function(row){return row[that.header.stateField]})};BootstrapTable.prototype.checkAll=function(){this.checkAll_(true)};BootstrapTable.prototype.uncheckAll=function(){this.checkAll_(false)};BootstrapTable.prototype.checkInvert=function(){var that=this;var rows=that.$selectItem.filter(":enabled");var checked=rows.filter(":checked");rows.each(function(){$(this).prop("checked",!$(this).prop("checked"))});that.updateRows();that.updateSelected();that.trigger("uncheck-some",checked);checked=that.getSelections();that.trigger("check-some",checked)};BootstrapTable.prototype.checkAll_=function(checked){var rows;if(!checked){rows=this.getSelections()}this.$selectAll.add(this.$selectAll_).prop("checked",checked);this.$selectItem.filter(":enabled").prop("checked",checked);this.updateRows();if(checked){rows=this.getSelections()}this.trigger(checked?"check-all":"uncheck-all",rows)};BootstrapTable.prototype.check=function(index){this.check_(true,index)};BootstrapTable.prototype.uncheck=function(index){this.check_(false,index)};BootstrapTable.prototype.check_=function(checked,index){var $el=this.$selectItem.filter(sprintf('[data-index="%s"]',index)).prop("checked",checked);this.data[index][this.header.stateField]=checked;this.updateSelected();this.trigger(checked?"check":"uncheck",this.data[index],$el)};BootstrapTable.prototype.checkBy=function(obj){this.checkBy_(true,obj)};BootstrapTable.prototype.uncheckBy=function(obj){this.checkBy_(false,obj)};BootstrapTable.prototype.checkBy_=function(checked,obj){if(!obj.hasOwnProperty("field")||!obj.hasOwnProperty("values")){return}var that=this,rows=[];$.each(this.options.data,function(index,row){if(!row.hasOwnProperty(obj.field)){return false}if($.inArray(row[obj.field],obj.values)!==-1){var $el=that.$selectItem.filter(":enabled").filter(sprintf('[data-index="%s"]',index)).prop("checked",checked);row[that.header.stateField]=checked;rows.push(row);that.trigger(checked?"check":"uncheck",row,$el)}});this.updateSelected();this.trigger(checked?"check-some":"uncheck-some",rows)};BootstrapTable.prototype.destroy=function(){this.$el.insertBefore(this.$container);$(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")||"")};BootstrapTable.prototype.showLoading=function(){this.$tableLoading.show()};BootstrapTable.prototype.hideLoading=function(){this.$tableLoading.hide()};BootstrapTable.prototype.togglePagination=function(){this.options.pagination=!this.options.pagination;var button=this.$toolbar.find('button[name="paginationSwitch"] i');if(this.options.pagination){button.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchDown)}else{button.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchUp)}this.updatePagination()};BootstrapTable.prototype.refresh=function(params){if(params&&params.url){this.options.url=params.url}if(params&&params.pageNumber){this.options.pageNumber=params.pageNumber}if(params&&params.pageSize){this.options.pageSize=params.pageSize}this.initServer(params&&params.silent,params&&params.query,params&&params.url);this.trigger("refresh",params)};BootstrapTable.prototype.resetWidth=function(){if(this.options.showHeader&&this.options.height){this.fitHeader()}if(this.options.showFooter){this.fitFooter()}};BootstrapTable.prototype.showColumn=function(field){this.toggleColumn(getFieldIndex(this.columns,field),true,true)};BootstrapTable.prototype.hideColumn=function(field){this.toggleColumn(getFieldIndex(this.columns,field),false,true)};BootstrapTable.prototype.getHiddenColumns=function(){return $.grep(this.columns,function(column){return!column.visible})};BootstrapTable.prototype.getVisibleColumns=function(){return $.grep(this.columns,function(column){return column.visible})};BootstrapTable.prototype.toggleAllColumns=function(visible){$.each(this.columns,function(i,column){this.columns[i].visible=visible});this.initHeader();this.initSearch();this.initPagination();this.initBody();if(this.options.showColumns){var $items=this.$toolbar.find(".keep-open input").prop("disabled",false);if($items.filter(":checked").length<=this.options.minimumCountColumns){$items.filter(":checked").prop("disabled",true)}}};BootstrapTable.prototype.showAllColumns=function(){this.toggleAllColumns(true)};BootstrapTable.prototype.hideAllColumns=function(){this.toggleAllColumns(false)};BootstrapTable.prototype.filterBy=function(columns){this.filterColumns=$.isEmptyObject(columns)?{}:columns;this.options.pageNumber=1;this.initSearch();this.updatePagination()};BootstrapTable.prototype.scrollTo=function(value){if(typeof value==="string"){value=value==="bottom"?this.$tableBody[0].scrollHeight:0}if(typeof value==="number"){this.$tableBody.scrollTop(value)}if(typeof value==="undefined"){return this.$tableBody.scrollTop()}};BootstrapTable.prototype.getScrollPosition=function(){return this.scrollTo()};BootstrapTable.prototype.selectPage=function(page){if(page>0&&page<=this.options.totalPages){this.options.pageNumber=page;this.updatePagination()}};BootstrapTable.prototype.prevPage=function(){if(this.options.pageNumber>1){this.options.pageNumber--;this.updatePagination()}};BootstrapTable.prototype.nextPage=function(){if(this.options.pageNumber<this.options.totalPages){this.options.pageNumber++;this.updatePagination()}};BootstrapTable.prototype.toggleView=function(){this.options.cardView=!this.options.cardView;this.initHeader();this.initBody();this.trigger("toggle",this.options.cardView)};BootstrapTable.prototype.refreshOptions=function(options){if(compareObjects(this.options,options,true)){return}this.options=$.extend(this.options,options);this.trigger("refresh-options",this.options);this.destroy();this.init()};BootstrapTable.prototype.resetSearch=function(text){var $search=this.$toolbar.find(".search input");$search.val(text||"");this.onSearch({currentTarget:$search})};BootstrapTable.prototype.expandRow_=function(expand,index){var $tr=this.$body.find(sprintf('> tr[data-index="%s"]',index));if($tr.next().is("tr.detail-view")===(expand?false:true)){$tr.find("> td > .detail-icon").click()}};BootstrapTable.prototype.expandRow=function(index){this.expandRow_(true,index)};BootstrapTable.prototype.collapseRow=function(index){this.expandRow_(false,index)};BootstrapTable.prototype.expandAllRows=function(isSubTable){if(isSubTable){var $tr=this.$body.find(sprintf('> tr[data-index="%s"]',0)),that=this,detailIcon=null,executeInterval=false,idInterval=-1;if(!$tr.next().is("tr.detail-view")){$tr.find("> td > .detail-icon").click();executeInterval=true}else if(!$tr.next().next().is("tr.detail-view")){$tr.next().find(".detail-icon").click();executeInterval=true}if(executeInterval){try{idInterval=setInterval(function(){detailIcon=that.$body.find("tr.detail-view").last().find(".detail-icon");if(detailIcon.length>0){detailIcon.click()}else{clearInterval(idInterval)}},1)}catch(ex){clearInterval(idInterval)}}}else{var trs=this.$body.children();for(var i=0;i<trs.length;i++){this.expandRow_(true,$(trs[i]).data("index"))}}};BootstrapTable.prototype.collapseAllRows=function(isSubTable){if(isSubTable){this.expandRow_(false,0)}else{var trs=this.$body.children();for(var i=0;i<trs.length;i++){this.expandRow_(false,$(trs[i]).data("index"))}}};BootstrapTable.prototype.updateFormatText=function(name,text){if(this.options[sprintf("format%s",name)]){if(typeof text==="string"){this.options[sprintf("format%s",name)]=function(){return text}}else if(typeof text==="function"){this.options[sprintf("format%s",name)]=text}}this.initToolbar();this.initPagination();this.initBody()};var allowedMethods=["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"];$.fn.bootstrapTable=function(option){var value,args=Array.prototype.slice.call(arguments,1);this.each(function(){var $this=$(this),data=$this.data("bootstrap.table"),options=$.extend({},BootstrapTable.DEFAULTS,$this.data(),typeof option==="object"&&option);if(typeof option==="string"){if($.inArray(option,allowedMethods)<0){throw new Error("Unknown method: "+option)}if(!data){return}value=data[option].apply(data,args);if(option==="destroy"){$this.removeData("bootstrap.table")}}if(!data){$this.data("bootstrap.table",data=new BootstrapTable(this,options))}});return typeof value==="undefined"?this:value};$.fn.bootstrapTable.Constructor=BootstrapTable;$.fn.bootstrapTable.defaults=BootstrapTable.DEFAULTS;$.fn.bootstrapTable.columnDefaults=BootstrapTable.COLUMN_DEFAULTS;$.fn.bootstrapTable.locales=BootstrapTable.LOCALES;$.fn.bootstrapTable.methods=allowedMethods;$.fn.bootstrapTable.utils={sprintf:sprintf,getFieldIndex:getFieldIndex,compareObjects:compareObjects,calculateObjectValue:calculateObjectValue,getItemField:getItemField,objectKeys:objectKeys,isIEBrowser:isIEBrowser};$(function(){$('[data-toggle="table"]').bootstrapTable()})})(jQuery);
  6246. define("bootstrap-table", ["bootstrap"], (function (global) {
  6247. return function () {
  6248. var ret, fn;
  6249. return ret || global.$.fn.bootstrapTable;
  6250. };
  6251. }(this)));
  6252. /**
  6253. * Bootstrap Table Chinese translation
  6254. * Author: Zhixin Wen<wenzhixin2010@gmail.com>
  6255. */
  6256. (function ($) {
  6257. 'use strict';
  6258. $.fn.bootstrapTable.locales['zh-CN'] = {
  6259. formatLoadingMessage: function () {
  6260. return '正在努力地加载数据中,请稍候……';
  6261. },
  6262. formatRecordsPerPage: function (pageNumber) {
  6263. return '每页显示 ' + pageNumber + ' 条记录';
  6264. },
  6265. formatShowingRows: function (pageFrom, pageTo, totalRows) {
  6266. return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
  6267. },
  6268. formatSearch: function () {
  6269. return '搜索';
  6270. },
  6271. formatNoMatches: function () {
  6272. return '没有找到匹配的记录';
  6273. },
  6274. formatPaginationSwitch: function () {
  6275. return '隐藏/显示分页';
  6276. },
  6277. formatRefresh: function () {
  6278. return '刷新';
  6279. },
  6280. formatToggle: function () {
  6281. return '切换';
  6282. },
  6283. formatColumns: function () {
  6284. return '列';
  6285. },
  6286. formatExport: function () {
  6287. return '导出数据';
  6288. },
  6289. formatClearFilters: function () {
  6290. return '清空过滤';
  6291. }
  6292. };
  6293. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
  6294. })(jQuery);
  6295. define("bootstrap-table-lang", ["bootstrap-table"], (function (global) {
  6296. return function () {
  6297. var ret, fn;
  6298. return ret || global.$.fn.bootstrapTable.defaults;
  6299. };
  6300. }(this)));
  6301. /*
  6302. tableExport.jquery.plugin
  6303. Version 1.10.22
  6304. Copyright (c) 2015-2021 hhurz, https://github.com/hhurz/tableExport.jquery.plugin
  6305. Based on https://github.com/kayalshri/tableExport.jquery.plugin
  6306. Licensed under the MIT License
  6307. */
  6308. var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(d,k,y){d instanceof String&&(d=String(d));for(var C=d.length,v=0;v<C;v++){var R=d[v];if(k.call(y,R,v,d))return{i:v,v:R}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(d,k,y){d!=Array.prototype&&d!=Object.prototype&&(d[k]=y.value)};
  6309. $jscomp.getGlobal=function(d){return"undefined"!=typeof window&&window===d?d:"undefined"!=typeof global&&null!=global?global:d};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(d,k,y,C){if(k){y=$jscomp.global;d=d.split(".");for(C=0;C<d.length-1;C++){var v=d[C];v in y||(y[v]={});y=y[v]}d=d[d.length-1];C=y[d];k=k(C);k!=C&&null!=k&&$jscomp.defineProperty(y,d,{configurable:!0,writable:!0,value:k})}};
  6310. $jscomp.polyfill("Array.prototype.find",function(d){return d?d:function(d,y){return $jscomp.findInternal(this,d,y).v}},"es6","es3");
  6311. (function(d){d.fn.tableExport=function(k){function y(b){var c=[];v(b,"thead").each(function(){c.push.apply(c,v(d(this),a.theadSelector).toArray())});return c}function C(b){var c=[];v(b,"tbody").each(function(){c.push.apply(c,v(d(this),a.tbodySelector).toArray())});a.tfootSelector.length&&v(b,"tfoot").each(function(){c.push.apply(c,v(d(this),a.tfootSelector).toArray())});return c}function v(b,a){var c=b[0].tagName,q=b.parents(c).length;return b.find(a).filter(function(){return q===d(this).closest(c).parents(c).length})}
  6312. function R(b){var a=[],e=0,q=0,f=0;d(b).find("thead").first().find("th").each(function(b,c){b=void 0!==d(c).attr("data-field");"undefined"!==typeof c.parentNode.rowIndex&&q!==c.parentNode.rowIndex&&(q=c.parentNode.rowIndex,e=f=0);var h=J(c);for(e+=h?h:1;f<e;)a[f]=b?d(c).attr("data-field"):f.toString(),f++});return a}function I(b){var a="undefined"!==typeof b[0].rowIndex,e=!1===a&&"undefined"!==typeof b[0].cellIndex,q=e||a?Ja(b):b.is(":visible"),f=b.attr("data-tableexport-display");e&&"none"!==f&&
  6313. "always"!==f&&(b=d(b[0].parentNode),a="undefined"!==typeof b[0].rowIndex,f=b.attr("data-tableexport-display"));a&&"none"!==f&&"always"!==f&&(f=b.closest("table").attr("data-tableexport-display"));return"none"!==f&&(!0===q||"always"===f)}function Ja(b){var a=[];V&&(a=K.filter(function(){var a=!1;this.nodeType===b[0].nodeType&&("undefined"!==typeof this.rowIndex&&this.rowIndex===b[0].rowIndex?a=!0:"undefined"!==typeof this.cellIndex&&this.cellIndex===b[0].cellIndex&&"undefined"!==typeof this.parentNode.rowIndex&&
  6314. "undefined"!==typeof b[0].parentNode.rowIndex&&this.parentNode.rowIndex===b[0].parentNode.rowIndex&&(a=!0));return a}));return!1===V||0===a.length}function ta(b,c,e){var q=!1;I(b)?0<a.ignoreColumn.length&&(-1!==d.inArray(e,a.ignoreColumn)||-1!==d.inArray(e-c,a.ignoreColumn)||S.length>e&&"undefined"!==typeof S[e]&&-1!==d.inArray(S[e],a.ignoreColumn))&&(q=!0):q=!0;return q}function E(b,c,e,q,f){if("function"===typeof f){var h=!1;"function"===typeof a.onIgnoreRow&&(h=a.onIgnoreRow(d(b),e));if(!1===h&&
  6315. (0===a.ignoreRow.length||-1===d.inArray(e,a.ignoreRow)&&-1===d.inArray(e-q,a.ignoreRow))&&I(d(b))){b=v(d(b),c);var n=b.length,l=0,u=0;b.each(function(){var b=d(this),a=J(this),c=T(this),h;d.each(G,function(){if(e>this.s.r&&e<=this.e.r&&l>=this.s.c&&l<=this.e.c)for(h=0;h<=this.e.c-this.s.c;++h)n++,u++,f(null,e,l++)});if(c||a)a=a||1,G.push({s:{r:e,c:l},e:{r:e+(c||1)-1,c:l+a-1}});!1===ta(b,n,u++)&&f(this,e,l++);if(1<a)for(h=0;h<a-1;++h)u++,f(null,e,l++)});d.each(G,function(){if(e>=this.s.r&&e<=this.e.r&&
  6316. l>=this.s.c&&l<=this.e.c)for(ea=0;ea<=this.e.c-this.s.c;++ea)f(null,e,l++)})}}}function ua(b,a,e,d){if("undefined"!==typeof d.images&&(e=d.images[e],"undefined"!==typeof e)){a=a.getBoundingClientRect();var c=b.width/b.height,h=a.width/a.height,q=b.width,l=b.height,u=19.049976/25.4,g=0;h<=c?(l=Math.min(b.height,a.height),q=a.width*l/a.height):h>c&&(q=Math.min(b.width,a.width),l=a.height*q/a.width);q*=u;l*=u;l<b.height&&(g=(b.height-l)/2);try{d.doc.addImage(e.src,b.textPos.x,b.y+g,q,l)}catch(Pa){}b.textPos.x+=
  6317. q}}function va(b,c){if("string"===a.outputMode)return b.output();if("base64"===a.outputMode)return L(b.output());if("window"===a.outputMode)window.URL=window.URL||window.webkitURL,window.open(window.URL.createObjectURL(b.output("blob")));else try{var e=b.output("blob");saveAs(e,a.fileName+".pdf")}catch(q){ka(a.fileName+".pdf","data:application/pdf"+(c?"":";base64")+",",c?b.output("blob"):b.output())}}function wa(b,a,e){var c=0;"undefined"!==typeof e&&(c=e.colspan);if(0<=c){for(var f=b.width,d=b.textPos.x,
  6318. n=a.table.columns.indexOf(a.column),l=1;l<c;l++)f+=a.table.columns[n+l].width;1<c&&("right"===b.styles.halign?d=b.textPos.x+f-b.width:"center"===b.styles.halign&&(d=b.textPos.x+(f-b.width)/2));b.width=f;b.textPos.x=d;"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-=(2-1.15)/2*a.row.styles.fontSize*(e-2)/3);return!0}return!1}function xa(b,
  6319. a,e){"undefined"!==typeof b&&null!==b&&(b.hasAttribute("data-tableexport-canvas")?(a=(new Date).getTime(),d(b).attr("data-tableexport-canvas",a),e.images[a]={url:'[data-tableexport-canvas="'+a+'"]',src:null}):"undefined"!==a&&null!=a&&a.each(function(){if(d(this).is("img")){var a=ya(this.src);e.images[a]={url:this.src,src:this.src}}xa(b,d(this).children(),e)}))}function Ka(b,a){function c(b){if(b.url)if(b.src){var c=new Image;q=++f;c.crossOrigin="Anonymous";c.onerror=c.onload=function(){if(c.complete&&
  6320. (0===c.src.indexOf("data:image/")&&(c.width=b.width||c.width||0,c.height=b.height||c.height||0),c.width+c.height)){var e=document.createElement("canvas"),d=e.getContext("2d");e.width=c.width;e.height=c.height;d.drawImage(c,0,0);b.src=e.toDataURL("image/png")}--f||a(q)};c.src=b.url}else{var e=d(b.url);e.length&&(q=++f,html2canvas(e[0]).then(function(c){b.src=c.toDataURL("image/png");--f||a(q)}))}}var q=0,f=0;if("undefined"!==typeof b.images)for(var h in b.images)b.images.hasOwnProperty(h)&&c(b.images[h]);
  6321. (b=f)||(a(q),b=void 0);return b}function za(b,c,e){c.each(function(){if(d(this).is("div")){var c=fa(M(this,"background-color"),[255,255,255]),f=fa(M(this,"border-top-color"),[0,0,0]),h=ha(this,"border-top-width",a.jspdf.unit),n=this.getBoundingClientRect(),l=this.offsetLeft*e.wScaleFactor,u=this.offsetTop*e.hScaleFactor,g=n.width*e.wScaleFactor;n=n.height*e.hScaleFactor;e.doc.setDrawColor.apply(void 0,f);e.doc.setFillColor.apply(void 0,c);e.doc.setLineWidth(h);e.doc.rect(b.x+l,b.y+u,g,n,h?"FD":"F")}else d(this).is("img")&&
  6322. (c=ya(this.src),ua(b,this,c,e));za(b,d(this).children(),e)})}function Aa(b,c,e){if("function"===typeof e.onAutotableText)e.onAutotableText(e.doc,b,c);else{var q=b.textPos.x,f=b.textPos.y,h={halign:b.styles.halign,valign:b.styles.valign};if(c.length){for(c=c[0];c.previousSibling;)c=c.previousSibling;for(var n=!1,l=!1;c;){var u=c.innerText||c.textContent||"",g=u.length&&" "===u[0]?" ":"",k=1<u.length&&" "===u[u.length-1]?" ":"";!0!==a.preserve.leadingWS&&(u=g+la(u));!0!==a.preserve.trailingWS&&(u=ma(u)+
  6323. k);d(c).is("br")&&(q=b.textPos.x,f+=e.doc.internal.getFontSize());d(c).is("b")?n=!0:d(c).is("i")&&(l=!0);(n||l)&&e.doc.setFontType(n&&l?"bolditalic":n?"bold":"italic");if(g=e.doc.getStringUnitWidth(u)*e.doc.internal.getFontSize()){"linebreak"===b.styles.overflow&&q>b.textPos.x&&q+g>b.textPos.x+b.width&&(0<=".,!%*;:=-".indexOf(u.charAt(0))&&(k=u.charAt(0),g=e.doc.getStringUnitWidth(k)*e.doc.internal.getFontSize(),q+g<=b.textPos.x+b.width&&(e.doc.autoTableText(k,q,f,h),u=u.substring(1,u.length)),g=
  6324. e.doc.getStringUnitWidth(u)*e.doc.internal.getFontSize()),q=b.textPos.x,f+=e.doc.internal.getFontSize());if("visible"!==b.styles.overflow)for(;u.length&&q+g>b.textPos.x+b.width;)u=u.substring(0,u.length-1),g=e.doc.getStringUnitWidth(u)*e.doc.internal.getFontSize();e.doc.autoTableText(u,q,f,h);q+=g}if(n||l)d(c).is("b")?n=!1:d(c).is("i")&&(l=!1),e.doc.setFontType(n||l?n?"bold":"italic":"normal");c=c.nextSibling}b.textPos.x=q;b.textPos.y=f}else e.doc.autoTableText(b.text,b.textPos.x,b.textPos.y,h)}}
  6325. function W(b,a,e){return null==b?"":b.toString().replace(new RegExp(null==a?"":a.toString().replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),e)}function la(b){return null==b?"":b.toString().replace(/^\s+/,"")}function ma(b){return null==b?"":b.toString().replace(/\s+$/,"")}function La(b){if(0===a.date.html.length)return!1;a.date.pattern.lastIndex=0;var c=a.date.pattern.exec(b);if(null==c)return!1;b=+c[a.date.match_y];if(0>b||8099<b)return!1;var e=1*c[a.date.match_m];c=1*c[a.date.match_d];if(!isFinite(c))return!1;
  6326. var d=new Date(b,e-1,c,0,0,0);return d.getFullYear()===b&&d.getMonth()===e-1&&d.getDate()===c?new Date(Date.UTC(b,e-1,c,0,0,0)):!1}function na(b){b=b||"0";""!==a.numbers.html.thousandsSeparator&&(b=W(b,a.numbers.html.thousandsSeparator,""));"."!==a.numbers.html.decimalMark&&(b=W(b,a.numbers.html.decimalMark,"."));return"number"===typeof b||!1!==jQuery.isNumeric(b)?b:!1}function Ma(b){-1<b.indexOf("%")?(b=na(b.replace(/%/g,"")),!1!==b&&(b/=100)):b=!1;return b}function D(b,c,e,q){var f="",h="text";
  6327. if(null!==b){var n=d(b);n.removeData("teUserDefText");if(n[0].hasAttribute("data-tableexport-canvas"))var l="";else if(n[0].hasAttribute("data-tableexport-value"))l=(l=n.attr("data-tableexport-value"))?l+"":"",n.data("teUserDefText",1);else if(l=n.html(),"function"===typeof a.onCellHtmlData)l=a.onCellHtmlData(n,c,e,l),n.data("teUserDefText",1);else if(""!==l){b=d.parseHTML(l);var g=0,k=0;l="";d.each(b,function(){if(d(this).is("input"))l+=n.find("input").eq(g++).val();else if(d(this).is("select"))l+=
  6328. n.find("select option:selected").eq(k++).text();else if(d(this).is("br"))l+="<br>";else{if("undefined"===typeof d(this).html())l+=d(this).text();else if(void 0===jQuery().bootstrapTable||!1===d(this).hasClass("fht-cell")&&!1===d(this).hasClass("filterControl")&&0===n.parents(".detail-view").length)l+=d(this).html();if(d(this).is("a")){var b=n.find("a").attr("href")||"";f="function"===typeof a.onCellHtmlHyperlink?f+a.onCellHtmlHyperlink(n,c,e,b,l):"href"===a.htmlHyperlink?f+b:f+l;l=""}}})}if(l&&""!==
  6329. l&&!0===a.htmlContent)f=d.trim(l);else if(l&&""!==l)if(""!==n.attr("data-tableexport-cellformat")){var m=l.replace(/\n/g,"\u2028").replace(/(<\s*br([^>]*)>)/gi,"\u2060"),p=d("<div/>").html(m).contents();b=!1;m="";d.each(p.text().split("\u2028"),function(b,c){0<b&&(m+=" ");!0!==a.preserve.leadingWS&&(c=la(c));m+=!0!==a.preserve.trailingWS?ma(c):c});d.each(m.split("\u2060"),function(b,c){0<b&&(f+="\n");!0!==a.preserve.leadingWS&&(c=la(c));!0!==a.preserve.trailingWS&&(c=ma(c));f+=c.replace(/\u00AD/g,
  6330. "")});f=f.replace(/\u00A0/g," ");if("json"===a.type||"excel"===a.type&&"xmlss"===a.mso.fileFormat||!1===a.numbers.output)b=na(f),!1!==b&&(h="number",f=Number(b));else if(a.numbers.html.decimalMark!==a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!==a.numbers.output.thousandsSeparator)if(b=na(f),!1!==b){p=(""+b.substr(0>b?1:0)).split(".");1===p.length&&(p[1]="");var t=3<p[0].length?p[0].length%3:0;h="number";f=(0>b?"-":"")+(a.numbers.output.thousandsSeparator?(t?p[0].substr(0,t)+a.numbers.output.thousandsSeparator:
  6331. "")+p[0].substr(t).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):p[0])+(p[1].length?a.numbers.output.decimalMark+p[1]:"")}}else f=l;!0===a.escape&&(f=escape(f));"function"===typeof a.onCellData&&(f=a.onCellData(n,c,e,f,h),n.data("teUserDefText",1))}void 0!==q&&(q.type=h);return f}function Ba(b){return 0<b.length&&!0===a.preventInjection&&0<="=+-@".indexOf(b.charAt(0))?"'"+b:b}function Na(b,a,e){return a+"-"+e.toLowerCase()}function fa(b,a){(b=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(b))&&
  6332. (a=[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]);return a}function Ca(b){var a=M(b,"text-align"),e=M(b,"font-weight"),d=M(b,"font-style"),f="";"start"===a&&(a="rtl"===M(b,"direction")?"right":"left");700<=e&&(f="bold");"italic"===d&&(f+=d);""===f&&(f="normal");a={style:{align:a,bcolor:fa(M(b,"background-color"),[255,255,255]),color:fa(M(b,"color"),[0,0,0]),fstyle:f},colspan:J(b),rowspan:T(b)};null!==b&&(b=b.getBoundingClientRect(),a.rect={width:b.width,height:b.height});return a}function J(b){var a=
  6333. d(b).attr("data-tableexport-colspan");"undefined"===typeof a&&d(b).is("[colspan]")&&(a=d(b).attr("colspan"));return parseInt(a)||0}function T(b){var a=d(b).attr("data-tableexport-rowspan");"undefined"===typeof a&&d(b).is("[rowspan]")&&(a=d(b).attr("rowspan"));return parseInt(a)||0}function M(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 ha(a,c,e){c=
  6334. M(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/b.offsetWidth;a.removeChild(b);return c*e}return 0}function Oa(a){for(var b=new ArrayBuffer(a.length),e=new Uint8Array(b),d=0;d!==a.length;++d)e[d]=a.charCodeAt(d)&255;return b}function oa(a){var b=a.c,e="";for(++b;b;b=Math.floor((b-1)/26))e=String.fromCharCode((b-1)%26+65)+e;return e+(""+(a.r+1))}function pa(a,
  6335. c){if("undefined"===typeof c||"number"===typeof c)return pa(a.s,a.e);"string"!==typeof a&&(a=oa(a));"string"!==typeof c&&(c=oa(c));return a===c?a:a+":"+c}function Da(a,c){var b=Number(a);if(isFinite(b))return b;var d=1;""!==c.thousandsSeparator&&(a=a.replace(new RegExp("([\\d])"+c.thousandsSeparator+"([\\d])","g"),"$1$2"));"."!==c.decimalMark&&(a=a.replace(new RegExp("([\\d])"+c.decimalMark+"([\\d])","g"),"$1.$2"));a=a.replace(/[$]/g,"").replace(/[%]/g,function(){d*=100;return""});if(isFinite(b=Number(a)))return b/
  6336. d;a=a.replace(/[(](.*)[)]/,function(a,b){d=-d;return b});return isFinite(b=Number(a))?b/d:b}function ya(a){var b=0,d;if(0===a.length)return b;var q=0;for(d=a.length;q<d;q++){var f=a.charCodeAt(q);b=(b<<5)-b+f;b|=0}return b}function N(b,c,d,q,f,h){var e=!0;"function"===typeof a.onBeforeSaveToFile&&(e=a.onBeforeSaveToFile(b,c,d,q,f),"boolean"!==typeof e&&(e=!0));if(e)try{if(Ea=new Blob([b],{type:d+";charset="+q}),saveAs(Ea,c,!1===h),"function"===typeof a.onAfterSaveToFile)a.onAfterSaveToFile(b,c)}catch(l){ka(c,
  6337. "data:"+d+(q.length?";charset="+q:"")+(f.length?";"+f:"")+",",h?"\ufeff"+b:b)}}function ka(b,c,d){var e=window.navigator.userAgent;if(!1!==b&&window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(new Blob([d]),b);else if(!1!==b&&(0<e.indexOf("MSIE ")||e.match(/Trident.*rv\:11\./))){if(c=document.createElement("iframe")){document.body.appendChild(c);c.setAttribute("style","display:none");c.contentDocument.open("txt/plain","replace");c.contentDocument.write(d);c.contentDocument.close();
  6338. c.contentWindow.focus();switch(b.substr(b.lastIndexOf(".")+1)){case "doc":case "json":case "png":case "pdf":case "xls":case "xlsx":b+=".txt"}c.contentDocument.execCommand("SaveAs",!0,b);document.body.removeChild(c)}}else{var f=document.createElement("a");if(f){var h=null;f.style.display="none";!1!==b?f.download=b:f.target="_blank";"object"===typeof d?(window.URL=window.URL||window.webkitURL,e=[],e.push(d),h=window.URL.createObjectURL(new Blob(e,{type:c})),f.href=h):0<=c.toLowerCase().indexOf("base64,")?
  6339. f.href=c+L(d):f.href=c+encodeURIComponent(d);document.body.appendChild(f);if(document.createEvent)null===ia&&(ia=document.createEvent("MouseEvents")),ia.initEvent("click",!0,!1),f.dispatchEvent(ia);else if(document.createEventObject)f.fireEvent("onclick");else if("function"===typeof f.onclick)f.onclick();setTimeout(function(){h&&window.URL.revokeObjectURL(h);document.body.removeChild(f);if("function"===typeof a.onAfterSaveToFile)a.onAfterSaveToFile(d,b)},100)}}}function L(a){var b,d="",q=0;if("string"===
  6340. typeof a){a=a.replace(/\x0d\x0a/g,"\n");var f="";for(b=0;b<a.length;b++){var h=a.charCodeAt(b);128>h?f+=String.fromCharCode(h):(127<h&&2048>h?f+=String.fromCharCode(h>>6|192):(f+=String.fromCharCode(h>>12|224),f+=String.fromCharCode(h>>6&63|128)),f+=String.fromCharCode(h&63|128))}a=f}for(;q<a.length;){var n=a.charCodeAt(q++);f=a.charCodeAt(q++);b=a.charCodeAt(q++);h=n>>2;n=(n&3)<<4|f>>4;var l=(f&15)<<2|b>>6;var g=b&63;isNaN(f)?l=g=64:isNaN(b)&&(g=64);d=d+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)+
  6341. "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(n)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)}return d}var a={csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,date:{html:"dd/mm/yyyy"},displayTableName:!1,escape:!1,exportHiddenCells:!1,fileName:"tableExport",htmlContent:!1,htmlHyperlink:"content",ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",
  6342. unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},onDocCreated:null,autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"inherit",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"inherit",valign:"middle"},alternateRowStyles:{fillColor:245},tableExport:{doc:null,onAfterAutotable:null,onBeforeAutotable:null,onAutotableText:null,onTable:null,outputImages:!0}}},mso:{fileFormat:"xlshtml",
  6343. onMsoNumberFormat:null,pageFormat:"a4",pageOrientation:"portrait",rtl:!1,styles:[],worksheetName:"",xslx:{formatId:{date:14,numbers:2}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onAfterSaveToFile:null,onBeforeSaveToFile:null,onCellData:null,onCellHtmlData:null,onCellHtmlHyperlink:null,onIgnoreRow:null,onTableExportBegin:null,onTableExportEnd:null,outputMode:"file",pdfmake:{enabled:!1,docDefinition:{pageSize:"A4",pageOrientation:"portrait",
  6344. styles:{header:{background:"#34495E",color:"#FFFFFF",bold:!0,alignment:"center",fillColor:"#34495E"},alternateRow:{fillColor:"#f5f5f5"}},defaultStyle:{color:"#000000",fontSize:8,font:"Roboto"}},fonts:{}},preserve:{leadingWS:!1,trailingWS:!1},preventInjection:!0,sql:{tableEnclosure:"`",columnEnclosure:"`"},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"Table",type:"csv"},O={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],a5:[419.53,
  6345. 595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,
  6346. 161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]},B=this,ia=null,r=[],w=[],p=0,t="",S=[],G=[],Ea,K=[],V=!1;d.extend(!0,a,k);"xlsx"===a.type&&(a.mso.fileFormat=a.type,a.type="excel");"undefined"!==typeof a.excelFileFormat&&"undefined"===a.mso.fileFormat&&(a.mso.fileFormat=a.excelFileFormat);"undefined"!==typeof a.excelPageFormat&&"undefined"===a.mso.pageFormat&&
  6347. (a.mso.pageFormat=a.excelPageFormat);"undefined"!==typeof a.excelPageOrientation&&"undefined"===a.mso.pageOrientation&&(a.mso.pageOrientation=a.excelPageOrientation);"undefined"!==typeof a.excelRTL&&"undefined"===a.mso.rtl&&(a.mso.rtl=a.excelRTL);"undefined"!==typeof a.excelstyles&&"undefined"===a.mso.styles&&(a.mso.styles=a.excelstyles);"undefined"!==typeof a.onMsoNumberFormat&&"undefined"===a.mso.onMsoNumberFormat&&(a.mso.onMsoNumberFormat=a.onMsoNumberFormat);"undefined"!==typeof a.worksheetName&&
  6348. "undefined"===a.mso.worksheetName&&(a.mso.worksheetName=a.worksheetName);a.mso.pageOrientation="l"===a.mso.pageOrientation.substr(0,1)?"landscape":"portrait";a.date.html=a.date.html||"";if(a.date.html.length){k=[];k.dd="(3[01]|[12][0-9]|0?[1-9])";k.mm="(1[012]|0?[1-9])";k.yyyy="((?:1[6-9]|2[0-2])\\d{2})";k.yy="(\\d{2})";var z=a.date.html.match(/[^a-zA-Z0-9]/)[0];z=a.date.html.toLowerCase().split(z);a.date.regex="^\\s*";a.date.regex+=k[z[0]];a.date.regex+="(.)";a.date.regex+=k[z[1]];a.date.regex+=
  6349. "\\2";a.date.regex+=k[z[2]];a.date.regex+="\\s*$";a.date.pattern=new RegExp(a.date.regex,"g");k=z.indexOf("dd")+1;a.date.match_d=k+(1<k?1:0);k=z.indexOf("mm")+1;a.date.match_m=k+(1<k?1:0);k=(0<=z.indexOf("yyyy")?z.indexOf("yyyy"):z.indexOf("yy"))+1;a.date.match_y=k+(1<k?1:0)}S=R(B);if("function"===typeof a.onTableExportBegin)a.onTableExportBegin();if("csv"===a.type||"tsv"===a.type||"txt"===a.type){var P="",Z=0;G=[];p=0;var qa=function(b,c,e){b.each(function(){t="";E(this,c,p,e+b.length,function(b,
  6350. c,d){var e=t,f="";if(null!==b)if(b=D(b,c,d),c=null===b||""===b?"":b.toString(),"tsv"===a.type)b instanceof Date&&b.toLocaleString(),f=W(c,"\t"," ");else if(b instanceof Date)f=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else if(f=Ba(c),f=W(f,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=f.indexOf(a.csvSeparator)||/[\r\n ]/g.test(f))f=a.csvEnclosure+f+a.csvEnclosure;t=e+(f+("tsv"===a.type?"\t":a.csvSeparator))});t=d.trim(t).substring(0,t.length-1);0<t.length&&(0<P.length&&(P+="\n"),P+=t);p++});
  6351. return b.length};Z+=qa(d(B).find("thead").first().find(a.theadSelector),"th,td",Z);v(d(B),"tbody").each(function(){Z+=qa(v(d(this),a.tbodySelector),"td,th",Z)});a.tfootSelector.length&&qa(d(B).find("tfoot").first().find(a.tfootSelector),"td,th",Z);P+="\n";if("string"===a.outputMode)return P;if("base64"===a.outputMode)return L(P);if("window"===a.outputMode){ka(!1,"data:text/"+("csv"===a.type?"csv":"plain")+";charset=utf-8,",P);return}N(P,a.fileName+"."+a.type,"text/"+("csv"===a.type?"csv":"plain"),
  6352. "utf-8","","csv"===a.type&&a.csvUseBOM)}else if("sql"===a.type){p=0;G=[];var A="INSERT INTO "+a.sql.tableEnclosure+a.tableName+a.sql.tableEnclosure+" (";r=y(d(B));d(r).each(function(){E(this,"th,td",p,r.length,function(b,c,d){b=D(b,c,d)||"";-1<b.indexOf(a.sql.columnEnclosure)&&(b=W(b.toString(),a.sql.columnEnclosure,a.sql.columnEnclosure+a.sql.columnEnclosure));A+=a.sql.columnEnclosure+b+a.sql.columnEnclosure+","});p++;A=d.trim(A).substring(0,A.length-1)});A+=") VALUES ";w=C(d(B));d(w).each(function(){t=
  6353. "";E(this,"td,th",p,r.length+w.length,function(a,c,d){a=D(a,c,d)||"";-1<a.indexOf("'")&&(a=W(a.toString(),"'","''"));t+="'"+a+"',"});3<t.length&&(A+="("+t,A=d.trim(A).substring(0,A.length-1),A+="),");p++});A=d.trim(A).substring(0,A.length-1);A+=";";if("string"===a.outputMode)return A;if("base64"===a.outputMode)return L(A);N(A,a.fileName+".sql","application/sql","utf-8","",!1)}else if("json"===a.type){var X=[];G=[];r=y(d(B));d(r).each(function(){var a=[];E(this,"th,td",p,r.length,function(b,d,g){a.push(D(b,
  6354. d,g))});X.push(a)});var ra=[];w=C(d(B));d(w).each(function(){var a={},c=0;E(this,"td,th",p,r.length+w.length,function(b,d,f){X.length?a[X[X.length-1][c]]=D(b,d,f):a[c]=D(b,d,f);c++});!1===d.isEmptyObject(a)&&ra.push(a);p++});k="head"===a.jsonScope?JSON.stringify(X):"data"===a.jsonScope?JSON.stringify(ra):JSON.stringify({header:X,data:ra});if("string"===a.outputMode)return k;if("base64"===a.outputMode)return L(k);N(k,a.fileName+".json","application/json","utf-8","base64",!1)}else if("xml"===a.type){p=
  6355. 0;G=[];var Q='<?xml version="1.0" encoding="utf-8"?>';Q+="<tabledata><fields>";r=y(d(B));d(r).each(function(){E(this,"th,td",p,r.length,function(a,d,e){Q+="<field>"+D(a,d,e)+"</field>"});p++});Q+="</fields><data>";var Fa=1;w=C(d(B));d(w).each(function(){var a=1;t="";E(this,"td,th",p,r.length+w.length,function(b,d,g){t+="<column-"+a+">"+D(b,d,g)+"</column-"+a+">";a++});0<t.length&&"<column-1></column-1>"!==t&&(Q+='<row id="'+Fa+'">'+t+"</row>",Fa++);p++});Q+="</data></tabledata>";if("string"===a.outputMode)return Q;
  6356. if("base64"===a.outputMode)return L(Q);N(Q,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===a.type&&"xmlss"===a.mso.fileFormat){var sa=[],F=[];d(B).filter(function(){return I(d(this))}).each(function(){function b(a,b,c){var f=[];d(a).each(function(){var b=0,e=0;t="";E(this,"td,th",p,c+a.length,function(a,c,h){if(null!==a){var l="";c=D(a,c,h);h="String";if(!1!==jQuery.isNumeric(c))h="Number";else{var n=Ma(c);!1!==n&&(c=n,h="Number",l+=' ss:StyleID="pct1"')}"Number"!==h&&(c=
  6357. c.replace(/\n/g,"<br>"));n=J(a);a=T(a);d.each(f,function(){if(p>=this.s.r&&p<=this.e.r&&e>=this.s.c&&e<=this.e.c)for(var a=0;a<=this.e.c-this.s.c;++a)e++,b++});if(a||n)a=a||1,n=n||1,f.push({s:{r:p,c:e},e:{r:p+a-1,c:e+n-1}});1<n&&(l+=' ss:MergeAcross="'+(n-1)+'"',e+=n-1);1<a&&(l+=' ss:MergeDown="'+(a-1)+'" ss:StyleID="rsp1"');0<b&&(l+=' ss:Index="'+(e+1)+'"',b=0);t+="<Cell"+l+'><Data ss:Type="'+h+'">'+d("<div />").text(c).html()+"</Data></Cell>\r";e++}});0<t.length&&(H+='<Row ss:AutoFitHeight="0">\r'+
  6358. t+"</Row>\r");p++});return a.length}var c=d(this),e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?e=a.mso.worksheetName+" "+(F.length+1):"undefined"!==typeof a.mso.worksheetName[F.length]&&(e=a.mso.worksheetName[F.length]);e.length||(e=c.find("caption").text()||"");e.length||(e="Table "+(F.length+1));e=d.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));F.push(d("<div />").text(e).html());!1===a.exportHiddenCells&&(K=c.find("tr, th, td").filter(":hidden"),V=0<K.length);
  6359. p=0;S=R(this);H="<Table>\r";e=b(y(c),"th,td",0);b(C(c),"td,th",e);H+="</Table>\r";sa.push(H)});k={};z={};for(var m,aa,Y=0,ea=F.length;Y<ea;Y++)m=F[Y],aa=k[m],aa=k[m]=null==aa?1:aa+1,2===aa&&(F[z[m]]=F[z[m]].substring(0,29)+"-1"),1<k[m]?F[Y]=F[Y].substring(0,29)+"-"+k[m]:z[m]=Y;k='<?xml version="1.0" encoding="UTF-8"?>\r<?mso-application progid="Excel.Sheet"?>\r<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:o="urn:schemas-microsoft-com:office:office"\r xmlns:x="urn:schemas-microsoft-com:office:excel"\r xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:html="http://www.w3.org/TR/REC-html40">\r<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">\r <Created>'+
  6360. (new Date).toISOString()+'</Created>\r</DocumentProperties>\r<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">\r <AllowPNG/>\r</OfficeDocumentSettings>\r<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">\r <WindowHeight>9000</WindowHeight>\r <WindowWidth>13860</WindowWidth>\r <WindowTopX>0</WindowTopX>\r <WindowTopY>0</WindowTopY>\r <ProtectStructure>False</ProtectStructure>\r <ProtectWindows>False</ProtectWindows>\r</ExcelWorkbook>\r<Styles>\r <Style ss:ID="Default" ss:Name="Normal">\r <Alignment ss:Vertical="Bottom"/>\r <Borders/>\r <Font/>\r <Interior/>\r <NumberFormat/>\r <Protection/>\r </Style>\r <Style ss:ID="rsp1">\r <Alignment ss:Vertical="Center"/>\r </Style>\r <Style ss:ID="pct1">\r <NumberFormat ss:Format="Percent"/>\r </Style>\r</Styles>\r';
  6361. for(z=0;z<sa.length;z++)k+='<Worksheet ss:Name="'+F[z]+'" ss:RightToLeft="'+(a.mso.rtl?"1":"0")+'">\r'+sa[z],k=a.mso.rtl?k+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">\r<DisplayRightToLeft/>\r</WorksheetOptions>\r':k+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"/>\r',k+="</Worksheet>\r";k+="</Workbook>\r";if("string"===a.outputMode)return k;if("base64"===a.outputMode)return L(k);N(k,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===
  6362. a.type&&"xlsx"===a.mso.fileFormat){var ba=[],Ga=XLSX.utils.book_new();d(B).filter(function(){return I(d(this))}).each(function(){for(var b=d(this),c={},e=this.getElementsByTagName("tr"),g={s:{r:0,c:0},e:{r:0,c:0}},f=[],h,n=[],l=0,u=0,k,m,p,t,r,w=XLSX.SSF.get_table();l<e.length&&1E7>u;++l)if(k=e[l],m=!1,"function"===typeof a.onIgnoreRow&&(m=a.onIgnoreRow(d(k),l)),!0!==m&&(0===a.ignoreRow.length||-1===d.inArray(l,a.ignoreRow)&&-1===d.inArray(l-e.length,a.ignoreRow))&&!1!==I(d(k))){var y=k.children,
  6363. B=0;for(k=0;k<y.length;++k)r=y[k],t=+J(r)||1,B+=t;var z=0;for(k=m=0;k<y.length;++k)if(r=y[k],t=+J(r)||1,h=k+z,!ta(d(r),B,h+(h<m?m-h:0))){z+=t-1;for(h=0;h<f.length;++h){var v=f[h];v.s.c==m&&v.s.r<=u&&u<=v.e.r&&(m=v.e.c+1,h=-1)}(0<(p=+T(r))||1<t)&&f.push({s:{r:u,c:m},e:{r:u+(p||1)-1,c:m+t-1}});var C={type:""};h=D(r,l,k+z,C);v={t:"s",v:h};var A="";if(""!==(d(r).attr("data-tableexport-cellformat")||"")){var x=parseInt(d(r).attr("data-tableexport-xlsxformatid")||0);0===x&&"function"===typeof a.mso.xslx.formatId.numbers&&
  6364. (x=a.mso.xslx.formatId.numbers(d(r),l,k+z));0===x&&"function"===typeof a.mso.xslx.formatId.date&&(x=a.mso.xslx.formatId.date(d(r),l,k+z));if(49===x||"@"===x)A="s";else if("number"===C.type||0<x&&14>x||36<x&&41>x||48===x)A="n";else if("date"===C.type||13<x&&37>x||44<x&&48>x||56===x)A="d"}else A="s";if(null!=h)if(0===h.length)v.t="z";else if(0!==h.trim().length)if("s"===A)d(r).find("a").length&&(h="href"!==a.htmlHyperlink?h:"",v={f:'=HYPERLINK("'+d(r).find("a").attr("href")+(h.length?'","'+h:"")+'")'});
  6365. else if("function"===C.type)v={f:h};else if("TRUE"===h)v={t:"b",v:!0};else if("FALSE"===h)v={t:"b",v:!1};else if("n"===A||isFinite(Da(h,a.numbers.output))){if(r=Da(h,a.numbers.output),0===x&&"function"!==typeof a.mso.xslx.formatId.numbers&&(x=a.mso.xslx.formatId.numbers),isFinite(r)||isFinite(h))v={t:"n",v:isFinite(r)?r:h,z:"string"===typeof x?x:x in w?w[x]:"0.00"}}else if(!1!==(r=La(h))||"d"===A)0===x&&"function"!==typeof a.mso.xslx.formatId.date&&(x=a.mso.xslx.formatId.date),v={t:"d",v:!1!==r?r:
  6366. h,z:"string"===typeof x?x:x in w?w[x]:"m/d/yy"};c[oa({c:m,r:u})]=v;g.e.c<m&&(g.e.c=m);m+=t}++u}f.length&&(c["!merges"]=f);n.length&&(c["!rows"]=n);g.e.r=u-1;c["!ref"]=pa(g);1E7<=u&&(c["!fullref"]=pa((g.e.r=e.length-l+u-1,g)));e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?e=a.mso.worksheetName+" "+(ba.length+1):"undefined"!==typeof a.mso.worksheetName[ba.length]&&(e=a.mso.worksheetName[ba.length]);e.length||(e=b.find("caption").text()||"");e.length||(e="Table "+(ba.length+
  6367. 1));e=d.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));ba.push(e);XLSX.utils.book_append_sheet(Ga,c,e)});k=XLSX.write(Ga,{type:"binary",bookType:a.mso.fileFormat,bookSST:!1});N(Oa(k),a.fileName+"."+a.mso.fileFormat,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","UTF-8","",!1)}else if("excel"===a.type||"xls"===a.type||"word"===a.type||"doc"===a.type){k="excel"===a.type||"xls"===a.type?"excel":"word";z="excel"===k?"xls":"doc";m='xmlns:x="urn:schemas-microsoft-com:office:'+
  6368. k+'"';var H="",ca="";d(B).filter(function(){return I(d(this))}).each(function(){var b=d(this);""===ca&&(ca=a.mso.worksheetName||b.find("caption").text()||"Table",ca=d.trim(ca.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31)));!1===a.exportHiddenCells&&(K=b.find("tr, th, td").filter(":hidden"),V=0<K.length);p=0;G=[];S=R(this);H+="<table><thead>";r=y(b);d(r).each(function(){var b=d(this);t="";E(this,"th,td",p,r.length,function(d,c,f){if(null!==d){var e="";t+="<th";if(a.mso.styles.length){var n=document.defaultView.getComputedStyle(d,
  6369. null),l=document.defaultView.getComputedStyle(b[0],null),g;for(g in a.mso.styles){var k=n[a.mso.styles[g]];""===k&&(k=l[a.mso.styles[g]]);""!==k&&"0px none rgb(0, 0, 0)"!==k&&"rgba(0, 0, 0, 0)"!==k&&(e+=""===e?'style="':";",e+=a.mso.styles[g]+":"+k)}}""!==e&&(t+=" "+e+'"');e=J(d);0<e&&(t+=' colspan="'+e+'"');e=T(d);0<e&&(t+=' rowspan="'+e+'"');t+=">"+D(d,c,f)+"</th>"}});0<t.length&&(H+="<tr>"+t+"</tr>");p++});H+="</thead><tbody>";w=C(b);d(w).each(function(){var b=d(this);t="";E(this,"td,th",p,r.length+
  6370. w.length,function(c,g,f){if(null!==c){var e=D(c,g,f),n="",l=d(c).attr("data-tableexport-msonumberformat");"undefined"===typeof l&&"function"===typeof a.mso.onMsoNumberFormat&&(l=a.mso.onMsoNumberFormat(c,g,f));"undefined"!==typeof l&&""!==l&&(n="style=\"mso-number-format:'"+l+"'");if(a.mso.styles.length){g=document.defaultView.getComputedStyle(c,null);f=document.defaultView.getComputedStyle(b[0],null);for(var k in a.mso.styles)l=g[a.mso.styles[k]],""===l&&(l=f[a.mso.styles[k]]),""!==l&&"0px none rgb(0, 0, 0)"!==
  6371. l&&"rgba(0, 0, 0, 0)"!==l&&(n+=""===n?'style="':";",n+=a.mso.styles[k]+":"+l)}t+="<td";""!==n&&(t+=" "+n+'"');n=J(c);0<n&&(t+=' colspan="'+n+'"');c=T(c);0<c&&(t+=' rowspan="'+c+'"');"string"===typeof e&&""!==e&&(e=Ba(e),e=e.replace(/\n/g,"<br>"));t+=">"+e+"</td>"}});0<t.length&&(H+="<tr>"+t+"</tr>");p++});a.displayTableName&&(H+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+D(d("<p>"+a.tableName+"</p>"))+"</td></tr>");H+="</tbody></table>"});m='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+
  6372. m+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta http-equiv="content-type" content="application/vnd.ms-'+k+'; charset=UTF-8">')+"<head>";"excel"===k&&(m+="\x3c!--[if gte mso 9]>",m+="<xml>",m+="<x:ExcelWorkbook>",m+="<x:ExcelWorksheets>",m+="<x:ExcelWorksheet>",m+="<x:Name>",m+=ca,m+="</x:Name>",m+="<x:WorksheetOptions>",m+="<x:DisplayGridlines/>",a.mso.rtl&&(m+="<x:DisplayRightToLeft/>"),m+="</x:WorksheetOptions>",m+="</x:ExcelWorksheet>",m+="</x:ExcelWorksheets>",m+="</x:ExcelWorkbook>",m+=
  6373. "</xml>",m+="<![endif]--\x3e");m+="<style>";m+="@page { size:"+a.mso.pageOrientation+"; mso-page-orientation:"+a.mso.pageOrientation+"; }";m+="@page Section1 {size:"+O[a.mso.pageFormat][0]+"pt "+O[a.mso.pageFormat][1]+"pt";m+="; margin:1.0in 1.25in 1.0in 1.25in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";m+="div.Section1 {page:Section1;}";m+="@page Section2 {size:"+O[a.mso.pageFormat][1]+"pt "+O[a.mso.pageFormat][0]+"pt";m+=";mso-page-orientation:"+a.mso.pageOrientation+";margin:1.25in 1.0in 1.25in 1.0in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";
  6374. m+="div.Section2 {page:Section2;}";m+="br {mso-data-placement:same-cell;}";m+="</style>";m+="</head>";m+="<body>";m+='<div class="Section'+("landscape"===a.mso.pageOrientation?"2":"1")+'">';m+=H;m+="</div>";m+="</body>";m+="</html>";if("string"===a.outputMode)return m;if("base64"===a.outputMode)return L(m);N(m,a.fileName+"."+z,"application/vnd.ms-"+k,"","base64",!1)}else if("png"===a.type)html2canvas(d(B)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),d=new ArrayBuffer(c.length),
  6375. g=new Uint8Array(d),f=0;f<c.length;f++)g[f]=c.charCodeAt(f);if("string"===a.outputMode)return c;if("base64"===a.outputMode)return L(b);"window"===a.outputMode?window.open(b):N(d,a.fileName+".png","image/png","","",!1)});else if("pdf"===a.type)if(!0===a.pdfmake.enabled){var U={content:[]};d.extend(!0,U,a.pdfmake.docDefinition);G=[];d(B).filter(function(){return I(d(this))}).each(function(){var b=d(this),c=[],e=[];p=0;var g=function(a,b,c){var f=0;d(a).each(function(){var a=[];E(this,b,p,c,function(c,
  6376. d,f){if("undefined"!==typeof c&&null!==c){var e=J(c),h=T(c);c={text:D(c,d,f)||" "};if(1<e||1<h)c.colSpan=e||1,c.rowSpan=h||1}else c={text:" "};0<=b.indexOf("th")&&(c.style="header");a.push(c)});for(var d=a.length;d<c;d++)a.push("");a.length&&e.push(a);f<a.length&&(f=a.length);p++});return f};r=y(b);for(var f=g(r,"th,td",r.length),h=c.length;h<f;h++)c.push("*");w=C(b);f=g(w,"td",r.length+w.length);for(h=c.length;h<f;h++)c.push("*");U.content.push({table:{headerRows:r.length?r.length:null,widths:c,
  6377. body:e},layout:{layout:"noBorders",hLineStyle:function(a,b){return 0},vLineWidth:function(a,b){return 0},hLineColor:function(b,c){return b<c.table.headerRows?a.pdfmake.docDefinition.styles.header.background:a.pdfmake.docDefinition.styles.alternateRow.fillColor},vLineColor:function(b,c){return b<c.table.headerRows?a.pdfmake.docDefinition.styles.header.background:a.pdfmake.docDefinition.styles.alternateRow.fillColor},fillColor:function(b,c,d){return 0===b%2?a.pdfmake.docDefinition.styles.alternateRow.fillColor:
  6378. null}},pageBreak:U.content.length?"before":void 0})});"undefined"!==typeof pdfMake&&"undefined"!==typeof pdfMake.createPdf&&(pdfMake.fonts={Roboto:{normal:"Roboto-Regular.ttf",bold:"Roboto-Medium.ttf",italics:"Roboto-Italic.ttf",bolditalics:"Roboto-MediumItalic.ttf"}},pdfMake.vfs.hasOwnProperty("Mirza-Regular.ttf")?(U.defaultStyle.font="Mirza",d.extend(!0,pdfMake.fonts,{Mirza:{normal:"Mirza-Regular.ttf",bold:"Mirza-Bold.ttf",italics:"Mirza-Medium.ttf",bolditalics:"Mirza-SemiBold.ttf"}})):pdfMake.vfs.hasOwnProperty("gbsn00lp.ttf")?
  6379. (U.defaultStyle.font="gbsn00lp",d.extend(!0,pdfMake.fonts,{gbsn00lp:{normal:"gbsn00lp.ttf",bold:"gbsn00lp.ttf",italics:"gbsn00lp.ttf",bolditalics:"gbsn00lp.ttf"}})):pdfMake.vfs.hasOwnProperty("ZCOOLXiaoWei-Regular.ttf")&&(U.defaultStyle.font="ZCOOLXiaoWei",d.extend(!0,pdfMake.fonts,{ZCOOLXiaoWei:{normal:"ZCOOLXiaoWei-Regular.ttf",bold:"ZCOOLXiaoWei-Regular.ttf",italics:"ZCOOLXiaoWei-Regular.ttf",bolditalics:"ZCOOLXiaoWei-Regular.ttf"}})),d.extend(!0,pdfMake.fonts,a.pdfmake.fonts),pdfMake.createPdf(U).getBuffer(function(b){N(b,
  6380. a.fileName+".pdf","application/pdf","","",!1)}))}else if(!1===a.jspdf.autotable){k={dim:{w:ha(d(B).first().get(0),"width","mm"),h:ha(d(B).first().get(0),"height","mm")},pagesplit:!1};var Ha=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);Ha.addHTML(d(B).first(),a.jspdf.margins.left,a.jspdf.margins.top,k,function(){va(Ha,!1)})}else{var g=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&"bestfit"===a.jspdf.format.toLowerCase()){var ja="",da="",Ia=0;d(B).each(function(){if(I(d(this))){var a=
  6381. ha(d(this).get(0),"width","pt");if(a>Ia){a>O.a0[0]&&(ja="a0",da="l");for(var c in O)O.hasOwnProperty(c)&&O[c][1]>a&&(ja=c,da="l",O[c][0]>a&&(da="p"));Ia=a}}});a.jspdf.format=""===ja?"a4":ja;a.jspdf.orientation=""===da?"w":da}if(null==g.doc&&(g.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format),g.wScaleFactor=1,g.hScaleFactor=1,"function"===typeof a.jspdf.onDocCreated))a.jspdf.onDocCreated(g.doc);!0===g.outputImages&&(g.images={});"undefined"!==typeof g.images&&(d(B).filter(function(){return I(d(this))}).each(function(){var b=
  6382. 0;G=[];!1===a.exportHiddenCells&&(K=d(this).find("tr, th, td").filter(":hidden"),V=0<K.length);r=y(d(this));w=C(d(this));d(w).each(function(){E(this,"td,th",r.length+b,r.length+w.length,function(a){xa(a,d(a).children(),g)});b++})}),r=[],w=[]);Ka(g,function(){d(B).filter(function(){return I(d(this))}).each(function(){var b;p=0;G=[];!1===a.exportHiddenCells&&(K=d(this).find("tr, th, td").filter(":hidden"),V=0<K.length);S=R(this);g.columns=[];g.rows=[];g.teCells={};if("function"===typeof g.onTable&&
  6383. !1===g.onTable(d(this),a))return!0;a.jspdf.autotable.tableExport=null;var c=d.extend(!0,{},a.jspdf.autotable);a.jspdf.autotable.tableExport=g;c.margin={};d.extend(!0,c.margin,a.jspdf.margins);c.tableExport=g;"function"!==typeof c.beforePageContent&&(c.beforePageContent=function(a){if(1===a.pageCount){var b=a.table.rows.concat(a.table.headerRow);d.each(b,function(){0<this.height&&(this.height+=(2-1.15)/2*this.styles.fontSize,a.table.height+=(2-1.15)/2*this.styles.fontSize)})}});"function"!==typeof c.createdHeaderCell&&
  6384. (c.createdHeaderCell=function(a,b){a.styles=d.extend({},b.row.styles);if("undefined"!==typeof g.columns[b.column.dataKey]){var e=g.columns[b.column.dataKey];if("undefined"!==typeof e.rect){a.contentWidth=e.rect.width;if("undefined"===typeof g.heightRatio||0===g.heightRatio){var f=b.row.raw[b.column.dataKey].rowspan?b.row.raw[b.column.dataKey].rect.height/b.row.raw[b.column.dataKey].rowspan:b.row.raw[b.column.dataKey].rect.height;g.heightRatio=a.styles.rowHeight/f}f=b.row.raw[b.column.dataKey].rect.height*
  6385. g.heightRatio;f>a.styles.rowHeight&&(a.styles.rowHeight=f)}a.styles.halign="inherit"===c.headerStyles.halign?"center":c.headerStyles.halign;a.styles.valign=c.headerStyles.valign;"undefined"!==typeof e.style&&!0!==e.style.hidden&&("inherit"===c.headerStyles.halign&&(a.styles.halign=e.style.align),"inherit"===c.styles.fillColor&&(a.styles.fillColor=e.style.bcolor),"inherit"===c.styles.textColor&&(a.styles.textColor=e.style.color),"inherit"===c.styles.fontStyle&&(a.styles.fontStyle=e.style.fstyle))}});
  6386. "function"!==typeof c.createdCell&&(c.createdCell=function(a,b){b=g.teCells[b.row.index+":"+b.column.dataKey];a.styles.halign="inherit"===c.styles.halign?"center":c.styles.halign;a.styles.valign=c.styles.valign;"undefined"!==typeof b&&"undefined"!==typeof b.style&&!0!==b.style.hidden&&("inherit"===c.styles.halign&&(a.styles.halign=b.style.align),"inherit"===c.styles.fillColor&&(a.styles.fillColor=b.style.bcolor),"inherit"===c.styles.textColor&&(a.styles.textColor=b.style.color),"inherit"===c.styles.fontStyle&&
  6387. (a.styles.fontStyle=b.style.fstyle))});"function"!==typeof c.drawHeaderCell&&(c.drawHeaderCell=function(a,b){var c=g.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&&0<=c.rowIndex?wa(a,b,c):!1});"function"!==typeof c.drawCell&&(c.drawCell=function(a,b){var c=g.teCells[b.row.index+":"+b.column.dataKey];if(!0!==("undefined"!==typeof c&&c.isCanvas))wa(a,b,c)&&(g.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle),"undefined"===typeof c||"undefined"!==typeof c.hasUserDefText&&
  6388. !0===c.hasUserDefText||"undefined"===typeof c.elements||!c.elements.length?Aa(a,{},g):(b=a.height/c.rect.height,b>g.hScaleFactor&&(g.hScaleFactor=b),g.wScaleFactor=a.width/c.rect.width,b=a.textPos.y,za(a,c.elements,g),a.textPos.y=b,Aa(a,c.elements,g)));else{c=c.elements[0];var e=d(c).attr("data-tableexport-canvas"),f=c.getBoundingClientRect();a.width=f.width*g.wScaleFactor;a.height=f.height*g.hScaleFactor;b.row.height=a.height;ua(a,c,e,g)}return!1});g.headerrows=[];r=y(d(this));d(r).each(function(){b=
  6389. 0;g.headerrows[p]=[];E(this,"th,td",p,r.length,function(a,c,d){var e=Ca(a);e.title=D(a,c,d);e.key=b++;e.rowIndex=p;g.headerrows[p].push(e)});p++});if(0<p)for(var e=p-1;0<=e;)d.each(g.headerrows[e],function(){var a=this;0<e&&null===this.rect&&(a=g.headerrows[e-1][this.key]);null!==a&&0<=a.rowIndex&&(!0!==a.style.hasOwnProperty("hidden")||!0!==a.style.hidden)&&g.columns.push(a)}),e=0<g.columns.length?-1:e-1;var k=0;w=[];w=C(d(this));d(w).each(function(){var a=[];b=0;E(this,"td,th",p,r.length+w.length,
  6390. function(c,e,f){if("undefined"===typeof g.columns[b]){var h={title:"",key:b,style:{hidden:!0}};g.columns.push(h)}a.push(D(c,e,f));"undefined"!==typeof c&&null!==c?(h=Ca(c),h.isCanvas=c.hasAttribute("data-tableexport-canvas"),h.elements=h.isCanvas?d(c):d(c).children(),"undefined"!==typeof d(c).data("teUserDefText")&&(h.hasUserDefText=!0)):(h=d.extend(!0,{},g.teCells[k+":"+(b-1)]),h.colspan=-1);g.teCells[k+":"+b++]=h});a.length&&(g.rows.push(a),k++);p++});if("function"===typeof g.onBeforeAutotable)g.onBeforeAutotable(d(this),
  6391. g.columns,g.rows,c);g.doc.autoTable(g.columns,g.rows,c);if("function"===typeof g.onAfterAutotable)g.onAfterAutotable(d(this),c);a.jspdf.autotable.startY=g.doc.autoTableEndPosY()+c.margin.top});va(g.doc,"undefined"!==typeof g.images&&!1===jQuery.isEmptyObject(g.images));"undefined"!==typeof g.headerrows&&(g.headerrows.length=0);"undefined"!==typeof g.columns&&(g.columns.length=0);"undefined"!==typeof g.rows&&(g.rows.length=0);delete g.doc;g.doc=null})}if("function"===typeof a.onTableExportEnd)a.onTableExportEnd();
  6392. return this}})(jQuery);
  6393. define("tableexport", ["jquery"], (function (global) {
  6394. return function () {
  6395. var ret, fn;
  6396. return ret || global.$.fn.extend;
  6397. };
  6398. }(this)));
  6399. !function(t){"use strict";var o=t.fn.bootstrapTable.utils.sprintf,e={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"};t.extend(t.fn.bootstrapTable.defaults,{showExport:!1,exportDataType:"basic",exportTypes:["json","xml","csv","txt","sql","excel"],exportOptions:{}}),t.extend(t.fn.bootstrapTable.defaults.icons,{export:"glyphicon-export icon-share"}),t.extend(t.fn.bootstrapTable.locales,{formatExport:function(){return"Export data"}}),t.extend(t.fn.bootstrapTable.defaults,t.fn.bootstrapTable.locales);var s=t.fn.bootstrapTable.Constructor,i=s.prototype.initToolbar;s.prototype.initToolbar=function(){if(this.showToolbar=this.options.showExport,i.apply(this,Array.prototype.slice.apply(arguments)),this.options.showExport){var s=this,n=this.$toolbar.find(">.btn-group"),a=n.find("div.export");if(!a.length){var p=(a=t(['<div class="export btn-group">','<button class="btn'+o(" btn-%s",this.options.buttonsClass)+o(" btn-%s",this.options.iconSize)+' dropdown-toggle" aria-label="export type" title="'+this.options.formatExport()+'" data-toggle="dropdown" type="button">',o('<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(n)).find(".dropdown-menu"),l=this.options.exportTypes;if("string"==typeof this.options.exportTypes){var r=this.options.exportTypes.slice(1,-1).replace(/ /g,"").split(",");l=[],t.each(r,function(t,o){l.push(o.slice(1,-1))})}t.each(l,function(t,o){e.hasOwnProperty(o)&&p.append(['<li role="menuitem" data-type="'+o+'">','<a href="javascript:void(0)">',e[o],"</a>","</li>"].join(""))}),p.find("li").click(function(){var o=t(this).data("type"),e=function(){s.$el.tableExport(t.extend({},s.options.exportOptions,{type:o,escape:!1}))};if("all"===s.options.exportDataType&&s.options.pagination)s.$el.one("server"===s.options.sidePagination?"post-body.bs.table":"page-change.bs.table",function(){e(),s.togglePagination()}),s.togglePagination();else if("selected"===s.options.exportDataType){var i=s.getData(),n=s.getAllSelections();if("server"===s.options.sidePagination){(i={total:s.options.totalRows})[s.options.dataField]=s.getData();var a="function"==typeof require?require("table"):null;(n={total:s.options.totalRows})[s.options.dataField]=a&&s.options.maintainSelected?a.api.selecteddata(s.$el):s.getAllSelections()}s.load(n),e(),s.load(i)}else e()})}}}}(jQuery);
  6400. define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (global) {
  6401. return function () {
  6402. var ret, fn;
  6403. return ret || global.$.fn.bootstrapTable.defaults;
  6404. };
  6405. }(this)));
  6406. (function(factory){if(typeof define==="function"&&define.amd){define('dropzone',["jquery"],factory)}else{factory(jQuery)}})(function(jQuery){var module={exports:{}};"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}var Emitter=function(){function Emitter(){_classCallCheck(this,Emitter)}_createClass(Emitter,[{key:"on",value:function on(event,fn){this._callbacks=this._callbacks||{};if(!this._callbacks[event]){this._callbacks[event]=[]}this._callbacks[event].push(fn);return this}},{key:"emit",value:function emit(event){this._callbacks=this._callbacks||{};var callbacks=this._callbacks[event];if(callbacks){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key]}var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=callbacks[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var callback=_step.value;callback.apply(this,args)}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator["return"]!=null){_iterator["return"]()}}finally{if(_didIteratorError){throw _iteratorError}}}}return this}},{key:"off",value:function off(event,fn){if(!this._callbacks||arguments.length===0){this._callbacks={};return this}var callbacks=this._callbacks[event];if(!callbacks){return this}if(arguments.length===1){delete this._callbacks[event];return this}for(var i=0;i<callbacks.length;i++){var callback=callbacks[i];if(callback===fn){callbacks.splice(i,1);break}}return this}}]);return Emitter}();var Dropzone=function(_Emitter){_inherits(Dropzone,_Emitter);_createClass(Dropzone,null,[{key:"initClass",value:function initClass(){this.prototype.Emitter=Emitter;this.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"];this.prototype.defaultOptions={url:null,method:"post",withCredentials:false,timeout:3e4,parallelUploads:2,uploadMultiple:false,chunking:false,forceChunking:false,chunkSize:2e6,parallelChunkUploads:false,retryChunks:false,retryChunksLimit:3,maxFilesize:256,paramName:"file",createImageThumbnails:true,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,thumbnailMethod:"crop",resizeWidth:null,resizeHeight:null,resizeMimeType:null,resizeQuality:.8,resizeMethod:"contain",filesizeBase:1e3,maxFiles:null,headers:null,clickable:true,ignoreHiddenFiles:true,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:true,autoQueue:true,addRemoveLinks:false,previewsContainer:null,hiddenInputContainer:"body",capture:null,renameFilename:null,renameFile:null,forceFallback:false,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictUploadCanceled:"Upload canceled.",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",dictFileSizeUnits:{tb:"TB",gb:"GB",mb:"MB",kb:"KB",b:"b"},init:function init(){},params:function params(files,xhr,chunk){if(chunk){return{dzuuid:chunk.file.upload.uuid,dzchunkindex:chunk.index,dztotalfilesize:chunk.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:chunk.file.upload.totalChunkCount,dzchunkbyteoffset:chunk.index*this.options.chunkSize}}},accept:function accept(file,done){return done()},chunkSuccess:function(chunk,file,response){},chunksUploaded:function chunksUploaded(file,done){done()},fallback:function fallback(){var messageElement;this.element.className="".concat(this.element.className," dz-browser-not-supported");var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator2=this.element.getElementsByTagName("div")[Symbol.iterator](),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){var child=_step2.value;if(/(^| )dz-message($| )/.test(child.className)){messageElement=child;child.className="dz-message";break}}}catch(err){_didIteratorError2=true;_iteratorError2=err}finally{try{if(!_iteratorNormalCompletion2&&_iterator2["return"]!=null){_iterator2["return"]()}}finally{if(_didIteratorError2){throw _iteratorError2}}}if(!messageElement){messageElement=Dropzone.createElement('<div class="dz-message"><span></span></div>');this.element.appendChild(messageElement)}var span=messageElement.getElementsByTagName("span")[0];if(span){if(span.textContent!=null){span.textContent=this.options.dictFallbackMessage}else if(span.innerText!=null){span.innerText=this.options.dictFallbackMessage}}return this.element.appendChild(this.getFallbackForm())},resize:function resize(file,width,height,resizeMethod){var info={srcX:0,srcY:0,srcWidth:file.width,srcHeight:file.height};var srcRatio=file.width/file.height;if(width==null&&height==null){width=info.srcWidth;height=info.srcHeight}else if(width==null){width=height*srcRatio}else if(height==null){height=width/srcRatio}width=Math.min(width,info.srcWidth);height=Math.min(height,info.srcHeight);var trgRatio=width/height;if(info.srcWidth>width||info.srcHeight>height){if(resizeMethod==="crop"){if(srcRatio>trgRatio){info.srcHeight=file.height;info.srcWidth=info.srcHeight*trgRatio}else{info.srcWidth=file.width;info.srcHeight=info.srcWidth/trgRatio}}else if(resizeMethod==="contain"){if(srcRatio>trgRatio){height=width/srcRatio}else{width=height*srcRatio}}else{throw new Error("Unknown resizeMethod '".concat(resizeMethod,"'"))}}info.srcX=(file.width-info.srcWidth)/2;info.srcY=(file.height-info.srcHeight)/2;info.trgWidth=width;info.trgHeight=height;return info},transformFile:function transformFile(file,done){if((this.options.resizeWidth||this.options.resizeHeight)&&file.type.match(/image.*/)){return this.resizeImage(file,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,done)}else{return done(file)}},previewTemplate:'<div class="dz-preview dz-file-preview">\n <div class="dz-image"><img data-dz-thumbnail /></div>\n <div class="dz-details">\n <div class="dz-size"><span data-dz-size></span></div>\n <div class="dz-filename"><span data-dz-name></span></div>\n </div>\n <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>\n <div class="dz-error-message"><span data-dz-errormessage></span></div>\n <div class="dz-success-mark">\n <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>Check</title>\n <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <path d="M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" stroke-opacity="0.198794158" stroke="#747474" fill-opacity="0.816519475" fill="#FFFFFF"></path>\n </g>\n </svg>\n </div>\n <div class="dz-error-mark">\n <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>Error</title>\n <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g stroke="#747474" stroke-opacity="0.198794158" fill="#FFFFFF" fill-opacity="0.816519475">\n <path d="M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z"></path>\n </g>\n </g>\n </svg>\n </div>\n</div>',drop:function drop(e){return this.element.classList.remove("dz-drag-hover")},dragstart:function dragstart(e){},dragend:function dragend(e){return this.element.classList.remove("dz-drag-hover")},dragenter:function dragenter(e){return this.element.classList.add("dz-drag-hover")},dragover:function dragover(e){return this.element.classList.add("dz-drag-hover")},dragleave:function dragleave(e){return this.element.classList.remove("dz-drag-hover")},paste:function paste(e){},reset:function reset(){return this.element.classList.remove("dz-started")},addedfile:function addedfile(file){var _this2=this;if(this.element===this.previewsContainer){this.element.classList.add("dz-started")}if(this.previewsContainer){file.previewElement=Dropzone.createElement(this.options.previewTemplate.trim());file.previewTemplate=file.previewElement;this.previewsContainer.appendChild(file.previewElement);var _iteratorNormalCompletion3=true;var _didIteratorError3=false;var _iteratorError3=undefined;try{for(var _iterator3=file.previewElement.querySelectorAll("[data-dz-name]")[Symbol.iterator](),_step3;!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=true){var node=_step3.value;node.textContent=file.name}}catch(err){_didIteratorError3=true;_iteratorError3=err}finally{try{if(!_iteratorNormalCompletion3&&_iterator3["return"]!=null){_iterator3["return"]()}}finally{if(_didIteratorError3){throw _iteratorError3}}}var _iteratorNormalCompletion4=true;var _didIteratorError4=false;var _iteratorError4=undefined;try{for(var _iterator4=file.previewElement.querySelectorAll("[data-dz-size]")[Symbol.iterator](),_step4;!(_iteratorNormalCompletion4=(_step4=_iterator4.next()).done);_iteratorNormalCompletion4=true){node=_step4.value;node.innerHTML=this.filesize(file.size)}}catch(err){_didIteratorError4=true;_iteratorError4=err}finally{try{if(!_iteratorNormalCompletion4&&_iterator4["return"]!=null){_iterator4["return"]()}}finally{if(_didIteratorError4){throw _iteratorError4}}}if(this.options.addRemoveLinks){file._removeLink=Dropzone.createElement('<a class="dz-remove" href="javascript:undefined;" data-dz-remove>'.concat(this.options.dictRemoveFile,"</a>"));file.previewElement.appendChild(file._removeLink)}var removeFileEvent=function removeFileEvent(e){e.preventDefault();e.stopPropagation();if(file.status===Dropzone.UPLOADING){return Dropzone.confirm(_this2.options.dictCancelUploadConfirmation,function(){return _this2.removeFile(file)})}else{if(_this2.options.dictRemoveFileConfirmation){return Dropzone.confirm(_this2.options.dictRemoveFileConfirmation,function(){return _this2.removeFile(file)})}else{return _this2.removeFile(file)}}};var _iteratorNormalCompletion5=true;var _didIteratorError5=false;var _iteratorError5=undefined;try{for(var _iterator5=file.previewElement.querySelectorAll("[data-dz-remove]")[Symbol.iterator](),_step5;!(_iteratorNormalCompletion5=(_step5=_iterator5.next()).done);_iteratorNormalCompletion5=true){var removeLink=_step5.value;removeLink.addEventListener("click",removeFileEvent)}}catch(err){_didIteratorError5=true;_iteratorError5=err}finally{try{if(!_iteratorNormalCompletion5&&_iterator5["return"]!=null){_iterator5["return"]()}}finally{if(_didIteratorError5){throw _iteratorError5}}}}},removedfile:function removedfile(file){if(file.previewElement!=null&&file.previewElement.parentNode!=null){file.previewElement.parentNode.removeChild(file.previewElement)}return this._updateMaxFilesReachedClass()},thumbnail:function thumbnail(file,dataUrl){if(file.previewElement){file.previewElement.classList.remove("dz-file-preview");var _iteratorNormalCompletion6=true;var _didIteratorError6=false;var _iteratorError6=undefined;try{for(var _iterator6=file.previewElement.querySelectorAll("[data-dz-thumbnail]")[Symbol.iterator](),_step6;!(_iteratorNormalCompletion6=(_step6=_iterator6.next()).done);_iteratorNormalCompletion6=true){var thumbnailElement=_step6.value;thumbnailElement.alt=file.name;thumbnailElement.src=dataUrl}}catch(err){_didIteratorError6=true;_iteratorError6=err}finally{try{if(!_iteratorNormalCompletion6&&_iterator6["return"]!=null){_iterator6["return"]()}}finally{if(_didIteratorError6){throw _iteratorError6}}}return setTimeout(function(){return file.previewElement.classList.add("dz-image-preview")},1)}},error:function error(file,message){if(file.previewElement){file.previewElement.classList.add("dz-error");if(typeof message!=="String"&&message.error){message=message.error}var _iteratorNormalCompletion7=true;var _didIteratorError7=false;var _iteratorError7=undefined;try{for(var _iterator7=file.previewElement.querySelectorAll("[data-dz-errormessage]")[Symbol.iterator](),_step7;!(_iteratorNormalCompletion7=(_step7=_iterator7.next()).done);_iteratorNormalCompletion7=true){var node=_step7.value;node.textContent=message}}catch(err){_didIteratorError7=true;_iteratorError7=err}finally{try{if(!_iteratorNormalCompletion7&&_iterator7["return"]!=null){_iterator7["return"]()}}finally{if(_didIteratorError7){throw _iteratorError7}}}}},errormultiple:function errormultiple(){},processing:function processing(file){if(file.previewElement){file.previewElement.classList.add("dz-processing");if(file._removeLink){return file._removeLink.innerHTML=this.options.dictCancelUpload}}},processingmultiple:function processingmultiple(){},uploadprogress:function uploadprogress(file,progress,bytesSent){if(file.previewElement){var _iteratorNormalCompletion8=true;var _didIteratorError8=false;var _iteratorError8=undefined;try{for(var _iterator8=file.previewElement.querySelectorAll("[data-dz-uploadprogress]")[Symbol.iterator](),_step8;!(_iteratorNormalCompletion8=(_step8=_iterator8.next()).done);_iteratorNormalCompletion8=true){var node=_step8.value;node.nodeName==="PROGRESS"?node.value=progress:node.style.width="".concat(progress,"%")}}catch(err){_didIteratorError8=true;_iteratorError8=err}finally{try{if(!_iteratorNormalCompletion8&&_iterator8["return"]!=null){_iterator8["return"]()}}finally{if(_didIteratorError8){throw _iteratorError8}}}}},totaluploadprogress:function totaluploadprogress(){},sending:function sending(){},sendingmultiple:function sendingmultiple(){},success:function success(file){if(file.previewElement){return file.previewElement.classList.add("dz-success")}},successmultiple:function successmultiple(){},canceled:function canceled(file){return this.emit("error",file,this.options.dictUploadCanceled)},canceledmultiple:function canceledmultiple(){},complete:function complete(file){if(file._removeLink){file._removeLink.innerHTML=this.options.dictRemoveFile}if(file.previewElement){return file.previewElement.classList.add("dz-complete")}},completemultiple:function completemultiple(){},maxfilesexceeded:function maxfilesexceeded(){},maxfilesreached:function maxfilesreached(){},queuecomplete:function queuecomplete(){},addedfiles:function addedfiles(){}};this.prototype._thumbnailQueue=[];this.prototype._processingThumbnail=false}},{key:"extend",value:function extend(target){for(var _len2=arguments.length,objects=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){objects[_key2-1]=arguments[_key2]}for(var _i=0,_objects=objects;_i<_objects.length;_i++){var object=_objects[_i];for(var key in object){var val=object[key];target[key]=val}}return target}}]);function Dropzone(el,options){var _this;_classCallCheck(this,Dropzone);_this=_possibleConstructorReturn(this,_getPrototypeOf(Dropzone).call(this));var fallback,left;_this.element=el;_this.version=Dropzone.version;_this.defaultOptions.previewTemplate=_this.defaultOptions.previewTemplate.replace(/\n*/g,"");_this.clickableElements=[];_this.listeners=[];_this.files=[];if(typeof _this.element==="string"){_this.element=document.querySelector(_this.element)}if(!_this.element||_this.element.nodeType==null){throw new Error("Invalid dropzone element.")}if(_this.element.dropzone){throw new Error("Dropzone already attached.")}Dropzone.instances.push(_assertThisInitialized(_this));_this.element.dropzone=_assertThisInitialized(_this);var elementOptions=(left=Dropzone.optionsForElement(_this.element))!=null?left:{};_this.options=Dropzone.extend({},_this.defaultOptions,elementOptions,options!=null?options:{});if(_this.options.forceFallback||!Dropzone.isBrowserSupported()){return _possibleConstructorReturn(_this,_this.options.fallback.call(_assertThisInitialized(_this)))}if(_this.options.url==null){_this.options.url=_this.element.getAttribute("action")}if(!_this.options.url){throw new Error("No URL provided.")}if(_this.options.acceptedFiles&&_this.options.acceptedMimeTypes){throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.")}if(_this.options.uploadMultiple&&_this.options.chunking){throw new Error("You cannot set both: uploadMultiple and chunking.")}if(_this.options.acceptedMimeTypes){_this.options.acceptedFiles=_this.options.acceptedMimeTypes;delete _this.options.acceptedMimeTypes}if(_this.options.renameFilename!=null){_this.options.renameFile=function(file){return _this.options.renameFilename.call(_assertThisInitialized(_this),file.name,file)}}_this.options.method=typeof _this.options.method!=="function"?_this.options.method.toUpperCase():_this.options.method;if((fallback=_this.getExistingFallback())&&fallback.parentNode){fallback.parentNode.removeChild(fallback)}if(_this.options.previewsContainer!==false){if(_this.options.previewsContainer){_this.previewsContainer=Dropzone.getElement(_this.options.previewsContainer,"previewsContainer")}else{_this.previewsContainer=_this.element}}if(_this.options.clickable){if(_this.options.clickable===true){_this.clickableElements=[_this.element]}else{_this.clickableElements=Dropzone.getElements(_this.options.clickable,"clickable")}}_this.init();return _this}_createClass(Dropzone,[{key:"getAcceptedFiles",value:function getAcceptedFiles(){return this.files.filter(function(file){return file.accepted}).map(function(file){return file})}},{key:"getRejectedFiles",value:function getRejectedFiles(){return this.files.filter(function(file){return!file.accepted}).map(function(file){return file})}},{key:"getFilesWithStatus",value:function getFilesWithStatus(status){return this.files.filter(function(file){return file.status===status}).map(function(file){return file})}},{key:"getQueuedFiles",value:function getQueuedFiles(){return this.getFilesWithStatus(Dropzone.QUEUED)}},{key:"getUploadingFiles",value:function getUploadingFiles(){return this.getFilesWithStatus(Dropzone.UPLOADING)}},{key:"getAddedFiles",value:function getAddedFiles(){return this.getFilesWithStatus(Dropzone.ADDED)}},{key:"getActiveFiles",value:function getActiveFiles(){return this.files.filter(function(file){return file.status===Dropzone.UPLOADING||file.status===Dropzone.QUEUED}).map(function(file){return file})}},{key:"init",value:function init(){var _this3=this;if(this.element.tagName==="form"){this.element.setAttribute("enctype","multipart/form-data")}if(this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")){this.element.appendChild(Dropzone.createElement('<div class="dz-default dz-message"><button class="dz-button" type="button">'.concat(this.options.dictDefaultMessage,"</button></div>")))}if(this.clickableElements.length){var setupHiddenFileInput=function setupHiddenFileInput(){if(_this3.hiddenFileInput){_this3.hiddenFileInput.parentNode.removeChild(_this3.hiddenFileInput)}_this3.hiddenFileInput=document.createElement("input");_this3.hiddenFileInput.setAttribute("type","file");if(_this3.options.maxFiles===null||_this3.options.maxFiles>1){_this3.hiddenFileInput.setAttribute("multiple","multiple")}_this3.hiddenFileInput.className="dz-hidden-input";if(_this3.options.acceptedFiles!==null){_this3.hiddenFileInput.setAttribute("accept",_this3.options.acceptedFiles)}if(_this3.options.capture!==null){_this3.hiddenFileInput.setAttribute("capture",_this3.options.capture)}_this3.hiddenFileInput.style.visibility="hidden";_this3.hiddenFileInput.style.position="absolute";_this3.hiddenFileInput.style.top="0";_this3.hiddenFileInput.style.left="0";_this3.hiddenFileInput.style.height="0";_this3.hiddenFileInput.style.width="0";Dropzone.getElement(_this3.options.hiddenInputContainer,"hiddenInputContainer").appendChild(_this3.hiddenFileInput);return _this3.hiddenFileInput.addEventListener("change",function(){var files=_this3.hiddenFileInput.files;if(files.length){var _iteratorNormalCompletion9=true;var _didIteratorError9=false;var _iteratorError9=undefined;try{for(var _iterator9=files[Symbol.iterator](),_step9;!(_iteratorNormalCompletion9=(_step9=_iterator9.next()).done);_iteratorNormalCompletion9=true){var file=_step9.value;_this3.addFile(file)}}catch(err){_didIteratorError9=true;_iteratorError9=err}finally{try{if(!_iteratorNormalCompletion9&&_iterator9["return"]!=null){_iterator9["return"]()}}finally{if(_didIteratorError9){throw _iteratorError9}}}}_this3.emit("addedfiles",files);return setupHiddenFileInput()})};setupHiddenFileInput()}this.URL=window.URL!==null?window.URL:window.webkitURL;var _iteratorNormalCompletion10=true;var _didIteratorError10=false;var _iteratorError10=undefined;try{for(var _iterator10=this.events[Symbol.iterator](),_step10;!(_iteratorNormalCompletion10=(_step10=_iterator10.next()).done);_iteratorNormalCompletion10=true){var eventName=_step10.value;this.on(eventName,this.options[eventName])}}catch(err){_didIteratorError10=true;_iteratorError10=err}finally{try{if(!_iteratorNormalCompletion10&&_iterator10["return"]!=null){_iterator10["return"]()}}finally{if(_didIteratorError10){throw _iteratorError10}}}this.on("uploadprogress",function(){return _this3.updateTotalUploadProgress()});this.on("removedfile",function(){return _this3.updateTotalUploadProgress()});this.on("canceled",function(file){return _this3.emit("complete",file)});this.on("complete",function(file){if(_this3.getAddedFiles().length===0&&_this3.getUploadingFiles().length===0&&_this3.getQueuedFiles().length===0){return setTimeout(function(){return _this3.emit("queuecomplete")},0)}});var containsFiles=function containsFiles(e){return e.dataTransfer.types&&e.dataTransfer.types.some(function(type){return type=="Files"})};var noPropagation=function noPropagation(e){if(!containsFiles(e))return;e.stopPropagation();if(e.preventDefault){return e.preventDefault()}else{return e.returnValue=false}};this.listeners=[{element:this.element,events:{dragstart:function dragstart(e){return _this3.emit("dragstart",e)},dragenter:function dragenter(e){noPropagation(e);return _this3.emit("dragenter",e)},dragover:function dragover(e){var efct;try{efct=e.dataTransfer.effectAllowed}catch(error){}e.dataTransfer.dropEffect="move"===efct||"linkMove"===efct?"move":"copy";noPropagation(e);return _this3.emit("dragover",e)},dragleave:function dragleave(e){return _this3.emit("dragleave",e)},drop:function drop(e){noPropagation(e);return _this3.drop(e)},dragend:function dragend(e){return _this3.emit("dragend",e)}}}];this.clickableElements.forEach(function(clickableElement){return _this3.listeners.push({element:clickableElement,events:{click:function click(evt){if(clickableElement!==_this3.element||evt.target===_this3.element||Dropzone.elementInside(evt.target,_this3.element.querySelector(".dz-message"))){_this3.hiddenFileInput.click()}return true}}})});this.enable();return this.options.init.call(this)}},{key:"destroy",value:function destroy(){this.disable();this.removeAllFiles(true);if(this.hiddenFileInput!=null?this.hiddenFileInput.parentNode:undefined){this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);this.hiddenFileInput=null}delete this.element.dropzone;return Dropzone.instances.splice(Dropzone.instances.indexOf(this),1)}},{key:"updateTotalUploadProgress",value:function updateTotalUploadProgress(){var totalUploadProgress;var totalBytesSent=0;var totalBytes=0;var activeFiles=this.getActiveFiles();if(activeFiles.length){var _iteratorNormalCompletion11=true;var _didIteratorError11=false;var _iteratorError11=undefined;try{for(var _iterator11=this.getActiveFiles()[Symbol.iterator](),_step11;!(_iteratorNormalCompletion11=(_step11=_iterator11.next()).done);_iteratorNormalCompletion11=true){var file=_step11.value;totalBytesSent+=file.upload.bytesSent;totalBytes+=file.upload.total}}catch(err){_didIteratorError11=true;_iteratorError11=err}finally{try{if(!_iteratorNormalCompletion11&&_iterator11["return"]!=null){_iterator11["return"]()}}finally{if(_didIteratorError11){throw _iteratorError11}}}totalUploadProgress=100*totalBytesSent/totalBytes}else{totalUploadProgress=100}return this.emit("totaluploadprogress",totalUploadProgress,totalBytes,totalBytesSent)}},{key:"_getParamName",value:function _getParamName(n){if(typeof this.options.paramName==="function"){return this.options.paramName(n)}else{return"".concat(this.options.paramName).concat(this.options.uploadMultiple?"[".concat(n,"]"):"")}}},{key:"_renameFile",value:function _renameFile(file){if(typeof this.options.renameFile!=="function"){return file.name}return this.options.renameFile(file)}},{key:"getFallbackForm",value:function getFallbackForm(){var existingFallback,form;if(existingFallback=this.getExistingFallback()){return existingFallback}var fieldsString='<div class="dz-fallback">';if(this.options.dictFallbackText){fieldsString+="<p>".concat(this.options.dictFallbackText,"</p>")}fieldsString+='<input type="file" name="'.concat(this._getParamName(0),'" ').concat(this.options.uploadMultiple?'multiple="multiple"':undefined,' /><input type="submit" value="Upload!"></div>');var fields=Dropzone.createElement(fieldsString);if(this.element.tagName!=="FORM"){form=Dropzone.createElement('<form action="'.concat(this.options.url,'" enctype="multipart/form-data" method="').concat(this.options.method,'"></form>'));form.appendChild(fields)}else{this.element.setAttribute("enctype","multipart/form-data");this.element.setAttribute("method",this.options.method)}return form!=null?form:fields}},{key:"getExistingFallback",value:function getExistingFallback(){var getFallback=function getFallback(elements){var _iteratorNormalCompletion12=true;var _didIteratorError12=false;var _iteratorError12=undefined;try{for(var _iterator12=elements[Symbol.iterator](),_step12;!(_iteratorNormalCompletion12=(_step12=_iterator12.next()).done);_iteratorNormalCompletion12=true){var el=_step12.value;if(/(^| )fallback($| )/.test(el.className)){return el}}}catch(err){_didIteratorError12=true;_iteratorError12=err}finally{try{if(!_iteratorNormalCompletion12&&_iterator12["return"]!=null){_iterator12["return"]()}}finally{if(_didIteratorError12){throw _iteratorError12}}}};for(var _i2=0,_arr=["div","form"];_i2<_arr.length;_i2++){var tagName=_arr[_i2];var fallback;if(fallback=getFallback(this.element.getElementsByTagName(tagName))){return fallback}}}},{key:"setupEventListeners",value:function setupEventListeners(){return this.listeners.map(function(elementListeners){return function(){var result=[];for(var event in elementListeners.events){var listener=elementListeners.events[event];result.push(elementListeners.element.addEventListener(event,listener,false))}return result}()})}},{key:"removeEventListeners",value:function removeEventListeners(){return this.listeners.map(function(elementListeners){return function(){var result=[];for(var event in elementListeners.events){var listener=elementListeners.events[event];result.push(elementListeners.element.removeEventListener(event,listener,false))}return result}()})}},{key:"disable",value:function disable(){var _this4=this;this.clickableElements.forEach(function(element){return element.classList.remove("dz-clickable")});this.removeEventListeners();this.disabled=true;return this.files.map(function(file){return _this4.cancelUpload(file)})}},{key:"enable",value:function enable(){delete this.disabled;this.clickableElements.forEach(function(element){return element.classList.add("dz-clickable")});return this.setupEventListeners()}},{key:"filesize",value:function filesize(size){var selectedSize=0;var selectedUnit="b";if(size>0){var units=["tb","gb","mb","kb","b"];for(var i=0;i<units.length;i++){var unit=units[i];var cutoff=Math.pow(this.options.filesizeBase,4-i)/10;if(size>=cutoff){selectedSize=size/Math.pow(this.options.filesizeBase,4-i);selectedUnit=unit;break}}selectedSize=Math.round(10*selectedSize)/10}return"<strong>".concat(selectedSize,"</strong> ").concat(this.options.dictFileSizeUnits[selectedUnit])}},{key:"_updateMaxFilesReachedClass",value:function _updateMaxFilesReachedClass(){if(this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles){if(this.getAcceptedFiles().length===this.options.maxFiles){this.emit("maxfilesreached",this.files)}return this.element.classList.add("dz-max-files-reached")}else{return this.element.classList.remove("dz-max-files-reached")}}},{key:"drop",value:function drop(e){if(!e.dataTransfer){return}this.emit("drop",e);var files=[];for(var i=0;i<e.dataTransfer.files.length;i++){files[i]=e.dataTransfer.files[i]}if(files.length){var items=e.dataTransfer.items;if(items&&items.length&&items[0].webkitGetAsEntry!=null){this._addFilesFromItems(items)}else{this.handleFiles(files)}}this.emit("addedfiles",files)}},{key:"paste",value:function paste(e){if(__guard__(e!=null?e.clipboardData:undefined,function(x){return x.items})==null){return}this.emit("paste",e);var items=e.clipboardData.items;if(items.length){return this._addFilesFromItems(items)}}},{key:"handleFiles",value:function handleFiles(files){var _iteratorNormalCompletion13=true;var _didIteratorError13=false;var _iteratorError13=undefined;try{for(var _iterator13=files[Symbol.iterator](),_step13;!(_iteratorNormalCompletion13=(_step13=_iterator13.next()).done);_iteratorNormalCompletion13=true){var file=_step13.value;this.addFile(file)}}catch(err){_didIteratorError13=true;_iteratorError13=err}finally{try{if(!_iteratorNormalCompletion13&&_iterator13["return"]!=null){_iterator13["return"]()}}finally{if(_didIteratorError13){throw _iteratorError13}}}}},{key:"_addFilesFromItems",value:function _addFilesFromItems(items){var _this5=this;return function(){var result=[];var _iteratorNormalCompletion14=true;var _didIteratorError14=false;var _iteratorError14=undefined;try{for(var _iterator14=items[Symbol.iterator](),_step14;!(_iteratorNormalCompletion14=(_step14=_iterator14.next()).done);_iteratorNormalCompletion14=true){var item=_step14.value;var entry;if(item.webkitGetAsEntry!=null&&(entry=item.webkitGetAsEntry())){if(entry.isFile){result.push(_this5.addFile(item.getAsFile()))}else if(entry.isDirectory){result.push(_this5._addFilesFromDirectory(entry,entry.name))}else{result.push(undefined)}}else if(item.getAsFile!=null){if(item.kind==null||item.kind==="file"){result.push(_this5.addFile(item.getAsFile()))}else{result.push(undefined)}}else{result.push(undefined)}}}catch(err){_didIteratorError14=true;_iteratorError14=err}finally{try{if(!_iteratorNormalCompletion14&&_iterator14["return"]!=null){_iterator14["return"]()}}finally{if(_didIteratorError14){throw _iteratorError14}}}return result}()}},{key:"_addFilesFromDirectory",value:function _addFilesFromDirectory(directory,path){var _this6=this;var dirReader=directory.createReader();var errorHandler=function errorHandler(error){return __guardMethod__(console,"log",function(o){return o.log(error)})};var readEntries=function readEntries(){return dirReader.readEntries(function(entries){if(entries.length>0){var _iteratorNormalCompletion15=true;var _didIteratorError15=false;var _iteratorError15=undefined;try{for(var _iterator15=entries[Symbol.iterator](),_step15;!(_iteratorNormalCompletion15=(_step15=_iterator15.next()).done);_iteratorNormalCompletion15=true){var entry=_step15.value;if(entry.isFile){entry.file(function(file){if(_this6.options.ignoreHiddenFiles&&file.name.substring(0,1)==="."){return}file.fullPath="".concat(path,"/").concat(file.name);return _this6.addFile(file)})}else if(entry.isDirectory){_this6._addFilesFromDirectory(entry,"".concat(path,"/").concat(entry.name))}}}catch(err){_didIteratorError15=true;_iteratorError15=err}finally{try{if(!_iteratorNormalCompletion15&&_iterator15["return"]!=null){_iterator15["return"]()}}finally{if(_didIteratorError15){throw _iteratorError15}}}readEntries()}return null},errorHandler)};return readEntries()}},{key:"accept",value:function accept(file,done){if(this.options.maxFilesize&&file.size>this.options.maxFilesize*1024*1024){done(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(file.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize))}else if(!Dropzone.isValidFile(file,this.options.acceptedFiles)){done(this.options.dictInvalidFileType)}else if(this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles){done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles));this.emit("maxfilesexceeded",file)}else{this.options.accept.call(this,file,done)}}},{key:"addFile",value:function addFile(file){var _this7=this;file.upload={uuid:Dropzone.uuidv4(),progress:0,total:file.size,bytesSent:0,filename:this._renameFile(file)};this.files.push(file);file.status=Dropzone.ADDED;this.emit("addedfile",file);this._enqueueThumbnail(file);this.accept(file,function(error){if(error){file.accepted=false;_this7._errorProcessing([file],error)}else{file.accepted=true;if(_this7.options.autoQueue){_this7.enqueueFile(file)}}_this7._updateMaxFilesReachedClass()})}},{key:"enqueueFiles",value:function enqueueFiles(files){var _iteratorNormalCompletion16=true;var _didIteratorError16=false;var _iteratorError16=undefined;try{for(var _iterator16=files[Symbol.iterator](),_step16;!(_iteratorNormalCompletion16=(_step16=_iterator16.next()).done);_iteratorNormalCompletion16=true){var file=_step16.value;this.enqueueFile(file)}}catch(err){_didIteratorError16=true;_iteratorError16=err}finally{try{if(!_iteratorNormalCompletion16&&_iterator16["return"]!=null){_iterator16["return"]()}}finally{if(_didIteratorError16){throw _iteratorError16}}}return null}},{key:"enqueueFile",value:function enqueueFile(file){var _this8=this;if(file.status===Dropzone.ADDED&&file.accepted===true){file.status=Dropzone.QUEUED;if(this.options.autoProcessQueue){return setTimeout(function(){return _this8.processQueue()},0)}}else{throw new Error("This file can't be queued because it has already been processed or was rejected.")}}},{key:"_enqueueThumbnail",value:function _enqueueThumbnail(file){var _this9=this;if(this.options.createImageThumbnails&&file.type.match(/image.*/)&&file.size<=this.options.maxThumbnailFilesize*1024*1024){this._thumbnailQueue.push(file);return setTimeout(function(){return _this9._processThumbnailQueue()},0)}}},{key:"_processThumbnailQueue",value:function _processThumbnailQueue(){var _this10=this;if(this._processingThumbnail||this._thumbnailQueue.length===0){return}this._processingThumbnail=true;var file=this._thumbnailQueue.shift();return this.createThumbnail(file,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,true,function(dataUrl){_this10.emit("thumbnail",file,dataUrl);_this10._processingThumbnail=false;return _this10._processThumbnailQueue()})}},{key:"removeFile",value:function removeFile(file){if(file.status===Dropzone.UPLOADING){this.cancelUpload(file)}this.files=without(this.files,file);this.emit("removedfile",file);if(this.files.length===0){return this.emit("reset")}}},{key:"removeAllFiles",value:function removeAllFiles(cancelIfNecessary){if(cancelIfNecessary==null){cancelIfNecessary=false}var _iteratorNormalCompletion17=true;var _didIteratorError17=false;var _iteratorError17=undefined;try{for(var _iterator17=this.files.slice()[Symbol.iterator](),_step17;!(_iteratorNormalCompletion17=(_step17=_iterator17.next()).done);_iteratorNormalCompletion17=true){var file=_step17.value;if(file.status!==Dropzone.UPLOADING||cancelIfNecessary){this.removeFile(file)}}}catch(err){_didIteratorError17=true;_iteratorError17=err}finally{try{if(!_iteratorNormalCompletion17&&_iterator17["return"]!=null){_iterator17["return"]()}}finally{if(_didIteratorError17){throw _iteratorError17}}}return null}},{key:"resizeImage",value:function resizeImage(file,width,height,resizeMethod,callback){var _this11=this;return this.createThumbnail(file,width,height,resizeMethod,true,function(dataUrl,canvas){if(canvas==null){return callback(file)}else{var resizeMimeType=_this11.options.resizeMimeType;if(resizeMimeType==null){resizeMimeType=file.type}var resizedDataURL=canvas.toDataURL(resizeMimeType,_this11.options.resizeQuality);if(resizeMimeType==="image/jpeg"||resizeMimeType==="image/jpg"){resizedDataURL=ExifRestore.restore(file.dataURL,resizedDataURL)}return callback(Dropzone.dataURItoBlob(resizedDataURL))}})}},{key:"createThumbnail",value:function createThumbnail(file,width,height,resizeMethod,fixOrientation,callback){var _this12=this;var fileReader=new FileReader;fileReader.onload=function(){file.dataURL=fileReader.result;if(file.type==="image/svg+xml"){if(callback!=null){callback(fileReader.result)}return}_this12.createThumbnailFromUrl(file,width,height,resizeMethod,fixOrientation,callback)};fileReader.readAsDataURL(file)}},{key:"displayExistingFile",value:function displayExistingFile(mockFile,imageUrl,callback,crossOrigin){var _this13=this;var resizeThumbnail=arguments.length>4&&arguments[4]!==undefined?arguments[4]:true;this.emit("addedfile",mockFile);this.emit("complete",mockFile);if(!resizeThumbnail){this.emit("thumbnail",mockFile,imageUrl);if(callback)callback()}else{var onDone=function onDone(thumbnail){_this13.emit("thumbnail",mockFile,thumbnail);if(callback)callback()};mockFile.dataURL=imageUrl;this.createThumbnailFromUrl(mockFile,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.resizeMethod,this.options.fixOrientation,onDone,crossOrigin)}}},{key:"createThumbnailFromUrl",value:function createThumbnailFromUrl(file,width,height,resizeMethod,fixOrientation,callback,crossOrigin){var _this14=this;var img=document.createElement("img");if(crossOrigin){img.crossOrigin=crossOrigin}img.onload=function(){var loadExif=function loadExif(callback){return callback(1)};if(typeof EXIF!=="undefined"&&EXIF!==null&&fixOrientation){loadExif=function loadExif(callback){return EXIF.getData(img,function(){return callback(EXIF.getTag(this,"Orientation"))})}}return loadExif(function(orientation){file.width=img.width;file.height=img.height;var resizeInfo=_this14.options.resize.call(_this14,file,width,height,resizeMethod);var canvas=document.createElement("canvas");var ctx=canvas.getContext("2d");canvas.width=resizeInfo.trgWidth;canvas.height=resizeInfo.trgHeight;if(orientation>4){canvas.width=resizeInfo.trgHeight;canvas.height=resizeInfo.trgWidth}switch(orientation){case 2:ctx.translate(canvas.width,0);ctx.scale(-1,1);break;case 3:ctx.translate(canvas.width,canvas.height);ctx.rotate(Math.PI);break;case 4:ctx.translate(0,canvas.height);ctx.scale(1,-1);break;case 5:ctx.rotate(.5*Math.PI);ctx.scale(1,-1);break;case 6:ctx.rotate(.5*Math.PI);ctx.translate(0,-canvas.width);break;case 7:ctx.rotate(.5*Math.PI);ctx.translate(canvas.height,-canvas.width);ctx.scale(-1,1);break;case 8:ctx.rotate(-.5*Math.PI);ctx.translate(-canvas.height,0);break}drawImageIOSFix(ctx,img,resizeInfo.srcX!=null?resizeInfo.srcX:0,resizeInfo.srcY!=null?resizeInfo.srcY:0,resizeInfo.srcWidth,resizeInfo.srcHeight,resizeInfo.trgX!=null?resizeInfo.trgX:0,resizeInfo.trgY!=null?resizeInfo.trgY:0,resizeInfo.trgWidth,resizeInfo.trgHeight);var thumbnail=canvas.toDataURL("image/png");if(callback!=null){return callback(thumbnail,canvas)}})};if(callback!=null){img.onerror=callback}return img.src=file.dataURL}},{key:"processQueue",value:function processQueue(){var parallelUploads=this.options.parallelUploads;var processingLength=this.getUploadingFiles().length;var i=processingLength;if(processingLength>=parallelUploads){return}var queuedFiles=this.getQueuedFiles();if(!(queuedFiles.length>0)){return}if(this.options.uploadMultiple){return this.processFiles(queuedFiles.slice(0,parallelUploads-processingLength))}else{while(i<parallelUploads){if(!queuedFiles.length){return}this.processFile(queuedFiles.shift());i++}}}},{key:"processFile",value:function processFile(file){return this.processFiles([file])}},{key:"processFiles",value:function processFiles(files){var _iteratorNormalCompletion18=true;var _didIteratorError18=false;var _iteratorError18=undefined;try{for(var _iterator18=files[Symbol.iterator](),_step18;!(_iteratorNormalCompletion18=(_step18=_iterator18.next()).done);_iteratorNormalCompletion18=true){var file=_step18.value;file.processing=true;file.status=Dropzone.UPLOADING;this.emit("processing",file)}}catch(err){_didIteratorError18=true;_iteratorError18=err}finally{try{if(!_iteratorNormalCompletion18&&_iterator18["return"]!=null){_iterator18["return"]()}}finally{if(_didIteratorError18){throw _iteratorError18}}}if(this.options.uploadMultiple){this.emit("processingmultiple",files)}return this.uploadFiles(files)}},{key:"_getFilesWithXhr",value:function _getFilesWithXhr(xhr){var files;return files=this.files.filter(function(file){return file.xhr===xhr}).map(function(file){return file})}},{key:"cancelUpload",value:function cancelUpload(file){if(file.status===Dropzone.UPLOADING){var groupedFiles=this._getFilesWithXhr(file.xhr);var _iteratorNormalCompletion19=true;var _didIteratorError19=false;var _iteratorError19=undefined;try{for(var _iterator19=groupedFiles[Symbol.iterator](),_step19;!(_iteratorNormalCompletion19=(_step19=_iterator19.next()).done);_iteratorNormalCompletion19=true){var groupedFile=_step19.value;groupedFile.status=Dropzone.CANCELED}}catch(err){_didIteratorError19=true;_iteratorError19=err}finally{try{if(!_iteratorNormalCompletion19&&_iterator19["return"]!=null){_iterator19["return"]()}}finally{if(_didIteratorError19){throw _iteratorError19}}}if(typeof file.xhr!=="undefined"){file.xhr.abort()}var _iteratorNormalCompletion20=true;var _didIteratorError20=false;var _iteratorError20=undefined;try{for(var _iterator20=groupedFiles[Symbol.iterator](),_step20;!(_iteratorNormalCompletion20=(_step20=_iterator20.next()).done);_iteratorNormalCompletion20=true){var _groupedFile=_step20.value;this.emit("canceled",_groupedFile)}}catch(err){_didIteratorError20=true;_iteratorError20=err}finally{try{if(!_iteratorNormalCompletion20&&_iterator20["return"]!=null){_iterator20["return"]()}}finally{if(_didIteratorError20){throw _iteratorError20}}}if(this.options.uploadMultiple){this.emit("canceledmultiple",groupedFiles)}}else if(file.status===Dropzone.ADDED||file.status===Dropzone.QUEUED){file.status=Dropzone.CANCELED;this.emit("canceled",file);if(this.options.uploadMultiple){this.emit("canceledmultiple",[file])}}if(this.options.autoProcessQueue){return this.processQueue()}}},{key:"resolveOption",value:function resolveOption(option){if(typeof option==="function"){for(var _len3=arguments.length,args=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){args[_key3-1]=arguments[_key3]}return option.apply(this,args)}return option}},{key:"uploadFile",value:function uploadFile(file){return this.uploadFiles([file])}},{key:"uploadFiles",value:function uploadFiles(files){var _this15=this;this._transformFiles(files,function(transformedFiles){if(_this15.options.chunking){var transformedFile=transformedFiles[0];files[0].upload.chunked=_this15.options.chunking&&(_this15.options.forceChunking||transformedFile.size>_this15.options.chunkSize);files[0].upload.totalChunkCount=Math.ceil(transformedFile.size/_this15.options.chunkSize)}if(files[0].upload.chunked){var file=files[0];var _transformedFile=transformedFiles[0];var startedChunkCount=0;file.upload.chunks=[];var handleNextChunk=function handleNextChunk(){var chunkIndex=0;while(file.upload.chunks[chunkIndex]!==undefined){chunkIndex++}if(chunkIndex>=file.upload.totalChunkCount)return;startedChunkCount++;var start=chunkIndex*_this15.options.chunkSize;var end=Math.min(start+_this15.options.chunkSize,file.size);var dataBlock={name:_this15._getParamName(0),data:_transformedFile.webkitSlice?_transformedFile.webkitSlice(start,end):_transformedFile.slice(start,end),filename:file.upload.filename,chunkIndex:chunkIndex};file.upload.chunks[chunkIndex]={file:file,index:chunkIndex,dataBlock:dataBlock,status:Dropzone.UPLOADING,progress:0,retries:0};_this15._uploadData(files,[dataBlock])};file.upload.finishedChunkUpload=function(chunk,response){var allFinished=true;chunk.status=Dropzone.SUCCESS;_this15.options.chunkSuccess.call(_this15,chunk,file,response);chunk.dataBlock=null;chunk.xhr=null;for(var i=0;i<file.upload.totalChunkCount;i++){if(file.upload.chunks[i]===undefined){return handleNextChunk()}if(file.upload.chunks[i].status!==Dropzone.SUCCESS){allFinished=false}}if(allFinished){_this15.options.chunksUploaded.call(_this15,file,function(response){_this15._finished(files,response||"",null)})}};if(_this15.options.parallelChunkUploads){for(var i=0;i<file.upload.totalChunkCount;i++){handleNextChunk()}}else{handleNextChunk()}}else{var dataBlocks=[];for(var _i3=0;_i3<files.length;_i3++){dataBlocks[_i3]={name:_this15._getParamName(_i3),data:transformedFiles[_i3],filename:files[_i3].upload.filename}}_this15._uploadData(files,dataBlocks)}})}},{key:"_getChunk",value:function _getChunk(file,xhr){for(var i=0;i<file.upload.totalChunkCount;i++){if(file.upload.chunks[i]!==undefined&&file.upload.chunks[i].xhr===xhr){return file.upload.chunks[i]}}}},{key:"_uploadData",value:function _uploadData(files,dataBlocks){var _this16=this;var xhr=new XMLHttpRequest;var _iteratorNormalCompletion21=true;var _didIteratorError21=false;var _iteratorError21=undefined;try{for(var _iterator21=files[Symbol.iterator](),_step21;!(_iteratorNormalCompletion21=(_step21=_iterator21.next()).done);_iteratorNormalCompletion21=true){var file=_step21.value;file.xhr=xhr}}catch(err){_didIteratorError21=true;_iteratorError21=err}finally{try{if(!_iteratorNormalCompletion21&&_iterator21["return"]!=null){_iterator21["return"]()}}finally{if(_didIteratorError21){throw _iteratorError21}}}if(files[0].upload.chunked){files[0].upload.chunks[dataBlocks[0].chunkIndex].xhr=xhr}var method=this.resolveOption(this.options.method,files);var url=this.resolveOption(this.options.url,files);xhr.open(method,url,true);xhr.timeout=this.resolveOption(this.options.timeout,files);xhr.withCredentials=!!this.options.withCredentials;xhr.onload=function(e){_this16._finishedUploading(files,xhr,e)};xhr.ontimeout=function(){_this16._handleUploadError(files,xhr,"Request timedout after ".concat(_this16.options.timeout," seconds"))};xhr.onerror=function(){_this16._handleUploadError(files,xhr)};var progressObj=xhr.upload!=null?xhr.upload:xhr;progressObj.onprogress=function(e){return _this16._updateFilesUploadProgress(files,xhr,e)};var headers={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};if(this.options.headers){Dropzone.extend(headers,this.options.headers)}for(var headerName in headers){var headerValue=headers[headerName];if(headerValue){xhr.setRequestHeader(headerName,headerValue)}}var formData=new FormData;if(this.options.params){var additionalParams=this.options.params;if(typeof additionalParams==="function"){additionalParams=additionalParams.call(this,files,xhr,files[0].upload.chunked?this._getChunk(files[0],xhr):null)}for(var key in additionalParams){var value=additionalParams[key];formData.append(key,value)}}var _iteratorNormalCompletion22=true;var _didIteratorError22=false;var _iteratorError22=undefined;try{for(var _iterator22=files[Symbol.iterator](),_step22;!(_iteratorNormalCompletion22=(_step22=_iterator22.next()).done);_iteratorNormalCompletion22=true){var _file=_step22.value;this.emit("sending",_file,xhr,formData)}}catch(err){_didIteratorError22=true;_iteratorError22=err}finally{try{if(!_iteratorNormalCompletion22&&_iterator22["return"]!=null){_iterator22["return"]()}}finally{if(_didIteratorError22){throw _iteratorError22}}}if(this.options.uploadMultiple){this.emit("sendingmultiple",files,xhr,formData)}this._addFormElementData(formData);for(var i=0;i<dataBlocks.length;i++){var dataBlock=dataBlocks[i];formData.append(dataBlock.name,dataBlock.data,dataBlock.filename)}this.submitRequest(xhr,formData,files)}},{key:"_transformFiles",value:function _transformFiles(files,done){var _this17=this;var transformedFiles=[];var doneCounter=0;var _loop=function _loop(i){_this17.options.transformFile.call(_this17,files[i],function(transformedFile){transformedFiles[i]=transformedFile;if(++doneCounter===files.length){done(transformedFiles)}})};for(var i=0;i<files.length;i++){_loop(i)}}},{key:"_addFormElementData",value:function _addFormElementData(formData){if(this.element.tagName==="FORM"){var _iteratorNormalCompletion23=true;var _didIteratorError23=false;var _iteratorError23=undefined;try{for(var _iterator23=this.element.querySelectorAll("input, textarea, select, button")[Symbol.iterator](),_step23;!(_iteratorNormalCompletion23=(_step23=_iterator23.next()).done);_iteratorNormalCompletion23=true){var input=_step23.value;var inputName=input.getAttribute("name");var inputType=input.getAttribute("type");if(inputType)inputType=inputType.toLowerCase();if(typeof inputName==="undefined"||inputName===null)continue;if(input.tagName==="SELECT"&&input.hasAttribute("multiple")){var _iteratorNormalCompletion24=true;var _didIteratorError24=false;var _iteratorError24=undefined;try{for(var _iterator24=input.options[Symbol.iterator](),_step24;!(_iteratorNormalCompletion24=(_step24=_iterator24.next()).done);_iteratorNormalCompletion24=true){var option=_step24.value;if(option.selected){formData.append(inputName,option.value)}}}catch(err){_didIteratorError24=true;_iteratorError24=err}finally{try{if(!_iteratorNormalCompletion24&&_iterator24["return"]!=null){_iterator24["return"]()}}finally{if(_didIteratorError24){throw _iteratorError24}}}}else if(!inputType||inputType!=="checkbox"&&inputType!=="radio"||input.checked){formData.append(inputName,input.value)}}}catch(err){_didIteratorError23=true;_iteratorError23=err}finally{try{if(!_iteratorNormalCompletion23&&_iterator23["return"]!=null){_iterator23["return"]()}}finally{if(_didIteratorError23){throw _iteratorError23}}}}}},{key:"_updateFilesUploadProgress",value:function _updateFilesUploadProgress(files,xhr,e){var progress;if(typeof e!=="undefined"){progress=100*e.loaded/e.total;if(files[0].upload.chunked){var file=files[0];var chunk=this._getChunk(file,xhr);chunk.progress=progress;chunk.total=e.total;chunk.bytesSent=e.loaded;var fileProgress=0,fileTotal,fileBytesSent;file.upload.progress=0;file.upload.total=0;file.upload.bytesSent=0;for(var i=0;i<file.upload.totalChunkCount;i++){if(file.upload.chunks[i]!==undefined&&file.upload.chunks[i].progress!==undefined){file.upload.progress+=file.upload.chunks[i].progress;file.upload.total+=file.upload.chunks[i].total;file.upload.bytesSent+=file.upload.chunks[i].bytesSent}}file.upload.progress=file.upload.progress/file.upload.totalChunkCount}else{var _iteratorNormalCompletion25=true;var _didIteratorError25=false;var _iteratorError25=undefined;try{for(var _iterator25=files[Symbol.iterator](),_step25;!(_iteratorNormalCompletion25=(_step25=_iterator25.next()).done);_iteratorNormalCompletion25=true){var _file2=_step25.value;_file2.upload.progress=progress;_file2.upload.total=e.total;_file2.upload.bytesSent=e.loaded}}catch(err){_didIteratorError25=true;_iteratorError25=err}finally{try{if(!_iteratorNormalCompletion25&&_iterator25["return"]!=null){_iterator25["return"]()}}finally{if(_didIteratorError25){throw _iteratorError25}}}}var _iteratorNormalCompletion26=true;var _didIteratorError26=false;var _iteratorError26=undefined;try{for(var _iterator26=files[Symbol.iterator](),_step26;!(_iteratorNormalCompletion26=(_step26=_iterator26.next()).done);_iteratorNormalCompletion26=true){var _file3=_step26.value;this.emit("uploadprogress",_file3,_file3.upload.progress,_file3.upload.bytesSent)}}catch(err){_didIteratorError26=true;_iteratorError26=err}finally{try{if(!_iteratorNormalCompletion26&&_iterator26["return"]!=null){_iterator26["return"]()}}finally{if(_didIteratorError26){throw _iteratorError26}}}}else{var allFilesFinished=true;progress=100;var _iteratorNormalCompletion27=true;var _didIteratorError27=false;var _iteratorError27=undefined;try{for(var _iterator27=files[Symbol.iterator](),_step27;!(_iteratorNormalCompletion27=(_step27=_iterator27.next()).done);_iteratorNormalCompletion27=true){var _file4=_step27.value;if(_file4.upload.progress!==100||_file4.upload.bytesSent!==_file4.upload.total){allFilesFinished=false}_file4.upload.progress=progress;_file4.upload.bytesSent=_file4.upload.total}}catch(err){_didIteratorError27=true;_iteratorError27=err}finally{try{if(!_iteratorNormalCompletion27&&_iterator27["return"]!=null){_iterator27["return"]()}}finally{if(_didIteratorError27){throw _iteratorError27}}}if(allFilesFinished){return}var _iteratorNormalCompletion28=true;var _didIteratorError28=false;var _iteratorError28=undefined;try{for(var _iterator28=files[Symbol.iterator](),_step28;!(_iteratorNormalCompletion28=(_step28=_iterator28.next()).done);_iteratorNormalCompletion28=true){var _file5=_step28.value;this.emit("uploadprogress",_file5,progress,_file5.upload.bytesSent)}}catch(err){_didIteratorError28=true;_iteratorError28=err}finally{try{if(!_iteratorNormalCompletion28&&_iterator28["return"]!=null){_iterator28["return"]()}}finally{if(_didIteratorError28){throw _iteratorError28}}}}}},{key:"_finishedUploading",value:function _finishedUploading(files,xhr,e){var response;if(files[0].status===Dropzone.CANCELED){return}if(xhr.readyState!==4){return}if(xhr.responseType!=="arraybuffer"&&xhr.responseType!=="blob"){response=xhr.responseText;if(xhr.getResponseHeader("content-type")&&~xhr.getResponseHeader("content-type").indexOf("application/json")){try{response=JSON.parse(response)}catch(error){e=error;response="Invalid JSON response from server."}}}this._updateFilesUploadProgress(files);if(!(200<=xhr.status&&xhr.status<300)){this._handleUploadError(files,xhr,response)}else{if(files[0].upload.chunked){files[0].upload.finishedChunkUpload(this._getChunk(files[0],xhr),response)}else{this._finished(files,response,e)}}}},{key:"_handleUploadError",value:function _handleUploadError(files,xhr,response){if(files[0].status===Dropzone.CANCELED){return}if(files[0].upload.chunked&&this.options.retryChunks){var chunk=this._getChunk(files[0],xhr);if(chunk.retries++<this.options.retryChunksLimit){this._uploadData(files,[chunk.dataBlock]);return}else{console.warn("Retried this chunk too often. Giving up.")}}this._errorProcessing(files,response||this.options.dictResponseError.replace("{{statusCode}}",xhr.status),xhr)}},{key:"submitRequest",value:function submitRequest(xhr,formData,files){xhr.send(formData)}},{key:"_finished",value:function _finished(files,responseText,e){var _iteratorNormalCompletion29=true;var _didIteratorError29=false;var _iteratorError29=undefined;try{for(var _iterator29=files[Symbol.iterator](),_step29;!(_iteratorNormalCompletion29=(_step29=_iterator29.next()).done);_iteratorNormalCompletion29=true){var file=_step29.value;file.status=Dropzone.SUCCESS;this.emit("success",file,responseText,e);this.emit("complete",file)}}catch(err){_didIteratorError29=true;_iteratorError29=err}finally{try{if(!_iteratorNormalCompletion29&&_iterator29["return"]!=null){_iterator29["return"]()}}finally{if(_didIteratorError29){throw _iteratorError29}}}if(this.options.uploadMultiple){this.emit("successmultiple",files,responseText,e);this.emit("completemultiple",files)}if(this.options.autoProcessQueue){return this.processQueue()}}},{key:"_errorProcessing",value:function _errorProcessing(files,message,xhr){var _iteratorNormalCompletion30=true;var _didIteratorError30=false;var _iteratorError30=undefined;try{for(var _iterator30=files[Symbol.iterator](),_step30;!(_iteratorNormalCompletion30=(_step30=_iterator30.next()).done);_iteratorNormalCompletion30=true){var file=_step30.value;file.status=Dropzone.ERROR;this.emit("error",file,message,xhr);this.emit("complete",file)}}catch(err){_didIteratorError30=true;_iteratorError30=err}finally{try{if(!_iteratorNormalCompletion30&&_iterator30["return"]!=null){_iterator30["return"]()}}finally{if(_didIteratorError30){throw _iteratorError30}}}if(this.options.uploadMultiple){this.emit("errormultiple",files,message,xhr);this.emit("completemultiple",files)}if(this.options.autoProcessQueue){return this.processQueue()}}}],[{key:"uuidv4",value:function uuidv4(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c==="x"?r:r&3|8;return v.toString(16)})}}]);return Dropzone}(Emitter);Dropzone.initClass();Dropzone.version="5.7.0";Dropzone.options={};Dropzone.optionsForElement=function(element){if(element.getAttribute("id")){return Dropzone.options[camelize(element.getAttribute("id"))]}else{return undefined}};Dropzone.instances=[];Dropzone.forElement=function(element){if(typeof element==="string"){element=document.querySelector(element)}if((element!=null?element.dropzone:undefined)==null){throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.")}return element.dropzone};Dropzone.autoDiscover=true;Dropzone.discover=function(){var dropzones;if(document.querySelectorAll){dropzones=document.querySelectorAll(".dropzone")}else{dropzones=[];var checkElements=function checkElements(elements){return function(){var result=[];var _iteratorNormalCompletion31=true;var _didIteratorError31=false;var _iteratorError31=undefined;try{for(var _iterator31=elements[Symbol.iterator](),_step31;!(_iteratorNormalCompletion31=(_step31=_iterator31.next()).done);_iteratorNormalCompletion31=true){var el=_step31.value;if(/(^| )dropzone($| )/.test(el.className)){result.push(dropzones.push(el))}else{result.push(undefined)}}}catch(err){_didIteratorError31=true;_iteratorError31=err}finally{try{if(!_iteratorNormalCompletion31&&_iterator31["return"]!=null){_iterator31["return"]()}}finally{if(_didIteratorError31){throw _iteratorError31}}}return result}()};checkElements(document.getElementsByTagName("div"));checkElements(document.getElementsByTagName("form"))}return function(){var result=[];var _iteratorNormalCompletion32=true;var _didIteratorError32=false;var _iteratorError32=undefined;try{for(var _iterator32=dropzones[Symbol.iterator](),_step32;!(_iteratorNormalCompletion32=(_step32=_iterator32.next()).done);_iteratorNormalCompletion32=true){var dropzone=_step32.value;if(Dropzone.optionsForElement(dropzone)!==false){result.push(new Dropzone(dropzone))}else{result.push(undefined)}}}catch(err){_didIteratorError32=true;_iteratorError32=err}finally{try{if(!_iteratorNormalCompletion32&&_iterator32["return"]!=null){_iterator32["return"]()}}finally{if(_didIteratorError32){throw _iteratorError32}}}return result}()};Dropzone.blacklistedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i];Dropzone.isBrowserSupported=function(){var capableBrowser=true;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector){if(!("classList"in document.createElement("a"))){capableBrowser=false}else{var _iteratorNormalCompletion33=true;var _didIteratorError33=false;var _iteratorError33=undefined;try{for(var _iterator33=Dropzone.blacklistedBrowsers[Symbol.iterator](),_step33;!(_iteratorNormalCompletion33=(_step33=_iterator33.next()).done);_iteratorNormalCompletion33=true){var regex=_step33.value;if(regex.test(navigator.userAgent)){capableBrowser=false;continue}}}catch(err){_didIteratorError33=true;_iteratorError33=err}finally{try{if(!_iteratorNormalCompletion33&&_iterator33["return"]!=null){_iterator33["return"]()}}finally{if(_didIteratorError33){throw _iteratorError33}}}}}else{capableBrowser=false}return capableBrowser};Dropzone.dataURItoBlob=function(dataURI){var byteString=atob(dataURI.split(",")[1]);var mimeString=dataURI.split(",")[0].split(":")[1].split(";")[0];var ab=new ArrayBuffer(byteString.length);var ia=new Uint8Array(ab);for(var i=0,end=byteString.length,asc=0<=end;asc?i<=end:i>=end;asc?i++:i--){ia[i]=byteString.charCodeAt(i)}return new Blob([ab],{type:mimeString})};var without=function without(list,rejectedItem){return list.filter(function(item){return item!==rejectedItem}).map(function(item){return item})};var camelize=function camelize(str){return str.replace(/[\-_](\w)/g,function(match){return match.charAt(1).toUpperCase()})};Dropzone.createElement=function(string){var div=document.createElement("div");div.innerHTML=string;return div.childNodes[0]};Dropzone.elementInside=function(element,container){if(element===container){return true}while(element=element.parentNode){if(element===container){return true}}return false};Dropzone.getElement=function(el,name){var element;if(typeof el==="string"){element=document.querySelector(el)}else if(el.nodeType!=null){element=el}if(element==null){throw new Error("Invalid `".concat(name,"` option provided. Please provide a CSS selector or a plain HTML element."))}return element};Dropzone.getElements=function(els,name){var el,elements;if(els instanceof Array){elements=[];try{var _iteratorNormalCompletion34=true;var _didIteratorError34=false;var _iteratorError34=undefined;try{for(var _iterator34=els[Symbol.iterator](),_step34;!(_iteratorNormalCompletion34=(_step34=_iterator34.next()).done);_iteratorNormalCompletion34=true){el=_step34.value;elements.push(this.getElement(el,name))}}catch(err){_didIteratorError34=true;_iteratorError34=err}finally{try{if(!_iteratorNormalCompletion34&&_iterator34["return"]!=null){_iterator34["return"]()}}finally{if(_didIteratorError34){throw _iteratorError34}}}}catch(e){elements=null}}else if(typeof els==="string"){elements=[];var _iteratorNormalCompletion35=true;var _didIteratorError35=false;var _iteratorError35=undefined;try{for(var _iterator35=document.querySelectorAll(els)[Symbol.iterator](),_step35;!(_iteratorNormalCompletion35=(_step35=_iterator35.next()).done);_iteratorNormalCompletion35=true){el=_step35.value;elements.push(el)}}catch(err){_didIteratorError35=true;_iteratorError35=err}finally{try{if(!_iteratorNormalCompletion35&&_iterator35["return"]!=null){_iterator35["return"]()}}finally{if(_didIteratorError35){throw _iteratorError35}}}}else if(els.nodeType!=null){elements=[els]}if(elements==null||!elements.length){throw new Error("Invalid `".concat(name,"` option provided. Please provide a CSS selector, a plain HTML element or a list of those."))}return elements};Dropzone.confirm=function(question,accepted,rejected){if(window.confirm(question)){return accepted()}else if(rejected!=null){return rejected()}};Dropzone.isValidFile=function(file,acceptedFiles){if(!acceptedFiles){return true}acceptedFiles=acceptedFiles.split(",");var mimeType=file.type;var baseMimeType=mimeType.replace(/\/.*$/,"");var _iteratorNormalCompletion36=true;var _didIteratorError36=false;var _iteratorError36=undefined;try{for(var _iterator36=acceptedFiles[Symbol.iterator](),_step36;!(_iteratorNormalCompletion36=(_step36=_iterator36.next()).done);_iteratorNormalCompletion36=true){var validType=_step36.value;validType=validType.trim();if(validType.charAt(0)==="."){if(file.name.toLowerCase().indexOf(validType.toLowerCase(),file.name.length-validType.length)!==-1){return true}}else if(/\/\*$/.test(validType)){if(baseMimeType===validType.replace(/\/.*$/,"")){return true}}else{if(mimeType===validType){return true}}}}catch(err){_didIteratorError36=true;_iteratorError36=err}finally{try{if(!_iteratorNormalCompletion36&&_iterator36["return"]!=null){_iterator36["return"]()}}finally{if(_didIteratorError36){throw _iteratorError36}}}return false};if(typeof jQuery!=="undefined"&&jQuery!==null){jQuery.fn.dropzone=function(options){return this.each(function(){return new Dropzone(this,options)})}}if(typeof module!=="undefined"&&module!==null){module.exports=Dropzone}else{window.Dropzone=Dropzone}Dropzone.ADDED="added";Dropzone.QUEUED="queued";Dropzone.ACCEPTED=Dropzone.QUEUED;Dropzone.UPLOADING="uploading";Dropzone.PROCESSING=Dropzone.UPLOADING;Dropzone.CANCELED="canceled";Dropzone.ERROR="error";Dropzone.SUCCESS="success";var detectVerticalSquash=function detectVerticalSquash(img){var iw=img.naturalWidth;var ih=img.naturalHeight;var canvas=document.createElement("canvas");canvas.width=1;canvas.height=ih;var ctx=canvas.getContext("2d");ctx.drawImage(img,0,0);var _ctx$getImageData=ctx.getImageData(1,0,1,ih),data=_ctx$getImageData.data;var sy=0;var ey=ih;var py=ih;while(py>sy){var alpha=data[(py-1)*4+3];if(alpha===0){ey=py}else{sy=py}py=ey+sy>>1}var ratio=py/ih;if(ratio===0){return 1}else{return ratio}};var drawImageIOSFix=function drawImageIOSFix(ctx,img,sx,sy,sw,sh,dx,dy,dw,dh){var vertSquashRatio=detectVerticalSquash(img);return ctx.drawImage(img,sx,sy,sw,sh,dx,dy,dw,dh/vertSquashRatio)};var ExifRestore=function(){function ExifRestore(){_classCallCheck(this,ExifRestore)}_createClass(ExifRestore,null,[{key:"initClass",value:function initClass(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}},{key:"encode64",value:function encode64(input){var output="";var chr1=undefined;var chr2=undefined;var chr3="";var enc1=undefined;var enc2=undefined;var enc3=undefined;var enc4="";var i=0;while(true){chr1=input[i++];chr2=input[i++];chr3=input[i++];enc1=chr1>>2;enc2=(chr1&3)<<4|chr2>>4;enc3=(chr2&15)<<2|chr3>>6;enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64}else if(isNaN(chr3)){enc4=64}output=output+this.KEY_STR.charAt(enc1)+this.KEY_STR.charAt(enc2)+this.KEY_STR.charAt(enc3)+this.KEY_STR.charAt(enc4);chr1=chr2=chr3="";enc1=enc2=enc3=enc4="";if(!(i<input.length)){break}}return output}},{key:"restore",value:function restore(origFileBase64,resizedFileBase64){if(!origFileBase64.match("data:image/jpeg;base64,")){return resizedFileBase64}var rawImage=this.decode64(origFileBase64.replace("data:image/jpeg;base64,",""));var segments=this.slice2Segments(rawImage);var image=this.exifManipulation(resizedFileBase64,segments);return"data:image/jpeg;base64,".concat(this.encode64(image))}},{key:"exifManipulation",value:function exifManipulation(resizedFileBase64,segments){var exifArray=this.getExifArray(segments);var newImageArray=this.insertExif(resizedFileBase64,exifArray);var aBuffer=new Uint8Array(newImageArray);return aBuffer}},{key:"getExifArray",value:function getExifArray(segments){var seg=undefined;var x=0;while(x<segments.length){seg=segments[x];if(seg[0]===255&seg[1]===225){return seg}x++}return[]}},{key:"insertExif",value:function insertExif(resizedFileBase64,exifArray){var imageData=resizedFileBase64.replace("data:image/jpeg;base64,","");var buf=this.decode64(imageData);var separatePoint=buf.indexOf(255,3);var mae=buf.slice(0,separatePoint);var ato=buf.slice(separatePoint);var array=mae;array=array.concat(exifArray);array=array.concat(ato);return array}},{key:"slice2Segments",value:function slice2Segments(rawImageArray){var head=0;var segments=[];while(true){var length;if(rawImageArray[head]===255&rawImageArray[head+1]===218){break}if(rawImageArray[head]===255&rawImageArray[head+1]===216){head+=2}else{length=rawImageArray[head+2]*256+rawImageArray[head+3];var endPoint=head+length+2;var seg=rawImageArray.slice(head,endPoint);segments.push(seg);head=endPoint}if(head>rawImageArray.length){break}}return segments}},{key:"decode64",value:function decode64(input){var output="";var chr1=undefined;var chr2=undefined;var chr3="";var enc1=undefined;var enc2=undefined;var enc3=undefined;var enc4="";var i=0;var buf=[];var base64test=/[^A-Za-z0-9\+\/\=]/g;if(base64test.exec(input)){console.warn("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding.")}input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(true){enc1=this.KEY_STR.indexOf(input.charAt(i++));enc2=this.KEY_STR.indexOf(input.charAt(i++));enc3=this.KEY_STR.indexOf(input.charAt(i++));enc4=this.KEY_STR.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;buf.push(chr1);if(enc3!==64){buf.push(chr2)}if(enc4!==64){buf.push(chr3)}chr1=chr2=chr3="";enc1=enc2=enc3=enc4="";if(!(i<input.length)){break}}return buf}}]);return ExifRestore}();ExifRestore.initClass();var contentLoaded=function contentLoaded(win,fn){var done=false;var top=true;var doc=win.document;var root=doc.documentElement;var add=doc.addEventListener?"addEventListener":"attachEvent";var rem=doc.addEventListener?"removeEventListener":"detachEvent";var pre=doc.addEventListener?"":"on";var init=function init(e){if(e.type==="readystatechange"&&doc.readyState!=="complete"){return}(e.type==="load"?win:doc)[rem](pre+e.type,init,false);if(!done&&(done=true)){return fn.call(win,e.type||e)}};var poll=function poll(){try{root.doScroll("left")}catch(e){setTimeout(poll,50);return}return init("poll")};if(doc.readyState!=="complete"){if(doc.createEventObject&&root.doScroll){try{top=!win.frameElement}catch(error){}if(top){poll()}}doc[add](pre+"DOMContentLoaded",init,false);doc[add](pre+"readystatechange",init,false);return win[add](pre+"load",init,false)}};Dropzone._autoDiscoverFunction=function(){if(Dropzone.autoDiscover){return Dropzone.discover()}};contentLoaded(window,Dropzone._autoDiscoverFunction);function __guard__(value,transform){return typeof value!=="undefined"&&value!==null?transform(value):undefined}function __guardMethod__(obj,methodName,transform){if(typeof obj!=="undefined"&&obj!==null&&typeof obj[methodName]==="function"){return transform(obj,methodName)}else{return undefined}}return module.exports});
  6407. define('upload',['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined, Dropzone, Template) {
  6408. var Upload = {
  6409. list: {},
  6410. options: {},
  6411. config: {
  6412. container: document.body,
  6413. classname: '.plupload:not([initialized]),.faupload:not([initialized])',
  6414. previewtpl: '<li class="col-xs-3"><a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail"><img src="<%=fullurl%>" onerror="this.src=\'' + Fast.api.fixurl("ajax/icon") + '?suffix=<%=suffix%>\';this.onerror=null;" class="img-responsive"></a><a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a></li>',
  6415. },
  6416. events: {
  6417. //初始化
  6418. onInit: function () {
  6419. },
  6420. //上传成功的回调
  6421. onUploadSuccess: function (up, ret, file) {
  6422. var button = up.element;
  6423. var onUploadSuccess = up.options.onUploadSuccess;
  6424. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  6425. //上传成功后回调
  6426. if (button) {
  6427. //如果有文本框则填充
  6428. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  6429. if (input_id) {
  6430. var urlArr = [];
  6431. var inputObj = $("#" + input_id);
  6432. if ($(button).data("multiple") && inputObj.val() !== "") {
  6433. urlArr.push(inputObj.val());
  6434. }
  6435. urlArr.push(data.url);
  6436. inputObj.val(urlArr.join(",")).trigger("change").trigger("validate");
  6437. }
  6438. //如果有回调函数
  6439. var onDomUploadSuccess = $(button).data("upload-success");
  6440. if (onDomUploadSuccess) {
  6441. if (typeof onDomUploadSuccess !== 'function' && typeof Upload.api.custom[onDomUploadSuccess] === 'function') {
  6442. onDomUploadSuccess = Upload.api.custom[onDomUploadSuccess];
  6443. }
  6444. if (typeof onDomUploadSuccess === 'function') {
  6445. var result = onDomUploadSuccess.call(button, data, ret);
  6446. if (result === false)
  6447. return;
  6448. }
  6449. }
  6450. }
  6451. if (typeof onUploadSuccess === 'function') {
  6452. var result = onUploadSuccess.call(button, data, ret);
  6453. if (result === false)
  6454. return;
  6455. }
  6456. },
  6457. //上传错误的回调
  6458. onUploadError: function (up, ret, file) {
  6459. var button = up.element;
  6460. var onUploadError = up.options.onUploadError;
  6461. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  6462. if (button) {
  6463. var onDomUploadError = $(button).data("upload-error");
  6464. if (onDomUploadError) {
  6465. if (typeof onDomUploadError !== 'function' && typeof Upload.api.custom[onDomUploadError] === 'function') {
  6466. onDomUploadError = Upload.api.custom[onDomUploadError];
  6467. }
  6468. if (typeof onDomUploadError === 'function') {
  6469. var result = onDomUploadError.call(button, data, ret);
  6470. if (result === false)
  6471. return;
  6472. }
  6473. }
  6474. }
  6475. if (typeof onUploadError === 'function') {
  6476. var result = onUploadError.call(button, data, ret);
  6477. if (result === false) {
  6478. return;
  6479. }
  6480. }
  6481. Toastr.error(ret.msg.toString().replace(/(<([^>]+)>)/gi, "") + "(code:" + ret.code + ")");
  6482. },
  6483. //服务器响应数据后
  6484. onUploadResponse: function (response, up, file) {
  6485. try {
  6486. var ret = typeof response === 'object' ? response : JSON.parse(response);
  6487. if (!ret.hasOwnProperty('code')) {
  6488. $.extend(ret, {code: -2, msg: response, data: null});
  6489. }
  6490. } catch (e) {
  6491. var ret = {code: -1, msg: e.message, data: null};
  6492. }
  6493. return ret;
  6494. },
  6495. //上传全部结束后
  6496. onUploadComplete: function (up, files) {
  6497. var button = up.element;
  6498. var onUploadComplete = up.options.onUploadComplete;
  6499. if (button) {
  6500. var onDomUploadComplete = $(button).data("upload-complete");
  6501. if (onDomUploadComplete) {
  6502. if (typeof onDomUploadComplete !== 'function' && typeof Upload.api.custom[onDomUploadComplete] === 'function') {
  6503. onDomUploadComplete = Upload.api.custom[onDomUploadComplete];
  6504. }
  6505. if (typeof onDomUploadComplete === 'function') {
  6506. var result = onDomUploadComplete.call(button, files);
  6507. if (result === false)
  6508. return;
  6509. }
  6510. }
  6511. }
  6512. if (typeof onUploadComplete === 'function') {
  6513. var result = onUploadComplete.call(button, files);
  6514. if (result === false) {
  6515. return;
  6516. }
  6517. }
  6518. }
  6519. },
  6520. api: {
  6521. //上传接口
  6522. upload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6523. element = typeof element === 'undefined' ? Upload.config.classname : element;
  6524. $(element, Upload.config.container).each(function () {
  6525. if ($(this).attr("initialized")) {
  6526. return true;
  6527. }
  6528. $(this).attr("initialized", true);
  6529. var that = this;
  6530. var id = $(this).prop("id") || $(this).prop("name") || Dropzone.uuidv4();
  6531. var url = $(this).data("url");
  6532. var maxsize = $(this).data("maxsize");
  6533. var maxcount = $(this).data("maxcount");
  6534. var mimetype = $(this).data("mimetype");
  6535. var multipart = $(this).data("multipart");
  6536. var multiple = $(this).data("multiple");
  6537. //填充ID
  6538. var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
  6539. //预览ID
  6540. var preview_id = $(that).data("preview-id") ? $(that).data("preview-id") : "";
  6541. //上传URL
  6542. url = url ? url : Config.upload.uploadurl;
  6543. url = Fast.api.fixurl(url);
  6544. var chunking = false, chunkSize = Config.upload.chunksize || 2097152, timeout = Config.upload.timeout || 600000;
  6545. //最大可上传文件大小
  6546. maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize;
  6547. //文件类型
  6548. mimetype = typeof mimetype !== "undefined" ? mimetype : Config.upload.mimetype;
  6549. //请求的表单参数
  6550. multipart = typeof multipart !== "undefined" ? multipart : Config.upload.multipart;
  6551. //是否支持批量上传
  6552. multiple = typeof multiple !== "undefined" ? multiple : Config.upload.multiple;
  6553. //后缀特殊处理
  6554. mimetype = mimetype.split(",").map(function (k) {
  6555. return k.indexOf("/") > -1 ? k : (!k || k === "*" || k.charAt(0) === "." ? k : "." + k);
  6556. }).join(",");
  6557. mimetype = mimetype === '*' ? null : mimetype;
  6558. //最大文件限制转换成mb
  6559. var maxFilesize = (function (maxsize) {
  6560. var matches = maxsize.toString().match(/^([0-9\.]+)(\w+)$/);
  6561. var size = matches ? parseFloat(matches[1]) : parseFloat(maxsize),
  6562. unit = matches ? matches[2].toLowerCase() : 'b';
  6563. var unitDict = {'b': 0, 'k': 1, 'kb': 1, 'm': 2, 'mb': 2, 'gb': 3, 'g': 3, 'tb': 4, 't': 4};
  6564. var y = typeof unitDict[unit] !== 'undefined' ? unitDict[unit] : 0;
  6565. var bytes = size * Math.pow(1024, y);
  6566. return bytes / Math.pow(1024, 2);
  6567. }(maxsize));
  6568. var options = $(this).data() || {};
  6569. delete options.success;
  6570. delete options.url;
  6571. multipart = $.isArray(multipart) ? {} : multipart;
  6572. Upload.list[id] = new Dropzone(this, $.extend({
  6573. url: url,
  6574. params: function (files, xhr, chunk) {
  6575. var params = multipart;
  6576. if (chunk) {
  6577. return $.extend({}, params, {
  6578. filesize: chunk.file.size,
  6579. filename: chunk.file.name,
  6580. chunkid: chunk.file.upload.uuid,
  6581. chunkindex: chunk.index,
  6582. chunkcount: chunk.file.upload.totalChunkCount,
  6583. chunksize: this.options.chunkSize,
  6584. chunkfilesize: chunk.dataBlock.data.size,
  6585. width: chunk.file.width || 0,
  6586. height: chunk.file.height || 0,
  6587. type: chunk.file.type,
  6588. });
  6589. }
  6590. return params;
  6591. },
  6592. chunking: chunking,
  6593. chunkSize: chunkSize,
  6594. maxFilesize: maxFilesize,
  6595. acceptedFiles: mimetype,
  6596. maxFiles: (maxcount && parseInt(maxcount) > 1 ? maxcount : (multiple ? null : 1)),
  6597. timeout: timeout,
  6598. parallelUploads: 1,
  6599. previewsContainer: false,
  6600. dictDefaultMessage: __("Drop files here to upload"),
  6601. dictFallbackMessage: __("Your browser does not support drag'n'drop file uploads"),
  6602. dictFallbackText: __("Please use the fallback form below to upload your files like in the olden days"),
  6603. dictFileTooBig: __("File is too big (%sMiB), Max filesize: %sMiB", "{{filesize}}", "{{maxFilesize}}"),
  6604. dictInvalidFileType: __("You can't upload files of this type"),
  6605. dictResponseError: __("Server responded with %s code.", "{{statusCode}}"),
  6606. dictCancelUpload: __("Cancel upload"),
  6607. dictUploadCanceled: __("Upload canceled"),
  6608. dictCancelUploadConfirmation: __("Are you sure you want to cancel this upload?"),
  6609. dictRemoveFile: __("Remove file"),
  6610. dictMaxFilesExceeded: __("You can only upload a maximum of %s files", "{{maxFiles}}"),
  6611. init: function () {
  6612. Upload.events.onInit.call(this);
  6613. //必须添加dz-message,否则点击icon无法唤起上传窗口
  6614. $(">i", this.element).addClass("dz-message");
  6615. this.options.elementHtml = $(this.element).html();
  6616. },
  6617. addedfiles: function (files) {
  6618. if (this.options.maxFiles && (!this.options.maxFiles || this.options.maxFiles > 1) && this.options.inputId) {
  6619. var inputObj = $("#" + this.options.inputId);
  6620. if (inputObj.size() > 0) {
  6621. var value = $.trim(inputObj.val());
  6622. var nums = value === '' ? 0 : value.split(/\,/).length;
  6623. var remain = this.options.maxFiles - nums;
  6624. if (remain === 0 || files.length > remain) {
  6625. files = Array.prototype.slice.call(files, remain);
  6626. for (var i = 0; i < files.length; i++) {
  6627. this.removeFile(files[i]);
  6628. }
  6629. Toastr.error(__("You can only upload a maximum of %s files", this.options.maxFiles));
  6630. }
  6631. }
  6632. }
  6633. },
  6634. success: function (file, response) {
  6635. var ret = Upload.events.onUploadResponse(response, this, file);
  6636. file.ret = ret;
  6637. if (ret.code === 1) {
  6638. Upload.events.onUploadSuccess(this, ret, file);
  6639. } else {
  6640. Upload.events.onUploadError(this, ret, file);
  6641. }
  6642. },
  6643. error: function (file, response, xhr) {
  6644. var responseObj = $("<div>" + (xhr && typeof xhr.responseText !== 'undefined' ? xhr.responseText : response) + "</div>");
  6645. responseObj.find("style, title, script").remove();
  6646. var ret = {code: 0, data: null, msg: responseObj.text()};
  6647. Upload.events.onUploadError(this, ret, file);
  6648. },
  6649. uploadprogress: function (file, progress, bytesSent) {
  6650. if (file.upload.chunked) {
  6651. $(this.element).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + Math.floor((file.upload.bytesSent / file.size) * 100) + "%");
  6652. }
  6653. },
  6654. totaluploadprogress: function (progress, bytesSent) {
  6655. if (this.getActiveFiles().length > 0 && !this.options.chunking) {
  6656. $(this.element).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + Math.floor(progress) + "%");
  6657. }
  6658. },
  6659. queuecomplete: function () {
  6660. Upload.events.onUploadComplete(this, this.files);
  6661. this.removeAllFiles(true);
  6662. $(this.element).prop("disabled", false).html(this.options.elementHtml);
  6663. },
  6664. chunkSuccess: function (chunk, file, response) {
  6665. },
  6666. chunksUploaded: function (file, done) {
  6667. var that = this;
  6668. Fast.api.ajax({
  6669. url: this.options.url,
  6670. data: $.extend({}, multipart, {
  6671. action: 'merge',
  6672. filesize: file.size,
  6673. filename: file.name,
  6674. chunkid: file.upload.uuid,
  6675. chunkcount: file.upload.totalChunkCount,
  6676. })
  6677. }, function (data, ret) {
  6678. done(JSON.stringify(ret));
  6679. return false;
  6680. }, function (data, ret) {
  6681. file.accepted = false;
  6682. that._errorProcessing([file], ret.msg);
  6683. });
  6684. },
  6685. onUploadSuccess: onUploadSuccess,
  6686. onUploadError: onUploadError,
  6687. onUploadComplete: onUploadComplete,
  6688. }, Upload.options, options));
  6689. //拖动排序
  6690. if (preview_id && multiple) {
  6691. require(['dragsort'], function () {
  6692. $("#" + preview_id).dragsort({
  6693. dragSelector: "li a:not(.btn-trash)",
  6694. dragEnd: function () {
  6695. $("#" + preview_id).trigger("fa.preview.change");
  6696. },
  6697. placeHolderTemplate: '<li class="col-xs-3"></li>'
  6698. });
  6699. });
  6700. }
  6701. //刷新隐藏textarea的值
  6702. var refresh = function (name) {
  6703. var data = {};
  6704. var textarea = $("textarea[name='" + name + "']");
  6705. var container = textarea.prev("ul");
  6706. $.each($("input,select,textarea", container).serializeArray(), function (i, j) {
  6707. var reg = /\[?(\w+)\]?\[(\w+)\]$/g;
  6708. var match = reg.exec(j.name);
  6709. if (!match)
  6710. return true;
  6711. if (!isNaN(match[2])) {
  6712. data[i] = j.value;
  6713. } else {
  6714. match[1] = "x" + parseInt(match[1]);
  6715. if (typeof data[match[1]] === 'undefined') {
  6716. data[match[1]] = {};
  6717. }
  6718. data[match[1]][match[2]] = j.value;
  6719. }
  6720. });
  6721. var result = [];
  6722. $.each(data, function (i, j) {
  6723. result.push(j);
  6724. });
  6725. textarea.val(JSON.stringify(result));
  6726. };
  6727. if (preview_id && input_id) {
  6728. $(document.body).on("keyup change", "#" + input_id, function (e) {
  6729. var inputStr = $("#" + input_id).val();
  6730. var inputArr = inputStr.split(/\,/);
  6731. $("#" + preview_id).empty();
  6732. var tpl = $("#" + preview_id).data("template") ? $("#" + preview_id).data("template") : "";
  6733. var extend = $("#" + preview_id).next().is("textarea") ? $("#" + preview_id).next("textarea").val() : "{}";
  6734. var json = {};
  6735. try {
  6736. json = JSON.parse(extend);
  6737. } catch (e) {
  6738. }
  6739. $.each(inputArr, function (i, j) {
  6740. if (!j) {
  6741. return true;
  6742. }
  6743. var suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(j);
  6744. suffix = suffix ? suffix[1] : 'file';
  6745. var value = (json && typeof json[i] !== 'undefined' ? json[i] : null);
  6746. var data = {url: j, fullurl: Fast.api.cdnurl(j), data: $(that).data(), key: i, index: i, value: value, row: value, suffix: suffix};
  6747. var html = tpl ? Template(tpl, data) : Template.render(Upload.config.previewtpl, data);
  6748. $("#" + preview_id).append(html);
  6749. });
  6750. refresh($("#" + preview_id).data("name"));
  6751. });
  6752. $("#" + input_id).trigger("change");
  6753. }
  6754. if (preview_id) {
  6755. //监听文本框改变事件
  6756. $("#" + preview_id).on('change keyup', "input,textarea,select", function () {
  6757. refresh($(this).closest("ul").data("name"));
  6758. });
  6759. // 监听事件
  6760. $(document.body).on("fa.preview.change", "#" + preview_id, function () {
  6761. var urlArr = [];
  6762. $("#" + preview_id + " [data-url]").each(function (i, j) {
  6763. urlArr.push($(this).data("url"));
  6764. });
  6765. if (input_id) {
  6766. $("#" + input_id).val(urlArr.join(","));
  6767. }
  6768. refresh($("#" + preview_id).data("name"));
  6769. });
  6770. // 移除按钮事件
  6771. $(document.body).on("click", "#" + preview_id + " .btn-trash", function () {
  6772. $(this).closest("li").remove();
  6773. $("#" + preview_id).trigger("fa.preview.change");
  6774. });
  6775. }
  6776. if (input_id) {
  6777. //粘贴上传、拖拽上传
  6778. $("body").on('paste drop', "#" + input_id, function (event) {
  6779. var originEvent = event.originalEvent;
  6780. var button = $(".plupload[data-input-id='" + $(this).attr("id") + "'],.faupload[data-input-id='" + $(this).attr("id") + "']");
  6781. if (event.type === 'paste' && originEvent.clipboardData && originEvent.clipboardData.items) {
  6782. var items = originEvent.clipboardData.items;
  6783. if ((items.length === 1 && items[0].type.indexOf("text") > -1) || (items.length === 2 && items[1].type.indexOf("text") > -1)) {
  6784. } else {
  6785. Upload.list[button.attr("id")].paste(originEvent);
  6786. return false;
  6787. }
  6788. }
  6789. if (event.type === 'drop' && originEvent.dataTransfer && originEvent.dataTransfer.files) {
  6790. Upload.list[button.attr("id")].drop(originEvent);
  6791. return false;
  6792. }
  6793. });
  6794. }
  6795. });
  6796. },
  6797. /**
  6798. * @deprecated Use upload instead.
  6799. */
  6800. plupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6801. return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete);
  6802. },
  6803. /**
  6804. * @deprecated Use upload instead.
  6805. */
  6806. faupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6807. return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete);
  6808. },
  6809. // AJAX异步上传
  6810. send: function (file, onUploadSuccess, onUploadError, onUploadComplete) {
  6811. var index = Layer.msg(__('Uploading'), {offset: 't', time: 0});
  6812. var id = "dropzone-" + Dropzone.uuidv4();
  6813. $('<button type="button" id="' + id + '" class="btn btn-danger hidden faupload" />').appendTo("body");
  6814. $("#" + id).data("upload-complete", function (files) {
  6815. Layer.close(index);
  6816. Upload.list[id].removeAllFiles(true);
  6817. });
  6818. Upload.api.upload("#" + id, onUploadSuccess, onUploadError, onUploadComplete);
  6819. setTimeout(function () {
  6820. Upload.list[id].addFile(file);
  6821. }, 1);
  6822. },
  6823. custom: {
  6824. //自定义上传完成回调
  6825. afteruploadcallback: function (response) {
  6826. console.log(this, response);
  6827. alert("Custom Callback,Response URL:" + response.url);
  6828. },
  6829. }
  6830. }
  6831. }
  6832. ;
  6833. return Upload;
  6834. });
  6835. /*! nice-validator 1.1.5
  6836. * (c) 2012-2020 Jony Zhang <niceue@live.com>, MIT Licensed
  6837. * https://github.com/niceue/nice-validator
  6838. */
  6839. ;(function(factory) {
  6840. typeof module === 'object' && module.exports ? module.exports = factory( require( 'jquery' ) ) :
  6841. typeof define === 'function' && define.amd ? define('validator',['jquery'], factory) :
  6842. factory(jQuery);
  6843. }(function($, undefined) {
  6844. 'use strict';
  6845. var NS = 'validator',
  6846. CLS_NS = '.' + NS,
  6847. CLS_NS_RULE = '.rule',
  6848. CLS_NS_FIELD = '.field',
  6849. CLS_NS_FORM = '.form',
  6850. CLS_WRAPPER = 'nice-' + NS,
  6851. CLS_MSG_BOX = 'msg-box',
  6852. ARIA_INVALID = 'aria-invalid',
  6853. DATA_RULE = 'data-rule',
  6854. DATA_MSG = 'data-msg',
  6855. DATA_TIP = 'data-tip',
  6856. DATA_OK = 'data-ok',
  6857. DATA_TIMELY = 'data-timely',
  6858. DATA_TARGET = 'data-target',
  6859. DATA_DISPLAY = 'data-display',
  6860. DATA_MUST = 'data-must',
  6861. NOVALIDATE = 'novalidate',
  6862. INPUT_SELECTOR = ':verifiable',
  6863. rRules = /(&)?(!)?\b(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?\s*(;|\|)?/g,
  6864. rRule = /(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?/,
  6865. rDisplay = /(?:([^:;\(\[]*):)?(.*)/,
  6866. rDoubleBytes = /[^\x00-\xff]/g,
  6867. rPos = /top|right|bottom|left/,
  6868. rAjaxType = /(?:(cors|jsonp):)?(?:(post|get):)?(.+)/i,
  6869. rUnsafe = /[<>'"`\\]|&#x?\d+[A-F]?;?|%3[A-F]/gmi,
  6870. noop = $.noop,
  6871. proxy = $.proxy,
  6872. trim = $.trim,
  6873. isFunction = $.isFunction,
  6874. isString = function(s) {
  6875. return typeof s === 'string';
  6876. },
  6877. isObject = function(o) {
  6878. return o && Object.prototype.toString.call(o) === '[object Object]';
  6879. },
  6880. isIE = document.documentMode || +(navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1),
  6881. attr = function(el, key, value) {
  6882. if (!el || !el.tagName) return null;
  6883. if (value !== undefined) {
  6884. if (value === null) el.removeAttribute(key);
  6885. else el.setAttribute(key, '' + value);
  6886. } else {
  6887. return el.getAttribute(key);
  6888. }
  6889. },
  6890. novalidateonce,
  6891. preinitialized = {},
  6892. defaults = {
  6893. debug: 0,
  6894. theme: 'default',
  6895. ignore: '',
  6896. focusInvalid: true,
  6897. focusCleanup: false,
  6898. stopOnError: false,
  6899. beforeSubmit: null,
  6900. valid: null,
  6901. invalid: null,
  6902. validation: null,
  6903. formClass: 'n-default',
  6904. validClass: 'n-valid',
  6905. invalidClass: 'n-invalid',
  6906. bindClassTo: null
  6907. },
  6908. fieldDefaults = {
  6909. timely: 1,
  6910. display: null,
  6911. target: null,
  6912. ignoreBlank: false,
  6913. showOk: true,
  6914. // Translate ajax response to validation result
  6915. dataFilter: function (data) {
  6916. if ( isString(data) || ( isObject(data) && ('error' in data || 'ok' in data) ) ) {
  6917. return data;
  6918. }
  6919. },
  6920. msgMaker: function(opt) {
  6921. var html;
  6922. html = '<span role="alert" class="msg-wrap n-'+ opt.type + '">' + opt.arrow;
  6923. if (opt.result) {
  6924. $.each(opt.result, function(i, obj){
  6925. html += '<span class="n-'+ obj.type +'">' + opt.icon + '<span class="n-msg">' + obj.msg + '</span></span>';
  6926. });
  6927. } else {
  6928. html += opt.icon + '<span class="n-msg">' + opt.msg + '</span>';
  6929. }
  6930. html += '</span>';
  6931. return html;
  6932. },
  6933. msgWrapper: 'span',
  6934. msgArrow: '',
  6935. msgIcon: '<span class="n-icon"></span>',
  6936. msgClass: 'n-right',
  6937. msgStyle: '',
  6938. msgShow: null,
  6939. msgHide: null
  6940. },
  6941. themes = {};
  6942. /** jQuery Plugin
  6943. * @param {Object} options
  6944. debug {Boolean} 0 Whether to enable debug mode
  6945. timely {Number} 1 Whether to enable timely validation
  6946. theme {String} 'default' Theme name
  6947. stopOnError {Boolean} false Whether to stop validate when found an error input
  6948. focusCleanup {Boolean} false Whether to clean up the field message when focus the field
  6949. focusInvalid {Boolean} true Whether to focus the field that is invalid
  6950. ignoreBlank {Boolean} false When the field has no value, whether to ignore validation
  6951. ignore {jqSelector} '' Ignored fields (Using jQuery selector)
  6952. beforeSubmit {Function} Do something before submit form
  6953. dataFilter {Function} Convert ajax results
  6954. valid {Function} Triggered when the form is valid
  6955. invalid {Function} Triggered when the form is invalid
  6956. validClass {String} 'n-valid' Add this class name to a valid field
  6957. invalidClass {String} 'n-invalid' Add this class name to a invalid field
  6958. bindClassTo {jqSelector} ':verifiable' Which element should the className binding to
  6959. display {Function} Callback function to get dynamic display
  6960. target {Function} Callback function to get dynamic target
  6961. msgShow {Function} Trigger this callback when show message
  6962. msgHide {Function} Trigger this callback when hide message
  6963. msgWrapper {String} 'span' Message wrapper tag name
  6964. msgMaker {Function} Callback function to make message HTML
  6965. msgArrow {String} Message arrow template
  6966. msgIcon {String} Message icon template
  6967. msgStyle {String} Custom message css style
  6968. msgClass {String} Additional added to the message class names
  6969. formClass {String} Additional added to the form class names
  6970. messages {Object} Custom messages for the current instance
  6971. rules {Object} Custom rules for the current instance
  6972. fields {Object} Field validation configuration
  6973. {String} key name|#id
  6974. {String|Object} value Rule string or an object which can pass more arguments
  6975. fields[key][rule] {String} Rule string
  6976. fields[key][display] {String|Function}
  6977. fields[key][tip] {String} Custom tip message
  6978. fields[key][ok] {String} Custom success message
  6979. fields[key][msg] {Object} Custom error message
  6980. fields[key][msgStyle] {String} Custom message style
  6981. fields[key][msgClass] {String} A className which added to message placeholder element
  6982. fields[key][msgWrapper] {String} Tag name of the message placeholder element
  6983. fields[key][msgMaker] {Function} A function to custom message HTML
  6984. fields[key][dataFilter] {Function} A function to convert ajax results
  6985. fields[key][valid] {Function} A function triggered when field is valid
  6986. fields[key][invalid] {Function} A function triggered when field is invalid
  6987. fields[key][must] {Boolean} If set true, we always check the field even has remote checking
  6988. fields[key][timely] {Boolean} Whether to enable timely validation
  6989. fields[key][target] {jqSelector} Define placement of a message
  6990. */
  6991. $.fn.validator = function(options) {
  6992. var that = this,
  6993. args = arguments;
  6994. if (that.is(INPUT_SELECTOR)) return that;
  6995. if (!that.is('form')) that = this.find('form');
  6996. if (!that.length) that = this;
  6997. that.each(function() {
  6998. var instance = $(this).data(NS);
  6999. if (instance) {
  7000. if ( isString(options) ) {
  7001. if ( options.charAt(0) === '_' ) return;
  7002. instance[options].apply(instance, [].slice.call(args, 1));
  7003. }
  7004. else if (options) {
  7005. instance._reset(true);
  7006. instance._init(this, options);
  7007. }
  7008. } else {
  7009. new Validator(this, options);
  7010. }
  7011. });
  7012. return this;
  7013. };
  7014. // Validate a field, or an area
  7015. $.fn.isValid = function(callback, hideMsg) {
  7016. var me = _getInstance(this[0]),
  7017. hasCallback = isFunction(callback),
  7018. ret, opt;
  7019. if (!me) return true;
  7020. if (!hasCallback && hideMsg === undefined) hideMsg = callback;
  7021. me.checkOnly = !!hideMsg;
  7022. opt = me.options;
  7023. ret = me._multiValidate(
  7024. this.is(INPUT_SELECTOR) ? this : this.find(INPUT_SELECTOR),
  7025. function(isValid){
  7026. if (!isValid && opt.focusInvalid && !me.checkOnly) {
  7027. // navigate to the error element
  7028. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  7029. }
  7030. if (hasCallback) {
  7031. if (callback.length) {
  7032. callback(isValid);
  7033. } else if (isValid) {
  7034. callback();
  7035. }
  7036. }
  7037. me.checkOnly = false;
  7038. }
  7039. );
  7040. // If you pass a callback, we maintain the jQuery object chain
  7041. return hasCallback ? this : ret;
  7042. };
  7043. $.extend($.expr.pseudos || $.expr[':'], {
  7044. // A faster selector than ":input:not(:submit,:button,:reset,:image,:disabled,[contenteditable])"
  7045. verifiable: function(elem) {
  7046. var name = elem.nodeName.toLowerCase();
  7047. return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
  7048. name === 'select' ||
  7049. name === 'textarea' ||
  7050. elem.contentEditable === 'true'
  7051. ) && !elem.disabled;
  7052. },
  7053. // any value, but not only whitespace
  7054. filled: function(elem) {
  7055. return !!trim($(elem).val());
  7056. }
  7057. });
  7058. /**
  7059. * Creates a new Validator
  7060. *
  7061. * @class
  7062. * @param {Element} element - form element
  7063. * @param {Object} options - options for validator
  7064. */
  7065. function Validator(element, options) {
  7066. var me = this;
  7067. if ( !(me instanceof Validator) ) {
  7068. return new Validator(element, options);
  7069. }
  7070. if (Validator.pending) {
  7071. $(window).on('validatorready', init);
  7072. } else {
  7073. init();
  7074. }
  7075. function init() {
  7076. me.$el = $(element);
  7077. if (me.$el.length) {
  7078. me._init(me.$el[0], options);
  7079. }
  7080. else if (isString(element)) {
  7081. preinitialized[element] = options;
  7082. }
  7083. }
  7084. }
  7085. Validator.prototype = {
  7086. _init: function(element, options) {
  7087. var me = this,
  7088. opt, themeOpt, dataOpt;
  7089. // Initialization options
  7090. if ( isFunction(options) ) {
  7091. options = {
  7092. valid: options
  7093. };
  7094. }
  7095. options = me._opt = options || {};
  7096. dataOpt = attr(element, 'data-'+ NS +'-option');
  7097. dataOpt = me._dataOpt = dataOpt && dataOpt.charAt(0) === '{' ? (new Function('return ' + dataOpt))() : {};
  7098. themeOpt = me._themeOpt = themes[ options.theme || dataOpt.theme || defaults.theme ];
  7099. opt = me.options = $.extend({}, defaults, fieldDefaults, themeOpt, me.options, options, dataOpt);
  7100. me.rules = new Rules(opt.rules, true);
  7101. me.messages = new Messages(opt.messages, true);
  7102. me.Field = _createFieldFactory(me);
  7103. me.elements = me.elements || {};
  7104. me.deferred = {};
  7105. me.errors = {};
  7106. me.fields = {};
  7107. // Initialization fields
  7108. me._initFields(opt.fields);
  7109. // Initialization events and make a cache
  7110. if ( !me.$el.data(NS) ) {
  7111. me.$el.data(NS, me).addClass(CLS_WRAPPER +' '+ opt.formClass)
  7112. .on('form-submit-validate', function(e, a, $form, opts, veto) {
  7113. me.vetoed = veto.veto = !me.isValid;
  7114. me.ajaxFormOptions = opts;
  7115. })
  7116. .on('submit'+ CLS_NS +' validate'+ CLS_NS, proxy(me, '_submit'))
  7117. .on('reset'+ CLS_NS, proxy(me, '_reset'))
  7118. .on('showmsg'+ CLS_NS, proxy(me, '_showmsg'))
  7119. .on('hidemsg'+ CLS_NS, proxy(me, '_hidemsg'))
  7120. .on('focusin'+ CLS_NS + ' click'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusin'))
  7121. .on('focusout'+ CLS_NS +' validate'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusout'))
  7122. .on('keyup'+ CLS_NS +' input'+ CLS_NS + ' compositionstart compositionend', INPUT_SELECTOR, proxy(me, '_focusout'))
  7123. .on('click'+ CLS_NS, ':radio,:checkbox', 'click', proxy(me, '_focusout'))
  7124. .on('change'+ CLS_NS, 'select,input[type="file"]', 'change', proxy(me, '_focusout'));
  7125. // cache the novalidate attribute value
  7126. me._NOVALIDATE = attr(element, NOVALIDATE);
  7127. // Initialization is complete, stop off default HTML5 form validation
  7128. // If use "jQuery.attr('novalidate')" in IE7 will complain: "SCRIPT3: Member not found."
  7129. attr(element, NOVALIDATE, NOVALIDATE);
  7130. }
  7131. // Display all messages in target container
  7132. if ( isString(opt.target) ) {
  7133. me.$el.find(opt.target).addClass('msg-container');
  7134. }
  7135. },
  7136. // Guess whether the form use ajax submit
  7137. _guessAjax: function(form) {
  7138. var me = this;
  7139. if ( !(me.isAjaxSubmit = !!me.options.valid) ) {
  7140. // if there is a "valid.form" event
  7141. var events = ($._data || $.data)(form, 'events');
  7142. me.isAjaxSubmit = issetEvent(events, 'valid', 'form') || issetEvent(events, 'submit', 'form-plugin');
  7143. }
  7144. function issetEvent(events, name, namespace) {
  7145. return !!(
  7146. events && events[name]
  7147. && $.map(events[name], function(e){
  7148. return ~e.namespace.indexOf(namespace) ? 1 : null;
  7149. }).length )
  7150. }
  7151. },
  7152. _initFields: function(fields) {
  7153. var me = this, k, arr, i,
  7154. clear = fields === null;
  7155. // Processing field information
  7156. if (clear) fields = me.fields;
  7157. if ( isObject(fields) ) {
  7158. for (k in fields) {
  7159. if (~k.indexOf(',')) {
  7160. arr = k.split(',');
  7161. i = arr.length;
  7162. while (i--) {
  7163. initField(trim(arr[i]), fields[k]);
  7164. }
  7165. } else {
  7166. initField(k, fields[k]);
  7167. }
  7168. }
  7169. }
  7170. // Parsing DOM rules
  7171. me.$el.find(INPUT_SELECTOR).each(function() {
  7172. me._parse(this);
  7173. });
  7174. function initField(k, v) {
  7175. // delete a field from settings
  7176. if ( v === null || clear ) {
  7177. var el = me.elements[k];
  7178. if (el) me._resetElement(el, true);
  7179. delete me.fields[k];
  7180. } else {
  7181. me.fields[k] = new me.Field(k, isString(v) ? {rule: v} : v, me.fields[k]);
  7182. }
  7183. }
  7184. },
  7185. // Parsing a field
  7186. _parse: function(el) {
  7187. var me = this,
  7188. field,
  7189. key = el.name,
  7190. display,
  7191. timely,
  7192. dataRule = attr(el, DATA_RULE);
  7193. dataRule && attr(el, DATA_RULE, null);
  7194. // If the field has passed the key as id mode, or it doesn't has a name
  7195. if ( el.id && (
  7196. ('#' + el.id in me.fields) ||
  7197. !key ||
  7198. // If dataRule and element are diffrent from old's, we use ID mode.
  7199. (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
  7200. )
  7201. ) {
  7202. key = '#' + el.id;
  7203. }
  7204. // Generate id
  7205. if (!key) {
  7206. key = '#' + (el.id = 'N' + String(Math.random()).slice(-12));
  7207. }
  7208. field = me.getField(key, true);
  7209. // The priority of passing parameter by DOM is higher than by JS.
  7210. field.rule = dataRule || field.rule;
  7211. if (display = attr(el, DATA_DISPLAY)) {
  7212. field.display = display;
  7213. }
  7214. if (field.rule) {
  7215. if ( attr(el, DATA_MUST) !== null || /\b(?:match|checked)\b/.test(field.rule) ) {
  7216. field.must = true;
  7217. }
  7218. if ( /\brequired\b/.test(field.rule) ) {
  7219. field.required = true;
  7220. }
  7221. if (timely = attr(el, DATA_TIMELY)) {
  7222. field.timely = +timely;
  7223. } else if (field.timely > 3) {
  7224. attr(el, DATA_TIMELY, field.timely);
  7225. }
  7226. me._parseRule(field);
  7227. field.old = {};
  7228. }
  7229. if ( isString(field.target) ) {
  7230. attr(el, DATA_TARGET, field.target);
  7231. }
  7232. if ( isString(field.tip) ) {
  7233. attr(el, DATA_TIP, field.tip);
  7234. }
  7235. return me.fields[key] = field;
  7236. },
  7237. // Parsing field rules
  7238. _parseRule: function(field) {
  7239. var arr = rDisplay.exec(field.rule);
  7240. if (!arr) return;
  7241. // current rule index
  7242. field._i = 0;
  7243. if (arr[1]) {
  7244. field.display = arr[1];
  7245. }
  7246. if (arr[2]) {
  7247. field._rules = [];
  7248. arr[2].replace(rRules, function(){
  7249. var args = arguments;
  7250. args[4] = args[4] || args[5];
  7251. field._rules.push({
  7252. and: args[1] === '&',
  7253. not: args[2] === '!',
  7254. or: args[6] === '|',
  7255. method: args[3],
  7256. params: args[4] ? $.map( args[4].split(', '), trim ) : undefined
  7257. });
  7258. });
  7259. }
  7260. },
  7261. // Verify a zone
  7262. _multiValidate: function($inputs, doneCallback){
  7263. var me = this,
  7264. opt = me.options;
  7265. me.hasError = false;
  7266. if (opt.ignore) {
  7267. $inputs = $inputs.not(opt.ignore);
  7268. }
  7269. $inputs.each(function() {
  7270. me._validate(this);
  7271. if (me.hasError && opt.stopOnError) {
  7272. // stop the validation
  7273. return false;
  7274. }
  7275. });
  7276. // Need to wait for all fields validation complete, especially asynchronous validation
  7277. if (doneCallback) {
  7278. me.validating = true;
  7279. $.when.apply(
  7280. null,
  7281. $.map(me.deferred, function(v){return v;})
  7282. ).done(function(){
  7283. doneCallback.call(me, !me.hasError);
  7284. me.validating = false;
  7285. });
  7286. }
  7287. // If the form does not contain asynchronous validation, the return value is correct.
  7288. // Otherwise, you should detect form validation result through "doneCallback".
  7289. return !$.isEmptyObject(me.deferred) ? undefined : !me.hasError;
  7290. },
  7291. // Validate the whole form
  7292. _submit: function(e) {
  7293. var me = this,
  7294. opt = me.options,
  7295. form = e.target,
  7296. canSubmit = e.type === 'submit' && form.tagName === 'FORM' && !e.isDefaultPrevented();
  7297. e.preventDefault();
  7298. if (
  7299. novalidateonce && ~(novalidateonce = false) ||
  7300. // Prevent duplicate submission
  7301. me.submiting ||
  7302. // Receive the "validate" event only from the form.
  7303. e.type === 'validate' && me.$el[0] !== form ||
  7304. // trigger the beforeSubmit callback.
  7305. isFunction(opt.beforeSubmit) && opt.beforeSubmit.call(me, form) === false
  7306. ) {
  7307. return;
  7308. }
  7309. if (me.isAjaxSubmit === undefined) {
  7310. me._guessAjax(form);
  7311. }
  7312. me._debug('log', '\n<<< event: ' + e.type);
  7313. me._reset();
  7314. me.submiting = true;
  7315. me._multiValidate(
  7316. me.$el.find(INPUT_SELECTOR),
  7317. function(isValid){
  7318. var ret = (isValid || opt.debug === 2) ? 'valid' : 'invalid',
  7319. errors;
  7320. if (!isValid) {
  7321. if (opt.focusInvalid) {
  7322. // navigate to the error element
  7323. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  7324. }
  7325. errors = $.map(me.errors, function(err){return err;});
  7326. }
  7327. // releasing submit
  7328. me.submiting = false;
  7329. me.isValid = isValid;
  7330. // trigger callback and event
  7331. isFunction(opt[ret]) && opt[ret].call(me, form, errors);
  7332. me.$el.trigger(ret + CLS_NS_FORM, [form, errors]);
  7333. me._debug('log', '>>> ' + ret);
  7334. if (!isValid) return;
  7335. // For jquery.form plugin
  7336. if (me.vetoed) {
  7337. $(form).ajaxSubmit(me.ajaxFormOptions);
  7338. }
  7339. else if (canSubmit && !me.isAjaxSubmit) {
  7340. document.createElement('form').submit.call(form);
  7341. }
  7342. }
  7343. );
  7344. },
  7345. _reset: function(e) {
  7346. var me = this;
  7347. me.errors = {};
  7348. if (e) {
  7349. me.reseting = true;
  7350. me.$el.find(INPUT_SELECTOR).each( function(){
  7351. me._resetElement(this);
  7352. });
  7353. delete me.reseting;
  7354. }
  7355. },
  7356. _resetElement: function(el, all) {
  7357. this._setClass(el, null);
  7358. this.hideMsg(el);
  7359. },
  7360. // Handle events: "focusin/click"
  7361. _focusin: function(e) {
  7362. var me = this,
  7363. opt = me.options,
  7364. el = e.target,
  7365. timely,
  7366. msg;
  7367. if ( me.validating || ( e.type==='click' && document.activeElement === el ) ) {
  7368. return;
  7369. }
  7370. if (opt.focusCleanup) {
  7371. if ( attr(el, ARIA_INVALID) === 'true' ) {
  7372. me._setClass(el, null);
  7373. me.hideMsg(el);
  7374. }
  7375. }
  7376. msg = attr(el, DATA_TIP);
  7377. if (msg) {
  7378. me.showMsg(el, {
  7379. type: 'tip',
  7380. msg: msg
  7381. });
  7382. } else {
  7383. if (attr(el, DATA_RULE)) {
  7384. me._parse(el);
  7385. }
  7386. if (timely = attr(el, DATA_TIMELY)) {
  7387. if ( timely === 8 || timely === 9 ) {
  7388. me._focusout(e);
  7389. }
  7390. }
  7391. }
  7392. },
  7393. // Handle events: "focusout/validate/keyup/click/change/input/compositionstart/compositionend"
  7394. _focusout: function(e) {
  7395. var me = this,
  7396. opt = me.options,
  7397. el = e.target,
  7398. etype = e.type,
  7399. etype0,
  7400. focusin = etype === 'focusin',
  7401. special = etype === 'validate',
  7402. elem,
  7403. field,
  7404. old,
  7405. value,
  7406. timestamp,
  7407. key, specialKey,
  7408. timely,
  7409. timer = 0;
  7410. if (etype === 'compositionstart') {
  7411. me.pauseValidate = true;
  7412. }
  7413. if (etype === 'compositionend') {
  7414. me.pauseValidate = false;
  7415. }
  7416. if (me.pauseValidate) {
  7417. return;
  7418. }
  7419. // For checkbox and radio
  7420. elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
  7421. // Get field
  7422. if (!(field = me.getField(elem)) || !field.rule) {
  7423. return;
  7424. }
  7425. // Cache event type
  7426. etype0 = field._e;
  7427. field._e = etype;
  7428. timely = field.timely;
  7429. if (!special) {
  7430. if (!timely || (_checkable(el) && etype !== 'click')) {
  7431. return;
  7432. }
  7433. value = field.getValue();
  7434. // not validate field unless fill a value
  7435. if ( field.ignoreBlank && !value && !focusin ) {
  7436. me.hideMsg(el);
  7437. return;
  7438. }
  7439. if ( etype === 'focusout' ) {
  7440. if (etype0 === 'change') {
  7441. return;
  7442. }
  7443. if ( timely === 2 || timely === 8 ) {
  7444. old = field.old;
  7445. if (value && old) {
  7446. if (field.isValid && !old.showOk) {
  7447. me.hideMsg(el);
  7448. } else {
  7449. me._makeMsg(el, field, old);
  7450. }
  7451. } else {
  7452. return;
  7453. }
  7454. }
  7455. }
  7456. else {
  7457. if ( timely < 2 && !e.data ) {
  7458. return;
  7459. }
  7460. // mark timestamp to reduce the frequency of the received event
  7461. timestamp = +new Date();
  7462. if ( timestamp - (el._ts || 0) < 100 ) {
  7463. return;
  7464. }
  7465. el._ts = timestamp;
  7466. // handle keyup
  7467. if ( etype === 'keyup' ) {
  7468. if (etype0 === 'input') {
  7469. return;
  7470. }
  7471. key = e.keyCode;
  7472. specialKey = {
  7473. 8: 1, // Backspace
  7474. 9: 1, // Tab
  7475. 16: 1, // Shift
  7476. 32: 1, // Space
  7477. 46: 1 // Delete
  7478. };
  7479. // only gets focus, no validation
  7480. if ( key === 9 && !value ) {
  7481. return;
  7482. }
  7483. // do not validate, if triggered by these keys
  7484. if ( key < 48 && !specialKey[key] ) {
  7485. return;
  7486. }
  7487. }
  7488. if ( !focusin ) {
  7489. // keyboard events, reducing the frequency of validation
  7490. timer = timely <100 ? (etype === 'click' || el.tagName === 'SELECT') ? 0 : 400 : timely;
  7491. }
  7492. }
  7493. }
  7494. // if the current field is ignored
  7495. if ( opt.ignore && $(el).is(opt.ignore) ) {
  7496. return;
  7497. }
  7498. clearTimeout(field._t);
  7499. if (timer) {
  7500. field._t = setTimeout(function() {
  7501. me._validate(el, field);
  7502. }, timer);
  7503. } else {
  7504. if (special) field.old = {};
  7505. me._validate(el, field);
  7506. }
  7507. },
  7508. _setClass: function(el, isValid) {
  7509. var $el = $(el), opt = this.options;
  7510. if (opt.bindClassTo) {
  7511. $el = $el.closest(opt.bindClassTo);
  7512. }
  7513. $el.removeClass( opt.invalidClass + ' ' + opt.validClass );
  7514. if (isValid !== null) {
  7515. $el.addClass( isValid ? opt.validClass : opt.invalidClass );
  7516. }
  7517. },
  7518. _showmsg: function(e, type, msg) {
  7519. var me = this,
  7520. el = e.target;
  7521. if ( me.$el.is(el) ) {
  7522. if (isObject(type)) {
  7523. me.showMsg(type)
  7524. }
  7525. else if ( type === 'tip' ) {
  7526. me.$el.find(INPUT_SELECTOR +'['+ DATA_TIP +']', el).each(function(){
  7527. me.showMsg(this, {type: type, msg: msg});
  7528. });
  7529. }
  7530. }
  7531. else {
  7532. me.showMsg(el, {type: type, msg: msg});
  7533. }
  7534. },
  7535. _hidemsg: function(e) {
  7536. var $el = $(e.target);
  7537. if ( $el.is(INPUT_SELECTOR) ) {
  7538. this.hideMsg($el);
  7539. }
  7540. },
  7541. // Validated a field
  7542. _validatedField: function(el, field, ret) {
  7543. var me = this,
  7544. opt = me.options,
  7545. isValid = field.isValid = ret.isValid = !!ret.isValid,
  7546. callback = isValid ? 'valid' : 'invalid';
  7547. ret.key = field.key;
  7548. ret.ruleName = field._r;
  7549. ret.id = el.id;
  7550. ret.value = field.value;
  7551. me.elements[field.key] = ret.element = el;
  7552. me.isValid = me.$el[0].isValid = isValid ? me.isFormValid() : isValid;
  7553. if (isValid) {
  7554. ret.type = 'ok';
  7555. } else {
  7556. if (me.submiting) {
  7557. me.errors[field.key] = ret.msg;
  7558. }
  7559. me.hasError = true;
  7560. }
  7561. // cache result
  7562. field.old = ret;
  7563. // trigger callback
  7564. isFunction(field[callback]) && field[callback].call(me, el, ret);
  7565. isFunction(opt.validation) && opt.validation.call(me, el, ret);
  7566. // trigger event
  7567. $(el).attr( ARIA_INVALID, isValid ? null : true )
  7568. .trigger( callback + CLS_NS_FIELD, [ret, me] );
  7569. me.$el.triggerHandler('validation', [ret, me]);
  7570. if (me.checkOnly) return;
  7571. // set className
  7572. me._setClass(el, ret.skip || ret.type === 'tip' ? null : isValid);
  7573. me._makeMsg.apply(me, arguments);
  7574. },
  7575. _makeMsg: function(el, field, ret) {
  7576. // show or hide the message
  7577. if (field.msgMaker) {
  7578. ret = $.extend({}, ret);
  7579. if (field._e === 'focusin') {
  7580. ret.type = 'tip';
  7581. }
  7582. this[ ret.showOk || ret.msg || ret.type === 'tip' ? 'showMsg' : 'hideMsg' ](el, ret, field);
  7583. }
  7584. },
  7585. // Validated a rule
  7586. _validatedRule: function(el, field, ret, msgOpt) {
  7587. field = field || me.getField(el);
  7588. msgOpt = msgOpt || {};
  7589. var me = this,
  7590. msg,
  7591. rule,
  7592. method = field._r,
  7593. timely = field.timely,
  7594. special = timely === 9 || timely === 8,
  7595. transfer,
  7596. temp,
  7597. isValid = false;
  7598. // use null to break validation from a field
  7599. if (ret === null) {
  7600. me._validatedField(el, field, {isValid: true, skip: true});
  7601. field._i = 0;
  7602. return;
  7603. }
  7604. else if (ret === undefined) {
  7605. transfer = true;
  7606. }
  7607. else if (ret === true || ret === '') {
  7608. isValid = true;
  7609. }
  7610. else if (isString(ret)) {
  7611. msg = ret;
  7612. }
  7613. else if (isObject(ret)) {
  7614. if (ret.error) {
  7615. msg = ret.error;
  7616. } else {
  7617. msg = ret.ok;
  7618. isValid = true;
  7619. }
  7620. }
  7621. else {
  7622. isValid = !!ret
  7623. }
  7624. rule = field._rules[field._i];
  7625. if (rule.not) {
  7626. msg = undefined;
  7627. isValid = method === 'required' || !isValid;
  7628. }
  7629. if (rule.or) {
  7630. if (isValid) {
  7631. while ( field._i < field._rules.length && field._rules[field._i].or ) {
  7632. field._i++;
  7633. }
  7634. } else {
  7635. transfer = true;
  7636. }
  7637. }
  7638. else if (rule.and) {
  7639. if (!field.isValid) transfer = true;
  7640. }
  7641. if (transfer) {
  7642. isValid = true;
  7643. }
  7644. // message analysis, and throw rule level event
  7645. else {
  7646. if (isValid) {
  7647. if (field.showOk !== false) {
  7648. temp = attr(el, DATA_OK);
  7649. msg = temp === null ? isString(field.ok) ? field.ok : msg : temp;
  7650. if (!isString(msg) && isString(field.showOk)) {
  7651. msg = field.showOk;
  7652. }
  7653. if (isString(msg)) {
  7654. msgOpt.showOk = isValid;
  7655. }
  7656. }
  7657. }
  7658. if (!isValid || special) {
  7659. /* rule message priority:
  7660. 1. custom DOM message
  7661. 2. custom field message;
  7662. 3. global defined message;
  7663. 4. rule returned message;
  7664. 5. default message;
  7665. */
  7666. msg = (_getDataMsg(el, field, msg || rule.msg || me.messages[method]) || me.messages.fallback).replace(/\{0\|?([^\}]*)\}/, function(m, defaultDisplay){
  7667. return me._getDisplay(el, field.display) || defaultDisplay || me.messages[0];
  7668. });
  7669. }
  7670. if (!isValid) field.isValid = isValid;
  7671. msgOpt.msg = msg;
  7672. $(el).trigger( (isValid ? 'valid' : 'invalid') + CLS_NS_RULE, [method, msg]);
  7673. }
  7674. if (special && (!transfer || rule.and)) {
  7675. if (!isValid && !field._m) field._m = msg;
  7676. field._v = field._v || [];
  7677. field._v.push({
  7678. type: isValid ? !transfer ? 'ok' : 'tip' : 'error',
  7679. msg: msg || rule.msg
  7680. });
  7681. }
  7682. me._debug('log', ' ' + field._i + ': ' + method + ' => ' + (isValid || msg));
  7683. // the current rule has passed, continue to validate
  7684. if ( (isValid || special) && field._i < field._rules.length - 1) {
  7685. field._i++;
  7686. me._checkRule(el, field);
  7687. }
  7688. // field was invalid, or all fields was valid
  7689. else {
  7690. field._i = 0;
  7691. if (special) {
  7692. msgOpt.isValid = field.isValid;
  7693. msgOpt.result = field._v;
  7694. msgOpt.msg = field._m || '';
  7695. if (!field.value && (field._e === 'focusin')) {
  7696. msgOpt.type = 'tip';
  7697. }
  7698. } else {
  7699. msgOpt.isValid = isValid;
  7700. }
  7701. me._validatedField(el, field, msgOpt);
  7702. delete field._m;
  7703. delete field._v;
  7704. }
  7705. },
  7706. // Verify a rule form a field
  7707. _checkRule: function(el, field) {
  7708. var me = this,
  7709. ret,
  7710. fn,
  7711. old,
  7712. key = field.key,
  7713. rule = field._rules[field._i],
  7714. method = rule.method,
  7715. params = rule.params;
  7716. // request has been sent, wait it
  7717. if (me.submiting && me.deferred[key]) {
  7718. return;
  7719. }
  7720. old = field.old;
  7721. field._r = method;
  7722. if (old && !field.must && !rule.must && rule.result !== undefined &&
  7723. old.ruleName === method && old.id === el.id &&
  7724. field.value && old.value === field.value )
  7725. {
  7726. // get result from cache
  7727. ret = rule.result;
  7728. }
  7729. else {
  7730. // get result from current rule
  7731. fn = _getDataRule(el, method) || me.rules[method] || noop;
  7732. ret = fn.call(field, el, params, field);
  7733. if (fn.msg) rule.msg = fn.msg;
  7734. }
  7735. // asynchronous validation
  7736. if (isObject(ret) && isFunction(ret.then)) {
  7737. me.deferred[key] = ret;
  7738. // whether the field valid is unknown
  7739. field.isValid = undefined;
  7740. // show loading message
  7741. !me.checkOnly && me.showMsg(el, {
  7742. type: 'loading',
  7743. msg: me.messages.loading
  7744. }, field);
  7745. // waiting to parse the response data
  7746. ret.then(
  7747. function(d, textStatus, jqXHR) {
  7748. var data = trim(jqXHR.responseText),
  7749. result,
  7750. dataFilter = field.dataFilter;
  7751. // detect if data is json or jsonp format
  7752. if (/jsonp?/.test(this.dataType)) {
  7753. data = d;
  7754. } else if (data.charAt(0) === '{') {
  7755. data = $.parseJSON(data);
  7756. }
  7757. // filter data
  7758. result = dataFilter.call(this, data, field);
  7759. if (result === undefined) result = dataFilter.call(this, data.data, field);
  7760. rule.data = this.data;
  7761. rule.result = field.old ? result : undefined;
  7762. me._validatedRule(el, field, result);
  7763. },
  7764. function(jqXHR, textStatus){
  7765. me._validatedRule(el, field, me.messages[textStatus] || textStatus);
  7766. }
  7767. ).always(function(){
  7768. delete me.deferred[key];
  7769. });
  7770. }
  7771. // other result
  7772. else {
  7773. me._validatedRule(el, field, ret);
  7774. }
  7775. },
  7776. // Processing the validation
  7777. _validate: function(el, field) {
  7778. var me = this;
  7779. // doesn't validate the element that has "disabled" or "novalidate" attribute
  7780. if ( el.disabled || attr(el, NOVALIDATE) !== null ) {
  7781. return;
  7782. }
  7783. field = field || me.getField(el);
  7784. if (!field) return;
  7785. if (!field._rules) me._parse(el);
  7786. if (!field._rules) return;
  7787. me._debug('info', field.key);
  7788. field.isValid = true;
  7789. field.element = el;
  7790. // Cache the value
  7791. field.value = field.getValue();
  7792. // if the field is not required, and that has a blank value
  7793. if (!field.required && !field.must && !field.value) {
  7794. if (!_checkable(el)) {
  7795. me._validatedField(el, field, {isValid: true});
  7796. return true;
  7797. }
  7798. }
  7799. me._checkRule(el, field);
  7800. return field.isValid;
  7801. },
  7802. _debug: function(type, messages) {
  7803. if (window.console && this.options.debug) {
  7804. console[type](messages);
  7805. }
  7806. },
  7807. /**
  7808. * Detecting whether the value of an element that matches a rule
  7809. *
  7810. * @method test
  7811. * @param {Element} el - input element
  7812. * @param {String} rule - rule name
  7813. */
  7814. test: function(el, rule) {
  7815. var me = this,
  7816. ret,
  7817. parts = rRule.exec(rule),
  7818. field,
  7819. method,
  7820. params;
  7821. if (parts) {
  7822. method = parts[1];
  7823. if (method in me.rules) {
  7824. params = parts[2] || parts[3];
  7825. params = params ? params.split(', ') : undefined;
  7826. field = me.getField(el, true);
  7827. field._r = method;
  7828. field.value = field.getValue();
  7829. ret = me.rules[method].call(field, el, params);
  7830. }
  7831. }
  7832. return ret === true || ret === undefined || ret === null;
  7833. },
  7834. _getDisplay: function(el, str) {
  7835. return !isString(str) ? isFunction(str) ? str.call(this, el) : '' : str;
  7836. },
  7837. _getMsgOpt: function(obj, field) {
  7838. var opt = field ? field : this.options;
  7839. return $.extend({
  7840. type: 'error',
  7841. pos: _getPos(opt.msgClass),
  7842. target: opt.target,
  7843. wrapper: opt.msgWrapper,
  7844. style: opt.msgStyle,
  7845. cls: opt.msgClass,
  7846. arrow: opt.msgArrow,
  7847. icon: opt.msgIcon
  7848. }, isString(obj) ? {msg: obj} : obj);
  7849. },
  7850. _getMsgDOM: function(el, msgOpt) {
  7851. var $el = $(el), $msgbox, datafor, tgt, container;
  7852. if ( $el.is(INPUT_SELECTOR) ) {
  7853. tgt = msgOpt.target || attr(el, DATA_TARGET);
  7854. if (tgt) {
  7855. tgt = !isFunction(tgt) ? tgt.charAt(0) === '#' ? $(tgt) : this.$el.find(tgt) : tgt.call(this, el);
  7856. if (tgt.length) {
  7857. if ( tgt.is(INPUT_SELECTOR) ) {
  7858. $el = tgt
  7859. el = tgt.get(0);
  7860. } else if ( tgt.hasClass(CLS_MSG_BOX) ) {
  7861. $msgbox = tgt;
  7862. } else {
  7863. container = tgt;
  7864. }
  7865. }
  7866. }
  7867. if (!$msgbox) {
  7868. datafor = (!_checkable(el) || !el.name) && el.id ? el.id : el.name;
  7869. $msgbox = (container || this.$el).find(msgOpt.wrapper + '.' + CLS_MSG_BOX + '[for="' + datafor + '"]');
  7870. }
  7871. } else {
  7872. $msgbox = $el;
  7873. }
  7874. // Create new message box
  7875. if (!msgOpt.hide && !$msgbox.length) {
  7876. $msgbox = $('<'+ msgOpt.wrapper + '>').attr({
  7877. 'class': CLS_MSG_BOX + (msgOpt.cls ? ' ' + msgOpt.cls : ''),
  7878. 'style': msgOpt.style || undefined,
  7879. 'for': datafor
  7880. });
  7881. if (container) {
  7882. $msgbox.appendTo(container);
  7883. } else {
  7884. if ( _checkable(el) ) {
  7885. var $parent = $el.parent();
  7886. $msgbox.appendTo( $parent.is('label') ? $parent.parent() : $parent );
  7887. } else {
  7888. $msgbox[!msgOpt.pos || msgOpt.pos === 'right' ? 'insertAfter' : 'insertBefore']($el);
  7889. }
  7890. }
  7891. }
  7892. return $msgbox;
  7893. },
  7894. /**
  7895. * Show validation message
  7896. *
  7897. * @method showMsg
  7898. * @param {Element} el - input element
  7899. * @param {Object} msgOpt
  7900. */
  7901. showMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  7902. if (!el) return;
  7903. var me = this,
  7904. opt = me.options,
  7905. msgShow,
  7906. msgMaker,
  7907. temp,
  7908. $msgbox;
  7909. if (isObject(el) && !el.jquery && !msgOpt) {
  7910. $.each(el, function(key, msg) {
  7911. var el = me.elements[key] || me.$el.find(_key2selector(key))[0];
  7912. me.showMsg(el, msg);
  7913. });
  7914. return;
  7915. }
  7916. if ($(el).is(INPUT_SELECTOR)) {
  7917. field = field || me.getField(el);
  7918. }
  7919. if (!(msgMaker = (field || opt).msgMaker)) {
  7920. return;
  7921. }
  7922. msgOpt = me._getMsgOpt(msgOpt, field);
  7923. el = (el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]') : $(el)).get(0);
  7924. // ok or tip
  7925. if (!msgOpt.msg && msgOpt.type !== 'error') {
  7926. temp = attr(el, 'data-' + msgOpt.type);
  7927. if (temp !== null) msgOpt.msg = temp;
  7928. }
  7929. if ( !isString(msgOpt.msg) ) {
  7930. return;
  7931. }
  7932. $msgbox = me._getMsgDOM(el, msgOpt);
  7933. !rPos.test($msgbox[0].className) && $msgbox.addClass(msgOpt.cls);
  7934. if ( isIE === 6 && msgOpt.pos === 'bottom' ) {
  7935. $msgbox[0].style.marginTop = $(el).outerHeight() + 'px';
  7936. }
  7937. $msgbox.html( msgMaker.call(me, msgOpt) )[0].style.display = '';
  7938. if (isFunction(msgShow = field && field.msgShow || opt.msgShow)) {
  7939. msgShow.call(me, $msgbox, msgOpt.type);
  7940. }
  7941. },
  7942. /**
  7943. * Hide validation message
  7944. *
  7945. * @method hideMsg
  7946. * @param {Element} el - input element
  7947. * @param {Object} msgOpt optional
  7948. */
  7949. hideMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  7950. var me = this,
  7951. opt = me.options,
  7952. msgHide,
  7953. $msgbox;
  7954. el = $(el).get(0);
  7955. if ($(el).is(INPUT_SELECTOR)) {
  7956. field = field || me.getField(el);
  7957. if (field) {
  7958. if (field.isValid || me.reseting) attr(el, ARIA_INVALID, null);
  7959. }
  7960. }
  7961. msgOpt = me._getMsgOpt(msgOpt, field);
  7962. msgOpt.hide = true;
  7963. $msgbox = me._getMsgDOM(el, msgOpt);
  7964. if (!$msgbox.length) return;
  7965. if ( isFunction(msgHide = field && field.msgHide || opt.msgHide) ) {
  7966. msgHide.call(me, $msgbox, msgOpt.type);
  7967. } else {
  7968. $msgbox[0].style.display = 'none';
  7969. $msgbox[0].innerHTML = '';
  7970. }
  7971. },
  7972. /**
  7973. * Get field information
  7974. *
  7975. * @method getField
  7976. * @param {Element} - input element
  7977. * @return {Object} field
  7978. */
  7979. getField: function(el, must) {
  7980. var me = this,
  7981. key,
  7982. field;
  7983. if (isString(el)) {
  7984. key = el;
  7985. el = undefined;
  7986. } else {
  7987. if (attr(el, DATA_RULE)) {
  7988. return me._parse(el);
  7989. }
  7990. if (el.id && '#' + el.id in me.fields || !el.name) {
  7991. key = '#' + el.id;
  7992. } else {
  7993. key = el.name;
  7994. }
  7995. }
  7996. if ( (field = me.fields[key]) || must && (field = new me.Field(key)) ) {
  7997. field.element = el;
  7998. }
  7999. return field;
  8000. },
  8001. /**
  8002. * Config a field
  8003. *
  8004. * @method: setField
  8005. * @param {String} key
  8006. * @param {Object} obj
  8007. */
  8008. setField: function(key, obj) {
  8009. var fields = {};
  8010. if (!key) return;
  8011. // update this field
  8012. if (isString(key)) {
  8013. fields[key] = obj;
  8014. }
  8015. // update fields
  8016. else {
  8017. fields = key;
  8018. }
  8019. this._initFields(fields);
  8020. },
  8021. /**
  8022. * Detecting whether the form is valid
  8023. *
  8024. * @method isFormValid
  8025. * @return {Boolean}
  8026. */
  8027. isFormValid: function() {
  8028. var fields = this.fields, k, field;
  8029. for (k in fields) {
  8030. field = fields[k];
  8031. if (!field._rules || !field.required && !field.must && !field.value) continue;
  8032. if (!field.isValid) return false;
  8033. }
  8034. return true;
  8035. },
  8036. /**
  8037. * Prevent submission form
  8038. *
  8039. * @method holdSubmit
  8040. * @param {Boolean} hold - If set to false, will release the hold
  8041. */
  8042. holdSubmit: function(hold) {
  8043. this.submiting = hold === undefined || hold;
  8044. },
  8045. /**
  8046. * Clean validation messages
  8047. *
  8048. * @method cleanUp
  8049. */
  8050. cleanUp: function() {
  8051. this._reset(1);
  8052. },
  8053. /**
  8054. * Destroy the validation
  8055. *
  8056. * @method destroy
  8057. */
  8058. destroy: function() {
  8059. this._reset(1);
  8060. this.$el.off(CLS_NS).removeData(NS);
  8061. attr(this.$el[0], NOVALIDATE, this._NOVALIDATE);
  8062. }
  8063. };
  8064. /**
  8065. * Create Field Factory
  8066. *
  8067. * @class
  8068. * @param {Object} context
  8069. * @return {Function} Factory
  8070. */
  8071. function _createFieldFactory(context) {
  8072. function FieldFactory() {
  8073. var options = this.options;
  8074. for (var i in options) {
  8075. if (i in fieldDefaults) this[i] = options[i];
  8076. }
  8077. $.extend(this, {
  8078. _valHook: function() {
  8079. return this.element.contentEditable === 'true' ? 'text' : 'val';
  8080. },
  8081. getValue: function() {
  8082. var elem = this.element;
  8083. if (elem.type === 'number' && elem.validity && elem.validity.badInput) {
  8084. return 'NaN';
  8085. }
  8086. return $(elem)[this._valHook()]();
  8087. },
  8088. setValue: function(value) {
  8089. $(this.element)[this._valHook()](this.value = value);
  8090. },
  8091. // Get a range of validation messages
  8092. getRangeMsg: function(value, params, suffix) {
  8093. if (!params) return;
  8094. var me = this,
  8095. msg = me.messages[me._r] || '',
  8096. result,
  8097. p = params[0].split('~'),
  8098. e = params[1] === 'false',
  8099. a = p[0],
  8100. b = p[1],
  8101. c = 'rg',
  8102. args = [''],
  8103. isNumber = trim(value) && +value === +value;
  8104. function compare(large, small) {
  8105. return !e ? large >= small : large > small;
  8106. }
  8107. if (p.length === 2) {
  8108. if (a && b) {
  8109. if (isNumber && compare(value, +a) && compare(+b, value)) {
  8110. result = true;
  8111. }
  8112. args = args.concat(p);
  8113. c = e ? 'gtlt' : 'rg';
  8114. }
  8115. else if (a && !b) {
  8116. if (isNumber && compare(value, +a)) {
  8117. result = true;
  8118. }
  8119. args.push(a);
  8120. c = e ? 'gt' : 'gte';
  8121. }
  8122. else if (!a && b) {
  8123. if (isNumber && compare(+b, value)) {
  8124. result = true;
  8125. }
  8126. args.push(b);
  8127. c = e ? 'lt' : 'lte';
  8128. }
  8129. }
  8130. else {
  8131. if (value === +a) {
  8132. result = true;
  8133. }
  8134. args.push(a);
  8135. c = 'eq';
  8136. }
  8137. if (msg) {
  8138. if (suffix && msg[c + suffix]) {
  8139. c += suffix;
  8140. }
  8141. args[0] = msg[c];
  8142. }
  8143. return result || me._rules && ( me._rules[me._i].msg = me.renderMsg.apply(null, args) );
  8144. },
  8145. // Render message template
  8146. renderMsg: function() {
  8147. var args = arguments,
  8148. tpl = args[0],
  8149. i = args.length;
  8150. if (!tpl) return;
  8151. while (--i) {
  8152. tpl = tpl.replace('{' + i + '}', args[i]);
  8153. }
  8154. return tpl;
  8155. }
  8156. });
  8157. }
  8158. function Field(key, obj, oldField) {
  8159. this.key = key;
  8160. this.validator = context;
  8161. $.extend(this, oldField, obj);
  8162. }
  8163. FieldFactory.prototype = context;
  8164. Field.prototype = new FieldFactory();
  8165. return Field;
  8166. }
  8167. /**
  8168. * Create Rules
  8169. *
  8170. * @class
  8171. * @param {Object} obj rules
  8172. * @param {Object} context context
  8173. */
  8174. function Rules(obj, context) {
  8175. if (!isObject(obj)) return;
  8176. var k, that = context ? context === true ? this : context : Rules.prototype;
  8177. for (k in obj) {
  8178. if (_checkRuleName(k)) {
  8179. that[k] = _getRule(obj[k]);
  8180. }
  8181. }
  8182. }
  8183. /**
  8184. * Create Messages
  8185. *
  8186. * @class
  8187. * @param {Object} obj rules
  8188. * @param {Object} context context
  8189. */
  8190. function Messages(obj, context) {
  8191. if (!isObject(obj)) return;
  8192. var k, that = context ? context === true ? this : context : Messages.prototype;
  8193. for (k in obj) {
  8194. that[k] = obj[k];
  8195. }
  8196. }
  8197. // Rule converted factory
  8198. function _getRule(fn) {
  8199. switch ($.type(fn)) {
  8200. case 'function':
  8201. return fn;
  8202. case 'array':
  8203. var f = function() {
  8204. return fn[0].test(this.value) || fn[1] || false;
  8205. };
  8206. f.msg = fn[1];
  8207. return f;
  8208. case 'regexp':
  8209. return function() {
  8210. return fn.test(this.value);
  8211. };
  8212. }
  8213. }
  8214. // Get instance by an element
  8215. function _getInstance(el) {
  8216. var wrap, k, options;
  8217. if (!el || !el.tagName) return;
  8218. switch (el.tagName) {
  8219. case 'INPUT':
  8220. case 'SELECT':
  8221. case 'TEXTAREA':
  8222. case 'BUTTON':
  8223. case 'FIELDSET':
  8224. wrap = el.form || $(el).closest('.' + CLS_WRAPPER);
  8225. break;
  8226. case 'FORM':
  8227. wrap = el;
  8228. break;
  8229. default:
  8230. wrap = $(el).closest('.' + CLS_WRAPPER);
  8231. }
  8232. for (k in preinitialized) {
  8233. if ($(wrap).is(k)) {
  8234. options = preinitialized[k];
  8235. break;
  8236. }
  8237. }
  8238. return $(wrap).data(NS) || $(wrap)[NS](options).data(NS);
  8239. }
  8240. // Get custom rules on the node
  8241. function _getDataRule(el, method) {
  8242. var fn = trim(attr(el, DATA_RULE + '-' + method));
  8243. if ( fn && (fn = new Function('return ' + fn)()) ) {
  8244. return _getRule(fn);
  8245. }
  8246. }
  8247. // Get custom messages on the node
  8248. function _getDataMsg(el, field, m) {
  8249. var msg = field.msg,
  8250. item = field._r;
  8251. if ( isObject(msg) ) msg = msg[item];
  8252. if ( !isString(msg) ) {
  8253. msg = attr(el, DATA_MSG + '-' + item) || attr(el, DATA_MSG) || ( m ? isString(m) ? m : m[item] : '');
  8254. }
  8255. return msg;
  8256. }
  8257. // Get message position
  8258. function _getPos(str) {
  8259. var pos;
  8260. if (str) pos = rPos.exec(str);
  8261. return pos && pos[0];
  8262. }
  8263. // Check whether the element is checkbox or radio
  8264. function _checkable(el) {
  8265. return el.tagName === 'INPUT' && el.type === 'checkbox' || el.type === 'radio';
  8266. }
  8267. // Parse date string to timestamp
  8268. function _parseDate(str) {
  8269. return Date.parse(str.replace(/\.|\-/g, '/'));
  8270. }
  8271. // Rule name only allows alphanumeric characters and underscores
  8272. function _checkRuleName(name) {
  8273. return /^\w+$/.test(name);
  8274. }
  8275. // Translate field key to jQuery selector.
  8276. function _key2selector(key) {
  8277. var isID = key.charAt(0) === '#';
  8278. key = key.replace(/([:.{(|)}/\[\]])/g, '\\$1');
  8279. return isID ? key : '[name="'+ key +'"]:first';
  8280. }
  8281. // Fixed a issue cause by refresh page in IE.
  8282. $(window).on('beforeunload', function(){
  8283. this.focus();
  8284. });
  8285. $(document)
  8286. .on('click', ':submit', function(){
  8287. var input = this, attrNode;
  8288. if (!input.form) return;
  8289. // Shim for "formnovalidate"
  8290. attrNode = input.getAttributeNode('formnovalidate');
  8291. if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
  8292. novalidateonce = true;
  8293. }
  8294. })
  8295. // Automatic initializing form validation
  8296. .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
  8297. if ( attr(this, NOVALIDATE) !== null ) return;
  8298. var $form = $(this), me;
  8299. if ( !$form.data(NS) && (me = _getInstance(this)) ) {
  8300. if ( !$.isEmptyObject(me.fields) ) {
  8301. // Execute event handler
  8302. if (e.type === 'focusin') {
  8303. me._focusin(e);
  8304. } else {
  8305. me._submit(e);
  8306. }
  8307. } else {
  8308. attr(this, NOVALIDATE, NOVALIDATE);
  8309. $form.off(CLS_NS).removeData(NS);
  8310. }
  8311. }
  8312. });
  8313. new Messages({
  8314. fallback: 'This field is not valid.',
  8315. loading: 'Validating...'
  8316. });
  8317. // Built-in rules (global)
  8318. new Rules({
  8319. /**
  8320. * required
  8321. *
  8322. * @example:
  8323. required
  8324. required(jqSelector)
  8325. required(anotherRule)
  8326. required(not, -1)
  8327. required(from, .contact)
  8328. */
  8329. required: function(element, params) {
  8330. var me = this,
  8331. val = trim(me.value),
  8332. isValid = true;
  8333. if (params) {
  8334. if ( params.length === 1 ) {
  8335. if ( !_checkRuleName(params[0]) ) {
  8336. if (!val && !$(params[0], me.$el).length ) {
  8337. return null;
  8338. }
  8339. }
  8340. else if ( me.rules[params[0]] ) {
  8341. if ( !val && !me.test(element, params[0]) ) {
  8342. return null;
  8343. }
  8344. me._r = 'required'
  8345. }
  8346. }
  8347. else if ( params[0] === 'not' ) {
  8348. $.each(params.slice(1), function() {
  8349. return (isValid = val !== trim(this));
  8350. });
  8351. }
  8352. else if ( params[0] === 'from' ) {
  8353. var $elements = me.$el.find(params[1]),
  8354. VALIDATED = '_validated_',
  8355. ret;
  8356. isValid = $elements.filter(function(){
  8357. var field = me.getField(this);
  8358. return field && !!trim(field.getValue());
  8359. }).length >= (params[2] || 1);
  8360. if (isValid) {
  8361. if (!val) ret = null;
  8362. } else {
  8363. ret = _getDataMsg($elements[0], me) || false;
  8364. }
  8365. if ( !$(element).data(VALIDATED) ) {
  8366. $elements.data(VALIDATED, 1).each(function(){
  8367. if (element !== this) {
  8368. me._validate(this);
  8369. }
  8370. }).removeData(VALIDATED);
  8371. }
  8372. return ret;
  8373. }
  8374. }
  8375. return isValid && !!val;
  8376. },
  8377. /**
  8378. * integer
  8379. *
  8380. * @example:
  8381. integer
  8382. integer[+]
  8383. integer[+0]
  8384. integer[-]
  8385. integer[-0]
  8386. */
  8387. integer: function(element, params) {
  8388. var re, z = '0|',
  8389. p = '[1-9]\\d*',
  8390. key = params ? params[0] : '*';
  8391. switch (key) {
  8392. case '+':
  8393. re = p;
  8394. break;
  8395. case '-':
  8396. re = '-' + p;
  8397. break;
  8398. case '+0':
  8399. re = z + p;
  8400. break;
  8401. case '-0':
  8402. re = z + '-' + p;
  8403. break;
  8404. default:
  8405. re = z + '-?' + p;
  8406. }
  8407. re = '^(?:' + re + ')$';
  8408. return new RegExp(re).test(this.value) || (this.messages.integer && this.messages.integer[key]);
  8409. },
  8410. /**
  8411. * match another field
  8412. *
  8413. * @example:
  8414. match[password] Match the password field (two values ​​must be the same)
  8415. match[eq, password] Ditto
  8416. match[neq, count] The value must be not equal to the value of the count field
  8417. match[lt, count] The value must be less than the value of the count field
  8418. match[lte, count] The value must be less than or equal to the value of the count field
  8419. match[gt, count] The value must be greater than the value of the count field
  8420. match[gte, count] The value must be greater than or equal to the value of the count field
  8421. match[gte, startDate, date]
  8422. match[gte, startTime, time]
  8423. **/
  8424. match: function(element, params) {
  8425. if (!params) return;
  8426. var me = this,
  8427. isValid = true,
  8428. a, b,
  8429. key, msg, type = 'eq', parser,
  8430. selector2, elem2, field2;
  8431. if (params.length === 1) {
  8432. key = params[0];
  8433. } else {
  8434. type = params[0];
  8435. key = params[1];
  8436. }
  8437. selector2 = _key2selector(key);
  8438. elem2 = me.$el.find(selector2)[0];
  8439. // If the compared field is not exist
  8440. if (!elem2) return;
  8441. field2 = me.getField(elem2);
  8442. a = me.value;
  8443. b = field2.getValue();
  8444. if (!me._match) {
  8445. me.$el.on('valid'+CLS_NS_FIELD+CLS_NS, selector2, function(){
  8446. $(element).trigger('validate');
  8447. });
  8448. me._match = field2._match = 1;
  8449. }
  8450. // If both fields are blank
  8451. if (!me.required && a === '' && b === '') {
  8452. return null;
  8453. }
  8454. parser = params[2];
  8455. if (parser) {
  8456. if (/^date(time)?$/i.test(parser)) {
  8457. a = _parseDate(a);
  8458. b = _parseDate(b);
  8459. } else if (parser === 'time') {
  8460. a = +a.replace(/:/g, '');
  8461. b = +b.replace(/:/g, '');
  8462. }
  8463. }
  8464. // If the compared field is incorrect, we only ensure that this field is correct.
  8465. if (type !== 'eq' && !isNaN(+a) && isNaN(+b)) {
  8466. return true;
  8467. }
  8468. switch (type) {
  8469. case 'lt':
  8470. isValid = +a < +b; break;
  8471. case 'lte':
  8472. isValid = +a <= +b; break;
  8473. case 'gte':
  8474. isValid = +a >= +b; break;
  8475. case 'gt':
  8476. isValid = +a > +b; break;
  8477. case 'neq':
  8478. isValid = a !== b; break;
  8479. default:
  8480. isValid = a === b;
  8481. }
  8482. return isValid || (
  8483. isObject(me.messages.match)
  8484. && me.messages.match[type].replace( '{1}', me._getDisplay( elem2, field2.display || key ) )
  8485. );
  8486. },
  8487. /**
  8488. * range numbers
  8489. *
  8490. * @example:
  8491. range[0~99] Number 0-99
  8492. range[0~] Number greater than or equal to 0
  8493. range[~100] Number less than or equal to 100
  8494. **/
  8495. range: function(element, params) {
  8496. return this.getRangeMsg(this.value, params);
  8497. },
  8498. /**
  8499. * how many checkbox or radio inputs that checked
  8500. *
  8501. * @example:
  8502. checked; no empty, same to required
  8503. checked[1~3] 1-3 items
  8504. checked[1~] greater than 1 item
  8505. checked[~3] less than 3 items
  8506. checked[3] 3 items
  8507. **/
  8508. checked: function(element, params) {
  8509. if ( !_checkable(element) ) return;
  8510. var me = this,
  8511. elem, count;
  8512. if (element.name) {
  8513. count = me.$el.find('input[name="' + element.name + '"]').filter(function() {
  8514. var el = this;
  8515. if (!elem && _checkable(el)) elem = el;
  8516. return !el.disabled && el.checked;
  8517. }).length;
  8518. } else {
  8519. elem = element;
  8520. count = elem.checked;
  8521. }
  8522. if (params) {
  8523. return me.getRangeMsg(count, params);
  8524. } else {
  8525. return !!count || _getDataMsg(elem, me, '') || me.messages.required || false;
  8526. }
  8527. },
  8528. /**
  8529. * length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
  8530. *
  8531. * @example:
  8532. length[6~16] 6-16 characters
  8533. length[6~] Greater than 6 characters
  8534. length[~16] Less than 16 characters
  8535. length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
  8536. **/
  8537. length: function(element, params) {
  8538. var value = this.value,
  8539. len = (params[1] === 'true' ? value.replace(rDoubleBytes, 'xx') : value).length;
  8540. return this.getRangeMsg(len, params, (params[1] ? '_2' : ''));
  8541. },
  8542. /**
  8543. * remote validation
  8544. *
  8545. * @description
  8546. * remote([get:]url [, name1, [name2 ...]]);
  8547. * Adaptation three kinds of results (Front for the successful, followed by a failure):
  8548. 1. text:
  8549. '' 'Error Message'
  8550. 2. json:
  8551. {"ok": ""} {"error": "Error Message"}
  8552. 3. json wrapper:
  8553. {"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
  8554. * @example
  8555. The simplest: remote(path/to/server);
  8556. With parameters: remote(path/to/server, name1, name2, ...);
  8557. By GET: remote(get:path/to/server, name1, name2, ...);
  8558. Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
  8559. Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)
  8560. CORS remote(cors:path/to/server)
  8561. JSONP remote(jsonp:path/to/server)
  8562. */
  8563. remote: function(element, params) {
  8564. if (!params) return;
  8565. var me = this,
  8566. arr = rAjaxType.exec(params[0]),
  8567. rule = me._rules[me._i],
  8568. data = {},
  8569. queryString = '',
  8570. url = arr[3],
  8571. type = arr[2] || 'POST', // GET / POST
  8572. rType = (arr[1]||'').toLowerCase(), // CORS / JSONP
  8573. dataType;
  8574. rule.must = true;
  8575. data[element.name] = me.value;
  8576. // There are extra fields
  8577. if (params[1]) {
  8578. $.map(params.slice(1), function(name) {
  8579. var arr, key;
  8580. if (~name.indexOf('=')) {
  8581. queryString += '&' + name;
  8582. } else {
  8583. arr = name.split(':');
  8584. name = trim(arr[0]);
  8585. key = trim(arr[1]) || name;
  8586. data[ name ] = me.$el.find( _key2selector(key) ).val();
  8587. }
  8588. });
  8589. }
  8590. data = $.param(data) + queryString;
  8591. if (!me.must && rule.data && rule.data === data) {
  8592. return rule.result;
  8593. }
  8594. // Cross-domain request, force jsonp dataType
  8595. if (rType !== 'cors' && /^https?:/.test(url) && !~url.indexOf(location.host)) {
  8596. dataType = 'jsonp';
  8597. }
  8598. // Asynchronous validation need return jqXHR objects
  8599. return $.ajax({
  8600. url: url,
  8601. type: type,
  8602. data: data,
  8603. dataType: dataType
  8604. });
  8605. },
  8606. /**
  8607. * filter characters, direct filtration without prompting error (support custom regular expressions)
  8608. *
  8609. * @example
  8610. * filter filtering unsafe characters
  8611. * filter(regexp) filtering the "regexp" matched characters
  8612. */
  8613. filter: function(element, params) {
  8614. var value = this.value,
  8615. temp = value.replace( params ? (new RegExp('[' + params[0] + ']', 'gm')) : rUnsafe, '' );
  8616. if (temp !== value) this.setValue(temp);
  8617. }
  8618. });
  8619. /**
  8620. * Config global options
  8621. *
  8622. * @static config
  8623. * @param {Object} options
  8624. */
  8625. Validator.config = function(key, value) {
  8626. if (isObject(key)) {
  8627. $.each(key, _config);
  8628. }
  8629. else if (isString(key)) {
  8630. _config(key, value);
  8631. }
  8632. function _config(k, o) {
  8633. if (k === 'rules') {
  8634. new Rules(o);
  8635. }
  8636. else if (k === 'messages') {
  8637. new Messages(o);
  8638. }
  8639. else if (k in fieldDefaults) {
  8640. fieldDefaults[k] = o;
  8641. }
  8642. else {
  8643. defaults[k] = o;
  8644. }
  8645. }
  8646. };
  8647. /**
  8648. * Config themes
  8649. *
  8650. * @static setTheme
  8651. * @param {String|Object} name
  8652. * @param {Object} obj
  8653. * @example
  8654. .setTheme( themeName, themeOptions )
  8655. .setTheme( multiThemes )
  8656. */
  8657. Validator.setTheme = function(name, obj) {
  8658. if ( isObject(name) ) {
  8659. $.extend(true, themes, name);
  8660. }
  8661. else if ( isString(name) && isObject(obj) ) {
  8662. themes[name] = $.extend(themes[name], obj);
  8663. }
  8664. };
  8665. /**
  8666. * Resource loader
  8667. *
  8668. * @static load
  8669. * @param {String} str
  8670. * @example
  8671. .load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css
  8672. .load('local=zh-CN&css=') // load: local/zh-CN.js
  8673. .load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css
  8674. .load('local') // dito
  8675. */
  8676. Validator.load = function(str) {
  8677. if (!str) return;
  8678. var doc = document,
  8679. params = {},
  8680. node = doc.scripts[0],
  8681. dir, el, ONLOAD;
  8682. str.replace(/([^?=&]+)=([^&#]*)/g, function(m, key, value){
  8683. params[key] = value;
  8684. });
  8685. dir = params.dir || Validator.dir;
  8686. if (!Validator.css && params.css !== '') {
  8687. el = doc.createElement('link');
  8688. el.rel = 'stylesheet';
  8689. el.href = Validator.css = dir + 'jquery.validator.css';
  8690. node.parentNode.insertBefore(el, node);
  8691. }
  8692. if (!Validator.local && ~str.indexOf('local') && params.local !== '') {
  8693. Validator.local = (params.local || doc.documentElement.lang || 'en').replace('_','-');
  8694. Validator.pending = 1;
  8695. el = doc.createElement('script');
  8696. el.src = dir + 'local/' + Validator.local + '.js';
  8697. ONLOAD = 'onload' in el ? 'onload' : 'onreadystatechange';
  8698. el[ONLOAD] = function() {
  8699. if (!el.readyState || /loaded|complete/.test(el.readyState)) {
  8700. el = el[ONLOAD] = null;
  8701. delete Validator.pending;
  8702. $(window).triggerHandler('validatorready');
  8703. }
  8704. };
  8705. node.parentNode.insertBefore(el, node);
  8706. }
  8707. };
  8708. // Auto loading resources
  8709. (function(){
  8710. var scripts = document.scripts,
  8711. i = scripts.length, node, arr,
  8712. re = /(.*validator(?:\.min)?.js)(\?.*(?:local|css|dir)(?:=[\w\-]*)?)?/;
  8713. while (i-- && !arr) {
  8714. node = scripts[i];
  8715. arr = (node.hasAttribute ? node.src : node.getAttribute('src',4)||'').match(re);
  8716. }
  8717. if (!arr) return;
  8718. Validator.dir = arr[1].split('/').slice(0, -1).join('/')+'/';
  8719. Validator.load(arr[2]);
  8720. })();
  8721. return $[NS] = Validator;
  8722. }));
  8723. /*********************************
  8724. * Themes, rules, and i18n support
  8725. * Locale: Chinese; 中文
  8726. *********************************/
  8727. (function(factory) {
  8728. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  8729. typeof define === 'function' && define.amd ? define('validator-lang',['jquery'], factory) :
  8730. factory(jQuery);
  8731. }(function($) {
  8732. /* Global configuration
  8733. */
  8734. $.validator.config({
  8735. //stopOnError: true,
  8736. //focusCleanup: true,
  8737. //theme: 'yellow_right',
  8738. //timely: 2,
  8739. // Custom rules
  8740. rules: {
  8741. digits: [/^\d+$/, "请填写数字"]
  8742. ,letters: [/^[a-z]+$/i, "请填写字母"]
  8743. ,date: [/^\d{4}-\d{2}-\d{2}$/, "请填写有效的日期,格式:yyyy-mm-dd"]
  8744. ,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请填写有效的时间,00:00到23:59之间"]
  8745. ,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "请填写有效的邮箱"]
  8746. ,url: [/^(https?|s?ftp):\/\/\S+$/i, "请填写有效的网址"]
  8747. ,qq: [/^[1-9]\d{4,}$/, "请填写有效的QQ号"]
  8748. ,IDcard: [/^\d{6}(19|2\d)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)?$/, "请填写正确的身份证号码"]
  8749. ,tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "请填写有效的电话号码"]
  8750. ,mobile: [/^1[3-9]\d{9}$/, "请填写有效的手机号"]
  8751. ,zipcode: [/^\d{6}$/, "请检查邮政编码格式"]
  8752. ,chinese: [/^[\u0391-\uFFE5]+$/, "请填写中文字符"]
  8753. ,username: [/^\w{3,12}$/, "请填写3-12位数字、字母、下划线"]
  8754. ,password: [/^[\S]{6,16}$/, "请填写6-16位字符,不能包含空格"]
  8755. ,accept: function (element, params){
  8756. if (!params) return true;
  8757. var ext = params[0],
  8758. value = $(element).val();
  8759. return (ext === '*') ||
  8760. (new RegExp(".(?:" + ext + ")$", "i")).test(value) ||
  8761. this.renderMsg("只接受{1}后缀的文件", ext.replace(/\|/g, ','));
  8762. }
  8763. },
  8764. // Default error messages
  8765. messages: {
  8766. 0: "此处",
  8767. fallback: "{0}格式不正确",
  8768. loading: "正在验证...",
  8769. error: "网络异常",
  8770. timeout: "请求超时",
  8771. required: "{0}不能为空",
  8772. remote: "{0}已被使用",
  8773. integer: {
  8774. '*': "请填写整数",
  8775. '+': "请填写正整数",
  8776. '+0': "请填写正整数或0",
  8777. '-': "请填写负整数",
  8778. '-0': "请填写负整数或0"
  8779. },
  8780. match: {
  8781. eq: "{0}与{1}不一致",
  8782. neq: "{0}与{1}不能相同",
  8783. lt: "{0}必须小于{1}",
  8784. gt: "{0}必须大于{1}",
  8785. lte: "{0}不能大于{1}",
  8786. gte: "{0}不能小于{1}"
  8787. },
  8788. range: {
  8789. rg: "请填写{1}到{2}的数",
  8790. gte: "请填写不小于{1}的数",
  8791. lte: "请填写最大{1}的数",
  8792. gtlt: "请填写{1}到{2}之间的数",
  8793. gt: "请填写大于{1}的数",
  8794. lt: "请填写小于{1}的数"
  8795. },
  8796. checked: {
  8797. eq: "请选择{1}项",
  8798. rg: "请选择{1}到{2}项",
  8799. gte: "请至少选择{1}项",
  8800. lte: "请最多选择{1}项"
  8801. },
  8802. length: {
  8803. eq: "请填写{1}个字符",
  8804. rg: "请填写{1}到{2}个字符",
  8805. gte: "请至少填写{1}个字符",
  8806. lte: "请最多填写{1}个字符",
  8807. eq_2: "",
  8808. rg_2: "",
  8809. gte_2: "",
  8810. lte_2: ""
  8811. }
  8812. }
  8813. });
  8814. /* Themes
  8815. */
  8816. var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
  8817. $.validator.setTheme({
  8818. 'simple_right': {
  8819. formClass: 'n-simple',
  8820. msgClass: 'n-right'
  8821. },
  8822. 'simple_bottom': {
  8823. formClass: 'n-simple',
  8824. msgClass: 'n-bottom'
  8825. },
  8826. 'yellow_top': {
  8827. formClass: 'n-yellow',
  8828. msgClass: 'n-top',
  8829. msgArrow: TPL_ARROW
  8830. },
  8831. 'yellow_right': {
  8832. formClass: 'n-yellow',
  8833. msgClass: 'n-right',
  8834. msgArrow: TPL_ARROW
  8835. },
  8836. 'yellow_right_effect': {
  8837. formClass: 'n-yellow',
  8838. msgClass: 'n-right',
  8839. msgArrow: TPL_ARROW,
  8840. msgShow: function($msgbox, type){
  8841. var $el = $msgbox.children();
  8842. if ($el.is(':animated')) return;
  8843. if (type === 'error') {
  8844. $el.css({left: '20px', opacity: 0})
  8845. .delay(100).show().stop()
  8846. .animate({left: '-4px', opacity: 1}, 150)
  8847. .animate({left: '3px'}, 80)
  8848. .animate({left: 0}, 80);
  8849. } else {
  8850. $el.css({left: 0, opacity: 1}).fadeIn(200);
  8851. }
  8852. },
  8853. msgHide: function($msgbox, type){
  8854. var $el = $msgbox.children();
  8855. $el.stop().delay(100).show()
  8856. .animate({left: '20px', opacity: 0}, 300, function(){
  8857. $msgbox.hide();
  8858. });
  8859. }
  8860. }
  8861. });
  8862. }));
  8863. define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], function ($, undefined, Upload, Validator, undefined) {
  8864. var Form = {
  8865. config: {
  8866. fieldlisttpl: '<dd class="form-inline"><input type="text" name="<%=name%>[<%=index%>][key]" class="form-control" value="<%=row.key%>" size="10" /> <input type="text" name="<%=name%>[<%=index%>][value]" class="form-control" value="<%=row.value%>" /> <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span></dd>'
  8867. },
  8868. events: {
  8869. validator: function (form, success, error, submit) {
  8870. if (!form.is("form"))
  8871. return;
  8872. //绑定表单事件
  8873. form.validator($.extend({
  8874. validClass: 'has-success',
  8875. invalidClass: 'has-error',
  8876. bindClassTo: '.form-group',
  8877. formClass: 'n-default n-bootstrap',
  8878. msgClass: 'n-right',
  8879. stopOnError: true,
  8880. display: function (elem) {
  8881. return $(elem).closest('.form-group').find(".control-label").text().replace(/\:/, '');
  8882. },
  8883. dataFilter: function (data) {
  8884. if (data.code === 1) {
  8885. return data.msg ? {"ok": data.msg} : '';
  8886. } else {
  8887. return data.msg;
  8888. }
  8889. },
  8890. target: function (input) {
  8891. var target = $(input).data("target");
  8892. if (target && $(target).size() > 0) {
  8893. return $(target);
  8894. }
  8895. var $formitem = $(input).closest('.form-group'),
  8896. $msgbox = $formitem.find('span.msg-box');
  8897. if (!$msgbox.length) {
  8898. return [];
  8899. }
  8900. return $msgbox;
  8901. },
  8902. valid: function (ret) {
  8903. var that = this, submitBtn = $(".layer-footer [type=submit]", form);
  8904. that.holdSubmit(true);
  8905. submitBtn.addClass("disabled");
  8906. //验证通过提交表单
  8907. var submitResult = Form.api.submit($(ret), function (data, ret) {
  8908. that.holdSubmit(false);
  8909. submitBtn.removeClass("disabled");
  8910. if (false === $(this).triggerHandler("success.form", [data, ret])) {
  8911. return false;
  8912. }
  8913. if (typeof success === 'function') {
  8914. if (false === success.call($(this), data, ret)) {
  8915. return false;
  8916. }
  8917. }
  8918. //提示及关闭当前窗口
  8919. var msg = ret.hasOwnProperty("msg") && ret.msg !== "" ? ret.msg : __('Operation completed');
  8920. parent.Toastr.success(msg);
  8921. parent.$(".btn-refresh").trigger("click");
  8922. var index = parent.Layer.getFrameIndex(window.name);
  8923. parent.Layer.close(index);
  8924. return false;
  8925. }, function (data, ret) {
  8926. that.holdSubmit(false);
  8927. if (false === $(this).triggerHandler("error.form", [data, ret])) {
  8928. return false;
  8929. }
  8930. submitBtn.removeClass("disabled");
  8931. if (typeof error === 'function') {
  8932. if (false === error.call($(this), data, ret)) {
  8933. return false;
  8934. }
  8935. }
  8936. }, submit);
  8937. //如果提交失败则释放锁定
  8938. if (!submitResult) {
  8939. that.holdSubmit(false);
  8940. submitBtn.removeClass("disabled");
  8941. }
  8942. return false;
  8943. }
  8944. }, form.data("validator-options") || {}));
  8945. //移除提交按钮的disabled类
  8946. $(".layer-footer [type=submit],.fixed-footer [type=submit],.normal-footer [type=submit]", form).removeClass("disabled");
  8947. //自定义关闭按钮事件
  8948. form.on("click", ".layer-close", function () {
  8949. var index = parent.Layer.getFrameIndex(window.name);
  8950. parent.Layer.close(index);
  8951. return false;
  8952. });
  8953. },
  8954. selectpicker: function (form) {
  8955. //绑定select元素事件
  8956. if ($(".selectpicker", form).size() > 0) {
  8957. require(['bootstrap-select', 'bootstrap-select-lang'], function () {
  8958. $('.selectpicker', form).selectpicker();
  8959. $(form).on("reset", function () {
  8960. setTimeout(function () {
  8961. $('.selectpicker').selectpicker('refresh').trigger("change");
  8962. }, 1);
  8963. });
  8964. });
  8965. }
  8966. },
  8967. selectpage: function (form) {
  8968. //绑定selectpage元素事件
  8969. if ($(".selectpage", form).size() > 0) {
  8970. require(['selectpage'], function () {
  8971. $('.selectpage', form).selectPage({
  8972. eAjaxSuccess: function (data) {
  8973. data.list = typeof data.rows !== 'undefined' ? data.rows : (typeof data.list !== 'undefined' ? data.list : []);
  8974. data.totalRow = typeof data.total !== 'undefined' ? data.total : (typeof data.totalRow !== 'undefined' ? data.totalRow : data.list.length);
  8975. return data;
  8976. }
  8977. });
  8978. });
  8979. //给隐藏的元素添加上validate验证触发事件
  8980. $(document).on("change", ".sp_hidden", function () {
  8981. $(this).trigger("validate");
  8982. });
  8983. $(document).on("change", ".sp_input", function () {
  8984. $(this).closest(".sp_container").find(".sp_hidden").trigger("change");
  8985. });
  8986. $(form).on("reset", function () {
  8987. setTimeout(function () {
  8988. $('.selectpage', form).selectPageClear();
  8989. }, 1);
  8990. });
  8991. }
  8992. },
  8993. cxselect: function (form) {
  8994. //绑定cxselect元素事件
  8995. if ($("[data-toggle='cxselect']", form).size() > 0) {
  8996. require(['cxselect'], function () {
  8997. $.cxSelect.defaults.jsonName = 'name';
  8998. $.cxSelect.defaults.jsonValue = 'value';
  8999. $.cxSelect.defaults.jsonSpace = 'data';
  9000. $("[data-toggle='cxselect']", form).cxSelect();
  9001. });
  9002. }
  9003. },
  9004. citypicker: function (form) {
  9005. //绑定城市远程插件
  9006. if ($("[data-toggle='city-picker']", form).size() > 0) {
  9007. require(['citypicker'], function () {
  9008. $(form).on("reset", function () {
  9009. setTimeout(function () {
  9010. $("[data-toggle='city-picker']").citypicker('refresh');
  9011. }, 1);
  9012. });
  9013. });
  9014. }
  9015. },
  9016. datetimepicker: function (form) {
  9017. //绑定日期时间元素事件
  9018. if ($(".datetimepicker", form).size() > 0) {
  9019. require(['bootstrap-datetimepicker'], function () {
  9020. var options = {
  9021. format: 'YYYY-MM-DD HH:mm:ss',
  9022. icons: {
  9023. time: 'fa fa-clock-o',
  9024. date: 'fa fa-calendar',
  9025. up: 'fa fa-chevron-up',
  9026. down: 'fa fa-chevron-down',
  9027. previous: 'fa fa-chevron-left',
  9028. next: 'fa fa-chevron-right',
  9029. today: 'fa fa-history',
  9030. clear: 'fa fa-trash',
  9031. close: 'fa fa-remove'
  9032. },
  9033. showTodayButton: true,
  9034. showClose: true
  9035. };
  9036. $('.datetimepicker', form).parent().css('position', 'relative');
  9037. $('.datetimepicker', form).datetimepicker(options).on('dp.change', function (e) {
  9038. $(this, document).trigger("changed");
  9039. });
  9040. });
  9041. }
  9042. },
  9043. daterangepicker: function (form) {
  9044. //绑定日期时间元素事件
  9045. if ($(".datetimerange", form).size() > 0) {
  9046. require(['bootstrap-daterangepicker'], function () {
  9047. var ranges = {};
  9048. ranges[__('Today')] = [Moment().startOf('day'), Moment().endOf('day')];
  9049. ranges[__('Yesterday')] = [Moment().subtract(1, 'days').startOf('day'), Moment().subtract(1, 'days').endOf('day')];
  9050. ranges[__('Last 7 Days')] = [Moment().subtract(6, 'days').startOf('day'), Moment().endOf('day')];
  9051. ranges[__('Last 30 Days')] = [Moment().subtract(29, 'days').startOf('day'), Moment().endOf('day')];
  9052. ranges[__('This Month')] = [Moment().startOf('month'), Moment().endOf('month')];
  9053. ranges[__('Last Month')] = [Moment().subtract(1, 'month').startOf('month'), Moment().subtract(1, 'month').endOf('month')];
  9054. var options = {
  9055. timePicker: false,
  9056. autoUpdateInput: false,
  9057. timePickerSeconds: true,
  9058. timePicker24Hour: true,
  9059. autoApply: true,
  9060. locale: {
  9061. format: 'YYYY-MM-DD HH:mm:ss',
  9062. customRangeLabel: __("Custom Range"),
  9063. applyLabel: __("Apply"),
  9064. cancelLabel: __("Clear"),
  9065. },
  9066. ranges: ranges,
  9067. };
  9068. var origincallback = function (start, end) {
  9069. $(this.element).val(start.format(this.locale.format) + " - " + end.format(this.locale.format));
  9070. $(this.element).trigger('blur');
  9071. };
  9072. $(".datetimerange", form).each(function () {
  9073. var callback = typeof $(this).data('callback') == 'function' ? $(this).data('callback') : origincallback;
  9074. $(this).on('apply.daterangepicker', function (ev, picker) {
  9075. callback.call(picker, picker.startDate, picker.endDate);
  9076. });
  9077. $(this).on('cancel.daterangepicker', function (ev, picker) {
  9078. $(this).val('').trigger('blur');
  9079. });
  9080. $(this).daterangepicker($.extend(true, options, $(this).data()), callback);
  9081. });
  9082. });
  9083. }
  9084. },
  9085. /**
  9086. * 绑定上传事件
  9087. * @param form
  9088. * @deprecated Use faupload instead.
  9089. */
  9090. plupload: function (form) {
  9091. Form.events.faupload(form);
  9092. },
  9093. /**
  9094. * 绑定上传事件
  9095. * @param form
  9096. */
  9097. faupload: function (form) {
  9098. //绑定上传元素事件
  9099. if ($(".plupload,.faupload", form).size() > 0) {
  9100. Upload.api.upload($(".plupload,.faupload", form));
  9101. }
  9102. },
  9103. faselect: function (form) {
  9104. //绑定fachoose选择附件事件
  9105. if ($(".faselect,.fachoose", form).size() > 0) {
  9106. $(".faselect,.fachoose", form).off('click').on('click', function () {
  9107. var that = this;
  9108. var multiple = $(this).data("multiple") ? $(this).data("multiple") : false;
  9109. var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : '';
  9110. var admin_id = $(this).data("admin-id") ? $(this).data("admin-id") : '';
  9111. var user_id = $(this).data("user-id") ? $(this).data("user-id") : '';
  9112. var url = $(this).data("url") ? $(this).data("url") : (typeof Backend !== 'undefined' ? "general/attachment/select" : "user/attachment");
  9113. parent.Fast.api.open(url + "?element_id=" + $(this).attr("id") + "&multiple=" + multiple + "&mimetype=" + mimetype + "&admin_id=" + admin_id + "&user_id=" + user_id, __('Choose'), {
  9114. callback: function (data) {
  9115. var button = $("#" + $(that).attr("id"));
  9116. var maxcount = $(button).data("maxcount");
  9117. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  9118. maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
  9119. if (input_id && data.multiple) {
  9120. var urlArr = [];
  9121. var inputObj = $("#" + input_id);
  9122. var value = $.trim(inputObj.val());
  9123. if (value !== "") {
  9124. urlArr.push(inputObj.val());
  9125. }
  9126. urlArr.push(data.url)
  9127. var result = urlArr.join(",");
  9128. if (maxcount > 0) {
  9129. var nums = value === '' ? 0 : value.split(/\,/).length;
  9130. var files = data.url !== "" ? data.url.split(/\,/) : [];
  9131. var remains = maxcount - nums;
  9132. if (files.length > remains) {
  9133. Toastr.error(__('You can choose up to %d file%s', remains));
  9134. return false;
  9135. }
  9136. }
  9137. inputObj.val(result).trigger("change").trigger("validate");
  9138. } else {
  9139. $("#" + input_id).val(data.url).trigger("change").trigger("validate");
  9140. }
  9141. }
  9142. });
  9143. return false;
  9144. });
  9145. }
  9146. },
  9147. fieldlist: function (form) {
  9148. //绑定fieldlist
  9149. if ($(".fieldlist", form).size() > 0) {
  9150. require(['dragsort', 'template'], function (undefined, Template) {
  9151. //刷新隐藏textarea的值
  9152. var refresh = function (name) {
  9153. var data = {};
  9154. var textarea = $("textarea[name='" + name + "']", form);
  9155. var container = $(".fieldlist[data-name='" + name + "']");
  9156. var template = container.data("template");
  9157. $.each($("input,select,textarea", container).serializeArray(), function (i, j) {
  9158. var reg = /\[(\w+)\]\[(\w+)\]$/g;
  9159. var match = reg.exec(j.name);
  9160. if (!match)
  9161. return true;
  9162. match[1] = "x" + parseInt(match[1]);
  9163. if (typeof data[match[1]] == 'undefined') {
  9164. data[match[1]] = {};
  9165. }
  9166. data[match[1]][match[2]] = j.value;
  9167. });
  9168. var result = template ? [] : {};
  9169. $.each(data, function (i, j) {
  9170. if (j) {
  9171. if (!template) {
  9172. if (j.key != '') {
  9173. result[j.key] = j.value;
  9174. }
  9175. } else {
  9176. result.push(j);
  9177. }
  9178. }
  9179. });
  9180. textarea.val(JSON.stringify(result));
  9181. };
  9182. //监听文本框改变事件
  9183. $(document).on('change keyup changed', ".fieldlist input,.fieldlist textarea,.fieldlist select", function () {
  9184. refresh($(this).closest(".fieldlist").data("name"));
  9185. });
  9186. //追加控制
  9187. $(".fieldlist", form).on("click", ".btn-append,.append", function (e, row) {
  9188. var container = $(this).closest(".fieldlist");
  9189. var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
  9190. var index = container.data("index");
  9191. var name = container.data("name");
  9192. var template = container.data("template");
  9193. var data = container.data();
  9194. index = index ? parseInt(index) : 0;
  9195. container.data("index", index + 1);
  9196. row = row ? row : {};
  9197. var vars = {index: index, name: name, data: data, row: row};
  9198. var html = template ? Template(template, vars) : Template.render(Form.config.fieldlisttpl, vars);
  9199. $(html).attr("fieldlist-item", true).insertBefore($(tagName + ":last", container));
  9200. $(this).trigger("fa.event.appendfieldlist", $(this).closest(tagName).prev());
  9201. });
  9202. //移除控制
  9203. $(".fieldlist", form).on("click", ".btn-remove", function () {
  9204. var container = $(this).closest(".fieldlist");
  9205. var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
  9206. $(this).closest(tagName).remove();
  9207. refresh(container.data("name"));
  9208. });
  9209. //渲染数据&拖拽排序
  9210. $(".fieldlist", form).each(function () {
  9211. var container = this;
  9212. var tagName = $(this).data("tag") || ($(this).is("table") ? "tr" : "dd");
  9213. $(this).dragsort({
  9214. itemSelector: tagName,
  9215. dragSelector: ".btn-dragsort",
  9216. dragEnd: function () {
  9217. refresh($(this).closest(".fieldlist").data("name"));
  9218. },
  9219. placeHolderTemplate: $("<" + tagName + "/>")
  9220. });
  9221. var textarea = $("textarea[name='" + $(this).data("name") + "']", form);
  9222. if (textarea.val() == '') {
  9223. return true;
  9224. }
  9225. var template = $(this).data("template");
  9226. textarea.on("fa.event.refreshfieldlist", function () {
  9227. $("[fieldlist-item]", container).remove();
  9228. var json = {};
  9229. try {
  9230. json = JSON.parse($(this).val());
  9231. } catch (e) {
  9232. }
  9233. $.each(json, function (i, j) {
  9234. $(".btn-append,.append", container).trigger('click', template ? j : {
  9235. key: i, value: j
  9236. });
  9237. });
  9238. });
  9239. textarea.trigger("fa.event.refreshfieldlist");
  9240. });
  9241. });
  9242. }
  9243. },
  9244. switcher: function (form) {
  9245. form.on("click", "[data-toggle='switcher']", function () {
  9246. if ($(this).hasClass("disabled")) {
  9247. return false;
  9248. }
  9249. var switcher = $.proxy(function () {
  9250. var input = $(this).prev("input");
  9251. input = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : input;
  9252. if (input.size() > 0) {
  9253. var yes = $(this).data("yes");
  9254. var no = $(this).data("no");
  9255. if (input.val() == yes) {
  9256. input.val(no);
  9257. $("i", this).addClass("fa-flip-horizontal text-gray");
  9258. } else {
  9259. input.val(yes);
  9260. $("i", this).removeClass("fa-flip-horizontal text-gray");
  9261. }
  9262. input.trigger('change');
  9263. }
  9264. }, this);
  9265. if (typeof $(this).data("confirm") !== 'undefined') {
  9266. Layer.confirm($(this).data("confirm"), function (index) {
  9267. switcher();
  9268. Layer.close(index);
  9269. });
  9270. } else {
  9271. switcher();
  9272. }
  9273. return false;
  9274. });
  9275. },
  9276. bindevent: function (form) {
  9277. },
  9278. slider: function (form) {
  9279. if ($(".slider", form).size() > 0) {
  9280. require(['bootstrap-slider'], function () {
  9281. $('.slider').removeClass('hidden').css('width', function (index, value) {
  9282. return $(this).parents('.form-control').width();
  9283. }).slider().on('slide', function (ev) {
  9284. var data = $(this).data();
  9285. if (typeof data.unit !== 'undefined') {
  9286. $(this).parents('.form-control').siblings('.value').text(ev.value + data.unit);
  9287. }
  9288. });
  9289. });
  9290. }
  9291. }
  9292. },
  9293. api: {
  9294. submit: function (form, success, error, submit) {
  9295. if (form.size() === 0) {
  9296. Toastr.error("表单未初始化完成,无法提交");
  9297. return false;
  9298. }
  9299. if (typeof submit === 'function') {
  9300. if (false === submit.call(form, success, error)) {
  9301. return false;
  9302. }
  9303. }
  9304. var type = form.attr("method") ? form.attr("method").toUpperCase() : 'GET';
  9305. type = type && (type === 'GET' || type === 'POST') ? type : 'GET';
  9306. url = form.attr("action");
  9307. url = url ? url : location.href;
  9308. //修复当存在多选项元素时提交的BUG
  9309. var params = {};
  9310. var multipleList = $("[name$='[]']", form);
  9311. if (multipleList.size() > 0) {
  9312. var postFields = form.serializeArray().map(function (obj) {
  9313. return $(obj).prop("name");
  9314. });
  9315. $.each(multipleList, function (i, j) {
  9316. if (postFields.indexOf($(this).prop("name")) < 0) {
  9317. params[$(this).prop("name")] = '';
  9318. }
  9319. });
  9320. }
  9321. //调用Ajax请求方法
  9322. Fast.api.ajax({
  9323. type: type,
  9324. url: url,
  9325. data: form.serialize() + (Object.keys(params).length > 0 ? '&' + $.param(params) : ''),
  9326. dataType: 'json',
  9327. complete: function (xhr) {
  9328. var token = xhr.getResponseHeader('__token__');
  9329. if (token) {
  9330. $("input[name='__token__']").val(token);
  9331. }
  9332. }
  9333. }, function (data, ret) {
  9334. $('.form-group', form).removeClass('has-feedback has-success has-error');
  9335. if (data && typeof data === 'object') {
  9336. //刷新客户端token
  9337. if (typeof data.token !== 'undefined') {
  9338. $("input[name='__token__']").val(data.token);
  9339. }
  9340. //调用客户端事件
  9341. if (typeof data.callback !== 'undefined' && typeof data.callback === 'function') {
  9342. data.callback.call(form, data);
  9343. }
  9344. }
  9345. if (typeof success === 'function') {
  9346. if (false === success.call(form, data, ret)) {
  9347. return false;
  9348. }
  9349. }
  9350. }, function (data, ret) {
  9351. if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
  9352. $("input[name='__token__']").val(data.token);
  9353. }
  9354. if (typeof error === 'function') {
  9355. if (false === error.call(form, data, ret)) {
  9356. return false;
  9357. }
  9358. }
  9359. });
  9360. return true;
  9361. },
  9362. bindevent: function (form, success, error, submit) {
  9363. form = typeof form === 'object' ? form : $(form);
  9364. var events = Form.events;
  9365. events.bindevent(form);
  9366. events.validator(form, success, error, submit);
  9367. events.selectpicker(form);
  9368. events.daterangepicker(form);
  9369. events.selectpage(form);
  9370. events.cxselect(form);
  9371. events.citypicker(form);
  9372. events.datetimepicker(form);
  9373. events.faupload(form);
  9374. events.faselect(form);
  9375. events.fieldlist(form);
  9376. events.slider(form);
  9377. events.switcher(form);
  9378. },
  9379. custom: {}
  9380. },
  9381. };
  9382. return Form;
  9383. });
  9384. /**
  9385. * FastAdmin通用搜索
  9386. *
  9387. * @author: pppscn <35696959@qq.com>
  9388. * @update 2017-05-07 <https://gitee.com/pp/fastadmin>
  9389. *
  9390. * @author: Karson <karsonzhang@163.com>
  9391. * @update 2018-04-05 <https://gitee.com/karson/fastadmin>
  9392. */
  9393. !function ($) {
  9394. 'use strict';
  9395. var ColumnsForSearch = [];
  9396. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  9397. var initCommonSearch = function (pColumns, that) {
  9398. var vFormCommon = createFormCommon(pColumns, that);
  9399. var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden");
  9400. vModal += vFormCommon;
  9401. vModal += "</div>";
  9402. that.$container.prepend($(vModal));
  9403. that.$commonsearch = $(".commonsearch-table", that.$container);
  9404. var form = $("form.form-commonsearch", that.$commonsearch);
  9405. require(['form'], function (Form) {
  9406. Form.api.bindevent(form);
  9407. form.validator("destroy");
  9408. });
  9409. // 表单提交
  9410. form.on("submit", function (event) {
  9411. event.preventDefault();
  9412. that.onCommonSearch();
  9413. return false;
  9414. });
  9415. // 重置搜索
  9416. form.on("click", "button[type=reset]", function (event) {
  9417. form[0].reset();
  9418. setTimeout(function () {
  9419. that.onCommonSearch();
  9420. }, 0);
  9421. });
  9422. };
  9423. var createFormCommon = function (pColumns, that) {
  9424. // 如果有使用模板则直接返回模板的内容
  9425. if (that.options.searchFormTemplate) {
  9426. return Template(that.options.searchFormTemplate, {columns: pColumns, table: that});
  9427. }
  9428. var htmlForm = [];
  9429. htmlForm.push(sprintf('<form class="form-horizontal form-commonsearch" novalidate method="post" action="%s" >', that.options.actionForm));
  9430. htmlForm.push('<fieldset>');
  9431. if (that.options.titleForm.length > 0)
  9432. htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
  9433. htmlForm.push('<div class="row">');
  9434. for (var i in pColumns) {
  9435. var vObjCol = pColumns[i];
  9436. if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
  9437. var query = Fast.api.query(vObjCol.field);
  9438. var operate = Fast.api.query(vObjCol.field + "-operate");
  9439. var renderDefault = that.options.renderDefault && (typeof vObjCol.renderDefault == 'undefined' || vObjCol.renderDefault);
  9440. vObjCol.defaultValue = renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue);
  9441. vObjCol.operate = renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate);
  9442. ColumnsForSearch.push(vObjCol);
  9443. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  9444. htmlForm.push(sprintf('<label for="%s" class="control-label col-xs-4">%s</label>', vObjCol.field, vObjCol.title));
  9445. htmlForm.push('<div class="col-xs-8">');
  9446. vObjCol.operate = vObjCol.operate ? vObjCol.operate.toUpperCase() : '=';
  9447. htmlForm.push(sprintf('<input type="hidden" class="form-control operate" name="%s-operate" data-name="%s" value="%s" readonly>', vObjCol.field, vObjCol.field, vObjCol.operate));
  9448. var addClass = typeof vObjCol.addClass === 'undefined' ? (typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass) : 'form-control ' + vObjCol.addClass;
  9449. var extend = typeof vObjCol.extend === 'undefined' ? '' : vObjCol.extend;
  9450. var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style);
  9451. extend = typeof vObjCol.data !== 'undefined' && extend == '' ? vObjCol.data : extend;
  9452. extend = typeof vObjCol.autocomplete !== 'undefined' ? extend + ' autocomplete="' + (vObjCol.autocomplete === false || vObjCol.autocomplete === 'off' ? 'off' : 'on') + '"' : extend;
  9453. if (vObjCol.searchList) {
  9454. if (typeof vObjCol.searchList === 'function') {
  9455. htmlForm.push(vObjCol.searchList.call(this, vObjCol));
  9456. } else {
  9457. var optionList = [sprintf('<option value="">%s</option>', that.options.formatCommonChoose())];
  9458. if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') {
  9459. (function (vObjCol, that) {
  9460. $.when(vObjCol.searchList).done(function (ret) {
  9461. var searchList = [];
  9462. if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) {
  9463. searchList = ret.data.searchlist;
  9464. } else if (ret.constructor === Array || ret.constructor === Object) {
  9465. searchList = ret;
  9466. }
  9467. var optionList = createOptionList(searchList, vObjCol, that);
  9468. $("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).html(optionList.join('')).trigger("change");
  9469. });
  9470. })(vObjCol, that);
  9471. } else {
  9472. optionList = createOptionList(vObjCol.searchList, vObjCol, that);
  9473. }
  9474. htmlForm.push(sprintf('<select class="%s" name="%s" %s %s>%s</select>', addClass, vObjCol.field, style, extend, optionList.join('')));
  9475. }
  9476. } else {
  9477. var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder;
  9478. var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type;
  9479. var defaultValue = typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue;
  9480. if (/BETWEEN$/.test(vObjCol.operate)) {
  9481. var defaultValueArr = defaultValue.toString().match(/\|/) ? defaultValue.split('|') : ['', ''];
  9482. var placeholderArr = placeholder.toString().match(/\|/) ? placeholder.split('|') : [placeholder, placeholder];
  9483. htmlForm.push('<div class="row row-between">');
  9484. htmlForm.push(sprintf('<div class="col-xs-6"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s-min" data-index="%s" %s %s></div>', type, addClass, vObjCol.field, defaultValueArr[0], placeholderArr[0], vObjCol.field, i, style, extend));
  9485. htmlForm.push(sprintf('<div class="col-xs-6"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s-max" data-index="%s" %s %s></div>', type, addClass, vObjCol.field, defaultValueArr[1], placeholderArr[1], vObjCol.field, i, style, extend));
  9486. htmlForm.push('</div>');
  9487. } else {
  9488. htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s>', type, addClass, vObjCol.field, defaultValue, placeholder, vObjCol.field, i, style, extend));
  9489. }
  9490. }
  9491. htmlForm.push('</div>');
  9492. htmlForm.push('</div>');
  9493. }
  9494. }
  9495. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  9496. htmlForm.push(createFormBtn(that).join(''));
  9497. htmlForm.push('</div>');
  9498. htmlForm.push('</div>');
  9499. htmlForm.push('</fieldset>');
  9500. htmlForm.push('</form>');
  9501. return htmlForm.join('');
  9502. };
  9503. var createFormBtn = function (that) {
  9504. var htmlBtn = [];
  9505. var searchSubmit = that.options.formatCommonSubmitButton();
  9506. var searchReset = that.options.formatCommonResetButton();
  9507. htmlBtn.push('<div class="col-sm-8 col-xs-offset-4">');
  9508. htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" formnovalidate>%s</button> ', searchSubmit));
  9509. htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
  9510. htmlBtn.push('</div>');
  9511. return htmlBtn;
  9512. };
  9513. var createOptionList = function (searchList, vObjCol, that) {
  9514. var isArray = searchList.constructor === Array;
  9515. var optionList = [];
  9516. optionList.push(sprintf('<option value="">%s</option>', that.options.formatCommonChoose()));
  9517. $.each(searchList, function (key, value) {
  9518. if (value.constructor === Object) {
  9519. key = value.id;
  9520. value = value.name;
  9521. } else {
  9522. key = isArray ? value : key;
  9523. }
  9524. optionList.push(sprintf("<option value='" + key + "' %s>" + value + "</option>", key == vObjCol.defaultValue ? 'selected' : ''));
  9525. });
  9526. return optionList;
  9527. };
  9528. var isSearchAvailble = function (that) {
  9529. //只支持服务端搜索
  9530. if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) {
  9531. return false;
  9532. }
  9533. return true;
  9534. };
  9535. var getSearchQuery = function (that, removeempty) {
  9536. var op = {};
  9537. var filter = {};
  9538. var value = '';
  9539. $("form.form-commonsearch .operate", that.$commonsearch).each(function (i) {
  9540. var name = $(this).data("name");
  9541. var sym = $(this).is("select") ? $("option:selected", this).val() : $(this).val().toUpperCase();
  9542. var obj = $("[name='" + name + "']", that.$commonsearch);
  9543. if (obj.size() == 0)
  9544. return true;
  9545. var vObjCol = ColumnsForSearch[i];
  9546. var process = !that.options.searchFormTemplate && vObjCol && typeof vObjCol.process == 'function' ? vObjCol.process : null;
  9547. if (obj.size() > 1) {
  9548. if (/BETWEEN$/.test(sym)) {
  9549. var value_begin = $.trim($("[name='" + name + "']:first", that.$commonsearch).val()),
  9550. value_end = $.trim($("[name='" + name + "']:last", that.$commonsearch).val());
  9551. if (value_begin.length || value_end.length) {
  9552. if (process) {
  9553. value_begin = process(value_begin, 'begin');
  9554. value_end = process(value_end, 'end');
  9555. }
  9556. value = value_begin + ',' + value_end;
  9557. } else {
  9558. value = '';
  9559. }
  9560. //如果是时间筛选,将operate置为RANGE
  9561. if ($("[name='" + name + "']:first", that.$commonsearch).hasClass("datetimepicker")) {
  9562. sym = 'RANGE';
  9563. }
  9564. } else {
  9565. value = $("[name='" + name + "']:checked", that.$commonsearch).val();
  9566. value = process ? process(value) : value;
  9567. }
  9568. } else {
  9569. value = process ? process(obj.val()) : obj.val();
  9570. }
  9571. if (removeempty && (value == '' || value == null || ($.isArray(value) && value.length == 0)) && !sym.match(/null/i)) {
  9572. return true;
  9573. }
  9574. op[name] = sym;
  9575. filter[name] = value;
  9576. });
  9577. return {op: op, filter: filter};
  9578. };
  9579. var getQueryParams = function (params, searchQuery, removeempty) {
  9580. params.filter = typeof params.filter === 'Object' ? params.filter : (params.filter ? JSON.parse(params.filter) : {});
  9581. params.op = typeof params.op === 'Object' ? params.op : (params.op ? JSON.parse(params.op) : {});
  9582. params.filter = $.extend({}, params.filter, searchQuery.filter);
  9583. params.op = $.extend({}, params.op, searchQuery.op);
  9584. //移除empty的值
  9585. if (removeempty) {
  9586. $.each(params.filter, function (i, j) {
  9587. if ((j == '' || j == null || ($.isArray(j) && j.length == 0)) && !params.op[i].match(/null/i)) {
  9588. delete params.filter[i];
  9589. delete params.op[i];
  9590. }
  9591. });
  9592. }
  9593. params.filter = JSON.stringify(params.filter);
  9594. params.op = JSON.stringify(params.op);
  9595. return params;
  9596. };
  9597. $.extend($.fn.bootstrapTable.defaults, {
  9598. commonSearch: false,
  9599. titleForm: "Common search",
  9600. actionForm: "",
  9601. searchFormTemplate: "",
  9602. searchFormVisible: true,
  9603. searchClass: 'searchit',
  9604. showSearch: true,
  9605. renderDefault: true,
  9606. onCommonSearch: function (field, text) {
  9607. return false;
  9608. },
  9609. onPostCommonSearch: function (table) {
  9610. return false;
  9611. }
  9612. });
  9613. $.extend($.fn.bootstrapTable.defaults.icons, {
  9614. commonSearchIcon: 'glyphicon-search'
  9615. });
  9616. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  9617. 'common-search.bs.table': 'onCommonSearch',
  9618. 'post-common-search.bs.table': 'onPostCommonSearch'
  9619. });
  9620. $.extend($.fn.bootstrapTable.locales[$.fn.bootstrapTable.defaults.locale], {
  9621. formatCommonSearch: function () {
  9622. return "Common search";
  9623. },
  9624. formatCommonSubmitButton: function () {
  9625. return "Submit";
  9626. },
  9627. formatCommonResetButton: function () {
  9628. return "Reset";
  9629. },
  9630. formatCommonCloseButton: function () {
  9631. return "Close";
  9632. },
  9633. formatCommonChoose: function () {
  9634. return "Choose";
  9635. }
  9636. });
  9637. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  9638. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9639. _initHeader = BootstrapTable.prototype.initHeader,
  9640. _initToolbar = BootstrapTable.prototype.initToolbar,
  9641. _load = BootstrapTable.prototype.load,
  9642. _initSearch = BootstrapTable.prototype.initSearch;
  9643. BootstrapTable.prototype.initHeader = function () {
  9644. _initHeader.apply(this, Array.prototype.slice.apply(arguments));
  9645. this.$header.find('th[data-field]').each(function (i) {
  9646. var column = $(this).data();
  9647. if (typeof column['width'] !== 'undefined' && column['width'].toString().indexOf("%") === -1) {
  9648. $(".th-inner", this).outerWidth(column['width']);
  9649. $(this).css("max-width", column['width']);
  9650. }
  9651. });
  9652. this.options.stateField = this.header.stateField;
  9653. };
  9654. BootstrapTable.prototype.initToolbar = function () {
  9655. _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
  9656. if (!isSearchAvailble(this)) {
  9657. return;
  9658. }
  9659. var that = this,
  9660. html = [];
  9661. if (that.options.showSearch) {
  9662. html.push(sprintf('<div class="columns-%s pull-%s" style="margin-top:10px;margin-bottom:10px;">', this.options.buttonsAlign, this.options.buttonsAlign));
  9663. 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()));
  9664. html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.commonSearchIcon))
  9665. html.push('</button></div>');
  9666. }
  9667. if (that.$toolbar.find(".pull-right").size() > 0) {
  9668. $(html.join('')).insertBefore(that.$toolbar.find(".pull-right:first"));
  9669. } else {
  9670. that.$toolbar.append(html.join(''));
  9671. }
  9672. initCommonSearch(that.columns, that);
  9673. that.$toolbar.find('button[name="commonSearch"]')
  9674. .off('click').on('click', function () {
  9675. that.$commonsearch.toggleClass("hidden");
  9676. return;
  9677. });
  9678. that.$container.on("click", "." + that.options.searchClass, function () {
  9679. var value = $(this).data("value");
  9680. var field = $(this).data("field");
  9681. var ul = that.$container.closest(".panel-intro").find("ul[data-field='" + field + "']");
  9682. if (ul.length > 0) {
  9683. $('li a[data-value="' + value + '"][data-toggle="tab"]', ul).trigger('click');
  9684. return;
  9685. }
  9686. var obj = $("form [name='" + field + "']", that.$commonsearch);
  9687. if (obj.size() > 0) {
  9688. if (obj.is("select")) {
  9689. $("option[value='" + value + "']", obj).prop("selected", true);
  9690. } else if (obj.size() > 1) {
  9691. $("form [name='" + field + "'][value='" + value + "']", that.$commonsearch).prop("checked", true);
  9692. } else {
  9693. obj.val(value + "");
  9694. }
  9695. obj.trigger("change");
  9696. $("form", that.$commonsearch).trigger("submit");
  9697. }
  9698. });
  9699. var queryParams = that.options.queryParams;
  9700. //匹配默认搜索值
  9701. this.options.queryParams = function (params) {
  9702. return queryParams(getQueryParams(params, getSearchQuery(that, true)));
  9703. };
  9704. this.trigger('post-common-search', that);
  9705. };
  9706. BootstrapTable.prototype.onCommonSearch = function () {
  9707. var searchQuery = getSearchQuery(this);
  9708. this.trigger('common-search', this, searchQuery);
  9709. this.options.pageNumber = 1;
  9710. //this.options.pageSize = $.fn.bootstrapTable.defaults.pageSize;
  9711. this.refresh({});
  9712. };
  9713. BootstrapTable.prototype.load = function (data) {
  9714. _load.apply(this, Array.prototype.slice.apply(arguments));
  9715. if (!isSearchAvailble(this)) {
  9716. return;
  9717. }
  9718. };
  9719. BootstrapTable.prototype.initSearch = function () {
  9720. _initSearch.apply(this, Array.prototype.slice.apply(arguments));
  9721. if (!isSearchAvailble(this)) {
  9722. return;
  9723. }
  9724. var that = this;
  9725. var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
  9726. this.data = fp ? $.grep(this.data, function (item, i) {
  9727. for (var key in fp) {
  9728. var fval = fp[key].toLowerCase();
  9729. var value = item[key];
  9730. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
  9731. that.header.formatters[$.inArray(key, that.header.fields)],
  9732. [value, item, i], value);
  9733. if (!($.inArray(key, that.header.fields) !== -1 &&
  9734. (typeof value === 'string' || typeof value === 'number') &&
  9735. (value + '').toLowerCase().indexOf(fval) !== -1)) {
  9736. return false;
  9737. }
  9738. }
  9739. return true;
  9740. }) : this.data;
  9741. };
  9742. }(jQuery);
  9743. define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) {
  9744. return function () {
  9745. var ret, fn;
  9746. return ret || global.$.fn.bootstrapTable.defaults;
  9747. };
  9748. }(this)));
  9749. /**
  9750. * 将BootstrapTable的行使用自定义的模板来渲染
  9751. *
  9752. * @author: karson
  9753. * @version: v0.0.1
  9754. *
  9755. * @update 2017-06-24 <http://github.com/karsonzhang/fastadmin>
  9756. */
  9757. !function ($) {
  9758. 'use strict';
  9759. $.extend($.fn.bootstrapTable.defaults, {
  9760. //是否启用模板渲染
  9761. templateView: false,
  9762. //数据格式化的模板ID或格式函数
  9763. templateFormatter: "itemtpl",
  9764. //添加的父类的class
  9765. templateParentClass: "row row-flex",
  9766. //向table添加的class
  9767. templateTableClass: "table-template",
  9768. });
  9769. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9770. _initContainer = BootstrapTable.prototype.initContainer,
  9771. _initBody = BootstrapTable.prototype.initBody,
  9772. _initRow = BootstrapTable.prototype.initRow;
  9773. BootstrapTable.prototype.initContainer = function () {
  9774. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  9775. var that = this;
  9776. if (!that.options.templateView) {
  9777. return;
  9778. }
  9779. that.options.cardView = true;
  9780. };
  9781. BootstrapTable.prototype.initBody = function () {
  9782. var that = this;
  9783. $.extend(that.options, {
  9784. showHeader: !that.options.templateView ? $.fn.bootstrapTable.defaults.showHeader : false,
  9785. showFooter: !that.options.templateView ? $.fn.bootstrapTable.defaults.showFooter : false,
  9786. });
  9787. $(that.$el).toggleClass(that.options.templateTableClass, that.options.templateView);
  9788. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  9789. if (!that.options.templateView) {
  9790. return;
  9791. } else {
  9792. //由于Bootstrap是基于Table的,添加一个父类容器
  9793. $("> *:not(.no-records-found)", that.$body).wrapAll($("<div />").addClass(that.options.templateParentClass));
  9794. }
  9795. };
  9796. BootstrapTable.prototype.initRow = function (item, i, data, parentDom) {
  9797. var that = this;
  9798. //如果未启用则使用原生的initRow方法
  9799. if (!that.options.templateView) {
  9800. return _initRow.apply(that, Array.prototype.slice.apply(arguments));
  9801. }
  9802. var $content = '';
  9803. if (typeof that.options.templateFormatter === 'function') {
  9804. $content = that.options.templateFormatter.call(that, item, i, data);
  9805. } else {
  9806. var Template = require('template');
  9807. $content = Template(that.options.templateFormatter, {item: item, i: i, data: data});
  9808. }
  9809. return $content;
  9810. };
  9811. }(jQuery);
  9812. define("bootstrap-table-template", ["bootstrap-table","template"], (function (global) {
  9813. return function () {
  9814. var ret, fn;
  9815. return ret || global.$.fn.bootstrapTable.defaults;
  9816. };
  9817. }(this)));
  9818. /**
  9819. * @author Jay <jwang@dizsoft.com>
  9820. */
  9821. (function ($) {
  9822. 'use strict';
  9823. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  9824. $.extend($.fn.bootstrapTable.defaults, {
  9825. showJumpto: false,
  9826. exportOptions: {}
  9827. });
  9828. $.extend($.fn.bootstrapTable.locales, {
  9829. formatJumpto: function () {
  9830. return 'GO';
  9831. }
  9832. });
  9833. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  9834. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9835. _initPagination = BootstrapTable.prototype.initPagination;
  9836. BootstrapTable.prototype.initPagination = function () {
  9837. this.showToolbar = this.options.showExport;
  9838. _initPagination.apply(this, Array.prototype.slice.apply(arguments));
  9839. if (this.options.showJumpto) {
  9840. var that = this,
  9841. $pageGroup = this.$pagination.find('ul.pagination'),
  9842. $jumpto = $pageGroup.find('li.jumpto');
  9843. if (!$jumpto.length) {
  9844. $jumpto = $([
  9845. '<li class="jumpto">',
  9846. '<input type="text" class="form-control">',
  9847. '<button class="btn' +
  9848. sprintf(' btn-%s', this.options.buttonsClass) +
  9849. sprintf(' btn-%s', this.options.iconSize) +
  9850. '" title="' + this.options.formatJumpto() + '" ' +
  9851. ' type="button">'+this.options.formatJumpto(),
  9852. '</button>',
  9853. '</li>'].join('')).appendTo($pageGroup);
  9854. $jumpto.find('button').click(function () {
  9855. that.selectPage(parseInt($jumpto.find('input').val()));
  9856. });
  9857. }
  9858. }
  9859. };
  9860. })(jQuery);
  9861. define("bootstrap-table-jumpto", ["bootstrap-table"], (function (global) {
  9862. return function () {
  9863. var ret, fn;
  9864. return ret || global.$.fn.bootstrapTable.defaults;
  9865. };
  9866. }(this)));
  9867. (function ($) {
  9868. 'use strict';
  9869. // Reasonable defaults
  9870. var PIXEL_STEP = 10;
  9871. var LINE_HEIGHT = 40;
  9872. var PAGE_HEIGHT = 800;
  9873. function normalizeWheel(event) {
  9874. var sX = 0; // spinX
  9875. var sY = 0; // spinY
  9876. var pX = 0; // pixelX
  9877. var pY = 0; // pixelY
  9878. // Legacy
  9879. if ('detail' in event) {
  9880. sY = event.detail;
  9881. }
  9882. if ('wheelDelta' in event) {
  9883. sY = -event.wheelDelta / 120;
  9884. }
  9885. if ('wheelDeltaY' in event) {
  9886. sY = -event.wheelDeltaY / 120;
  9887. }
  9888. if ('wheelDeltaX' in event) {
  9889. sX = -event.wheelDeltaX / 120;
  9890. }
  9891. // side scrolling on FF with DOMMouseScroll
  9892. if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {
  9893. sX = sY;
  9894. sY = 0;
  9895. }
  9896. pX = sX * PIXEL_STEP;
  9897. pY = sY * PIXEL_STEP;
  9898. if ('deltaY' in event) {
  9899. pY = event.deltaY;
  9900. }
  9901. if ('deltaX' in event) {
  9902. pX = event.deltaX;
  9903. }
  9904. if ((pX || pY) && event.deltaMode) {
  9905. if (event.deltaMode === 1) {
  9906. // delta in LINE units
  9907. pX *= LINE_HEIGHT;
  9908. pY *= LINE_HEIGHT;
  9909. } else {
  9910. // delta in PAGE units
  9911. pX *= PAGE_HEIGHT;
  9912. pY *= PAGE_HEIGHT;
  9913. }
  9914. }
  9915. // Fall-back if spin cannot be determined
  9916. if (pX && !sX) {
  9917. sX = pX < 1 ? -1 : 1;
  9918. }
  9919. if (pY && !sY) {
  9920. sY = pY < 1 ? -1 : 1;
  9921. }
  9922. return {
  9923. spinX: sX,
  9924. spinY: sY,
  9925. pixelX: pX,
  9926. pixelY: pY
  9927. };
  9928. }
  9929. var cachedWidth = null;
  9930. var getScrollBarWidth = function getScrollBarWidth() {
  9931. if (cachedWidth === null) {
  9932. var inner = $('<p/>').addClass('fixed-table-scroll-inner'),
  9933. outer = $('<div/>').addClass('fixed-table-scroll-outer'),
  9934. w1 = void 0,
  9935. w2 = void 0;
  9936. outer.append(inner);
  9937. $('body').append(outer);
  9938. w1 = inner[0].offsetWidth;
  9939. outer.css('overflow', 'scroll');
  9940. w2 = inner[0].offsetWidth;
  9941. if (w1 === w2) {
  9942. w2 = outer[0].clientWidth;
  9943. }
  9944. outer.remove();
  9945. cachedWidth = w1 - w2;
  9946. }
  9947. return cachedWidth;
  9948. };
  9949. //获取原本表格体的滑块宽度
  9950. var getTableBodyScrollBarWidth = function getTableBodyScrollBarWidth(tableBody) {
  9951. return tableBody[0].scrollHeight > tableBody[0].clientHeight ? 15 : 0;
  9952. };
  9953. $.extend($.fn.bootstrapTable.defaults, {
  9954. fixedColumns: false,
  9955. fixedNumber: 0,
  9956. fixedRightNumber: 0
  9957. });
  9958. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9959. _initBody = BootstrapTable.prototype.initBody,
  9960. _initContainer = BootstrapTable.prototype.initContainer,
  9961. _trigger = BootstrapTable.prototype.trigger,
  9962. _hideLoading = BootstrapTable.prototype.hideLoading,
  9963. _updateSelected = BootstrapTable.prototype.updateSelected;
  9964. BootstrapTable.prototype.fixedColumnsSupported = function () {
  9965. var that = this;
  9966. return that.options.fixedColumns && !that.options.detailView && !that.options.cardView;
  9967. };
  9968. BootstrapTable.prototype.initFixedContainer = function () {
  9969. if (!this.fixedColumnsSupported()) {
  9970. return;
  9971. }
  9972. if (this.options.fixedNumber) {
  9973. this.$tableContainer.find('.fixed-columns').size() == 0 && this.$tableContainer.append('<div class="fixed-columns"></div>');
  9974. this.$fixedColumns = this.$tableContainer.find('.fixed-columns');
  9975. }
  9976. if (this.options.fixedRightNumber) {
  9977. this.$tableContainer.find('.fixed-columns-right').size() == 0 && this.$tableContainer.append('<div class="fixed-columns-right"></div>');
  9978. this.$fixedColumnsRight = this.$tableContainer.find('.fixed-columns-right');
  9979. }
  9980. };
  9981. BootstrapTable.prototype.initContainer = function () {
  9982. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  9983. this.initFixedContainer();
  9984. };
  9985. BootstrapTable.prototype.initBody = function () {
  9986. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  9987. if (!this.fixedColumnsSupported()) {
  9988. return;
  9989. }
  9990. if (this.options.showHeader && this.options.height) {
  9991. return;
  9992. }
  9993. this.initFixedColumnsBody();
  9994. this.initFixedColumnsEvents();
  9995. };
  9996. BootstrapTable.prototype.trigger = function () {
  9997. var that = this;
  9998. _trigger.apply(this, Array.prototype.slice.apply(arguments));
  9999. if (arguments[0] === 'pre-body') {
  10000. //如果上来就是cardView 设置表格高度为auto
  10001. if (this.options.cardView) {
  10002. this.$tableBody.css("height", "auto");
  10003. }
  10004. }
  10005. //监听cardView 显示/隐藏fixed部分
  10006. if (arguments[0] === 'toggle') {
  10007. if (arguments[1]) {
  10008. this.$tableBody.css("height", "auto");
  10009. this.$fixedColumns && this.$fixedColumns.hide();
  10010. this.$fixedColumnsRight && this.$fixedColumnsRight.hide();
  10011. } else {
  10012. this.$tableBody.css("height", "100%");
  10013. this.$fixedColumns && this.$fixedColumns.show();
  10014. this.$fixedColumnsRight && this.$fixedColumnsRight.show();
  10015. this.$fixedHeaderRight && this.$fixedHeaderRight.scrollLeft(this.$tableBody.find('table').width());
  10016. this.$fixedBodyRight && this.$fixedBodyRight.scrollLeft(this.$tableBody.find('table').width());
  10017. }
  10018. }
  10019. if (!that.fixedColumnsSupported()) {
  10020. return;
  10021. }
  10022. if (arguments[0] === 'post-header') {
  10023. this.initFixedColumnsHeader();
  10024. } else if (arguments[0] === 'scroll-body') {
  10025. if (this.needFixedColumns && this.options.fixedNumber) {
  10026. this.$fixedBody && this.$fixedBody.scrollTop(this.$tableBody.scrollTop());
  10027. }
  10028. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10029. this.$fixedBodyRight && this.$fixedBodyRight.scrollTop(this.$tableBody.scrollTop());
  10030. }
  10031. } else if (arguments[0] === 'load-success') {
  10032. this.hideLoading();
  10033. }
  10034. };
  10035. BootstrapTable.prototype.updateSelected = function () {
  10036. var that = this;
  10037. _updateSelected.apply(this, Array.prototype.slice.apply(arguments));
  10038. if (!this.fixedColumnsSupported()) {
  10039. return;
  10040. }
  10041. this.$tableBody.find('tr').each(function (i, el) {
  10042. var $el = $(el);
  10043. var index = $el.data('index');
  10044. var classes = $el.attr('class');
  10045. var inputSelector = '[name="' + that.options.selectItemName + '"]';
  10046. var $input = $el.find(inputSelector);
  10047. if (typeof index === 'undefined') {
  10048. return;
  10049. }
  10050. var updateFixedBody = function updateFixedBody($fixedHeader, $fixedBody) {
  10051. var $tr = $fixedBody.find('tr[data-index="' + index + '"]');
  10052. $tr.attr('class', classes);
  10053. if ($input.length) {
  10054. $tr.find(inputSelector).prop('checked', $input.prop('checked'));
  10055. }
  10056. if (that.$selectAll.length) {
  10057. $fixedHeader.add($fixedBody).find('[name="btSelectAll"]').prop('checked', that.$selectAll.prop('checked'));
  10058. }
  10059. };
  10060. if (that.$fixedBody && that.options.fixedNumber) {
  10061. updateFixedBody(that.$fixedHeader, that.$fixedBody);
  10062. }
  10063. if (that.$fixedBodyRight && that.options.fixedRightNumber) {
  10064. updateFixedBody(that.$fixedHeaderRight, that.$fixedBodyRight);
  10065. }
  10066. });
  10067. };
  10068. BootstrapTable.prototype.hideLoading = function () {
  10069. _hideLoading.apply(this, Array.prototype.slice.apply(arguments));
  10070. if (this.needFixedColumns && this.options.fixedNumber) {
  10071. this.$fixedColumns.find('.fixed-table-loading').hide();
  10072. }
  10073. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10074. this.$fixedColumnsRight.find('.fixed-table-loading').hide();
  10075. }
  10076. };
  10077. BootstrapTable.prototype.initFixedColumnsHeader = function () {
  10078. var that = this;
  10079. if (this.options.height) {
  10080. this.needFixedColumns = this.$tableHeader.outerWidth(true) < this.$tableHeader.find('table').outerWidth(true);
  10081. } else {
  10082. this.needFixedColumns = this.$tableBody.outerWidth(true) < this.$tableBody.find('table').outerWidth(true);
  10083. }
  10084. var initFixedHeader = function initFixedHeader($fixedColumns, isRight) {
  10085. $fixedColumns.find('.fixed-table-header').remove();
  10086. $fixedColumns.append(that.$tableHeader.clone(true));
  10087. $fixedColumns.find('.fixed-table-header').css('margin-right', "");
  10088. $fixedColumns.css({
  10089. width: that.getFixedColumnsWidth(isRight)
  10090. });
  10091. return $fixedColumns.find('.fixed-table-header');
  10092. };
  10093. if (this.needFixedColumns && this.options.fixedNumber) {
  10094. this.$fixedHeader = initFixedHeader(this.$fixedColumns);
  10095. this.$fixedHeader.css('margin-right', '');
  10096. } else if (this.$fixedColumns) {
  10097. this.$fixedColumns.html('').css('width', '');
  10098. }
  10099. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10100. this.$fixedHeaderRight = initFixedHeader(this.$fixedColumnsRight, true);
  10101. this.$fixedHeaderRight.scrollLeft(this.$fixedHeaderRight.find('table').width());
  10102. } else if (this.$fixedColumnsRight) {
  10103. this.$fixedColumnsRight.html('').css('width', '');
  10104. }
  10105. this.initFixedColumnsBody();
  10106. this.initFixedColumnsEvents();
  10107. };
  10108. BootstrapTable.prototype.initFixedColumnsBody = function () {
  10109. var that = this;
  10110. var initFixedBody = function initFixedBody($fixedColumns, $fixedHeader) {
  10111. $fixedColumns.find('.fixed-table-body').remove();
  10112. $fixedColumns.append(that.$tableBody.clone(true));
  10113. var $fixedBody = $fixedColumns.find('.fixed-table-body');
  10114. var tableBody = that.$tableBody.get(0);
  10115. var scrollHeight = tableBody.scrollWidth > tableBody.clientWidth ? getScrollBarWidth() : 0;
  10116. var paginationHeight = $(".fixed-table-pagination").height();
  10117. if (typeof that.options.height !== 'undefined') paginationHeight = 0;
  10118. var height = that.$tableContainer.outerHeight(true) - scrollHeight - paginationHeight + 1;
  10119. $fixedColumns.css({
  10120. height: height
  10121. });
  10122. $fixedBody.css({
  10123. height: height - $fixedHeader.height()
  10124. });
  10125. return $fixedBody;
  10126. };
  10127. if (this.needFixedColumns && this.options.fixedNumber) {
  10128. this.$fixedBody = initFixedBody(this.$fixedColumns, this.$fixedHeader);
  10129. }
  10130. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10131. this.$fixedBodyRight = initFixedBody(this.$fixedColumnsRight, this.$fixedHeaderRight);
  10132. this.$fixedBodyRight.scrollLeft(this.$fixedBodyRight.find('table').width());
  10133. this.$fixedBodyRight.css('overflow-y', 'hidden');
  10134. }
  10135. };
  10136. BootstrapTable.prototype.getFixedColumnsWidth = function (isRight) {
  10137. var visibleFields = this.getVisibleFields();
  10138. var width = 0;
  10139. var fixedNumber = this.options.fixedNumber;
  10140. var marginRight = 0;
  10141. if (isRight) {
  10142. visibleFields = visibleFields.reverse();
  10143. fixedNumber = this.options.fixedRightNumber;
  10144. //右侧固定列距离
  10145. this.$fixedColumnsRight.css('right', getTableBodyScrollBarWidth(this.$tableBody));
  10146. }
  10147. for (var i = 0; i < fixedNumber; i++) {
  10148. width += this.$header.find('th[data-field="' + visibleFields[i] + '"]').outerWidth();
  10149. }
  10150. return width + 1;
  10151. };
  10152. BootstrapTable.prototype.initFixedColumnsEvents = function () {
  10153. var that = this;
  10154. var toggleHover = function toggleHover(e, toggle) {
  10155. var tr = 'tr[data-index="' + $(e.currentTarget).data('index') + '"]';
  10156. var $trs = that.$tableBody.find(tr);
  10157. if (that.$fixedBody) {
  10158. $trs = $trs.add(that.$fixedBody.find(tr));
  10159. }
  10160. if (that.$fixedBodyRight) {
  10161. $trs = $trs.add(that.$fixedBodyRight.find(tr));
  10162. }
  10163. $trs.css('background-color', toggle ? $(e.currentTarget).css('background-color') : '');
  10164. };
  10165. this.$tableBody.find('tr').hover(function (e) {
  10166. toggleHover(e, true);
  10167. }, function (e) {
  10168. toggleHover(e, false);
  10169. });
  10170. var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
  10171. var mousewheel = isFirefox ? 'DOMMouseScroll' : 'mousewheel';
  10172. var updateScroll = function updateScroll(e, fixedBody) {
  10173. var normalized = normalizeWheel(e);
  10174. var deltaY = Math.ceil(normalized.pixelY);
  10175. var top = that.$tableBody.scrollTop() + deltaY;
  10176. if (deltaY < 0 && top > 0 || deltaY > 0 && top < fixedBody.scrollHeight - fixedBody.clientHeight) {
  10177. e.preventDefault();
  10178. }
  10179. that.$tableBody.scrollTop(top);
  10180. if (that.$fixedBody) {
  10181. that.$fixedBody.scrollTop(top);
  10182. }
  10183. if (that.$fixedBodyRight) {
  10184. that.$fixedBodyRight.scrollTop(top);
  10185. }
  10186. };
  10187. if (this.needFixedColumns && this.options.fixedNumber) {
  10188. this.$fixedBody.find('tr').hover(function (e) {
  10189. toggleHover(e, true);
  10190. }, function (e) {
  10191. toggleHover(e, false);
  10192. });
  10193. this.$fixedBody[0].addEventListener(mousewheel, function (e) {
  10194. //给鼠标滑轮绑定事件
  10195. updateScroll(e, that.$fixedBody[0]);
  10196. });
  10197. //给固定表格的checkbox绑定事件
  10198. this.$fixedBody.find('input[name="' + this.options.selectItemName + '"]').off("click").on('click', function (e) {
  10199. e.stopImmediatePropagation();
  10200. var index = $(e.target).data("index");
  10201. $(that.$selectItem[index]).trigger("click");
  10202. });
  10203. //绑定TD点击事件
  10204. this.$fixedBody.find('> table > tbody > tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
  10205. var index = $(this).closest("tr[data-index]").data("index");
  10206. $(that.$selectItem[index]).closest("tr[data-index]").find(">td:eq(" + $(this).index() + ")").trigger("click");
  10207. });
  10208. }
  10209. //给原本表格绑定scroll事件
  10210. $('div.fixed-table-body').off('scroll'); //给所有的body解绑 scroll
  10211. this.$tableBody.off('scroll').on('scroll', function (e) {
  10212. that.$tableHeader.scrollLeft(0);
  10213. if (that.$tableBody.scrollLeft() > 0) {
  10214. that.$tableHeader.scrollLeft(that.$tableBody.scrollLeft());
  10215. if (that.options.showFooter && !that.options.cardView) {
  10216. that.$tableFooter.scrollLeft(that.$tableBody.scrollLeft());
  10217. }
  10218. }
  10219. var top = that.$tableBody.scrollTop();
  10220. if (that.$fixedBody) {
  10221. that.$fixedBody.scrollTop(top);
  10222. }
  10223. if (that.$fixedBodyRight) {
  10224. that.$fixedBodyRight.scrollTop(top);
  10225. }
  10226. });
  10227. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10228. this.$fixedBodyRight.find('tr').hover(function (e) {
  10229. toggleHover(e, true);
  10230. }, function (e) {
  10231. toggleHover(e, false);
  10232. });
  10233. this.$fixedBodyRight[0].addEventListener(mousewheel, function (e) {
  10234. //给鼠标滑轮绑定事件
  10235. updateScroll(e, that.$fixedBodyRight[0]);
  10236. });
  10237. //给固定表格的checkbox绑定事件
  10238. this.$fixedBodyRight.find('input[name="' + this.options.selectItemName + '"]').off("click").on('click', function (e) {
  10239. e.stopImmediatePropagation();
  10240. var index = $(e.target).data("index");
  10241. $(that.$selectItem[index]).trigger("click");
  10242. });
  10243. //绑定TD点击事件
  10244. this.$fixedBodyRight.find('> table > tbody > tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
  10245. var index = $(this).closest("tr[data-index]").data("index");
  10246. $(that.$selectItem[index]).closest("tr[data-index]").find(">td:eq(" + $(this).index() + ")").trigger("click");
  10247. });
  10248. }
  10249. if (this.options.filterControl) {
  10250. $(this.$fixedColumns).off('keyup change').on('keyup change', function (e) {
  10251. var $target = $(e.target);
  10252. var value = $target.val();
  10253. var field = $target.parents('th').data('field');
  10254. var $coreTh = that.$header.find('th[data-field="' + field + '"]');
  10255. if ($target.is('input')) {
  10256. $coreTh.find('input').val(value);
  10257. } else if ($target.is('select')) {
  10258. var $select = $coreTh.find('select');
  10259. $select.find('option[selected]').removeAttr('selected');
  10260. $select.find('option[value="' + value + '"]').attr('selected', true);
  10261. }
  10262. that.triggerSearch();
  10263. });
  10264. }
  10265. };
  10266. })(jQuery);
  10267. define("bootstrap-table-fixed-columns", ["bootstrap-table"], (function (global) {
  10268. return function () {
  10269. var ret, fn;
  10270. return ret || global.$.fn.bootstrapTable.defaults;
  10271. };
  10272. }(this)));
  10273. define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-export', 'bootstrap-table-commonsearch', 'bootstrap-table-template', 'bootstrap-table-jumpto', 'bootstrap-table-fixed-columns'], function ($, undefined, Moment) {
  10274. var Table = {
  10275. list: {},
  10276. // Bootstrap-table 基础配置
  10277. defaults: {
  10278. url: '',
  10279. sidePagination: 'server',
  10280. method: 'get', //请求方法
  10281. toolbar: ".toolbar", //工具栏
  10282. search: true, //是否启用快速搜索
  10283. cache: false,
  10284. commonSearch: true, //是否启用通用搜索
  10285. searchFormVisible: false, //是否始终显示搜索表单
  10286. titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
  10287. idTable: 'commonTable',
  10288. showExport: true,
  10289. exportDataType: "auto",
  10290. exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
  10291. exportOptions: {
  10292. fileName: 'export_' + Moment().format("YYYY-MM-DD"),
  10293. preventInjection: false,
  10294. mso: {
  10295. onMsoNumberFormat: function (cell, row, col) {
  10296. return !isNaN($(cell).text()) ? '\\@' : '';
  10297. },
  10298. },
  10299. ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列
  10300. },
  10301. pageSize: localStorage.getItem("pagesize") || 10,
  10302. pageList: [10, 15, 20, 25, 50, 'All'],
  10303. pagination: true,
  10304. clickToSelect: true, //是否启用点击选中
  10305. dblClickToEdit: true, //是否启用双击编辑
  10306. singleSelect: false, //是否启用单选
  10307. showRefresh: false,
  10308. showJumpto: true,
  10309. locale: Config.language == 'zh-cn' ? 'zh-CN' : 'en-US',
  10310. showToggle: true,
  10311. showColumns: true,
  10312. pk: 'id',
  10313. sortName: 'id',
  10314. sortOrder: 'desc',
  10315. paginationFirstText: __("First"),
  10316. paginationPreText: __("Previous"),
  10317. paginationNextText: __("Next"),
  10318. paginationLastText: __("Last"),
  10319. cardView: false, //卡片视图
  10320. iosCardView: true, //ios卡片视图
  10321. checkOnInit: true, //是否在初始化时判断
  10322. escape: true, //是否对内容进行转义
  10323. fixDropdownPosition: true, //是否修复下拉的定位
  10324. selectedIds: [],
  10325. selectedData: [],
  10326. extend: {
  10327. index_url: '',
  10328. add_url: '',
  10329. edit_url: '',
  10330. del_url: '',
  10331. import_url: '',
  10332. multi_url: '',
  10333. dragsort_url: 'ajax/weigh',
  10334. }
  10335. },
  10336. // Bootstrap-table 列配置
  10337. columnDefaults: {
  10338. align: 'center',
  10339. valign: 'middle',
  10340. },
  10341. config: {
  10342. checkboxtd: 'tbody>tr>td.bs-checkbox',
  10343. toolbar: '.toolbar',
  10344. refreshbtn: '.btn-refresh',
  10345. addbtn: '.btn-add',
  10346. editbtn: '.btn-edit',
  10347. delbtn: '.btn-del',
  10348. importbtn: '.btn-import',
  10349. multibtn: '.btn-multi',
  10350. disabledbtn: '.btn-disabled',
  10351. editonebtn: '.btn-editone',
  10352. restoreonebtn: '.btn-restoreone',
  10353. destroyonebtn: '.btn-destroyone',
  10354. restoreallbtn: '.btn-restoreall',
  10355. destroyallbtn: '.btn-destroyall',
  10356. dragsortfield: 'weigh',
  10357. },
  10358. button: {
  10359. edit: {
  10360. name: 'edit',
  10361. icon: 'fa fa-pencil',
  10362. title: __('Edit'),
  10363. extend: 'data-toggle="tooltip"',
  10364. classname: 'btn btn-xs btn-success btn-editone'
  10365. },
  10366. del: {
  10367. name: 'del',
  10368. icon: 'fa fa-trash',
  10369. title: __('Del'),
  10370. extend: 'data-toggle="tooltip"',
  10371. classname: 'btn btn-xs btn-danger btn-delone'
  10372. },
  10373. dragsort: {
  10374. name: 'dragsort',
  10375. icon: 'fa fa-arrows',
  10376. title: __('Drag to sort'),
  10377. extend: 'data-toggle="tooltip"',
  10378. classname: 'btn btn-xs btn-primary btn-dragsort'
  10379. }
  10380. },
  10381. api: {
  10382. init: function (defaults, columnDefaults, locales) {
  10383. defaults = defaults ? defaults : {};
  10384. columnDefaults = columnDefaults ? columnDefaults : {};
  10385. locales = locales ? locales : {};
  10386. $.fn.bootstrapTable.Constructor.prototype.getSelectItem = function () {
  10387. return this.$selectItem;
  10388. };
  10389. // 写入bootstrap-table默认配置
  10390. $.extend(true, $.fn.bootstrapTable.defaults, Table.defaults, defaults);
  10391. // 写入bootstrap-table column配置
  10392. $.extend($.fn.bootstrapTable.columnDefaults, Table.columnDefaults, columnDefaults);
  10393. // 写入bootstrap-table locale配置
  10394. $.extend($.fn.bootstrapTable.locales[Table.defaults.locale], {
  10395. formatCommonSearch: function () {
  10396. return __('Common search');
  10397. },
  10398. formatCommonSubmitButton: function () {
  10399. return __('Submit');
  10400. },
  10401. formatCommonResetButton: function () {
  10402. return __('Reset');
  10403. },
  10404. formatCommonCloseButton: function () {
  10405. return __('Close');
  10406. },
  10407. formatCommonChoose: function () {
  10408. return __('Choose');
  10409. },
  10410. formatJumpto: function () {
  10411. return __('Go');
  10412. }
  10413. }, locales);
  10414. // 如果是iOS设备则判断是否启用卡片视图
  10415. if ($.fn.bootstrapTable.defaults.iosCardView && navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
  10416. Table.defaults.cardView = true;
  10417. $.fn.bootstrapTable.defaults.cardView = true;
  10418. }
  10419. if (typeof defaults.exportTypes != 'undefined') {
  10420. $.fn.bootstrapTable.defaults.exportTypes = defaults.exportTypes;
  10421. }
  10422. },
  10423. // 绑定事件
  10424. bindevent: function (table) {
  10425. //Bootstrap-table的父元素,包含table,toolbar,pagnation
  10426. var parenttable = table.closest('.bootstrap-table');
  10427. //Bootstrap-table配置
  10428. var options = table.bootstrapTable('getOptions');
  10429. //Bootstrap操作区
  10430. var toolbar = $(options.toolbar, parenttable);
  10431. //跨页提示按钮
  10432. var tipsBtn = $(".btn-selected-tips", parenttable);
  10433. if (tipsBtn.size() === 0) {
  10434. tipsBtn = $('<a href="javascript:" class="btn btn-warning-light btn-selected-tips hide" data-animation="false" data-toggle="tooltip" data-title="' + __("Click to uncheck all") + '"><i class="fa fa-info-circle"></i> ' + __("Multiple selection mode: %s checked", "<b>0</b>") + '</a>').appendTo(toolbar);
  10435. }
  10436. //点击提示按钮
  10437. tipsBtn.off("click").on("click", function (e) {
  10438. table.trigger("uncheckbox");
  10439. table.bootstrapTable("refresh");
  10440. });
  10441. //当刷新表格时
  10442. table.on('uncheckbox', function (status, res, e) {
  10443. options.selectedIds = [];
  10444. options.selectedData = [];
  10445. tipsBtn.tooltip('hide');
  10446. tipsBtn.addClass('hide');
  10447. });
  10448. //表格加载出错时
  10449. table.on('load-error.bs.table', function (status, res, e) {
  10450. if (e.status === 0) {
  10451. return;
  10452. }
  10453. Toastr.error(__('Unknown data format'));
  10454. });
  10455. //当加载数据成功时
  10456. table.on('load-success.bs.table', function (e, data) {
  10457. if (typeof data.rows === 'undefined' && typeof data.code != 'undefined') {
  10458. Toastr.error(data.msg);
  10459. }
  10460. });
  10461. //当刷新表格时
  10462. table.on('refresh.bs.table', function (e, settings, data) {
  10463. $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
  10464. });
  10465. //当表格分页变更时
  10466. table.on('page-change.bs.table', function (e, page, pagesize) {
  10467. if (!isNaN(pagesize)) {
  10468. localStorage.setItem("pagesize", pagesize);
  10469. }
  10470. });
  10471. //当执行搜索时
  10472. table.on('search.bs.table common-search.bs.table', function (e, settings, data) {
  10473. table.trigger("uncheckbox");
  10474. });
  10475. if (options.dblClickToEdit) {
  10476. //当双击单元格时
  10477. table.on('dbl-click-row.bs.table', function (e, row, element, field) {
  10478. $(Table.config.editonebtn, element).trigger("click");
  10479. });
  10480. }
  10481. //渲染内容前
  10482. table.on('pre-body.bs.table', function (e, data) {
  10483. if (options.maintainSelected) {
  10484. $.each(data, function (i, row) {
  10485. row[options.stateField] = $.inArray(row[options.pk], options.selectedIds) > -1;
  10486. });
  10487. }
  10488. });
  10489. //当内容渲染完成后
  10490. table.on('post-body.bs.table', function (e, data) {
  10491. $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
  10492. if ($(Table.config.checkboxtd + ":first", table).find("input[type='checkbox'][data-index]").size() > 0) {
  10493. // 拖拽选择,需要重新绑定事件
  10494. require(['drag', 'drop'], function () {
  10495. var checkboxtd = $(Table.config.checkboxtd, table);
  10496. checkboxtd.drag("start", function (ev, dd) {
  10497. return $('<div class="selection" />').css('opacity', .65).appendTo(document.body);
  10498. }).drag(function (ev, dd) {
  10499. $(dd.proxy).css({
  10500. top: Math.min(ev.pageY, dd.startY),
  10501. left: Math.min(ev.pageX, dd.startX),
  10502. height: Math.abs(ev.pageY - dd.startY),
  10503. width: Math.abs(ev.pageX - dd.startX)
  10504. });
  10505. }).drag("end", function (ev, dd) {
  10506. $(dd.proxy).remove();
  10507. });
  10508. checkboxtd.drop("start", function () {
  10509. Table.api.toggleattr(this);
  10510. }).drop(function () {
  10511. // Table.api.toggleattr(this);
  10512. }).drop("end", function (e) {
  10513. var that = this;
  10514. setTimeout(function () {
  10515. if (e.type === 'mousemove') {
  10516. Table.api.toggleattr(that);
  10517. }
  10518. }, 0);
  10519. });
  10520. $.drop({
  10521. multi: true
  10522. });
  10523. });
  10524. }
  10525. });
  10526. var exportDataType = options.exportDataType;
  10527. // 处理选中筛选框后按钮的状态统一变更
  10528. table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table post-body.bs.table', function (e) {
  10529. var allIds = [];
  10530. $.each(table.bootstrapTable("getData"), function (i, item) {
  10531. allIds.push(typeof item[options.pk] != 'undefined' ? item[options.pk] : '');
  10532. });
  10533. var selectedIds = Table.api.selectedids(table, true),
  10534. selectedData = Table.api.selecteddata(table, true);
  10535. //开启分页checkbox分页记忆
  10536. if (options.maintainSelected) {
  10537. options.selectedIds = options.selectedIds.filter(function (element, index, self) {
  10538. return $.inArray(element, allIds) === -1;
  10539. }).concat(selectedIds);
  10540. options.selectedData = options.selectedData.filter(function (element, index, self) {
  10541. return $.inArray(element[options.pk], allIds) === -1;
  10542. }).concat(selectedData);
  10543. if (options.selectedIds.length > selectedIds.length) {
  10544. $("b", tipsBtn).text(options.selectedIds.length);
  10545. tipsBtn.removeClass('hide');
  10546. } else {
  10547. tipsBtn.addClass('hide');
  10548. }
  10549. } else {
  10550. options.selectedIds = selectedIds;
  10551. options.selectedData = selectedData;
  10552. }
  10553. //如果导出类型为auto时则自动判断
  10554. if (exportDataType === 'auto') {
  10555. options.exportDataType = selectedIds.length > 0 ? 'selected' : 'all';
  10556. }
  10557. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !options.selectedIds.length);
  10558. });
  10559. // 绑定TAB事件
  10560. $('.panel-heading [data-field] a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) {
  10561. var field = $(this).closest("[data-field]").data("field");
  10562. var value = $(this).data("value");
  10563. var object = $("[name='" + field + "']", table.closest(".bootstrap-table").find(".commonsearch-table"));
  10564. if (object.prop('tagName') == "SELECT") {
  10565. $("option[value='" + value + "']", object).prop("selected", true);
  10566. } else {
  10567. object.val(value);
  10568. }
  10569. table.trigger("uncheckbox");
  10570. table.bootstrapTable('refresh', {pageNumber: 1});
  10571. return false;
  10572. });
  10573. // 修复重置事件
  10574. $("form", table.closest(".bootstrap-table").find(".commonsearch-table")).on('reset', function () {
  10575. setTimeout(function () {
  10576. // $('.panel-heading [data-field] li.active a[data-toggle="tab"]').trigger('shown.bs.tab');
  10577. }, 0);
  10578. $('.panel-heading [data-field] li', table.closest(".panel-intro")).removeClass('active');
  10579. $('.panel-heading [data-field] li:first', table.closest(".panel-intro")).addClass('active');
  10580. });
  10581. // 刷新按钮事件
  10582. toolbar.on('click', Table.config.refreshbtn, function () {
  10583. table.bootstrapTable('refresh');
  10584. });
  10585. // 添加按钮事件
  10586. toolbar.on('click', Table.config.addbtn, function () {
  10587. var ids = Table.api.selectedids(table);
  10588. var url = options.extend.add_url;
  10589. if (url.indexOf("{ids}") !== -1) {
  10590. url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
  10591. }
  10592. Fast.api.open(url, $(this).data("original-title") || $(this).attr("title") || __('Add'), $(this).data() || {});
  10593. });
  10594. // 导入按钮事件
  10595. if ($(Table.config.importbtn, toolbar).size() > 0) {
  10596. require(['upload'], function (Upload) {
  10597. Upload.api.upload($(Table.config.importbtn, toolbar), function (data, ret) {
  10598. Fast.api.ajax({
  10599. url: options.extend.import_url,
  10600. data: {file: data.url},
  10601. }, function (data, ret) {
  10602. table.trigger("uncheckbox");
  10603. table.bootstrapTable('refresh');
  10604. });
  10605. });
  10606. });
  10607. }
  10608. // 批量编辑按钮事件
  10609. toolbar.on('click', Table.config.editbtn, function () {
  10610. var that = this;
  10611. var ids = Table.api.selectedids(table);
  10612. if (ids.length > 10) {
  10613. return;
  10614. }
  10615. var title = $(that).data('title') || $(that).attr("title") || __('Edit');
  10616. var data = $(that).data() || {};
  10617. delete data.title;
  10618. //循环弹出多个编辑框
  10619. $.each(Table.api.selecteddata(table), function (index, row) {
  10620. var url = options.extend.edit_url;
  10621. row = $.extend({}, row ? row : {}, {ids: row[options.pk]});
  10622. url = Table.api.replaceurl(url, row, table);
  10623. Fast.api.open(url, typeof title === 'function' ? title.call(table, row) : title, data);
  10624. });
  10625. });
  10626. //清空回收站
  10627. $(document).on('click', Table.config.destroyallbtn, function () {
  10628. var that = this;
  10629. Layer.confirm(__('Are you sure you want to truncate?'), function () {
  10630. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10631. Fast.api.ajax(url, function () {
  10632. Layer.closeAll();
  10633. table.trigger("uncheckbox");
  10634. table.bootstrapTable('refresh');
  10635. }, function () {
  10636. Layer.closeAll();
  10637. });
  10638. });
  10639. return false;
  10640. });
  10641. //全部还原
  10642. $(document).on('click', Table.config.restoreallbtn, function () {
  10643. var that = this;
  10644. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10645. Fast.api.ajax(url, function () {
  10646. Layer.closeAll();
  10647. table.trigger("uncheckbox");
  10648. table.bootstrapTable('refresh');
  10649. }, function () {
  10650. Layer.closeAll();
  10651. });
  10652. return false;
  10653. });
  10654. //销毁或删除
  10655. $(document).on('click', Table.config.restoreonebtn + ',' + Table.config.destroyonebtn, function () {
  10656. var that = this;
  10657. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10658. var row = Fast.api.getrowbyindex(table, $(that).data("row-index"));
  10659. Fast.api.ajax({
  10660. url: url,
  10661. data: {ids: row[options.pk]}
  10662. }, function () {
  10663. table.trigger("uncheckbox");
  10664. table.bootstrapTable('refresh');
  10665. });
  10666. return false;
  10667. });
  10668. // 批量操作按钮事件
  10669. toolbar.on('click', Table.config.multibtn, function () {
  10670. var ids = Table.api.selectedids(table);
  10671. Table.api.multi($(this).data("action"), ids, table, this);
  10672. });
  10673. // 批量删除按钮事件
  10674. toolbar.on('click', Table.config.delbtn, function () {
  10675. var that = this;
  10676. var ids = Table.api.selectedids(table);
  10677. Layer.confirm(
  10678. __('Are you sure you want to delete the %s selected item?', ids.length),
  10679. {icon: 3, title: __('Warning'), offset: 0, shadeClose: true, btn: [__('OK'), __('Cancel')]},
  10680. function (index) {
  10681. Table.api.multi("del", ids, table, that);
  10682. Layer.close(index);
  10683. }
  10684. );
  10685. });
  10686. // 拖拽排序
  10687. require(['dragsort'], function () {
  10688. //绑定拖动排序
  10689. $("tbody", table).dragsort({
  10690. itemSelector: 'tr:visible',
  10691. dragSelector: "a.btn-dragsort",
  10692. dragEnd: function (a, b) {
  10693. var element = $("a.btn-dragsort", this);
  10694. var data = table.bootstrapTable('getData');
  10695. var current = data[parseInt($(this).data("index"))];
  10696. var options = table.bootstrapTable('getOptions');
  10697. //改变的值和改变的ID集合
  10698. var ids = $.map($("tbody tr:visible", table), function (tr) {
  10699. return data[parseInt($(tr).data("index"))][options.pk];
  10700. });
  10701. var changeid = current[options.pk];
  10702. var pid = typeof current.pid != 'undefined' ? current.pid : '';
  10703. var params = {
  10704. url: table.bootstrapTable('getOptions').extend.dragsort_url,
  10705. data: {
  10706. ids: ids.join(','),
  10707. changeid: changeid,
  10708. pid: pid,
  10709. field: Table.config.dragsortfield,
  10710. orderway: options.sortOrder,
  10711. table: options.extend.table,
  10712. pk: options.pk
  10713. }
  10714. };
  10715. Fast.api.ajax(params, function (data, ret) {
  10716. var success = $(element).data("success") || $.noop;
  10717. if (typeof success === 'function') {
  10718. if (false === success.call(element, data, ret)) {
  10719. return false;
  10720. }
  10721. }
  10722. table.bootstrapTable('refresh');
  10723. }, function (data, ret) {
  10724. var error = $(element).data("error") || $.noop;
  10725. if (typeof error === 'function') {
  10726. if (false === error.call(element, data, ret)) {
  10727. return false;
  10728. }
  10729. }
  10730. table.bootstrapTable('refresh');
  10731. });
  10732. },
  10733. placeHolderTemplate: ""
  10734. });
  10735. });
  10736. table.on("click", "input[data-id][name='checkbox']", function (e) {
  10737. var ids = $(this).data("id");
  10738. table.bootstrapTable($(this).prop("checked") ? 'checkBy' : 'uncheckBy', {field: options.pk, values: [ids]});
  10739. });
  10740. table.on("click", "[data-id].btn-change", function (e) {
  10741. e.preventDefault();
  10742. var changer = $.proxy(function () {
  10743. Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this);
  10744. }, this);
  10745. if (typeof $(this).data("confirm") !== 'undefined') {
  10746. Layer.confirm($(this).data("confirm"), function (index) {
  10747. changer();
  10748. Layer.close(index);
  10749. });
  10750. } else {
  10751. changer();
  10752. }
  10753. });
  10754. table.on("click", "[data-id].btn-edit", function (e) {
  10755. e.preventDefault();
  10756. var ids = $(this).data("id");
  10757. var row = Table.api.getrowbyid(table, ids);
  10758. row.ids = ids;
  10759. var url = Table.api.replaceurl(options.extend.edit_url, row, table);
  10760. Fast.api.open(url, $(this).data("original-title") || $(this).attr("title") || __('Edit'), $(this).data() || {});
  10761. });
  10762. table.on("click", "[data-id].btn-del", function (e) {
  10763. e.preventDefault();
  10764. var id = $(this).data("id");
  10765. var that = this;
  10766. Layer.confirm(
  10767. __('Are you sure you want to delete this item?'),
  10768. {icon: 3, title: __('Warning'), shadeClose: true, btn: [__('OK'), __('Cancel')]},
  10769. function (index) {
  10770. Table.api.multi("del", id, table, that);
  10771. Layer.close(index);
  10772. }
  10773. );
  10774. });
  10775. //修复dropdown定位溢出的情况
  10776. if (options.fixDropdownPosition) {
  10777. var tableBody = table.closest(".fixed-table-body");
  10778. table.on('show.bs.dropdown fa.event.refreshdropdown', ".btn-group", function (e) {
  10779. var dropdownMenu = $(".dropdown-menu", this);
  10780. var btnGroup = $(this);
  10781. var isPullRight = dropdownMenu.hasClass("pull-right") || dropdownMenu.hasClass("dropdown-menu-right");
  10782. var left, top, position;
  10783. if (dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
  10784. position = 'fixed';
  10785. top = btnGroup.offset().top - $(window).scrollTop() + btnGroup.outerHeight();
  10786. left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
  10787. } else {
  10788. if (btnGroup.offset().top + btnGroup.outerHeight() + dropdownMenu.outerHeight() > tableBody.offset().top + tableBody.outerHeight() - 30) {
  10789. position = 'absolute';
  10790. left = isPullRight ? -(dropdownMenu.outerWidth() - btnGroup.outerWidth()) : 0;
  10791. top = -(dropdownMenu.outerHeight() + 3);
  10792. }
  10793. }
  10794. if (left || top) {
  10795. dropdownMenu.css({
  10796. position: position, left: left, top: top, right: 'inherit'
  10797. });
  10798. }
  10799. });
  10800. var checkdropdown = function () {
  10801. if ($(".btn-group.open", table).length > 0 && $(".btn-group.open .dropdown-menu", table).css("position") == 'fixed') {
  10802. $(".btn-group.open", table).trigger("fa.event.refreshdropdown");
  10803. }
  10804. };
  10805. $(window).on("scroll", function () {
  10806. checkdropdown();
  10807. });
  10808. tableBody.on("scroll", function () {
  10809. checkdropdown();
  10810. });
  10811. }
  10812. var id = table.attr("id");
  10813. Table.list[id] = table;
  10814. return table;
  10815. },
  10816. // 批量操作请求
  10817. multi: function (action, ids, table, element) {
  10818. var options = table.bootstrapTable('getOptions');
  10819. var data = element ? $(element).data() : {};
  10820. ids = ($.isArray(ids) ? ids.join(",") : ids);
  10821. var url = typeof data.url !== "undefined" ? data.url : (action == "del" ? options.extend.del_url : options.extend.multi_url);
  10822. var params = typeof data.params !== "undefined" ? (typeof data.params == 'object' ? $.param(data.params) : data.params) : '';
  10823. options = {url: url, data: {action: action, ids: ids, params: params}};
  10824. Fast.api.ajax(options, function (data, ret) {
  10825. table.trigger("uncheckbox");
  10826. var success = $(element).data("success") || $.noop;
  10827. if (typeof success === 'function') {
  10828. if (false === success.call(element, data, ret)) {
  10829. return false;
  10830. }
  10831. }
  10832. table.bootstrapTable('refresh');
  10833. }, function (data, ret) {
  10834. var error = $(element).data("error") || $.noop;
  10835. if (typeof error === 'function') {
  10836. if (false === error.call(element, data, ret)) {
  10837. return false;
  10838. }
  10839. }
  10840. });
  10841. },
  10842. // 单元格元素事件
  10843. events: {
  10844. operate: {
  10845. 'click .btn-editone': function (e, value, row, index) {
  10846. e.stopPropagation();
  10847. e.preventDefault();
  10848. var table = $(this).closest('table');
  10849. var options = table.bootstrapTable('getOptions');
  10850. var ids = row[options.pk];
  10851. row = $.extend({}, row ? row : {}, {ids: ids});
  10852. var url = options.extend.edit_url;
  10853. Fast.api.open(Table.api.replaceurl(url, row, table), $(this).data("original-title") || $(this).attr("title") || __('Edit'), $(this).data() || {});
  10854. },
  10855. 'click .btn-delone': function (e, value, row, index) {
  10856. e.stopPropagation();
  10857. e.preventDefault();
  10858. var that = this;
  10859. var top = $(that).offset().top - $(window).scrollTop();
  10860. var left = $(that).offset().left - $(window).scrollLeft() - 260;
  10861. if (top + 154 > $(window).height()) {
  10862. top = top - 154;
  10863. }
  10864. if ($(window).width() < 480) {
  10865. top = left = undefined;
  10866. }
  10867. Layer.confirm(
  10868. __('Are you sure you want to delete this item?'),
  10869. {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true, btn: [__('OK'), __('Cancel')]},
  10870. function (index) {
  10871. var table = $(that).closest('table');
  10872. var options = table.bootstrapTable('getOptions');
  10873. Table.api.multi("del", row[options.pk], table, that);
  10874. Layer.close(index);
  10875. }
  10876. );
  10877. }
  10878. },//单元格图片预览
  10879. image: {
  10880. 'click .img-center': function (e, value, row, index) {
  10881. var data = [];
  10882. value = value === null ? '' : value.toString();
  10883. var arr = value != '' ? value.split(",") : [];
  10884. $.each(arr, function (index, value) {
  10885. data.push({
  10886. src: Fast.api.cdnurl(value),
  10887. });
  10888. });
  10889. Layer.photos({
  10890. photos: {
  10891. "start": $(this).parent().index(),
  10892. "data": data
  10893. },
  10894. anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
  10895. });
  10896. },
  10897. }
  10898. },
  10899. // 单元格数据格式化
  10900. formatter: {
  10901. icon: function (value, row, index) {
  10902. value = value === null ? '' : value.toString();
  10903. value = value.indexOf(" ") > -1 ? value : "fa fa-" + value;
  10904. //渲染fontawesome图标
  10905. return '<i class="' + value + '"></i> ' + value;
  10906. },
  10907. image: function (value, row, index) {
  10908. value = value == null || value.length === 0 ? '' : value.toString();
  10909. value = value ? value : '/assets/img/blank.gif';
  10910. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  10911. return '<a href="javascript:"><img class="' + classname + '" src="' + Fast.api.cdnurl(value) + '" /></a>';
  10912. },
  10913. images: function (value, row, index) {
  10914. value = value == null || value.length === 0 ? '' : value.toString();
  10915. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  10916. var arr = value != '' ? value.split(',') : [];
  10917. var html = [];
  10918. $.each(arr, function (i, value) {
  10919. value = value ? value : '/assets/img/blank.gif';
  10920. html.push('<a href="javascript:"><img class="' + classname + '" src="' + Fast.api.cdnurl(value) + '" /></a>');
  10921. });
  10922. return html.join(' ');
  10923. },
  10924. content: function (value, row, index) {
  10925. var width = this.width != undefined ? (this.width.match(/^\d+$/) ? this.width + "px" : this.width) : "250px";
  10926. return "<div style='white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:" + width + ";'>" + value + "</div>";
  10927. },
  10928. status: function (value, row, index) {
  10929. var custom = {normal: 'success', hidden: 'gray', deleted: 'danger', locked: 'info'};
  10930. if (typeof this.custom !== 'undefined') {
  10931. custom = $.extend(custom, this.custom);
  10932. }
  10933. this.custom = custom;
  10934. this.icon = 'fa fa-circle';
  10935. return Table.api.formatter.normal.call(this, value, row, index);
  10936. },
  10937. normal: function (value, row, index) {
  10938. var colorArr = ["primary", "success", "danger", "warning", "info", "gray", "red", "yellow", "aqua", "blue", "navy", "teal", "olive", "lime", "fuchsia", "purple", "maroon"];
  10939. var custom = {};
  10940. if (typeof this.custom !== 'undefined') {
  10941. custom = $.extend(custom, this.custom);
  10942. }
  10943. value = value == null || value.length === 0 ? '' : value.toString();
  10944. var keys = typeof this.searchList === 'object' ? Object.keys(this.searchList) : [];
  10945. var index = keys.indexOf(value);
  10946. var color = value && typeof custom[value] !== 'undefined' ? custom[value] : null;
  10947. var display = index > -1 ? this.searchList[value] : null;
  10948. var icon = typeof this.icon !== 'undefined' ? this.icon : null;
  10949. if (!color) {
  10950. color = index > -1 && typeof colorArr[index] !== 'undefined' ? colorArr[index] : 'primary';
  10951. }
  10952. if (!display) {
  10953. display = __(value.charAt(0).toUpperCase() + value.slice(1));
  10954. }
  10955. var html = '<span class="text-' + color + '">' + (icon ? '<i class="' + icon + '"></i> ' : '') + display + '</span>';
  10956. if (this.operate != false) {
  10957. html = '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + this.field + '" data-value="' + value + '">' + html + '</a>';
  10958. }
  10959. return html;
  10960. },
  10961. toggle: function (value, row, index) {
  10962. var table = this.table;
  10963. var options = table ? table.bootstrapTable('getOptions') : {};
  10964. var pk = options.pk || "id";
  10965. var color = typeof this.color !== 'undefined' ? this.color : 'success';
  10966. var yes = typeof this.yes !== 'undefined' ? this.yes : 1;
  10967. var no = typeof this.no !== 'undefined' ? this.no : 0;
  10968. var url = typeof this.url !== 'undefined' ? this.url : '';
  10969. var confirm = '';
  10970. var disable = false;
  10971. if (typeof this.confirm !== "undefined") {
  10972. confirm = typeof this.confirm === "function" ? this.confirm.call(this, value, row, index) : this.confirm;
  10973. }
  10974. if (typeof this.disable !== "undefined") {
  10975. disable = typeof this.disable === "function" ? this.disable.call(this, value, row, index) : this.disable;
  10976. }
  10977. return "<a href='javascript:;' data-toggle='tooltip' title='" + __('Click to toggle') + "' class='btn-change " + (disable ? 'btn disabled no-padding' : '') + "' data-index='" + index + "' data-id='"
  10978. + row[pk] + "' " + (url ? "data-url='" + url + "'" : "") + (confirm ? "data-confirm='" + confirm + "'" : "") + " data-params='" + this.field + "=" + (value == yes ? no : yes) + "'><i class='fa fa-toggle-on text-success text-" + color + " " + (value == yes ? '' : 'fa-flip-horizontal text-gray') + " fa-2x'></i></a>";
  10979. },
  10980. url: function (value, row, index) {
  10981. value = value == null || value.length === 0 ? '' : value.toString();
  10982. return '<div class="input-group input-group-sm" style="width:250px;margin:0 auto;"><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>';
  10983. },
  10984. search: function (value, row, index) {
  10985. var field = this.field;
  10986. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  10987. value = row[this.customField];
  10988. field = this.customField;
  10989. }
  10990. return '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', value) + '" data-field="' + field + '" data-value="' + value + '">' + value + '</a>';
  10991. },
  10992. addtabs: function (value, row, index) {
  10993. var url = Table.api.replaceurl(this.url || '', row, this.table);
  10994. var title = this.atitle ? this.atitle : __("Search %s", value);
  10995. return '<a href="' + Fast.api.fixurl(url) + '" class="addtabsit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  10996. },
  10997. dialog: function (value, row, index) {
  10998. var url = Table.api.replaceurl(this.url || '', row, this.table);
  10999. var title = this.atitle ? this.atitle : __("View %s", value);
  11000. return '<a href="' + Fast.api.fixurl(url) + '" class="dialogit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  11001. },
  11002. flag: function (value, row, index) {
  11003. var that = this;
  11004. value = value == null || value.length === 0 ? '' : value.toString();
  11005. var colorArr = {index: 'success', hot: 'warning', recommend: 'danger', 'new': 'info'};
  11006. //如果字段列有定义custom
  11007. if (typeof this.custom !== 'undefined') {
  11008. colorArr = $.extend(colorArr, this.custom);
  11009. }
  11010. var field = this.field;
  11011. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  11012. value = row[this.customField];
  11013. field = this.customField;
  11014. }
  11015. if (typeof that.searchList === 'object' && typeof that.custom === 'undefined') {
  11016. var i = 0;
  11017. var searchValues = Object.values(colorArr);
  11018. $.each(that.searchList, function (key, val) {
  11019. if (typeof colorArr[key] == 'undefined') {
  11020. colorArr[key] = searchValues[i];
  11021. i = typeof searchValues[i + 1] === 'undefined' ? 0 : i + 1;
  11022. }
  11023. });
  11024. }
  11025. //渲染Flag
  11026. var html = [];
  11027. var arr = value != '' ? value.split(',') : [];
  11028. var color, display, label;
  11029. $.each(arr, function (i, value) {
  11030. value = value == null || value.length === 0 ? '' : value.toString();
  11031. if (value == '')
  11032. return true;
  11033. color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  11034. display = typeof that.searchList !== 'undefined' && typeof that.searchList[value] !== 'undefined' ? that.searchList[value] : __(value.charAt(0).toUpperCase() + value.slice(1));
  11035. label = '<span class="label label-' + color + '">' + display + '</span>';
  11036. if (that.operate) {
  11037. html.push('<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + field + '" data-value="' + value + '">' + label + '</a>');
  11038. } else {
  11039. html.push(label);
  11040. }
  11041. });
  11042. return html.join(' ');
  11043. },
  11044. label: function (value, row, index) {
  11045. return Table.api.formatter.flag.call(this, value, row, index);
  11046. },
  11047. datetime: function (value, row, index) {
  11048. var datetimeFormat = typeof this.datetimeFormat === 'undefined' ? 'YYYY-MM-DD HH:mm:ss' : this.datetimeFormat;
  11049. if (isNaN(value)) {
  11050. return value ? Moment(value).format(datetimeFormat) : __('None');
  11051. } else {
  11052. return value ? Moment(parseInt(value) * 1000).format(datetimeFormat) : __('None');
  11053. }
  11054. },
  11055. operate: function (value, row, index) {
  11056. var table = this.table;
  11057. // 操作配置
  11058. var options = table ? table.bootstrapTable('getOptions') : {};
  11059. // 默认按钮组
  11060. var buttons = $.extend([], this.buttons || []);
  11061. // 所有按钮名称
  11062. var names = [];
  11063. buttons.forEach(function (item) {
  11064. names.push(item.name);
  11065. });
  11066. if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
  11067. buttons.push(Table.button.dragsort);
  11068. }
  11069. if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
  11070. Table.button.edit.url = options.extend.edit_url;
  11071. buttons.push(Table.button.edit);
  11072. }
  11073. if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
  11074. buttons.push(Table.button.del);
  11075. }
  11076. return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
  11077. }
  11078. ,
  11079. buttons: function (value, row, index) {
  11080. // 默认按钮组
  11081. var buttons = $.extend([], this.buttons || []);
  11082. return Table.api.buttonlink(this, buttons, value, row, index, 'buttons');
  11083. }
  11084. },
  11085. buttonlink: function (column, buttons, value, row, index, type) {
  11086. var table = column.table;
  11087. column.clickToSelect = false;
  11088. type = typeof type === 'undefined' ? 'buttons' : type;
  11089. var options = table ? table.bootstrapTable('getOptions') : {};
  11090. var html = [];
  11091. var hidden, visible, disable, url, classname, icon, text, title, refresh, confirm, extend,
  11092. dropdown, link;
  11093. var fieldIndex = column.fieldIndex;
  11094. var dropdowns = {};
  11095. $.each(buttons, function (i, j) {
  11096. if (type === 'operate') {
  11097. if (j.name === 'dragsort' && typeof row[Table.config.dragsortfield] === 'undefined') {
  11098. return true;
  11099. }
  11100. if (['add', 'edit', 'del', 'multi', 'dragsort'].indexOf(j.name) > -1 && !options.extend[j.name + "_url"]) {
  11101. return true;
  11102. }
  11103. }
  11104. var attr = table.data(type + "-" + j.name);
  11105. if (typeof attr === 'undefined' || attr) {
  11106. hidden = typeof j.hidden === 'function' ? j.hidden.call(table, row, j) : (typeof j.hidden !== 'undefined' ? j.hidden : false);
  11107. if (hidden) {
  11108. return true;
  11109. }
  11110. visible = typeof j.visible === 'function' ? j.visible.call(table, row, j) : (typeof j.visible !== 'undefined' ? j.visible : true);
  11111. if (!visible) {
  11112. return true;
  11113. }
  11114. dropdown = j.dropdown ? j.dropdown : '';
  11115. url = j.url ? j.url : '';
  11116. url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
  11117. classname = j.classname ? j.classname : 'btn-primary btn-' + name + 'one';
  11118. icon = j.icon ? j.icon : '';
  11119. text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : '';
  11120. title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text;
  11121. refresh = j.refresh ? 'data-refresh="' + j.refresh + '"' : '';
  11122. confirm = typeof j.confirm === 'function' ? j.confirm.call(table, row, j) : (typeof j.confirm !== 'undefined' ? j.confirm : false);
  11123. confirm = confirm ? 'data-confirm="' + confirm + '"' : '';
  11124. extend = j.extend ? j.extend : '';
  11125. disable = typeof j.disable === 'function' ? j.disable.call(table, row, j) : (typeof j.disable !== 'undefined' ? j.disable : false);
  11126. if (disable) {
  11127. classname = classname + ' disabled';
  11128. }
  11129. link = '<a href="' + url + '" class="' + classname + '" ' + (confirm ? confirm + ' ' : '') + (refresh ? refresh + ' ' : '') + extend + ' title="' + title + '" data-table-id="' + (table ? table.attr("id") : '') + '" data-field-index="' + fieldIndex + '" data-row-index="' + index + '" data-button-index="' + i + '"><i class="' + icon + '"></i>' + (text ? ' ' + text : '') + '</a>';
  11130. if (dropdown) {
  11131. if (typeof dropdowns[dropdown] == 'undefined') {
  11132. dropdowns[dropdown] = [];
  11133. }
  11134. dropdowns[dropdown].push(link);
  11135. } else {
  11136. html.push(link);
  11137. }
  11138. }
  11139. });
  11140. if (!$.isEmptyObject(dropdowns)) {
  11141. var dropdownHtml = [];
  11142. $.each(dropdowns, function (i, j) {
  11143. dropdownHtml.push('<div class="btn-group"><button type="button" class="btn btn-primary dropdown-toggle btn-xs" data-toggle="dropdown">' + i + '</button><button type="button" class="btn btn-primary dropdown-toggle btn-xs" data-toggle="dropdown"><span class="caret"></span></button><ul class="dropdown-menu dropdown-menu-right"><li>' + j.join('</li><li>') + '</li></ul></div>');
  11144. });
  11145. html.unshift(dropdownHtml);
  11146. }
  11147. return html.join(' ');
  11148. },
  11149. //替换URL中的数据
  11150. replaceurl: function (url, row, table) {
  11151. var options = table ? table.bootstrapTable('getOptions') : null;
  11152. var ids = options ? row[options.pk] : 0;
  11153. row.ids = ids ? ids : (typeof row.ids !== 'undefined' ? row.ids : 0);
  11154. url = url == null || url.length === 0 ? '' : url.toString();
  11155. //自动添加ids参数
  11156. url = !url.match(/\{ids\}/i) ? url + (url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + '{ids}' : url;
  11157. url = url.replace(/\{(.*?)\}/gi, function (matched) {
  11158. matched = matched.substring(1, matched.length - 1);
  11159. if (matched.indexOf(".") !== -1) {
  11160. var temp = row;
  11161. var arr = matched.split(/\./);
  11162. for (var i = 0; i < arr.length; i++) {
  11163. if (typeof temp[arr[i]] !== 'undefined') {
  11164. temp = temp[arr[i]];
  11165. }
  11166. }
  11167. return typeof temp === 'object' ? '' : temp;
  11168. }
  11169. return row[matched];
  11170. });
  11171. return url;
  11172. },
  11173. // 获取选中的条目ID集合
  11174. selectedids: function (table, current) {
  11175. var options = table.bootstrapTable('getOptions');
  11176. //如果有设置翻页记忆模式
  11177. if (!current && options.maintainSelected) {
  11178. return options.selectedIds;
  11179. }
  11180. return $.map(table.bootstrapTable('getSelections'), function (row) {
  11181. return row[options.pk];
  11182. });
  11183. },
  11184. //获取选中的数据
  11185. selecteddata: function (table, current) {
  11186. var options = table.bootstrapTable('getOptions');
  11187. //如果有设置翻页记忆模式
  11188. if (!current && options.maintainSelected) {
  11189. return options.selectedData;
  11190. }
  11191. return table.bootstrapTable('getSelections');
  11192. },
  11193. // 切换复选框状态
  11194. toggleattr: function (table) {
  11195. $("input[type='checkbox']", table).trigger('click');
  11196. },
  11197. // 根据行索引获取行数据
  11198. getrowdata: function (table, index) {
  11199. index = parseInt(index);
  11200. var data = table.bootstrapTable('getData');
  11201. return typeof data[index] !== 'undefined' ? data[index] : null;
  11202. },
  11203. // 根据行索引获取行数据
  11204. getrowbyindex: function (table, index) {
  11205. return Table.api.getrowdata(table, index);
  11206. },
  11207. // 根据主键ID获取行数据
  11208. getrowbyid: function (table, id) {
  11209. var row = {};
  11210. var options = table.bootstrapTable("getOptions");
  11211. $.each(Table.api.selecteddata(table), function (i, j) {
  11212. if (j[options.pk] == id) {
  11213. row = j;
  11214. return false;
  11215. }
  11216. });
  11217. return row;
  11218. }
  11219. },
  11220. };
  11221. return Table;
  11222. });
  11223. // jQuery List DragSort v0.5.2
  11224. // Website: http://dragsort.codeplex.com/
  11225. // License: http://dragsort.codeplex.com/license
  11226. (function($) {
  11227. $.fn.dragsort = function(options) {
  11228. if (options == "destroy") {
  11229. $(this.selector).trigger("dragsort-uninit");
  11230. return;
  11231. }
  11232. var opts = $.extend({}, $.fn.dragsort.defaults, options);
  11233. var lists = [];
  11234. var list = null, lastPos = null;
  11235. this.each(function(i, cont) {
  11236. //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
  11237. if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody"))
  11238. cont = $(cont).children().get(0);
  11239. var newList = {
  11240. draggedItem: null,
  11241. placeHolderItem: null,
  11242. pos: null,
  11243. offset: null,
  11244. offsetLimit: null,
  11245. scroll: null,
  11246. container: cont,
  11247. init: function() {
  11248. //set options to default values if not set
  11249. opts.tagName = opts.tagName == "" ? ($(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase()) : opts.tagName;
  11250. if (opts.itemSelector == "")
  11251. opts.itemSelector = opts.tagName;
  11252. if (opts.dragSelector == "")
  11253. opts.dragSelector = opts.tagName;
  11254. if (opts.placeHolderTemplate == "")
  11255. opts.placeHolderTemplate = "<" + opts.tagName + ">&nbsp;</" + opts.tagName + ">";
  11256. //listidx allows reference back to correct list variable instance
  11257. $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit);
  11258. this.styleDragHandlers(true);
  11259. },
  11260. uninit: function() {
  11261. var list = lists[$(this).attr("data-listidx")];
  11262. $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit");
  11263. list.styleDragHandlers(false);
  11264. },
  11265. getItems: function() {
  11266. return $(this.container).children(opts.itemSelector);
  11267. },
  11268. styleDragHandlers: function(cursor) {
  11269. this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : "");
  11270. },
  11271. grabItem: function(e) {
  11272. var list = lists[$(this).attr("data-listidx")];
  11273. var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0);
  11274. var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0;
  11275. //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return
  11276. if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem)
  11277. return;
  11278. //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,
  11279. //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude
  11280. //e.preventDefault();
  11281. //change cursor to move while dragging
  11282. var dragHandle = e.target;
  11283. while (!$(dragHandle).is(opts.dragSelector)) {
  11284. if (dragHandle == this) return;
  11285. dragHandle = dragHandle.parentNode;
  11286. }
  11287. $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor"));
  11288. $(dragHandle).css("cursor", "move");
  11289. //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work
  11290. var listElem = this;
  11291. var trigger = function() {
  11292. list.dragStart.call(listElem, e);
  11293. $(list.container).unbind("mousemove", trigger);
  11294. };
  11295. $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); });
  11296. },
  11297. dragStart: function(e) {
  11298. if (list != null && list.draggedItem != null)
  11299. list.dropItem();
  11300. list = lists[$(this).attr("data-listidx")];
  11301. list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName)
  11302. //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
  11303. list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem));
  11304. //calculate mouse offset relative to draggedItem
  11305. var mt = parseInt(list.draggedItem.css("marginTop"));
  11306. var ml = parseInt(list.draggedItem.css("marginLeft"));
  11307. list.offset = list.draggedItem.offset();
  11308. list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1;
  11309. list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1;
  11310. //calculate box the dragged item can't be dragged outside of
  11311. if (!opts.dragBetween) {
  11312. 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();
  11313. list.offsetLimit = $(list.container).offset();
  11314. list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth();
  11315. list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
  11316. }
  11317. //create placeholder item
  11318. var h = list.draggedItem.height();
  11319. var w = list.draggedItem.width();
  11320. if (opts.tagName == "tr") {
  11321. list.draggedItem.children().each(function() { $(this).width($(this).width()); });
  11322. list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true);
  11323. list.draggedItem.after(list.placeHolderItem);
  11324. //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html("&nbsp;"); });
  11325. list.placeHolderItem.children().each(function() { $(this).html("&nbsp;"); });
  11326. } else {
  11327. list.draggedItem.after(opts.placeHolderTemplate);
  11328. list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true);
  11329. }
  11330. if (opts.tagName == "td") {
  11331. var listTable = list.draggedItem.closest("table").get(0);
  11332. $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").appendTo("body").children().append(list.draggedItem);
  11333. }
  11334. //style draggedItem while dragging
  11335. var orig = list.draggedItem.attr("style");
  11336. list.draggedItem.attr("data-origstyle", orig ? orig : "");
  11337. list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w });
  11338. //auto-scroll setup
  11339. list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() };
  11340. list.scroll.scrollY = window.setInterval(function() {
  11341. if (opts.scrollContainer != window) {
  11342. $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY);
  11343. return;
  11344. }
  11345. var t = $(opts.scrollContainer).scrollTop();
  11346. if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) {
  11347. $(opts.scrollContainer).scrollTop(t + list.scroll.moveY);
  11348. list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1);
  11349. }
  11350. }, 10);
  11351. list.scroll.scrollX = window.setInterval(function() {
  11352. if (opts.scrollContainer != window) {
  11353. $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX);
  11354. return;
  11355. }
  11356. var l = $(opts.scrollContainer).scrollLeft();
  11357. if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) {
  11358. $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX);
  11359. list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1);
  11360. }
  11361. }, 10);
  11362. //misc
  11363. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  11364. list.setPos(e.pageX, e.pageY);
  11365. $(document).bind("mousemove", list.swapItems);
  11366. $(document).bind("mouseup", list.dropItem);
  11367. if (opts.scrollContainer != window)
  11368. $(window).bind("wheel", list.wheel);
  11369. },
  11370. //set position of draggedItem
  11371. setPos: function(x, y) {
  11372. //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner
  11373. var top = y - this.offset.top;
  11374. var left = x - this.offset.left;
  11375. //limit top, left to within box draggedItem can't be dragged outside of
  11376. if (!opts.dragBetween) {
  11377. top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
  11378. left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
  11379. }
  11380. //adjust top & left calculations to parent offset
  11381. var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin
  11382. if (parent != null) {
  11383. top -= parent.top;
  11384. left -= parent.left;
  11385. }
  11386. //set x or y auto-scroll amount
  11387. if (opts.scrollContainer == window) {
  11388. y -= $(window).scrollTop();
  11389. x -= $(window).scrollLeft();
  11390. y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5);
  11391. x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5);
  11392. } else {
  11393. var cont = $(opts.scrollContainer);
  11394. var offset = cont.offset();
  11395. y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top);
  11396. x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left);
  11397. }
  11398. list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x);
  11399. list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y);
  11400. //move draggedItem to new mouse cursor location
  11401. this.draggedItem.css({ top: top, left: left });
  11402. },
  11403. //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over
  11404. wheel: function(e) {
  11405. if (list && opts.scrollContainer != window) {
  11406. var cont = $(opts.scrollContainer);
  11407. var offset = cont.offset();
  11408. e = e.originalEvent;
  11409. if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) {
  11410. var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY;
  11411. cont.scrollTop(cont.scrollTop() + deltaY);
  11412. e.preventDefault();
  11413. }
  11414. }
  11415. },
  11416. //build a table recording all the positions of the moveable list items
  11417. buildPositionTable: function() {
  11418. var pos = [];
  11419. this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) {
  11420. var loc = $(this).offset();
  11421. loc.right = loc.left + $(this).outerWidth();
  11422. loc.bottom = loc.top + $(this).outerHeight();
  11423. loc.elm = this;
  11424. pos[i] = loc;
  11425. });
  11426. this.pos = pos;
  11427. },
  11428. dropItem: function() {
  11429. if (list.draggedItem == null)
  11430. return;
  11431. //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower
  11432. //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower)
  11433. var orig = list.draggedItem.attr("data-origstyle");
  11434. list.draggedItem.attr("style", orig);
  11435. if (orig == "")
  11436. list.draggedItem.removeAttr("style");
  11437. list.draggedItem.removeAttr("data-origstyle");
  11438. list.styleDragHandlers(true);
  11439. list.placeHolderItem.before(list.draggedItem);
  11440. list.placeHolderItem.remove();
  11441. $("[data-droptarget], .dragSortItem").remove();
  11442. window.clearInterval(list.scroll.scrollY);
  11443. window.clearInterval(list.scroll.scrollX);
  11444. //if position changed call dragEnd
  11445. if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem))
  11446. if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order
  11447. var pos = list.draggedItem.attr("data-origpos").split('-');
  11448. var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]);
  11449. if (nextItem.size() > 0)
  11450. nextItem.before(list.draggedItem);
  11451. else if (pos[1] == 0) //was the only item in list
  11452. $(lists[pos[0]].container).prepend(list.draggedItem);
  11453. else //was the last item in list
  11454. $(lists[pos[0]].container).append(list.draggedItem);
  11455. }
  11456. list.draggedItem.removeAttr("data-origpos");
  11457. list.draggedItem = null;
  11458. $(document).unbind("mousemove", list.swapItems);
  11459. $(document).unbind("mouseup", list.dropItem);
  11460. if (opts.scrollContainer != window)
  11461. $(window).unbind("wheel", list.wheel);
  11462. return false;
  11463. },
  11464. //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of
  11465. swapItems: function(e) {
  11466. if (list.draggedItem == null)
  11467. return false;
  11468. //move draggedItem to mouse location
  11469. list.setPos(e.pageX, e.pageY);
  11470. //retrieve list and item position mouse cursor is over
  11471. var ei = list.findPos(e.pageX, e.pageY);
  11472. var nlist = list;
  11473. for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) {
  11474. ei = lists[i].findPos(e.pageX, e.pageY);
  11475. nlist = lists[i];
  11476. }
  11477. //if not over another moveable list item return
  11478. if (ei == -1)
  11479. return false;
  11480. //save fixed items locations
  11481. var children = function() { return $(nlist.container).children().not(nlist.draggedItem); };
  11482. var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); });
  11483. //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after
  11484. if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left)
  11485. $(nlist.pos[ei].elm).before(list.placeHolderItem);
  11486. else
  11487. $(nlist.pos[ei].elm).after(list.placeHolderItem);
  11488. //restore fixed items location
  11489. fixed.each(function() {
  11490. var elm = children().eq(this.idx).get(0);
  11491. if (this != elm && children().index(this) < this.idx)
  11492. $(this).insertAfter(elm);
  11493. else if (this != elm)
  11494. $(this).insertBefore(elm);
  11495. });
  11496. //misc
  11497. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  11498. lastPos = list.draggedItem.offset();
  11499. return false;
  11500. },
  11501. //returns the index of the list item the mouse is over
  11502. findPos: function(x, y) {
  11503. for (var i = 0; i < this.pos.length; i++) {
  11504. if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y)
  11505. return i;
  11506. }
  11507. return -1;
  11508. },
  11509. //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position
  11510. createDropTargets: function() {
  11511. if (!opts.dragBetween)
  11512. return;
  11513. $(lists).each(function() {
  11514. var ph = $(this.container).find("[data-placeholder]");
  11515. var dt = $(this.container).find("[data-droptarget]");
  11516. if (ph.size() > 0 && dt.size() > 0)
  11517. dt.remove();
  11518. else if (ph.size() == 0 && dt.size() == 0) {
  11519. if (opts.tagName == "td")
  11520. $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container);
  11521. else
  11522. //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8)
  11523. $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true));
  11524. list.placeHolderItem.attr("data-placeholder", true);
  11525. }
  11526. });
  11527. }
  11528. };
  11529. newList.init();
  11530. lists.push(newList);
  11531. });
  11532. return this;
  11533. };
  11534. $.fn.dragsort.defaults = {
  11535. tagName:"",
  11536. itemSelector: "",
  11537. dragSelector: "",
  11538. dragSelectorExclude: "input, textarea",
  11539. dragEnd: function() { },
  11540. dragBetween: false,
  11541. placeHolderTemplate: "",
  11542. scrollContainer: window,
  11543. scrollSpeed: 5
  11544. };
  11545. })(jQuery);
  11546. define("dragsort", function(){});
  11547. /*!
  11548. * jquery.event.drag - v 2.2
  11549. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  11550. * Open Source MIT License - http://threedubmedia.com/code/license
  11551. */
  11552. ;(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);
  11553. define("drag", function(){});
  11554. /*!
  11555. * jquery.event.drop - v 2.2
  11556. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  11557. * Open Source MIT License - http://threedubmedia.com/code/license
  11558. */
  11559. ;(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);
  11560. define("drop", function(){});
  11561. /**
  11562. * http://git.oschina.net/hbbcs/bootStrap-addTabs
  11563. * Created by joe on 2015-12-19.
  11564. * Modified by Karson
  11565. */
  11566. (function ($) {
  11567. $.fn.addtabs = function (options) {
  11568. var obj = $(this);
  11569. options = $.extend({
  11570. content: '', //直接指定所有页面TABS内容
  11571. close: true, //是否可以关闭
  11572. monitor: 'body', //监视的区域
  11573. nav: '.nav-addtabs',
  11574. tab: '.tab-addtabs',
  11575. iframeUse: true, //使用iframe还是ajax
  11576. iframeHeight: $(window).height() - 50, //固定TAB中IFRAME高度,根据需要自己修改
  11577. iframeForceRefresh: false, //点击后强制加载对应的iframe
  11578. iframeForceRefreshTable: false, //点击后强制刷新对应的iframe中的table
  11579. callback: function () {
  11580. //关闭后回调函数
  11581. }
  11582. }, options || {});
  11583. var navobj = $(options.nav);
  11584. var tabobj = $(options.tab);
  11585. if (history.pushState) {
  11586. //浏览器前进后退事件
  11587. $(window).on("popstate", function (e) {
  11588. var state = e.originalEvent.state;
  11589. if (state) {
  11590. $("a[addtabs=" + state.id + "]", options.monitor).data("pushstate", true).trigger("click");
  11591. }
  11592. });
  11593. }
  11594. $(options.monitor).on('click', '[addtabs]', function (e) {
  11595. if ($(this).attr('url').indexOf("javascript:") !== 0) {
  11596. if ($(this).is("a")) {
  11597. e.preventDefault();
  11598. }
  11599. var id = $(this).attr('addtabs');
  11600. var title = $(this).attr('title') ? $(this).attr('title') : $.trim($(this).text());
  11601. var url = $(this).attr('url');
  11602. var content = options.content ? options.content : $(this).attr('content');
  11603. var ajax = $(this).attr('ajax') === '1' || $(this).attr('ajax') === 'true';
  11604. var state = ({
  11605. url: url, title: title, id: id, content: content, ajax: ajax
  11606. });
  11607. document.title = title;
  11608. if (history.pushState && !$(this).data("pushstate")) {
  11609. var pushurl = url.indexOf("ref=addtabs") === -1 ? (url + (url.indexOf("?") > -1 ? "&" : "?") + "ref=addtabs") : url;
  11610. try {
  11611. window.history.pushState(state, title, pushurl);
  11612. } catch (e) {
  11613. }
  11614. }
  11615. $(this).data("pushstate", null);
  11616. _add.call(this, {
  11617. id: id,
  11618. title: $(this).attr('title') ? $(this).attr('title') : $(this).html(),
  11619. content: content,
  11620. url: url,
  11621. ajax: ajax
  11622. });
  11623. }
  11624. });
  11625. navobj.on('click', '.close-tab', function () {
  11626. var id = $(this).prev("a").attr("aria-controls");
  11627. _close(id);
  11628. return false;
  11629. });
  11630. navobj.on('dblclick', 'li[role=presentation]', function () {
  11631. $(this).find(".close-tab").trigger("click");
  11632. });
  11633. navobj.on('click', 'li[role=presentation]', function () {
  11634. $("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click");
  11635. });
  11636. $(window).resize(function () {
  11637. if (typeof options.nav === 'object') {
  11638. var siblingsWidth = 0;
  11639. navobj.siblings().each(function () {
  11640. siblingsWidth += $(this).outerWidth();
  11641. });
  11642. navobj.width(navobj.parent().width() - siblingsWidth);
  11643. } else {
  11644. $("#nav").width($("#header").find("> .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20);
  11645. }
  11646. _drop();
  11647. });
  11648. var _add = function (opts) {
  11649. var id, tabid, conid, url;
  11650. id = opts.id;
  11651. tabid = 'tab_' + opts.id;
  11652. conid = 'con_' + opts.id;
  11653. url = opts.url;
  11654. url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1");
  11655. var tabitem = $('#' + tabid, navobj);
  11656. var conitem = $('#' + conid, tabobj);
  11657. navobj.find("[role='presentation']").removeClass('active');
  11658. tabobj.find("[role='tabpanel']").removeClass('active');
  11659. //如果TAB不存在,创建一个新的TAB
  11660. if (tabitem.size() === 0) {
  11661. //创建新TAB的title
  11662. tabitem = $('<li role="presentation" id="' + tabid + '"><a href="#' + conid + '" node-id="' + opts.id + '" aria-controls="' + id + '" role="tab" data-toggle="tab">' + opts.title + '</a></li>');
  11663. //是否允许关闭
  11664. if (options.close && $("li", navobj).size() > 0) {
  11665. tabitem.append(' <i class="close-tab fa fa-remove"></i>');
  11666. }
  11667. if (conitem.size() === 0) {
  11668. //创建新TAB的内容
  11669. conitem = $('<div role="tabpanel" class="tab-pane" id="' + conid + '"></div>');
  11670. //是否指定TAB内容
  11671. if (opts.content) {
  11672. conitem.append(opts.content);
  11673. } else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接
  11674. var height = options.iframeHeight;
  11675. conitem.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>');
  11676. } else {
  11677. $.get(url, function (data) {
  11678. conitem.append(data);
  11679. });
  11680. }
  11681. tabobj.append(conitem);
  11682. }
  11683. //加入TABS
  11684. if ($('.tabdrop li', navobj).size() > 0) {
  11685. $('.tabdrop ul', navobj).append(tabitem);
  11686. } else {
  11687. navobj.append(tabitem);
  11688. }
  11689. } else {
  11690. //强制刷新iframe
  11691. if (options.iframeForceRefresh) {
  11692. $("#" + conid + " iframe").attr('src', function (i, val) {
  11693. return val;
  11694. });
  11695. } else if (options.iframeForceRefreshTable) {
  11696. try {
  11697. //检测iframe中是否存在刷新按钮
  11698. if ($("#" + conid + " iframe").contents().find(".btn-refresh:not([data-force-refresh=false])").size() > 0) {
  11699. $("#" + conid + " iframe")[0].contentWindow.$(".btn-refresh:not([data-force-refresh=false])").trigger("click");
  11700. }
  11701. } catch (e) {
  11702. }
  11703. }
  11704. }
  11705. localStorage.setItem("addtabs", $(this).prop('outerHTML'));
  11706. //激活TAB
  11707. tabitem.addClass('active');
  11708. conitem.addClass("active");
  11709. _drop();
  11710. };
  11711. var _close = function (id) {
  11712. var tabid = 'tab_' + id;
  11713. var conid = 'con_' + id;
  11714. var tabitem = $('#' + tabid, navobj);
  11715. var conitem = $('#' + conid, tabobj);
  11716. //如果关闭的是当前激活的TAB,激活他的前一个TAB
  11717. if (obj.find("li.active").not('.tabdrop').attr('id') === tabid) {
  11718. var prev = tabitem.prev().not(".tabdrop");
  11719. var next = tabitem.next().not(".tabdrop");
  11720. if (prev.size() > 0) {
  11721. prev.find('a').trigger("click");
  11722. } else if (next.size() > 0) {
  11723. next.find('a').trigger("click");
  11724. } else {
  11725. $(">li:not(.tabdrop):last > a", navobj).trigger('click');
  11726. }
  11727. }
  11728. //关闭TAB
  11729. tabitem.remove();
  11730. conitem.remove();
  11731. _drop();
  11732. options.callback();
  11733. };
  11734. var _drop = function () {
  11735. navobj.refreshAddtabs();
  11736. };
  11737. };
  11738. //刷新Addtabs
  11739. $.fn.refreshAddtabs = function () {
  11740. var navobj = $(this);
  11741. var dropdown = $(".tabdrop", navobj);
  11742. if (dropdown.size() === 0) {
  11743. dropdown = $('<li class="dropdown pull-right hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;">' +
  11744. '<i class="glyphicon glyphicon-align-justify"></i>' +
  11745. ' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>');
  11746. dropdown.prependTo(navobj);
  11747. }
  11748. //检测是否有下拉样式
  11749. if (navobj.parent().is('.tabs-below')) {
  11750. dropdown.addClass('dropup');
  11751. }
  11752. var collection = 0;
  11753. var maxwidth = navobj.width() - 65;
  11754. var liwidth = 0;
  11755. //检查超过一行的标签页
  11756. var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop');
  11757. var totalwidth = 0;
  11758. litabs.each(function () {
  11759. totalwidth += $(this).outerWidth(true);
  11760. });
  11761. if (navobj.width() < totalwidth) {
  11762. litabs.each(function () {
  11763. liwidth += $(this).outerWidth(true);
  11764. if (liwidth > maxwidth) {
  11765. dropdown.find('ul').append($(this));
  11766. collection++;
  11767. }
  11768. });
  11769. if (collection > 0) {
  11770. dropdown.removeClass('hide');
  11771. if (dropdown.find('.active').length === 1) {
  11772. dropdown.addClass('active');
  11773. } else {
  11774. dropdown.removeClass('active');
  11775. }
  11776. }
  11777. } else {
  11778. dropdown.addClass('hide');
  11779. }
  11780. };
  11781. })(jQuery);
  11782. define("addtabs", function(){});
  11783. /**
  11784. * @summary SelectPage
  11785. * @desc Simple and powerful selection plugin
  11786. * @file selectpage.js
  11787. * @version 2.19
  11788. * @author TerryZeng
  11789. * @contact https://terryz.github.io/
  11790. * @license MIT License
  11791. *
  11792. */
  11793. ;(function ($) {
  11794. "use strict";
  11795. /**
  11796. * Default options
  11797. */
  11798. var defaults = {
  11799. /**
  11800. * Data source
  11801. * @type {string|Object}
  11802. *
  11803. * string:server side request url address
  11804. * Object:JSON array,format:[{a:1,b:2,c:3},{...}]
  11805. */
  11806. data: undefined,
  11807. /**
  11808. * Language ('cn', 'en')
  11809. * @type string
  11810. * @default 'cn'
  11811. */
  11812. lang: 'cn',
  11813. /**
  11814. * Multiple select mode(tags)
  11815. * @type boolean
  11816. * @default false
  11817. */
  11818. multiple: false,
  11819. /**
  11820. * pagination or not
  11821. * @type boolean
  11822. * @default true
  11823. */
  11824. pagination: true,
  11825. /**
  11826. * Show up menu button
  11827. * @type boolean
  11828. * @default true
  11829. */
  11830. dropButton: true,
  11831. /**
  11832. * Result list visible size in pagination bar close
  11833. * @type number
  11834. * @default 10
  11835. */
  11836. listSize: 10,
  11837. /**
  11838. * Show control bar in multiple select mode
  11839. * @type boolean
  11840. * @default true
  11841. */
  11842. multipleControlbar: true,
  11843. /**
  11844. * Max selected item limited in multiple select mode
  11845. * @type number
  11846. * @default 0(unlimited)
  11847. */
  11848. maxSelectLimit: 0,
  11849. /**
  11850. * Select result item to close list, work on multiple select mode
  11851. * @type boolean
  11852. * @default false
  11853. */
  11854. selectToCloseList: false,
  11855. /**
  11856. * Init selected item key, the result will match to option.keyField option
  11857. * @type string
  11858. */
  11859. initRecord: undefined,
  11860. /**
  11861. * The table parameter in server side mode
  11862. * @type string
  11863. */
  11864. dbTable: 'tbl',
  11865. /**
  11866. * The value field, the value will fill to hidden element
  11867. * @type string
  11868. * @default 'id'
  11869. */
  11870. keyField: 'id',
  11871. /**
  11872. * The show text field, the text will show to input element or tags(multiple mode)
  11873. * @type string
  11874. * @default 'name'
  11875. */
  11876. showField: 'name',
  11877. /**
  11878. * Actually used to search field
  11879. * @type string
  11880. */
  11881. searchField: undefined,
  11882. /**
  11883. * Search type ('AND' or 'OR')
  11884. * @type string
  11885. * @default 'AND'
  11886. */
  11887. andOr: 'OR',
  11888. /**
  11889. * Result sort type
  11890. * @type array|boolean - if not set, will default used showField field
  11891. * @example
  11892. * orderBy : ['id desc']
  11893. */
  11894. orderBy: undefined,
  11895. /**
  11896. * Page size
  11897. * @type number
  11898. * @default 10
  11899. */
  11900. pageSize: 10,
  11901. /**
  11902. * Server side request parameters
  11903. * @type function
  11904. * @return object
  11905. * @example params : function(){return {'name':'aa','sex':1};}
  11906. */
  11907. params: undefined,
  11908. /**
  11909. * Custom result list item show text
  11910. * @type function
  11911. * @param data {object} row data
  11912. * @return string
  11913. */
  11914. formatItem: undefined,
  11915. /**
  11916. * Have some highlight item and lost focus, auto select the highlight item
  11917. * @type boolean
  11918. * @default false
  11919. */
  11920. autoFillResult: false,
  11921. /**
  11922. * Auto select first item in show up result list or search result
  11923. * depend on `autoFillResult` option set to true
  11924. * @type boolean
  11925. * @default false
  11926. */
  11927. autoSelectFirst: false,
  11928. /**
  11929. * Whether clear input element text when enter some keywords to search and no result return
  11930. * @type boolean
  11931. * @default true
  11932. */
  11933. noResultClean: true,
  11934. /**
  11935. * Select only mode
  11936. * @type boolean
  11937. */
  11938. selectOnly: false,
  11939. /**
  11940. * Input to search delay time, work on ajax data source
  11941. * @type number
  11942. * @default 0.5
  11943. */
  11944. inputDelay: 0.5,
  11945. /**
  11946. * -----------------------------------------Callback--------------------------------------------
  11947. */
  11948. /**
  11949. * Result list item selected callback
  11950. * @type function
  11951. * @param object - selected item json data
  11952. * @param self - plugin object
  11953. */
  11954. eSelect: undefined,
  11955. /**
  11956. * Before result list show up callback, you can do anything prepared
  11957. * @param self - plugin object
  11958. */
  11959. eOpen: undefined,
  11960. /**
  11961. * Server side return data convert callback
  11962. * @type function
  11963. * @param data {object} server side return data
  11964. * @param self {object} plugin object
  11965. * @return {object} return data format:
  11966. * @example
  11967. * {
  11968. * list : [{name:'aa',sex:1},{name:'bb',sex:1}...],
  11969. * totalRow : 100
  11970. * }
  11971. */
  11972. eAjaxSuccess: undefined,
  11973. /**
  11974. * Close selected item tag callback (multiple mode)
  11975. * @type function
  11976. * @param removeCount {number} remove item count
  11977. * @param self {object} plugin object
  11978. */
  11979. eTagRemove: undefined,
  11980. /**
  11981. * Clear selected item callback(single select mode)
  11982. * @type function
  11983. * @param self {object} plugin object
  11984. */
  11985. eClear: undefined
  11986. };
  11987. /**
  11988. * SelectPage class definition
  11989. * @constructor
  11990. * @param {Object} input - input element
  11991. * @param {Object} option
  11992. */
  11993. var SelectPage = function (input, option) {
  11994. //特殊字段处理
  11995. $.each({data: 'source', keyField: 'primaryKey', showField: 'field', pageSize: 'perPage'}, function (i, j) {
  11996. if (typeof option[j] !== 'undefined') {
  11997. option[i] = option[j];
  11998. delete option[j];
  11999. }
  12000. });
  12001. this.setOption(option);
  12002. this.setLanguage();
  12003. this.setCssClass();
  12004. this.setProp();
  12005. this.setElem(input);
  12006. this.setButtonAttrDefault();
  12007. this.setInitRecord();
  12008. this.eDropdownButton();
  12009. this.eInput();
  12010. this.eWhole();
  12011. };
  12012. /**
  12013. * Plugin version number
  12014. */
  12015. SelectPage.version = '2.19';
  12016. /**
  12017. * Plugin object cache key
  12018. */
  12019. SelectPage.dataKey = 'selectPageObject';
  12020. /**
  12021. * Options set
  12022. * @param {Object} option
  12023. */
  12024. SelectPage.prototype.setOption = function (option) {
  12025. //use showField to default
  12026. option.searchField = option.searchField || option.showField;
  12027. option.andOr = option.andOr.toUpperCase();
  12028. if (option.andOr !== 'AND' && option.andOr !== 'OR') option.andOr = 'AND';
  12029. //support multiple field set
  12030. var arr = ['searchField'];
  12031. for (var i = 0; i < arr.length; i++) {
  12032. option[arr[i]] = this.strToArray(option[arr[i]]);
  12033. }
  12034. //set default order field
  12035. option.orderBy = option.orderBy || option.showField;
  12036. //set multiple order field
  12037. //example: [ ['id', 'ASC'], ['name', 'DESC'] ]
  12038. if (option.orderBy !== false) option.orderBy = this.setOrderbyOption(option.orderBy, option.showField);
  12039. //close auto fill result and auto select first in multiple mode and select item not close list
  12040. if (option.multiple && !option.selectToCloseList) {
  12041. option.autoFillResult = false;
  12042. option.autoSelectFirst = false;
  12043. }
  12044. //show all item when pagination bar close, limited 200
  12045. if (!option.pagination) option.pageSize = 200;
  12046. if ($.type(option.listSize) !== 'number' || option.listSize < 0) option.listSize = 10;
  12047. if (typeof option.formatItem === 'string') {
  12048. var _formatItem = option.formatItem;
  12049. option.formatItem = function (row) {
  12050. if (typeof Template === 'function' && _formatItem.match(/\#([a-zA-Z0-9_\-]+)$/)) {
  12051. return Template(_formatItem.substring(1), row);
  12052. } else {
  12053. return _formatItem.replace(/\{(.*?)\}/gi, function (matched) {
  12054. matched = matched.substring(1, matched.length - 1);
  12055. return typeof row[matched] !== 'undefined' ? row[matched] : '';
  12056. });
  12057. }
  12058. };
  12059. }
  12060. this.option = option;
  12061. };
  12062. /**
  12063. * String convert to array
  12064. * @param str {string}
  12065. * @return {Array}
  12066. */
  12067. SelectPage.prototype.strToArray = function (str) {
  12068. return str ? str.replace(/[\s ]+/g, '').split(',') : '';
  12069. };
  12070. /**
  12071. * Set order field
  12072. * @param {Array} arg_order
  12073. * @param {string} arg_field - default sort field
  12074. * @return {Array}
  12075. */
  12076. SelectPage.prototype.setOrderbyOption = function (arg_order, arg_field) {
  12077. var arr = [], orders = [];
  12078. if (typeof arg_order === 'object') {
  12079. for (var i = 0; i < arg_order.length; i++) {
  12080. orders = $.trim(arg_order[i]).split(' ');
  12081. if (orders.length)
  12082. arr.push((orders.length === 2) ? orders.concat() : [orders[0], 'ASC']);
  12083. }
  12084. } else {
  12085. orders = $.trim(arg_order).split(' ');
  12086. arr[0] = (orders.length === 2) ? orders.concat() : (orders[0].toUpperCase().match(/^(ASC|DESC)$/i)) ? [arg_field, orders[0].toUpperCase()] : [orders[0], 'ASC'];
  12087. }
  12088. return arr;
  12089. };
  12090. /**
  12091. * i18n
  12092. */
  12093. SelectPage.prototype.setLanguage = function () {
  12094. var message, p = this.option;
  12095. switch (p.lang) {
  12096. // English
  12097. case 'en':
  12098. message = {
  12099. add_btn: 'Add button',
  12100. add_title: 'add a box',
  12101. del_btn: 'Del button',
  12102. del_title: 'delete a box',
  12103. next: 'Next',
  12104. next_title: 'Next' + p.pageSize + ' (Right key)',
  12105. prev: 'Prev',
  12106. prev_title: 'Prev' + p.pageSize + ' (Left key)',
  12107. first_title: 'First (Shift + Left key)',
  12108. last_title: 'Last (Shift + Right key)',
  12109. get_all_btn: 'Get All (Down key)',
  12110. get_all_alt: '(button)',
  12111. close_btn: 'Close (Tab key)',
  12112. close_alt: '(button)',
  12113. loading: 'loading...',
  12114. loading_alt: '(loading)',
  12115. page_info: 'page_num of page_count',
  12116. select_ng: 'Attention : Please choose from among the list.',
  12117. select_ok: 'OK : Correctly selected.',
  12118. not_found: 'not found',
  12119. ajax_error: 'An error occurred while connecting to server.',
  12120. clear: 'Clear content',
  12121. select_all: 'Select current page',
  12122. unselect_all: 'Clear current page',
  12123. clear_all: 'Clear all selected',
  12124. max_selected: 'You can only select up to max_selected_limit items'
  12125. };
  12126. break;
  12127. // 中文
  12128. case 'cn':
  12129. default:
  12130. message = {
  12131. add_btn: '添加按钮',
  12132. add_title: '添加区域',
  12133. del_btn: '删除按钮',
  12134. del_title: '删除区域',
  12135. next: '下一页',
  12136. next_title: '下' + p.pageSize + ' (→)',
  12137. prev: '上一页',
  12138. prev_title: '上' + p.pageSize + ' (←)',
  12139. first_title: '首页 (Shift + ←)',
  12140. last_title: '尾页 (Shift + →)',
  12141. get_all_btn: '获得全部 (↓)',
  12142. get_all_alt: '(按钮)',
  12143. close_btn: '关闭 (Tab键)',
  12144. close_alt: '(按钮)',
  12145. loading: '读取中...',
  12146. loading_alt: '(读取中)',
  12147. page_info: '第 page_num 页(共page_count页)',
  12148. select_ng: '请注意:请从列表中选择.',
  12149. select_ok: 'OK : 已经选择.',
  12150. not_found: '无查询结果',
  12151. ajax_error: '连接到服务器时发生错误!',
  12152. clear: '清除内容',
  12153. select_all: '选择当前页项目',
  12154. unselect_all: '取消选择当前页项目',
  12155. clear_all: '清除全部已选择项目',
  12156. max_selected: '最多只能选择 max_selected_limit 个项目'
  12157. };
  12158. break;
  12159. }
  12160. this.message = message;
  12161. };
  12162. /**
  12163. * Css classname defined
  12164. */
  12165. SelectPage.prototype.setCssClass = function () {
  12166. var css_class = {
  12167. container: 'sp_container',
  12168. container_open: 'sp_container_open',
  12169. re_area: 'sp_result_area',
  12170. result_open: 'sp_result_area_open',
  12171. control_box: 'sp_control_box',
  12172. //multiple select mode
  12173. element_box: 'sp_element_box',
  12174. navi: 'sp_navi',
  12175. //result list
  12176. results: 'sp_results',
  12177. re_off: 'sp_results_off',
  12178. select: 'sp_over',
  12179. select_ok: 'sp_select_ok',
  12180. select_ng: 'sp_select_ng',
  12181. selected: 'sp_selected',
  12182. input_off: 'sp_input_off',
  12183. message_box: 'sp_message_box',
  12184. disabled: 'sp_disabled',
  12185. button: 'sp_button',
  12186. caret_open: 'sp_caret_open',
  12187. btn_on: 'sp_btn_on',
  12188. btn_out: 'sp_btn_out',
  12189. input: 'sp_input',
  12190. clear_btn: 'sp_clear_btn',
  12191. align_right: 'sp_align_right'
  12192. };
  12193. this.css_class = css_class;
  12194. };
  12195. /**
  12196. * Plugin inner properties
  12197. */
  12198. SelectPage.prototype.setProp = function () {
  12199. this.prop = {
  12200. //input disabled status
  12201. disabled: false,
  12202. current_page: 1,
  12203. //total page
  12204. max_page: 1,
  12205. //ajax data loading status
  12206. is_loading: false,
  12207. xhr: false,
  12208. key_paging: false,
  12209. key_select: false,
  12210. //last selected item value
  12211. prev_value: '',
  12212. //last selected item text
  12213. selected_text: '',
  12214. last_input_time: undefined,
  12215. init_set: false
  12216. };
  12217. this.template = {
  12218. tag: {
  12219. content: '<li class="selected_tag" itemvalue="#item_value#">#item_text#<span class="tag_close"><i class="spfont sp-close"></i></span></li>',
  12220. textKey: '#item_text#',
  12221. valueKey: '#item_value#'
  12222. },
  12223. page: {
  12224. current: 'page_num',
  12225. total: 'page_count'
  12226. },
  12227. msg: {
  12228. maxSelectLimit: 'max_selected_limit'
  12229. }
  12230. };
  12231. };
  12232. /**
  12233. * Get the actual width/height of invisible DOM elements with jQuery.
  12234. * Source code come from dreamerslab/jquery.actual
  12235. * @param element
  12236. * @param method
  12237. * @returns {*}
  12238. */
  12239. SelectPage.prototype.elementRealSize = function (element, method) {
  12240. var defaults = {
  12241. absolute: false,
  12242. clone: false,
  12243. includeMargin: false,
  12244. display: 'block'
  12245. };
  12246. var configs = defaults, $target = element.eq(0), fix, restore, tmp = [], style = '', $hidden;
  12247. fix = function () {
  12248. // get all hidden parents
  12249. $hidden = $target.parents().addBack().filter(':hidden');
  12250. style += 'visibility: hidden !important; display: ' + configs.display + ' !important; ';
  12251. if (configs.absolute === true) style += 'position: absolute !important;';
  12252. // save the origin style props
  12253. // set the hidden el css to be got the actual value later
  12254. $hidden.each(function () {
  12255. // Save original style. If no style was set, attr() returns undefined
  12256. var $this = $(this), thisStyle = $this.attr('style');
  12257. tmp.push(thisStyle);
  12258. // Retain as much of the original style as possible, if there is one
  12259. $this.attr('style', thisStyle ? thisStyle + ';' + style : style);
  12260. });
  12261. };
  12262. restore = function () {
  12263. // restore origin style values
  12264. $hidden.each(function (i) {
  12265. var $this = $(this), _tmp = tmp[i];
  12266. if (_tmp === undefined) $this.removeAttr('style');
  12267. else $this.attr('style', _tmp);
  12268. });
  12269. };
  12270. fix();
  12271. // get the actual value with user specific methed
  12272. // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc
  12273. // configs.includeMargin only works for 'outerWidth' and 'outerHeight'
  12274. var actual = /(outer)/.test(method) ?
  12275. $target[method](configs.includeMargin) :
  12276. $target[method]();
  12277. restore();
  12278. // IMPORTANT, this plugin only return the value of the first element
  12279. return actual;
  12280. };
  12281. /**
  12282. * Dom building
  12283. * @param {Object} combo_input - original input element
  12284. */
  12285. SelectPage.prototype.setElem = function (combo_input) {
  12286. // 1. build Dom object
  12287. var elem = {}, p = this.option, css = this.css_class, msg = this.message, input = $(combo_input);
  12288. var cssWidth = input.css("width");
  12289. var orgWidth = input.outerWidth();
  12290. if (cssWidth.indexOf("%") > -1 || input.parent().size() > 0 && input.parent().width() == orgWidth) {
  12291. orgWidth = "100%";
  12292. } else {
  12293. // fix input width in hidden situation
  12294. if (orgWidth <= 0) orgWidth = this.elementRealSize(input, 'outerWidth');
  12295. if (orgWidth < 150) orgWidth = 150;
  12296. }
  12297. elem.combo_input = input.attr({'autocomplete': 'off'}).addClass(css.input).wrap('<div>');
  12298. if (p.selectOnly) elem.combo_input.prop('readonly', true);
  12299. elem.container = elem.combo_input.parent().addClass(css.container);
  12300. if (elem.combo_input.prop('disabled')) {
  12301. if (p.multiple) elem.container.addClass(css.disabled);
  12302. else elem.combo_input.addClass(css.input_off);
  12303. }
  12304. // set outer box width
  12305. elem.container.width(orgWidth);
  12306. elem.button = $('<div>').addClass(css.button);
  12307. //drop down button
  12308. elem.dropdown = $('<span class="sp_caret"></span>');
  12309. //clear button 'X' in single mode
  12310. elem.clear_btn = $('<div>').html($('<i>').addClass('spfont sp-close')).addClass(css.clear_btn).attr('title', msg.clear);
  12311. if (!p.dropButton) elem.clear_btn.addClass(css.align_right);
  12312. //main box in multiple mode
  12313. elem.element_box = $('<ul>').addClass(css.element_box);
  12314. if (p.multiple && p.multipleControlbar)
  12315. elem.control = $('<div>').addClass(css.control_box);
  12316. //result list box
  12317. elem.result_area = $('<div>').addClass(css.re_area);
  12318. //pagination bar
  12319. if (p.pagination) elem.navi = $('<div>').addClass('sp_pagination').append('<ul>');
  12320. elem.results = $('<ul>').addClass(css.results);
  12321. var namePrefix = '_text',
  12322. input_id = elem.combo_input.attr('id') || elem.combo_input.attr('name'),
  12323. input_name = elem.combo_input.attr('name') || 'selectPage',
  12324. hidden_name = input_name,
  12325. hidden_id = input_id;
  12326. //switch the id and name attributes of input/hidden element
  12327. elem.hidden = $('<input type="hidden" class="sp_hidden" />').attr({
  12328. name: hidden_name,
  12329. id: hidden_id
  12330. }).val('');
  12331. elem.combo_input.attr({
  12332. name: typeof input.data('name') !== 'undefined' ? input.data('name') : input_name + namePrefix,
  12333. id: input_id + namePrefix
  12334. });
  12335. // 2. DOM element put
  12336. elem.container.append(elem.hidden);
  12337. if (p.dropButton) {
  12338. elem.container.append(elem.button)
  12339. elem.button.append(elem.dropdown);
  12340. }
  12341. $(document.body).append(elem.result_area);
  12342. elem.result_area.append(elem.results);
  12343. if (p.pagination) elem.result_area.append(elem.navi);
  12344. //Multiple select mode
  12345. if (p.multiple) {
  12346. if (p.multipleControlbar) {
  12347. elem.control.append('<button type="button" class="btn btn-default sp_clear_all" ><i class="spfont sp-clear"></i></button>');
  12348. elem.control.append('<button type="button" class="btn btn-default sp_unselect_all" ><i class="spfont sp-unselect-all"></i></button>');
  12349. elem.control.append('<button type="button" class="btn btn-default sp_select_all" ><i class="spfont sp-select-all"></i></button>');
  12350. elem.control_text = $('<p>');
  12351. elem.control.append(elem.control_text);
  12352. elem.result_area.prepend(elem.control);
  12353. }
  12354. elem.container.addClass('sp_container_combo');
  12355. elem.combo_input.addClass('sp_combo_input').before(elem.element_box);
  12356. var li = $('<li>').addClass('input_box');
  12357. li.append(elem.combo_input);
  12358. elem.element_box.append(li);
  12359. if (elem.combo_input.attr('placeholder')) elem.combo_input.attr('placeholder_bak', elem.combo_input.attr('placeholder'));
  12360. }
  12361. this.elem = elem;
  12362. };
  12363. /**
  12364. * Drop down button set to default
  12365. */
  12366. SelectPage.prototype.setButtonAttrDefault = function () {
  12367. /*
  12368. if (this.option.selectOnly) {
  12369. if ($(this.elem.combo_input).val() !== '') {
  12370. if ($(this.elem.hidden).val() !== '') {
  12371. //选择条件
  12372. $(this.elem.combo_input).attr('title', this.message.select_ok).removeClass(this.css_class.select_ng).addClass(this.css_class.select_ok);
  12373. } else {
  12374. //输入方式
  12375. $(this.elem.combo_input).attr('title', this.message.select_ng).removeClass(this.css_class.select_ok).addClass(this.css_class.select_ng);
  12376. }
  12377. } else {
  12378. $(this.elem.hidden).val('');
  12379. $(this.elem.combo_input).removeAttr('title').removeClass(this.css_class.select_ng);
  12380. }
  12381. }
  12382. */
  12383. //this.elem.button.attr('title', this.message.get_all_btn);
  12384. if (this.option.dropButton)
  12385. this.elem.button.attr('title', this.message.close_btn);
  12386. };
  12387. /**
  12388. * Set item need selected after init
  12389. * set selected item ways:
  12390. * <input value="key">
  12391. * <input data-init="key">
  12392. */
  12393. SelectPage.prototype.setInitRecord = function (refresh) {
  12394. var self = this, p = self.option, el = self.elem, key = '';
  12395. if ($.type(el.combo_input.data('init')) != 'undefined')
  12396. p.initRecord = String(el.combo_input.data('init'));
  12397. //data-init and value attribute can be init plugin selected item
  12398. //but, if set data-init and value attribute in the same time, plugin will choose data-init attribute first
  12399. if (!refresh && !p.initRecord && el.combo_input.val())
  12400. p.initRecord = el.combo_input.val();
  12401. el.combo_input.val('');
  12402. if (!refresh) el.hidden.val(p.initRecord);
  12403. key = refresh && el.hidden.val() ? el.hidden.val() : p.initRecord;
  12404. if (key) {
  12405. if (typeof p.data === 'object') {
  12406. var data = new Array();
  12407. var keyarr = key.split(',');
  12408. $.each(keyarr, function (index, row) {
  12409. for (var i = 0; i < p.data.length; i++) {
  12410. if (p.data[i][p.keyField] == row) {
  12411. data.push(p.data[i]);
  12412. break;
  12413. }
  12414. }
  12415. });
  12416. if (!p.multiple && data.length > 1) data = [data[0]];
  12417. self.afterInit(self, data);
  12418. } else {//ajax data source mode to init selected item
  12419. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  12420. var _orgParams = {
  12421. searchTable: p.dbTable,
  12422. searchKey: p.keyField,
  12423. searchValue: key,
  12424. orderBy: p.orderBy,
  12425. showField: p.showField,
  12426. keyField: p.keyField,
  12427. keyValue: key,
  12428. searchField: p.searchField
  12429. };
  12430. if (_paramsFunc) {
  12431. var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
  12432. if (result && $.isPlainObject(result)) {
  12433. _params = $.extend({}, _orgParams, result);
  12434. } else {
  12435. _params = _orgParams;
  12436. }
  12437. } else {
  12438. _params = _orgParams;
  12439. }
  12440. $.ajax({
  12441. dataType: 'json',
  12442. type: 'POST',
  12443. url: p.data,
  12444. data: _params,
  12445. success: function (json) {
  12446. var d = null;
  12447. if (p.eAjaxSuccess && $.isFunction(p.eAjaxSuccess))
  12448. d = p.eAjaxSuccess(json);
  12449. self.afterInit(self, d.list);
  12450. },
  12451. error: function (jqXHR, textStatus, errorThrown) {
  12452. self.ajaxErrorNotify(self, errorThrown);
  12453. }
  12454. });
  12455. }
  12456. }
  12457. };
  12458. /**
  12459. * Selected item set to plugin
  12460. * @param {Object} self
  12461. * @param {Object} data - selected item data
  12462. */
  12463. SelectPage.prototype.afterInit = function (self, data) {
  12464. if (!data || ($.isArray(data) && data.length === 0)) return;
  12465. if (!$.isArray(data)) data = [data];
  12466. var p = self.option, css = self.css_class;
  12467. self.data = data;
  12468. if (p.multiple) {
  12469. self.prop.init_set = true;
  12470. self.clearAll(self);
  12471. $.each(data, function (i, row) {
  12472. var value = row[p.keyField];
  12473. var text = row[p.showField];
  12474. var item = {text: text, value: value};
  12475. if (!self.isAlreadySelected(self, item)) self.addNewTag(self, row, item);
  12476. });
  12477. self.tagValuesSet(self);
  12478. self.inputResize(self);
  12479. self.elem.hidden.blur();
  12480. self.prop.init_set = false;
  12481. } else {
  12482. var row = data[0];
  12483. var value = row[p.keyField];
  12484. var text = row[p.showField];
  12485. self.elem.combo_input.val(text);
  12486. self.elem.hidden.val(value);
  12487. self.prop.prev_value = text;
  12488. self.prop.selected_text = text;
  12489. if (p.selectOnly) {
  12490. self.elem.combo_input.attr('title', self.message.select_ok).removeClass(css.select_ng).addClass(css.select_ok);
  12491. }
  12492. self.putClearButton();
  12493. }
  12494. };
  12495. /**
  12496. * Drop down button event bind
  12497. */
  12498. SelectPage.prototype.eDropdownButton = function () {
  12499. var self = this;
  12500. if (self.option.dropButton) {
  12501. self.elem.button.mouseup(function (ev) {
  12502. ev.stopPropagation();
  12503. if (self.elem.result_area.is(':hidden') && !self.elem.combo_input.prop('disabled')) {
  12504. self.elem.combo_input.focus();
  12505. } else self.hideResults(self);
  12506. });
  12507. }
  12508. };
  12509. /**
  12510. * Events bind
  12511. */
  12512. SelectPage.prototype.eInput = function () {
  12513. var self = this, p = self.option, el = self.elem, msg = self.message;
  12514. var showList = function () {
  12515. self.prop.page_move = false;
  12516. self.suggest(self);
  12517. self.setCssFocusedInput(self);
  12518. };
  12519. el.combo_input.keyup(function (e) {
  12520. self.processKey(self, e);
  12521. }).keydown(function (e) {
  12522. self.processControl(self, e);
  12523. }).focus(function (e) {
  12524. //When focus on input, show the result list
  12525. if (el.result_area.is(':hidden')) {
  12526. e.stopPropagation();
  12527. self.prop.first_show = true;
  12528. showList();
  12529. }
  12530. });
  12531. el.container.on('click.SelectPage', 'div.' + self.css_class.clear_btn, function (e) {
  12532. e.stopPropagation();
  12533. if (!self.disabled(self)) {
  12534. self.clearAll(self, true);
  12535. self.elem.hidden.change();
  12536. if (p.eClear && $.isFunction(p.eClear)) p.eClear(self);
  12537. }
  12538. });
  12539. el.result_area.on('mousedown.SelectPage', function (e) {
  12540. e.stopPropagation();
  12541. });
  12542. if (p.multiple) {
  12543. if (p.multipleControlbar) {
  12544. //Select all item of current page
  12545. el.control.find('.sp_select_all').on('click.SelectPage', function (e) {
  12546. self.selectAllLine(self);
  12547. }).hover(function () {
  12548. el.control_text.html(msg.select_all);
  12549. }, function () {
  12550. el.control_text.html('');
  12551. });
  12552. //Cancel select all item of current page
  12553. el.control.find('.sp_unselect_all').on('click.SelectPage', function (e) {
  12554. self.unSelectAllLine(self);
  12555. }).hover(function () {
  12556. el.control_text.html(msg.unselect_all);
  12557. }, function () {
  12558. el.control_text.html('');
  12559. });
  12560. //Clear all selected item
  12561. el.control.find('.sp_clear_all').on('click.SelectPage', function (e) {
  12562. self.clearAll(self, true);
  12563. }).hover(function () {
  12564. el.control_text.html(msg.clear_all);
  12565. }, function () {
  12566. el.control_text.html('');
  12567. });
  12568. }
  12569. el.element_box.on('click.SelectPage', function (e) {
  12570. var srcEl = e.target || e.srcElement;
  12571. if ($(srcEl).is('ul')) el.combo_input.focus();
  12572. });
  12573. //Tag close
  12574. el.element_box.on('click.SelectPage', 'span.tag_close', function () {
  12575. var li = $(this).closest('li'), data = li.data('dataObj');
  12576. self.removeTag(self, li);
  12577. showList();
  12578. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove([data]);
  12579. });
  12580. self.inputResize(self);
  12581. }
  12582. };
  12583. /**
  12584. * Out of plugin area click event handler
  12585. */
  12586. SelectPage.prototype.eWhole = function () {
  12587. var self = this, css = self.css_class;
  12588. var cleanContent = function (obj) {
  12589. obj.elem.combo_input.val('');
  12590. if (!obj.option.multiple) obj.elem.hidden.val('');
  12591. obj.prop.selected_text = '';
  12592. };
  12593. //Out of plugin area
  12594. $(document.body).off('mousedown.selectPage').on('mousedown.selectPage', function (e) {
  12595. var ele = e.target || e.srcElement;
  12596. var sp = $(ele).closest('div.' + css.container);
  12597. //Open status result list
  12598. $('div.' + css.container + '.' + css.container_open).each(function () {
  12599. if (this == sp[0]) return;
  12600. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey);
  12601. if (!d.elem.combo_input.val() && d.elem.hidden.val() && !d.option.multiple) {
  12602. d.prop.current_page = 1;//reset page to 1
  12603. cleanContent(d);
  12604. d.hideResults(d);
  12605. return true;
  12606. }
  12607. if (d.elem.results.find('li').not('.' + css.message_box).length) {
  12608. if (d.option.autoFillResult) {
  12609. //have selected item, then hide result list
  12610. if (d.elem.hidden.val()) d.hideResults(d);
  12611. else if (d.elem.results.find('li.sp_over').length) {
  12612. //no one selected and have highlight item, select the highlight item
  12613. d.selectCurrentLine(d, true);
  12614. } else if (d.option.autoSelectFirst) {
  12615. //no one selected, no one highlight, select the first item
  12616. d.nextLine(d);
  12617. d.selectCurrentLine(d, true);
  12618. } else d.hideResults(d);
  12619. } else d.hideResults(d);
  12620. } else {
  12621. //when no one item match, clear search keywords
  12622. if (d.option.noResultClean) cleanContent(d);
  12623. else {
  12624. if (!d.option.multiple) d.elem.hidden.val('');
  12625. }
  12626. d.hideResults(d);
  12627. }
  12628. });
  12629. });
  12630. };
  12631. /**
  12632. * Result list event bind
  12633. */
  12634. SelectPage.prototype.eResultList = function () {
  12635. var self = this, css = this.css_class;
  12636. self.elem.results.children('li').hover(function () {
  12637. if (self.prop.key_select) {
  12638. self.prop.key_select = false;
  12639. return;
  12640. }
  12641. if (!$(this).hasClass(css.selected) && !$(this).hasClass(css.message_box)) {
  12642. $(this).addClass(css.select);
  12643. self.setCssFocusedResults(self);
  12644. }
  12645. }, function () {
  12646. $(this).removeClass(css.select);
  12647. }).click(function (e) {
  12648. if (self.prop.key_select) {
  12649. self.prop.key_select = false;
  12650. return;
  12651. }
  12652. e.preventDefault();
  12653. e.stopPropagation();
  12654. if (!$(this).hasClass(css.selected)) self.selectCurrentLine(self, false);
  12655. });
  12656. };
  12657. /**
  12658. * Reposition result list when list beyond the visible area
  12659. */
  12660. SelectPage.prototype.eScroll = function () {
  12661. var self = this, css = this.css_class;
  12662. $(window).on('scroll.SelectPage', function (e) {
  12663. $('div.' + css.container + '.' + css.container_open).each(function () {
  12664. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey),
  12665. offset = d.elem.result_area.offset(),
  12666. screenScrollTop = $(window).scrollTop(),
  12667. docHeight = $(document).height(),
  12668. viewHeight = $(window).height(),
  12669. listHeight = d.elem.result_area.outerHeight(),
  12670. listBottom = offset.top + listHeight,
  12671. hasOverflow = docHeight > viewHeight,
  12672. down = d.elem.result_area.hasClass('shadowDown');
  12673. if (hasOverflow) {
  12674. if (down) {//open down
  12675. if (listBottom > (viewHeight + screenScrollTop)) d.calcResultsSize(d);
  12676. } else {//open up
  12677. if (offset.top < screenScrollTop) d.calcResultsSize(d);
  12678. }
  12679. }
  12680. });
  12681. });
  12682. };
  12683. /**
  12684. * Page bar button event bind
  12685. */
  12686. SelectPage.prototype.ePaging = function () {
  12687. var self = this;
  12688. if (!self.option.pagination) return;
  12689. self.elem.navi.find('li.csFirstPage').off('click').on('click', function (ev) {
  12690. //$(self.elem.combo_input).focus();
  12691. ev.preventDefault();
  12692. self.firstPage(self);
  12693. });
  12694. self.elem.navi.find('li.csPreviousPage').off('click').on('click', function (ev) {
  12695. //$(self.elem.combo_input).focus();
  12696. ev.preventDefault();
  12697. self.prevPage(self);
  12698. });
  12699. self.elem.navi.find('li.csNextPage').off('click').on('click', function (ev) {
  12700. //$(self.elem.combo_input).focus();
  12701. ev.preventDefault();
  12702. self.nextPage(self);
  12703. });
  12704. self.elem.navi.find('li.csLastPage').off('click').on('click', function (ev) {
  12705. //$(self.elem.combo_input).focus();
  12706. ev.preventDefault();
  12707. self.lastPage(self);
  12708. });
  12709. };
  12710. /**
  12711. * Ajax request fail
  12712. * @param {Object} self
  12713. * @param {string} errorThrown
  12714. */
  12715. SelectPage.prototype.ajaxErrorNotify = function (self, errorThrown) {
  12716. self.showMessage(self.message.ajax_error);
  12717. };
  12718. /**
  12719. * Message box
  12720. * @param {Object} self
  12721. * @param msg {string} the text need to show
  12722. */
  12723. SelectPage.prototype.showMessage = function (self, msg) {
  12724. if (!msg) return;
  12725. var msgLi = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' + msg + '</li>';
  12726. self.elem.results.empty().append(msgLi).show();
  12727. self.calcResultsSize(self);
  12728. self.setOpenStatus(self, true);
  12729. self.elem.control.hide();
  12730. if (self.option.pagination) self.elem.navi.hide();
  12731. };
  12732. /**
  12733. * @desc Scroll
  12734. * @param {Object} self
  12735. * @param {boolean} enforce
  12736. */
  12737. SelectPage.prototype.scrollWindow = function (self, enforce) {
  12738. var current_result = self.getCurrentLine(self),
  12739. target_top = (current_result && !enforce) ? current_result.offset().top : self.elem.container.offset().top,
  12740. target_size;
  12741. self.prop.size_li = self.elem.results.children('li:first').outerHeight();
  12742. target_size = self.prop.size_li;
  12743. var gap, client_height = $(window).height(),
  12744. scroll_top = $(window).scrollTop(),
  12745. scroll_bottom = scroll_top + client_height - target_size;
  12746. if (current_result.length) {
  12747. if (target_top < scroll_top || target_size > client_height) {
  12748. //scroll to top
  12749. gap = target_top - scroll_top;
  12750. } else if (target_top > scroll_bottom) {
  12751. //scroll down
  12752. gap = target_top - scroll_bottom;
  12753. } else return; //do not scroll
  12754. } else if (target_top < scroll_top) gap = target_top - scroll_top;
  12755. window.scrollBy(0, gap);
  12756. };
  12757. /**
  12758. * change css class by status
  12759. * @param self
  12760. * @param status {boolean} true: open, false: close
  12761. */
  12762. SelectPage.prototype.setOpenStatus = function (self, status) {
  12763. var el = self.elem, css = self.css_class;
  12764. if (status) {
  12765. el.container.addClass(css.container_open);
  12766. el.result_area.addClass(css.result_open);
  12767. } else {
  12768. el.container.removeClass(css.container_open);
  12769. el.result_area.removeClass(css.result_open);
  12770. }
  12771. };
  12772. /**
  12773. * input element in focus css class set
  12774. * @param {Object} self
  12775. */
  12776. SelectPage.prototype.setCssFocusedInput = function (self) {
  12777. //$(self.elem.results).addClass(self.css_class.re_off);
  12778. //$(self.elem.combo_input).removeClass(self.css_class.input_off);
  12779. };
  12780. /**
  12781. * set result list get focus and input element lost focus
  12782. * @param {Object} self
  12783. */
  12784. SelectPage.prototype.setCssFocusedResults = function (self) {
  12785. //$(self.elem.results).removeClass(self.css_class.re_off);
  12786. //$(self.elem.combo_input).addClass(self.css_class.input_off);
  12787. };
  12788. /**
  12789. * Quick search input keywords listener
  12790. * @param {Object} self
  12791. */
  12792. SelectPage.prototype.checkValue = function (self) {
  12793. var now_value = self.elem.combo_input.val();
  12794. if (now_value != self.prop.prev_value) {
  12795. self.prop.prev_value = now_value;
  12796. self.prop.first_show = false;
  12797. if (self.option.selectOnly) self.setButtonAttrDefault();
  12798. if (!self.option.multiple && !now_value) {
  12799. self.elem.combo_input.val('');
  12800. self.elem.hidden.val('');
  12801. self.elem.clear_btn.remove();
  12802. }
  12803. self.suggest(self);
  12804. }
  12805. };
  12806. /**
  12807. * Input handle(regular input)
  12808. * @param {Object} self
  12809. * @param {Object} e - event object
  12810. */
  12811. SelectPage.prototype.processKey = function (self, e) {
  12812. if ($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9, 13]) === -1) {
  12813. if (e.keyCode != 16) self.setCssFocusedInput(self); // except Shift(16)
  12814. self.inputResize(self);
  12815. if ($.type(self.option.data) === 'string') {
  12816. self.prop.last_input_time = e.timeStamp;
  12817. setTimeout(function () {
  12818. if ((e.timeStamp - self.prop.last_input_time) === 0)
  12819. self.checkValue(self);
  12820. }, self.option.inputDelay * 1000);
  12821. } else {
  12822. self.checkValue(self);
  12823. }
  12824. }
  12825. }
  12826. /**
  12827. * Input handle(control key)
  12828. * @param {Object} self
  12829. * @param {Object} e - event object
  12830. */
  12831. SelectPage.prototype.processControl = function (self, e) {
  12832. if (($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9]) > -1 && self.elem.result_area.is(':visible')) ||
  12833. ($.inArray(e.keyCode, [13, 9]) > -1 && self.getCurrentLine(self))) {
  12834. e.preventDefault();
  12835. e.stopPropagation();
  12836. e.cancelBubble = true;
  12837. e.returnValue = false;
  12838. switch (e.keyCode) {
  12839. case 37:// left
  12840. if (e.shiftKey) self.firstPage(self);
  12841. else self.prevPage(self);
  12842. break;
  12843. case 38:// up
  12844. self.prop.key_select = true;
  12845. self.prevLine(self);
  12846. break;
  12847. case 39:// right
  12848. if (e.shiftKey) self.lastPage(self);
  12849. else self.nextPage(self);
  12850. break;
  12851. case 40:// down
  12852. if (self.elem.results.children('li').length) {
  12853. self.prop.key_select = true;
  12854. self.nextLine(self);
  12855. } else self.suggest(self);
  12856. break;
  12857. case 9:// tab
  12858. self.prop.key_paging = true;
  12859. self.selectCurrentLine(self, true);
  12860. //self.hideResults(self);
  12861. break;
  12862. case 13:// return
  12863. self.selectCurrentLine(self, true);
  12864. break;
  12865. case 27:// escape
  12866. self.prop.key_paging = true;
  12867. self.hideResults(self);
  12868. break;
  12869. }
  12870. }
  12871. };
  12872. /**
  12873. * Abort Ajax request
  12874. * @param {Object} self
  12875. */
  12876. SelectPage.prototype.abortAjax = function (self) {
  12877. if (self.prop.xhr) {
  12878. self.prop.xhr.abort();
  12879. self.prop.xhr = false;
  12880. }
  12881. };
  12882. /**
  12883. * Suggest result of search keywords
  12884. * @param {Object} self
  12885. */
  12886. SelectPage.prototype.suggest = function (self) {
  12887. var q_word, val = $.trim(self.elem.combo_input.val());
  12888. if (self.option.multiple) q_word = val;
  12889. else {
  12890. if (val && val === self.prop.selected_text) q_word = '';
  12891. else q_word = val;
  12892. }
  12893. q_word = q_word.split(/[\s ]+/);
  12894. //Before show up result list callback
  12895. if (self.option.eOpen && $.isFunction(self.option.eOpen))
  12896. self.option.eOpen.call(self);
  12897. self.abortAjax(self);
  12898. //self.setLoading(self);
  12899. var which_page_num = self.prop.current_page || 1;
  12900. if (typeof self.option.data == 'object') self.searchForJson(self, q_word, which_page_num);
  12901. else self.searchForDb(self, q_word, which_page_num);
  12902. };
  12903. /**
  12904. * Loading
  12905. * @param {Object} self
  12906. */
  12907. SelectPage.prototype.setLoading = function (self) {
  12908. if (self.elem.results.html() === '') {
  12909. //self.calcResultsSize(self);
  12910. self.setOpenStatus(self, true);
  12911. }
  12912. };
  12913. /**
  12914. * Search for ajax
  12915. * @param {Object} self
  12916. * @param {Array} q_word - query keyword
  12917. * @param {number} which_page_num - target page number
  12918. */
  12919. SelectPage.prototype.searchForDb = function (self, q_word, which_page_num) {
  12920. var p = self.option;
  12921. if (!p.eAjaxSuccess || !$.isFunction(p.eAjaxSuccess)) self.hideResults(self);
  12922. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  12923. //when have new query keyword, then reset page number to 1.
  12924. if (q_word.length && q_word[0] && q_word[0] !== self.prop.prev_value) which_page_num = 1;
  12925. var _orgParams = {
  12926. q_word: q_word,
  12927. pageNumber: which_page_num,
  12928. pageSize: p.pageSize,
  12929. andOr: p.andOr,
  12930. orderBy: p.orderBy,
  12931. searchTable: p.dbTable,
  12932. showField: self.option.showField,
  12933. keyField: self.option.keyField,
  12934. searchField: self.option.searchField
  12935. };
  12936. if (p.orderBy !== false) _orgParams.orderBy = p.orderBy;
  12937. _orgParams[searchKey] = q_word[0];
  12938. if (_paramsFunc) {
  12939. var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
  12940. if (result && $.isPlainObject(result)) {
  12941. _params = $.extend({}, _orgParams, result);
  12942. } else {
  12943. _params = _orgParams;
  12944. }
  12945. } else {
  12946. _params = _orgParams;
  12947. }
  12948. self.prop.xhr = $.ajax({
  12949. dataType: 'json',
  12950. url: p.data,
  12951. type: 'POST',
  12952. data: _params,
  12953. success: function (returnData) {
  12954. if (!returnData || !$.isPlainObject(returnData)) {
  12955. self.hideResults(self);
  12956. self.ajaxErrorNotify(self, errorThrown);
  12957. return;
  12958. }
  12959. var data = {}, json = {};
  12960. try {
  12961. data = p.eAjaxSuccess(returnData);
  12962. json.originalResult = data.list;
  12963. json.cnt_whole = data.totalRow;
  12964. } catch (e) {
  12965. self.showMessage(self, self.message.ajax_error);
  12966. return;
  12967. }
  12968. if (self.elem.navi) {
  12969. $(self.elem.navi).toggleClass("hide", json.cnt_whole <= json.originalResult.length);
  12970. }
  12971. json.candidate = [];
  12972. json.keyField = [];
  12973. if (typeof json.originalResult != 'object') {
  12974. self.prop.xhr = null;
  12975. self.notFoundSearch(self);
  12976. return;
  12977. }
  12978. json.cnt_page = json.originalResult.length;
  12979. for (var i = 0; i < json.cnt_page; i++) {
  12980. for (var key in json.originalResult[i]) {
  12981. if (key == p.keyField) {
  12982. json.keyField.push(json.originalResult[i][key]);
  12983. }
  12984. if (key == p.showField) {
  12985. json.candidate.push(json.originalResult[i][key]);
  12986. }
  12987. }
  12988. }
  12989. self.prepareResults(self, json, q_word, which_page_num);
  12990. },
  12991. error: function (jqXHR, textStatus, errorThrown) {
  12992. if (textStatus != 'abort') {
  12993. self.hideResults(self);
  12994. self.ajaxErrorNotify(self, errorThrown);
  12995. }
  12996. },
  12997. complete: function () {
  12998. self.prop.xhr = null;
  12999. }
  13000. });
  13001. };
  13002. /**
  13003. * Search for json data source
  13004. * @param {Object} self
  13005. * @param {Array} q_word
  13006. * @param {number} which_page_num
  13007. */
  13008. SelectPage.prototype.searchForJson = function (self, q_word, which_page_num) {
  13009. var p = self.option, matched = [], esc_q = [], sorted = [], json = {}, i = 0, arr_reg = [];
  13010. //query keyword filter
  13011. do {
  13012. //'/\W/g'正则代表全部不是字母,数字,下划线,汉字的字符
  13013. //将非法字符进行转义
  13014. esc_q[i] = q_word[i].replace(/\W/g, '\\$&').toString();
  13015. arr_reg[i] = new RegExp(esc_q[i], 'gi');
  13016. i++;
  13017. } while (i < q_word.length);
  13018. // SELECT * FROM data WHERE field LIKE q_word;
  13019. for (var i = 0; i < p.data.length; i++) {
  13020. var flag = false, row = p.data[i], itemText;
  13021. for (var j = 0; j < arr_reg.length; j++) {
  13022. itemText = row[p.searchField];
  13023. if (p.formatItem && $.isFunction(p.formatItem))
  13024. itemText = p.formatItem(row);
  13025. if (itemText.match(arr_reg[j])) {
  13026. flag = true;
  13027. if (p.andOr == 'OR') break;
  13028. } else {
  13029. flag = false;
  13030. if (p.andOr == 'AND') break;
  13031. }
  13032. }
  13033. if (flag) matched.push(row);
  13034. }
  13035. // (CASE WHEN ...) then く order some column
  13036. if (p.orderBy === false) sorted = matched.concat();
  13037. else {
  13038. var reg1 = new RegExp('^' + esc_q[0] + '$', 'gi'),
  13039. reg2 = new RegExp('^' + esc_q[0], 'gi'),
  13040. matched1 = [], matched2 = [], matched3 = [];
  13041. for (var i = 0; i < matched.length; i++) {
  13042. var orderField = p.orderBy[0][0];
  13043. var orderValue = String(matched[i][orderField]);
  13044. if (orderValue.match(reg1)) {
  13045. matched1.push(matched[i]);
  13046. } else if (orderValue.match(reg2)) {
  13047. matched2.push(matched[i]);
  13048. } else {
  13049. matched3.push(matched[i]);
  13050. }
  13051. }
  13052. if (p.orderBy[0][1].match(/^asc$/i)) {
  13053. matched1 = self.sortAsc(self, matched1);
  13054. matched2 = self.sortAsc(self, matched2);
  13055. matched3 = self.sortAsc(self, matched3);
  13056. } else {
  13057. matched1 = self.sortDesc(self, matched1);
  13058. matched2 = self.sortDesc(self, matched2);
  13059. matched3 = self.sortDesc(self, matched3);
  13060. }
  13061. sorted = sorted.concat(matched1).concat(matched2).concat(matched3);
  13062. }
  13063. /*
  13064. if (sorted.length === undefined || sorted.length === 0 ) {
  13065. self.notFoundSearch(self);
  13066. return;
  13067. }
  13068. */
  13069. json.cnt_whole = sorted.length;
  13070. //page_move used to distinguish between init plugin or page moving
  13071. if (!self.prop.page_move) {
  13072. //only single mode can be used page number relocation
  13073. if (!p.multiple) {
  13074. //get selected item belong page number
  13075. var currentValue = self.elem.hidden.val();
  13076. if ($.type(currentValue) !== 'undefined' && $.trim(currentValue) !== '') {
  13077. var index = 0;
  13078. $.each(sorted, function (i, row) {
  13079. if (row[p.keyField] == currentValue) {
  13080. index = i + 1;
  13081. return false;
  13082. }
  13083. });
  13084. which_page_num = Math.ceil(index / p.pageSize);
  13085. if (which_page_num < 1) which_page_num = 1;
  13086. self.prop.current_page = which_page_num;
  13087. }
  13088. }
  13089. } else {
  13090. //set page number to 1 when result number less then page size
  13091. if (sorted.length <= ((which_page_num - 1) * p.pageSize)) {
  13092. which_page_num = 1;
  13093. self.prop.current_page = 1;
  13094. }
  13095. }
  13096. //LIMIT xx OFFSET xx
  13097. var start = (which_page_num - 1) * p.pageSize, end = start + p.pageSize;
  13098. //save original data
  13099. json.originalResult = [];
  13100. //after data filter handle
  13101. for (var i = start; i < end; i++) {
  13102. if (sorted[i] === undefined) break;
  13103. json.originalResult.push(sorted[i]);
  13104. for (var key in sorted[i]) {
  13105. if (key == p.keyField) {
  13106. if (json.keyField === undefined) json.keyField = [];
  13107. json.keyField.push(sorted[i][key]);
  13108. }
  13109. if (key == p.showField) {
  13110. if (json.candidate === undefined) json.candidate = [];
  13111. json.candidate.push(sorted[i][key]);
  13112. }
  13113. }
  13114. }
  13115. if (json.candidate === undefined) json.candidate = [];
  13116. json.cnt_page = json.candidate.length;
  13117. self.prepareResults(self, json, q_word, which_page_num);
  13118. };
  13119. /**
  13120. * Set order asc
  13121. * @param {Object} self
  13122. * @param {Array} arr - result array
  13123. */
  13124. SelectPage.prototype.sortAsc = function (self, arr) {
  13125. arr.sort(function (a, b) {
  13126. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  13127. return $.type(valA) === 'number' ? valA - valB : String(valA).localeCompare(String(valB));
  13128. });
  13129. return arr;
  13130. };
  13131. /**
  13132. * Set order desc
  13133. * @param {Object} self
  13134. * @param {Array} arr - result array
  13135. */
  13136. SelectPage.prototype.sortDesc = function (self, arr) {
  13137. arr.sort(function (a, b) {
  13138. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  13139. return $.type(valA) === 'number' ? valB - valA : String(valB).localeCompare(String(valA));
  13140. });
  13141. return arr;
  13142. };
  13143. /**
  13144. * Not result found handle
  13145. * @param {Object} self
  13146. */
  13147. SelectPage.prototype.notFoundSearch = function (self) {
  13148. self.elem.results.empty();
  13149. self.calcResultsSize(self);
  13150. self.setOpenStatus(self, true);
  13151. self.setCssFocusedInput(self);
  13152. };
  13153. /**
  13154. * Prepare data to show
  13155. * @param {Object} self
  13156. * @param {Object} json - data result
  13157. * @param {Array} q_word - query keyword
  13158. * @param {number} which_page_num - target page number
  13159. */
  13160. SelectPage.prototype.prepareResults = function (self, json, q_word, which_page_num) {
  13161. self.data = json.originalResult;
  13162. if (self.option.pagination) self.setNavi(self, json.cnt_whole, json.cnt_page, which_page_num);
  13163. if (!json.keyField) json.keyField = false;
  13164. if (self.option.selectOnly && json.candidate.length === 1 && json.candidate[0] == q_word[0]) {
  13165. self.elem.hidden.val(json.keyField[0]);
  13166. this.setButtonAttrDefault();
  13167. }
  13168. var is_query = false;
  13169. if (q_word && q_word.length && q_word[0]) is_query = true;
  13170. self.displayResults(self, json, is_query);
  13171. };
  13172. /**
  13173. * Build page bar
  13174. * @param {Object} self
  13175. * @param {number} cnt_whole - total record count
  13176. * @param {number} cnt_page
  13177. * @param {number} page_num - current page number
  13178. */
  13179. SelectPage.prototype.setNavi = function (self, cnt_whole, cnt_page, page_num) {
  13180. var msg = self.message;
  13181. /**
  13182. * build pagination bar
  13183. */
  13184. var buildPageNav = function (self, pagebar, page_num, last_page) {
  13185. var updatePageInfo = function () {
  13186. var pageInfo = msg.page_info;
  13187. return pageInfo.replace(self.template.page.current, page_num).replace(self.template.page.total, last_page);
  13188. };
  13189. if (pagebar.find('li').length === 0) {
  13190. pagebar.hide().empty();
  13191. var iconFist = 'spfont sp-first',
  13192. iconPrev = 'spfont sp-previous',
  13193. iconNext = 'spfont sp-next',
  13194. iconLast = 'spfont sp-last';
  13195. pagebar.append('<li class="csFirstPage" title="' + msg.first_title + '" ><a href="javascript:void(0);"> <i class="' + iconFist + '"></i> </a></li>');
  13196. pagebar.append('<li class="csPreviousPage" title="' + msg.prev_title + '" ><a href="javascript:void(0);"><i class="' + iconPrev + '"></i></a></li>');
  13197. //pagination information
  13198. pagebar.append('<li class="pageInfoBox"><a href="javascript:void(0);"> ' + updatePageInfo() + ' </a></li>');
  13199. pagebar.append('<li class="csNextPage" title="' + msg.next_title + '" ><a href="javascript:void(0);"><i class="' + iconNext + '"></i></a></li>');
  13200. pagebar.append('<li class="csLastPage" title="' + msg.last_title + '" ><a href="javascript:void(0);"> <i class="' + iconLast + '"></i> </a></li>');
  13201. pagebar.show();
  13202. } else {
  13203. pagebar.find('li.pageInfoBox a').html(updatePageInfo());
  13204. }
  13205. };
  13206. var pagebar = self.elem.navi.find('ul'),
  13207. last_page = Math.ceil(cnt_whole / self.option.pageSize); //calculate total page
  13208. if (last_page === 0) page_num = 0;
  13209. else {
  13210. if (last_page < page_num) page_num = last_page;
  13211. else if (page_num === 0) page_num = 1;
  13212. }
  13213. self.prop.current_page = page_num;//update current page number
  13214. self.prop.max_page = last_page;//update page count
  13215. buildPageNav(self, pagebar, page_num, last_page);
  13216. //update paging status
  13217. var dClass = 'disabled',
  13218. first = pagebar.find('li.csFirstPage'),
  13219. previous = pagebar.find('li.csPreviousPage'),
  13220. next = pagebar.find('li.csNextPage'),
  13221. last = pagebar.find('li.csLastPage');
  13222. //first and previous
  13223. if (page_num === 1 || page_num === 0) {
  13224. if (!first.hasClass(dClass)) first.addClass(dClass);
  13225. if (!previous.hasClass(dClass)) previous.addClass(dClass);
  13226. } else {
  13227. if (first.hasClass(dClass)) first.removeClass(dClass);
  13228. if (previous.hasClass(dClass)) previous.removeClass(dClass);
  13229. }
  13230. //next and last
  13231. if (page_num === last_page || last_page === 0) {
  13232. if (!next.hasClass(dClass)) next.addClass(dClass);
  13233. if (!last.hasClass(dClass)) last.addClass(dClass);
  13234. } else {
  13235. if (next.hasClass(dClass)) next.removeClass(dClass);
  13236. if (last.hasClass(dClass)) last.removeClass(dClass);
  13237. }
  13238. if (last_page > 1) self.ePaging(); //pagination event bind
  13239. };
  13240. /**
  13241. * Render result list
  13242. * @param {Object} self
  13243. * @param {Object} json - result data
  13244. * @param {boolean} is_query - used to different from search to open and just click to open
  13245. */
  13246. SelectPage.prototype.displayResults = function (self, json, is_query) {
  13247. var p = self.option, el = self.elem;
  13248. el.results.hide().empty();
  13249. if (p.multiple && $.type(p.maxSelectLimit) === 'number' && p.maxSelectLimit > 0) {
  13250. var selectedSize = el.element_box.find('li.selected_tag').length;
  13251. if (selectedSize > 0 && selectedSize >= p.maxSelectLimit) {
  13252. var msg = self.message.max_selected;
  13253. self.showMessage(self, msg.replace(self.template.msg.maxSelectLimit, p.maxSelectLimit));
  13254. return;
  13255. }
  13256. }
  13257. if (json.candidate.length) {
  13258. var arr_candidate = json.candidate,
  13259. arr_primary_key = json.keyField,
  13260. keystr = el.hidden.val(),
  13261. keyArr = keystr ? keystr.split(',') : new Array(),
  13262. itemText = '';
  13263. for (var i = 0; i < arr_candidate.length; i++) {
  13264. if (p.formatItem && $.isFunction(p.formatItem)) {
  13265. try {
  13266. itemText = p.formatItem(json.originalResult[i]);
  13267. } catch (e) {
  13268. console.error('formatItem内容格式化函数内容设置不正确!');
  13269. itemText = arr_candidate[i];
  13270. }
  13271. } else itemText = arr_candidate[i];
  13272. var list = $('<li>').html(itemText).attr({
  13273. pkey: arr_primary_key[i],
  13274. index: i
  13275. });
  13276. if (!p.formatItem) list.attr('title', itemText);
  13277. //Set selected item highlight
  13278. if ($.inArray(arr_primary_key[i].toString(), keyArr) !== -1) {
  13279. list.addClass(self.css_class.selected);
  13280. }
  13281. //cache item data
  13282. list.data('dataObj', json.originalResult[i]);
  13283. el.results.append(list);
  13284. }
  13285. } else {
  13286. var li = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' +
  13287. self.message.not_found + '</li>';
  13288. el.results.append(li);
  13289. }
  13290. el.results.show();
  13291. if (p.multiple && p.multipleControlbar) el.control.show();
  13292. if (p.pagination) el.navi.show();
  13293. self.calcResultsSize(self);
  13294. self.setOpenStatus(self, true);
  13295. //Result item event bind
  13296. self.eResultList();
  13297. //scrolling listen
  13298. self.eScroll();
  13299. //auto highlight first item in search, have result and set autoSelectFirst to true situation
  13300. if (is_query && json.candidate.length && p.autoSelectFirst) self.nextLine(self);
  13301. };
  13302. /**
  13303. * Calculate result list size and position
  13304. * @param {Object} self
  13305. */
  13306. SelectPage.prototype.calcResultsSize = function (self) {
  13307. var p = self.option, el = self.elem;
  13308. var rePosition = function () {
  13309. if (el.container.css('position') === 'static') {
  13310. // position: static
  13311. var offset = el.combo_input.offset();
  13312. el.result_area.css({
  13313. top: offset.top + el.combo_input.outerHeight() + 'px',
  13314. left: offset.left + 'px'
  13315. });
  13316. } else {
  13317. if (!p.pagination) {
  13318. var itemHeight = el.results.find('li:first').outerHeight(true),
  13319. listHeight = itemHeight * p.listSize;
  13320. el.results.css({
  13321. 'max-height': listHeight,
  13322. 'overflow-y': 'auto'
  13323. });
  13324. }
  13325. //handle result list show up side(left, right, up or down)
  13326. var docWidth = $(document).width(),
  13327. docHeight = $(document).height(), //the document full height
  13328. viewHeight = $(window).height(), //browser visible area height
  13329. offset = el.container.offset(),
  13330. screenScrollTop = $(window).scrollTop(),
  13331. listWidth = el.result_area.outerWidth(),
  13332. //result list height
  13333. listHeight = el.result_area.outerHeight(),
  13334. //default left used input element left
  13335. defaultLeft = offset.left, //p.multiple ? -1 : 0;
  13336. //input element height
  13337. inputHeight = el.container.outerHeight(),
  13338. left = (offset.left + listWidth) > docWidth ?
  13339. defaultLeft - (listWidth - el.container.outerWidth()) :
  13340. defaultLeft,
  13341. //the actual top coordinate of input element(outer div)
  13342. screenTop = offset.top, //$(el.container).scrollTop();//offset.top - screenScrollTop;
  13343. top = 0, dist = 5, //set distance between input element and result list
  13344. //the actual top coordinate of result list
  13345. listBottom = screenTop + inputHeight + listHeight + dist,
  13346. listTop = screenTop + listHeight + dist,
  13347. hasOverflow = docHeight > viewHeight;
  13348. if ((screenTop - screenScrollTop - dist > listHeight) &&
  13349. (hasOverflow && listBottom > (viewHeight + screenScrollTop)) ||
  13350. (!hasOverflow && listBottom > viewHeight && screenTop >= listTop)) {
  13351. //open up
  13352. top = offset.top - listHeight - dist;
  13353. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowUp');
  13354. } else {
  13355. //open down
  13356. top = offset.top + (p.multiple ? el.container.outerHeight() : inputHeight);
  13357. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowDown');
  13358. top += dist;
  13359. }
  13360. return {
  13361. top: top + 'px', left: left + 'px'
  13362. };
  13363. }
  13364. };
  13365. if (el.result_area.is(':visible')) {
  13366. el.result_area.css(rePosition());
  13367. } else {
  13368. var pss = rePosition();
  13369. el.result_area.css(pss).show(1, function () {
  13370. var repss = rePosition();
  13371. if (pss.top !== repss.top || pss.left !== repss.left) el.result_area.css(repss);
  13372. });
  13373. }
  13374. };
  13375. /**
  13376. * hide result list
  13377. * @param {Object} self
  13378. */
  13379. SelectPage.prototype.hideResults = function (self) {
  13380. if (self.prop.key_paging) {
  13381. self.scrollWindow(self, true);
  13382. self.prop.key_paging = false;
  13383. }
  13384. self.setCssFocusedInput(self);
  13385. if (self.option.autoFillResult) {
  13386. //self.selectCurrentLine(self, true);
  13387. }
  13388. self.elem.results.empty();
  13389. self.elem.result_area.hide();
  13390. self.setOpenStatus(self, false);
  13391. //unbind window scroll listen
  13392. $(window).off('scroll.SelectPage');
  13393. self.abortAjax(self);
  13394. self.setButtonAttrDefault();
  13395. };
  13396. /**
  13397. * set plugin to disabled / enabled
  13398. * @param self
  13399. * @param disabled
  13400. */
  13401. SelectPage.prototype.disabled = function (self, disabled) {
  13402. var p = self.option, el = self.elem;
  13403. if ($.type(disabled) === 'undefined') return el.combo_input.prop('disabled');
  13404. if ($.type(disabled) === 'boolean') {
  13405. el.combo_input.prop('disabled', disabled);
  13406. if (disabled) el.container.addClass(self.css_class.disabled);
  13407. else el.container.removeClass(self.css_class.disabled);
  13408. }
  13409. };
  13410. /**
  13411. * Go fist page
  13412. * @param {Object} self
  13413. */
  13414. SelectPage.prototype.firstPage = function (self) {
  13415. if (self.prop.current_page > 1) {
  13416. self.prop.current_page = 1;
  13417. self.prop.page_move = true;
  13418. self.suggest(self);
  13419. }
  13420. };
  13421. /**
  13422. * Go previous page
  13423. * @param {Object} self
  13424. */
  13425. SelectPage.prototype.prevPage = function (self) {
  13426. if (self.prop.current_page > 1) {
  13427. self.prop.current_page--;
  13428. self.prop.page_move = true;
  13429. self.suggest(self);
  13430. }
  13431. };
  13432. /**
  13433. * Go next page
  13434. * @param {Object} self
  13435. */
  13436. SelectPage.prototype.nextPage = function (self) {
  13437. if (self.prop.current_page < self.prop.max_page) {
  13438. self.prop.current_page++;
  13439. self.prop.page_move = true;
  13440. self.suggest(self);
  13441. }
  13442. };
  13443. /**
  13444. * Go last page
  13445. * @param {Object} self
  13446. */
  13447. SelectPage.prototype.lastPage = function (self) {
  13448. if (self.prop.current_page < self.prop.max_page) {
  13449. self.prop.current_page = self.prop.max_page;
  13450. self.prop.page_move = true;
  13451. self.suggest(self);
  13452. }
  13453. };
  13454. /**
  13455. * do something after select/unSelect action
  13456. * @param {Object} self
  13457. * @param {boolean} reOpen
  13458. */
  13459. SelectPage.prototype.afterAction = function (self, reOpen) {
  13460. self.inputResize(self);
  13461. self.elem.combo_input.change();
  13462. self.setCssFocusedInput(self);
  13463. if (self.prop.init_set) return;
  13464. if (self.option.multiple) {
  13465. if (self.option.selectToCloseList) {
  13466. self.hideResults(self);
  13467. self.elem.combo_input.blur();
  13468. }
  13469. if (!self.option.selectToCloseList && reOpen) {
  13470. self.suggest(self);
  13471. self.elem.combo_input.focus();
  13472. }
  13473. } else {
  13474. self.hideResults(self);
  13475. self.elem.combo_input.blur();
  13476. }
  13477. };
  13478. /**
  13479. * Select current list item
  13480. * @param {Object} self
  13481. * @param {boolean} is_enter_key
  13482. */
  13483. SelectPage.prototype.selectCurrentLine = function (self, is_enter_key) {
  13484. self.scrollWindow(self, true);
  13485. var p = self.option, current = self.getCurrentLine(self);
  13486. if (current) {
  13487. var data = current.data('dataObj');
  13488. var text = data[p.showField] || current.text();
  13489. var value = current.attr('pkey');
  13490. if (!p.multiple) {
  13491. self.elem.combo_input.val(text);
  13492. self.elem.hidden.val(value);
  13493. } else {
  13494. //build tags in multiple selection mode
  13495. self.elem.combo_input.val('');
  13496. var item = {text: text, value: value};
  13497. if (!self.isAlreadySelected(self, item)) {
  13498. self.addNewTag(self, data, item);
  13499. self.tagValuesSet(self);
  13500. }
  13501. }
  13502. if (p.selectOnly) self.setButtonAttrDefault();
  13503. //Select item callback
  13504. if (p.eSelect && $.isFunction(p.eSelect)) p.eSelect(data, self);
  13505. self.prop.prev_value = self.elem.combo_input.val();
  13506. self.prop.selected_text = self.elem.combo_input.val();
  13507. self.putClearButton();
  13508. }
  13509. self.afterAction(self, true);
  13510. };
  13511. /**
  13512. * Show clear button when item selected in single selection mode
  13513. */
  13514. SelectPage.prototype.putClearButton = function () {
  13515. if (!this.option.multiple && !this.elem.combo_input.prop('disabled')) this.elem.container.append(this.elem.clear_btn);
  13516. };
  13517. /**
  13518. * Select all list item
  13519. * @param {Object} self
  13520. */
  13521. SelectPage.prototype.selectAllLine = function (self) {
  13522. var p = self.option, jsonarr = new Array();
  13523. self.elem.results.find('li').each(function (i, row) {
  13524. var $row = $(row), data = $row.data('dataObj');
  13525. var text = data[p.showField] || $row.text();
  13526. var value = $row.attr('pkey');
  13527. var item = {text: text, value: value};
  13528. if (!self.isAlreadySelected(self, item)) {
  13529. self.addNewTag(self, data, item);
  13530. self.tagValuesSet(self);
  13531. }
  13532. jsonarr.push(data);
  13533. //limited max selected items
  13534. if ($.type(p.maxSelectLimit) === 'number' &&
  13535. p.maxSelectLimit > 0 &&
  13536. p.maxSelectLimit === self.elem.element_box.find('li.selected_tag').length) {
  13537. return false;
  13538. }
  13539. });
  13540. if (p.eSelect && $.isFunction(p.eSelect)) p.eSelect(jsonarr, self);
  13541. self.afterAction(self, true);
  13542. };
  13543. /**
  13544. * Cancel select all item in current page
  13545. * @param {Object} self
  13546. */
  13547. SelectPage.prototype.unSelectAllLine = function (self) {
  13548. var p = self.option, size = self.elem.results.find('li').length, ds = [];
  13549. self.elem.results.find('li').each(function (i, row) {
  13550. var key = $(row).attr('pkey');
  13551. var tag = self.elem.element_box.find('li.selected_tag[itemvalue="' + key + '"]');
  13552. if (tag.length) ds.push(tag.data('dataObj'));
  13553. self.removeTag(self, tag);
  13554. });
  13555. self.afterAction(self, true);
  13556. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove(ds);
  13557. };
  13558. /**
  13559. * Clear all selected items
  13560. * @param {Object} self
  13561. * @param {boolean} open - open list after clear selected item
  13562. */
  13563. SelectPage.prototype.clearAll = function (self, open) {
  13564. var p = self.option, ds = [];
  13565. if (p.multiple) {
  13566. self.elem.element_box.find('li.selected_tag').each(function (i, row) {
  13567. ds.push($(row).data('dataObj'));
  13568. row.remove();
  13569. });
  13570. self.elem.element_box.find('li.selected_tag').remove();
  13571. }
  13572. self.reset(self);
  13573. self.afterAction(self, open);
  13574. if (p.multiple) {
  13575. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove(ds);
  13576. } else self.elem.clear_btn.remove();
  13577. };
  13578. /**
  13579. * reset
  13580. */
  13581. SelectPage.prototype.reset = function (self) {
  13582. self.elem.combo_input.val('');
  13583. self.elem.hidden.val('');
  13584. self.prop.prev_value = '';
  13585. self.prop.selected_text = '';
  13586. self.prop.current_page = 1;
  13587. };
  13588. /**
  13589. * Get current highlight item
  13590. * @param {Object} self
  13591. */
  13592. SelectPage.prototype.getCurrentLine = function (self) {
  13593. if (self.elem.result_area.is(':hidden')) return false;
  13594. var obj = self.elem.results.find('li.' + self.css_class.select);
  13595. if (obj.length) return obj;
  13596. else return false;
  13597. };
  13598. /**
  13599. * Check the result item is already selected or not
  13600. * @param {Object} self
  13601. * @param {Object} item - item info
  13602. */
  13603. SelectPage.prototype.isAlreadySelected = function (self, item) {
  13604. var isExist = false;
  13605. if (item.value) {
  13606. var keys = self.elem.hidden.val();
  13607. if (keys) {
  13608. var karr = keys.split(',');
  13609. if (karr && karr.length && $.inArray(item.value, karr) != -1) isExist = true;
  13610. }
  13611. }
  13612. return isExist;
  13613. };
  13614. /**
  13615. * Add a new tag in multiple selection mode
  13616. * @param {Object} self
  13617. * @param {object} data - raw row data
  13618. * @param {Object} item
  13619. */
  13620. SelectPage.prototype.addNewTag = function (self, data, item) {
  13621. if (!self.option.multiple || !data || !item) return;
  13622. var tmp = self.template.tag.content, tag;
  13623. tmp = tmp.replace(self.template.tag.textKey, item.text);
  13624. tmp = tmp.replace(self.template.tag.valueKey, item.value);
  13625. tag = $(tmp);
  13626. tag.data('dataObj', data);
  13627. if (self.elem.combo_input.prop('disabled')) tag.find('span.tag_close').hide();
  13628. self.elem.combo_input.closest('li').before(tag);
  13629. };
  13630. /**
  13631. * Remove a tag in multiple selection mode
  13632. * @param {Object} self
  13633. * @param {Object} item
  13634. */
  13635. SelectPage.prototype.removeTag = function (self, item) {
  13636. var key = $(item).attr('itemvalue');
  13637. var keys = self.elem.hidden.val();
  13638. if ($.type(key) != 'undefined' && keys) {
  13639. var keyarr = keys.split(','),
  13640. index = $.inArray(key.toString(), keyarr);
  13641. if (index != -1) {
  13642. keyarr.splice(index, 1);
  13643. self.elem.hidden.val(keyarr.toString()).trigger("change");
  13644. }
  13645. }
  13646. $(item).remove();
  13647. self.inputResize(self);
  13648. };
  13649. /**
  13650. * Selected item value(keyField) put in to hidden element
  13651. * @param {Object} self
  13652. */
  13653. SelectPage.prototype.tagValuesSet = function (self) {
  13654. if (!self.option.multiple) return;
  13655. var tags = self.elem.element_box.find('li.selected_tag');
  13656. if (tags && tags.length) {
  13657. var result = new Array();
  13658. $.each(tags, function (i, li) {
  13659. var v = $(li).attr('itemvalue');
  13660. if ($.type(v) !== 'undefined') result.push(v);
  13661. });
  13662. if (result.length) {
  13663. self.elem.hidden.val(result.join(',')).trigger("change");
  13664. }
  13665. }
  13666. };
  13667. /**
  13668. * auto resize input element width in multiple select mode
  13669. * @param {Object} self
  13670. */
  13671. SelectPage.prototype.inputResize = function (self) {
  13672. if (!self.option.multiple) return;
  13673. var width = '',
  13674. inputLi = self.elem.combo_input.closest('li');
  13675. var setDefaultSize = function (self, inputLi) {
  13676. inputLi.removeClass('full_width');
  13677. var minimumWidth = self.elem.combo_input.val().length + 1,
  13678. width = (minimumWidth * 0.75) + 'em';
  13679. self.elem.combo_input.css('width', width).removeAttr('placeholder');
  13680. };
  13681. if (self.elem.element_box.find('li.selected_tag').length === 0) {
  13682. if (!inputLi.hasClass('full_width')) inputLi.addClass('full_width');
  13683. if (self.elem.combo_input.attr('placeholder_bak')) {
  13684. self.elem.combo_input.attr('placeholder', self.elem.combo_input.attr('placeholder_bak')).removeAttr('style');
  13685. }
  13686. } else setDefaultSize(self, inputLi);
  13687. };
  13688. /**
  13689. * Move to next line
  13690. * @param {Object} self
  13691. */
  13692. SelectPage.prototype.nextLine = function (self) {
  13693. var obj = self.getCurrentLine(self), idx;
  13694. if (!obj) idx = -1;
  13695. else {
  13696. idx = self.elem.results.children('li').index(obj);
  13697. obj.removeClass(self.css_class.select);
  13698. }
  13699. idx++;
  13700. if (idx < self.elem.results.children('li').length) {
  13701. var next = self.elem.results.children('li').eq(idx);
  13702. next.addClass(self.css_class.select);
  13703. self.setCssFocusedResults(self);
  13704. } else self.setCssFocusedInput(self);
  13705. self.scrollWindow(self, false);
  13706. };
  13707. /**
  13708. * Move to previous line
  13709. * @param {Object} self
  13710. */
  13711. SelectPage.prototype.prevLine = function (self) {
  13712. var obj = self.getCurrentLine(self), idx;
  13713. if (!obj) idx = self.elem.results.children('li').length;
  13714. else {
  13715. idx = self.elem.results.children('li').index(obj);
  13716. obj.removeClass(self.css_class.select);
  13717. }
  13718. idx--;
  13719. if (idx > -1) {
  13720. var prev = self.elem.results.children('li').eq(idx);
  13721. prev.addClass(self.css_class.select);
  13722. self.setCssFocusedResults(self);
  13723. } else self.setCssFocusedInput(self);
  13724. self.scrollWindow(self, false);
  13725. };
  13726. /**
  13727. * SelectPage plugin definition
  13728. * @global
  13729. * @param option {Object} init plugin option
  13730. */
  13731. function Plugin(option) {
  13732. return this.each(function () {
  13733. var $this = $(this),
  13734. data = $this.data(SelectPage.dataKey),
  13735. params = $.extend({}, defaults, $this.data(), data && data.option, typeof option === 'object' && option);
  13736. if (!data) $this.data(SelectPage.dataKey, (data = new SelectPage(this, params)));
  13737. });
  13738. }
  13739. /**
  13740. * Get plugin object
  13741. * @param {object} obj
  13742. * @returns
  13743. */
  13744. function getPlugin(obj) {
  13745. return $(obj).closest('div.sp_container').find('input.sp_input');
  13746. }
  13747. /**
  13748. * Clear all selected item
  13749. */
  13750. function ClearSelected() {
  13751. return this.each(function () {
  13752. var $this = getPlugin(this),
  13753. data = $this.data(SelectPage.dataKey);
  13754. if (data) {
  13755. data.prop.init_set = true;
  13756. data.clearAll(data);
  13757. data.prop.init_set = false;
  13758. }
  13759. });
  13760. }
  13761. /**
  13762. * Refresh result list
  13763. * use case:
  13764. * 1.use $(obj).val('xxx') to modify selectpage selected item key
  13765. * 2.refresh selected item show content/tag text
  13766. */
  13767. function SelectedRefresh() {
  13768. return this.each(function () {
  13769. var $this = getPlugin(this),
  13770. data = $this.data(SelectPage.dataKey);
  13771. if (data && data.elem.hidden.val())
  13772. data.setInitRecord(true);
  13773. });
  13774. }
  13775. /**
  13776. * Modify plugin datasource, only work on json datasource mode
  13777. * @param {array} data - new datasource
  13778. * @example
  13779. * [{name:'aa',sex:1},{name:'bb',sex:0},{...}]
  13780. */
  13781. function ModifyDataSource(data) {
  13782. return this.each(function () {
  13783. if (data && $.isArray(data)) {
  13784. var $this = getPlugin(this),
  13785. plugin = $this.data(SelectPage.dataKey);
  13786. if (plugin) {
  13787. plugin.clearAll(plugin);
  13788. plugin.option.data = data;
  13789. }
  13790. }
  13791. });
  13792. }
  13793. /**
  13794. * Get plugin disabled status or Modify plugin disabled status
  13795. * @param disabled {boolean} set disabled status
  13796. */
  13797. function PluginDisabled(disabled) {
  13798. var status = false;
  13799. this.each(function () {
  13800. var $this = getPlugin(this),
  13801. plugin = $this.data(SelectPage.dataKey);
  13802. if (plugin) {
  13803. if ($.type(disabled) !== 'undefined')
  13804. plugin.disabled(plugin, disabled);
  13805. else
  13806. status = plugin.disabled(plugin);
  13807. }
  13808. });
  13809. return status;
  13810. }
  13811. /**
  13812. * Get selected item text
  13813. * @returns {string}
  13814. */
  13815. function GetInputText() {
  13816. var str = '';
  13817. this.each(function () {
  13818. var $this = getPlugin(this), data = $this.data(SelectPage.dataKey);
  13819. if (data) {
  13820. if (data.option.multiple) {
  13821. var tags = [];
  13822. data.elem.element_box.find('li.selected_tag').each(function (i, tag) {
  13823. tags.push($(tag).text());
  13824. });
  13825. str += tags.toString();
  13826. } else {
  13827. str += data.elem.combo_input.val();
  13828. }
  13829. }
  13830. });
  13831. return str;
  13832. }
  13833. var old = $.fn.selectPage;
  13834. $.fn.selectPage = Plugin;
  13835. $.fn.selectPage.Constructor = SelectPage;
  13836. $.fn.selectPageClear = ClearSelected;
  13837. $.fn.selectPageRefresh = SelectedRefresh;
  13838. $.fn.selectPageData = ModifyDataSource;
  13839. $.fn.selectPageDisabled = PluginDisabled;
  13840. $.fn.selectPageText = GetInputText;
  13841. // SelectPage no conflict
  13842. // =================
  13843. $.fn.selectPage.noConflict = function () {
  13844. $.fn.selectPage = old;
  13845. return this;
  13846. };
  13847. })(window.jQuery);
  13848. define("selectpage", function(){});