require-backend.min.js 912 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553
  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.2 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.2",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){n.find("."+l[6]).children("a").each(function(){var e=i(this),t=i("<button type='button' />").addClass("layui-layer-confirm");e.css("position","relative").attr("tabindex",-1).append(t),t.click(function(){return e.trigger("click"),!1})});var s=n.find("."+l[6]).find("button.layui-layer-confirm").eq(a.focusBtn);s.length>0&&s.focus()}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");if(s!==o.type[3]&&s!==o.type[4])if(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});else{var u="border-box"==r.css("box-sizing");r.css({height:parseFloat(t.height)-f-c-parseFloat(u?0:r.css("padding-top"))-parseFloat(u?0: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. if (top.$(".tab-pane.active").length > 0) {
  778. options.area = [top.$(".tab-pane.active").width() + "px", top.$(".tab-pane.active").height() + "px"];
  779. options.offset = [top.$(".tab-pane.active").scrollTop() + "px", "0px"];
  780. } else {
  781. options.area = [$(window).width() + "px", $(window).height() + "px"];
  782. options.offset = ["0px", "0px"];
  783. }
  784. }
  785. return Layer.open(options);
  786. },
  787. //关闭窗口并回传数据
  788. close: function (data) {
  789. var index = parent.Layer.getFrameIndex(window.name);
  790. var callback = parent.$("#layui-layer" + index).data("callback");
  791. //再执行关闭
  792. parent.Layer.close(index);
  793. //再调用回传函数
  794. if (typeof callback === 'function') {
  795. callback.call(undefined, data);
  796. }
  797. },
  798. layerfooter: function (layero, index, that) {
  799. var frame = Layer.getChildFrame('html', index);
  800. var layerfooter = frame.find(".layer-footer");
  801. if (layerfooter.size() > 0) {
  802. $(".layui-layer-footer", layero).remove();
  803. var footer = $("<div />").addClass('layui-layer-btn layui-layer-footer');
  804. footer.html(layerfooter.html());
  805. if ($(".row", footer).size() === 0) {
  806. $(">", footer).wrapAll("<div class='row'></div>");
  807. }
  808. footer.insertAfter(layero.find('.layui-layer-content'));
  809. //绑定事件
  810. footer.on("click", ".btn", function () {
  811. if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
  812. return;
  813. }
  814. var index = footer.find('.btn').index(this);
  815. $(".btn:eq(" + index + ")", layerfooter).trigger("click");
  816. });
  817. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  818. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  819. //重设iframe高度
  820. $("iframe", layero).height(layero.height() - titHeight - btnHeight);
  821. }
  822. //修复iOS下弹出窗口的高度和iOS下iframe无法滚动的BUG
  823. if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
  824. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  825. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  826. $("iframe", layero).parent().css("height", layero.height() - titHeight - btnHeight);
  827. $("iframe", layero).css("height", "100%");
  828. }
  829. },
  830. success: function (options, callback) {
  831. var type = typeof options === 'function';
  832. if (type) {
  833. callback = options;
  834. }
  835. return Layer.msg(__('Operation completed'), $.extend({
  836. offset: 0, icon: 1
  837. }, type ? {} : options), callback);
  838. },
  839. error: function (options, callback) {
  840. var type = typeof options === 'function';
  841. if (type) {
  842. callback = options;
  843. }
  844. return Layer.msg(__('Operation failed'), $.extend({
  845. offset: 0, icon: 2
  846. }, type ? {} : options), callback);
  847. },
  848. msg: function (message, url) {
  849. var callback = typeof url === 'function' ? url : function () {
  850. if (typeof url !== 'undefined' && url) {
  851. location.href = url;
  852. }
  853. };
  854. Layer.msg(message, {
  855. time: 2000
  856. }, callback);
  857. },
  858. toastr: Toastr,
  859. layer: Layer
  860. },
  861. lang: function () {
  862. var args = arguments,
  863. string = args[0],
  864. i = 1;
  865. string = string.toLowerCase();
  866. //string = typeof Lang[string] != 'undefined' ? Lang[string] : string;
  867. if (typeof Lang !== 'undefined' && typeof Lang[string] !== 'undefined') {
  868. if (typeof Lang[string] == 'object')
  869. return Lang[string];
  870. string = Lang[string];
  871. } else if (string.indexOf('.') !== -1 && false) {
  872. var arr = string.split('.');
  873. var current = Lang[arr[0]];
  874. for (var i = 1; i < arr.length; i++) {
  875. current = typeof current[arr[i]] != 'undefined' ? current[arr[i]] : '';
  876. if (typeof current != 'object')
  877. break;
  878. }
  879. if (typeof current == 'object')
  880. return current;
  881. string = current;
  882. } else {
  883. string = args[0];
  884. }
  885. return string.replace(/%((%)|s|d)/g, function (m) {
  886. // m is the matched format, e.g. %s, %d
  887. var val = null;
  888. if (m[2]) {
  889. val = m[2];
  890. } else {
  891. val = args[i];
  892. // A switch statement so that the formatter can be extended. Default is %s
  893. switch (m) {
  894. case '%d':
  895. val = parseFloat(val);
  896. if (isNaN(val)) {
  897. val = 0;
  898. }
  899. break;
  900. }
  901. i++;
  902. }
  903. return val;
  904. });
  905. },
  906. init: function () {
  907. // 对相对地址进行处理
  908. $.ajaxSetup({
  909. beforeSend: function (xhr, setting) {
  910. setting.url = Fast.api.fixurl(setting.url);
  911. }
  912. });
  913. Layer.config({
  914. skin: 'layui-layer-fast'
  915. });
  916. // 绑定ESC关闭窗口事件
  917. $(window).keyup(function (e) {
  918. if (e.keyCode == 27) {
  919. if ($(".layui-layer").size() > 0) {
  920. var index = 0;
  921. $(".layui-layer").each(function () {
  922. index = Math.max(index, parseInt($(this).attr("times")));
  923. });
  924. if (index) {
  925. Layer.close(index);
  926. }
  927. }
  928. }
  929. });
  930. //公共代码
  931. //配置Toastr的参数
  932. Toastr.options = Fast.config.toastr;
  933. }
  934. };
  935. //将Layer暴露到全局中去
  936. window.Layer = Layer;
  937. //将Toastr暴露到全局中去
  938. window.Toastr = Toastr;
  939. //将语言方法暴露到全局中去
  940. window.__ = Fast.lang;
  941. //将Fast渲染至全局
  942. window.Fast = Fast;
  943. //默认初始化执行的代码
  944. Fast.init();
  945. return Fast;
  946. });
  947. /*!art-template - Template Engine | http://aui.github.com/artTemplate/*/
  948. !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}();
  949. //! moment.js
  950. //! version : 2.29.1
  951. //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
  952. //! license : MIT
  953. //! momentjs.com
  954. ;(function (global, factory) {
  955. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  956. typeof define === 'function' && define.amd ? define('moment/moment',factory) :
  957. global.moment = factory()
  958. }(this, (function () { 'use strict';
  959. var hookCallback;
  960. function hooks() {
  961. return hookCallback.apply(null, arguments);
  962. }
  963. // This is done to register the method called with moment()
  964. // without creating circular dependencies.
  965. function setHookCallback(callback) {
  966. hookCallback = callback;
  967. }
  968. function isArray(input) {
  969. return (
  970. input instanceof Array ||
  971. Object.prototype.toString.call(input) === '[object Array]'
  972. );
  973. }
  974. function isObject(input) {
  975. // IE8 will treat undefined and null as object if it wasn't for
  976. // input != null
  977. return (
  978. input != null &&
  979. Object.prototype.toString.call(input) === '[object Object]'
  980. );
  981. }
  982. function hasOwnProp(a, b) {
  983. return Object.prototype.hasOwnProperty.call(a, b);
  984. }
  985. function isObjectEmpty(obj) {
  986. if (Object.getOwnPropertyNames) {
  987. return Object.getOwnPropertyNames(obj).length === 0;
  988. } else {
  989. var k;
  990. for (k in obj) {
  991. if (hasOwnProp(obj, k)) {
  992. return false;
  993. }
  994. }
  995. return true;
  996. }
  997. }
  998. function isUndefined(input) {
  999. return input === void 0;
  1000. }
  1001. function isNumber(input) {
  1002. return (
  1003. typeof input === 'number' ||
  1004. Object.prototype.toString.call(input) === '[object Number]'
  1005. );
  1006. }
  1007. function isDate(input) {
  1008. return (
  1009. input instanceof Date ||
  1010. Object.prototype.toString.call(input) === '[object Date]'
  1011. );
  1012. }
  1013. function map(arr, fn) {
  1014. var res = [],
  1015. i;
  1016. for (i = 0; i < arr.length; ++i) {
  1017. res.push(fn(arr[i], i));
  1018. }
  1019. return res;
  1020. }
  1021. function extend(a, b) {
  1022. for (var i in b) {
  1023. if (hasOwnProp(b, i)) {
  1024. a[i] = b[i];
  1025. }
  1026. }
  1027. if (hasOwnProp(b, 'toString')) {
  1028. a.toString = b.toString;
  1029. }
  1030. if (hasOwnProp(b, 'valueOf')) {
  1031. a.valueOf = b.valueOf;
  1032. }
  1033. return a;
  1034. }
  1035. function createUTC(input, format, locale, strict) {
  1036. return createLocalOrUTC(input, format, locale, strict, true).utc();
  1037. }
  1038. function defaultParsingFlags() {
  1039. // We need to deep clone this object.
  1040. return {
  1041. empty: false,
  1042. unusedTokens: [],
  1043. unusedInput: [],
  1044. overflow: -2,
  1045. charsLeftOver: 0,
  1046. nullInput: false,
  1047. invalidEra: null,
  1048. invalidMonth: null,
  1049. invalidFormat: false,
  1050. userInvalidated: false,
  1051. iso: false,
  1052. parsedDateParts: [],
  1053. era: null,
  1054. meridiem: null,
  1055. rfc2822: false,
  1056. weekdayMismatch: false,
  1057. };
  1058. }
  1059. function getParsingFlags(m) {
  1060. if (m._pf == null) {
  1061. m._pf = defaultParsingFlags();
  1062. }
  1063. return m._pf;
  1064. }
  1065. var some;
  1066. if (Array.prototype.some) {
  1067. some = Array.prototype.some;
  1068. } else {
  1069. some = function (fun) {
  1070. var t = Object(this),
  1071. len = t.length >>> 0,
  1072. i;
  1073. for (i = 0; i < len; i++) {
  1074. if (i in t && fun.call(this, t[i], i, t)) {
  1075. return true;
  1076. }
  1077. }
  1078. return false;
  1079. };
  1080. }
  1081. function isValid(m) {
  1082. if (m._isValid == null) {
  1083. var flags = getParsingFlags(m),
  1084. parsedParts = some.call(flags.parsedDateParts, function (i) {
  1085. return i != null;
  1086. }),
  1087. isNowValid =
  1088. !isNaN(m._d.getTime()) &&
  1089. flags.overflow < 0 &&
  1090. !flags.empty &&
  1091. !flags.invalidEra &&
  1092. !flags.invalidMonth &&
  1093. !flags.invalidWeekday &&
  1094. !flags.weekdayMismatch &&
  1095. !flags.nullInput &&
  1096. !flags.invalidFormat &&
  1097. !flags.userInvalidated &&
  1098. (!flags.meridiem || (flags.meridiem && parsedParts));
  1099. if (m._strict) {
  1100. isNowValid =
  1101. isNowValid &&
  1102. flags.charsLeftOver === 0 &&
  1103. flags.unusedTokens.length === 0 &&
  1104. flags.bigHour === undefined;
  1105. }
  1106. if (Object.isFrozen == null || !Object.isFrozen(m)) {
  1107. m._isValid = isNowValid;
  1108. } else {
  1109. return isNowValid;
  1110. }
  1111. }
  1112. return m._isValid;
  1113. }
  1114. function createInvalid(flags) {
  1115. var m = createUTC(NaN);
  1116. if (flags != null) {
  1117. extend(getParsingFlags(m), flags);
  1118. } else {
  1119. getParsingFlags(m).userInvalidated = true;
  1120. }
  1121. return m;
  1122. }
  1123. // Plugins that add properties should also add the key here (null value),
  1124. // so we can properly clone ourselves.
  1125. var momentProperties = (hooks.momentProperties = []),
  1126. updateInProgress = false;
  1127. function copyConfig(to, from) {
  1128. var i, prop, val;
  1129. if (!isUndefined(from._isAMomentObject)) {
  1130. to._isAMomentObject = from._isAMomentObject;
  1131. }
  1132. if (!isUndefined(from._i)) {
  1133. to._i = from._i;
  1134. }
  1135. if (!isUndefined(from._f)) {
  1136. to._f = from._f;
  1137. }
  1138. if (!isUndefined(from._l)) {
  1139. to._l = from._l;
  1140. }
  1141. if (!isUndefined(from._strict)) {
  1142. to._strict = from._strict;
  1143. }
  1144. if (!isUndefined(from._tzm)) {
  1145. to._tzm = from._tzm;
  1146. }
  1147. if (!isUndefined(from._isUTC)) {
  1148. to._isUTC = from._isUTC;
  1149. }
  1150. if (!isUndefined(from._offset)) {
  1151. to._offset = from._offset;
  1152. }
  1153. if (!isUndefined(from._pf)) {
  1154. to._pf = getParsingFlags(from);
  1155. }
  1156. if (!isUndefined(from._locale)) {
  1157. to._locale = from._locale;
  1158. }
  1159. if (momentProperties.length > 0) {
  1160. for (i = 0; i < momentProperties.length; i++) {
  1161. prop = momentProperties[i];
  1162. val = from[prop];
  1163. if (!isUndefined(val)) {
  1164. to[prop] = val;
  1165. }
  1166. }
  1167. }
  1168. return to;
  1169. }
  1170. // Moment prototype object
  1171. function Moment(config) {
  1172. copyConfig(this, config);
  1173. this._d = new Date(config._d != null ? config._d.getTime() : NaN);
  1174. if (!this.isValid()) {
  1175. this._d = new Date(NaN);
  1176. }
  1177. // Prevent infinite loop in case updateOffset creates new moment
  1178. // objects.
  1179. if (updateInProgress === false) {
  1180. updateInProgress = true;
  1181. hooks.updateOffset(this);
  1182. updateInProgress = false;
  1183. }
  1184. }
  1185. function isMoment(obj) {
  1186. return (
  1187. obj instanceof Moment || (obj != null && obj._isAMomentObject != null)
  1188. );
  1189. }
  1190. function warn(msg) {
  1191. if (
  1192. hooks.suppressDeprecationWarnings === false &&
  1193. typeof console !== 'undefined' &&
  1194. console.warn
  1195. ) {
  1196. console.warn('Deprecation warning: ' + msg);
  1197. }
  1198. }
  1199. function deprecate(msg, fn) {
  1200. var firstTime = true;
  1201. return extend(function () {
  1202. if (hooks.deprecationHandler != null) {
  1203. hooks.deprecationHandler(null, msg);
  1204. }
  1205. if (firstTime) {
  1206. var args = [],
  1207. arg,
  1208. i,
  1209. key;
  1210. for (i = 0; i < arguments.length; i++) {
  1211. arg = '';
  1212. if (typeof arguments[i] === 'object') {
  1213. arg += '\n[' + i + '] ';
  1214. for (key in arguments[0]) {
  1215. if (hasOwnProp(arguments[0], key)) {
  1216. arg += key + ': ' + arguments[0][key] + ', ';
  1217. }
  1218. }
  1219. arg = arg.slice(0, -2); // Remove trailing comma and space
  1220. } else {
  1221. arg = arguments[i];
  1222. }
  1223. args.push(arg);
  1224. }
  1225. warn(
  1226. msg +
  1227. '\nArguments: ' +
  1228. Array.prototype.slice.call(args).join('') +
  1229. '\n' +
  1230. new Error().stack
  1231. );
  1232. firstTime = false;
  1233. }
  1234. return fn.apply(this, arguments);
  1235. }, fn);
  1236. }
  1237. var deprecations = {};
  1238. function deprecateSimple(name, msg) {
  1239. if (hooks.deprecationHandler != null) {
  1240. hooks.deprecationHandler(name, msg);
  1241. }
  1242. if (!deprecations[name]) {
  1243. warn(msg);
  1244. deprecations[name] = true;
  1245. }
  1246. }
  1247. hooks.suppressDeprecationWarnings = false;
  1248. hooks.deprecationHandler = null;
  1249. function isFunction(input) {
  1250. return (
  1251. (typeof Function !== 'undefined' && input instanceof Function) ||
  1252. Object.prototype.toString.call(input) === '[object Function]'
  1253. );
  1254. }
  1255. function set(config) {
  1256. var prop, i;
  1257. for (i in config) {
  1258. if (hasOwnProp(config, i)) {
  1259. prop = config[i];
  1260. if (isFunction(prop)) {
  1261. this[i] = prop;
  1262. } else {
  1263. this['_' + i] = prop;
  1264. }
  1265. }
  1266. }
  1267. this._config = config;
  1268. // Lenient ordinal parsing accepts just a number in addition to
  1269. // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
  1270. // TODO: Remove "ordinalParse" fallback in next major release.
  1271. this._dayOfMonthOrdinalParseLenient = new RegExp(
  1272. (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
  1273. '|' +
  1274. /\d{1,2}/.source
  1275. );
  1276. }
  1277. function mergeConfigs(parentConfig, childConfig) {
  1278. var res = extend({}, parentConfig),
  1279. prop;
  1280. for (prop in childConfig) {
  1281. if (hasOwnProp(childConfig, prop)) {
  1282. if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
  1283. res[prop] = {};
  1284. extend(res[prop], parentConfig[prop]);
  1285. extend(res[prop], childConfig[prop]);
  1286. } else if (childConfig[prop] != null) {
  1287. res[prop] = childConfig[prop];
  1288. } else {
  1289. delete res[prop];
  1290. }
  1291. }
  1292. }
  1293. for (prop in parentConfig) {
  1294. if (
  1295. hasOwnProp(parentConfig, prop) &&
  1296. !hasOwnProp(childConfig, prop) &&
  1297. isObject(parentConfig[prop])
  1298. ) {
  1299. // make sure changes to properties don't modify parent config
  1300. res[prop] = extend({}, res[prop]);
  1301. }
  1302. }
  1303. return res;
  1304. }
  1305. function Locale(config) {
  1306. if (config != null) {
  1307. this.set(config);
  1308. }
  1309. }
  1310. var keys;
  1311. if (Object.keys) {
  1312. keys = Object.keys;
  1313. } else {
  1314. keys = function (obj) {
  1315. var i,
  1316. res = [];
  1317. for (i in obj) {
  1318. if (hasOwnProp(obj, i)) {
  1319. res.push(i);
  1320. }
  1321. }
  1322. return res;
  1323. };
  1324. }
  1325. var defaultCalendar = {
  1326. sameDay: '[Today at] LT',
  1327. nextDay: '[Tomorrow at] LT',
  1328. nextWeek: 'dddd [at] LT',
  1329. lastDay: '[Yesterday at] LT',
  1330. lastWeek: '[Last] dddd [at] LT',
  1331. sameElse: 'L',
  1332. };
  1333. function calendar(key, mom, now) {
  1334. var output = this._calendar[key] || this._calendar['sameElse'];
  1335. return isFunction(output) ? output.call(mom, now) : output;
  1336. }
  1337. function zeroFill(number, targetLength, forceSign) {
  1338. var absNumber = '' + Math.abs(number),
  1339. zerosToFill = targetLength - absNumber.length,
  1340. sign = number >= 0;
  1341. return (
  1342. (sign ? (forceSign ? '+' : '') : '-') +
  1343. Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +
  1344. absNumber
  1345. );
  1346. }
  1347. 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,
  1348. localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
  1349. formatFunctions = {},
  1350. formatTokenFunctions = {};
  1351. // token: 'M'
  1352. // padded: ['MM', 2]
  1353. // ordinal: 'Mo'
  1354. // callback: function () { this.month() + 1 }
  1355. function addFormatToken(token, padded, ordinal, callback) {
  1356. var func = callback;
  1357. if (typeof callback === 'string') {
  1358. func = function () {
  1359. return this[callback]();
  1360. };
  1361. }
  1362. if (token) {
  1363. formatTokenFunctions[token] = func;
  1364. }
  1365. if (padded) {
  1366. formatTokenFunctions[padded[0]] = function () {
  1367. return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
  1368. };
  1369. }
  1370. if (ordinal) {
  1371. formatTokenFunctions[ordinal] = function () {
  1372. return this.localeData().ordinal(
  1373. func.apply(this, arguments),
  1374. token
  1375. );
  1376. };
  1377. }
  1378. }
  1379. function removeFormattingTokens(input) {
  1380. if (input.match(/\[[\s\S]/)) {
  1381. return input.replace(/^\[|\]$/g, '');
  1382. }
  1383. return input.replace(/\\/g, '');
  1384. }
  1385. function makeFormatFunction(format) {
  1386. var array = format.match(formattingTokens),
  1387. i,
  1388. length;
  1389. for (i = 0, length = array.length; i < length; i++) {
  1390. if (formatTokenFunctions[array[i]]) {
  1391. array[i] = formatTokenFunctions[array[i]];
  1392. } else {
  1393. array[i] = removeFormattingTokens(array[i]);
  1394. }
  1395. }
  1396. return function (mom) {
  1397. var output = '',
  1398. i;
  1399. for (i = 0; i < length; i++) {
  1400. output += isFunction(array[i])
  1401. ? array[i].call(mom, format)
  1402. : array[i];
  1403. }
  1404. return output;
  1405. };
  1406. }
  1407. // format date using native date object
  1408. function formatMoment(m, format) {
  1409. if (!m.isValid()) {
  1410. return m.localeData().invalidDate();
  1411. }
  1412. format = expandFormat(format, m.localeData());
  1413. formatFunctions[format] =
  1414. formatFunctions[format] || makeFormatFunction(format);
  1415. return formatFunctions[format](m);
  1416. }
  1417. function expandFormat(format, locale) {
  1418. var i = 5;
  1419. function replaceLongDateFormatTokens(input) {
  1420. return locale.longDateFormat(input) || input;
  1421. }
  1422. localFormattingTokens.lastIndex = 0;
  1423. while (i >= 0 && localFormattingTokens.test(format)) {
  1424. format = format.replace(
  1425. localFormattingTokens,
  1426. replaceLongDateFormatTokens
  1427. );
  1428. localFormattingTokens.lastIndex = 0;
  1429. i -= 1;
  1430. }
  1431. return format;
  1432. }
  1433. var defaultLongDateFormat = {
  1434. LTS: 'h:mm:ss A',
  1435. LT: 'h:mm A',
  1436. L: 'MM/DD/YYYY',
  1437. LL: 'MMMM D, YYYY',
  1438. LLL: 'MMMM D, YYYY h:mm A',
  1439. LLLL: 'dddd, MMMM D, YYYY h:mm A',
  1440. };
  1441. function longDateFormat(key) {
  1442. var format = this._longDateFormat[key],
  1443. formatUpper = this._longDateFormat[key.toUpperCase()];
  1444. if (format || !formatUpper) {
  1445. return format;
  1446. }
  1447. this._longDateFormat[key] = formatUpper
  1448. .match(formattingTokens)
  1449. .map(function (tok) {
  1450. if (
  1451. tok === 'MMMM' ||
  1452. tok === 'MM' ||
  1453. tok === 'DD' ||
  1454. tok === 'dddd'
  1455. ) {
  1456. return tok.slice(1);
  1457. }
  1458. return tok;
  1459. })
  1460. .join('');
  1461. return this._longDateFormat[key];
  1462. }
  1463. var defaultInvalidDate = 'Invalid date';
  1464. function invalidDate() {
  1465. return this._invalidDate;
  1466. }
  1467. var defaultOrdinal = '%d',
  1468. defaultDayOfMonthOrdinalParse = /\d{1,2}/;
  1469. function ordinal(number) {
  1470. return this._ordinal.replace('%d', number);
  1471. }
  1472. var defaultRelativeTime = {
  1473. future: 'in %s',
  1474. past: '%s ago',
  1475. s: 'a few seconds',
  1476. ss: '%d seconds',
  1477. m: 'a minute',
  1478. mm: '%d minutes',
  1479. h: 'an hour',
  1480. hh: '%d hours',
  1481. d: 'a day',
  1482. dd: '%d days',
  1483. w: 'a week',
  1484. ww: '%d weeks',
  1485. M: 'a month',
  1486. MM: '%d months',
  1487. y: 'a year',
  1488. yy: '%d years',
  1489. };
  1490. function relativeTime(number, withoutSuffix, string, isFuture) {
  1491. var output = this._relativeTime[string];
  1492. return isFunction(output)
  1493. ? output(number, withoutSuffix, string, isFuture)
  1494. : output.replace(/%d/i, number);
  1495. }
  1496. function pastFuture(diff, output) {
  1497. var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
  1498. return isFunction(format) ? format(output) : format.replace(/%s/i, output);
  1499. }
  1500. var aliases = {};
  1501. function addUnitAlias(unit, shorthand) {
  1502. var lowerCase = unit.toLowerCase();
  1503. aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
  1504. }
  1505. function normalizeUnits(units) {
  1506. return typeof units === 'string'
  1507. ? aliases[units] || aliases[units.toLowerCase()]
  1508. : undefined;
  1509. }
  1510. function normalizeObjectUnits(inputObject) {
  1511. var normalizedInput = {},
  1512. normalizedProp,
  1513. prop;
  1514. for (prop in inputObject) {
  1515. if (hasOwnProp(inputObject, prop)) {
  1516. normalizedProp = normalizeUnits(prop);
  1517. if (normalizedProp) {
  1518. normalizedInput[normalizedProp] = inputObject[prop];
  1519. }
  1520. }
  1521. }
  1522. return normalizedInput;
  1523. }
  1524. var priorities = {};
  1525. function addUnitPriority(unit, priority) {
  1526. priorities[unit] = priority;
  1527. }
  1528. function getPrioritizedUnits(unitsObj) {
  1529. var units = [],
  1530. u;
  1531. for (u in unitsObj) {
  1532. if (hasOwnProp(unitsObj, u)) {
  1533. units.push({ unit: u, priority: priorities[u] });
  1534. }
  1535. }
  1536. units.sort(function (a, b) {
  1537. return a.priority - b.priority;
  1538. });
  1539. return units;
  1540. }
  1541. function isLeapYear(year) {
  1542. return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
  1543. }
  1544. function absFloor(number) {
  1545. if (number < 0) {
  1546. // -0 -> 0
  1547. return Math.ceil(number) || 0;
  1548. } else {
  1549. return Math.floor(number);
  1550. }
  1551. }
  1552. function toInt(argumentForCoercion) {
  1553. var coercedNumber = +argumentForCoercion,
  1554. value = 0;
  1555. if (coercedNumber !== 0 && isFinite(coercedNumber)) {
  1556. value = absFloor(coercedNumber);
  1557. }
  1558. return value;
  1559. }
  1560. function makeGetSet(unit, keepTime) {
  1561. return function (value) {
  1562. if (value != null) {
  1563. set$1(this, unit, value);
  1564. hooks.updateOffset(this, keepTime);
  1565. return this;
  1566. } else {
  1567. return get(this, unit);
  1568. }
  1569. };
  1570. }
  1571. function get(mom, unit) {
  1572. return mom.isValid()
  1573. ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]()
  1574. : NaN;
  1575. }
  1576. function set$1(mom, unit, value) {
  1577. if (mom.isValid() && !isNaN(value)) {
  1578. if (
  1579. unit === 'FullYear' &&
  1580. isLeapYear(mom.year()) &&
  1581. mom.month() === 1 &&
  1582. mom.date() === 29
  1583. ) {
  1584. value = toInt(value);
  1585. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](
  1586. value,
  1587. mom.month(),
  1588. daysInMonth(value, mom.month())
  1589. );
  1590. } else {
  1591. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
  1592. }
  1593. }
  1594. }
  1595. // MOMENTS
  1596. function stringGet(units) {
  1597. units = normalizeUnits(units);
  1598. if (isFunction(this[units])) {
  1599. return this[units]();
  1600. }
  1601. return this;
  1602. }
  1603. function stringSet(units, value) {
  1604. if (typeof units === 'object') {
  1605. units = normalizeObjectUnits(units);
  1606. var prioritized = getPrioritizedUnits(units),
  1607. i;
  1608. for (i = 0; i < prioritized.length; i++) {
  1609. this[prioritized[i].unit](units[prioritized[i].unit]);
  1610. }
  1611. } else {
  1612. units = normalizeUnits(units);
  1613. if (isFunction(this[units])) {
  1614. return this[units](value);
  1615. }
  1616. }
  1617. return this;
  1618. }
  1619. var match1 = /\d/, // 0 - 9
  1620. match2 = /\d\d/, // 00 - 99
  1621. match3 = /\d{3}/, // 000 - 999
  1622. match4 = /\d{4}/, // 0000 - 9999
  1623. match6 = /[+-]?\d{6}/, // -999999 - 999999
  1624. match1to2 = /\d\d?/, // 0 - 99
  1625. match3to4 = /\d\d\d\d?/, // 999 - 9999
  1626. match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999
  1627. match1to3 = /\d{1,3}/, // 0 - 999
  1628. match1to4 = /\d{1,4}/, // 0 - 9999
  1629. match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999
  1630. matchUnsigned = /\d+/, // 0 - inf
  1631. matchSigned = /[+-]?\d+/, // -inf - inf
  1632. matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
  1633. matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z
  1634. matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
  1635. // any word (or two) characters or numbers including two/three word month in arabic.
  1636. // includes scottish gaelic two word and hyphenated months
  1637. 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,
  1638. regexes;
  1639. regexes = {};
  1640. function addRegexToken(token, regex, strictRegex) {
  1641. regexes[token] = isFunction(regex)
  1642. ? regex
  1643. : function (isStrict, localeData) {
  1644. return isStrict && strictRegex ? strictRegex : regex;
  1645. };
  1646. }
  1647. function getParseRegexForToken(token, config) {
  1648. if (!hasOwnProp(regexes, token)) {
  1649. return new RegExp(unescapeFormat(token));
  1650. }
  1651. return regexes[token](config._strict, config._locale);
  1652. }
  1653. // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
  1654. function unescapeFormat(s) {
  1655. return regexEscape(
  1656. s
  1657. .replace('\\', '')
  1658. .replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (
  1659. matched,
  1660. p1,
  1661. p2,
  1662. p3,
  1663. p4
  1664. ) {
  1665. return p1 || p2 || p3 || p4;
  1666. })
  1667. );
  1668. }
  1669. function regexEscape(s) {
  1670. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  1671. }
  1672. var tokens = {};
  1673. function addParseToken(token, callback) {
  1674. var i,
  1675. func = callback;
  1676. if (typeof token === 'string') {
  1677. token = [token];
  1678. }
  1679. if (isNumber(callback)) {
  1680. func = function (input, array) {
  1681. array[callback] = toInt(input);
  1682. };
  1683. }
  1684. for (i = 0; i < token.length; i++) {
  1685. tokens[token[i]] = func;
  1686. }
  1687. }
  1688. function addWeekParseToken(token, callback) {
  1689. addParseToken(token, function (input, array, config, token) {
  1690. config._w = config._w || {};
  1691. callback(input, config._w, config, token);
  1692. });
  1693. }
  1694. function addTimeToArrayFromToken(token, input, config) {
  1695. if (input != null && hasOwnProp(tokens, token)) {
  1696. tokens[token](input, config._a, config, token);
  1697. }
  1698. }
  1699. var YEAR = 0,
  1700. MONTH = 1,
  1701. DATE = 2,
  1702. HOUR = 3,
  1703. MINUTE = 4,
  1704. SECOND = 5,
  1705. MILLISECOND = 6,
  1706. WEEK = 7,
  1707. WEEKDAY = 8;
  1708. function mod(n, x) {
  1709. return ((n % x) + x) % x;
  1710. }
  1711. var indexOf;
  1712. if (Array.prototype.indexOf) {
  1713. indexOf = Array.prototype.indexOf;
  1714. } else {
  1715. indexOf = function (o) {
  1716. // I know
  1717. var i;
  1718. for (i = 0; i < this.length; ++i) {
  1719. if (this[i] === o) {
  1720. return i;
  1721. }
  1722. }
  1723. return -1;
  1724. };
  1725. }
  1726. function daysInMonth(year, month) {
  1727. if (isNaN(year) || isNaN(month)) {
  1728. return NaN;
  1729. }
  1730. var modMonth = mod(month, 12);
  1731. year += (month - modMonth) / 12;
  1732. return modMonth === 1
  1733. ? isLeapYear(year)
  1734. ? 29
  1735. : 28
  1736. : 31 - ((modMonth % 7) % 2);
  1737. }
  1738. // FORMATTING
  1739. addFormatToken('M', ['MM', 2], 'Mo', function () {
  1740. return this.month() + 1;
  1741. });
  1742. addFormatToken('MMM', 0, 0, function (format) {
  1743. return this.localeData().monthsShort(this, format);
  1744. });
  1745. addFormatToken('MMMM', 0, 0, function (format) {
  1746. return this.localeData().months(this, format);
  1747. });
  1748. // ALIASES
  1749. addUnitAlias('month', 'M');
  1750. // PRIORITY
  1751. addUnitPriority('month', 8);
  1752. // PARSING
  1753. addRegexToken('M', match1to2);
  1754. addRegexToken('MM', match1to2, match2);
  1755. addRegexToken('MMM', function (isStrict, locale) {
  1756. return locale.monthsShortRegex(isStrict);
  1757. });
  1758. addRegexToken('MMMM', function (isStrict, locale) {
  1759. return locale.monthsRegex(isStrict);
  1760. });
  1761. addParseToken(['M', 'MM'], function (input, array) {
  1762. array[MONTH] = toInt(input) - 1;
  1763. });
  1764. addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
  1765. var month = config._locale.monthsParse(input, token, config._strict);
  1766. // if we didn't find a month name, mark the date as invalid.
  1767. if (month != null) {
  1768. array[MONTH] = month;
  1769. } else {
  1770. getParsingFlags(config).invalidMonth = input;
  1771. }
  1772. });
  1773. // LOCALES
  1774. var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
  1775. '_'
  1776. ),
  1777. defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split(
  1778. '_'
  1779. ),
  1780. MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
  1781. defaultMonthsShortRegex = matchWord,
  1782. defaultMonthsRegex = matchWord;
  1783. function localeMonths(m, format) {
  1784. if (!m) {
  1785. return isArray(this._months)
  1786. ? this._months
  1787. : this._months['standalone'];
  1788. }
  1789. return isArray(this._months)
  1790. ? this._months[m.month()]
  1791. : this._months[
  1792. (this._months.isFormat || MONTHS_IN_FORMAT).test(format)
  1793. ? 'format'
  1794. : 'standalone'
  1795. ][m.month()];
  1796. }
  1797. function localeMonthsShort(m, format) {
  1798. if (!m) {
  1799. return isArray(this._monthsShort)
  1800. ? this._monthsShort
  1801. : this._monthsShort['standalone'];
  1802. }
  1803. return isArray(this._monthsShort)
  1804. ? this._monthsShort[m.month()]
  1805. : this._monthsShort[
  1806. MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'
  1807. ][m.month()];
  1808. }
  1809. function handleStrictParse(monthName, format, strict) {
  1810. var i,
  1811. ii,
  1812. mom,
  1813. llc = monthName.toLocaleLowerCase();
  1814. if (!this._monthsParse) {
  1815. // this is not used
  1816. this._monthsParse = [];
  1817. this._longMonthsParse = [];
  1818. this._shortMonthsParse = [];
  1819. for (i = 0; i < 12; ++i) {
  1820. mom = createUTC([2000, i]);
  1821. this._shortMonthsParse[i] = this.monthsShort(
  1822. mom,
  1823. ''
  1824. ).toLocaleLowerCase();
  1825. this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
  1826. }
  1827. }
  1828. if (strict) {
  1829. if (format === 'MMM') {
  1830. ii = indexOf.call(this._shortMonthsParse, llc);
  1831. return ii !== -1 ? ii : null;
  1832. } else {
  1833. ii = indexOf.call(this._longMonthsParse, llc);
  1834. return ii !== -1 ? ii : null;
  1835. }
  1836. } else {
  1837. if (format === 'MMM') {
  1838. ii = indexOf.call(this._shortMonthsParse, llc);
  1839. if (ii !== -1) {
  1840. return ii;
  1841. }
  1842. ii = indexOf.call(this._longMonthsParse, llc);
  1843. return ii !== -1 ? ii : null;
  1844. } else {
  1845. ii = indexOf.call(this._longMonthsParse, llc);
  1846. if (ii !== -1) {
  1847. return ii;
  1848. }
  1849. ii = indexOf.call(this._shortMonthsParse, llc);
  1850. return ii !== -1 ? ii : null;
  1851. }
  1852. }
  1853. }
  1854. function localeMonthsParse(monthName, format, strict) {
  1855. var i, mom, regex;
  1856. if (this._monthsParseExact) {
  1857. return handleStrictParse.call(this, monthName, format, strict);
  1858. }
  1859. if (!this._monthsParse) {
  1860. this._monthsParse = [];
  1861. this._longMonthsParse = [];
  1862. this._shortMonthsParse = [];
  1863. }
  1864. // TODO: add sorting
  1865. // Sorting makes sure if one month (or abbr) is a prefix of another
  1866. // see sorting in computeMonthsParse
  1867. for (i = 0; i < 12; i++) {
  1868. // make the regex if we don't have it already
  1869. mom = createUTC([2000, i]);
  1870. if (strict && !this._longMonthsParse[i]) {
  1871. this._longMonthsParse[i] = new RegExp(
  1872. '^' + this.months(mom, '').replace('.', '') + '$',
  1873. 'i'
  1874. );
  1875. this._shortMonthsParse[i] = new RegExp(
  1876. '^' + this.monthsShort(mom, '').replace('.', '') + '$',
  1877. 'i'
  1878. );
  1879. }
  1880. if (!strict && !this._monthsParse[i]) {
  1881. regex =
  1882. '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
  1883. this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
  1884. }
  1885. // test the regex
  1886. if (
  1887. strict &&
  1888. format === 'MMMM' &&
  1889. this._longMonthsParse[i].test(monthName)
  1890. ) {
  1891. return i;
  1892. } else if (
  1893. strict &&
  1894. format === 'MMM' &&
  1895. this._shortMonthsParse[i].test(monthName)
  1896. ) {
  1897. return i;
  1898. } else if (!strict && this._monthsParse[i].test(monthName)) {
  1899. return i;
  1900. }
  1901. }
  1902. }
  1903. // MOMENTS
  1904. function setMonth(mom, value) {
  1905. var dayOfMonth;
  1906. if (!mom.isValid()) {
  1907. // No op
  1908. return mom;
  1909. }
  1910. if (typeof value === 'string') {
  1911. if (/^\d+$/.test(value)) {
  1912. value = toInt(value);
  1913. } else {
  1914. value = mom.localeData().monthsParse(value);
  1915. // TODO: Another silent failure?
  1916. if (!isNumber(value)) {
  1917. return mom;
  1918. }
  1919. }
  1920. }
  1921. dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
  1922. mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
  1923. return mom;
  1924. }
  1925. function getSetMonth(value) {
  1926. if (value != null) {
  1927. setMonth(this, value);
  1928. hooks.updateOffset(this, true);
  1929. return this;
  1930. } else {
  1931. return get(this, 'Month');
  1932. }
  1933. }
  1934. function getDaysInMonth() {
  1935. return daysInMonth(this.year(), this.month());
  1936. }
  1937. function monthsShortRegex(isStrict) {
  1938. if (this._monthsParseExact) {
  1939. if (!hasOwnProp(this, '_monthsRegex')) {
  1940. computeMonthsParse.call(this);
  1941. }
  1942. if (isStrict) {
  1943. return this._monthsShortStrictRegex;
  1944. } else {
  1945. return this._monthsShortRegex;
  1946. }
  1947. } else {
  1948. if (!hasOwnProp(this, '_monthsShortRegex')) {
  1949. this._monthsShortRegex = defaultMonthsShortRegex;
  1950. }
  1951. return this._monthsShortStrictRegex && isStrict
  1952. ? this._monthsShortStrictRegex
  1953. : this._monthsShortRegex;
  1954. }
  1955. }
  1956. function monthsRegex(isStrict) {
  1957. if (this._monthsParseExact) {
  1958. if (!hasOwnProp(this, '_monthsRegex')) {
  1959. computeMonthsParse.call(this);
  1960. }
  1961. if (isStrict) {
  1962. return this._monthsStrictRegex;
  1963. } else {
  1964. return this._monthsRegex;
  1965. }
  1966. } else {
  1967. if (!hasOwnProp(this, '_monthsRegex')) {
  1968. this._monthsRegex = defaultMonthsRegex;
  1969. }
  1970. return this._monthsStrictRegex && isStrict
  1971. ? this._monthsStrictRegex
  1972. : this._monthsRegex;
  1973. }
  1974. }
  1975. function computeMonthsParse() {
  1976. function cmpLenRev(a, b) {
  1977. return b.length - a.length;
  1978. }
  1979. var shortPieces = [],
  1980. longPieces = [],
  1981. mixedPieces = [],
  1982. i,
  1983. mom;
  1984. for (i = 0; i < 12; i++) {
  1985. // make the regex if we don't have it already
  1986. mom = createUTC([2000, i]);
  1987. shortPieces.push(this.monthsShort(mom, ''));
  1988. longPieces.push(this.months(mom, ''));
  1989. mixedPieces.push(this.months(mom, ''));
  1990. mixedPieces.push(this.monthsShort(mom, ''));
  1991. }
  1992. // Sorting makes sure if one month (or abbr) is a prefix of another it
  1993. // will match the longer piece.
  1994. shortPieces.sort(cmpLenRev);
  1995. longPieces.sort(cmpLenRev);
  1996. mixedPieces.sort(cmpLenRev);
  1997. for (i = 0; i < 12; i++) {
  1998. shortPieces[i] = regexEscape(shortPieces[i]);
  1999. longPieces[i] = regexEscape(longPieces[i]);
  2000. }
  2001. for (i = 0; i < 24; i++) {
  2002. mixedPieces[i] = regexEscape(mixedPieces[i]);
  2003. }
  2004. this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  2005. this._monthsShortRegex = this._monthsRegex;
  2006. this._monthsStrictRegex = new RegExp(
  2007. '^(' + longPieces.join('|') + ')',
  2008. 'i'
  2009. );
  2010. this._monthsShortStrictRegex = new RegExp(
  2011. '^(' + shortPieces.join('|') + ')',
  2012. 'i'
  2013. );
  2014. }
  2015. // FORMATTING
  2016. addFormatToken('Y', 0, 0, function () {
  2017. var y = this.year();
  2018. return y <= 9999 ? zeroFill(y, 4) : '+' + y;
  2019. });
  2020. addFormatToken(0, ['YY', 2], 0, function () {
  2021. return this.year() % 100;
  2022. });
  2023. addFormatToken(0, ['YYYY', 4], 0, 'year');
  2024. addFormatToken(0, ['YYYYY', 5], 0, 'year');
  2025. addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
  2026. // ALIASES
  2027. addUnitAlias('year', 'y');
  2028. // PRIORITIES
  2029. addUnitPriority('year', 1);
  2030. // PARSING
  2031. addRegexToken('Y', matchSigned);
  2032. addRegexToken('YY', match1to2, match2);
  2033. addRegexToken('YYYY', match1to4, match4);
  2034. addRegexToken('YYYYY', match1to6, match6);
  2035. addRegexToken('YYYYYY', match1to6, match6);
  2036. addParseToken(['YYYYY', 'YYYYYY'], YEAR);
  2037. addParseToken('YYYY', function (input, array) {
  2038. array[YEAR] =
  2039. input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
  2040. });
  2041. addParseToken('YY', function (input, array) {
  2042. array[YEAR] = hooks.parseTwoDigitYear(input);
  2043. });
  2044. addParseToken('Y', function (input, array) {
  2045. array[YEAR] = parseInt(input, 10);
  2046. });
  2047. // HELPERS
  2048. function daysInYear(year) {
  2049. return isLeapYear(year) ? 366 : 365;
  2050. }
  2051. // HOOKS
  2052. hooks.parseTwoDigitYear = function (input) {
  2053. return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
  2054. };
  2055. // MOMENTS
  2056. var getSetYear = makeGetSet('FullYear', true);
  2057. function getIsLeapYear() {
  2058. return isLeapYear(this.year());
  2059. }
  2060. function createDate(y, m, d, h, M, s, ms) {
  2061. // can't just apply() to create a date:
  2062. // https://stackoverflow.com/q/181348
  2063. var date;
  2064. // the date constructor remaps years 0-99 to 1900-1999
  2065. if (y < 100 && y >= 0) {
  2066. // preserve leap years using a full 400 year cycle, then reset
  2067. date = new Date(y + 400, m, d, h, M, s, ms);
  2068. if (isFinite(date.getFullYear())) {
  2069. date.setFullYear(y);
  2070. }
  2071. } else {
  2072. date = new Date(y, m, d, h, M, s, ms);
  2073. }
  2074. return date;
  2075. }
  2076. function createUTCDate(y) {
  2077. var date, args;
  2078. // the Date.UTC function remaps years 0-99 to 1900-1999
  2079. if (y < 100 && y >= 0) {
  2080. args = Array.prototype.slice.call(arguments);
  2081. // preserve leap years using a full 400 year cycle, then reset
  2082. args[0] = y + 400;
  2083. date = new Date(Date.UTC.apply(null, args));
  2084. if (isFinite(date.getUTCFullYear())) {
  2085. date.setUTCFullYear(y);
  2086. }
  2087. } else {
  2088. date = new Date(Date.UTC.apply(null, arguments));
  2089. }
  2090. return date;
  2091. }
  2092. // start-of-first-week - start-of-year
  2093. function firstWeekOffset(year, dow, doy) {
  2094. var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
  2095. fwd = 7 + dow - doy,
  2096. // first-week day local weekday -- which local weekday is fwd
  2097. fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  2098. return -fwdlw + fwd - 1;
  2099. }
  2100. // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
  2101. function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  2102. var localWeekday = (7 + weekday - dow) % 7,
  2103. weekOffset = firstWeekOffset(year, dow, doy),
  2104. dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
  2105. resYear,
  2106. resDayOfYear;
  2107. if (dayOfYear <= 0) {
  2108. resYear = year - 1;
  2109. resDayOfYear = daysInYear(resYear) + dayOfYear;
  2110. } else if (dayOfYear > daysInYear(year)) {
  2111. resYear = year + 1;
  2112. resDayOfYear = dayOfYear - daysInYear(year);
  2113. } else {
  2114. resYear = year;
  2115. resDayOfYear = dayOfYear;
  2116. }
  2117. return {
  2118. year: resYear,
  2119. dayOfYear: resDayOfYear,
  2120. };
  2121. }
  2122. function weekOfYear(mom, dow, doy) {
  2123. var weekOffset = firstWeekOffset(mom.year(), dow, doy),
  2124. week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
  2125. resWeek,
  2126. resYear;
  2127. if (week < 1) {
  2128. resYear = mom.year() - 1;
  2129. resWeek = week + weeksInYear(resYear, dow, doy);
  2130. } else if (week > weeksInYear(mom.year(), dow, doy)) {
  2131. resWeek = week - weeksInYear(mom.year(), dow, doy);
  2132. resYear = mom.year() + 1;
  2133. } else {
  2134. resYear = mom.year();
  2135. resWeek = week;
  2136. }
  2137. return {
  2138. week: resWeek,
  2139. year: resYear,
  2140. };
  2141. }
  2142. function weeksInYear(year, dow, doy) {
  2143. var weekOffset = firstWeekOffset(year, dow, doy),
  2144. weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  2145. return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
  2146. }
  2147. // FORMATTING
  2148. addFormatToken('w', ['ww', 2], 'wo', 'week');
  2149. addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
  2150. // ALIASES
  2151. addUnitAlias('week', 'w');
  2152. addUnitAlias('isoWeek', 'W');
  2153. // PRIORITIES
  2154. addUnitPriority('week', 5);
  2155. addUnitPriority('isoWeek', 5);
  2156. // PARSING
  2157. addRegexToken('w', match1to2);
  2158. addRegexToken('ww', match1to2, match2);
  2159. addRegexToken('W', match1to2);
  2160. addRegexToken('WW', match1to2, match2);
  2161. addWeekParseToken(['w', 'ww', 'W', 'WW'], function (
  2162. input,
  2163. week,
  2164. config,
  2165. token
  2166. ) {
  2167. week[token.substr(0, 1)] = toInt(input);
  2168. });
  2169. // HELPERS
  2170. // LOCALES
  2171. function localeWeek(mom) {
  2172. return weekOfYear(mom, this._week.dow, this._week.doy).week;
  2173. }
  2174. var defaultLocaleWeek = {
  2175. dow: 0, // Sunday is the first day of the week.
  2176. doy: 6, // The week that contains Jan 6th is the first week of the year.
  2177. };
  2178. function localeFirstDayOfWeek() {
  2179. return this._week.dow;
  2180. }
  2181. function localeFirstDayOfYear() {
  2182. return this._week.doy;
  2183. }
  2184. // MOMENTS
  2185. function getSetWeek(input) {
  2186. var week = this.localeData().week(this);
  2187. return input == null ? week : this.add((input - week) * 7, 'd');
  2188. }
  2189. function getSetISOWeek(input) {
  2190. var week = weekOfYear(this, 1, 4).week;
  2191. return input == null ? week : this.add((input - week) * 7, 'd');
  2192. }
  2193. // FORMATTING
  2194. addFormatToken('d', 0, 'do', 'day');
  2195. addFormatToken('dd', 0, 0, function (format) {
  2196. return this.localeData().weekdaysMin(this, format);
  2197. });
  2198. addFormatToken('ddd', 0, 0, function (format) {
  2199. return this.localeData().weekdaysShort(this, format);
  2200. });
  2201. addFormatToken('dddd', 0, 0, function (format) {
  2202. return this.localeData().weekdays(this, format);
  2203. });
  2204. addFormatToken('e', 0, 0, 'weekday');
  2205. addFormatToken('E', 0, 0, 'isoWeekday');
  2206. // ALIASES
  2207. addUnitAlias('day', 'd');
  2208. addUnitAlias('weekday', 'e');
  2209. addUnitAlias('isoWeekday', 'E');
  2210. // PRIORITY
  2211. addUnitPriority('day', 11);
  2212. addUnitPriority('weekday', 11);
  2213. addUnitPriority('isoWeekday', 11);
  2214. // PARSING
  2215. addRegexToken('d', match1to2);
  2216. addRegexToken('e', match1to2);
  2217. addRegexToken('E', match1to2);
  2218. addRegexToken('dd', function (isStrict, locale) {
  2219. return locale.weekdaysMinRegex(isStrict);
  2220. });
  2221. addRegexToken('ddd', function (isStrict, locale) {
  2222. return locale.weekdaysShortRegex(isStrict);
  2223. });
  2224. addRegexToken('dddd', function (isStrict, locale) {
  2225. return locale.weekdaysRegex(isStrict);
  2226. });
  2227. addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
  2228. var weekday = config._locale.weekdaysParse(input, token, config._strict);
  2229. // if we didn't get a weekday name, mark the date as invalid
  2230. if (weekday != null) {
  2231. week.d = weekday;
  2232. } else {
  2233. getParsingFlags(config).invalidWeekday = input;
  2234. }
  2235. });
  2236. addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
  2237. week[token] = toInt(input);
  2238. });
  2239. // HELPERS
  2240. function parseWeekday(input, locale) {
  2241. if (typeof input !== 'string') {
  2242. return input;
  2243. }
  2244. if (!isNaN(input)) {
  2245. return parseInt(input, 10);
  2246. }
  2247. input = locale.weekdaysParse(input);
  2248. if (typeof input === 'number') {
  2249. return input;
  2250. }
  2251. return null;
  2252. }
  2253. function parseIsoWeekday(input, locale) {
  2254. if (typeof input === 'string') {
  2255. return locale.weekdaysParse(input) % 7 || 7;
  2256. }
  2257. return isNaN(input) ? null : input;
  2258. }
  2259. // LOCALES
  2260. function shiftWeekdays(ws, n) {
  2261. return ws.slice(n, 7).concat(ws.slice(0, n));
  2262. }
  2263. var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
  2264. '_'
  2265. ),
  2266. defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  2267. defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  2268. defaultWeekdaysRegex = matchWord,
  2269. defaultWeekdaysShortRegex = matchWord,
  2270. defaultWeekdaysMinRegex = matchWord;
  2271. function localeWeekdays(m, format) {
  2272. var weekdays = isArray(this._weekdays)
  2273. ? this._weekdays
  2274. : this._weekdays[
  2275. m && m !== true && this._weekdays.isFormat.test(format)
  2276. ? 'format'
  2277. : 'standalone'
  2278. ];
  2279. return m === true
  2280. ? shiftWeekdays(weekdays, this._week.dow)
  2281. : m
  2282. ? weekdays[m.day()]
  2283. : weekdays;
  2284. }
  2285. function localeWeekdaysShort(m) {
  2286. return m === true
  2287. ? shiftWeekdays(this._weekdaysShort, this._week.dow)
  2288. : m
  2289. ? this._weekdaysShort[m.day()]
  2290. : this._weekdaysShort;
  2291. }
  2292. function localeWeekdaysMin(m) {
  2293. return m === true
  2294. ? shiftWeekdays(this._weekdaysMin, this._week.dow)
  2295. : m
  2296. ? this._weekdaysMin[m.day()]
  2297. : this._weekdaysMin;
  2298. }
  2299. function handleStrictParse$1(weekdayName, format, strict) {
  2300. var i,
  2301. ii,
  2302. mom,
  2303. llc = weekdayName.toLocaleLowerCase();
  2304. if (!this._weekdaysParse) {
  2305. this._weekdaysParse = [];
  2306. this._shortWeekdaysParse = [];
  2307. this._minWeekdaysParse = [];
  2308. for (i = 0; i < 7; ++i) {
  2309. mom = createUTC([2000, 1]).day(i);
  2310. this._minWeekdaysParse[i] = this.weekdaysMin(
  2311. mom,
  2312. ''
  2313. ).toLocaleLowerCase();
  2314. this._shortWeekdaysParse[i] = this.weekdaysShort(
  2315. mom,
  2316. ''
  2317. ).toLocaleLowerCase();
  2318. this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
  2319. }
  2320. }
  2321. if (strict) {
  2322. if (format === 'dddd') {
  2323. ii = indexOf.call(this._weekdaysParse, llc);
  2324. return ii !== -1 ? ii : null;
  2325. } else if (format === 'ddd') {
  2326. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2327. return ii !== -1 ? ii : null;
  2328. } else {
  2329. ii = indexOf.call(this._minWeekdaysParse, llc);
  2330. return ii !== -1 ? ii : null;
  2331. }
  2332. } else {
  2333. if (format === 'dddd') {
  2334. ii = indexOf.call(this._weekdaysParse, llc);
  2335. if (ii !== -1) {
  2336. return ii;
  2337. }
  2338. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2339. if (ii !== -1) {
  2340. return ii;
  2341. }
  2342. ii = indexOf.call(this._minWeekdaysParse, llc);
  2343. return ii !== -1 ? ii : null;
  2344. } else if (format === 'ddd') {
  2345. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2346. if (ii !== -1) {
  2347. return ii;
  2348. }
  2349. ii = indexOf.call(this._weekdaysParse, llc);
  2350. if (ii !== -1) {
  2351. return ii;
  2352. }
  2353. ii = indexOf.call(this._minWeekdaysParse, llc);
  2354. return ii !== -1 ? ii : null;
  2355. } else {
  2356. ii = indexOf.call(this._minWeekdaysParse, llc);
  2357. if (ii !== -1) {
  2358. return ii;
  2359. }
  2360. ii = indexOf.call(this._weekdaysParse, llc);
  2361. if (ii !== -1) {
  2362. return ii;
  2363. }
  2364. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2365. return ii !== -1 ? ii : null;
  2366. }
  2367. }
  2368. }
  2369. function localeWeekdaysParse(weekdayName, format, strict) {
  2370. var i, mom, regex;
  2371. if (this._weekdaysParseExact) {
  2372. return handleStrictParse$1.call(this, weekdayName, format, strict);
  2373. }
  2374. if (!this._weekdaysParse) {
  2375. this._weekdaysParse = [];
  2376. this._minWeekdaysParse = [];
  2377. this._shortWeekdaysParse = [];
  2378. this._fullWeekdaysParse = [];
  2379. }
  2380. for (i = 0; i < 7; i++) {
  2381. // make the regex if we don't have it already
  2382. mom = createUTC([2000, 1]).day(i);
  2383. if (strict && !this._fullWeekdaysParse[i]) {
  2384. this._fullWeekdaysParse[i] = new RegExp(
  2385. '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$',
  2386. 'i'
  2387. );
  2388. this._shortWeekdaysParse[i] = new RegExp(
  2389. '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$',
  2390. 'i'
  2391. );
  2392. this._minWeekdaysParse[i] = new RegExp(
  2393. '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$',
  2394. 'i'
  2395. );
  2396. }
  2397. if (!this._weekdaysParse[i]) {
  2398. regex =
  2399. '^' +
  2400. this.weekdays(mom, '') +
  2401. '|^' +
  2402. this.weekdaysShort(mom, '') +
  2403. '|^' +
  2404. this.weekdaysMin(mom, '');
  2405. this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
  2406. }
  2407. // test the regex
  2408. if (
  2409. strict &&
  2410. format === 'dddd' &&
  2411. this._fullWeekdaysParse[i].test(weekdayName)
  2412. ) {
  2413. return i;
  2414. } else if (
  2415. strict &&
  2416. format === 'ddd' &&
  2417. this._shortWeekdaysParse[i].test(weekdayName)
  2418. ) {
  2419. return i;
  2420. } else if (
  2421. strict &&
  2422. format === 'dd' &&
  2423. this._minWeekdaysParse[i].test(weekdayName)
  2424. ) {
  2425. return i;
  2426. } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
  2427. return i;
  2428. }
  2429. }
  2430. }
  2431. // MOMENTS
  2432. function getSetDayOfWeek(input) {
  2433. if (!this.isValid()) {
  2434. return input != null ? this : NaN;
  2435. }
  2436. var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
  2437. if (input != null) {
  2438. input = parseWeekday(input, this.localeData());
  2439. return this.add(input - day, 'd');
  2440. } else {
  2441. return day;
  2442. }
  2443. }
  2444. function getSetLocaleDayOfWeek(input) {
  2445. if (!this.isValid()) {
  2446. return input != null ? this : NaN;
  2447. }
  2448. var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  2449. return input == null ? weekday : this.add(input - weekday, 'd');
  2450. }
  2451. function getSetISODayOfWeek(input) {
  2452. if (!this.isValid()) {
  2453. return input != null ? this : NaN;
  2454. }
  2455. // behaves the same as moment#day except
  2456. // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
  2457. // as a setter, sunday should belong to the previous week.
  2458. if (input != null) {
  2459. var weekday = parseIsoWeekday(input, this.localeData());
  2460. return this.day(this.day() % 7 ? weekday : weekday - 7);
  2461. } else {
  2462. return this.day() || 7;
  2463. }
  2464. }
  2465. function weekdaysRegex(isStrict) {
  2466. if (this._weekdaysParseExact) {
  2467. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2468. computeWeekdaysParse.call(this);
  2469. }
  2470. if (isStrict) {
  2471. return this._weekdaysStrictRegex;
  2472. } else {
  2473. return this._weekdaysRegex;
  2474. }
  2475. } else {
  2476. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2477. this._weekdaysRegex = defaultWeekdaysRegex;
  2478. }
  2479. return this._weekdaysStrictRegex && isStrict
  2480. ? this._weekdaysStrictRegex
  2481. : this._weekdaysRegex;
  2482. }
  2483. }
  2484. function weekdaysShortRegex(isStrict) {
  2485. if (this._weekdaysParseExact) {
  2486. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2487. computeWeekdaysParse.call(this);
  2488. }
  2489. if (isStrict) {
  2490. return this._weekdaysShortStrictRegex;
  2491. } else {
  2492. return this._weekdaysShortRegex;
  2493. }
  2494. } else {
  2495. if (!hasOwnProp(this, '_weekdaysShortRegex')) {
  2496. this._weekdaysShortRegex = defaultWeekdaysShortRegex;
  2497. }
  2498. return this._weekdaysShortStrictRegex && isStrict
  2499. ? this._weekdaysShortStrictRegex
  2500. : this._weekdaysShortRegex;
  2501. }
  2502. }
  2503. function weekdaysMinRegex(isStrict) {
  2504. if (this._weekdaysParseExact) {
  2505. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2506. computeWeekdaysParse.call(this);
  2507. }
  2508. if (isStrict) {
  2509. return this._weekdaysMinStrictRegex;
  2510. } else {
  2511. return this._weekdaysMinRegex;
  2512. }
  2513. } else {
  2514. if (!hasOwnProp(this, '_weekdaysMinRegex')) {
  2515. this._weekdaysMinRegex = defaultWeekdaysMinRegex;
  2516. }
  2517. return this._weekdaysMinStrictRegex && isStrict
  2518. ? this._weekdaysMinStrictRegex
  2519. : this._weekdaysMinRegex;
  2520. }
  2521. }
  2522. function computeWeekdaysParse() {
  2523. function cmpLenRev(a, b) {
  2524. return b.length - a.length;
  2525. }
  2526. var minPieces = [],
  2527. shortPieces = [],
  2528. longPieces = [],
  2529. mixedPieces = [],
  2530. i,
  2531. mom,
  2532. minp,
  2533. shortp,
  2534. longp;
  2535. for (i = 0; i < 7; i++) {
  2536. // make the regex if we don't have it already
  2537. mom = createUTC([2000, 1]).day(i);
  2538. minp = regexEscape(this.weekdaysMin(mom, ''));
  2539. shortp = regexEscape(this.weekdaysShort(mom, ''));
  2540. longp = regexEscape(this.weekdays(mom, ''));
  2541. minPieces.push(minp);
  2542. shortPieces.push(shortp);
  2543. longPieces.push(longp);
  2544. mixedPieces.push(minp);
  2545. mixedPieces.push(shortp);
  2546. mixedPieces.push(longp);
  2547. }
  2548. // Sorting makes sure if one weekday (or abbr) is a prefix of another it
  2549. // will match the longer piece.
  2550. minPieces.sort(cmpLenRev);
  2551. shortPieces.sort(cmpLenRev);
  2552. longPieces.sort(cmpLenRev);
  2553. mixedPieces.sort(cmpLenRev);
  2554. this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  2555. this._weekdaysShortRegex = this._weekdaysRegex;
  2556. this._weekdaysMinRegex = this._weekdaysRegex;
  2557. this._weekdaysStrictRegex = new RegExp(
  2558. '^(' + longPieces.join('|') + ')',
  2559. 'i'
  2560. );
  2561. this._weekdaysShortStrictRegex = new RegExp(
  2562. '^(' + shortPieces.join('|') + ')',
  2563. 'i'
  2564. );
  2565. this._weekdaysMinStrictRegex = new RegExp(
  2566. '^(' + minPieces.join('|') + ')',
  2567. 'i'
  2568. );
  2569. }
  2570. // FORMATTING
  2571. function hFormat() {
  2572. return this.hours() % 12 || 12;
  2573. }
  2574. function kFormat() {
  2575. return this.hours() || 24;
  2576. }
  2577. addFormatToken('H', ['HH', 2], 0, 'hour');
  2578. addFormatToken('h', ['hh', 2], 0, hFormat);
  2579. addFormatToken('k', ['kk', 2], 0, kFormat);
  2580. addFormatToken('hmm', 0, 0, function () {
  2581. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
  2582. });
  2583. addFormatToken('hmmss', 0, 0, function () {
  2584. return (
  2585. '' +
  2586. hFormat.apply(this) +
  2587. zeroFill(this.minutes(), 2) +
  2588. zeroFill(this.seconds(), 2)
  2589. );
  2590. });
  2591. addFormatToken('Hmm', 0, 0, function () {
  2592. return '' + this.hours() + zeroFill(this.minutes(), 2);
  2593. });
  2594. addFormatToken('Hmmss', 0, 0, function () {
  2595. return (
  2596. '' +
  2597. this.hours() +
  2598. zeroFill(this.minutes(), 2) +
  2599. zeroFill(this.seconds(), 2)
  2600. );
  2601. });
  2602. function meridiem(token, lowercase) {
  2603. addFormatToken(token, 0, 0, function () {
  2604. return this.localeData().meridiem(
  2605. this.hours(),
  2606. this.minutes(),
  2607. lowercase
  2608. );
  2609. });
  2610. }
  2611. meridiem('a', true);
  2612. meridiem('A', false);
  2613. // ALIASES
  2614. addUnitAlias('hour', 'h');
  2615. // PRIORITY
  2616. addUnitPriority('hour', 13);
  2617. // PARSING
  2618. function matchMeridiem(isStrict, locale) {
  2619. return locale._meridiemParse;
  2620. }
  2621. addRegexToken('a', matchMeridiem);
  2622. addRegexToken('A', matchMeridiem);
  2623. addRegexToken('H', match1to2);
  2624. addRegexToken('h', match1to2);
  2625. addRegexToken('k', match1to2);
  2626. addRegexToken('HH', match1to2, match2);
  2627. addRegexToken('hh', match1to2, match2);
  2628. addRegexToken('kk', match1to2, match2);
  2629. addRegexToken('hmm', match3to4);
  2630. addRegexToken('hmmss', match5to6);
  2631. addRegexToken('Hmm', match3to4);
  2632. addRegexToken('Hmmss', match5to6);
  2633. addParseToken(['H', 'HH'], HOUR);
  2634. addParseToken(['k', 'kk'], function (input, array, config) {
  2635. var kInput = toInt(input);
  2636. array[HOUR] = kInput === 24 ? 0 : kInput;
  2637. });
  2638. addParseToken(['a', 'A'], function (input, array, config) {
  2639. config._isPm = config._locale.isPM(input);
  2640. config._meridiem = input;
  2641. });
  2642. addParseToken(['h', 'hh'], function (input, array, config) {
  2643. array[HOUR] = toInt(input);
  2644. getParsingFlags(config).bigHour = true;
  2645. });
  2646. addParseToken('hmm', function (input, array, config) {
  2647. var pos = input.length - 2;
  2648. array[HOUR] = toInt(input.substr(0, pos));
  2649. array[MINUTE] = toInt(input.substr(pos));
  2650. getParsingFlags(config).bigHour = true;
  2651. });
  2652. addParseToken('hmmss', function (input, array, config) {
  2653. var pos1 = input.length - 4,
  2654. pos2 = input.length - 2;
  2655. array[HOUR] = toInt(input.substr(0, pos1));
  2656. array[MINUTE] = toInt(input.substr(pos1, 2));
  2657. array[SECOND] = toInt(input.substr(pos2));
  2658. getParsingFlags(config).bigHour = true;
  2659. });
  2660. addParseToken('Hmm', function (input, array, config) {
  2661. var pos = input.length - 2;
  2662. array[HOUR] = toInt(input.substr(0, pos));
  2663. array[MINUTE] = toInt(input.substr(pos));
  2664. });
  2665. addParseToken('Hmmss', function (input, array, config) {
  2666. var pos1 = input.length - 4,
  2667. pos2 = input.length - 2;
  2668. array[HOUR] = toInt(input.substr(0, pos1));
  2669. array[MINUTE] = toInt(input.substr(pos1, 2));
  2670. array[SECOND] = toInt(input.substr(pos2));
  2671. });
  2672. // LOCALES
  2673. function localeIsPM(input) {
  2674. // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
  2675. // Using charAt should be more compatible.
  2676. return (input + '').toLowerCase().charAt(0) === 'p';
  2677. }
  2678. var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i,
  2679. // Setting the hour should keep the time, because the user explicitly
  2680. // specified which hour they want. So trying to maintain the same hour (in
  2681. // a new timezone) makes sense. Adding/subtracting hours does not follow
  2682. // this rule.
  2683. getSetHour = makeGetSet('Hours', true);
  2684. function localeMeridiem(hours, minutes, isLower) {
  2685. if (hours > 11) {
  2686. return isLower ? 'pm' : 'PM';
  2687. } else {
  2688. return isLower ? 'am' : 'AM';
  2689. }
  2690. }
  2691. var baseConfig = {
  2692. calendar: defaultCalendar,
  2693. longDateFormat: defaultLongDateFormat,
  2694. invalidDate: defaultInvalidDate,
  2695. ordinal: defaultOrdinal,
  2696. dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
  2697. relativeTime: defaultRelativeTime,
  2698. months: defaultLocaleMonths,
  2699. monthsShort: defaultLocaleMonthsShort,
  2700. week: defaultLocaleWeek,
  2701. weekdays: defaultLocaleWeekdays,
  2702. weekdaysMin: defaultLocaleWeekdaysMin,
  2703. weekdaysShort: defaultLocaleWeekdaysShort,
  2704. meridiemParse: defaultLocaleMeridiemParse,
  2705. };
  2706. // internal storage for locale config files
  2707. var locales = {},
  2708. localeFamilies = {},
  2709. globalLocale;
  2710. function commonPrefix(arr1, arr2) {
  2711. var i,
  2712. minl = Math.min(arr1.length, arr2.length);
  2713. for (i = 0; i < minl; i += 1) {
  2714. if (arr1[i] !== arr2[i]) {
  2715. return i;
  2716. }
  2717. }
  2718. return minl;
  2719. }
  2720. function normalizeLocale(key) {
  2721. return key ? key.toLowerCase().replace('_', '-') : key;
  2722. }
  2723. // pick the locale from the array
  2724. // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
  2725. // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
  2726. function chooseLocale(names) {
  2727. var i = 0,
  2728. j,
  2729. next,
  2730. locale,
  2731. split;
  2732. while (i < names.length) {
  2733. split = normalizeLocale(names[i]).split('-');
  2734. j = split.length;
  2735. next = normalizeLocale(names[i + 1]);
  2736. next = next ? next.split('-') : null;
  2737. while (j > 0) {
  2738. locale = loadLocale(split.slice(0, j).join('-'));
  2739. if (locale) {
  2740. return locale;
  2741. }
  2742. if (
  2743. next &&
  2744. next.length >= j &&
  2745. commonPrefix(split, next) >= j - 1
  2746. ) {
  2747. //the next array item is better than a shallower substring of this one
  2748. break;
  2749. }
  2750. j--;
  2751. }
  2752. i++;
  2753. }
  2754. return globalLocale;
  2755. }
  2756. function loadLocale(name) {
  2757. var oldLocale = null,
  2758. aliasedRequire;
  2759. // TODO: Find a better way to register and load all the locales in Node
  2760. if (
  2761. locales[name] === undefined &&
  2762. typeof module !== 'undefined' &&
  2763. module &&
  2764. module.exports
  2765. ) {
  2766. try {
  2767. oldLocale = globalLocale._abbr;
  2768. aliasedRequire = require;
  2769. aliasedRequire('./locale/' + name);
  2770. getSetGlobalLocale(oldLocale);
  2771. } catch (e) {
  2772. // mark as not found to avoid repeating expensive file require call causing high CPU
  2773. // when trying to find en-US, en_US, en-us for every format call
  2774. locales[name] = null; // null means not found
  2775. }
  2776. }
  2777. return locales[name];
  2778. }
  2779. // This function will load locale and then set the global locale. If
  2780. // no arguments are passed in, it will simply return the current global
  2781. // locale key.
  2782. function getSetGlobalLocale(key, values) {
  2783. var data;
  2784. if (key) {
  2785. if (isUndefined(values)) {
  2786. data = getLocale(key);
  2787. } else {
  2788. data = defineLocale(key, values);
  2789. }
  2790. if (data) {
  2791. // moment.duration._locale = moment._locale = data;
  2792. globalLocale = data;
  2793. } else {
  2794. if (typeof console !== 'undefined' && console.warn) {
  2795. //warn user if arguments are passed but the locale could not be set
  2796. console.warn(
  2797. 'Locale ' + key + ' not found. Did you forget to load it?'
  2798. );
  2799. }
  2800. }
  2801. }
  2802. return globalLocale._abbr;
  2803. }
  2804. function defineLocale(name, config) {
  2805. if (config !== null) {
  2806. var locale,
  2807. parentConfig = baseConfig;
  2808. config.abbr = name;
  2809. if (locales[name] != null) {
  2810. deprecateSimple(
  2811. 'defineLocaleOverride',
  2812. 'use moment.updateLocale(localeName, config) to change ' +
  2813. 'an existing locale. moment.defineLocale(localeName, ' +
  2814. 'config) should only be used for creating a new locale ' +
  2815. 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'
  2816. );
  2817. parentConfig = locales[name]._config;
  2818. } else if (config.parentLocale != null) {
  2819. if (locales[config.parentLocale] != null) {
  2820. parentConfig = locales[config.parentLocale]._config;
  2821. } else {
  2822. locale = loadLocale(config.parentLocale);
  2823. if (locale != null) {
  2824. parentConfig = locale._config;
  2825. } else {
  2826. if (!localeFamilies[config.parentLocale]) {
  2827. localeFamilies[config.parentLocale] = [];
  2828. }
  2829. localeFamilies[config.parentLocale].push({
  2830. name: name,
  2831. config: config,
  2832. });
  2833. return null;
  2834. }
  2835. }
  2836. }
  2837. locales[name] = new Locale(mergeConfigs(parentConfig, config));
  2838. if (localeFamilies[name]) {
  2839. localeFamilies[name].forEach(function (x) {
  2840. defineLocale(x.name, x.config);
  2841. });
  2842. }
  2843. // backwards compat for now: also set the locale
  2844. // make sure we set the locale AFTER all child locales have been
  2845. // created, so we won't end up with the child locale set.
  2846. getSetGlobalLocale(name);
  2847. return locales[name];
  2848. } else {
  2849. // useful for testing
  2850. delete locales[name];
  2851. return null;
  2852. }
  2853. }
  2854. function updateLocale(name, config) {
  2855. if (config != null) {
  2856. var locale,
  2857. tmpLocale,
  2858. parentConfig = baseConfig;
  2859. if (locales[name] != null && locales[name].parentLocale != null) {
  2860. // Update existing child locale in-place to avoid memory-leaks
  2861. locales[name].set(mergeConfigs(locales[name]._config, config));
  2862. } else {
  2863. // MERGE
  2864. tmpLocale = loadLocale(name);
  2865. if (tmpLocale != null) {
  2866. parentConfig = tmpLocale._config;
  2867. }
  2868. config = mergeConfigs(parentConfig, config);
  2869. if (tmpLocale == null) {
  2870. // updateLocale is called for creating a new locale
  2871. // Set abbr so it will have a name (getters return
  2872. // undefined otherwise).
  2873. config.abbr = name;
  2874. }
  2875. locale = new Locale(config);
  2876. locale.parentLocale = locales[name];
  2877. locales[name] = locale;
  2878. }
  2879. // backwards compat for now: also set the locale
  2880. getSetGlobalLocale(name);
  2881. } else {
  2882. // pass null for config to unupdate, useful for tests
  2883. if (locales[name] != null) {
  2884. if (locales[name].parentLocale != null) {
  2885. locales[name] = locales[name].parentLocale;
  2886. if (name === getSetGlobalLocale()) {
  2887. getSetGlobalLocale(name);
  2888. }
  2889. } else if (locales[name] != null) {
  2890. delete locales[name];
  2891. }
  2892. }
  2893. }
  2894. return locales[name];
  2895. }
  2896. // returns locale data
  2897. function getLocale(key) {
  2898. var locale;
  2899. if (key && key._locale && key._locale._abbr) {
  2900. key = key._locale._abbr;
  2901. }
  2902. if (!key) {
  2903. return globalLocale;
  2904. }
  2905. if (!isArray(key)) {
  2906. //short-circuit everything else
  2907. locale = loadLocale(key);
  2908. if (locale) {
  2909. return locale;
  2910. }
  2911. key = [key];
  2912. }
  2913. return chooseLocale(key);
  2914. }
  2915. function listLocales() {
  2916. return keys(locales);
  2917. }
  2918. function checkOverflow(m) {
  2919. var overflow,
  2920. a = m._a;
  2921. if (a && getParsingFlags(m).overflow === -2) {
  2922. overflow =
  2923. a[MONTH] < 0 || a[MONTH] > 11
  2924. ? MONTH
  2925. : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
  2926. ? DATE
  2927. : a[HOUR] < 0 ||
  2928. a[HOUR] > 24 ||
  2929. (a[HOUR] === 24 &&
  2930. (a[MINUTE] !== 0 ||
  2931. a[SECOND] !== 0 ||
  2932. a[MILLISECOND] !== 0))
  2933. ? HOUR
  2934. : a[MINUTE] < 0 || a[MINUTE] > 59
  2935. ? MINUTE
  2936. : a[SECOND] < 0 || a[SECOND] > 59
  2937. ? SECOND
  2938. : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
  2939. ? MILLISECOND
  2940. : -1;
  2941. if (
  2942. getParsingFlags(m)._overflowDayOfYear &&
  2943. (overflow < YEAR || overflow > DATE)
  2944. ) {
  2945. overflow = DATE;
  2946. }
  2947. if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
  2948. overflow = WEEK;
  2949. }
  2950. if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
  2951. overflow = WEEKDAY;
  2952. }
  2953. getParsingFlags(m).overflow = overflow;
  2954. }
  2955. return m;
  2956. }
  2957. // iso 8601 regex
  2958. // 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)
  2959. 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)?)?$/,
  2960. 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)?)?$/,
  2961. tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
  2962. isoDates = [
  2963. ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
  2964. ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
  2965. ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
  2966. ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
  2967. ['YYYY-DDD', /\d{4}-\d{3}/],
  2968. ['YYYY-MM', /\d{4}-\d\d/, false],
  2969. ['YYYYYYMMDD', /[+-]\d{10}/],
  2970. ['YYYYMMDD', /\d{8}/],
  2971. ['GGGG[W]WWE', /\d{4}W\d{3}/],
  2972. ['GGGG[W]WW', /\d{4}W\d{2}/, false],
  2973. ['YYYYDDD', /\d{7}/],
  2974. ['YYYYMM', /\d{6}/, false],
  2975. ['YYYY', /\d{4}/, false],
  2976. ],
  2977. // iso time formats and regexes
  2978. isoTimes = [
  2979. ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
  2980. ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
  2981. ['HH:mm:ss', /\d\d:\d\d:\d\d/],
  2982. ['HH:mm', /\d\d:\d\d/],
  2983. ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
  2984. ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
  2985. ['HHmmss', /\d\d\d\d\d\d/],
  2986. ['HHmm', /\d\d\d\d/],
  2987. ['HH', /\d\d/],
  2988. ],
  2989. aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
  2990. // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
  2991. 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}))$/,
  2992. obsOffsets = {
  2993. UT: 0,
  2994. GMT: 0,
  2995. EDT: -4 * 60,
  2996. EST: -5 * 60,
  2997. CDT: -5 * 60,
  2998. CST: -6 * 60,
  2999. MDT: -6 * 60,
  3000. MST: -7 * 60,
  3001. PDT: -7 * 60,
  3002. PST: -8 * 60,
  3003. };
  3004. // date from iso format
  3005. function configFromISO(config) {
  3006. var i,
  3007. l,
  3008. string = config._i,
  3009. match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
  3010. allowTime,
  3011. dateFormat,
  3012. timeFormat,
  3013. tzFormat;
  3014. if (match) {
  3015. getParsingFlags(config).iso = true;
  3016. for (i = 0, l = isoDates.length; i < l; i++) {
  3017. if (isoDates[i][1].exec(match[1])) {
  3018. dateFormat = isoDates[i][0];
  3019. allowTime = isoDates[i][2] !== false;
  3020. break;
  3021. }
  3022. }
  3023. if (dateFormat == null) {
  3024. config._isValid = false;
  3025. return;
  3026. }
  3027. if (match[3]) {
  3028. for (i = 0, l = isoTimes.length; i < l; i++) {
  3029. if (isoTimes[i][1].exec(match[3])) {
  3030. // match[2] should be 'T' or space
  3031. timeFormat = (match[2] || ' ') + isoTimes[i][0];
  3032. break;
  3033. }
  3034. }
  3035. if (timeFormat == null) {
  3036. config._isValid = false;
  3037. return;
  3038. }
  3039. }
  3040. if (!allowTime && timeFormat != null) {
  3041. config._isValid = false;
  3042. return;
  3043. }
  3044. if (match[4]) {
  3045. if (tzRegex.exec(match[4])) {
  3046. tzFormat = 'Z';
  3047. } else {
  3048. config._isValid = false;
  3049. return;
  3050. }
  3051. }
  3052. config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
  3053. configFromStringAndFormat(config);
  3054. } else {
  3055. config._isValid = false;
  3056. }
  3057. }
  3058. function extractFromRFC2822Strings(
  3059. yearStr,
  3060. monthStr,
  3061. dayStr,
  3062. hourStr,
  3063. minuteStr,
  3064. secondStr
  3065. ) {
  3066. var result = [
  3067. untruncateYear(yearStr),
  3068. defaultLocaleMonthsShort.indexOf(monthStr),
  3069. parseInt(dayStr, 10),
  3070. parseInt(hourStr, 10),
  3071. parseInt(minuteStr, 10),
  3072. ];
  3073. if (secondStr) {
  3074. result.push(parseInt(secondStr, 10));
  3075. }
  3076. return result;
  3077. }
  3078. function untruncateYear(yearStr) {
  3079. var year = parseInt(yearStr, 10);
  3080. if (year <= 49) {
  3081. return 2000 + year;
  3082. } else if (year <= 999) {
  3083. return 1900 + year;
  3084. }
  3085. return year;
  3086. }
  3087. function preprocessRFC2822(s) {
  3088. // Remove comments and folding whitespace and replace multiple-spaces with a single space
  3089. return s
  3090. .replace(/\([^)]*\)|[\n\t]/g, ' ')
  3091. .replace(/(\s\s+)/g, ' ')
  3092. .replace(/^\s\s*/, '')
  3093. .replace(/\s\s*$/, '');
  3094. }
  3095. function checkWeekday(weekdayStr, parsedInput, config) {
  3096. if (weekdayStr) {
  3097. // TODO: Replace the vanilla JS Date object with an independent day-of-week check.
  3098. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
  3099. weekdayActual = new Date(
  3100. parsedInput[0],
  3101. parsedInput[1],
  3102. parsedInput[2]
  3103. ).getDay();
  3104. if (weekdayProvided !== weekdayActual) {
  3105. getParsingFlags(config).weekdayMismatch = true;
  3106. config._isValid = false;
  3107. return false;
  3108. }
  3109. }
  3110. return true;
  3111. }
  3112. function calculateOffset(obsOffset, militaryOffset, numOffset) {
  3113. if (obsOffset) {
  3114. return obsOffsets[obsOffset];
  3115. } else if (militaryOffset) {
  3116. // the only allowed military tz is Z
  3117. return 0;
  3118. } else {
  3119. var hm = parseInt(numOffset, 10),
  3120. m = hm % 100,
  3121. h = (hm - m) / 100;
  3122. return h * 60 + m;
  3123. }
  3124. }
  3125. // date and time from ref 2822 format
  3126. function configFromRFC2822(config) {
  3127. var match = rfc2822.exec(preprocessRFC2822(config._i)),
  3128. parsedArray;
  3129. if (match) {
  3130. parsedArray = extractFromRFC2822Strings(
  3131. match[4],
  3132. match[3],
  3133. match[2],
  3134. match[5],
  3135. match[6],
  3136. match[7]
  3137. );
  3138. if (!checkWeekday(match[1], parsedArray, config)) {
  3139. return;
  3140. }
  3141. config._a = parsedArray;
  3142. config._tzm = calculateOffset(match[8], match[9], match[10]);
  3143. config._d = createUTCDate.apply(null, config._a);
  3144. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  3145. getParsingFlags(config).rfc2822 = true;
  3146. } else {
  3147. config._isValid = false;
  3148. }
  3149. }
  3150. // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict
  3151. function configFromString(config) {
  3152. var matched = aspNetJsonRegex.exec(config._i);
  3153. if (matched !== null) {
  3154. config._d = new Date(+matched[1]);
  3155. return;
  3156. }
  3157. configFromISO(config);
  3158. if (config._isValid === false) {
  3159. delete config._isValid;
  3160. } else {
  3161. return;
  3162. }
  3163. configFromRFC2822(config);
  3164. if (config._isValid === false) {
  3165. delete config._isValid;
  3166. } else {
  3167. return;
  3168. }
  3169. if (config._strict) {
  3170. config._isValid = false;
  3171. } else {
  3172. // Final attempt, use Input Fallback
  3173. hooks.createFromInputFallback(config);
  3174. }
  3175. }
  3176. hooks.createFromInputFallback = deprecate(
  3177. 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
  3178. 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
  3179. 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',
  3180. function (config) {
  3181. config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
  3182. }
  3183. );
  3184. // Pick the first defined of two or three arguments.
  3185. function defaults(a, b, c) {
  3186. if (a != null) {
  3187. return a;
  3188. }
  3189. if (b != null) {
  3190. return b;
  3191. }
  3192. return c;
  3193. }
  3194. function currentDateArray(config) {
  3195. // hooks is actually the exported moment object
  3196. var nowValue = new Date(hooks.now());
  3197. if (config._useUTC) {
  3198. return [
  3199. nowValue.getUTCFullYear(),
  3200. nowValue.getUTCMonth(),
  3201. nowValue.getUTCDate(),
  3202. ];
  3203. }
  3204. return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
  3205. }
  3206. // convert an array to a date.
  3207. // the array should mirror the parameters below
  3208. // note: all values past the year are optional and will default to the lowest possible value.
  3209. // [year, month, day , hour, minute, second, millisecond]
  3210. function configFromArray(config) {
  3211. var i,
  3212. date,
  3213. input = [],
  3214. currentDate,
  3215. expectedWeekday,
  3216. yearToUse;
  3217. if (config._d) {
  3218. return;
  3219. }
  3220. currentDate = currentDateArray(config);
  3221. //compute day of the year from weeks and weekdays
  3222. if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
  3223. dayOfYearFromWeekInfo(config);
  3224. }
  3225. //if the day of the year is set, figure out what it is
  3226. if (config._dayOfYear != null) {
  3227. yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
  3228. if (
  3229. config._dayOfYear > daysInYear(yearToUse) ||
  3230. config._dayOfYear === 0
  3231. ) {
  3232. getParsingFlags(config)._overflowDayOfYear = true;
  3233. }
  3234. date = createUTCDate(yearToUse, 0, config._dayOfYear);
  3235. config._a[MONTH] = date.getUTCMonth();
  3236. config._a[DATE] = date.getUTCDate();
  3237. }
  3238. // Default to current date.
  3239. // * if no year, month, day of month are given, default to today
  3240. // * if day of month is given, default month and year
  3241. // * if month is given, default only year
  3242. // * if year is given, don't default anything
  3243. for (i = 0; i < 3 && config._a[i] == null; ++i) {
  3244. config._a[i] = input[i] = currentDate[i];
  3245. }
  3246. // Zero out whatever was not defaulted, including time
  3247. for (; i < 7; i++) {
  3248. config._a[i] = input[i] =
  3249. config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];
  3250. }
  3251. // Check for 24:00:00.000
  3252. if (
  3253. config._a[HOUR] === 24 &&
  3254. config._a[MINUTE] === 0 &&
  3255. config._a[SECOND] === 0 &&
  3256. config._a[MILLISECOND] === 0
  3257. ) {
  3258. config._nextDay = true;
  3259. config._a[HOUR] = 0;
  3260. }
  3261. config._d = (config._useUTC ? createUTCDate : createDate).apply(
  3262. null,
  3263. input
  3264. );
  3265. expectedWeekday = config._useUTC
  3266. ? config._d.getUTCDay()
  3267. : config._d.getDay();
  3268. // Apply timezone offset from input. The actual utcOffset can be changed
  3269. // with parseZone.
  3270. if (config._tzm != null) {
  3271. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  3272. }
  3273. if (config._nextDay) {
  3274. config._a[HOUR] = 24;
  3275. }
  3276. // check for mismatching day of week
  3277. if (
  3278. config._w &&
  3279. typeof config._w.d !== 'undefined' &&
  3280. config._w.d !== expectedWeekday
  3281. ) {
  3282. getParsingFlags(config).weekdayMismatch = true;
  3283. }
  3284. }
  3285. function dayOfYearFromWeekInfo(config) {
  3286. var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
  3287. w = config._w;
  3288. if (w.GG != null || w.W != null || w.E != null) {
  3289. dow = 1;
  3290. doy = 4;
  3291. // TODO: We need to take the current isoWeekYear, but that depends on
  3292. // how we interpret now (local, utc, fixed offset). So create
  3293. // a now version of current config (take local/utc/offset flags, and
  3294. // create now).
  3295. weekYear = defaults(
  3296. w.GG,
  3297. config._a[YEAR],
  3298. weekOfYear(createLocal(), 1, 4).year
  3299. );
  3300. week = defaults(w.W, 1);
  3301. weekday = defaults(w.E, 1);
  3302. if (weekday < 1 || weekday > 7) {
  3303. weekdayOverflow = true;
  3304. }
  3305. } else {
  3306. dow = config._locale._week.dow;
  3307. doy = config._locale._week.doy;
  3308. curWeek = weekOfYear(createLocal(), dow, doy);
  3309. weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
  3310. // Default to current week.
  3311. week = defaults(w.w, curWeek.week);
  3312. if (w.d != null) {
  3313. // weekday -- low day numbers are considered next week
  3314. weekday = w.d;
  3315. if (weekday < 0 || weekday > 6) {
  3316. weekdayOverflow = true;
  3317. }
  3318. } else if (w.e != null) {
  3319. // local weekday -- counting starts from beginning of week
  3320. weekday = w.e + dow;
  3321. if (w.e < 0 || w.e > 6) {
  3322. weekdayOverflow = true;
  3323. }
  3324. } else {
  3325. // default to beginning of week
  3326. weekday = dow;
  3327. }
  3328. }
  3329. if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
  3330. getParsingFlags(config)._overflowWeeks = true;
  3331. } else if (weekdayOverflow != null) {
  3332. getParsingFlags(config)._overflowWeekday = true;
  3333. } else {
  3334. temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
  3335. config._a[YEAR] = temp.year;
  3336. config._dayOfYear = temp.dayOfYear;
  3337. }
  3338. }
  3339. // constant that refers to the ISO standard
  3340. hooks.ISO_8601 = function () {};
  3341. // constant that refers to the RFC 2822 form
  3342. hooks.RFC_2822 = function () {};
  3343. // date from string and format string
  3344. function configFromStringAndFormat(config) {
  3345. // TODO: Move this to another part of the creation flow to prevent circular deps
  3346. if (config._f === hooks.ISO_8601) {
  3347. configFromISO(config);
  3348. return;
  3349. }
  3350. if (config._f === hooks.RFC_2822) {
  3351. configFromRFC2822(config);
  3352. return;
  3353. }
  3354. config._a = [];
  3355. getParsingFlags(config).empty = true;
  3356. // This array is used to make a Date, either with `new Date` or `Date.UTC`
  3357. var string = '' + config._i,
  3358. i,
  3359. parsedInput,
  3360. tokens,
  3361. token,
  3362. skipped,
  3363. stringLength = string.length,
  3364. totalParsedInputLength = 0,
  3365. era;
  3366. tokens =
  3367. expandFormat(config._f, config._locale).match(formattingTokens) || [];
  3368. for (i = 0; i < tokens.length; i++) {
  3369. token = tokens[i];
  3370. parsedInput = (string.match(getParseRegexForToken(token, config)) ||
  3371. [])[0];
  3372. if (parsedInput) {
  3373. skipped = string.substr(0, string.indexOf(parsedInput));
  3374. if (skipped.length > 0) {
  3375. getParsingFlags(config).unusedInput.push(skipped);
  3376. }
  3377. string = string.slice(
  3378. string.indexOf(parsedInput) + parsedInput.length
  3379. );
  3380. totalParsedInputLength += parsedInput.length;
  3381. }
  3382. // don't parse if it's not a known token
  3383. if (formatTokenFunctions[token]) {
  3384. if (parsedInput) {
  3385. getParsingFlags(config).empty = false;
  3386. } else {
  3387. getParsingFlags(config).unusedTokens.push(token);
  3388. }
  3389. addTimeToArrayFromToken(token, parsedInput, config);
  3390. } else if (config._strict && !parsedInput) {
  3391. getParsingFlags(config).unusedTokens.push(token);
  3392. }
  3393. }
  3394. // add remaining unparsed input length to the string
  3395. getParsingFlags(config).charsLeftOver =
  3396. stringLength - totalParsedInputLength;
  3397. if (string.length > 0) {
  3398. getParsingFlags(config).unusedInput.push(string);
  3399. }
  3400. // clear _12h flag if hour is <= 12
  3401. if (
  3402. config._a[HOUR] <= 12 &&
  3403. getParsingFlags(config).bigHour === true &&
  3404. config._a[HOUR] > 0
  3405. ) {
  3406. getParsingFlags(config).bigHour = undefined;
  3407. }
  3408. getParsingFlags(config).parsedDateParts = config._a.slice(0);
  3409. getParsingFlags(config).meridiem = config._meridiem;
  3410. // handle meridiem
  3411. config._a[HOUR] = meridiemFixWrap(
  3412. config._locale,
  3413. config._a[HOUR],
  3414. config._meridiem
  3415. );
  3416. // handle era
  3417. era = getParsingFlags(config).era;
  3418. if (era !== null) {
  3419. config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);
  3420. }
  3421. configFromArray(config);
  3422. checkOverflow(config);
  3423. }
  3424. function meridiemFixWrap(locale, hour, meridiem) {
  3425. var isPm;
  3426. if (meridiem == null) {
  3427. // nothing to do
  3428. return hour;
  3429. }
  3430. if (locale.meridiemHour != null) {
  3431. return locale.meridiemHour(hour, meridiem);
  3432. } else if (locale.isPM != null) {
  3433. // Fallback
  3434. isPm = locale.isPM(meridiem);
  3435. if (isPm && hour < 12) {
  3436. hour += 12;
  3437. }
  3438. if (!isPm && hour === 12) {
  3439. hour = 0;
  3440. }
  3441. return hour;
  3442. } else {
  3443. // this is not supposed to happen
  3444. return hour;
  3445. }
  3446. }
  3447. // date from string and array of format strings
  3448. function configFromStringAndArray(config) {
  3449. var tempConfig,
  3450. bestMoment,
  3451. scoreToBeat,
  3452. i,
  3453. currentScore,
  3454. validFormatFound,
  3455. bestFormatIsValid = false;
  3456. if (config._f.length === 0) {
  3457. getParsingFlags(config).invalidFormat = true;
  3458. config._d = new Date(NaN);
  3459. return;
  3460. }
  3461. for (i = 0; i < config._f.length; i++) {
  3462. currentScore = 0;
  3463. validFormatFound = false;
  3464. tempConfig = copyConfig({}, config);
  3465. if (config._useUTC != null) {
  3466. tempConfig._useUTC = config._useUTC;
  3467. }
  3468. tempConfig._f = config._f[i];
  3469. configFromStringAndFormat(tempConfig);
  3470. if (isValid(tempConfig)) {
  3471. validFormatFound = true;
  3472. }
  3473. // if there is any input that was not parsed add a penalty for that format
  3474. currentScore += getParsingFlags(tempConfig).charsLeftOver;
  3475. //or tokens
  3476. currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
  3477. getParsingFlags(tempConfig).score = currentScore;
  3478. if (!bestFormatIsValid) {
  3479. if (
  3480. scoreToBeat == null ||
  3481. currentScore < scoreToBeat ||
  3482. validFormatFound
  3483. ) {
  3484. scoreToBeat = currentScore;
  3485. bestMoment = tempConfig;
  3486. if (validFormatFound) {
  3487. bestFormatIsValid = true;
  3488. }
  3489. }
  3490. } else {
  3491. if (currentScore < scoreToBeat) {
  3492. scoreToBeat = currentScore;
  3493. bestMoment = tempConfig;
  3494. }
  3495. }
  3496. }
  3497. extend(config, bestMoment || tempConfig);
  3498. }
  3499. function configFromObject(config) {
  3500. if (config._d) {
  3501. return;
  3502. }
  3503. var i = normalizeObjectUnits(config._i),
  3504. dayOrDate = i.day === undefined ? i.date : i.day;
  3505. config._a = map(
  3506. [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],
  3507. function (obj) {
  3508. return obj && parseInt(obj, 10);
  3509. }
  3510. );
  3511. configFromArray(config);
  3512. }
  3513. function createFromConfig(config) {
  3514. var res = new Moment(checkOverflow(prepareConfig(config)));
  3515. if (res._nextDay) {
  3516. // Adding is smart enough around DST
  3517. res.add(1, 'd');
  3518. res._nextDay = undefined;
  3519. }
  3520. return res;
  3521. }
  3522. function prepareConfig(config) {
  3523. var input = config._i,
  3524. format = config._f;
  3525. config._locale = config._locale || getLocale(config._l);
  3526. if (input === null || (format === undefined && input === '')) {
  3527. return createInvalid({ nullInput: true });
  3528. }
  3529. if (typeof input === 'string') {
  3530. config._i = input = config._locale.preparse(input);
  3531. }
  3532. if (isMoment(input)) {
  3533. return new Moment(checkOverflow(input));
  3534. } else if (isDate(input)) {
  3535. config._d = input;
  3536. } else if (isArray(format)) {
  3537. configFromStringAndArray(config);
  3538. } else if (format) {
  3539. configFromStringAndFormat(config);
  3540. } else {
  3541. configFromInput(config);
  3542. }
  3543. if (!isValid(config)) {
  3544. config._d = null;
  3545. }
  3546. return config;
  3547. }
  3548. function configFromInput(config) {
  3549. var input = config._i;
  3550. if (isUndefined(input)) {
  3551. config._d = new Date(hooks.now());
  3552. } else if (isDate(input)) {
  3553. config._d = new Date(input.valueOf());
  3554. } else if (typeof input === 'string') {
  3555. configFromString(config);
  3556. } else if (isArray(input)) {
  3557. config._a = map(input.slice(0), function (obj) {
  3558. return parseInt(obj, 10);
  3559. });
  3560. configFromArray(config);
  3561. } else if (isObject(input)) {
  3562. configFromObject(config);
  3563. } else if (isNumber(input)) {
  3564. // from milliseconds
  3565. config._d = new Date(input);
  3566. } else {
  3567. hooks.createFromInputFallback(config);
  3568. }
  3569. }
  3570. function createLocalOrUTC(input, format, locale, strict, isUTC) {
  3571. var c = {};
  3572. if (format === true || format === false) {
  3573. strict = format;
  3574. format = undefined;
  3575. }
  3576. if (locale === true || locale === false) {
  3577. strict = locale;
  3578. locale = undefined;
  3579. }
  3580. if (
  3581. (isObject(input) && isObjectEmpty(input)) ||
  3582. (isArray(input) && input.length === 0)
  3583. ) {
  3584. input = undefined;
  3585. }
  3586. // object construction must be done this way.
  3587. // https://github.com/moment/moment/issues/1423
  3588. c._isAMomentObject = true;
  3589. c._useUTC = c._isUTC = isUTC;
  3590. c._l = locale;
  3591. c._i = input;
  3592. c._f = format;
  3593. c._strict = strict;
  3594. return createFromConfig(c);
  3595. }
  3596. function createLocal(input, format, locale, strict) {
  3597. return createLocalOrUTC(input, format, locale, strict, false);
  3598. }
  3599. var prototypeMin = deprecate(
  3600. 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
  3601. function () {
  3602. var other = createLocal.apply(null, arguments);
  3603. if (this.isValid() && other.isValid()) {
  3604. return other < this ? this : other;
  3605. } else {
  3606. return createInvalid();
  3607. }
  3608. }
  3609. ),
  3610. prototypeMax = deprecate(
  3611. 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
  3612. function () {
  3613. var other = createLocal.apply(null, arguments);
  3614. if (this.isValid() && other.isValid()) {
  3615. return other > this ? this : other;
  3616. } else {
  3617. return createInvalid();
  3618. }
  3619. }
  3620. );
  3621. // Pick a moment m from moments so that m[fn](other) is true for all
  3622. // other. This relies on the function fn to be transitive.
  3623. //
  3624. // moments should either be an array of moment objects or an array, whose
  3625. // first element is an array of moment objects.
  3626. function pickBy(fn, moments) {
  3627. var res, i;
  3628. if (moments.length === 1 && isArray(moments[0])) {
  3629. moments = moments[0];
  3630. }
  3631. if (!moments.length) {
  3632. return createLocal();
  3633. }
  3634. res = moments[0];
  3635. for (i = 1; i < moments.length; ++i) {
  3636. if (!moments[i].isValid() || moments[i][fn](res)) {
  3637. res = moments[i];
  3638. }
  3639. }
  3640. return res;
  3641. }
  3642. // TODO: Use [].sort instead?
  3643. function min() {
  3644. var args = [].slice.call(arguments, 0);
  3645. return pickBy('isBefore', args);
  3646. }
  3647. function max() {
  3648. var args = [].slice.call(arguments, 0);
  3649. return pickBy('isAfter', args);
  3650. }
  3651. var now = function () {
  3652. return Date.now ? Date.now() : +new Date();
  3653. };
  3654. var ordering = [
  3655. 'year',
  3656. 'quarter',
  3657. 'month',
  3658. 'week',
  3659. 'day',
  3660. 'hour',
  3661. 'minute',
  3662. 'second',
  3663. 'millisecond',
  3664. ];
  3665. function isDurationValid(m) {
  3666. var key,
  3667. unitHasDecimal = false,
  3668. i;
  3669. for (key in m) {
  3670. if (
  3671. hasOwnProp(m, key) &&
  3672. !(
  3673. indexOf.call(ordering, key) !== -1 &&
  3674. (m[key] == null || !isNaN(m[key]))
  3675. )
  3676. ) {
  3677. return false;
  3678. }
  3679. }
  3680. for (i = 0; i < ordering.length; ++i) {
  3681. if (m[ordering[i]]) {
  3682. if (unitHasDecimal) {
  3683. return false; // only allow non-integers for smallest unit
  3684. }
  3685. if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
  3686. unitHasDecimal = true;
  3687. }
  3688. }
  3689. }
  3690. return true;
  3691. }
  3692. function isValid$1() {
  3693. return this._isValid;
  3694. }
  3695. function createInvalid$1() {
  3696. return createDuration(NaN);
  3697. }
  3698. function Duration(duration) {
  3699. var normalizedInput = normalizeObjectUnits(duration),
  3700. years = normalizedInput.year || 0,
  3701. quarters = normalizedInput.quarter || 0,
  3702. months = normalizedInput.month || 0,
  3703. weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
  3704. days = normalizedInput.day || 0,
  3705. hours = normalizedInput.hour || 0,
  3706. minutes = normalizedInput.minute || 0,
  3707. seconds = normalizedInput.second || 0,
  3708. milliseconds = normalizedInput.millisecond || 0;
  3709. this._isValid = isDurationValid(normalizedInput);
  3710. // representation for dateAddRemove
  3711. this._milliseconds =
  3712. +milliseconds +
  3713. seconds * 1e3 + // 1000
  3714. minutes * 6e4 + // 1000 * 60
  3715. hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
  3716. // Because of dateAddRemove treats 24 hours as different from a
  3717. // day when working around DST, we need to store them separately
  3718. this._days = +days + weeks * 7;
  3719. // It is impossible to translate months into days without knowing
  3720. // which months you are are talking about, so we have to store
  3721. // it separately.
  3722. this._months = +months + quarters * 3 + years * 12;
  3723. this._data = {};
  3724. this._locale = getLocale();
  3725. this._bubble();
  3726. }
  3727. function isDuration(obj) {
  3728. return obj instanceof Duration;
  3729. }
  3730. function absRound(number) {
  3731. if (number < 0) {
  3732. return Math.round(-1 * number) * -1;
  3733. } else {
  3734. return Math.round(number);
  3735. }
  3736. }
  3737. // compare two arrays, return the number of differences
  3738. function compareArrays(array1, array2, dontConvert) {
  3739. var len = Math.min(array1.length, array2.length),
  3740. lengthDiff = Math.abs(array1.length - array2.length),
  3741. diffs = 0,
  3742. i;
  3743. for (i = 0; i < len; i++) {
  3744. if (
  3745. (dontConvert && array1[i] !== array2[i]) ||
  3746. (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))
  3747. ) {
  3748. diffs++;
  3749. }
  3750. }
  3751. return diffs + lengthDiff;
  3752. }
  3753. // FORMATTING
  3754. function offset(token, separator) {
  3755. addFormatToken(token, 0, 0, function () {
  3756. var offset = this.utcOffset(),
  3757. sign = '+';
  3758. if (offset < 0) {
  3759. offset = -offset;
  3760. sign = '-';
  3761. }
  3762. return (
  3763. sign +
  3764. zeroFill(~~(offset / 60), 2) +
  3765. separator +
  3766. zeroFill(~~offset % 60, 2)
  3767. );
  3768. });
  3769. }
  3770. offset('Z', ':');
  3771. offset('ZZ', '');
  3772. // PARSING
  3773. addRegexToken('Z', matchShortOffset);
  3774. addRegexToken('ZZ', matchShortOffset);
  3775. addParseToken(['Z', 'ZZ'], function (input, array, config) {
  3776. config._useUTC = true;
  3777. config._tzm = offsetFromString(matchShortOffset, input);
  3778. });
  3779. // HELPERS
  3780. // timezone chunker
  3781. // '+10:00' > ['10', '00']
  3782. // '-1530' > ['-15', '30']
  3783. var chunkOffset = /([\+\-]|\d\d)/gi;
  3784. function offsetFromString(matcher, string) {
  3785. var matches = (string || '').match(matcher),
  3786. chunk,
  3787. parts,
  3788. minutes;
  3789. if (matches === null) {
  3790. return null;
  3791. }
  3792. chunk = matches[matches.length - 1] || [];
  3793. parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
  3794. minutes = +(parts[1] * 60) + toInt(parts[2]);
  3795. return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
  3796. }
  3797. // Return a moment from input, that is local/utc/zone equivalent to model.
  3798. function cloneWithOffset(input, model) {
  3799. var res, diff;
  3800. if (model._isUTC) {
  3801. res = model.clone();
  3802. diff =
  3803. (isMoment(input) || isDate(input)
  3804. ? input.valueOf()
  3805. : createLocal(input).valueOf()) - res.valueOf();
  3806. // Use low-level api, because this fn is low-level api.
  3807. res._d.setTime(res._d.valueOf() + diff);
  3808. hooks.updateOffset(res, false);
  3809. return res;
  3810. } else {
  3811. return createLocal(input).local();
  3812. }
  3813. }
  3814. function getDateOffset(m) {
  3815. // On Firefox.24 Date#getTimezoneOffset returns a floating point.
  3816. // https://github.com/moment/moment/pull/1871
  3817. return -Math.round(m._d.getTimezoneOffset());
  3818. }
  3819. // HOOKS
  3820. // This function will be called whenever a moment is mutated.
  3821. // It is intended to keep the offset in sync with the timezone.
  3822. hooks.updateOffset = function () {};
  3823. // MOMENTS
  3824. // keepLocalTime = true means only change the timezone, without
  3825. // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
  3826. // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
  3827. // +0200, so we adjust the time as needed, to be valid.
  3828. //
  3829. // Keeping the time actually adds/subtracts (one hour)
  3830. // from the actual represented time. That is why we call updateOffset
  3831. // a second time. In case it wants us to change the offset again
  3832. // _changeInProgress == true case, then we have to adjust, because
  3833. // there is no such time in the given timezone.
  3834. function getSetOffset(input, keepLocalTime, keepMinutes) {
  3835. var offset = this._offset || 0,
  3836. localAdjust;
  3837. if (!this.isValid()) {
  3838. return input != null ? this : NaN;
  3839. }
  3840. if (input != null) {
  3841. if (typeof input === 'string') {
  3842. input = offsetFromString(matchShortOffset, input);
  3843. if (input === null) {
  3844. return this;
  3845. }
  3846. } else if (Math.abs(input) < 16 && !keepMinutes) {
  3847. input = input * 60;
  3848. }
  3849. if (!this._isUTC && keepLocalTime) {
  3850. localAdjust = getDateOffset(this);
  3851. }
  3852. this._offset = input;
  3853. this._isUTC = true;
  3854. if (localAdjust != null) {
  3855. this.add(localAdjust, 'm');
  3856. }
  3857. if (offset !== input) {
  3858. if (!keepLocalTime || this._changeInProgress) {
  3859. addSubtract(
  3860. this,
  3861. createDuration(input - offset, 'm'),
  3862. 1,
  3863. false
  3864. );
  3865. } else if (!this._changeInProgress) {
  3866. this._changeInProgress = true;
  3867. hooks.updateOffset(this, true);
  3868. this._changeInProgress = null;
  3869. }
  3870. }
  3871. return this;
  3872. } else {
  3873. return this._isUTC ? offset : getDateOffset(this);
  3874. }
  3875. }
  3876. function getSetZone(input, keepLocalTime) {
  3877. if (input != null) {
  3878. if (typeof input !== 'string') {
  3879. input = -input;
  3880. }
  3881. this.utcOffset(input, keepLocalTime);
  3882. return this;
  3883. } else {
  3884. return -this.utcOffset();
  3885. }
  3886. }
  3887. function setOffsetToUTC(keepLocalTime) {
  3888. return this.utcOffset(0, keepLocalTime);
  3889. }
  3890. function setOffsetToLocal(keepLocalTime) {
  3891. if (this._isUTC) {
  3892. this.utcOffset(0, keepLocalTime);
  3893. this._isUTC = false;
  3894. if (keepLocalTime) {
  3895. this.subtract(getDateOffset(this), 'm');
  3896. }
  3897. }
  3898. return this;
  3899. }
  3900. function setOffsetToParsedOffset() {
  3901. if (this._tzm != null) {
  3902. this.utcOffset(this._tzm, false, true);
  3903. } else if (typeof this._i === 'string') {
  3904. var tZone = offsetFromString(matchOffset, this._i);
  3905. if (tZone != null) {
  3906. this.utcOffset(tZone);
  3907. } else {
  3908. this.utcOffset(0, true);
  3909. }
  3910. }
  3911. return this;
  3912. }
  3913. function hasAlignedHourOffset(input) {
  3914. if (!this.isValid()) {
  3915. return false;
  3916. }
  3917. input = input ? createLocal(input).utcOffset() : 0;
  3918. return (this.utcOffset() - input) % 60 === 0;
  3919. }
  3920. function isDaylightSavingTime() {
  3921. return (
  3922. this.utcOffset() > this.clone().month(0).utcOffset() ||
  3923. this.utcOffset() > this.clone().month(5).utcOffset()
  3924. );
  3925. }
  3926. function isDaylightSavingTimeShifted() {
  3927. if (!isUndefined(this._isDSTShifted)) {
  3928. return this._isDSTShifted;
  3929. }
  3930. var c = {},
  3931. other;
  3932. copyConfig(c, this);
  3933. c = prepareConfig(c);
  3934. if (c._a) {
  3935. other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
  3936. this._isDSTShifted =
  3937. this.isValid() && compareArrays(c._a, other.toArray()) > 0;
  3938. } else {
  3939. this._isDSTShifted = false;
  3940. }
  3941. return this._isDSTShifted;
  3942. }
  3943. function isLocal() {
  3944. return this.isValid() ? !this._isUTC : false;
  3945. }
  3946. function isUtcOffset() {
  3947. return this.isValid() ? this._isUTC : false;
  3948. }
  3949. function isUtc() {
  3950. return this.isValid() ? this._isUTC && this._offset === 0 : false;
  3951. }
  3952. // ASP.NET json date format regex
  3953. var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,
  3954. // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
  3955. // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
  3956. // and further modified to allow for strings containing both week and day
  3957. isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
  3958. function createDuration(input, key) {
  3959. var duration = input,
  3960. // matching against regexp is expensive, do it on demand
  3961. match = null,
  3962. sign,
  3963. ret,
  3964. diffRes;
  3965. if (isDuration(input)) {
  3966. duration = {
  3967. ms: input._milliseconds,
  3968. d: input._days,
  3969. M: input._months,
  3970. };
  3971. } else if (isNumber(input) || !isNaN(+input)) {
  3972. duration = {};
  3973. if (key) {
  3974. duration[key] = +input;
  3975. } else {
  3976. duration.milliseconds = +input;
  3977. }
  3978. } else if ((match = aspNetRegex.exec(input))) {
  3979. sign = match[1] === '-' ? -1 : 1;
  3980. duration = {
  3981. y: 0,
  3982. d: toInt(match[DATE]) * sign,
  3983. h: toInt(match[HOUR]) * sign,
  3984. m: toInt(match[MINUTE]) * sign,
  3985. s: toInt(match[SECOND]) * sign,
  3986. ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match
  3987. };
  3988. } else if ((match = isoRegex.exec(input))) {
  3989. sign = match[1] === '-' ? -1 : 1;
  3990. duration = {
  3991. y: parseIso(match[2], sign),
  3992. M: parseIso(match[3], sign),
  3993. w: parseIso(match[4], sign),
  3994. d: parseIso(match[5], sign),
  3995. h: parseIso(match[6], sign),
  3996. m: parseIso(match[7], sign),
  3997. s: parseIso(match[8], sign),
  3998. };
  3999. } else if (duration == null) {
  4000. // checks for null or undefined
  4001. duration = {};
  4002. } else if (
  4003. typeof duration === 'object' &&
  4004. ('from' in duration || 'to' in duration)
  4005. ) {
  4006. diffRes = momentsDifference(
  4007. createLocal(duration.from),
  4008. createLocal(duration.to)
  4009. );
  4010. duration = {};
  4011. duration.ms = diffRes.milliseconds;
  4012. duration.M = diffRes.months;
  4013. }
  4014. ret = new Duration(duration);
  4015. if (isDuration(input) && hasOwnProp(input, '_locale')) {
  4016. ret._locale = input._locale;
  4017. }
  4018. if (isDuration(input) && hasOwnProp(input, '_isValid')) {
  4019. ret._isValid = input._isValid;
  4020. }
  4021. return ret;
  4022. }
  4023. createDuration.fn = Duration.prototype;
  4024. createDuration.invalid = createInvalid$1;
  4025. function parseIso(inp, sign) {
  4026. // We'd normally use ~~inp for this, but unfortunately it also
  4027. // converts floats to ints.
  4028. // inp may be undefined, so careful calling replace on it.
  4029. var res = inp && parseFloat(inp.replace(',', '.'));
  4030. // apply sign while we're at it
  4031. return (isNaN(res) ? 0 : res) * sign;
  4032. }
  4033. function positiveMomentsDifference(base, other) {
  4034. var res = {};
  4035. res.months =
  4036. other.month() - base.month() + (other.year() - base.year()) * 12;
  4037. if (base.clone().add(res.months, 'M').isAfter(other)) {
  4038. --res.months;
  4039. }
  4040. res.milliseconds = +other - +base.clone().add(res.months, 'M');
  4041. return res;
  4042. }
  4043. function momentsDifference(base, other) {
  4044. var res;
  4045. if (!(base.isValid() && other.isValid())) {
  4046. return { milliseconds: 0, months: 0 };
  4047. }
  4048. other = cloneWithOffset(other, base);
  4049. if (base.isBefore(other)) {
  4050. res = positiveMomentsDifference(base, other);
  4051. } else {
  4052. res = positiveMomentsDifference(other, base);
  4053. res.milliseconds = -res.milliseconds;
  4054. res.months = -res.months;
  4055. }
  4056. return res;
  4057. }
  4058. // TODO: remove 'name' arg after deprecation is removed
  4059. function createAdder(direction, name) {
  4060. return function (val, period) {
  4061. var dur, tmp;
  4062. //invert the arguments, but complain about it
  4063. if (period !== null && !isNaN(+period)) {
  4064. deprecateSimple(
  4065. name,
  4066. 'moment().' +
  4067. name +
  4068. '(period, number) is deprecated. Please use moment().' +
  4069. name +
  4070. '(number, period). ' +
  4071. 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'
  4072. );
  4073. tmp = val;
  4074. val = period;
  4075. period = tmp;
  4076. }
  4077. dur = createDuration(val, period);
  4078. addSubtract(this, dur, direction);
  4079. return this;
  4080. };
  4081. }
  4082. function addSubtract(mom, duration, isAdding, updateOffset) {
  4083. var milliseconds = duration._milliseconds,
  4084. days = absRound(duration._days),
  4085. months = absRound(duration._months);
  4086. if (!mom.isValid()) {
  4087. // No op
  4088. return;
  4089. }
  4090. updateOffset = updateOffset == null ? true : updateOffset;
  4091. if (months) {
  4092. setMonth(mom, get(mom, 'Month') + months * isAdding);
  4093. }
  4094. if (days) {
  4095. set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
  4096. }
  4097. if (milliseconds) {
  4098. mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
  4099. }
  4100. if (updateOffset) {
  4101. hooks.updateOffset(mom, days || months);
  4102. }
  4103. }
  4104. var add = createAdder(1, 'add'),
  4105. subtract = createAdder(-1, 'subtract');
  4106. function isString(input) {
  4107. return typeof input === 'string' || input instanceof String;
  4108. }
  4109. // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined
  4110. function isMomentInput(input) {
  4111. return (
  4112. isMoment(input) ||
  4113. isDate(input) ||
  4114. isString(input) ||
  4115. isNumber(input) ||
  4116. isNumberOrStringArray(input) ||
  4117. isMomentInputObject(input) ||
  4118. input === null ||
  4119. input === undefined
  4120. );
  4121. }
  4122. function isMomentInputObject(input) {
  4123. var objectTest = isObject(input) && !isObjectEmpty(input),
  4124. propertyTest = false,
  4125. properties = [
  4126. 'years',
  4127. 'year',
  4128. 'y',
  4129. 'months',
  4130. 'month',
  4131. 'M',
  4132. 'days',
  4133. 'day',
  4134. 'd',
  4135. 'dates',
  4136. 'date',
  4137. 'D',
  4138. 'hours',
  4139. 'hour',
  4140. 'h',
  4141. 'minutes',
  4142. 'minute',
  4143. 'm',
  4144. 'seconds',
  4145. 'second',
  4146. 's',
  4147. 'milliseconds',
  4148. 'millisecond',
  4149. 'ms',
  4150. ],
  4151. i,
  4152. property;
  4153. for (i = 0; i < properties.length; i += 1) {
  4154. property = properties[i];
  4155. propertyTest = propertyTest || hasOwnProp(input, property);
  4156. }
  4157. return objectTest && propertyTest;
  4158. }
  4159. function isNumberOrStringArray(input) {
  4160. var arrayTest = isArray(input),
  4161. dataTypeTest = false;
  4162. if (arrayTest) {
  4163. dataTypeTest =
  4164. input.filter(function (item) {
  4165. return !isNumber(item) && isString(input);
  4166. }).length === 0;
  4167. }
  4168. return arrayTest && dataTypeTest;
  4169. }
  4170. function isCalendarSpec(input) {
  4171. var objectTest = isObject(input) && !isObjectEmpty(input),
  4172. propertyTest = false,
  4173. properties = [
  4174. 'sameDay',
  4175. 'nextDay',
  4176. 'lastDay',
  4177. 'nextWeek',
  4178. 'lastWeek',
  4179. 'sameElse',
  4180. ],
  4181. i,
  4182. property;
  4183. for (i = 0; i < properties.length; i += 1) {
  4184. property = properties[i];
  4185. propertyTest = propertyTest || hasOwnProp(input, property);
  4186. }
  4187. return objectTest && propertyTest;
  4188. }
  4189. function getCalendarFormat(myMoment, now) {
  4190. var diff = myMoment.diff(now, 'days', true);
  4191. return diff < -6
  4192. ? 'sameElse'
  4193. : diff < -1
  4194. ? 'lastWeek'
  4195. : diff < 0
  4196. ? 'lastDay'
  4197. : diff < 1
  4198. ? 'sameDay'
  4199. : diff < 2
  4200. ? 'nextDay'
  4201. : diff < 7
  4202. ? 'nextWeek'
  4203. : 'sameElse';
  4204. }
  4205. function calendar$1(time, formats) {
  4206. // Support for single parameter, formats only overload to the calendar function
  4207. if (arguments.length === 1) {
  4208. if (!arguments[0]) {
  4209. time = undefined;
  4210. formats = undefined;
  4211. } else if (isMomentInput(arguments[0])) {
  4212. time = arguments[0];
  4213. formats = undefined;
  4214. } else if (isCalendarSpec(arguments[0])) {
  4215. formats = arguments[0];
  4216. time = undefined;
  4217. }
  4218. }
  4219. // We want to compare the start of today, vs this.
  4220. // Getting start-of-today depends on whether we're local/utc/offset or not.
  4221. var now = time || createLocal(),
  4222. sod = cloneWithOffset(now, this).startOf('day'),
  4223. format = hooks.calendarFormat(this, sod) || 'sameElse',
  4224. output =
  4225. formats &&
  4226. (isFunction(formats[format])
  4227. ? formats[format].call(this, now)
  4228. : formats[format]);
  4229. return this.format(
  4230. output || this.localeData().calendar(format, this, createLocal(now))
  4231. );
  4232. }
  4233. function clone() {
  4234. return new Moment(this);
  4235. }
  4236. function isAfter(input, units) {
  4237. var localInput = isMoment(input) ? input : createLocal(input);
  4238. if (!(this.isValid() && localInput.isValid())) {
  4239. return false;
  4240. }
  4241. units = normalizeUnits(units) || 'millisecond';
  4242. if (units === 'millisecond') {
  4243. return this.valueOf() > localInput.valueOf();
  4244. } else {
  4245. return localInput.valueOf() < this.clone().startOf(units).valueOf();
  4246. }
  4247. }
  4248. function isBefore(input, units) {
  4249. var localInput = isMoment(input) ? input : createLocal(input);
  4250. if (!(this.isValid() && localInput.isValid())) {
  4251. return false;
  4252. }
  4253. units = normalizeUnits(units) || 'millisecond';
  4254. if (units === 'millisecond') {
  4255. return this.valueOf() < localInput.valueOf();
  4256. } else {
  4257. return this.clone().endOf(units).valueOf() < localInput.valueOf();
  4258. }
  4259. }
  4260. function isBetween(from, to, units, inclusivity) {
  4261. var localFrom = isMoment(from) ? from : createLocal(from),
  4262. localTo = isMoment(to) ? to : createLocal(to);
  4263. if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
  4264. return false;
  4265. }
  4266. inclusivity = inclusivity || '()';
  4267. return (
  4268. (inclusivity[0] === '('
  4269. ? this.isAfter(localFrom, units)
  4270. : !this.isBefore(localFrom, units)) &&
  4271. (inclusivity[1] === ')'
  4272. ? this.isBefore(localTo, units)
  4273. : !this.isAfter(localTo, units))
  4274. );
  4275. }
  4276. function isSame(input, units) {
  4277. var localInput = isMoment(input) ? input : createLocal(input),
  4278. inputMs;
  4279. if (!(this.isValid() && localInput.isValid())) {
  4280. return false;
  4281. }
  4282. units = normalizeUnits(units) || 'millisecond';
  4283. if (units === 'millisecond') {
  4284. return this.valueOf() === localInput.valueOf();
  4285. } else {
  4286. inputMs = localInput.valueOf();
  4287. return (
  4288. this.clone().startOf(units).valueOf() <= inputMs &&
  4289. inputMs <= this.clone().endOf(units).valueOf()
  4290. );
  4291. }
  4292. }
  4293. function isSameOrAfter(input, units) {
  4294. return this.isSame(input, units) || this.isAfter(input, units);
  4295. }
  4296. function isSameOrBefore(input, units) {
  4297. return this.isSame(input, units) || this.isBefore(input, units);
  4298. }
  4299. function diff(input, units, asFloat) {
  4300. var that, zoneDelta, output;
  4301. if (!this.isValid()) {
  4302. return NaN;
  4303. }
  4304. that = cloneWithOffset(input, this);
  4305. if (!that.isValid()) {
  4306. return NaN;
  4307. }
  4308. zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  4309. units = normalizeUnits(units);
  4310. switch (units) {
  4311. case 'year':
  4312. output = monthDiff(this, that) / 12;
  4313. break;
  4314. case 'month':
  4315. output = monthDiff(this, that);
  4316. break;
  4317. case 'quarter':
  4318. output = monthDiff(this, that) / 3;
  4319. break;
  4320. case 'second':
  4321. output = (this - that) / 1e3;
  4322. break; // 1000
  4323. case 'minute':
  4324. output = (this - that) / 6e4;
  4325. break; // 1000 * 60
  4326. case 'hour':
  4327. output = (this - that) / 36e5;
  4328. break; // 1000 * 60 * 60
  4329. case 'day':
  4330. output = (this - that - zoneDelta) / 864e5;
  4331. break; // 1000 * 60 * 60 * 24, negate dst
  4332. case 'week':
  4333. output = (this - that - zoneDelta) / 6048e5;
  4334. break; // 1000 * 60 * 60 * 24 * 7, negate dst
  4335. default:
  4336. output = this - that;
  4337. }
  4338. return asFloat ? output : absFloor(output);
  4339. }
  4340. function monthDiff(a, b) {
  4341. if (a.date() < b.date()) {
  4342. // end-of-month calculations work correct when the start month has more
  4343. // days than the end month.
  4344. return -monthDiff(b, a);
  4345. }
  4346. // difference in months
  4347. var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
  4348. // b is in (anchor - 1 month, anchor + 1 month)
  4349. anchor = a.clone().add(wholeMonthDiff, 'months'),
  4350. anchor2,
  4351. adjust;
  4352. if (b - anchor < 0) {
  4353. anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
  4354. // linear across the month
  4355. adjust = (b - anchor) / (anchor - anchor2);
  4356. } else {
  4357. anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
  4358. // linear across the month
  4359. adjust = (b - anchor) / (anchor2 - anchor);
  4360. }
  4361. //check for negative zero, return zero if negative zero
  4362. return -(wholeMonthDiff + adjust) || 0;
  4363. }
  4364. hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
  4365. hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
  4366. function toString() {
  4367. return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
  4368. }
  4369. function toISOString(keepOffset) {
  4370. if (!this.isValid()) {
  4371. return null;
  4372. }
  4373. var utc = keepOffset !== true,
  4374. m = utc ? this.clone().utc() : this;
  4375. if (m.year() < 0 || m.year() > 9999) {
  4376. return formatMoment(
  4377. m,
  4378. utc
  4379. ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'
  4380. : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'
  4381. );
  4382. }
  4383. if (isFunction(Date.prototype.toISOString)) {
  4384. // native implementation is ~50x faster, use it when we can
  4385. if (utc) {
  4386. return this.toDate().toISOString();
  4387. } else {
  4388. return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)
  4389. .toISOString()
  4390. .replace('Z', formatMoment(m, 'Z'));
  4391. }
  4392. }
  4393. return formatMoment(
  4394. m,
  4395. utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'
  4396. );
  4397. }
  4398. /**
  4399. * Return a human readable representation of a moment that can
  4400. * also be evaluated to get a new moment which is the same
  4401. *
  4402. * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
  4403. */
  4404. function inspect() {
  4405. if (!this.isValid()) {
  4406. return 'moment.invalid(/* ' + this._i + ' */)';
  4407. }
  4408. var func = 'moment',
  4409. zone = '',
  4410. prefix,
  4411. year,
  4412. datetime,
  4413. suffix;
  4414. if (!this.isLocal()) {
  4415. func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
  4416. zone = 'Z';
  4417. }
  4418. prefix = '[' + func + '("]';
  4419. year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';
  4420. datetime = '-MM-DD[T]HH:mm:ss.SSS';
  4421. suffix = zone + '[")]';
  4422. return this.format(prefix + year + datetime + suffix);
  4423. }
  4424. function format(inputString) {
  4425. if (!inputString) {
  4426. inputString = this.isUtc()
  4427. ? hooks.defaultFormatUtc
  4428. : hooks.defaultFormat;
  4429. }
  4430. var output = formatMoment(this, inputString);
  4431. return this.localeData().postformat(output);
  4432. }
  4433. function from(time, withoutSuffix) {
  4434. if (
  4435. this.isValid() &&
  4436. ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
  4437. ) {
  4438. return createDuration({ to: this, from: time })
  4439. .locale(this.locale())
  4440. .humanize(!withoutSuffix);
  4441. } else {
  4442. return this.localeData().invalidDate();
  4443. }
  4444. }
  4445. function fromNow(withoutSuffix) {
  4446. return this.from(createLocal(), withoutSuffix);
  4447. }
  4448. function to(time, withoutSuffix) {
  4449. if (
  4450. this.isValid() &&
  4451. ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
  4452. ) {
  4453. return createDuration({ from: this, to: time })
  4454. .locale(this.locale())
  4455. .humanize(!withoutSuffix);
  4456. } else {
  4457. return this.localeData().invalidDate();
  4458. }
  4459. }
  4460. function toNow(withoutSuffix) {
  4461. return this.to(createLocal(), withoutSuffix);
  4462. }
  4463. // If passed a locale key, it will set the locale for this
  4464. // instance. Otherwise, it will return the locale configuration
  4465. // variables for this instance.
  4466. function locale(key) {
  4467. var newLocaleData;
  4468. if (key === undefined) {
  4469. return this._locale._abbr;
  4470. } else {
  4471. newLocaleData = getLocale(key);
  4472. if (newLocaleData != null) {
  4473. this._locale = newLocaleData;
  4474. }
  4475. return this;
  4476. }
  4477. }
  4478. var lang = deprecate(
  4479. 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
  4480. function (key) {
  4481. if (key === undefined) {
  4482. return this.localeData();
  4483. } else {
  4484. return this.locale(key);
  4485. }
  4486. }
  4487. );
  4488. function localeData() {
  4489. return this._locale;
  4490. }
  4491. var MS_PER_SECOND = 1000,
  4492. MS_PER_MINUTE = 60 * MS_PER_SECOND,
  4493. MS_PER_HOUR = 60 * MS_PER_MINUTE,
  4494. MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
  4495. // actual modulo - handles negative numbers (for dates before 1970):
  4496. function mod$1(dividend, divisor) {
  4497. return ((dividend % divisor) + divisor) % divisor;
  4498. }
  4499. function localStartOfDate(y, m, d) {
  4500. // the date constructor remaps years 0-99 to 1900-1999
  4501. if (y < 100 && y >= 0) {
  4502. // preserve leap years using a full 400 year cycle, then reset
  4503. return new Date(y + 400, m, d) - MS_PER_400_YEARS;
  4504. } else {
  4505. return new Date(y, m, d).valueOf();
  4506. }
  4507. }
  4508. function utcStartOfDate(y, m, d) {
  4509. // Date.UTC remaps years 0-99 to 1900-1999
  4510. if (y < 100 && y >= 0) {
  4511. // preserve leap years using a full 400 year cycle, then reset
  4512. return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
  4513. } else {
  4514. return Date.UTC(y, m, d);
  4515. }
  4516. }
  4517. function startOf(units) {
  4518. var time, startOfDate;
  4519. units = normalizeUnits(units);
  4520. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  4521. return this;
  4522. }
  4523. startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  4524. switch (units) {
  4525. case 'year':
  4526. time = startOfDate(this.year(), 0, 1);
  4527. break;
  4528. case 'quarter':
  4529. time = startOfDate(
  4530. this.year(),
  4531. this.month() - (this.month() % 3),
  4532. 1
  4533. );
  4534. break;
  4535. case 'month':
  4536. time = startOfDate(this.year(), this.month(), 1);
  4537. break;
  4538. case 'week':
  4539. time = startOfDate(
  4540. this.year(),
  4541. this.month(),
  4542. this.date() - this.weekday()
  4543. );
  4544. break;
  4545. case 'isoWeek':
  4546. time = startOfDate(
  4547. this.year(),
  4548. this.month(),
  4549. this.date() - (this.isoWeekday() - 1)
  4550. );
  4551. break;
  4552. case 'day':
  4553. case 'date':
  4554. time = startOfDate(this.year(), this.month(), this.date());
  4555. break;
  4556. case 'hour':
  4557. time = this._d.valueOf();
  4558. time -= mod$1(
  4559. time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
  4560. MS_PER_HOUR
  4561. );
  4562. break;
  4563. case 'minute':
  4564. time = this._d.valueOf();
  4565. time -= mod$1(time, MS_PER_MINUTE);
  4566. break;
  4567. case 'second':
  4568. time = this._d.valueOf();
  4569. time -= mod$1(time, MS_PER_SECOND);
  4570. break;
  4571. }
  4572. this._d.setTime(time);
  4573. hooks.updateOffset(this, true);
  4574. return this;
  4575. }
  4576. function endOf(units) {
  4577. var time, startOfDate;
  4578. units = normalizeUnits(units);
  4579. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  4580. return this;
  4581. }
  4582. startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  4583. switch (units) {
  4584. case 'year':
  4585. time = startOfDate(this.year() + 1, 0, 1) - 1;
  4586. break;
  4587. case 'quarter':
  4588. time =
  4589. startOfDate(
  4590. this.year(),
  4591. this.month() - (this.month() % 3) + 3,
  4592. 1
  4593. ) - 1;
  4594. break;
  4595. case 'month':
  4596. time = startOfDate(this.year(), this.month() + 1, 1) - 1;
  4597. break;
  4598. case 'week':
  4599. time =
  4600. startOfDate(
  4601. this.year(),
  4602. this.month(),
  4603. this.date() - this.weekday() + 7
  4604. ) - 1;
  4605. break;
  4606. case 'isoWeek':
  4607. time =
  4608. startOfDate(
  4609. this.year(),
  4610. this.month(),
  4611. this.date() - (this.isoWeekday() - 1) + 7
  4612. ) - 1;
  4613. break;
  4614. case 'day':
  4615. case 'date':
  4616. time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
  4617. break;
  4618. case 'hour':
  4619. time = this._d.valueOf();
  4620. time +=
  4621. MS_PER_HOUR -
  4622. mod$1(
  4623. time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
  4624. MS_PER_HOUR
  4625. ) -
  4626. 1;
  4627. break;
  4628. case 'minute':
  4629. time = this._d.valueOf();
  4630. time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
  4631. break;
  4632. case 'second':
  4633. time = this._d.valueOf();
  4634. time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
  4635. break;
  4636. }
  4637. this._d.setTime(time);
  4638. hooks.updateOffset(this, true);
  4639. return this;
  4640. }
  4641. function valueOf() {
  4642. return this._d.valueOf() - (this._offset || 0) * 60000;
  4643. }
  4644. function unix() {
  4645. return Math.floor(this.valueOf() / 1000);
  4646. }
  4647. function toDate() {
  4648. return new Date(this.valueOf());
  4649. }
  4650. function toArray() {
  4651. var m = this;
  4652. return [
  4653. m.year(),
  4654. m.month(),
  4655. m.date(),
  4656. m.hour(),
  4657. m.minute(),
  4658. m.second(),
  4659. m.millisecond(),
  4660. ];
  4661. }
  4662. function toObject() {
  4663. var m = this;
  4664. return {
  4665. years: m.year(),
  4666. months: m.month(),
  4667. date: m.date(),
  4668. hours: m.hours(),
  4669. minutes: m.minutes(),
  4670. seconds: m.seconds(),
  4671. milliseconds: m.milliseconds(),
  4672. };
  4673. }
  4674. function toJSON() {
  4675. // new Date(NaN).toJSON() === null
  4676. return this.isValid() ? this.toISOString() : null;
  4677. }
  4678. function isValid$2() {
  4679. return isValid(this);
  4680. }
  4681. function parsingFlags() {
  4682. return extend({}, getParsingFlags(this));
  4683. }
  4684. function invalidAt() {
  4685. return getParsingFlags(this).overflow;
  4686. }
  4687. function creationData() {
  4688. return {
  4689. input: this._i,
  4690. format: this._f,
  4691. locale: this._locale,
  4692. isUTC: this._isUTC,
  4693. strict: this._strict,
  4694. };
  4695. }
  4696. addFormatToken('N', 0, 0, 'eraAbbr');
  4697. addFormatToken('NN', 0, 0, 'eraAbbr');
  4698. addFormatToken('NNN', 0, 0, 'eraAbbr');
  4699. addFormatToken('NNNN', 0, 0, 'eraName');
  4700. addFormatToken('NNNNN', 0, 0, 'eraNarrow');
  4701. addFormatToken('y', ['y', 1], 'yo', 'eraYear');
  4702. addFormatToken('y', ['yy', 2], 0, 'eraYear');
  4703. addFormatToken('y', ['yyy', 3], 0, 'eraYear');
  4704. addFormatToken('y', ['yyyy', 4], 0, 'eraYear');
  4705. addRegexToken('N', matchEraAbbr);
  4706. addRegexToken('NN', matchEraAbbr);
  4707. addRegexToken('NNN', matchEraAbbr);
  4708. addRegexToken('NNNN', matchEraName);
  4709. addRegexToken('NNNNN', matchEraNarrow);
  4710. addParseToken(['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function (
  4711. input,
  4712. array,
  4713. config,
  4714. token
  4715. ) {
  4716. var era = config._locale.erasParse(input, token, config._strict);
  4717. if (era) {
  4718. getParsingFlags(config).era = era;
  4719. } else {
  4720. getParsingFlags(config).invalidEra = input;
  4721. }
  4722. });
  4723. addRegexToken('y', matchUnsigned);
  4724. addRegexToken('yy', matchUnsigned);
  4725. addRegexToken('yyy', matchUnsigned);
  4726. addRegexToken('yyyy', matchUnsigned);
  4727. addRegexToken('yo', matchEraYearOrdinal);
  4728. addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);
  4729. addParseToken(['yo'], function (input, array, config, token) {
  4730. var match;
  4731. if (config._locale._eraYearOrdinalRegex) {
  4732. match = input.match(config._locale._eraYearOrdinalRegex);
  4733. }
  4734. if (config._locale.eraYearOrdinalParse) {
  4735. array[YEAR] = config._locale.eraYearOrdinalParse(input, match);
  4736. } else {
  4737. array[YEAR] = parseInt(input, 10);
  4738. }
  4739. });
  4740. function localeEras(m, format) {
  4741. var i,
  4742. l,
  4743. date,
  4744. eras = this._eras || getLocale('en')._eras;
  4745. for (i = 0, l = eras.length; i < l; ++i) {
  4746. switch (typeof eras[i].since) {
  4747. case 'string':
  4748. // truncate time
  4749. date = hooks(eras[i].since).startOf('day');
  4750. eras[i].since = date.valueOf();
  4751. break;
  4752. }
  4753. switch (typeof eras[i].until) {
  4754. case 'undefined':
  4755. eras[i].until = +Infinity;
  4756. break;
  4757. case 'string':
  4758. // truncate time
  4759. date = hooks(eras[i].until).startOf('day').valueOf();
  4760. eras[i].until = date.valueOf();
  4761. break;
  4762. }
  4763. }
  4764. return eras;
  4765. }
  4766. function localeErasParse(eraName, format, strict) {
  4767. var i,
  4768. l,
  4769. eras = this.eras(),
  4770. name,
  4771. abbr,
  4772. narrow;
  4773. eraName = eraName.toUpperCase();
  4774. for (i = 0, l = eras.length; i < l; ++i) {
  4775. name = eras[i].name.toUpperCase();
  4776. abbr = eras[i].abbr.toUpperCase();
  4777. narrow = eras[i].narrow.toUpperCase();
  4778. if (strict) {
  4779. switch (format) {
  4780. case 'N':
  4781. case 'NN':
  4782. case 'NNN':
  4783. if (abbr === eraName) {
  4784. return eras[i];
  4785. }
  4786. break;
  4787. case 'NNNN':
  4788. if (name === eraName) {
  4789. return eras[i];
  4790. }
  4791. break;
  4792. case 'NNNNN':
  4793. if (narrow === eraName) {
  4794. return eras[i];
  4795. }
  4796. break;
  4797. }
  4798. } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
  4799. return eras[i];
  4800. }
  4801. }
  4802. }
  4803. function localeErasConvertYear(era, year) {
  4804. var dir = era.since <= era.until ? +1 : -1;
  4805. if (year === undefined) {
  4806. return hooks(era.since).year();
  4807. } else {
  4808. return hooks(era.since).year() + (year - era.offset) * dir;
  4809. }
  4810. }
  4811. function getEraName() {
  4812. var i,
  4813. l,
  4814. val,
  4815. eras = this.localeData().eras();
  4816. for (i = 0, l = eras.length; i < l; ++i) {
  4817. // truncate time
  4818. val = this.clone().startOf('day').valueOf();
  4819. if (eras[i].since <= val && val <= eras[i].until) {
  4820. return eras[i].name;
  4821. }
  4822. if (eras[i].until <= val && val <= eras[i].since) {
  4823. return eras[i].name;
  4824. }
  4825. }
  4826. return '';
  4827. }
  4828. function getEraNarrow() {
  4829. var i,
  4830. l,
  4831. val,
  4832. eras = this.localeData().eras();
  4833. for (i = 0, l = eras.length; i < l; ++i) {
  4834. // truncate time
  4835. val = this.clone().startOf('day').valueOf();
  4836. if (eras[i].since <= val && val <= eras[i].until) {
  4837. return eras[i].narrow;
  4838. }
  4839. if (eras[i].until <= val && val <= eras[i].since) {
  4840. return eras[i].narrow;
  4841. }
  4842. }
  4843. return '';
  4844. }
  4845. function getEraAbbr() {
  4846. var i,
  4847. l,
  4848. val,
  4849. eras = this.localeData().eras();
  4850. for (i = 0, l = eras.length; i < l; ++i) {
  4851. // truncate time
  4852. val = this.clone().startOf('day').valueOf();
  4853. if (eras[i].since <= val && val <= eras[i].until) {
  4854. return eras[i].abbr;
  4855. }
  4856. if (eras[i].until <= val && val <= eras[i].since) {
  4857. return eras[i].abbr;
  4858. }
  4859. }
  4860. return '';
  4861. }
  4862. function getEraYear() {
  4863. var i,
  4864. l,
  4865. dir,
  4866. val,
  4867. eras = this.localeData().eras();
  4868. for (i = 0, l = eras.length; i < l; ++i) {
  4869. dir = eras[i].since <= eras[i].until ? +1 : -1;
  4870. // truncate time
  4871. val = this.clone().startOf('day').valueOf();
  4872. if (
  4873. (eras[i].since <= val && val <= eras[i].until) ||
  4874. (eras[i].until <= val && val <= eras[i].since)
  4875. ) {
  4876. return (
  4877. (this.year() - hooks(eras[i].since).year()) * dir +
  4878. eras[i].offset
  4879. );
  4880. }
  4881. }
  4882. return this.year();
  4883. }
  4884. function erasNameRegex(isStrict) {
  4885. if (!hasOwnProp(this, '_erasNameRegex')) {
  4886. computeErasParse.call(this);
  4887. }
  4888. return isStrict ? this._erasNameRegex : this._erasRegex;
  4889. }
  4890. function erasAbbrRegex(isStrict) {
  4891. if (!hasOwnProp(this, '_erasAbbrRegex')) {
  4892. computeErasParse.call(this);
  4893. }
  4894. return isStrict ? this._erasAbbrRegex : this._erasRegex;
  4895. }
  4896. function erasNarrowRegex(isStrict) {
  4897. if (!hasOwnProp(this, '_erasNarrowRegex')) {
  4898. computeErasParse.call(this);
  4899. }
  4900. return isStrict ? this._erasNarrowRegex : this._erasRegex;
  4901. }
  4902. function matchEraAbbr(isStrict, locale) {
  4903. return locale.erasAbbrRegex(isStrict);
  4904. }
  4905. function matchEraName(isStrict, locale) {
  4906. return locale.erasNameRegex(isStrict);
  4907. }
  4908. function matchEraNarrow(isStrict, locale) {
  4909. return locale.erasNarrowRegex(isStrict);
  4910. }
  4911. function matchEraYearOrdinal(isStrict, locale) {
  4912. return locale._eraYearOrdinalRegex || matchUnsigned;
  4913. }
  4914. function computeErasParse() {
  4915. var abbrPieces = [],
  4916. namePieces = [],
  4917. narrowPieces = [],
  4918. mixedPieces = [],
  4919. i,
  4920. l,
  4921. eras = this.eras();
  4922. for (i = 0, l = eras.length; i < l; ++i) {
  4923. namePieces.push(regexEscape(eras[i].name));
  4924. abbrPieces.push(regexEscape(eras[i].abbr));
  4925. narrowPieces.push(regexEscape(eras[i].narrow));
  4926. mixedPieces.push(regexEscape(eras[i].name));
  4927. mixedPieces.push(regexEscape(eras[i].abbr));
  4928. mixedPieces.push(regexEscape(eras[i].narrow));
  4929. }
  4930. this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  4931. this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');
  4932. this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');
  4933. this._erasNarrowRegex = new RegExp(
  4934. '^(' + narrowPieces.join('|') + ')',
  4935. 'i'
  4936. );
  4937. }
  4938. // FORMATTING
  4939. addFormatToken(0, ['gg', 2], 0, function () {
  4940. return this.weekYear() % 100;
  4941. });
  4942. addFormatToken(0, ['GG', 2], 0, function () {
  4943. return this.isoWeekYear() % 100;
  4944. });
  4945. function addWeekYearFormatToken(token, getter) {
  4946. addFormatToken(0, [token, token.length], 0, getter);
  4947. }
  4948. addWeekYearFormatToken('gggg', 'weekYear');
  4949. addWeekYearFormatToken('ggggg', 'weekYear');
  4950. addWeekYearFormatToken('GGGG', 'isoWeekYear');
  4951. addWeekYearFormatToken('GGGGG', 'isoWeekYear');
  4952. // ALIASES
  4953. addUnitAlias('weekYear', 'gg');
  4954. addUnitAlias('isoWeekYear', 'GG');
  4955. // PRIORITY
  4956. addUnitPriority('weekYear', 1);
  4957. addUnitPriority('isoWeekYear', 1);
  4958. // PARSING
  4959. addRegexToken('G', matchSigned);
  4960. addRegexToken('g', matchSigned);
  4961. addRegexToken('GG', match1to2, match2);
  4962. addRegexToken('gg', match1to2, match2);
  4963. addRegexToken('GGGG', match1to4, match4);
  4964. addRegexToken('gggg', match1to4, match4);
  4965. addRegexToken('GGGGG', match1to6, match6);
  4966. addRegexToken('ggggg', match1to6, match6);
  4967. addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (
  4968. input,
  4969. week,
  4970. config,
  4971. token
  4972. ) {
  4973. week[token.substr(0, 2)] = toInt(input);
  4974. });
  4975. addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
  4976. week[token] = hooks.parseTwoDigitYear(input);
  4977. });
  4978. // MOMENTS
  4979. function getSetWeekYear(input) {
  4980. return getSetWeekYearHelper.call(
  4981. this,
  4982. input,
  4983. this.week(),
  4984. this.weekday(),
  4985. this.localeData()._week.dow,
  4986. this.localeData()._week.doy
  4987. );
  4988. }
  4989. function getSetISOWeekYear(input) {
  4990. return getSetWeekYearHelper.call(
  4991. this,
  4992. input,
  4993. this.isoWeek(),
  4994. this.isoWeekday(),
  4995. 1,
  4996. 4
  4997. );
  4998. }
  4999. function getISOWeeksInYear() {
  5000. return weeksInYear(this.year(), 1, 4);
  5001. }
  5002. function getISOWeeksInISOWeekYear() {
  5003. return weeksInYear(this.isoWeekYear(), 1, 4);
  5004. }
  5005. function getWeeksInYear() {
  5006. var weekInfo = this.localeData()._week;
  5007. return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
  5008. }
  5009. function getWeeksInWeekYear() {
  5010. var weekInfo = this.localeData()._week;
  5011. return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
  5012. }
  5013. function getSetWeekYearHelper(input, week, weekday, dow, doy) {
  5014. var weeksTarget;
  5015. if (input == null) {
  5016. return weekOfYear(this, dow, doy).year;
  5017. } else {
  5018. weeksTarget = weeksInYear(input, dow, doy);
  5019. if (week > weeksTarget) {
  5020. week = weeksTarget;
  5021. }
  5022. return setWeekAll.call(this, input, week, weekday, dow, doy);
  5023. }
  5024. }
  5025. function setWeekAll(weekYear, week, weekday, dow, doy) {
  5026. var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
  5027. date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  5028. this.year(date.getUTCFullYear());
  5029. this.month(date.getUTCMonth());
  5030. this.date(date.getUTCDate());
  5031. return this;
  5032. }
  5033. // FORMATTING
  5034. addFormatToken('Q', 0, 'Qo', 'quarter');
  5035. // ALIASES
  5036. addUnitAlias('quarter', 'Q');
  5037. // PRIORITY
  5038. addUnitPriority('quarter', 7);
  5039. // PARSING
  5040. addRegexToken('Q', match1);
  5041. addParseToken('Q', function (input, array) {
  5042. array[MONTH] = (toInt(input) - 1) * 3;
  5043. });
  5044. // MOMENTS
  5045. function getSetQuarter(input) {
  5046. return input == null
  5047. ? Math.ceil((this.month() + 1) / 3)
  5048. : this.month((input - 1) * 3 + (this.month() % 3));
  5049. }
  5050. // FORMATTING
  5051. addFormatToken('D', ['DD', 2], 'Do', 'date');
  5052. // ALIASES
  5053. addUnitAlias('date', 'D');
  5054. // PRIORITY
  5055. addUnitPriority('date', 9);
  5056. // PARSING
  5057. addRegexToken('D', match1to2);
  5058. addRegexToken('DD', match1to2, match2);
  5059. addRegexToken('Do', function (isStrict, locale) {
  5060. // TODO: Remove "ordinalParse" fallback in next major release.
  5061. return isStrict
  5062. ? locale._dayOfMonthOrdinalParse || locale._ordinalParse
  5063. : locale._dayOfMonthOrdinalParseLenient;
  5064. });
  5065. addParseToken(['D', 'DD'], DATE);
  5066. addParseToken('Do', function (input, array) {
  5067. array[DATE] = toInt(input.match(match1to2)[0]);
  5068. });
  5069. // MOMENTS
  5070. var getSetDayOfMonth = makeGetSet('Date', true);
  5071. // FORMATTING
  5072. addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
  5073. // ALIASES
  5074. addUnitAlias('dayOfYear', 'DDD');
  5075. // PRIORITY
  5076. addUnitPriority('dayOfYear', 4);
  5077. // PARSING
  5078. addRegexToken('DDD', match1to3);
  5079. addRegexToken('DDDD', match3);
  5080. addParseToken(['DDD', 'DDDD'], function (input, array, config) {
  5081. config._dayOfYear = toInt(input);
  5082. });
  5083. // HELPERS
  5084. // MOMENTS
  5085. function getSetDayOfYear(input) {
  5086. var dayOfYear =
  5087. Math.round(
  5088. (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5
  5089. ) + 1;
  5090. return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
  5091. }
  5092. // FORMATTING
  5093. addFormatToken('m', ['mm', 2], 0, 'minute');
  5094. // ALIASES
  5095. addUnitAlias('minute', 'm');
  5096. // PRIORITY
  5097. addUnitPriority('minute', 14);
  5098. // PARSING
  5099. addRegexToken('m', match1to2);
  5100. addRegexToken('mm', match1to2, match2);
  5101. addParseToken(['m', 'mm'], MINUTE);
  5102. // MOMENTS
  5103. var getSetMinute = makeGetSet('Minutes', false);
  5104. // FORMATTING
  5105. addFormatToken('s', ['ss', 2], 0, 'second');
  5106. // ALIASES
  5107. addUnitAlias('second', 's');
  5108. // PRIORITY
  5109. addUnitPriority('second', 15);
  5110. // PARSING
  5111. addRegexToken('s', match1to2);
  5112. addRegexToken('ss', match1to2, match2);
  5113. addParseToken(['s', 'ss'], SECOND);
  5114. // MOMENTS
  5115. var getSetSecond = makeGetSet('Seconds', false);
  5116. // FORMATTING
  5117. addFormatToken('S', 0, 0, function () {
  5118. return ~~(this.millisecond() / 100);
  5119. });
  5120. addFormatToken(0, ['SS', 2], 0, function () {
  5121. return ~~(this.millisecond() / 10);
  5122. });
  5123. addFormatToken(0, ['SSS', 3], 0, 'millisecond');
  5124. addFormatToken(0, ['SSSS', 4], 0, function () {
  5125. return this.millisecond() * 10;
  5126. });
  5127. addFormatToken(0, ['SSSSS', 5], 0, function () {
  5128. return this.millisecond() * 100;
  5129. });
  5130. addFormatToken(0, ['SSSSSS', 6], 0, function () {
  5131. return this.millisecond() * 1000;
  5132. });
  5133. addFormatToken(0, ['SSSSSSS', 7], 0, function () {
  5134. return this.millisecond() * 10000;
  5135. });
  5136. addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
  5137. return this.millisecond() * 100000;
  5138. });
  5139. addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
  5140. return this.millisecond() * 1000000;
  5141. });
  5142. // ALIASES
  5143. addUnitAlias('millisecond', 'ms');
  5144. // PRIORITY
  5145. addUnitPriority('millisecond', 16);
  5146. // PARSING
  5147. addRegexToken('S', match1to3, match1);
  5148. addRegexToken('SS', match1to3, match2);
  5149. addRegexToken('SSS', match1to3, match3);
  5150. var token, getSetMillisecond;
  5151. for (token = 'SSSS'; token.length <= 9; token += 'S') {
  5152. addRegexToken(token, matchUnsigned);
  5153. }
  5154. function parseMs(input, array) {
  5155. array[MILLISECOND] = toInt(('0.' + input) * 1000);
  5156. }
  5157. for (token = 'S'; token.length <= 9; token += 'S') {
  5158. addParseToken(token, parseMs);
  5159. }
  5160. getSetMillisecond = makeGetSet('Milliseconds', false);
  5161. // FORMATTING
  5162. addFormatToken('z', 0, 0, 'zoneAbbr');
  5163. addFormatToken('zz', 0, 0, 'zoneName');
  5164. // MOMENTS
  5165. function getZoneAbbr() {
  5166. return this._isUTC ? 'UTC' : '';
  5167. }
  5168. function getZoneName() {
  5169. return this._isUTC ? 'Coordinated Universal Time' : '';
  5170. }
  5171. var proto = Moment.prototype;
  5172. proto.add = add;
  5173. proto.calendar = calendar$1;
  5174. proto.clone = clone;
  5175. proto.diff = diff;
  5176. proto.endOf = endOf;
  5177. proto.format = format;
  5178. proto.from = from;
  5179. proto.fromNow = fromNow;
  5180. proto.to = to;
  5181. proto.toNow = toNow;
  5182. proto.get = stringGet;
  5183. proto.invalidAt = invalidAt;
  5184. proto.isAfter = isAfter;
  5185. proto.isBefore = isBefore;
  5186. proto.isBetween = isBetween;
  5187. proto.isSame = isSame;
  5188. proto.isSameOrAfter = isSameOrAfter;
  5189. proto.isSameOrBefore = isSameOrBefore;
  5190. proto.isValid = isValid$2;
  5191. proto.lang = lang;
  5192. proto.locale = locale;
  5193. proto.localeData = localeData;
  5194. proto.max = prototypeMax;
  5195. proto.min = prototypeMin;
  5196. proto.parsingFlags = parsingFlags;
  5197. proto.set = stringSet;
  5198. proto.startOf = startOf;
  5199. proto.subtract = subtract;
  5200. proto.toArray = toArray;
  5201. proto.toObject = toObject;
  5202. proto.toDate = toDate;
  5203. proto.toISOString = toISOString;
  5204. proto.inspect = inspect;
  5205. if (typeof Symbol !== 'undefined' && Symbol.for != null) {
  5206. proto[Symbol.for('nodejs.util.inspect.custom')] = function () {
  5207. return 'Moment<' + this.format() + '>';
  5208. };
  5209. }
  5210. proto.toJSON = toJSON;
  5211. proto.toString = toString;
  5212. proto.unix = unix;
  5213. proto.valueOf = valueOf;
  5214. proto.creationData = creationData;
  5215. proto.eraName = getEraName;
  5216. proto.eraNarrow = getEraNarrow;
  5217. proto.eraAbbr = getEraAbbr;
  5218. proto.eraYear = getEraYear;
  5219. proto.year = getSetYear;
  5220. proto.isLeapYear = getIsLeapYear;
  5221. proto.weekYear = getSetWeekYear;
  5222. proto.isoWeekYear = getSetISOWeekYear;
  5223. proto.quarter = proto.quarters = getSetQuarter;
  5224. proto.month = getSetMonth;
  5225. proto.daysInMonth = getDaysInMonth;
  5226. proto.week = proto.weeks = getSetWeek;
  5227. proto.isoWeek = proto.isoWeeks = getSetISOWeek;
  5228. proto.weeksInYear = getWeeksInYear;
  5229. proto.weeksInWeekYear = getWeeksInWeekYear;
  5230. proto.isoWeeksInYear = getISOWeeksInYear;
  5231. proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
  5232. proto.date = getSetDayOfMonth;
  5233. proto.day = proto.days = getSetDayOfWeek;
  5234. proto.weekday = getSetLocaleDayOfWeek;
  5235. proto.isoWeekday = getSetISODayOfWeek;
  5236. proto.dayOfYear = getSetDayOfYear;
  5237. proto.hour = proto.hours = getSetHour;
  5238. proto.minute = proto.minutes = getSetMinute;
  5239. proto.second = proto.seconds = getSetSecond;
  5240. proto.millisecond = proto.milliseconds = getSetMillisecond;
  5241. proto.utcOffset = getSetOffset;
  5242. proto.utc = setOffsetToUTC;
  5243. proto.local = setOffsetToLocal;
  5244. proto.parseZone = setOffsetToParsedOffset;
  5245. proto.hasAlignedHourOffset = hasAlignedHourOffset;
  5246. proto.isDST = isDaylightSavingTime;
  5247. proto.isLocal = isLocal;
  5248. proto.isUtcOffset = isUtcOffset;
  5249. proto.isUtc = isUtc;
  5250. proto.isUTC = isUtc;
  5251. proto.zoneAbbr = getZoneAbbr;
  5252. proto.zoneName = getZoneName;
  5253. proto.dates = deprecate(
  5254. 'dates accessor is deprecated. Use date instead.',
  5255. getSetDayOfMonth
  5256. );
  5257. proto.months = deprecate(
  5258. 'months accessor is deprecated. Use month instead',
  5259. getSetMonth
  5260. );
  5261. proto.years = deprecate(
  5262. 'years accessor is deprecated. Use year instead',
  5263. getSetYear
  5264. );
  5265. proto.zone = deprecate(
  5266. 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',
  5267. getSetZone
  5268. );
  5269. proto.isDSTShifted = deprecate(
  5270. 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',
  5271. isDaylightSavingTimeShifted
  5272. );
  5273. function createUnix(input) {
  5274. return createLocal(input * 1000);
  5275. }
  5276. function createInZone() {
  5277. return createLocal.apply(null, arguments).parseZone();
  5278. }
  5279. function preParsePostFormat(string) {
  5280. return string;
  5281. }
  5282. var proto$1 = Locale.prototype;
  5283. proto$1.calendar = calendar;
  5284. proto$1.longDateFormat = longDateFormat;
  5285. proto$1.invalidDate = invalidDate;
  5286. proto$1.ordinal = ordinal;
  5287. proto$1.preparse = preParsePostFormat;
  5288. proto$1.postformat = preParsePostFormat;
  5289. proto$1.relativeTime = relativeTime;
  5290. proto$1.pastFuture = pastFuture;
  5291. proto$1.set = set;
  5292. proto$1.eras = localeEras;
  5293. proto$1.erasParse = localeErasParse;
  5294. proto$1.erasConvertYear = localeErasConvertYear;
  5295. proto$1.erasAbbrRegex = erasAbbrRegex;
  5296. proto$1.erasNameRegex = erasNameRegex;
  5297. proto$1.erasNarrowRegex = erasNarrowRegex;
  5298. proto$1.months = localeMonths;
  5299. proto$1.monthsShort = localeMonthsShort;
  5300. proto$1.monthsParse = localeMonthsParse;
  5301. proto$1.monthsRegex = monthsRegex;
  5302. proto$1.monthsShortRegex = monthsShortRegex;
  5303. proto$1.week = localeWeek;
  5304. proto$1.firstDayOfYear = localeFirstDayOfYear;
  5305. proto$1.firstDayOfWeek = localeFirstDayOfWeek;
  5306. proto$1.weekdays = localeWeekdays;
  5307. proto$1.weekdaysMin = localeWeekdaysMin;
  5308. proto$1.weekdaysShort = localeWeekdaysShort;
  5309. proto$1.weekdaysParse = localeWeekdaysParse;
  5310. proto$1.weekdaysRegex = weekdaysRegex;
  5311. proto$1.weekdaysShortRegex = weekdaysShortRegex;
  5312. proto$1.weekdaysMinRegex = weekdaysMinRegex;
  5313. proto$1.isPM = localeIsPM;
  5314. proto$1.meridiem = localeMeridiem;
  5315. function get$1(format, index, field, setter) {
  5316. var locale = getLocale(),
  5317. utc = createUTC().set(setter, index);
  5318. return locale[field](utc, format);
  5319. }
  5320. function listMonthsImpl(format, index, field) {
  5321. if (isNumber(format)) {
  5322. index = format;
  5323. format = undefined;
  5324. }
  5325. format = format || '';
  5326. if (index != null) {
  5327. return get$1(format, index, field, 'month');
  5328. }
  5329. var i,
  5330. out = [];
  5331. for (i = 0; i < 12; i++) {
  5332. out[i] = get$1(format, i, field, 'month');
  5333. }
  5334. return out;
  5335. }
  5336. // ()
  5337. // (5)
  5338. // (fmt, 5)
  5339. // (fmt)
  5340. // (true)
  5341. // (true, 5)
  5342. // (true, fmt, 5)
  5343. // (true, fmt)
  5344. function listWeekdaysImpl(localeSorted, format, index, field) {
  5345. if (typeof localeSorted === 'boolean') {
  5346. if (isNumber(format)) {
  5347. index = format;
  5348. format = undefined;
  5349. }
  5350. format = format || '';
  5351. } else {
  5352. format = localeSorted;
  5353. index = format;
  5354. localeSorted = false;
  5355. if (isNumber(format)) {
  5356. index = format;
  5357. format = undefined;
  5358. }
  5359. format = format || '';
  5360. }
  5361. var locale = getLocale(),
  5362. shift = localeSorted ? locale._week.dow : 0,
  5363. i,
  5364. out = [];
  5365. if (index != null) {
  5366. return get$1(format, (index + shift) % 7, field, 'day');
  5367. }
  5368. for (i = 0; i < 7; i++) {
  5369. out[i] = get$1(format, (i + shift) % 7, field, 'day');
  5370. }
  5371. return out;
  5372. }
  5373. function listMonths(format, index) {
  5374. return listMonthsImpl(format, index, 'months');
  5375. }
  5376. function listMonthsShort(format, index) {
  5377. return listMonthsImpl(format, index, 'monthsShort');
  5378. }
  5379. function listWeekdays(localeSorted, format, index) {
  5380. return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
  5381. }
  5382. function listWeekdaysShort(localeSorted, format, index) {
  5383. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
  5384. }
  5385. function listWeekdaysMin(localeSorted, format, index) {
  5386. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
  5387. }
  5388. getSetGlobalLocale('en', {
  5389. eras: [
  5390. {
  5391. since: '0001-01-01',
  5392. until: +Infinity,
  5393. offset: 1,
  5394. name: 'Anno Domini',
  5395. narrow: 'AD',
  5396. abbr: 'AD',
  5397. },
  5398. {
  5399. since: '0000-12-31',
  5400. until: -Infinity,
  5401. offset: 1,
  5402. name: 'Before Christ',
  5403. narrow: 'BC',
  5404. abbr: 'BC',
  5405. },
  5406. ],
  5407. dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  5408. ordinal: function (number) {
  5409. var b = number % 10,
  5410. output =
  5411. toInt((number % 100) / 10) === 1
  5412. ? 'th'
  5413. : b === 1
  5414. ? 'st'
  5415. : b === 2
  5416. ? 'nd'
  5417. : b === 3
  5418. ? 'rd'
  5419. : 'th';
  5420. return number + output;
  5421. },
  5422. });
  5423. // Side effect imports
  5424. hooks.lang = deprecate(
  5425. 'moment.lang is deprecated. Use moment.locale instead.',
  5426. getSetGlobalLocale
  5427. );
  5428. hooks.langData = deprecate(
  5429. 'moment.langData is deprecated. Use moment.localeData instead.',
  5430. getLocale
  5431. );
  5432. var mathAbs = Math.abs;
  5433. function abs() {
  5434. var data = this._data;
  5435. this._milliseconds = mathAbs(this._milliseconds);
  5436. this._days = mathAbs(this._days);
  5437. this._months = mathAbs(this._months);
  5438. data.milliseconds = mathAbs(data.milliseconds);
  5439. data.seconds = mathAbs(data.seconds);
  5440. data.minutes = mathAbs(data.minutes);
  5441. data.hours = mathAbs(data.hours);
  5442. data.months = mathAbs(data.months);
  5443. data.years = mathAbs(data.years);
  5444. return this;
  5445. }
  5446. function addSubtract$1(duration, input, value, direction) {
  5447. var other = createDuration(input, value);
  5448. duration._milliseconds += direction * other._milliseconds;
  5449. duration._days += direction * other._days;
  5450. duration._months += direction * other._months;
  5451. return duration._bubble();
  5452. }
  5453. // supports only 2.0-style add(1, 's') or add(duration)
  5454. function add$1(input, value) {
  5455. return addSubtract$1(this, input, value, 1);
  5456. }
  5457. // supports only 2.0-style subtract(1, 's') or subtract(duration)
  5458. function subtract$1(input, value) {
  5459. return addSubtract$1(this, input, value, -1);
  5460. }
  5461. function absCeil(number) {
  5462. if (number < 0) {
  5463. return Math.floor(number);
  5464. } else {
  5465. return Math.ceil(number);
  5466. }
  5467. }
  5468. function bubble() {
  5469. var milliseconds = this._milliseconds,
  5470. days = this._days,
  5471. months = this._months,
  5472. data = this._data,
  5473. seconds,
  5474. minutes,
  5475. hours,
  5476. years,
  5477. monthsFromDays;
  5478. // if we have a mix of positive and negative values, bubble down first
  5479. // check: https://github.com/moment/moment/issues/2166
  5480. if (
  5481. !(
  5482. (milliseconds >= 0 && days >= 0 && months >= 0) ||
  5483. (milliseconds <= 0 && days <= 0 && months <= 0)
  5484. )
  5485. ) {
  5486. milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
  5487. days = 0;
  5488. months = 0;
  5489. }
  5490. // The following code bubbles up values, see the tests for
  5491. // examples of what that means.
  5492. data.milliseconds = milliseconds % 1000;
  5493. seconds = absFloor(milliseconds / 1000);
  5494. data.seconds = seconds % 60;
  5495. minutes = absFloor(seconds / 60);
  5496. data.minutes = minutes % 60;
  5497. hours = absFloor(minutes / 60);
  5498. data.hours = hours % 24;
  5499. days += absFloor(hours / 24);
  5500. // convert days to months
  5501. monthsFromDays = absFloor(daysToMonths(days));
  5502. months += monthsFromDays;
  5503. days -= absCeil(monthsToDays(monthsFromDays));
  5504. // 12 months -> 1 year
  5505. years = absFloor(months / 12);
  5506. months %= 12;
  5507. data.days = days;
  5508. data.months = months;
  5509. data.years = years;
  5510. return this;
  5511. }
  5512. function daysToMonths(days) {
  5513. // 400 years have 146097 days (taking into account leap year rules)
  5514. // 400 years have 12 months === 4800
  5515. return (days * 4800) / 146097;
  5516. }
  5517. function monthsToDays(months) {
  5518. // the reverse of daysToMonths
  5519. return (months * 146097) / 4800;
  5520. }
  5521. function as(units) {
  5522. if (!this.isValid()) {
  5523. return NaN;
  5524. }
  5525. var days,
  5526. months,
  5527. milliseconds = this._milliseconds;
  5528. units = normalizeUnits(units);
  5529. if (units === 'month' || units === 'quarter' || units === 'year') {
  5530. days = this._days + milliseconds / 864e5;
  5531. months = this._months + daysToMonths(days);
  5532. switch (units) {
  5533. case 'month':
  5534. return months;
  5535. case 'quarter':
  5536. return months / 3;
  5537. case 'year':
  5538. return months / 12;
  5539. }
  5540. } else {
  5541. // handle milliseconds separately because of floating point math errors (issue #1867)
  5542. days = this._days + Math.round(monthsToDays(this._months));
  5543. switch (units) {
  5544. case 'week':
  5545. return days / 7 + milliseconds / 6048e5;
  5546. case 'day':
  5547. return days + milliseconds / 864e5;
  5548. case 'hour':
  5549. return days * 24 + milliseconds / 36e5;
  5550. case 'minute':
  5551. return days * 1440 + milliseconds / 6e4;
  5552. case 'second':
  5553. return days * 86400 + milliseconds / 1000;
  5554. // Math.floor prevents floating point math errors here
  5555. case 'millisecond':
  5556. return Math.floor(days * 864e5) + milliseconds;
  5557. default:
  5558. throw new Error('Unknown unit ' + units);
  5559. }
  5560. }
  5561. }
  5562. // TODO: Use this.as('ms')?
  5563. function valueOf$1() {
  5564. if (!this.isValid()) {
  5565. return NaN;
  5566. }
  5567. return (
  5568. this._milliseconds +
  5569. this._days * 864e5 +
  5570. (this._months % 12) * 2592e6 +
  5571. toInt(this._months / 12) * 31536e6
  5572. );
  5573. }
  5574. function makeAs(alias) {
  5575. return function () {
  5576. return this.as(alias);
  5577. };
  5578. }
  5579. var asMilliseconds = makeAs('ms'),
  5580. asSeconds = makeAs('s'),
  5581. asMinutes = makeAs('m'),
  5582. asHours = makeAs('h'),
  5583. asDays = makeAs('d'),
  5584. asWeeks = makeAs('w'),
  5585. asMonths = makeAs('M'),
  5586. asQuarters = makeAs('Q'),
  5587. asYears = makeAs('y');
  5588. function clone$1() {
  5589. return createDuration(this);
  5590. }
  5591. function get$2(units) {
  5592. units = normalizeUnits(units);
  5593. return this.isValid() ? this[units + 's']() : NaN;
  5594. }
  5595. function makeGetter(name) {
  5596. return function () {
  5597. return this.isValid() ? this._data[name] : NaN;
  5598. };
  5599. }
  5600. var milliseconds = makeGetter('milliseconds'),
  5601. seconds = makeGetter('seconds'),
  5602. minutes = makeGetter('minutes'),
  5603. hours = makeGetter('hours'),
  5604. days = makeGetter('days'),
  5605. months = makeGetter('months'),
  5606. years = makeGetter('years');
  5607. function weeks() {
  5608. return absFloor(this.days() / 7);
  5609. }
  5610. var round = Math.round,
  5611. thresholds = {
  5612. ss: 44, // a few seconds to seconds
  5613. s: 45, // seconds to minute
  5614. m: 45, // minutes to hour
  5615. h: 22, // hours to day
  5616. d: 26, // days to month/week
  5617. w: null, // weeks to month
  5618. M: 11, // months to year
  5619. };
  5620. // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
  5621. function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
  5622. return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
  5623. }
  5624. function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {
  5625. var duration = createDuration(posNegDuration).abs(),
  5626. seconds = round(duration.as('s')),
  5627. minutes = round(duration.as('m')),
  5628. hours = round(duration.as('h')),
  5629. days = round(duration.as('d')),
  5630. months = round(duration.as('M')),
  5631. weeks = round(duration.as('w')),
  5632. years = round(duration.as('y')),
  5633. a =
  5634. (seconds <= thresholds.ss && ['s', seconds]) ||
  5635. (seconds < thresholds.s && ['ss', seconds]) ||
  5636. (minutes <= 1 && ['m']) ||
  5637. (minutes < thresholds.m && ['mm', minutes]) ||
  5638. (hours <= 1 && ['h']) ||
  5639. (hours < thresholds.h && ['hh', hours]) ||
  5640. (days <= 1 && ['d']) ||
  5641. (days < thresholds.d && ['dd', days]);
  5642. if (thresholds.w != null) {
  5643. a =
  5644. a ||
  5645. (weeks <= 1 && ['w']) ||
  5646. (weeks < thresholds.w && ['ww', weeks]);
  5647. }
  5648. a = a ||
  5649. (months <= 1 && ['M']) ||
  5650. (months < thresholds.M && ['MM', months]) ||
  5651. (years <= 1 && ['y']) || ['yy', years];
  5652. a[2] = withoutSuffix;
  5653. a[3] = +posNegDuration > 0;
  5654. a[4] = locale;
  5655. return substituteTimeAgo.apply(null, a);
  5656. }
  5657. // This function allows you to set the rounding function for relative time strings
  5658. function getSetRelativeTimeRounding(roundingFunction) {
  5659. if (roundingFunction === undefined) {
  5660. return round;
  5661. }
  5662. if (typeof roundingFunction === 'function') {
  5663. round = roundingFunction;
  5664. return true;
  5665. }
  5666. return false;
  5667. }
  5668. // This function allows you to set a threshold for relative time strings
  5669. function getSetRelativeTimeThreshold(threshold, limit) {
  5670. if (thresholds[threshold] === undefined) {
  5671. return false;
  5672. }
  5673. if (limit === undefined) {
  5674. return thresholds[threshold];
  5675. }
  5676. thresholds[threshold] = limit;
  5677. if (threshold === 's') {
  5678. thresholds.ss = limit - 1;
  5679. }
  5680. return true;
  5681. }
  5682. function humanize(argWithSuffix, argThresholds) {
  5683. if (!this.isValid()) {
  5684. return this.localeData().invalidDate();
  5685. }
  5686. var withSuffix = false,
  5687. th = thresholds,
  5688. locale,
  5689. output;
  5690. if (typeof argWithSuffix === 'object') {
  5691. argThresholds = argWithSuffix;
  5692. argWithSuffix = false;
  5693. }
  5694. if (typeof argWithSuffix === 'boolean') {
  5695. withSuffix = argWithSuffix;
  5696. }
  5697. if (typeof argThresholds === 'object') {
  5698. th = Object.assign({}, thresholds, argThresholds);
  5699. if (argThresholds.s != null && argThresholds.ss == null) {
  5700. th.ss = argThresholds.s - 1;
  5701. }
  5702. }
  5703. locale = this.localeData();
  5704. output = relativeTime$1(this, !withSuffix, th, locale);
  5705. if (withSuffix) {
  5706. output = locale.pastFuture(+this, output);
  5707. }
  5708. return locale.postformat(output);
  5709. }
  5710. var abs$1 = Math.abs;
  5711. function sign(x) {
  5712. return (x > 0) - (x < 0) || +x;
  5713. }
  5714. function toISOString$1() {
  5715. // for ISO strings we do not use the normal bubbling rules:
  5716. // * milliseconds bubble up until they become hours
  5717. // * days do not bubble at all
  5718. // * months bubble up until they become years
  5719. // This is because there is no context-free conversion between hours and days
  5720. // (think of clock changes)
  5721. // and also not between days and months (28-31 days per month)
  5722. if (!this.isValid()) {
  5723. return this.localeData().invalidDate();
  5724. }
  5725. var seconds = abs$1(this._milliseconds) / 1000,
  5726. days = abs$1(this._days),
  5727. months = abs$1(this._months),
  5728. minutes,
  5729. hours,
  5730. years,
  5731. s,
  5732. total = this.asSeconds(),
  5733. totalSign,
  5734. ymSign,
  5735. daysSign,
  5736. hmsSign;
  5737. if (!total) {
  5738. // this is the same as C#'s (Noda) and python (isodate)...
  5739. // but not other JS (goog.date)
  5740. return 'P0D';
  5741. }
  5742. // 3600 seconds -> 60 minutes -> 1 hour
  5743. minutes = absFloor(seconds / 60);
  5744. hours = absFloor(minutes / 60);
  5745. seconds %= 60;
  5746. minutes %= 60;
  5747. // 12 months -> 1 year
  5748. years = absFloor(months / 12);
  5749. months %= 12;
  5750. // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
  5751. s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
  5752. totalSign = total < 0 ? '-' : '';
  5753. ymSign = sign(this._months) !== sign(total) ? '-' : '';
  5754. daysSign = sign(this._days) !== sign(total) ? '-' : '';
  5755. hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
  5756. return (
  5757. totalSign +
  5758. 'P' +
  5759. (years ? ymSign + years + 'Y' : '') +
  5760. (months ? ymSign + months + 'M' : '') +
  5761. (days ? daysSign + days + 'D' : '') +
  5762. (hours || minutes || seconds ? 'T' : '') +
  5763. (hours ? hmsSign + hours + 'H' : '') +
  5764. (minutes ? hmsSign + minutes + 'M' : '') +
  5765. (seconds ? hmsSign + s + 'S' : '')
  5766. );
  5767. }
  5768. var proto$2 = Duration.prototype;
  5769. proto$2.isValid = isValid$1;
  5770. proto$2.abs = abs;
  5771. proto$2.add = add$1;
  5772. proto$2.subtract = subtract$1;
  5773. proto$2.as = as;
  5774. proto$2.asMilliseconds = asMilliseconds;
  5775. proto$2.asSeconds = asSeconds;
  5776. proto$2.asMinutes = asMinutes;
  5777. proto$2.asHours = asHours;
  5778. proto$2.asDays = asDays;
  5779. proto$2.asWeeks = asWeeks;
  5780. proto$2.asMonths = asMonths;
  5781. proto$2.asQuarters = asQuarters;
  5782. proto$2.asYears = asYears;
  5783. proto$2.valueOf = valueOf$1;
  5784. proto$2._bubble = bubble;
  5785. proto$2.clone = clone$1;
  5786. proto$2.get = get$2;
  5787. proto$2.milliseconds = milliseconds;
  5788. proto$2.seconds = seconds;
  5789. proto$2.minutes = minutes;
  5790. proto$2.hours = hours;
  5791. proto$2.days = days;
  5792. proto$2.weeks = weeks;
  5793. proto$2.months = months;
  5794. proto$2.years = years;
  5795. proto$2.humanize = humanize;
  5796. proto$2.toISOString = toISOString$1;
  5797. proto$2.toString = toISOString$1;
  5798. proto$2.toJSON = toISOString$1;
  5799. proto$2.locale = locale;
  5800. proto$2.localeData = localeData;
  5801. proto$2.toIsoString = deprecate(
  5802. 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',
  5803. toISOString$1
  5804. );
  5805. proto$2.lang = lang;
  5806. // FORMATTING
  5807. addFormatToken('X', 0, 0, 'unix');
  5808. addFormatToken('x', 0, 0, 'valueOf');
  5809. // PARSING
  5810. addRegexToken('x', matchSigned);
  5811. addRegexToken('X', matchTimestamp);
  5812. addParseToken('X', function (input, array, config) {
  5813. config._d = new Date(parseFloat(input) * 1000);
  5814. });
  5815. addParseToken('x', function (input, array, config) {
  5816. config._d = new Date(toInt(input));
  5817. });
  5818. //! moment.js
  5819. hooks.version = '2.29.1';
  5820. setHookCallback(createLocal);
  5821. hooks.fn = proto;
  5822. hooks.min = min;
  5823. hooks.max = max;
  5824. hooks.now = now;
  5825. hooks.utc = createUTC;
  5826. hooks.unix = createUnix;
  5827. hooks.months = listMonths;
  5828. hooks.isDate = isDate;
  5829. hooks.locale = getSetGlobalLocale;
  5830. hooks.invalid = createInvalid;
  5831. hooks.duration = createDuration;
  5832. hooks.isMoment = isMoment;
  5833. hooks.weekdays = listWeekdays;
  5834. hooks.parseZone = createInZone;
  5835. hooks.localeData = getLocale;
  5836. hooks.isDuration = isDuration;
  5837. hooks.monthsShort = listMonthsShort;
  5838. hooks.weekdaysMin = listWeekdaysMin;
  5839. hooks.defineLocale = defineLocale;
  5840. hooks.updateLocale = updateLocale;
  5841. hooks.locales = listLocales;
  5842. hooks.weekdaysShort = listWeekdaysShort;
  5843. hooks.normalizeUnits = normalizeUnits;
  5844. hooks.relativeTimeRounding = getSetRelativeTimeRounding;
  5845. hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
  5846. hooks.calendarFormat = getCalendarFormat;
  5847. hooks.prototype = proto;
  5848. // currently HTML5 input type only supports 24-hour formats
  5849. hooks.HTML5_FMT = {
  5850. DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
  5851. DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
  5852. DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
  5853. DATE: 'YYYY-MM-DD', // <input type="date" />
  5854. TIME: 'HH:mm', // <input type="time" />
  5855. TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
  5856. TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
  5857. WEEK: 'GGGG-[W]WW', // <input type="week" />
  5858. MONTH: 'YYYY-MM', // <input type="month" />
  5859. };
  5860. return hooks;
  5861. })));
  5862. define('moment', ['moment/moment'], function (main) { return main; });
  5863. define('backend',['fast', 'template', 'moment'], function (Fast, Template, Moment) {
  5864. var Backend = {
  5865. api: {
  5866. sidebar: function (params) {
  5867. colorArr = ['red', 'green', 'yellow', 'blue', 'teal', 'orange', 'purple'];
  5868. $colorNums = colorArr.length;
  5869. badgeList = {};
  5870. $.each(params, function (k, v) {
  5871. $url = Fast.api.fixurl(k);
  5872. if ($.isArray(v)) {
  5873. $nums = typeof v[0] !== 'undefined' ? v[0] : 0;
  5874. $color = typeof v[1] !== 'undefined' ? v[1] : colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  5875. $class = typeof v[2] !== 'undefined' ? v[2] : 'label';
  5876. } else {
  5877. $nums = v;
  5878. $color = colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  5879. $class = 'label';
  5880. }
  5881. //必须nums大于0才显示
  5882. badgeList[$url] = $nums > 0 ? '<small class="' + $class + ' pull-right bg-' + $color + '">' + $nums + '</small>' : '';
  5883. });
  5884. $.each(badgeList, function (k, v) {
  5885. var anchor = top.window.$("li a[addtabs][url='" + k + "']");
  5886. if (anchor) {
  5887. top.window.$(".pull-right-container", anchor).html(v);
  5888. top.window.$(".nav-addtabs li a[node-id='" + anchor.attr("addtabs") + "'] .pull-right-container").html(v);
  5889. }
  5890. });
  5891. },
  5892. addtabs: function (url, title, icon) {
  5893. var dom = "a[url='{url}']"
  5894. var leftlink = top.window.$(dom.replace(/\{url\}/, url));
  5895. if (leftlink.size() > 0) {
  5896. leftlink.trigger("click");
  5897. } else {
  5898. url = Fast.api.fixurl(url);
  5899. leftlink = top.window.$(dom.replace(/\{url\}/, url));
  5900. if (leftlink.size() > 0) {
  5901. var event = leftlink.parent().hasClass("active") ? "dblclick" : "click";
  5902. leftlink.trigger(event);
  5903. } else {
  5904. var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
  5905. leftlink = top.window.$(dom.replace(/\{url\}/, baseurl));
  5906. //能找到相对地址
  5907. if (leftlink.size() > 0) {
  5908. icon = typeof icon !== 'undefined' ? icon : leftlink.find("i").attr("class");
  5909. title = typeof title !== 'undefined' ? title : leftlink.find("span:first").text();
  5910. leftlink.trigger("fa.event.toggleitem");
  5911. }
  5912. var navnode = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
  5913. if (navnode.size() > 0) {
  5914. navnode.trigger("click");
  5915. } else {
  5916. //追加新的tab
  5917. var id = Math.floor(new Date().valueOf() * Math.random());
  5918. icon = typeof icon !== 'undefined' ? icon : 'fa fa-circle-o';
  5919. title = typeof title !== 'undefined' ? title : '';
  5920. top.window.$("<a />").append('<i class="' + icon + '"></i> <span>' + title + '</span>').prop("href", url).attr({
  5921. url: url,
  5922. addtabs: id
  5923. }).addClass("hide").appendTo(top.window.document.body).trigger("click");
  5924. }
  5925. }
  5926. }
  5927. },
  5928. closetabs: function (url) {
  5929. if (typeof url === 'undefined') {
  5930. top.window.$("ul.nav-addtabs li.active .close-tab").trigger("click");
  5931. } else {
  5932. var dom = "a[url='{url}']"
  5933. var navlink = top.window.$(dom.replace(/\{url\}/, url));
  5934. if (navlink.size() === 0) {
  5935. url = Fast.api.fixurl(url);
  5936. navlink = top.window.$(dom.replace(/\{url\}/, url));
  5937. if (navlink.size() === 0) {
  5938. } else {
  5939. var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
  5940. navlink = top.window.$(dom.replace(/\{url\}/, baseurl));
  5941. //能找到相对地址
  5942. if (navlink.size() === 0) {
  5943. navlink = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
  5944. }
  5945. }
  5946. }
  5947. if (navlink.size() > 0 && navlink.attr('addtabs')) {
  5948. top.window.$("ul.nav-addtabs li#tab_" + navlink.attr('addtabs') + " .close-tab").trigger("click");
  5949. }
  5950. }
  5951. },
  5952. replaceids: function (elem, url) {
  5953. //如果有需要替换ids的
  5954. if (url.indexOf("{ids}") > -1) {
  5955. var ids = 0;
  5956. var tableId = $(elem).data("table-id");
  5957. if (tableId && $("#" + tableId).size() > 0 && $("#" + tableId).data("bootstrap.table")) {
  5958. var Table = require("table");
  5959. ids = Table.api.selectedids($("#" + tableId)).join(",");
  5960. }
  5961. url = url.replace(/\{ids\}/g, ids);
  5962. }
  5963. return url;
  5964. },
  5965. refreshmenu: function () {
  5966. top.window.$(".sidebar-menu").trigger("refresh");
  5967. },
  5968. gettablecolumnbutton: function (options) {
  5969. if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
  5970. var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
  5971. if (tableOptions) {
  5972. var columnObj = null;
  5973. $.each(tableOptions.columns, function (i, columns) {
  5974. $.each(columns, function (j, column) {
  5975. if (typeof column.fieldIndex !== 'undefined' && column.fieldIndex === options.fieldIndex) {
  5976. columnObj = column;
  5977. return false;
  5978. }
  5979. });
  5980. if (columnObj) {
  5981. return false;
  5982. }
  5983. });
  5984. if (columnObj) {
  5985. return columnObj['buttons'][options.buttonIndex];
  5986. }
  5987. }
  5988. }
  5989. return null;
  5990. },
  5991. },
  5992. init: function () {
  5993. //公共代码
  5994. //添加ios-fix兼容iOS下的iframe
  5995. if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
  5996. $("html").addClass("ios-fix");
  5997. }
  5998. //配置Toastr的参数
  5999. Toastr.options.positionClass = Config.controllername === 'index' ? "toast-top-right-index" : "toast-top-right";
  6000. //点击包含.btn-dialog的元素时弹出dialog
  6001. $(document).on('click', '.btn-dialog,.dialogit', function (e) {
  6002. var that = this;
  6003. var options = $.extend({}, $(that).data() || {});
  6004. var url = Backend.api.replaceids(that, $(that).data("url") || $(that).attr('href'));
  6005. var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
  6006. var button = Backend.api.gettablecolumnbutton(options);
  6007. if (button && typeof button.callback === 'function') {
  6008. options.callback = button.callback;
  6009. }
  6010. if (typeof options.confirm !== 'undefined') {
  6011. Layer.confirm(options.confirm, function (index) {
  6012. Backend.api.open(url, title, options);
  6013. Layer.close(index);
  6014. });
  6015. } else {
  6016. window[$(that).data("window") || 'self'].Backend.api.open(url, title, options);
  6017. }
  6018. return false;
  6019. });
  6020. //点击包含.btn-addtabs的元素时新增选项卡
  6021. $(document).on('click', '.btn-addtabs,.addtabsit', function (e) {
  6022. var that = this;
  6023. var options = $.extend({}, $(that).data() || {});
  6024. var url = Backend.api.replaceids(that, $(that).data("url") || $(that).attr('href'));
  6025. var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
  6026. var icon = $(that).attr("icon") || $(that).data("icon");
  6027. if (typeof options.confirm !== 'undefined') {
  6028. Layer.confirm(options.confirm, function (index) {
  6029. Backend.api.addtabs(url, title, icon);
  6030. Layer.close(index);
  6031. });
  6032. } else {
  6033. Backend.api.addtabs(url, title, icon);
  6034. }
  6035. return false;
  6036. });
  6037. //点击包含.btn-ajax的元素时发送Ajax请求
  6038. $(document).on('click', '.btn-ajax,.ajaxit', function (e) {
  6039. var that = this;
  6040. var options = $.extend({}, $(that).data() || {});
  6041. if (typeof options.url === 'undefined' && $(that).attr("href")) {
  6042. options.url = $(that).attr("href");
  6043. }
  6044. options.url = Backend.api.replaceids(this, options.url);
  6045. var success = typeof options.success === 'function' ? options.success : null;
  6046. var error = typeof options.error === 'function' ? options.error : null;
  6047. delete options.success;
  6048. delete options.error;
  6049. var button = Backend.api.gettablecolumnbutton(options);
  6050. if (button) {
  6051. if (typeof button.success === 'function') {
  6052. success = button.success;
  6053. }
  6054. if (typeof button.error === 'function') {
  6055. error = button.error;
  6056. }
  6057. }
  6058. //如果未设备成功的回调,设定了自动刷新的情况下自动进行刷新
  6059. if (!success && typeof options.tableId !== 'undefined' && typeof options.refresh !== 'undefined' && options.refresh) {
  6060. success = function () {
  6061. $("#" + options.tableId).bootstrapTable('refresh');
  6062. }
  6063. }
  6064. if (typeof options.confirm !== 'undefined') {
  6065. Layer.confirm(options.confirm, function (index) {
  6066. Backend.api.ajax(options, success, error);
  6067. Layer.close(index);
  6068. });
  6069. } else {
  6070. Backend.api.ajax(options, success, error);
  6071. }
  6072. return false;
  6073. });
  6074. $(document).on('click', '.btn-click,.clickit', function (e) {
  6075. var that = this;
  6076. var options = $.extend({}, $(that).data() || {});
  6077. var row = {};
  6078. if (typeof options.tableId !== 'undefined') {
  6079. var index = parseInt(options.rowIndex);
  6080. var data = $("#" + options.tableId).bootstrapTable('getData');
  6081. row = typeof data[index] !== 'undefined' ? data[index] : {};
  6082. }
  6083. var button = Backend.api.gettablecolumnbutton(options);
  6084. var click = typeof button.click === 'function' ? button.click : $.noop;
  6085. if (typeof options.confirm !== 'undefined') {
  6086. Layer.confirm(options.confirm, function (index) {
  6087. click.apply(that, [options, row, button]);
  6088. Layer.close(index);
  6089. });
  6090. } else {
  6091. click.apply(that, [options, row, button]);
  6092. }
  6093. return false;
  6094. });
  6095. //修复含有fixed-footer类的body边距
  6096. if ($(".fixed-footer").size() > 0) {
  6097. $(document.body).css("padding-bottom", $(".fixed-footer").outerHeight());
  6098. }
  6099. //修复不在iframe时layer-footer隐藏的问题
  6100. if ($(".layer-footer").size() > 0 && self === top) {
  6101. $(".layer-footer").show();
  6102. }
  6103. //tooltip和popover
  6104. if (!('ontouchstart' in document.documentElement)) {
  6105. $('body').tooltip({selector: '[data-toggle="tooltip"]'});
  6106. }
  6107. $('body').popover({selector: '[data-toggle="popover"]'});
  6108. }
  6109. };
  6110. Backend.api = $.extend(Fast.api, Backend.api);
  6111. //将Template渲染至全局,以便于在子框架中调用
  6112. window.Template = Template;
  6113. //将Moment渲染至全局,以便于在子框架中调用
  6114. window.Moment = Moment;
  6115. //将Backend渲染至全局,以便于在子框架中调用
  6116. window.Backend = Backend;
  6117. Backend.init();
  6118. return Backend;
  6119. });
  6120. define('backend-init',['backend'], function (Backend) {
  6121. });
  6122. //! moment.js locale configuration
  6123. //! locale : Chinese (China) [zh-cn]
  6124. //! author : suupic : https://github.com/suupic
  6125. //! author : Zeno Zeng : https://github.com/zenozeng
  6126. //! author : uu109 : https://github.com/uu109
  6127. ;(function (global, factory) {
  6128. typeof exports === 'object' && typeof module !== 'undefined'
  6129. && typeof require === 'function' ? factory(require('../moment')) :
  6130. typeof define === 'function' && define.amd ? define('moment/locale/zh-cn',['../moment'], factory) :
  6131. factory(global.moment)
  6132. }(this, (function (moment) { 'use strict';
  6133. //! moment.js locale configuration
  6134. var zhCn = moment.defineLocale('zh-cn', {
  6135. months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split(
  6136. '_'
  6137. ),
  6138. monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
  6139. '_'
  6140. ),
  6141. weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  6142. weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  6143. weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
  6144. longDateFormat: {
  6145. LT: 'HH:mm',
  6146. LTS: 'HH:mm:ss',
  6147. L: 'YYYY/MM/DD',
  6148. LL: 'YYYY年M月D日',
  6149. LLL: 'YYYY年M月D日Ah点mm分',
  6150. LLLL: 'YYYY年M月D日ddddAh点mm分',
  6151. l: 'YYYY/M/D',
  6152. ll: 'YYYY年M月D日',
  6153. lll: 'YYYY年M月D日 HH:mm',
  6154. llll: 'YYYY年M月D日dddd HH:mm',
  6155. },
  6156. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  6157. meridiemHour: function (hour, meridiem) {
  6158. if (hour === 12) {
  6159. hour = 0;
  6160. }
  6161. if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
  6162. return hour;
  6163. } else if (meridiem === '下午' || meridiem === '晚上') {
  6164. return hour + 12;
  6165. } else {
  6166. // '中午'
  6167. return hour >= 11 ? hour : hour + 12;
  6168. }
  6169. },
  6170. meridiem: function (hour, minute, isLower) {
  6171. var hm = hour * 100 + minute;
  6172. if (hm < 600) {
  6173. return '凌晨';
  6174. } else if (hm < 900) {
  6175. return '早上';
  6176. } else if (hm < 1130) {
  6177. return '上午';
  6178. } else if (hm < 1230) {
  6179. return '中午';
  6180. } else if (hm < 1800) {
  6181. return '下午';
  6182. } else {
  6183. return '晚上';
  6184. }
  6185. },
  6186. calendar: {
  6187. sameDay: '[今天]LT',
  6188. nextDay: '[明天]LT',
  6189. nextWeek: function (now) {
  6190. if (now.week() !== this.week()) {
  6191. return '[下]dddLT';
  6192. } else {
  6193. return '[本]dddLT';
  6194. }
  6195. },
  6196. lastDay: '[昨天]LT',
  6197. lastWeek: function (now) {
  6198. if (this.week() !== now.week()) {
  6199. return '[上]dddLT';
  6200. } else {
  6201. return '[本]dddLT';
  6202. }
  6203. },
  6204. sameElse: 'L',
  6205. },
  6206. dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
  6207. ordinal: function (number, period) {
  6208. switch (period) {
  6209. case 'd':
  6210. case 'D':
  6211. case 'DDD':
  6212. return number + '日';
  6213. case 'M':
  6214. return number + '月';
  6215. case 'w':
  6216. case 'W':
  6217. return number + '周';
  6218. default:
  6219. return number;
  6220. }
  6221. },
  6222. relativeTime: {
  6223. future: '%s后',
  6224. past: '%s前',
  6225. s: '几秒',
  6226. ss: '%d 秒',
  6227. m: '1 分钟',
  6228. mm: '%d 分钟',
  6229. h: '1 小时',
  6230. hh: '%d 小时',
  6231. d: '1 天',
  6232. dd: '%d 天',
  6233. w: '1 周',
  6234. ww: '%d 周',
  6235. M: '1 个月',
  6236. MM: '%d 个月',
  6237. y: '1 年',
  6238. yy: '%d 年',
  6239. },
  6240. week: {
  6241. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  6242. dow: 1, // Monday is the first day of the week.
  6243. doy: 4, // The week that contains Jan 4th is the first week of the year.
  6244. },
  6245. });
  6246. return zhCn;
  6247. })));
  6248. (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);
  6249. define("bootstrap-table", ["bootstrap"], (function (global) {
  6250. return function () {
  6251. var ret, fn;
  6252. return ret || global.$.fn.bootstrapTable;
  6253. };
  6254. }(this)));
  6255. /**
  6256. * Bootstrap Table Chinese translation
  6257. * Author: Zhixin Wen<wenzhixin2010@gmail.com>
  6258. */
  6259. (function ($) {
  6260. 'use strict';
  6261. $.fn.bootstrapTable.locales['zh-CN'] = {
  6262. formatLoadingMessage: function () {
  6263. return '正在努力地加载数据中,请稍候……';
  6264. },
  6265. formatRecordsPerPage: function (pageNumber) {
  6266. return '每页显示 ' + pageNumber + ' 条记录';
  6267. },
  6268. formatShowingRows: function (pageFrom, pageTo, totalRows) {
  6269. return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
  6270. },
  6271. formatSearch: function () {
  6272. return '搜索';
  6273. },
  6274. formatNoMatches: function () {
  6275. return '没有找到匹配的记录';
  6276. },
  6277. formatPaginationSwitch: function () {
  6278. return '隐藏/显示分页';
  6279. },
  6280. formatRefresh: function () {
  6281. return '刷新';
  6282. },
  6283. formatToggle: function () {
  6284. return '切换';
  6285. },
  6286. formatColumns: function () {
  6287. return '列';
  6288. },
  6289. formatExport: function () {
  6290. return '导出数据';
  6291. },
  6292. formatClearFilters: function () {
  6293. return '清空过滤';
  6294. }
  6295. };
  6296. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
  6297. })(jQuery);
  6298. define("bootstrap-table-lang", ["bootstrap-table"], (function (global) {
  6299. return function () {
  6300. var ret, fn;
  6301. return ret || global.$.fn.bootstrapTable.defaults;
  6302. };
  6303. }(this)));
  6304. /*
  6305. tableExport.jquery.plugin
  6306. Version 1.10.26
  6307. Copyright (c) 2015-2021 hhurz, https://github.com/hhurz/tableExport.jquery.plugin
  6308. Based on https://github.com/kayalshri/tableExport.jquery.plugin
  6309. Licensed under the MIT License
  6310. */
  6311. 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)};
  6312. $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})}};
  6313. $jscomp.polyfill("Array.prototype.find",function(d){return d?d:function(d,y){return $jscomp.findInternal(this,d,y).v}},"es6","es3");
  6314. (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})}
  6315. 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&&
  6316. "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&&
  6317. "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&&
  6318. (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&&
  6319. 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+=
  6320. 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,
  6321. 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,
  6322. 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&&
  6323. (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]);
  6324. (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")&&
  6325. (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)+
  6326. 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=
  6327. 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)}}
  6328. 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;
  6329. 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";
  6330. 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+=
  6331. 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&&""!==
  6332. 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,
  6333. "")});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:
  6334. "")+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))&&
  6335. (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=
  6336. 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=
  6337. 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,
  6338. 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/
  6339. 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,
  6340. "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();
  6341. 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,")?
  6342. 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"===
  6343. 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)+
  6344. "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",
  6345. 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",
  6346. 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",
  6347. 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,
  6348. 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,
  6349. 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&&
  6350. (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&&
  6351. "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+=
  6352. "\\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,
  6353. 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++});
  6354. 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"),
  6355. "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=
  6356. "";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,
  6357. 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=
  6358. 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;
  6359. 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=
  6360. 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'+
  6361. 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);
  6362. 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>'+
  6363. (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';
  6364. 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"===
  6365. 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,
  6366. 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&&
  6367. (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:"")+'")'});
  6368. 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:
  6369. 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+
  6370. 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:'+
  6371. 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,
  6372. 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+
  6373. 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)"!==
  6374. 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" '+
  6375. 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+=
  6376. "</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;}";
  6377. 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),
  6378. 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,
  6379. 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)});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,body:e},layout:{layout:"noBorders",hLineStyle:function(a,
  6380. 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:null}},pageBreak:U.content.length?"before":void 0})});
  6381. "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")?(U.defaultStyle.font=
  6382. "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,
  6383. 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=
  6384. 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=
  6385. 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&&
  6386. !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&&
  6387. (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*
  6388. 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))}});
  6389. "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&&
  6390. (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&&
  6391. !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=
  6392. 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,
  6393. 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),
  6394. 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();
  6395. return this}})(jQuery);
  6396. define("tableexport", ["jquery"], (function (global) {
  6397. return function () {
  6398. var ret, fn;
  6399. return ret || global.$.fn.extend;
  6400. };
  6401. }(this)));
  6402. !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);
  6403. define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (global) {
  6404. return function () {
  6405. var ret, fn;
  6406. return ret || global.$.fn.bootstrapTable.defaults;
  6407. };
  6408. }(this)));
  6409. (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});
  6410. define('upload',['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined, Dropzone, Template) {
  6411. var Upload = {
  6412. list: {},
  6413. options: {},
  6414. config: {
  6415. container: document.body,
  6416. classname: '.plupload:not([initialized]),.faupload:not([initialized])',
  6417. 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>',
  6418. },
  6419. events: {
  6420. //初始化
  6421. onInit: function () {
  6422. },
  6423. //上传成功的回调
  6424. onUploadSuccess: function (up, ret, file) {
  6425. var button = up.element;
  6426. var onUploadSuccess = up.options.onUploadSuccess;
  6427. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  6428. //上传成功后回调
  6429. if (button) {
  6430. //如果有文本框则填充
  6431. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  6432. if (input_id) {
  6433. var urlArr = [];
  6434. var inputObj = $("#" + input_id);
  6435. if ($(button).data("multiple") && inputObj.val() !== "") {
  6436. urlArr.push(inputObj.val());
  6437. }
  6438. var url = Config.upload.fullmode ? Fast.api.cdnurl(data.url) : data.url;
  6439. urlArr.push(url);
  6440. inputObj.val(urlArr.join(",")).trigger("change").trigger("validate");
  6441. }
  6442. //如果有回调函数
  6443. var onDomUploadSuccess = $(button).data("upload-success");
  6444. if (onDomUploadSuccess) {
  6445. if (typeof onDomUploadSuccess !== 'function' && typeof Upload.api.custom[onDomUploadSuccess] === 'function') {
  6446. onDomUploadSuccess = Upload.api.custom[onDomUploadSuccess];
  6447. }
  6448. if (typeof onDomUploadSuccess === 'function') {
  6449. var result = onDomUploadSuccess.call(button, data, ret);
  6450. if (result === false)
  6451. return;
  6452. }
  6453. }
  6454. }
  6455. if (typeof onUploadSuccess === 'function') {
  6456. var result = onUploadSuccess.call(button, data, ret);
  6457. if (result === false)
  6458. return;
  6459. }
  6460. },
  6461. //上传错误的回调
  6462. onUploadError: function (up, ret, file) {
  6463. var button = up.element;
  6464. var onUploadError = up.options.onUploadError;
  6465. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  6466. if (button) {
  6467. var onDomUploadError = $(button).data("upload-error");
  6468. if (onDomUploadError) {
  6469. if (typeof onDomUploadError !== 'function' && typeof Upload.api.custom[onDomUploadError] === 'function') {
  6470. onDomUploadError = Upload.api.custom[onDomUploadError];
  6471. }
  6472. if (typeof onDomUploadError === 'function') {
  6473. var result = onDomUploadError.call(button, data, ret);
  6474. if (result === false)
  6475. return;
  6476. }
  6477. }
  6478. }
  6479. if (typeof onUploadError === 'function') {
  6480. var result = onUploadError.call(button, data, ret);
  6481. if (result === false) {
  6482. return;
  6483. }
  6484. }
  6485. Toastr.error(ret.msg.toString().replace(/(<([^>]+)>)/gi, "") + "(code:" + ret.code + ")");
  6486. },
  6487. //服务器响应数据后
  6488. onUploadResponse: function (response, up, file) {
  6489. try {
  6490. var ret = typeof response === 'object' ? response : JSON.parse(response);
  6491. if (!ret.hasOwnProperty('code')) {
  6492. $.extend(ret, {code: -2, msg: response, data: null});
  6493. }
  6494. } catch (e) {
  6495. var ret = {code: -1, msg: e.message, data: null};
  6496. }
  6497. return ret;
  6498. },
  6499. //上传全部结束后
  6500. onUploadComplete: function (up, files) {
  6501. var button = up.element;
  6502. var onUploadComplete = up.options.onUploadComplete;
  6503. if (button) {
  6504. var onDomUploadComplete = $(button).data("upload-complete");
  6505. if (onDomUploadComplete) {
  6506. if (typeof onDomUploadComplete !== 'function' && typeof Upload.api.custom[onDomUploadComplete] === 'function') {
  6507. onDomUploadComplete = Upload.api.custom[onDomUploadComplete];
  6508. }
  6509. if (typeof onDomUploadComplete === 'function') {
  6510. var result = onDomUploadComplete.call(button, files);
  6511. if (result === false)
  6512. return;
  6513. }
  6514. }
  6515. }
  6516. if (typeof onUploadComplete === 'function') {
  6517. var result = onUploadComplete.call(button, files);
  6518. if (result === false) {
  6519. return;
  6520. }
  6521. }
  6522. }
  6523. },
  6524. api: {
  6525. //上传接口
  6526. upload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6527. element = typeof element === 'undefined' ? Upload.config.classname : element;
  6528. $(element, Upload.config.container).each(function () {
  6529. if ($(this).attr("initialized")) {
  6530. return true;
  6531. }
  6532. $(this).attr("initialized", true);
  6533. var that = this;
  6534. var id = $(this).prop("id") || $(this).prop("name") || Dropzone.uuidv4();
  6535. var url = $(this).data("url");
  6536. var maxsize = $(this).data("maxsize");
  6537. var maxcount = $(this).data("maxcount");
  6538. var mimetype = $(this).data("mimetype");
  6539. var multipart = $(this).data("multipart");
  6540. var multiple = $(this).data("multiple");
  6541. //填充ID
  6542. var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
  6543. //预览ID
  6544. var preview_id = $(that).data("preview-id") ? $(that).data("preview-id") : "";
  6545. //上传URL
  6546. url = url ? url : Config.upload.uploadurl;
  6547. url = Fast.api.fixurl(url);
  6548. var chunking = false, chunkSize = Config.upload.chunksize || 2097152, timeout = Config.upload.timeout || 600000;
  6549. //最大可上传文件大小
  6550. maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize;
  6551. //文件类型
  6552. mimetype = typeof mimetype !== "undefined" ? mimetype : Config.upload.mimetype;
  6553. //请求的表单参数
  6554. multipart = typeof multipart !== "undefined" ? multipart : Config.upload.multipart;
  6555. //是否支持批量上传
  6556. multiple = typeof multiple !== "undefined" ? multiple : Config.upload.multiple;
  6557. //后缀特殊处理
  6558. mimetype = mimetype.split(",").map(function (k) {
  6559. return k.indexOf("/") > -1 ? k : (!k || k === "*" || k.charAt(0) === "." ? k : "." + k);
  6560. }).join(",");
  6561. mimetype = mimetype === '*' ? null : mimetype;
  6562. //最大文件限制转换成mb
  6563. var maxFilesize = (function (maxsize) {
  6564. var matches = maxsize.toString().match(/^([0-9\.]+)(\w+)$/);
  6565. var size = matches ? parseFloat(matches[1]) : parseFloat(maxsize),
  6566. unit = matches ? matches[2].toLowerCase() : 'b';
  6567. var unitDict = {'b': 0, 'k': 1, 'kb': 1, 'm': 2, 'mb': 2, 'gb': 3, 'g': 3, 'tb': 4, 't': 4};
  6568. var y = typeof unitDict[unit] !== 'undefined' ? unitDict[unit] : 0;
  6569. var bytes = size * Math.pow(1024, y);
  6570. return bytes / Math.pow(1024, 2);
  6571. }(maxsize));
  6572. var options = $(this).data() || {};
  6573. options = $.extend(true, {}, options, $(this).data("upload-options") || {});
  6574. delete options.success;
  6575. delete options.url;
  6576. multipart = $.isArray(multipart) ? {} : multipart;
  6577. var params = $(this).data("params") || {};
  6578. var category = typeof params.category !== 'undefined' ? params.category : ($(this).data("category") || '');
  6579. if (category) {
  6580. // multipart.category = category;
  6581. }
  6582. Upload.list[id] = new Dropzone(this, $.extend({
  6583. url: url,
  6584. params: function (files, xhr, chunk) {
  6585. var params = multipart;
  6586. if (chunk) {
  6587. return $.extend({}, params, {
  6588. filesize: chunk.file.size,
  6589. filename: chunk.file.name,
  6590. chunkid: chunk.file.upload.uuid,
  6591. chunkindex: chunk.index,
  6592. chunkcount: chunk.file.upload.totalChunkCount,
  6593. chunksize: this.options.chunkSize,
  6594. chunkfilesize: chunk.dataBlock.data.size,
  6595. width: chunk.file.width || 0,
  6596. height: chunk.file.height || 0,
  6597. type: chunk.file.type,
  6598. });
  6599. }
  6600. return params;
  6601. },
  6602. chunking: chunking,
  6603. chunkSize: chunkSize,
  6604. maxFilesize: maxFilesize,
  6605. acceptedFiles: mimetype,
  6606. maxFiles: (maxcount && parseInt(maxcount) > 1 ? maxcount : (multiple ? null : 1)),
  6607. timeout: timeout,
  6608. parallelUploads: 1,
  6609. previewsContainer: false,
  6610. dictDefaultMessage: __("Drop files here to upload"),
  6611. dictFallbackMessage: __("Your browser does not support drag'n'drop file uploads"),
  6612. dictFallbackText: __("Please use the fallback form below to upload your files like in the olden days"),
  6613. dictFileTooBig: __("File is too big (%sMiB), Max filesize: %sMiB", "{{filesize}}", "{{maxFilesize}}"),
  6614. dictInvalidFileType: __("You can't upload files of this type"),
  6615. dictResponseError: __("Server responded with %s code.", "{{statusCode}}"),
  6616. dictCancelUpload: __("Cancel upload"),
  6617. dictUploadCanceled: __("Upload canceled"),
  6618. dictCancelUploadConfirmation: __("Are you sure you want to cancel this upload?"),
  6619. dictRemoveFile: __("Remove file"),
  6620. dictMaxFilesExceeded: __("You can only upload a maximum of %s files", "{{maxFiles}}"),
  6621. init: function () {
  6622. Upload.events.onInit.call(this);
  6623. //必须添加dz-message,否则点击icon无法唤起上传窗口
  6624. $(">i", this.element).addClass("dz-message");
  6625. this.options.elementHtml = $(this.element).html();
  6626. },
  6627. sending: function (file, xhr, formData) {
  6628. if (typeof file.category !== 'undefined') {
  6629. formData.append('category', file.category);
  6630. }
  6631. },
  6632. addedfile: function (file) {
  6633. var params = $(this.element).data("params") || {};
  6634. var category = typeof params.category !== 'undefined' ? params.category : ($(this.element).data("category") || '');
  6635. file.category = typeof category === 'function' ? category.call(this, file) : category;
  6636. },
  6637. addedfiles: function (files) {
  6638. if (this.options.maxFiles && (!this.options.maxFiles || this.options.maxFiles > 1) && this.options.inputId) {
  6639. var inputObj = $("#" + this.options.inputId);
  6640. if (inputObj.size() > 0) {
  6641. var value = $.trim(inputObj.val());
  6642. var nums = value === '' ? 0 : value.split(/\,/).length;
  6643. var remain = this.options.maxFiles - nums;
  6644. if (remain === 0 || files.length > remain) {
  6645. files = Array.prototype.slice.call(files, remain);
  6646. for (var i = 0; i < files.length; i++) {
  6647. this.removeFile(files[i]);
  6648. }
  6649. Toastr.error(__("You can only upload a maximum of %s files", this.options.maxFiles));
  6650. }
  6651. }
  6652. }
  6653. },
  6654. success: function (file, response) {
  6655. var ret = Upload.events.onUploadResponse(response, this, file);
  6656. file.ret = ret;
  6657. if (ret.code === 1) {
  6658. Upload.events.onUploadSuccess(this, ret, file);
  6659. } else {
  6660. Upload.events.onUploadError(this, ret, file);
  6661. }
  6662. },
  6663. error: function (file, response, xhr) {
  6664. var responseObj = $("<div>" + (xhr && typeof xhr.responseText !== 'undefined' ? xhr.responseText : response) + "</div>");
  6665. responseObj.find("style, title, script").remove();
  6666. var msg = responseObj.text() || __('Network error');
  6667. var ret = {code: 0, data: null, msg: msg};
  6668. Upload.events.onUploadError(this, ret, file);
  6669. },
  6670. uploadprogress: function (file, progress, bytesSent) {
  6671. if (file.upload.chunked) {
  6672. $(this.element).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + Math.floor((file.upload.bytesSent / file.size) * 100) + "%");
  6673. }
  6674. },
  6675. totaluploadprogress: function (progress, bytesSent) {
  6676. if (this.getActiveFiles().length > 0 && !this.options.chunking) {
  6677. $(this.element).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + Math.floor(progress) + "%");
  6678. }
  6679. },
  6680. queuecomplete: function () {
  6681. Upload.events.onUploadComplete(this, this.files);
  6682. this.removeAllFiles(true);
  6683. $(this.element).prop("disabled", false).html(this.options.elementHtml);
  6684. },
  6685. chunkSuccess: function (chunk, file, response) {
  6686. },
  6687. chunksUploaded: function (file, done) {
  6688. var that = this;
  6689. Fast.api.ajax({
  6690. url: this.options.url,
  6691. data: $.extend({}, multipart, {
  6692. action: 'merge',
  6693. filesize: file.size,
  6694. filename: file.name,
  6695. chunkid: file.upload.uuid,
  6696. chunkcount: file.upload.totalChunkCount,
  6697. })
  6698. }, function (data, ret) {
  6699. done(JSON.stringify(ret));
  6700. return false;
  6701. }, function (data, ret) {
  6702. file.accepted = false;
  6703. that._errorProcessing([file], ret.msg);
  6704. });
  6705. },
  6706. onUploadSuccess: onUploadSuccess,
  6707. onUploadError: onUploadError,
  6708. onUploadComplete: onUploadComplete,
  6709. }, Upload.options, options));
  6710. //拖动排序
  6711. if (preview_id && multiple) {
  6712. require(['dragsort'], function () {
  6713. $("#" + preview_id).dragsort({
  6714. dragSelector: "li a:not(.btn-trash)",
  6715. dragEnd: function () {
  6716. $("#" + preview_id).trigger("fa.preview.change");
  6717. },
  6718. placeHolderTemplate: '<li class="col-xs-3"></li>'
  6719. });
  6720. });
  6721. }
  6722. //刷新隐藏textarea的值
  6723. var refresh = function (name) {
  6724. var data = {};
  6725. var textarea = $("textarea[name='" + name + "']");
  6726. var container = textarea.prev("ul");
  6727. $.each($("input,select,textarea", container).serializeArray(), function (i, j) {
  6728. var reg = /\[?(\w+)\]?\[(\w+)\]$/g;
  6729. var match = reg.exec(j.name);
  6730. if (!match)
  6731. return true;
  6732. if (!isNaN(match[2])) {
  6733. data[i] = j.value;
  6734. } else {
  6735. match[1] = "x" + parseInt(match[1]);
  6736. if (typeof data[match[1]] === 'undefined') {
  6737. data[match[1]] = {};
  6738. }
  6739. data[match[1]][match[2]] = j.value;
  6740. }
  6741. });
  6742. var result = [];
  6743. $.each(data, function (i, j) {
  6744. result.push(j);
  6745. });
  6746. textarea.val(JSON.stringify(result));
  6747. };
  6748. if (preview_id && input_id) {
  6749. $(document.body).on("keyup change", "#" + input_id, function (e) {
  6750. var inputStr = $("#" + input_id).val();
  6751. var inputArr = inputStr.split(/\,/);
  6752. $("#" + preview_id).empty();
  6753. var tpl = $("#" + preview_id).data("template") ? $("#" + preview_id).data("template") : "";
  6754. var extend = $("#" + preview_id).next().is("textarea") ? $("#" + preview_id).next("textarea").val() : "{}";
  6755. var json = {};
  6756. try {
  6757. json = JSON.parse(extend);
  6758. } catch (e) {
  6759. }
  6760. $.each(inputArr, function (i, j) {
  6761. if (!j) {
  6762. return true;
  6763. }
  6764. var suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(j);
  6765. suffix = suffix ? suffix[1] : 'file';
  6766. j = Config.upload.fullmode ? Fast.api.cdnurl(j) : j;
  6767. var value = (json && typeof json[i] !== 'undefined' ? json[i] : null);
  6768. var data = {url: j, fullurl: Fast.api.cdnurl(j), data: $(that).data(), key: i, index: i, value: value, row: value, suffix: suffix};
  6769. var html = tpl ? Template(tpl, data) : Template.render(Upload.config.previewtpl, data);
  6770. $("#" + preview_id).append(html);
  6771. });
  6772. refresh($("#" + preview_id).data("name"));
  6773. });
  6774. $("#" + input_id).trigger("change");
  6775. }
  6776. if (preview_id) {
  6777. //监听文本框改变事件
  6778. $("#" + preview_id).on('change keyup', "input,textarea,select", function () {
  6779. refresh($(this).closest("ul").data("name"));
  6780. });
  6781. // 监听事件
  6782. $(document.body).on("fa.preview.change", "#" + preview_id, function () {
  6783. var urlArr = [];
  6784. $("#" + preview_id + " [data-url]").each(function (i, j) {
  6785. urlArr.push($(this).data("url"));
  6786. });
  6787. if (input_id) {
  6788. $("#" + input_id).val(urlArr.join(","));
  6789. }
  6790. refresh($("#" + preview_id).data("name"));
  6791. });
  6792. // 移除按钮事件
  6793. $(document.body).on("click", "#" + preview_id + " .btn-trash", function () {
  6794. $(this).closest("li").remove();
  6795. $("#" + preview_id).trigger("fa.preview.change");
  6796. });
  6797. }
  6798. if (input_id) {
  6799. //粘贴上传、拖拽上传
  6800. $("body").on('paste drop', "#" + input_id, function (event) {
  6801. var originEvent = event.originalEvent;
  6802. var button = $(".plupload[data-input-id='" + $(this).attr("id") + "'],.faupload[data-input-id='" + $(this).attr("id") + "']");
  6803. if (event.type === 'paste' && originEvent.clipboardData && originEvent.clipboardData.items) {
  6804. var items = originEvent.clipboardData.items;
  6805. if ((items.length === 1 && items[0].type.indexOf("text") > -1) || (items.length === 2 && items[1].type.indexOf("text") > -1)) {
  6806. } else {
  6807. Upload.list[button.attr("id")].paste(originEvent);
  6808. return false;
  6809. }
  6810. }
  6811. if (event.type === 'drop' && originEvent.dataTransfer && originEvent.dataTransfer.files) {
  6812. Upload.list[button.attr("id")].drop(originEvent);
  6813. return false;
  6814. }
  6815. });
  6816. }
  6817. });
  6818. },
  6819. /**
  6820. * @deprecated Use upload instead.
  6821. */
  6822. plupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6823. return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete);
  6824. },
  6825. /**
  6826. * @deprecated Use upload instead.
  6827. */
  6828. faupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6829. return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete);
  6830. },
  6831. // AJAX异步上传
  6832. send: function (file, onUploadSuccess, onUploadError, onUploadComplete) {
  6833. var index = Layer.msg(__('Uploading'), {offset: 't', time: 0});
  6834. var id = "dropzone-" + Dropzone.uuidv4();
  6835. $('<button type="button" id="' + id + '" class="btn btn-danger hidden faupload" />').appendTo("body");
  6836. $("#" + id).data("upload-complete", function (files) {
  6837. Layer.close(index);
  6838. Upload.list[id].removeAllFiles(true);
  6839. });
  6840. Upload.api.upload("#" + id, onUploadSuccess, onUploadError, onUploadComplete);
  6841. setTimeout(function () {
  6842. Upload.list[id].addFile(file);
  6843. }, 1);
  6844. },
  6845. custom: {
  6846. //自定义上传完成回调
  6847. afteruploadcallback: function (response) {
  6848. console.log(this, response);
  6849. alert("Custom Callback,Response URL:" + response.url);
  6850. },
  6851. }
  6852. }
  6853. }
  6854. ;
  6855. return Upload;
  6856. });
  6857. /*! nice-validator 1.1.5
  6858. * (c) 2012-2020 Jony Zhang <niceue@live.com>, MIT Licensed
  6859. * https://github.com/niceue/nice-validator
  6860. */
  6861. ;(function(factory) {
  6862. typeof module === 'object' && module.exports ? module.exports = factory( require( 'jquery' ) ) :
  6863. typeof define === 'function' && define.amd ? define('validator',['jquery'], factory) :
  6864. factory(jQuery);
  6865. }(function($, undefined) {
  6866. 'use strict';
  6867. var NS = 'validator',
  6868. CLS_NS = '.' + NS,
  6869. CLS_NS_RULE = '.rule',
  6870. CLS_NS_FIELD = '.field',
  6871. CLS_NS_FORM = '.form',
  6872. CLS_WRAPPER = 'nice-' + NS,
  6873. CLS_MSG_BOX = 'msg-box',
  6874. ARIA_INVALID = 'aria-invalid',
  6875. DATA_RULE = 'data-rule',
  6876. DATA_MSG = 'data-msg',
  6877. DATA_TIP = 'data-tip',
  6878. DATA_OK = 'data-ok',
  6879. DATA_TIMELY = 'data-timely',
  6880. DATA_TARGET = 'data-target',
  6881. DATA_DISPLAY = 'data-display',
  6882. DATA_MUST = 'data-must',
  6883. NOVALIDATE = 'novalidate',
  6884. INPUT_SELECTOR = ':verifiable',
  6885. rRules = /(&)?(!)?\b(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?\s*(;|\|)?/g,
  6886. rRule = /(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?/,
  6887. rDisplay = /(?:([^:;\(\[]*):)?(.*)/,
  6888. rDoubleBytes = /[^\x00-\xff]/g,
  6889. rPos = /top|right|bottom|left/,
  6890. rAjaxType = /(?:(cors|jsonp):)?(?:(post|get):)?(.+)/i,
  6891. rUnsafe = /[<>'"`\\]|&#x?\d+[A-F]?;?|%3[A-F]/gmi,
  6892. noop = $.noop,
  6893. proxy = $.proxy,
  6894. trim = $.trim,
  6895. isFunction = $.isFunction,
  6896. isString = function(s) {
  6897. return typeof s === 'string';
  6898. },
  6899. isObject = function(o) {
  6900. return o && Object.prototype.toString.call(o) === '[object Object]';
  6901. },
  6902. isIE = document.documentMode || +(navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1),
  6903. attr = function(el, key, value) {
  6904. if (!el || !el.tagName) return null;
  6905. if (value !== undefined) {
  6906. if (value === null) el.removeAttribute(key);
  6907. else el.setAttribute(key, '' + value);
  6908. } else {
  6909. return el.getAttribute(key);
  6910. }
  6911. },
  6912. novalidateonce,
  6913. preinitialized = {},
  6914. defaults = {
  6915. debug: 0,
  6916. theme: 'default',
  6917. ignore: '',
  6918. focusInvalid: true,
  6919. focusCleanup: false,
  6920. stopOnError: false,
  6921. beforeSubmit: null,
  6922. valid: null,
  6923. invalid: null,
  6924. validation: null,
  6925. formClass: 'n-default',
  6926. validClass: 'n-valid',
  6927. invalidClass: 'n-invalid',
  6928. bindClassTo: null
  6929. },
  6930. fieldDefaults = {
  6931. timely: 1,
  6932. display: null,
  6933. target: null,
  6934. ignoreBlank: false,
  6935. showOk: true,
  6936. // Translate ajax response to validation result
  6937. dataFilter: function (data) {
  6938. if ( isString(data) || ( isObject(data) && ('error' in data || 'ok' in data) ) ) {
  6939. return data;
  6940. }
  6941. },
  6942. msgMaker: function(opt) {
  6943. var html;
  6944. html = '<span role="alert" class="msg-wrap n-'+ opt.type + '">' + opt.arrow;
  6945. if (opt.result) {
  6946. $.each(opt.result, function(i, obj){
  6947. html += '<span class="n-'+ obj.type +'">' + opt.icon + '<span class="n-msg">' + obj.msg + '</span></span>';
  6948. });
  6949. } else {
  6950. html += opt.icon + '<span class="n-msg">' + opt.msg + '</span>';
  6951. }
  6952. html += '</span>';
  6953. return html;
  6954. },
  6955. msgWrapper: 'span',
  6956. msgArrow: '',
  6957. msgIcon: '<span class="n-icon"></span>',
  6958. msgClass: 'n-right',
  6959. msgStyle: '',
  6960. msgShow: null,
  6961. msgHide: null
  6962. },
  6963. themes = {};
  6964. /** jQuery Plugin
  6965. * @param {Object} options
  6966. debug {Boolean} 0 Whether to enable debug mode
  6967. timely {Number} 1 Whether to enable timely validation
  6968. theme {String} 'default' Theme name
  6969. stopOnError {Boolean} false Whether to stop validate when found an error input
  6970. focusCleanup {Boolean} false Whether to clean up the field message when focus the field
  6971. focusInvalid {Boolean} true Whether to focus the field that is invalid
  6972. ignoreBlank {Boolean} false When the field has no value, whether to ignore validation
  6973. ignore {jqSelector} '' Ignored fields (Using jQuery selector)
  6974. beforeSubmit {Function} Do something before submit form
  6975. dataFilter {Function} Convert ajax results
  6976. valid {Function} Triggered when the form is valid
  6977. invalid {Function} Triggered when the form is invalid
  6978. validClass {String} 'n-valid' Add this class name to a valid field
  6979. invalidClass {String} 'n-invalid' Add this class name to a invalid field
  6980. bindClassTo {jqSelector} ':verifiable' Which element should the className binding to
  6981. display {Function} Callback function to get dynamic display
  6982. target {Function} Callback function to get dynamic target
  6983. msgShow {Function} Trigger this callback when show message
  6984. msgHide {Function} Trigger this callback when hide message
  6985. msgWrapper {String} 'span' Message wrapper tag name
  6986. msgMaker {Function} Callback function to make message HTML
  6987. msgArrow {String} Message arrow template
  6988. msgIcon {String} Message icon template
  6989. msgStyle {String} Custom message css style
  6990. msgClass {String} Additional added to the message class names
  6991. formClass {String} Additional added to the form class names
  6992. messages {Object} Custom messages for the current instance
  6993. rules {Object} Custom rules for the current instance
  6994. fields {Object} Field validation configuration
  6995. {String} key name|#id
  6996. {String|Object} value Rule string or an object which can pass more arguments
  6997. fields[key][rule] {String} Rule string
  6998. fields[key][display] {String|Function}
  6999. fields[key][tip] {String} Custom tip message
  7000. fields[key][ok] {String} Custom success message
  7001. fields[key][msg] {Object} Custom error message
  7002. fields[key][msgStyle] {String} Custom message style
  7003. fields[key][msgClass] {String} A className which added to message placeholder element
  7004. fields[key][msgWrapper] {String} Tag name of the message placeholder element
  7005. fields[key][msgMaker] {Function} A function to custom message HTML
  7006. fields[key][dataFilter] {Function} A function to convert ajax results
  7007. fields[key][valid] {Function} A function triggered when field is valid
  7008. fields[key][invalid] {Function} A function triggered when field is invalid
  7009. fields[key][must] {Boolean} If set true, we always check the field even has remote checking
  7010. fields[key][timely] {Boolean} Whether to enable timely validation
  7011. fields[key][target] {jqSelector} Define placement of a message
  7012. */
  7013. $.fn.validator = function(options) {
  7014. var that = this,
  7015. args = arguments;
  7016. if (that.is(INPUT_SELECTOR)) return that;
  7017. if (!that.is('form')) that = this.find('form');
  7018. if (!that.length) that = this;
  7019. that.each(function() {
  7020. var instance = $(this).data(NS);
  7021. if (instance) {
  7022. if ( isString(options) ) {
  7023. if ( options.charAt(0) === '_' ) return;
  7024. instance[options].apply(instance, [].slice.call(args, 1));
  7025. }
  7026. else if (options) {
  7027. instance._reset(true);
  7028. instance._init(this, options);
  7029. }
  7030. } else {
  7031. new Validator(this, options);
  7032. }
  7033. });
  7034. return this;
  7035. };
  7036. // Validate a field, or an area
  7037. $.fn.isValid = function(callback, hideMsg) {
  7038. var me = _getInstance(this[0]),
  7039. hasCallback = isFunction(callback),
  7040. ret, opt;
  7041. if (!me) return true;
  7042. if (!hasCallback && hideMsg === undefined) hideMsg = callback;
  7043. me.checkOnly = !!hideMsg;
  7044. opt = me.options;
  7045. ret = me._multiValidate(
  7046. this.is(INPUT_SELECTOR) ? this : this.find(INPUT_SELECTOR),
  7047. function(isValid){
  7048. if (!isValid && opt.focusInvalid && !me.checkOnly) {
  7049. // navigate to the error element
  7050. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  7051. }
  7052. if (hasCallback) {
  7053. if (callback.length) {
  7054. callback(isValid);
  7055. } else if (isValid) {
  7056. callback();
  7057. }
  7058. }
  7059. me.checkOnly = false;
  7060. }
  7061. );
  7062. // If you pass a callback, we maintain the jQuery object chain
  7063. return hasCallback ? this : ret;
  7064. };
  7065. $.extend($.expr.pseudos || $.expr[':'], {
  7066. // A faster selector than ":input:not(:submit,:button,:reset,:image,:disabled,[contenteditable])"
  7067. verifiable: function(elem) {
  7068. var name = elem.nodeName.toLowerCase();
  7069. return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
  7070. name === 'select' ||
  7071. name === 'textarea' ||
  7072. elem.contentEditable === 'true'
  7073. ) && !elem.disabled;
  7074. },
  7075. // any value, but not only whitespace
  7076. filled: function(elem) {
  7077. return !!trim($(elem).val());
  7078. }
  7079. });
  7080. /**
  7081. * Creates a new Validator
  7082. *
  7083. * @class
  7084. * @param {Element} element - form element
  7085. * @param {Object} options - options for validator
  7086. */
  7087. function Validator(element, options) {
  7088. var me = this;
  7089. if ( !(me instanceof Validator) ) {
  7090. return new Validator(element, options);
  7091. }
  7092. if (Validator.pending) {
  7093. $(window).on('validatorready', init);
  7094. } else {
  7095. init();
  7096. }
  7097. function init() {
  7098. me.$el = $(element);
  7099. if (me.$el.length) {
  7100. me._init(me.$el[0], options);
  7101. }
  7102. else if (isString(element)) {
  7103. preinitialized[element] = options;
  7104. }
  7105. }
  7106. }
  7107. Validator.prototype = {
  7108. _init: function(element, options) {
  7109. var me = this,
  7110. opt, themeOpt, dataOpt;
  7111. // Initialization options
  7112. if ( isFunction(options) ) {
  7113. options = {
  7114. valid: options
  7115. };
  7116. }
  7117. options = me._opt = options || {};
  7118. dataOpt = attr(element, 'data-'+ NS +'-option');
  7119. dataOpt = me._dataOpt = dataOpt && dataOpt.charAt(0) === '{' ? (new Function('return ' + dataOpt))() : {};
  7120. themeOpt = me._themeOpt = themes[ options.theme || dataOpt.theme || defaults.theme ];
  7121. opt = me.options = $.extend({}, defaults, fieldDefaults, themeOpt, me.options, options, dataOpt);
  7122. me.rules = new Rules(opt.rules, true);
  7123. me.messages = new Messages(opt.messages, true);
  7124. me.Field = _createFieldFactory(me);
  7125. me.elements = me.elements || {};
  7126. me.deferred = {};
  7127. me.errors = {};
  7128. me.fields = {};
  7129. // Initialization fields
  7130. me._initFields(opt.fields);
  7131. // Initialization events and make a cache
  7132. if ( !me.$el.data(NS) ) {
  7133. me.$el.data(NS, me).addClass(CLS_WRAPPER +' '+ opt.formClass)
  7134. .on('form-submit-validate', function(e, a, $form, opts, veto) {
  7135. me.vetoed = veto.veto = !me.isValid;
  7136. me.ajaxFormOptions = opts;
  7137. })
  7138. .on('submit'+ CLS_NS +' validate'+ CLS_NS, proxy(me, '_submit'))
  7139. .on('reset'+ CLS_NS, proxy(me, '_reset'))
  7140. .on('showmsg'+ CLS_NS, proxy(me, '_showmsg'))
  7141. .on('hidemsg'+ CLS_NS, proxy(me, '_hidemsg'))
  7142. .on('focusin'+ CLS_NS + ' click'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusin'))
  7143. .on('focusout'+ CLS_NS +' validate'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusout'))
  7144. .on('keyup'+ CLS_NS +' input'+ CLS_NS + ' compositionstart compositionend', INPUT_SELECTOR, proxy(me, '_focusout'))
  7145. .on('click'+ CLS_NS, ':radio,:checkbox', 'click', proxy(me, '_focusout'))
  7146. .on('change'+ CLS_NS, 'select,input[type="file"]', 'change', proxy(me, '_focusout'));
  7147. // cache the novalidate attribute value
  7148. me._NOVALIDATE = attr(element, NOVALIDATE);
  7149. // Initialization is complete, stop off default HTML5 form validation
  7150. // If use "jQuery.attr('novalidate')" in IE7 will complain: "SCRIPT3: Member not found."
  7151. attr(element, NOVALIDATE, NOVALIDATE);
  7152. }
  7153. // Display all messages in target container
  7154. if ( isString(opt.target) ) {
  7155. me.$el.find(opt.target).addClass('msg-container');
  7156. }
  7157. },
  7158. // Guess whether the form use ajax submit
  7159. _guessAjax: function(form) {
  7160. var me = this;
  7161. if ( !(me.isAjaxSubmit = !!me.options.valid) ) {
  7162. // if there is a "valid.form" event
  7163. var events = ($._data || $.data)(form, 'events');
  7164. me.isAjaxSubmit = issetEvent(events, 'valid', 'form') || issetEvent(events, 'submit', 'form-plugin');
  7165. }
  7166. function issetEvent(events, name, namespace) {
  7167. return !!(
  7168. events && events[name]
  7169. && $.map(events[name], function(e){
  7170. return ~e.namespace.indexOf(namespace) ? 1 : null;
  7171. }).length )
  7172. }
  7173. },
  7174. _initFields: function(fields) {
  7175. var me = this, k, arr, i,
  7176. clear = fields === null;
  7177. // Processing field information
  7178. if (clear) fields = me.fields;
  7179. if ( isObject(fields) ) {
  7180. for (k in fields) {
  7181. if (~k.indexOf(',')) {
  7182. arr = k.split(',');
  7183. i = arr.length;
  7184. while (i--) {
  7185. initField(trim(arr[i]), fields[k]);
  7186. }
  7187. } else {
  7188. initField(k, fields[k]);
  7189. }
  7190. }
  7191. }
  7192. // Parsing DOM rules
  7193. me.$el.find(INPUT_SELECTOR).each(function() {
  7194. me._parse(this);
  7195. });
  7196. function initField(k, v) {
  7197. // delete a field from settings
  7198. if ( v === null || clear ) {
  7199. var el = me.elements[k];
  7200. if (el) me._resetElement(el, true);
  7201. delete me.fields[k];
  7202. } else {
  7203. me.fields[k] = new me.Field(k, isString(v) ? {rule: v} : v, me.fields[k]);
  7204. }
  7205. }
  7206. },
  7207. // Parsing a field
  7208. _parse: function(el) {
  7209. var me = this,
  7210. field,
  7211. key = el.name,
  7212. display,
  7213. timely,
  7214. dataRule = attr(el, DATA_RULE);
  7215. dataRule && attr(el, DATA_RULE, null);
  7216. // If the field has passed the key as id mode, or it doesn't has a name
  7217. if ( el.id && (
  7218. ('#' + el.id in me.fields) ||
  7219. !key ||
  7220. // If dataRule and element are diffrent from old's, we use ID mode.
  7221. (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
  7222. )
  7223. ) {
  7224. key = '#' + el.id;
  7225. }
  7226. // Generate id
  7227. if (!key) {
  7228. key = '#' + (el.id = 'N' + String(Math.random()).slice(-12));
  7229. }
  7230. field = me.getField(key, true);
  7231. // The priority of passing parameter by DOM is higher than by JS.
  7232. field.rule = dataRule || field.rule;
  7233. if (display = attr(el, DATA_DISPLAY)) {
  7234. field.display = display;
  7235. }
  7236. if (field.rule) {
  7237. if ( attr(el, DATA_MUST) !== null || /\b(?:match|checked)\b/.test(field.rule) ) {
  7238. field.must = true;
  7239. }
  7240. if ( /\brequired\b/.test(field.rule) ) {
  7241. field.required = true;
  7242. }
  7243. if (timely = attr(el, DATA_TIMELY)) {
  7244. field.timely = +timely;
  7245. } else if (field.timely > 3) {
  7246. attr(el, DATA_TIMELY, field.timely);
  7247. }
  7248. me._parseRule(field);
  7249. field.old = {};
  7250. }
  7251. if ( isString(field.target) ) {
  7252. attr(el, DATA_TARGET, field.target);
  7253. }
  7254. if ( isString(field.tip) ) {
  7255. attr(el, DATA_TIP, field.tip);
  7256. }
  7257. return me.fields[key] = field;
  7258. },
  7259. // Parsing field rules
  7260. _parseRule: function(field) {
  7261. var arr = rDisplay.exec(field.rule);
  7262. if (!arr) return;
  7263. // current rule index
  7264. field._i = 0;
  7265. if (arr[1]) {
  7266. field.display = arr[1];
  7267. }
  7268. if (arr[2]) {
  7269. field._rules = [];
  7270. arr[2].replace(rRules, function(){
  7271. var args = arguments;
  7272. args[4] = args[4] || args[5];
  7273. field._rules.push({
  7274. and: args[1] === '&',
  7275. not: args[2] === '!',
  7276. or: args[6] === '|',
  7277. method: args[3],
  7278. params: args[4] ? $.map( args[4].split(', '), trim ) : undefined
  7279. });
  7280. });
  7281. }
  7282. },
  7283. // Verify a zone
  7284. _multiValidate: function($inputs, doneCallback){
  7285. var me = this,
  7286. opt = me.options;
  7287. me.hasError = false;
  7288. if (opt.ignore) {
  7289. $inputs = $inputs.not(opt.ignore);
  7290. }
  7291. $inputs.each(function() {
  7292. me._validate(this);
  7293. if (me.hasError && opt.stopOnError) {
  7294. // stop the validation
  7295. return false;
  7296. }
  7297. });
  7298. // Need to wait for all fields validation complete, especially asynchronous validation
  7299. if (doneCallback) {
  7300. me.validating = true;
  7301. $.when.apply(
  7302. null,
  7303. $.map(me.deferred, function(v){return v;})
  7304. ).done(function(){
  7305. doneCallback.call(me, !me.hasError);
  7306. me.validating = false;
  7307. });
  7308. }
  7309. // If the form does not contain asynchronous validation, the return value is correct.
  7310. // Otherwise, you should detect form validation result through "doneCallback".
  7311. return !$.isEmptyObject(me.deferred) ? undefined : !me.hasError;
  7312. },
  7313. // Validate the whole form
  7314. _submit: function(e) {
  7315. var me = this,
  7316. opt = me.options,
  7317. form = e.target,
  7318. canSubmit = e.type === 'submit' && form.tagName === 'FORM' && !e.isDefaultPrevented();
  7319. e.preventDefault();
  7320. if (
  7321. novalidateonce && ~(novalidateonce = false) ||
  7322. // Prevent duplicate submission
  7323. me.submiting ||
  7324. // Receive the "validate" event only from the form.
  7325. e.type === 'validate' && me.$el[0] !== form ||
  7326. // trigger the beforeSubmit callback.
  7327. isFunction(opt.beforeSubmit) && opt.beforeSubmit.call(me, form) === false
  7328. ) {
  7329. return;
  7330. }
  7331. if (me.isAjaxSubmit === undefined) {
  7332. me._guessAjax(form);
  7333. }
  7334. me._debug('log', '\n<<< event: ' + e.type);
  7335. me._reset();
  7336. me.submiting = true;
  7337. me._multiValidate(
  7338. me.$el.find(INPUT_SELECTOR),
  7339. function(isValid){
  7340. var ret = (isValid || opt.debug === 2) ? 'valid' : 'invalid',
  7341. errors;
  7342. if (!isValid) {
  7343. if (opt.focusInvalid) {
  7344. // navigate to the error element
  7345. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  7346. }
  7347. errors = $.map(me.errors, function(err){return err;});
  7348. }
  7349. // releasing submit
  7350. me.submiting = false;
  7351. me.isValid = isValid;
  7352. // trigger callback and event
  7353. isFunction(opt[ret]) && opt[ret].call(me, form, errors);
  7354. me.$el.trigger(ret + CLS_NS_FORM, [form, errors]);
  7355. me._debug('log', '>>> ' + ret);
  7356. if (!isValid) return;
  7357. // For jquery.form plugin
  7358. if (me.vetoed) {
  7359. $(form).ajaxSubmit(me.ajaxFormOptions);
  7360. }
  7361. else if (canSubmit && !me.isAjaxSubmit) {
  7362. document.createElement('form').submit.call(form);
  7363. }
  7364. }
  7365. );
  7366. },
  7367. _reset: function(e) {
  7368. var me = this;
  7369. me.errors = {};
  7370. if (e) {
  7371. me.reseting = true;
  7372. me.$el.find(INPUT_SELECTOR).each( function(){
  7373. me._resetElement(this);
  7374. });
  7375. delete me.reseting;
  7376. }
  7377. },
  7378. _resetElement: function(el, all) {
  7379. this._setClass(el, null);
  7380. this.hideMsg(el);
  7381. },
  7382. // Handle events: "focusin/click"
  7383. _focusin: function(e) {
  7384. var me = this,
  7385. opt = me.options,
  7386. el = e.target,
  7387. timely,
  7388. msg;
  7389. if ( me.validating || ( e.type==='click' && document.activeElement === el ) ) {
  7390. return;
  7391. }
  7392. if (opt.focusCleanup) {
  7393. if ( attr(el, ARIA_INVALID) === 'true' ) {
  7394. me._setClass(el, null);
  7395. me.hideMsg(el);
  7396. }
  7397. }
  7398. msg = attr(el, DATA_TIP);
  7399. if (msg) {
  7400. me.showMsg(el, {
  7401. type: 'tip',
  7402. msg: msg
  7403. });
  7404. } else {
  7405. if (attr(el, DATA_RULE)) {
  7406. me._parse(el);
  7407. }
  7408. if (timely = attr(el, DATA_TIMELY)) {
  7409. if ( timely === 8 || timely === 9 ) {
  7410. me._focusout(e);
  7411. }
  7412. }
  7413. }
  7414. },
  7415. // Handle events: "focusout/validate/keyup/click/change/input/compositionstart/compositionend"
  7416. _focusout: function(e) {
  7417. var me = this,
  7418. opt = me.options,
  7419. el = e.target,
  7420. etype = e.type,
  7421. etype0,
  7422. focusin = etype === 'focusin',
  7423. special = etype === 'validate',
  7424. elem,
  7425. field,
  7426. old,
  7427. value,
  7428. timestamp,
  7429. key, specialKey,
  7430. timely,
  7431. timer = 0;
  7432. if (etype === 'compositionstart') {
  7433. me.pauseValidate = true;
  7434. }
  7435. if (etype === 'compositionend') {
  7436. me.pauseValidate = false;
  7437. }
  7438. if (me.pauseValidate) {
  7439. return;
  7440. }
  7441. // For checkbox and radio
  7442. elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
  7443. // Get field
  7444. if (!(field = me.getField(elem)) || !field.rule) {
  7445. return;
  7446. }
  7447. // Cache event type
  7448. etype0 = field._e;
  7449. field._e = etype;
  7450. timely = field.timely;
  7451. if (!special) {
  7452. if (!timely || (_checkable(el) && etype !== 'click')) {
  7453. return;
  7454. }
  7455. value = field.getValue();
  7456. // not validate field unless fill a value
  7457. if ( field.ignoreBlank && !value && !focusin ) {
  7458. me.hideMsg(el);
  7459. return;
  7460. }
  7461. if ( etype === 'focusout' ) {
  7462. if (etype0 === 'change') {
  7463. return;
  7464. }
  7465. if ( timely === 2 || timely === 8 ) {
  7466. old = field.old;
  7467. if (value && old) {
  7468. if (field.isValid && !old.showOk) {
  7469. me.hideMsg(el);
  7470. } else {
  7471. me._makeMsg(el, field, old);
  7472. }
  7473. } else {
  7474. return;
  7475. }
  7476. }
  7477. }
  7478. else {
  7479. if ( timely < 2 && !e.data ) {
  7480. return;
  7481. }
  7482. // mark timestamp to reduce the frequency of the received event
  7483. timestamp = +new Date();
  7484. if ( timestamp - (el._ts || 0) < 100 ) {
  7485. return;
  7486. }
  7487. el._ts = timestamp;
  7488. // handle keyup
  7489. if ( etype === 'keyup' ) {
  7490. if (etype0 === 'input') {
  7491. return;
  7492. }
  7493. key = e.keyCode;
  7494. specialKey = {
  7495. 8: 1, // Backspace
  7496. 9: 1, // Tab
  7497. 16: 1, // Shift
  7498. 32: 1, // Space
  7499. 46: 1 // Delete
  7500. };
  7501. // only gets focus, no validation
  7502. if ( key === 9 && !value ) {
  7503. return;
  7504. }
  7505. // do not validate, if triggered by these keys
  7506. if ( key < 48 && !specialKey[key] ) {
  7507. return;
  7508. }
  7509. }
  7510. if ( !focusin ) {
  7511. // keyboard events, reducing the frequency of validation
  7512. timer = timely <100 ? (etype === 'click' || el.tagName === 'SELECT') ? 0 : 400 : timely;
  7513. }
  7514. }
  7515. }
  7516. // if the current field is ignored
  7517. if ( opt.ignore && $(el).is(opt.ignore) ) {
  7518. return;
  7519. }
  7520. clearTimeout(field._t);
  7521. if (timer) {
  7522. field._t = setTimeout(function() {
  7523. me._validate(el, field);
  7524. }, timer);
  7525. } else {
  7526. if (special) field.old = {};
  7527. me._validate(el, field);
  7528. }
  7529. },
  7530. _setClass: function(el, isValid) {
  7531. var $el = $(el), opt = this.options;
  7532. if (opt.bindClassTo) {
  7533. $el = $el.closest(opt.bindClassTo);
  7534. }
  7535. $el.removeClass( opt.invalidClass + ' ' + opt.validClass );
  7536. if (isValid !== null) {
  7537. $el.addClass( isValid ? opt.validClass : opt.invalidClass );
  7538. }
  7539. },
  7540. _showmsg: function(e, type, msg) {
  7541. var me = this,
  7542. el = e.target;
  7543. if ( me.$el.is(el) ) {
  7544. if (isObject(type)) {
  7545. me.showMsg(type)
  7546. }
  7547. else if ( type === 'tip' ) {
  7548. me.$el.find(INPUT_SELECTOR +'['+ DATA_TIP +']', el).each(function(){
  7549. me.showMsg(this, {type: type, msg: msg});
  7550. });
  7551. }
  7552. }
  7553. else {
  7554. me.showMsg(el, {type: type, msg: msg});
  7555. }
  7556. },
  7557. _hidemsg: function(e) {
  7558. var $el = $(e.target);
  7559. if ( $el.is(INPUT_SELECTOR) ) {
  7560. this.hideMsg($el);
  7561. }
  7562. },
  7563. // Validated a field
  7564. _validatedField: function(el, field, ret) {
  7565. var me = this,
  7566. opt = me.options,
  7567. isValid = field.isValid = ret.isValid = !!ret.isValid,
  7568. callback = isValid ? 'valid' : 'invalid';
  7569. ret.key = field.key;
  7570. ret.ruleName = field._r;
  7571. ret.id = el.id;
  7572. ret.value = field.value;
  7573. me.elements[field.key] = ret.element = el;
  7574. me.isValid = me.$el[0].isValid = isValid ? me.isFormValid() : isValid;
  7575. if (isValid) {
  7576. ret.type = 'ok';
  7577. } else {
  7578. if (me.submiting) {
  7579. me.errors[field.key] = ret.msg;
  7580. }
  7581. me.hasError = true;
  7582. }
  7583. // cache result
  7584. field.old = ret;
  7585. // trigger callback
  7586. isFunction(field[callback]) && field[callback].call(me, el, ret);
  7587. isFunction(opt.validation) && opt.validation.call(me, el, ret);
  7588. // trigger event
  7589. $(el).attr( ARIA_INVALID, isValid ? null : true )
  7590. .trigger( callback + CLS_NS_FIELD, [ret, me] );
  7591. me.$el.triggerHandler('validation', [ret, me]);
  7592. if (me.checkOnly) return;
  7593. // set className
  7594. me._setClass(el, ret.skip || ret.type === 'tip' ? null : isValid);
  7595. me._makeMsg.apply(me, arguments);
  7596. },
  7597. _makeMsg: function(el, field, ret) {
  7598. // show or hide the message
  7599. if (field.msgMaker) {
  7600. ret = $.extend({}, ret);
  7601. if (field._e === 'focusin') {
  7602. ret.type = 'tip';
  7603. }
  7604. this[ ret.showOk || ret.msg || ret.type === 'tip' ? 'showMsg' : 'hideMsg' ](el, ret, field);
  7605. }
  7606. },
  7607. // Validated a rule
  7608. _validatedRule: function(el, field, ret, msgOpt) {
  7609. field = field || me.getField(el);
  7610. msgOpt = msgOpt || {};
  7611. var me = this,
  7612. msg,
  7613. rule,
  7614. method = field._r,
  7615. timely = field.timely,
  7616. special = timely === 9 || timely === 8,
  7617. transfer,
  7618. temp,
  7619. isValid = false;
  7620. // use null to break validation from a field
  7621. if (ret === null) {
  7622. me._validatedField(el, field, {isValid: true, skip: true});
  7623. field._i = 0;
  7624. return;
  7625. }
  7626. else if (ret === undefined) {
  7627. transfer = true;
  7628. }
  7629. else if (ret === true || ret === '') {
  7630. isValid = true;
  7631. }
  7632. else if (isString(ret)) {
  7633. msg = ret;
  7634. }
  7635. else if (isObject(ret)) {
  7636. if (ret.error) {
  7637. msg = ret.error;
  7638. } else {
  7639. msg = ret.ok;
  7640. isValid = true;
  7641. }
  7642. }
  7643. else {
  7644. isValid = !!ret
  7645. }
  7646. rule = field._rules[field._i];
  7647. if (rule.not) {
  7648. msg = undefined;
  7649. isValid = method === 'required' || !isValid;
  7650. }
  7651. if (rule.or) {
  7652. if (isValid) {
  7653. while ( field._i < field._rules.length && field._rules[field._i].or ) {
  7654. field._i++;
  7655. }
  7656. } else {
  7657. transfer = true;
  7658. }
  7659. }
  7660. else if (rule.and) {
  7661. if (!field.isValid) transfer = true;
  7662. }
  7663. if (transfer) {
  7664. isValid = true;
  7665. }
  7666. // message analysis, and throw rule level event
  7667. else {
  7668. if (isValid) {
  7669. if (field.showOk !== false) {
  7670. temp = attr(el, DATA_OK);
  7671. msg = temp === null ? isString(field.ok) ? field.ok : msg : temp;
  7672. if (!isString(msg) && isString(field.showOk)) {
  7673. msg = field.showOk;
  7674. }
  7675. if (isString(msg)) {
  7676. msgOpt.showOk = isValid;
  7677. }
  7678. }
  7679. }
  7680. if (!isValid || special) {
  7681. /* rule message priority:
  7682. 1. custom DOM message
  7683. 2. custom field message;
  7684. 3. global defined message;
  7685. 4. rule returned message;
  7686. 5. default message;
  7687. */
  7688. msg = (_getDataMsg(el, field, msg || rule.msg || me.messages[method]) || me.messages.fallback).replace(/\{0\|?([^\}]*)\}/, function(m, defaultDisplay){
  7689. return me._getDisplay(el, field.display) || defaultDisplay || me.messages[0];
  7690. });
  7691. }
  7692. if (!isValid) field.isValid = isValid;
  7693. msgOpt.msg = msg;
  7694. $(el).trigger( (isValid ? 'valid' : 'invalid') + CLS_NS_RULE, [method, msg]);
  7695. }
  7696. if (special && (!transfer || rule.and)) {
  7697. if (!isValid && !field._m) field._m = msg;
  7698. field._v = field._v || [];
  7699. field._v.push({
  7700. type: isValid ? !transfer ? 'ok' : 'tip' : 'error',
  7701. msg: msg || rule.msg
  7702. });
  7703. }
  7704. me._debug('log', ' ' + field._i + ': ' + method + ' => ' + (isValid || msg));
  7705. // the current rule has passed, continue to validate
  7706. if ( (isValid || special) && field._i < field._rules.length - 1) {
  7707. field._i++;
  7708. me._checkRule(el, field);
  7709. }
  7710. // field was invalid, or all fields was valid
  7711. else {
  7712. field._i = 0;
  7713. if (special) {
  7714. msgOpt.isValid = field.isValid;
  7715. msgOpt.result = field._v;
  7716. msgOpt.msg = field._m || '';
  7717. if (!field.value && (field._e === 'focusin')) {
  7718. msgOpt.type = 'tip';
  7719. }
  7720. } else {
  7721. msgOpt.isValid = isValid;
  7722. }
  7723. me._validatedField(el, field, msgOpt);
  7724. delete field._m;
  7725. delete field._v;
  7726. }
  7727. },
  7728. // Verify a rule form a field
  7729. _checkRule: function(el, field) {
  7730. var me = this,
  7731. ret,
  7732. fn,
  7733. old,
  7734. key = field.key,
  7735. rule = field._rules[field._i],
  7736. method = rule.method,
  7737. params = rule.params;
  7738. // request has been sent, wait it
  7739. if (me.submiting && me.deferred[key]) {
  7740. return;
  7741. }
  7742. old = field.old;
  7743. field._r = method;
  7744. if (old && !field.must && !rule.must && rule.result !== undefined &&
  7745. old.ruleName === method && old.id === el.id &&
  7746. field.value && old.value === field.value )
  7747. {
  7748. // get result from cache
  7749. ret = rule.result;
  7750. }
  7751. else {
  7752. // get result from current rule
  7753. fn = _getDataRule(el, method) || me.rules[method] || noop;
  7754. ret = fn.call(field, el, params, field);
  7755. if (fn.msg) rule.msg = fn.msg;
  7756. }
  7757. // asynchronous validation
  7758. if (isObject(ret) && isFunction(ret.then)) {
  7759. me.deferred[key] = ret;
  7760. // whether the field valid is unknown
  7761. field.isValid = undefined;
  7762. // show loading message
  7763. !me.checkOnly && me.showMsg(el, {
  7764. type: 'loading',
  7765. msg: me.messages.loading
  7766. }, field);
  7767. // waiting to parse the response data
  7768. ret.then(
  7769. function(d, textStatus, jqXHR) {
  7770. var data = trim(jqXHR.responseText),
  7771. result,
  7772. dataFilter = field.dataFilter;
  7773. // detect if data is json or jsonp format
  7774. if (/jsonp?/.test(this.dataType)) {
  7775. data = d;
  7776. } else if (data.charAt(0) === '{') {
  7777. data = $.parseJSON(data);
  7778. }
  7779. // filter data
  7780. result = dataFilter.call(this, data, field);
  7781. if (result === undefined) result = dataFilter.call(this, data.data, field);
  7782. rule.data = this.data;
  7783. rule.result = field.old ? result : undefined;
  7784. me._validatedRule(el, field, result);
  7785. },
  7786. function(jqXHR, textStatus){
  7787. me._validatedRule(el, field, me.messages[textStatus] || textStatus);
  7788. }
  7789. ).always(function(){
  7790. delete me.deferred[key];
  7791. });
  7792. }
  7793. // other result
  7794. else {
  7795. me._validatedRule(el, field, ret);
  7796. }
  7797. },
  7798. // Processing the validation
  7799. _validate: function(el, field) {
  7800. var me = this;
  7801. // doesn't validate the element that has "disabled" or "novalidate" attribute
  7802. if ( el.disabled || attr(el, NOVALIDATE) !== null ) {
  7803. return;
  7804. }
  7805. field = field || me.getField(el);
  7806. if (!field) return;
  7807. if (!field._rules) me._parse(el);
  7808. if (!field._rules) return;
  7809. me._debug('info', field.key);
  7810. field.isValid = true;
  7811. field.element = el;
  7812. // Cache the value
  7813. field.value = field.getValue();
  7814. // if the field is not required, and that has a blank value
  7815. if (!field.required && !field.must && !field.value) {
  7816. if (!_checkable(el)) {
  7817. me._validatedField(el, field, {isValid: true});
  7818. return true;
  7819. }
  7820. }
  7821. me._checkRule(el, field);
  7822. return field.isValid;
  7823. },
  7824. _debug: function(type, messages) {
  7825. if (window.console && this.options.debug) {
  7826. console[type](messages);
  7827. }
  7828. },
  7829. /**
  7830. * Detecting whether the value of an element that matches a rule
  7831. *
  7832. * @method test
  7833. * @param {Element} el - input element
  7834. * @param {String} rule - rule name
  7835. */
  7836. test: function(el, rule) {
  7837. var me = this,
  7838. ret,
  7839. parts = rRule.exec(rule),
  7840. field,
  7841. method,
  7842. params;
  7843. if (parts) {
  7844. method = parts[1];
  7845. if (method in me.rules) {
  7846. params = parts[2] || parts[3];
  7847. params = params ? params.split(', ') : undefined;
  7848. field = me.getField(el, true);
  7849. field._r = method;
  7850. field.value = field.getValue();
  7851. ret = me.rules[method].call(field, el, params);
  7852. }
  7853. }
  7854. return ret === true || ret === undefined || ret === null;
  7855. },
  7856. _getDisplay: function(el, str) {
  7857. return !isString(str) ? isFunction(str) ? str.call(this, el) : '' : str;
  7858. },
  7859. _getMsgOpt: function(obj, field) {
  7860. var opt = field ? field : this.options;
  7861. return $.extend({
  7862. type: 'error',
  7863. pos: _getPos(opt.msgClass),
  7864. target: opt.target,
  7865. wrapper: opt.msgWrapper,
  7866. style: opt.msgStyle,
  7867. cls: opt.msgClass,
  7868. arrow: opt.msgArrow,
  7869. icon: opt.msgIcon
  7870. }, isString(obj) ? {msg: obj} : obj);
  7871. },
  7872. _getMsgDOM: function(el, msgOpt) {
  7873. var $el = $(el), $msgbox, datafor, tgt, container;
  7874. if ( $el.is(INPUT_SELECTOR) ) {
  7875. tgt = msgOpt.target || attr(el, DATA_TARGET);
  7876. if (tgt) {
  7877. tgt = !isFunction(tgt) ? tgt.charAt(0) === '#' ? $(tgt) : this.$el.find(tgt) : tgt.call(this, el);
  7878. if (tgt.length) {
  7879. if ( tgt.is(INPUT_SELECTOR) ) {
  7880. $el = tgt
  7881. el = tgt.get(0);
  7882. } else if ( tgt.hasClass(CLS_MSG_BOX) ) {
  7883. $msgbox = tgt;
  7884. } else {
  7885. container = tgt;
  7886. }
  7887. }
  7888. }
  7889. if (!$msgbox) {
  7890. datafor = (!_checkable(el) || !el.name) && el.id ? el.id : el.name;
  7891. $msgbox = (container || this.$el).find(msgOpt.wrapper + '.' + CLS_MSG_BOX + '[for="' + datafor + '"]');
  7892. }
  7893. } else {
  7894. $msgbox = $el;
  7895. }
  7896. // Create new message box
  7897. if (!msgOpt.hide && !$msgbox.length) {
  7898. $msgbox = $('<'+ msgOpt.wrapper + '>').attr({
  7899. 'class': CLS_MSG_BOX + (msgOpt.cls ? ' ' + msgOpt.cls : ''),
  7900. 'style': msgOpt.style || undefined,
  7901. 'for': datafor
  7902. });
  7903. if (container) {
  7904. $msgbox.appendTo(container);
  7905. } else {
  7906. if ( _checkable(el) ) {
  7907. var $parent = $el.parent();
  7908. $msgbox.appendTo( $parent.is('label') ? $parent.parent() : $parent );
  7909. } else {
  7910. $msgbox[!msgOpt.pos || msgOpt.pos === 'right' ? 'insertAfter' : 'insertBefore']($el);
  7911. }
  7912. }
  7913. }
  7914. return $msgbox;
  7915. },
  7916. /**
  7917. * Show validation message
  7918. *
  7919. * @method showMsg
  7920. * @param {Element} el - input element
  7921. * @param {Object} msgOpt
  7922. */
  7923. showMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  7924. if (!el) return;
  7925. var me = this,
  7926. opt = me.options,
  7927. msgShow,
  7928. msgMaker,
  7929. temp,
  7930. $msgbox;
  7931. if (isObject(el) && !el.jquery && !msgOpt) {
  7932. $.each(el, function(key, msg) {
  7933. var el = me.elements[key] || me.$el.find(_key2selector(key))[0];
  7934. me.showMsg(el, msg);
  7935. });
  7936. return;
  7937. }
  7938. if ($(el).is(INPUT_SELECTOR)) {
  7939. field = field || me.getField(el);
  7940. }
  7941. if (!(msgMaker = (field || opt).msgMaker)) {
  7942. return;
  7943. }
  7944. msgOpt = me._getMsgOpt(msgOpt, field);
  7945. el = (el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]') : $(el)).get(0);
  7946. // ok or tip
  7947. if (!msgOpt.msg && msgOpt.type !== 'error') {
  7948. temp = attr(el, 'data-' + msgOpt.type);
  7949. if (temp !== null) msgOpt.msg = temp;
  7950. }
  7951. if ( !isString(msgOpt.msg) ) {
  7952. return;
  7953. }
  7954. $msgbox = me._getMsgDOM(el, msgOpt);
  7955. !rPos.test($msgbox[0].className) && $msgbox.addClass(msgOpt.cls);
  7956. if ( isIE === 6 && msgOpt.pos === 'bottom' ) {
  7957. $msgbox[0].style.marginTop = $(el).outerHeight() + 'px';
  7958. }
  7959. $msgbox.html( msgMaker.call(me, msgOpt) )[0].style.display = '';
  7960. if (isFunction(msgShow = field && field.msgShow || opt.msgShow)) {
  7961. msgShow.call(me, $msgbox, msgOpt.type);
  7962. }
  7963. },
  7964. /**
  7965. * Hide validation message
  7966. *
  7967. * @method hideMsg
  7968. * @param {Element} el - input element
  7969. * @param {Object} msgOpt optional
  7970. */
  7971. hideMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  7972. var me = this,
  7973. opt = me.options,
  7974. msgHide,
  7975. $msgbox;
  7976. el = $(el).get(0);
  7977. if ($(el).is(INPUT_SELECTOR)) {
  7978. field = field || me.getField(el);
  7979. if (field) {
  7980. if (field.isValid || me.reseting) attr(el, ARIA_INVALID, null);
  7981. }
  7982. }
  7983. msgOpt = me._getMsgOpt(msgOpt, field);
  7984. msgOpt.hide = true;
  7985. $msgbox = me._getMsgDOM(el, msgOpt);
  7986. if (!$msgbox.length) return;
  7987. if ( isFunction(msgHide = field && field.msgHide || opt.msgHide) ) {
  7988. msgHide.call(me, $msgbox, msgOpt.type);
  7989. } else {
  7990. $msgbox[0].style.display = 'none';
  7991. $msgbox[0].innerHTML = '';
  7992. }
  7993. },
  7994. /**
  7995. * Get field information
  7996. *
  7997. * @method getField
  7998. * @param {Element} - input element
  7999. * @return {Object} field
  8000. */
  8001. getField: function(el, must) {
  8002. var me = this,
  8003. key,
  8004. field;
  8005. if (isString(el)) {
  8006. key = el;
  8007. el = undefined;
  8008. } else {
  8009. if (attr(el, DATA_RULE)) {
  8010. return me._parse(el);
  8011. }
  8012. if (el.id && '#' + el.id in me.fields || !el.name) {
  8013. key = '#' + el.id;
  8014. } else {
  8015. key = el.name;
  8016. }
  8017. }
  8018. if ( (field = me.fields[key]) || must && (field = new me.Field(key)) ) {
  8019. field.element = el;
  8020. }
  8021. return field;
  8022. },
  8023. /**
  8024. * Config a field
  8025. *
  8026. * @method: setField
  8027. * @param {String} key
  8028. * @param {Object} obj
  8029. */
  8030. setField: function(key, obj) {
  8031. var fields = {};
  8032. if (!key) return;
  8033. // update this field
  8034. if (isString(key)) {
  8035. fields[key] = obj;
  8036. }
  8037. // update fields
  8038. else {
  8039. fields = key;
  8040. }
  8041. this._initFields(fields);
  8042. },
  8043. /**
  8044. * Detecting whether the form is valid
  8045. *
  8046. * @method isFormValid
  8047. * @return {Boolean}
  8048. */
  8049. isFormValid: function() {
  8050. var fields = this.fields, k, field;
  8051. for (k in fields) {
  8052. field = fields[k];
  8053. if (!field._rules || !field.required && !field.must && !field.value) continue;
  8054. if (!field.isValid) return false;
  8055. }
  8056. return true;
  8057. },
  8058. /**
  8059. * Prevent submission form
  8060. *
  8061. * @method holdSubmit
  8062. * @param {Boolean} hold - If set to false, will release the hold
  8063. */
  8064. holdSubmit: function(hold) {
  8065. this.submiting = hold === undefined || hold;
  8066. },
  8067. /**
  8068. * Clean validation messages
  8069. *
  8070. * @method cleanUp
  8071. */
  8072. cleanUp: function() {
  8073. this._reset(1);
  8074. },
  8075. /**
  8076. * Destroy the validation
  8077. *
  8078. * @method destroy
  8079. */
  8080. destroy: function() {
  8081. this._reset(1);
  8082. this.$el.off(CLS_NS).removeData(NS);
  8083. attr(this.$el[0], NOVALIDATE, this._NOVALIDATE);
  8084. }
  8085. };
  8086. /**
  8087. * Create Field Factory
  8088. *
  8089. * @class
  8090. * @param {Object} context
  8091. * @return {Function} Factory
  8092. */
  8093. function _createFieldFactory(context) {
  8094. function FieldFactory() {
  8095. var options = this.options;
  8096. for (var i in options) {
  8097. if (i in fieldDefaults) this[i] = options[i];
  8098. }
  8099. $.extend(this, {
  8100. _valHook: function() {
  8101. return this.element.contentEditable === 'true' ? 'text' : 'val';
  8102. },
  8103. getValue: function() {
  8104. var elem = this.element;
  8105. if (elem.type === 'number' && elem.validity && elem.validity.badInput) {
  8106. return 'NaN';
  8107. }
  8108. return $(elem)[this._valHook()]();
  8109. },
  8110. setValue: function(value) {
  8111. $(this.element)[this._valHook()](this.value = value);
  8112. },
  8113. // Get a range of validation messages
  8114. getRangeMsg: function(value, params, suffix) {
  8115. if (!params) return;
  8116. var me = this,
  8117. msg = me.messages[me._r] || '',
  8118. result,
  8119. p = params[0].split('~'),
  8120. e = params[1] === 'false',
  8121. a = p[0],
  8122. b = p[1],
  8123. c = 'rg',
  8124. args = [''],
  8125. isNumber = trim(value) && +value === +value;
  8126. function compare(large, small) {
  8127. return !e ? large >= small : large > small;
  8128. }
  8129. if (p.length === 2) {
  8130. if (a && b) {
  8131. if (isNumber && compare(value, +a) && compare(+b, value)) {
  8132. result = true;
  8133. }
  8134. args = args.concat(p);
  8135. c = e ? 'gtlt' : 'rg';
  8136. }
  8137. else if (a && !b) {
  8138. if (isNumber && compare(value, +a)) {
  8139. result = true;
  8140. }
  8141. args.push(a);
  8142. c = e ? 'gt' : 'gte';
  8143. }
  8144. else if (!a && b) {
  8145. if (isNumber && compare(+b, value)) {
  8146. result = true;
  8147. }
  8148. args.push(b);
  8149. c = e ? 'lt' : 'lte';
  8150. }
  8151. }
  8152. else {
  8153. if (value === +a) {
  8154. result = true;
  8155. }
  8156. args.push(a);
  8157. c = 'eq';
  8158. }
  8159. if (msg) {
  8160. if (suffix && msg[c + suffix]) {
  8161. c += suffix;
  8162. }
  8163. args[0] = msg[c];
  8164. }
  8165. return result || me._rules && ( me._rules[me._i].msg = me.renderMsg.apply(null, args) );
  8166. },
  8167. // Render message template
  8168. renderMsg: function() {
  8169. var args = arguments,
  8170. tpl = args[0],
  8171. i = args.length;
  8172. if (!tpl) return;
  8173. while (--i) {
  8174. tpl = tpl.replace('{' + i + '}', args[i]);
  8175. }
  8176. return tpl;
  8177. }
  8178. });
  8179. }
  8180. function Field(key, obj, oldField) {
  8181. this.key = key;
  8182. this.validator = context;
  8183. $.extend(this, oldField, obj);
  8184. }
  8185. FieldFactory.prototype = context;
  8186. Field.prototype = new FieldFactory();
  8187. return Field;
  8188. }
  8189. /**
  8190. * Create Rules
  8191. *
  8192. * @class
  8193. * @param {Object} obj rules
  8194. * @param {Object} context context
  8195. */
  8196. function Rules(obj, context) {
  8197. if (!isObject(obj)) return;
  8198. var k, that = context ? context === true ? this : context : Rules.prototype;
  8199. for (k in obj) {
  8200. if (_checkRuleName(k)) {
  8201. that[k] = _getRule(obj[k]);
  8202. }
  8203. }
  8204. }
  8205. /**
  8206. * Create Messages
  8207. *
  8208. * @class
  8209. * @param {Object} obj rules
  8210. * @param {Object} context context
  8211. */
  8212. function Messages(obj, context) {
  8213. if (!isObject(obj)) return;
  8214. var k, that = context ? context === true ? this : context : Messages.prototype;
  8215. for (k in obj) {
  8216. that[k] = obj[k];
  8217. }
  8218. }
  8219. // Rule converted factory
  8220. function _getRule(fn) {
  8221. switch ($.type(fn)) {
  8222. case 'function':
  8223. return fn;
  8224. case 'array':
  8225. var f = function() {
  8226. return fn[0].test(this.value) || fn[1] || false;
  8227. };
  8228. f.msg = fn[1];
  8229. return f;
  8230. case 'regexp':
  8231. return function() {
  8232. return fn.test(this.value);
  8233. };
  8234. }
  8235. }
  8236. // Get instance by an element
  8237. function _getInstance(el) {
  8238. var wrap, k, options;
  8239. if (!el || !el.tagName) return;
  8240. switch (el.tagName) {
  8241. case 'INPUT':
  8242. case 'SELECT':
  8243. case 'TEXTAREA':
  8244. case 'BUTTON':
  8245. case 'FIELDSET':
  8246. wrap = el.form || $(el).closest('.' + CLS_WRAPPER);
  8247. break;
  8248. case 'FORM':
  8249. wrap = el;
  8250. break;
  8251. default:
  8252. wrap = $(el).closest('.' + CLS_WRAPPER);
  8253. }
  8254. for (k in preinitialized) {
  8255. if ($(wrap).is(k)) {
  8256. options = preinitialized[k];
  8257. break;
  8258. }
  8259. }
  8260. return $(wrap).data(NS) || $(wrap)[NS](options).data(NS);
  8261. }
  8262. // Get custom rules on the node
  8263. function _getDataRule(el, method) {
  8264. var fn = trim(attr(el, DATA_RULE + '-' + method));
  8265. if ( fn && (fn = new Function('return ' + fn)()) ) {
  8266. return _getRule(fn);
  8267. }
  8268. }
  8269. // Get custom messages on the node
  8270. function _getDataMsg(el, field, m) {
  8271. var msg = field.msg,
  8272. item = field._r;
  8273. if ( isObject(msg) ) msg = msg[item];
  8274. if ( !isString(msg) ) {
  8275. msg = attr(el, DATA_MSG + '-' + item) || attr(el, DATA_MSG) || ( m ? isString(m) ? m : m[item] : '');
  8276. }
  8277. return msg;
  8278. }
  8279. // Get message position
  8280. function _getPos(str) {
  8281. var pos;
  8282. if (str) pos = rPos.exec(str);
  8283. return pos && pos[0];
  8284. }
  8285. // Check whether the element is checkbox or radio
  8286. function _checkable(el) {
  8287. return el.tagName === 'INPUT' && el.type === 'checkbox' || el.type === 'radio';
  8288. }
  8289. // Parse date string to timestamp
  8290. function _parseDate(str) {
  8291. return Date.parse(str.replace(/\.|\-/g, '/'));
  8292. }
  8293. // Rule name only allows alphanumeric characters and underscores
  8294. function _checkRuleName(name) {
  8295. return /^\w+$/.test(name);
  8296. }
  8297. // Translate field key to jQuery selector.
  8298. function _key2selector(key) {
  8299. var isID = key.charAt(0) === '#';
  8300. key = key.replace(/([:.{(|)}/\[\]])/g, '\\$1');
  8301. return isID ? key : '[name="'+ key +'"]:first';
  8302. }
  8303. // Fixed a issue cause by refresh page in IE.
  8304. $(window).on('beforeunload', function(){
  8305. this.focus();
  8306. });
  8307. $(document)
  8308. .on('click', ':submit', function(){
  8309. var input = this, attrNode;
  8310. if (!input.form) return;
  8311. // Shim for "formnovalidate"
  8312. attrNode = input.getAttributeNode('formnovalidate');
  8313. if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
  8314. novalidateonce = true;
  8315. }
  8316. })
  8317. // Automatic initializing form validation
  8318. .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
  8319. if ( attr(this, NOVALIDATE) !== null ) return;
  8320. var $form = $(this), me;
  8321. if ( !$form.data(NS) && (me = _getInstance(this)) ) {
  8322. if ( !$.isEmptyObject(me.fields) ) {
  8323. // Execute event handler
  8324. if (e.type === 'focusin') {
  8325. me._focusin(e);
  8326. } else {
  8327. me._submit(e);
  8328. }
  8329. } else {
  8330. attr(this, NOVALIDATE, NOVALIDATE);
  8331. $form.off(CLS_NS).removeData(NS);
  8332. }
  8333. }
  8334. });
  8335. new Messages({
  8336. fallback: 'This field is not valid.',
  8337. loading: 'Validating...'
  8338. });
  8339. // Built-in rules (global)
  8340. new Rules({
  8341. /**
  8342. * required
  8343. *
  8344. * @example:
  8345. required
  8346. required(jqSelector)
  8347. required(anotherRule)
  8348. required(not, -1)
  8349. required(from, .contact)
  8350. */
  8351. required: function(element, params) {
  8352. var me = this,
  8353. val = trim(me.value),
  8354. isValid = true;
  8355. if (params) {
  8356. if ( params.length === 1 ) {
  8357. if ( !_checkRuleName(params[0]) ) {
  8358. if (!val && !$(params[0], me.$el).length ) {
  8359. return null;
  8360. }
  8361. }
  8362. else if ( me.rules[params[0]] ) {
  8363. if ( !val && !me.test(element, params[0]) ) {
  8364. return null;
  8365. }
  8366. me._r = 'required'
  8367. }
  8368. }
  8369. else if ( params[0] === 'not' ) {
  8370. $.each(params.slice(1), function() {
  8371. return (isValid = val !== trim(this));
  8372. });
  8373. }
  8374. else if ( params[0] === 'from' ) {
  8375. var $elements = me.$el.find(params[1]),
  8376. VALIDATED = '_validated_',
  8377. ret;
  8378. isValid = $elements.filter(function(){
  8379. var field = me.getField(this);
  8380. return field && !!trim(field.getValue());
  8381. }).length >= (params[2] || 1);
  8382. if (isValid) {
  8383. if (!val) ret = null;
  8384. } else {
  8385. ret = _getDataMsg($elements[0], me) || false;
  8386. }
  8387. if ( !$(element).data(VALIDATED) ) {
  8388. $elements.data(VALIDATED, 1).each(function(){
  8389. if (element !== this) {
  8390. me._validate(this);
  8391. }
  8392. }).removeData(VALIDATED);
  8393. }
  8394. return ret;
  8395. }
  8396. }
  8397. return isValid && !!val;
  8398. },
  8399. /**
  8400. * integer
  8401. *
  8402. * @example:
  8403. integer
  8404. integer[+]
  8405. integer[+0]
  8406. integer[-]
  8407. integer[-0]
  8408. */
  8409. integer: function(element, params) {
  8410. var re, z = '0|',
  8411. p = '[1-9]\\d*',
  8412. key = params ? params[0] : '*';
  8413. switch (key) {
  8414. case '+':
  8415. re = p;
  8416. break;
  8417. case '-':
  8418. re = '-' + p;
  8419. break;
  8420. case '+0':
  8421. re = z + p;
  8422. break;
  8423. case '-0':
  8424. re = z + '-' + p;
  8425. break;
  8426. default:
  8427. re = z + '-?' + p;
  8428. }
  8429. re = '^(?:' + re + ')$';
  8430. return new RegExp(re).test(this.value) || (this.messages.integer && this.messages.integer[key]);
  8431. },
  8432. /**
  8433. * match another field
  8434. *
  8435. * @example:
  8436. match[password] Match the password field (two values ​​must be the same)
  8437. match[eq, password] Ditto
  8438. match[neq, count] The value must be not equal to the value of the count field
  8439. match[lt, count] The value must be less than the value of the count field
  8440. match[lte, count] The value must be less than or equal to the value of the count field
  8441. match[gt, count] The value must be greater than the value of the count field
  8442. match[gte, count] The value must be greater than or equal to the value of the count field
  8443. match[gte, startDate, date]
  8444. match[gte, startTime, time]
  8445. **/
  8446. match: function(element, params) {
  8447. if (!params) return;
  8448. var me = this,
  8449. isValid = true,
  8450. a, b,
  8451. key, msg, type = 'eq', parser,
  8452. selector2, elem2, field2;
  8453. if (params.length === 1) {
  8454. key = params[0];
  8455. } else {
  8456. type = params[0];
  8457. key = params[1];
  8458. }
  8459. selector2 = _key2selector(key);
  8460. elem2 = me.$el.find(selector2)[0];
  8461. // If the compared field is not exist
  8462. if (!elem2) return;
  8463. field2 = me.getField(elem2);
  8464. a = me.value;
  8465. b = field2.getValue();
  8466. if (!me._match) {
  8467. me.$el.on('valid'+CLS_NS_FIELD+CLS_NS, selector2, function(){
  8468. $(element).trigger('validate');
  8469. });
  8470. me._match = field2._match = 1;
  8471. }
  8472. // If both fields are blank
  8473. if (!me.required && a === '' && b === '') {
  8474. return null;
  8475. }
  8476. parser = params[2];
  8477. if (parser) {
  8478. if (/^date(time)?$/i.test(parser)) {
  8479. a = _parseDate(a);
  8480. b = _parseDate(b);
  8481. } else if (parser === 'time') {
  8482. a = +a.replace(/:/g, '');
  8483. b = +b.replace(/:/g, '');
  8484. }
  8485. }
  8486. // If the compared field is incorrect, we only ensure that this field is correct.
  8487. if (type !== 'eq' && !isNaN(+a) && isNaN(+b)) {
  8488. return true;
  8489. }
  8490. switch (type) {
  8491. case 'lt':
  8492. isValid = +a < +b; break;
  8493. case 'lte':
  8494. isValid = +a <= +b; break;
  8495. case 'gte':
  8496. isValid = +a >= +b; break;
  8497. case 'gt':
  8498. isValid = +a > +b; break;
  8499. case 'neq':
  8500. isValid = a !== b; break;
  8501. default:
  8502. isValid = a === b;
  8503. }
  8504. return isValid || (
  8505. isObject(me.messages.match)
  8506. && me.messages.match[type].replace( '{1}', me._getDisplay( elem2, field2.display || key ) )
  8507. );
  8508. },
  8509. /**
  8510. * range numbers
  8511. *
  8512. * @example:
  8513. range[0~99] Number 0-99
  8514. range[0~] Number greater than or equal to 0
  8515. range[~100] Number less than or equal to 100
  8516. **/
  8517. range: function(element, params) {
  8518. return this.getRangeMsg(this.value, params);
  8519. },
  8520. /**
  8521. * how many checkbox or radio inputs that checked
  8522. *
  8523. * @example:
  8524. checked; no empty, same to required
  8525. checked[1~3] 1-3 items
  8526. checked[1~] greater than 1 item
  8527. checked[~3] less than 3 items
  8528. checked[3] 3 items
  8529. **/
  8530. checked: function(element, params) {
  8531. if ( !_checkable(element) ) return;
  8532. var me = this,
  8533. elem, count;
  8534. if (element.name) {
  8535. count = me.$el.find('input[name="' + element.name + '"]').filter(function() {
  8536. var el = this;
  8537. if (!elem && _checkable(el)) elem = el;
  8538. return !el.disabled && el.checked;
  8539. }).length;
  8540. } else {
  8541. elem = element;
  8542. count = elem.checked;
  8543. }
  8544. if (params) {
  8545. return me.getRangeMsg(count, params);
  8546. } else {
  8547. return !!count || _getDataMsg(elem, me, '') || me.messages.required || false;
  8548. }
  8549. },
  8550. /**
  8551. * length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
  8552. *
  8553. * @example:
  8554. length[6~16] 6-16 characters
  8555. length[6~] Greater than 6 characters
  8556. length[~16] Less than 16 characters
  8557. length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
  8558. **/
  8559. length: function(element, params) {
  8560. var value = this.value,
  8561. len = (params[1] === 'true' ? value.replace(rDoubleBytes, 'xx') : value).length;
  8562. return this.getRangeMsg(len, params, (params[1] ? '_2' : ''));
  8563. },
  8564. /**
  8565. * remote validation
  8566. *
  8567. * @description
  8568. * remote([get:]url [, name1, [name2 ...]]);
  8569. * Adaptation three kinds of results (Front for the successful, followed by a failure):
  8570. 1. text:
  8571. '' 'Error Message'
  8572. 2. json:
  8573. {"ok": ""} {"error": "Error Message"}
  8574. 3. json wrapper:
  8575. {"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
  8576. * @example
  8577. The simplest: remote(path/to/server);
  8578. With parameters: remote(path/to/server, name1, name2, ...);
  8579. By GET: remote(get:path/to/server, name1, name2, ...);
  8580. Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
  8581. Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)
  8582. CORS remote(cors:path/to/server)
  8583. JSONP remote(jsonp:path/to/server)
  8584. */
  8585. remote: function(element, params) {
  8586. if (!params) return;
  8587. var me = this,
  8588. arr = rAjaxType.exec(params[0]),
  8589. rule = me._rules[me._i],
  8590. data = {},
  8591. queryString = '',
  8592. url = arr[3],
  8593. type = arr[2] || 'POST', // GET / POST
  8594. rType = (arr[1]||'').toLowerCase(), // CORS / JSONP
  8595. dataType;
  8596. rule.must = true;
  8597. data[element.name] = me.value;
  8598. // There are extra fields
  8599. if (params[1]) {
  8600. $.map(params.slice(1), function(name) {
  8601. var arr, key;
  8602. if (~name.indexOf('=')) {
  8603. queryString += '&' + name;
  8604. } else {
  8605. arr = name.split(':');
  8606. name = trim(arr[0]);
  8607. key = trim(arr[1]) || name;
  8608. data[ name ] = me.$el.find( _key2selector(key) ).val();
  8609. }
  8610. });
  8611. }
  8612. data = $.param(data) + queryString;
  8613. if (!me.must && rule.data && rule.data === data) {
  8614. return rule.result;
  8615. }
  8616. // Cross-domain request, force jsonp dataType
  8617. if (rType !== 'cors' && /^https?:/.test(url) && !~url.indexOf(location.host)) {
  8618. dataType = 'jsonp';
  8619. }
  8620. // Asynchronous validation need return jqXHR objects
  8621. return $.ajax({
  8622. url: url,
  8623. type: type,
  8624. data: data,
  8625. dataType: dataType
  8626. });
  8627. },
  8628. /**
  8629. * filter characters, direct filtration without prompting error (support custom regular expressions)
  8630. *
  8631. * @example
  8632. * filter filtering unsafe characters
  8633. * filter(regexp) filtering the "regexp" matched characters
  8634. */
  8635. filter: function(element, params) {
  8636. var value = this.value,
  8637. temp = value.replace( params ? (new RegExp('[' + params[0] + ']', 'gm')) : rUnsafe, '' );
  8638. if (temp !== value) this.setValue(temp);
  8639. }
  8640. });
  8641. /**
  8642. * Config global options
  8643. *
  8644. * @static config
  8645. * @param {Object} options
  8646. */
  8647. Validator.config = function(key, value) {
  8648. if (isObject(key)) {
  8649. $.each(key, _config);
  8650. }
  8651. else if (isString(key)) {
  8652. _config(key, value);
  8653. }
  8654. function _config(k, o) {
  8655. if (k === 'rules') {
  8656. new Rules(o);
  8657. }
  8658. else if (k === 'messages') {
  8659. new Messages(o);
  8660. }
  8661. else if (k in fieldDefaults) {
  8662. fieldDefaults[k] = o;
  8663. }
  8664. else {
  8665. defaults[k] = o;
  8666. }
  8667. }
  8668. };
  8669. /**
  8670. * Config themes
  8671. *
  8672. * @static setTheme
  8673. * @param {String|Object} name
  8674. * @param {Object} obj
  8675. * @example
  8676. .setTheme( themeName, themeOptions )
  8677. .setTheme( multiThemes )
  8678. */
  8679. Validator.setTheme = function(name, obj) {
  8680. if ( isObject(name) ) {
  8681. $.extend(true, themes, name);
  8682. }
  8683. else if ( isString(name) && isObject(obj) ) {
  8684. themes[name] = $.extend(themes[name], obj);
  8685. }
  8686. };
  8687. /**
  8688. * Resource loader
  8689. *
  8690. * @static load
  8691. * @param {String} str
  8692. * @example
  8693. .load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css
  8694. .load('local=zh-CN&css=') // load: local/zh-CN.js
  8695. .load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css
  8696. .load('local') // dito
  8697. */
  8698. Validator.load = function(str) {
  8699. if (!str) return;
  8700. var doc = document,
  8701. params = {},
  8702. node = doc.scripts[0],
  8703. dir, el, ONLOAD;
  8704. str.replace(/([^?=&]+)=([^&#]*)/g, function(m, key, value){
  8705. params[key] = value;
  8706. });
  8707. dir = params.dir || Validator.dir;
  8708. if (!Validator.css && params.css !== '') {
  8709. el = doc.createElement('link');
  8710. el.rel = 'stylesheet';
  8711. el.href = Validator.css = dir + 'jquery.validator.css';
  8712. node.parentNode.insertBefore(el, node);
  8713. }
  8714. if (!Validator.local && ~str.indexOf('local') && params.local !== '') {
  8715. Validator.local = (params.local || doc.documentElement.lang || 'en').replace('_','-');
  8716. Validator.pending = 1;
  8717. el = doc.createElement('script');
  8718. el.src = dir + 'local/' + Validator.local + '.js';
  8719. ONLOAD = 'onload' in el ? 'onload' : 'onreadystatechange';
  8720. el[ONLOAD] = function() {
  8721. if (!el.readyState || /loaded|complete/.test(el.readyState)) {
  8722. el = el[ONLOAD] = null;
  8723. delete Validator.pending;
  8724. $(window).triggerHandler('validatorready');
  8725. }
  8726. };
  8727. node.parentNode.insertBefore(el, node);
  8728. }
  8729. };
  8730. // Auto loading resources
  8731. (function(){
  8732. var scripts = document.scripts,
  8733. i = scripts.length, node, arr,
  8734. re = /(.*validator(?:\.min)?.js)(\?.*(?:local|css|dir)(?:=[\w\-]*)?)?/;
  8735. while (i-- && !arr) {
  8736. node = scripts[i];
  8737. arr = (node.hasAttribute ? node.src : node.getAttribute('src',4)||'').match(re);
  8738. }
  8739. if (!arr) return;
  8740. Validator.dir = arr[1].split('/').slice(0, -1).join('/')+'/';
  8741. Validator.load(arr[2]);
  8742. })();
  8743. return $[NS] = Validator;
  8744. }));
  8745. /*********************************
  8746. * Themes, rules, and i18n support
  8747. * Locale: Chinese; 中文
  8748. *********************************/
  8749. (function(factory) {
  8750. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  8751. typeof define === 'function' && define.amd ? define('validator-lang',['jquery'], factory) :
  8752. factory(jQuery);
  8753. }(function($) {
  8754. /* Global configuration
  8755. */
  8756. $.validator.config({
  8757. //stopOnError: true,
  8758. //focusCleanup: true,
  8759. //theme: 'yellow_right',
  8760. //timely: 2,
  8761. // Custom rules
  8762. rules: {
  8763. digits: [/^\d+$/, "请填写数字"]
  8764. ,letters: [/^[a-z]+$/i, "请填写字母"]
  8765. ,date: [/^\d{4}-\d{2}-\d{2}$/, "请填写有效的日期,格式:yyyy-mm-dd"]
  8766. ,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请填写有效的时间,00:00到23:59之间"]
  8767. ,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "请填写有效的邮箱"]
  8768. ,url: [/^(https?|s?ftp):\/\/\S+$/i, "请填写有效的网址"]
  8769. ,qq: [/^[1-9]\d{4,}$/, "请填写有效的QQ号"]
  8770. ,IDcard: [/^\d{6}(19|2\d)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)?$/, "请填写正确的身份证号码"]
  8771. ,tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "请填写有效的电话号码"]
  8772. ,mobile: [/^1[3-9]\d{9}$/, "请填写有效的手机号"]
  8773. ,zipcode: [/^\d{6}$/, "请检查邮政编码格式"]
  8774. ,chinese: [/^[\u0391-\uFFE5]+$/, "请填写中文字符"]
  8775. ,username: [/^\w{3,12}$/, "请填写3-12位数字、字母、下划线"]
  8776. ,password: [/^[\S]{6,16}$/, "请填写6-16位字符,不能包含空格"]
  8777. ,accept: function (element, params){
  8778. if (!params) return true;
  8779. var ext = params[0],
  8780. value = $(element).val();
  8781. return (ext === '*') ||
  8782. (new RegExp(".(?:" + ext + ")$", "i")).test(value) ||
  8783. this.renderMsg("只接受{1}后缀的文件", ext.replace(/\|/g, ','));
  8784. }
  8785. },
  8786. // Default error messages
  8787. messages: {
  8788. 0: "此处",
  8789. fallback: "{0}格式不正确",
  8790. loading: "正在验证...",
  8791. error: "网络异常",
  8792. timeout: "请求超时",
  8793. required: "{0}不能为空",
  8794. remote: "{0}已被使用",
  8795. integer: {
  8796. '*': "请填写整数",
  8797. '+': "请填写正整数",
  8798. '+0': "请填写正整数或0",
  8799. '-': "请填写负整数",
  8800. '-0': "请填写负整数或0"
  8801. },
  8802. match: {
  8803. eq: "{0}与{1}不一致",
  8804. neq: "{0}与{1}不能相同",
  8805. lt: "{0}必须小于{1}",
  8806. gt: "{0}必须大于{1}",
  8807. lte: "{0}不能大于{1}",
  8808. gte: "{0}不能小于{1}"
  8809. },
  8810. range: {
  8811. rg: "请填写{1}到{2}的数",
  8812. gte: "请填写不小于{1}的数",
  8813. lte: "请填写最大{1}的数",
  8814. gtlt: "请填写{1}到{2}之间的数",
  8815. gt: "请填写大于{1}的数",
  8816. lt: "请填写小于{1}的数"
  8817. },
  8818. checked: {
  8819. eq: "请选择{1}项",
  8820. rg: "请选择{1}到{2}项",
  8821. gte: "请至少选择{1}项",
  8822. lte: "请最多选择{1}项"
  8823. },
  8824. length: {
  8825. eq: "请填写{1}个字符",
  8826. rg: "请填写{1}到{2}个字符",
  8827. gte: "请至少填写{1}个字符",
  8828. lte: "请最多填写{1}个字符",
  8829. eq_2: "",
  8830. rg_2: "",
  8831. gte_2: "",
  8832. lte_2: ""
  8833. }
  8834. }
  8835. });
  8836. /* Themes
  8837. */
  8838. var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
  8839. $.validator.setTheme({
  8840. 'simple_right': {
  8841. formClass: 'n-simple',
  8842. msgClass: 'n-right'
  8843. },
  8844. 'simple_bottom': {
  8845. formClass: 'n-simple',
  8846. msgClass: 'n-bottom'
  8847. },
  8848. 'yellow_top': {
  8849. formClass: 'n-yellow',
  8850. msgClass: 'n-top',
  8851. msgArrow: TPL_ARROW
  8852. },
  8853. 'yellow_right': {
  8854. formClass: 'n-yellow',
  8855. msgClass: 'n-right',
  8856. msgArrow: TPL_ARROW
  8857. },
  8858. 'yellow_right_effect': {
  8859. formClass: 'n-yellow',
  8860. msgClass: 'n-right',
  8861. msgArrow: TPL_ARROW,
  8862. msgShow: function($msgbox, type){
  8863. var $el = $msgbox.children();
  8864. if ($el.is(':animated')) return;
  8865. if (type === 'error') {
  8866. $el.css({left: '20px', opacity: 0})
  8867. .delay(100).show().stop()
  8868. .animate({left: '-4px', opacity: 1}, 150)
  8869. .animate({left: '3px'}, 80)
  8870. .animate({left: 0}, 80);
  8871. } else {
  8872. $el.css({left: 0, opacity: 1}).fadeIn(200);
  8873. }
  8874. },
  8875. msgHide: function($msgbox, type){
  8876. var $el = $msgbox.children();
  8877. $el.stop().delay(100).show()
  8878. .animate({left: '20px', opacity: 0}, 300, function(){
  8879. $msgbox.hide();
  8880. });
  8881. }
  8882. }
  8883. });
  8884. }));
  8885. define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], function ($, undefined, Upload, Validator, undefined) {
  8886. var Form = {
  8887. config: {
  8888. fieldlisttpl: '<dd class="form-inline"><input type="text" name="<%=name%>[<%=index%>][key]" class="form-control" value="<%=key%>" placeholder="<%=options.keyPlaceholder||\'\'%>" size="10" /> <input type="text" name="<%=name%>[<%=index%>][value]" class="form-control" value="<%=value%>" placeholder="<%=options.valuePlaceholder||\'\'%>" /> <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>'
  8889. },
  8890. events: {
  8891. validator: function (form, success, error, submit) {
  8892. if (!form.is("form"))
  8893. return;
  8894. //绑定表单事件
  8895. form.validator($.extend({
  8896. rules: {
  8897. username: [/^\w{3,30}$/, __('Username must be 3 to 30 characters')],
  8898. password: [/^[\S]{6,30}$/, __('Password must be 6 to 30 characters')]
  8899. },
  8900. validClass: 'has-success',
  8901. invalidClass: 'has-error',
  8902. bindClassTo: '.form-group',
  8903. formClass: 'n-default n-bootstrap',
  8904. msgClass: 'n-right',
  8905. stopOnError: true,
  8906. display: function (elem) {
  8907. return $(elem).closest('.form-group').find(".control-label").text().replace(/\:/, '');
  8908. },
  8909. dataFilter: function (data) {
  8910. if (data.code === 1) {
  8911. return data.msg ? {"ok": data.msg} : '';
  8912. } else {
  8913. return data.msg;
  8914. }
  8915. },
  8916. target: function (input) {
  8917. var target = $(input).data("target");
  8918. if (target && $(target).size() > 0) {
  8919. return $(target);
  8920. }
  8921. var $formitem = $(input).closest('.form-group'),
  8922. $msgbox = $formitem.find('span.msg-box');
  8923. if (!$msgbox.length) {
  8924. return [];
  8925. }
  8926. return $msgbox;
  8927. },
  8928. valid: function (ret) {
  8929. var that = this, submitBtn = $(".layer-footer [type=submit]", form);
  8930. that.holdSubmit(true);
  8931. submitBtn.addClass("disabled");
  8932. //验证通过提交表单
  8933. var submitResult = Form.api.submit($(ret), function (data, ret) {
  8934. that.holdSubmit(false);
  8935. submitBtn.removeClass("disabled");
  8936. if (false === $(this).triggerHandler("success.form", [data, ret])) {
  8937. return false;
  8938. }
  8939. if (typeof success === 'function') {
  8940. if (false === success.call($(this), data, ret)) {
  8941. return false;
  8942. }
  8943. }
  8944. //提示及关闭当前窗口
  8945. var msg = ret.hasOwnProperty("msg") && ret.msg !== "" ? ret.msg : __('Operation completed');
  8946. parent.Toastr.success(msg);
  8947. parent.$(".btn-refresh").trigger("click");
  8948. var index = parent.Layer.getFrameIndex(window.name);
  8949. parent.Layer.close(index);
  8950. return false;
  8951. }, function (data, ret) {
  8952. that.holdSubmit(false);
  8953. if (false === $(this).triggerHandler("error.form", [data, ret])) {
  8954. return false;
  8955. }
  8956. submitBtn.removeClass("disabled");
  8957. if (typeof error === 'function') {
  8958. if (false === error.call($(this), data, ret)) {
  8959. return false;
  8960. }
  8961. }
  8962. }, submit);
  8963. //如果提交失败则释放锁定
  8964. if (!submitResult) {
  8965. that.holdSubmit(false);
  8966. submitBtn.removeClass("disabled");
  8967. }
  8968. return false;
  8969. }
  8970. }, form.data("validator-options") || {}));
  8971. //移除提交按钮的disabled类
  8972. $(".layer-footer [type=submit],.fixed-footer [type=submit],.normal-footer [type=submit]", form).removeClass("disabled");
  8973. //自定义关闭按钮事件
  8974. form.on("click", ".layer-close", function () {
  8975. var index = parent.Layer.getFrameIndex(window.name);
  8976. parent.Layer.close(index);
  8977. return false;
  8978. });
  8979. },
  8980. selectpicker: function (form) {
  8981. //绑定select元素事件
  8982. if ($(".selectpicker", form).size() > 0) {
  8983. require(['bootstrap-select', 'bootstrap-select-lang'], function () {
  8984. $('.selectpicker', form).selectpicker();
  8985. $(form).on("reset", function () {
  8986. setTimeout(function () {
  8987. $('.selectpicker').selectpicker('refresh').trigger("change");
  8988. }, 1);
  8989. });
  8990. });
  8991. }
  8992. },
  8993. selectpage: function (form) {
  8994. //绑定selectpage元素事件
  8995. if ($(".selectpage", form).size() > 0) {
  8996. require(['selectpage'], function () {
  8997. $('.selectpage', form).selectPage({
  8998. eAjaxSuccess: function (data) {
  8999. data.list = typeof data.rows !== 'undefined' ? data.rows : (typeof data.list !== 'undefined' ? data.list : []);
  9000. data.totalRow = typeof data.total !== 'undefined' ? data.total : (typeof data.totalRow !== 'undefined' ? data.totalRow : data.list.length);
  9001. return data;
  9002. }
  9003. });
  9004. });
  9005. //给隐藏的元素添加上validate验证触发事件
  9006. $(document).on("change", ".sp_hidden", function () {
  9007. $(this).trigger("validate");
  9008. });
  9009. $(document).on("change", ".sp_input", function () {
  9010. $(this).closest(".sp_container").find(".sp_hidden").trigger("change");
  9011. });
  9012. $(form).on("reset", function () {
  9013. setTimeout(function () {
  9014. $('.selectpage', form).selectPageClear();
  9015. }, 1);
  9016. });
  9017. }
  9018. },
  9019. cxselect: function (form) {
  9020. //绑定cxselect元素事件
  9021. if ($("[data-toggle='cxselect']", form).size() > 0) {
  9022. require(['cxselect'], function () {
  9023. $.cxSelect.defaults.jsonName = 'name';
  9024. $.cxSelect.defaults.jsonValue = 'value';
  9025. $.cxSelect.defaults.jsonSpace = 'data';
  9026. $("[data-toggle='cxselect']", form).cxSelect();
  9027. });
  9028. }
  9029. },
  9030. citypicker: function (form) {
  9031. //绑定城市远程插件
  9032. if ($("[data-toggle='city-picker']", form).size() > 0) {
  9033. require(['citypicker'], function () {
  9034. $(form).on("reset", function () {
  9035. setTimeout(function () {
  9036. $("[data-toggle='city-picker']").citypicker('refresh');
  9037. }, 1);
  9038. });
  9039. });
  9040. }
  9041. },
  9042. datetimepicker: function (form) {
  9043. //绑定日期时间元素事件
  9044. if ($(".datetimepicker", form).size() > 0) {
  9045. require(['bootstrap-datetimepicker'], function () {
  9046. var options = {
  9047. format: 'YYYY-MM-DD HH:mm:ss',
  9048. icons: {
  9049. time: 'fa fa-clock-o',
  9050. date: 'fa fa-calendar',
  9051. up: 'fa fa-chevron-up',
  9052. down: 'fa fa-chevron-down',
  9053. previous: 'fa fa-chevron-left',
  9054. next: 'fa fa-chevron-right',
  9055. today: 'fa fa-history',
  9056. clear: 'fa fa-trash',
  9057. close: 'fa fa-remove'
  9058. },
  9059. showTodayButton: true,
  9060. showClose: true
  9061. };
  9062. $('.datetimepicker', form).parent().css('position', 'relative');
  9063. $('.datetimepicker', form).datetimepicker(options).on('dp.change', function (e) {
  9064. $(this, document).trigger("changed");
  9065. });
  9066. });
  9067. }
  9068. },
  9069. daterangepicker: function (form) {
  9070. //绑定日期时间元素事件
  9071. if ($(".datetimerange", form).size() > 0) {
  9072. require(['bootstrap-daterangepicker'], function () {
  9073. var ranges = {};
  9074. ranges[__('Today')] = [Moment().startOf('day'), Moment().endOf('day')];
  9075. ranges[__('Yesterday')] = [Moment().subtract(1, 'days').startOf('day'), Moment().subtract(1, 'days').endOf('day')];
  9076. ranges[__('Last 7 Days')] = [Moment().subtract(6, 'days').startOf('day'), Moment().endOf('day')];
  9077. ranges[__('Last 30 Days')] = [Moment().subtract(29, 'days').startOf('day'), Moment().endOf('day')];
  9078. ranges[__('This Month')] = [Moment().startOf('month'), Moment().endOf('month')];
  9079. ranges[__('Last Month')] = [Moment().subtract(1, 'month').startOf('month'), Moment().subtract(1, 'month').endOf('month')];
  9080. var options = {
  9081. timePicker: false,
  9082. autoUpdateInput: false,
  9083. timePickerSeconds: true,
  9084. timePicker24Hour: true,
  9085. autoApply: true,
  9086. locale: {
  9087. format: 'YYYY-MM-DD HH:mm:ss',
  9088. customRangeLabel: __("Custom Range"),
  9089. applyLabel: __("Apply"),
  9090. cancelLabel: __("Clear"),
  9091. },
  9092. ranges: ranges,
  9093. };
  9094. var origincallback = function (start, end) {
  9095. $(this.element).val(start.format(this.locale.format) + " - " + end.format(this.locale.format));
  9096. $(this.element).trigger('blur');
  9097. };
  9098. $(".datetimerange", form).each(function () {
  9099. var callback = typeof $(this).data('callback') == 'function' ? $(this).data('callback') : origincallback;
  9100. $(this).on('apply.daterangepicker', function (ev, picker) {
  9101. callback.call(picker, picker.startDate, picker.endDate);
  9102. });
  9103. $(this).on('cancel.daterangepicker', function (ev, picker) {
  9104. $(this).val('').trigger('blur');
  9105. });
  9106. $(this).daterangepicker($.extend(true, options, $(this).data() || {}, $(this).data("daterangepicker-options") || {}));
  9107. });
  9108. });
  9109. }
  9110. },
  9111. /**
  9112. * 绑定上传事件
  9113. * @param form
  9114. * @deprecated Use faupload instead.
  9115. */
  9116. plupload: function (form) {
  9117. Form.events.faupload(form);
  9118. },
  9119. /**
  9120. * 绑定上传事件
  9121. * @param form
  9122. */
  9123. faupload: function (form) {
  9124. //绑定上传元素事件
  9125. if ($(".plupload,.faupload", form).size() > 0) {
  9126. Upload.api.upload($(".plupload,.faupload", form));
  9127. }
  9128. },
  9129. faselect: function (form) {
  9130. //绑定fachoose选择附件事件
  9131. if ($(".faselect,.fachoose", form).size() > 0) {
  9132. $(".faselect,.fachoose", form).off('click').on('click', function () {
  9133. var that = this;
  9134. var multiple = $(this).data("multiple") ? $(this).data("multiple") : false;
  9135. var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : '';
  9136. var admin_id = $(this).data("admin-id") ? $(this).data("admin-id") : '';
  9137. var user_id = $(this).data("user-id") ? $(this).data("user-id") : '';
  9138. mimetype = mimetype.replace(/\/\*/ig, '/');
  9139. var url = $(this).data("url") ? $(this).data("url") : (typeof Backend !== 'undefined' ? "general/attachment/select" : "user/attachment");
  9140. parent.Fast.api.open(url + "?element_id=" + $(this).attr("id") + "&multiple=" + multiple + "&mimetype=" + mimetype + "&admin_id=" + admin_id + "&user_id=" + user_id, __('Choose'), {
  9141. callback: function (data) {
  9142. var button = $("#" + $(that).attr("id"));
  9143. var maxcount = $(button).data("maxcount");
  9144. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  9145. maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
  9146. if (input_id && data.multiple) {
  9147. var urlArr = [];
  9148. var inputObj = $("#" + input_id);
  9149. var value = $.trim(inputObj.val());
  9150. if (value !== "") {
  9151. urlArr.push(inputObj.val());
  9152. }
  9153. var nums = value === '' ? 0 : value.split(/\,/).length;
  9154. var files = data.url !== "" ? data.url.split(/\,/) : [];
  9155. $.each(files, function (i, j) {
  9156. var url = Config.upload.fullmode ? Fast.api.cdnurl(j) : j;
  9157. urlArr.push(url);
  9158. });
  9159. if (maxcount > 0) {
  9160. var remains = maxcount - nums;
  9161. if (files.length > remains) {
  9162. Toastr.error(__('You can choose up to %d file%s', remains));
  9163. return false;
  9164. }
  9165. }
  9166. var result = urlArr.join(",");
  9167. inputObj.val(result).trigger("change").trigger("validate");
  9168. } else {
  9169. var url = Config.upload.fullmode ? Fast.api.cdnurl(data.url) : data.url;
  9170. $("#" + input_id).val(url).trigger("change").trigger("validate");
  9171. }
  9172. }
  9173. });
  9174. return false;
  9175. });
  9176. }
  9177. },
  9178. fieldlist: function (form) {
  9179. //绑定fieldlist
  9180. if ($(".fieldlist", form).size() > 0) {
  9181. require(['dragsort', 'template'], function (undefined, Template) {
  9182. //刷新隐藏textarea的值
  9183. var refresh = function (container) {
  9184. var data = {};
  9185. var name = container.data("name");
  9186. var textarea = $("textarea[name='" + name + "']", form);
  9187. var template = container.data("template");
  9188. $.each($("input,select,textarea", container).serializeArray(), function (i, j) {
  9189. var reg = /\[(\w+)\]\[(\w+)\]$/g;
  9190. var match = reg.exec(j.name);
  9191. if (!match)
  9192. return true;
  9193. match[1] = "x" + parseInt(match[1]);
  9194. if (typeof data[match[1]] == 'undefined') {
  9195. data[match[1]] = {};
  9196. }
  9197. data[match[1]][match[2]] = j.value;
  9198. });
  9199. var result = template ? [] : {};
  9200. $.each(data, function (i, j) {
  9201. if (j) {
  9202. if (!template) {
  9203. if (j.key != '') {
  9204. result[j.key] = j.value;
  9205. }
  9206. } else {
  9207. result.push(j);
  9208. }
  9209. }
  9210. });
  9211. textarea.val(JSON.stringify(result));
  9212. };
  9213. //追加一行数据
  9214. var append = function (container, row, initial) {
  9215. var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
  9216. var index = container.data("index");
  9217. var name = container.data("name");
  9218. var template = container.data("template");
  9219. var data = container.data();
  9220. index = index ? parseInt(index) : 0;
  9221. container.data("index", index + 1);
  9222. row = row ? row : {};
  9223. row = typeof row.key === 'undefined' || typeof row.value === 'undefined' ? {key: '', value: row} : row;
  9224. var options = container.data("fieldlist-options") || {};
  9225. var vars = {index: index, name: name, data: data, options: options, key: row.key, value: row.value, row: row.value};
  9226. var html = template ? Template(template, vars) : Template.render(Form.config.fieldlisttpl, vars);
  9227. var obj = $(html);
  9228. if ((options.deleteBtn === false || options.removeBtn === false) && initial)
  9229. obj.find(".btn-remove").remove();
  9230. if (options.dragsortBtn === false && initial)
  9231. obj.find(".btn-dragsort").remove();
  9232. if ((options.readonlyKey === true || options.disableKey === true) && initial) {
  9233. obj.find("input[name$='[key]']").prop("readonly", true);
  9234. }
  9235. obj.attr("fieldlist-item", true);
  9236. obj.insertAfter($(tagName + "[fieldlist-item]", container).length > 0 ? $(tagName + "[fieldlist-item]:last", container) : $(tagName + ":first", container));
  9237. if ($(".btn-append,.append", container).length > 0) {
  9238. //兼容旧版本事件
  9239. $(".btn-append,.append", container).trigger("fa.event.appendfieldlist", obj);
  9240. } else {
  9241. //新版本事件
  9242. container.trigger("fa.event.appendfieldlist", obj);
  9243. }
  9244. return obj;
  9245. };
  9246. var fieldlist = $(".fieldlist", form);
  9247. //监听文本框改变事件
  9248. $(document).on('change keyup changed', ".fieldlist input,.fieldlist textarea,.fieldlist select", function () {
  9249. var container = $(this).closest(".fieldlist");
  9250. refresh(container);
  9251. });
  9252. //追加控制(点击按钮)
  9253. fieldlist.on("click", ".btn-append,.append", function (e, row) {
  9254. var container = $(this).closest(".fieldlist");
  9255. append(container, row);
  9256. // refresh(container);
  9257. });
  9258. //移除控制(点击按钮)
  9259. fieldlist.on("click", ".btn-remove", function () {
  9260. var container = $(this).closest(".fieldlist");
  9261. var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
  9262. $(this).closest(tagName).remove();
  9263. refresh(container);
  9264. });
  9265. //追加控制(通过事件)
  9266. fieldlist.on("fa.event.appendtofieldlist", function (e, row) {
  9267. var container = $(this);
  9268. append(container, row);
  9269. refresh(container);
  9270. });
  9271. //根据textarea内容重新渲染
  9272. fieldlist.on("fa.event.refreshfieldlist", function () {
  9273. var container = $(this);
  9274. var textarea = $("textarea[name='" + container.data("name") + "']", form);
  9275. //先清空已有的数据
  9276. $("[fieldlist-item]", container).remove();
  9277. var json = {};
  9278. try {
  9279. json = JSON.parse(textarea.val());
  9280. } catch (e) {
  9281. }
  9282. $.each(json, function (i, j) {
  9283. append(container, {key: i, value: j}, true);
  9284. });
  9285. });
  9286. //拖拽排序
  9287. fieldlist.each(function () {
  9288. var container = $(this);
  9289. var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
  9290. container.dragsort({
  9291. itemSelector: tagName,
  9292. dragSelector: ".btn-dragsort",
  9293. dragEnd: function () {
  9294. refresh(container);
  9295. },
  9296. placeHolderTemplate: $("<" + tagName + "/>")
  9297. });
  9298. if (typeof container.data("options") === 'object' && container.data("options").appendBtn === false) {
  9299. $(".btn-append,.append", container).hide();
  9300. }
  9301. $("textarea[name='" + container.data("name") + "']", form).on("fa.event.refreshfieldlist", function () {
  9302. //兼容旧版本事件
  9303. $(this).closest(".fieldlist").trigger("fa.event.refreshfieldlist");
  9304. });
  9305. });
  9306. fieldlist.trigger("fa.event.refreshfieldlist");
  9307. });
  9308. }
  9309. },
  9310. switcher: function (form) {
  9311. form.on("click", "[data-toggle='switcher']", function () {
  9312. if ($(this).hasClass("disabled")) {
  9313. return false;
  9314. }
  9315. var switcher = $.proxy(function () {
  9316. var input = $(this).prev("input");
  9317. input = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : input;
  9318. if (input.size() > 0) {
  9319. var yes = $(this).data("yes");
  9320. var no = $(this).data("no");
  9321. if (input.val() == yes) {
  9322. input.val(no);
  9323. $("i", this).addClass("fa-flip-horizontal text-gray");
  9324. } else {
  9325. input.val(yes);
  9326. $("i", this).removeClass("fa-flip-horizontal text-gray");
  9327. }
  9328. input.trigger('change');
  9329. }
  9330. }, this);
  9331. if (typeof $(this).data("confirm") !== 'undefined') {
  9332. Layer.confirm($(this).data("confirm"), function (index) {
  9333. switcher();
  9334. Layer.close(index);
  9335. });
  9336. } else {
  9337. switcher();
  9338. }
  9339. return false;
  9340. });
  9341. },
  9342. bindevent: function (form) {
  9343. },
  9344. slider: function (form) {
  9345. if ($(".slider", form).size() > 0) {
  9346. require(['bootstrap-slider'], function () {
  9347. $('.slider').removeClass('hidden').css('width', function (index, value) {
  9348. return $(this).parents('.form-control').width();
  9349. }).slider().on('slide', function (ev) {
  9350. var data = $(this).data();
  9351. if (typeof data.unit !== 'undefined') {
  9352. $(this).parents('.form-control').siblings('.value').text(ev.value + data.unit);
  9353. }
  9354. });
  9355. });
  9356. }
  9357. },
  9358. tagsinput: function (form) {
  9359. if ($("[data-role='tagsinput']", form).size() > 0) {
  9360. require(['tagsinput', 'autocomplete'], function () {
  9361. $("[data-role='tagsinput']").tagsinput();
  9362. });
  9363. }
  9364. },
  9365. autocomplete: function (form) {
  9366. if ($("[data-role='autocomplete']", form).size() > 0) {
  9367. require(['autocomplete'], function () {
  9368. $("[data-role='autocomplete']").autocomplete();
  9369. });
  9370. }
  9371. },
  9372. favisible: function (form) {
  9373. if ($("[data-favisible]", form).length == 0) {
  9374. return;
  9375. }
  9376. var checkCondition = function (condition) {
  9377. var conditionArr = condition.split(/&&/);
  9378. var success = 0;
  9379. var baseregex = /^([a-z0-9\_]+)([>|<|=|\!]=?)(.*)$/i, strregex = /^('|")(.*)('|")$/, regregex = /^regex:(.*)$/;
  9380. // @formatter:off
  9381. var operator_result = {
  9382. '>': function(a, b) { return a > b; },
  9383. '>=': function(a, b) { return a >= b; },
  9384. '<': function(a, b) { return a < b; },
  9385. '<=': function(a, b) { return a <= b; },
  9386. '==': function(a, b) { return a == b; },
  9387. '!=': function(a, b) { return a != b; },
  9388. 'in': function(a, b) { return b.split(/\,/).indexOf(a) > -1; },
  9389. 'regex': function(a, b) {
  9390. var regParts = b.match(/^\/(.*?)\/([gim]*)$/);
  9391. var regexp = regParts ? new RegExp(regParts[1], regParts[2]) : new RegExp(b);
  9392. return regexp.test(a);
  9393. }
  9394. };
  9395. // @formatter:on
  9396. var dataArr = form.serializeArray(), dataObj = {};
  9397. $(dataArr).each(function (i, field) {
  9398. dataObj[field.name] = field.value;
  9399. });
  9400. $.each(conditionArr, function (i, item) {
  9401. var basematches = baseregex.exec(item);
  9402. if (basematches) {
  9403. var name = basematches[1], operator = basematches[2], value = basematches[3].toString();
  9404. if (operator === '=') {
  9405. var strmatches = strregex.exec(value);
  9406. operator = strmatches ? '==' : 'in';
  9407. value = strmatches ? strmatches[2] : value;
  9408. }
  9409. var regmatches = regregex.exec(value);
  9410. if (regmatches) {
  9411. operator = 'regex';
  9412. value = regmatches[1];
  9413. }
  9414. var chkname = "row[" + name + "]";
  9415. if (typeof dataObj[chkname] === 'undefined') {
  9416. return false;
  9417. }
  9418. var objvalue = dataObj[chkname];
  9419. if (['>', '>=', '<', '<='].indexOf(operator) > -1) {
  9420. objvalue = parseFloat(objvalue);
  9421. value = parseFloat(value);
  9422. }
  9423. var result = operator_result[operator](objvalue, value);
  9424. success += (result ? 1 : 0);
  9425. }
  9426. });
  9427. return success === conditionArr.length;
  9428. };
  9429. form.on("keyup change click configchange", "input,select", function () {
  9430. $("[data-favisible][data-favisible!='']", form).each(function () {
  9431. var visible = $(this).data("favisible");
  9432. var groupArr = visible.split(/\|\|/);
  9433. var success = 0;
  9434. $.each(groupArr, function (i, j) {
  9435. if (checkCondition(j)) {
  9436. success++;
  9437. }
  9438. });
  9439. if (success > 0) {
  9440. $(this).removeClass("hidden");
  9441. } else {
  9442. $(this).addClass("hidden");
  9443. }
  9444. });
  9445. });
  9446. //追加上忽略元素
  9447. setTimeout(function () {
  9448. form.data('validator').options.ignore += ((form.data('validator').options.ignore ? ',' : '') + '[data-favisible] :hidden,[data-favisible]:hidden');
  9449. }, 0);
  9450. $("input,select", form).trigger("configchange");
  9451. }
  9452. },
  9453. api: {
  9454. submit: function (form, success, error, submit) {
  9455. if (form.size() === 0) {
  9456. Toastr.error("表单未初始化完成,无法提交");
  9457. return false;
  9458. }
  9459. if (typeof submit === 'function') {
  9460. if (false === submit.call(form, success, error)) {
  9461. return false;
  9462. }
  9463. }
  9464. var type = form.attr("method") ? form.attr("method").toUpperCase() : 'GET';
  9465. type = type && (type === 'GET' || type === 'POST') ? type : 'GET';
  9466. url = form.attr("action");
  9467. url = url ? url : location.href;
  9468. //修复当存在多选项元素时提交的BUG
  9469. var params = {};
  9470. var multipleList = $("[name$='[]']", form);
  9471. if (multipleList.size() > 0) {
  9472. var postFields = form.serializeArray().map(function (obj) {
  9473. return $(obj).prop("name");
  9474. });
  9475. $.each(multipleList, function (i, j) {
  9476. if (postFields.indexOf($(this).prop("name")) < 0) {
  9477. params[$(this).prop("name")] = '';
  9478. }
  9479. });
  9480. }
  9481. //调用Ajax请求方法
  9482. Fast.api.ajax({
  9483. type: type,
  9484. url: url,
  9485. data: form.serialize() + (Object.keys(params).length > 0 ? '&' + $.param(params) : ''),
  9486. dataType: 'json',
  9487. complete: function (xhr) {
  9488. var token = xhr.getResponseHeader('__token__');
  9489. if (token) {
  9490. $("input[name='__token__']").val(token);
  9491. }
  9492. }
  9493. }, function (data, ret) {
  9494. $('.form-group', form).removeClass('has-feedback has-success has-error');
  9495. if (data && typeof data === 'object') {
  9496. //刷新客户端token
  9497. if (typeof data.token !== 'undefined') {
  9498. $("input[name='__token__']").val(data.token);
  9499. }
  9500. //调用客户端事件
  9501. if (typeof data.callback !== 'undefined' && typeof data.callback === 'function') {
  9502. data.callback.call(form, data);
  9503. }
  9504. }
  9505. if (typeof success === 'function') {
  9506. if (false === success.call(form, data, ret)) {
  9507. return false;
  9508. }
  9509. }
  9510. }, function (data, ret) {
  9511. if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
  9512. $("input[name='__token__']").val(data.token);
  9513. }
  9514. if (typeof error === 'function') {
  9515. if (false === error.call(form, data, ret)) {
  9516. return false;
  9517. }
  9518. }
  9519. });
  9520. return true;
  9521. },
  9522. bindevent: function (form, success, error, submit) {
  9523. form = typeof form === 'object' ? form : $(form);
  9524. var events = Form.events;
  9525. events.bindevent(form);
  9526. events.validator(form, success, error, submit);
  9527. events.selectpicker(form);
  9528. events.daterangepicker(form);
  9529. events.selectpage(form);
  9530. events.cxselect(form);
  9531. events.citypicker(form);
  9532. events.datetimepicker(form);
  9533. events.faupload(form);
  9534. events.faselect(form);
  9535. events.fieldlist(form);
  9536. events.slider(form);
  9537. events.switcher(form);
  9538. events.tagsinput(form);
  9539. events.autocomplete(form);
  9540. events.favisible(form);
  9541. },
  9542. custom: {}
  9543. },
  9544. };
  9545. return Form;
  9546. });
  9547. /**
  9548. * FastAdmin通用搜索
  9549. *
  9550. * @author: pppscn <35696959@qq.com>
  9551. * @update 2017-05-07 <https://gitee.com/pp/fastadmin>
  9552. *
  9553. * @author: Karson <karson@fastadmin.net>
  9554. * @update 2018-04-05 <https://gitee.com/karson/fastadmin>
  9555. */
  9556. !function ($) {
  9557. 'use strict';
  9558. var ColumnsForSearch = [];
  9559. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  9560. var initCommonSearch = function (pColumns, that) {
  9561. var vFormCommon = createFormCommon(pColumns, that);
  9562. var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden");
  9563. vModal += vFormCommon;
  9564. vModal += "</div>";
  9565. that.$container.prepend($(vModal));
  9566. that.$commonsearch = $(".commonsearch-table", that.$container);
  9567. var form = $("form.form-commonsearch", that.$commonsearch);
  9568. require(['form'], function (Form) {
  9569. Form.api.bindevent(form);
  9570. form.validator("destroy");
  9571. });
  9572. // 表单提交
  9573. form.on("submit", function (event) {
  9574. event.preventDefault();
  9575. that.onCommonSearch();
  9576. return false;
  9577. });
  9578. // 重置搜索
  9579. form.on("click", "button[type=reset]", function (event) {
  9580. form[0].reset();
  9581. setTimeout(function () {
  9582. that.onCommonSearch();
  9583. }, 0);
  9584. });
  9585. };
  9586. var createFormCommon = function (pColumns, that) {
  9587. // 如果有使用模板则直接返回模板的内容
  9588. if (that.options.searchFormTemplate) {
  9589. return Template(that.options.searchFormTemplate, {columns: pColumns, table: that});
  9590. }
  9591. var htmlForm = [];
  9592. htmlForm.push(sprintf('<form class="form-horizontal form-commonsearch" novalidate method="post" action="%s" >', that.options.actionForm));
  9593. htmlForm.push('<fieldset>');
  9594. if (that.options.titleForm.length > 0)
  9595. htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
  9596. htmlForm.push('<div class="row">');
  9597. for (var i in pColumns) {
  9598. var vObjCol = pColumns[i];
  9599. if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
  9600. var query = Fast.api.query(vObjCol.field);
  9601. var operate = Fast.api.query(vObjCol.field + "-operate");
  9602. var renderDefault = that.options.renderDefault && (typeof vObjCol.renderDefault == 'undefined' || vObjCol.renderDefault);
  9603. vObjCol.defaultValue = renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue);
  9604. vObjCol.operate = renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate);
  9605. ColumnsForSearch.push(vObjCol);
  9606. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  9607. htmlForm.push(sprintf('<label for="%s" class="control-label col-xs-4">%s</label>', vObjCol.field, vObjCol.title));
  9608. htmlForm.push('<div class="col-xs-8">');
  9609. vObjCol.operate = vObjCol.operate ? vObjCol.operate.toUpperCase() : '=';
  9610. 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));
  9611. var addClass = typeof vObjCol.addClass === 'undefined' ? (typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass) : 'form-control ' + vObjCol.addClass;
  9612. var extend = typeof vObjCol.extend === 'undefined' ? '' : vObjCol.extend;
  9613. var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style);
  9614. extend = typeof vObjCol.data !== 'undefined' && extend == '' ? vObjCol.data : extend;
  9615. extend = typeof vObjCol.autocomplete !== 'undefined' ? extend + ' autocomplete="' + (vObjCol.autocomplete === false || vObjCol.autocomplete === 'off' ? 'off' : 'on') + '"' : extend;
  9616. if (vObjCol.searchList) {
  9617. if (typeof vObjCol.searchList === 'function') {
  9618. htmlForm.push(vObjCol.searchList.call(this, vObjCol));
  9619. } else {
  9620. var optionList = [sprintf('<option value="">%s</option>', that.options.formatCommonChoose())];
  9621. if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') {
  9622. (function (vObjCol, that) {
  9623. $.when(vObjCol.searchList).done(function (ret) {
  9624. var searchList = [];
  9625. if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) {
  9626. searchList = ret.data.searchlist;
  9627. } else if (ret.constructor === Array || ret.constructor === Object) {
  9628. searchList = ret;
  9629. }
  9630. var optionList = createOptionList(searchList, vObjCol, that);
  9631. $("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).html(optionList.join('')).trigger("change");
  9632. });
  9633. })(vObjCol, that);
  9634. } else {
  9635. optionList = createOptionList(vObjCol.searchList, vObjCol, that);
  9636. }
  9637. htmlForm.push(sprintf('<select class="%s" name="%s" %s %s>%s</select>', addClass, vObjCol.field, style, extend, optionList.join('')));
  9638. }
  9639. } else {
  9640. var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder;
  9641. var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type;
  9642. var defaultValue = typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue;
  9643. if (/BETWEEN$/.test(vObjCol.operate)) {
  9644. var defaultValueArr = defaultValue.toString().match(/\|/) ? defaultValue.split('|') : ['', ''];
  9645. var placeholderArr = placeholder.toString().match(/\|/) ? placeholder.split('|') : [placeholder, placeholder];
  9646. htmlForm.push('<div class="row row-between">');
  9647. 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));
  9648. 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));
  9649. htmlForm.push('</div>');
  9650. } else {
  9651. 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));
  9652. }
  9653. }
  9654. htmlForm.push('</div>');
  9655. htmlForm.push('</div>');
  9656. }
  9657. }
  9658. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  9659. htmlForm.push(createFormBtn(that).join(''));
  9660. htmlForm.push('</div>');
  9661. htmlForm.push('</div>');
  9662. htmlForm.push('</fieldset>');
  9663. htmlForm.push('</form>');
  9664. return htmlForm.join('');
  9665. };
  9666. var createFormBtn = function (that) {
  9667. var htmlBtn = [];
  9668. var searchSubmit = that.options.formatCommonSubmitButton();
  9669. var searchReset = that.options.formatCommonResetButton();
  9670. htmlBtn.push('<div class="col-sm-8 col-xs-offset-4">');
  9671. htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" formnovalidate>%s</button> ', searchSubmit));
  9672. htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
  9673. htmlBtn.push('</div>');
  9674. return htmlBtn;
  9675. };
  9676. var createOptionList = function (searchList, vObjCol, that) {
  9677. var isArray = searchList.constructor === Array;
  9678. var optionList = [];
  9679. optionList.push(sprintf('<option value="">%s</option>', that.options.formatCommonChoose()));
  9680. $.each(searchList, function (key, value) {
  9681. if (value.constructor === Object) {
  9682. key = value.id;
  9683. value = value.name;
  9684. } else {
  9685. key = isArray ? value : key;
  9686. }
  9687. optionList.push(sprintf("<option value='" + key + "' %s>" + value + "</option>", key == vObjCol.defaultValue ? 'selected' : ''));
  9688. });
  9689. return optionList;
  9690. };
  9691. var isSearchAvailble = function (that) {
  9692. //只支持服务端搜索
  9693. if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) {
  9694. return false;
  9695. }
  9696. return true;
  9697. };
  9698. var getSearchQuery = function (that, removeempty) {
  9699. var op = {};
  9700. var filter = {};
  9701. var value = '';
  9702. $("form.form-commonsearch .operate", that.$commonsearch).each(function (i) {
  9703. var name = $(this).data("name");
  9704. var sym = $(this).is("select") ? $("option:selected", this).val() : $(this).val().toUpperCase();
  9705. var obj = $("[name='" + name + "']", that.$commonsearch);
  9706. if (obj.size() == 0)
  9707. return true;
  9708. var vObjCol = ColumnsForSearch[i];
  9709. var process = !that.options.searchFormTemplate && vObjCol && typeof vObjCol.process == 'function' ? vObjCol.process : null;
  9710. if (obj.size() > 1) {
  9711. if (/BETWEEN$/.test(sym)) {
  9712. var value_begin = $.trim($("[name='" + name + "']:first", that.$commonsearch).val()),
  9713. value_end = $.trim($("[name='" + name + "']:last", that.$commonsearch).val());
  9714. if (value_begin.length || value_end.length) {
  9715. if (process) {
  9716. value_begin = process(value_begin, 'begin');
  9717. value_end = process(value_end, 'end');
  9718. }
  9719. value = value_begin + ',' + value_end;
  9720. } else {
  9721. value = '';
  9722. }
  9723. //如果是时间筛选,将operate置为RANGE
  9724. if ($("[name='" + name + "']:first", that.$commonsearch).hasClass("datetimepicker")) {
  9725. sym = 'RANGE';
  9726. }
  9727. } else {
  9728. value = $("[name='" + name + "']:checked", that.$commonsearch).val();
  9729. value = process ? process(value) : value;
  9730. }
  9731. } else {
  9732. value = process ? process(obj.val()) : obj.val();
  9733. }
  9734. if (removeempty && (value == '' || value == null || ($.isArray(value) && value.length == 0)) && !sym.match(/null/i)) {
  9735. return true;
  9736. }
  9737. op[name] = sym;
  9738. filter[name] = value;
  9739. });
  9740. return {op: op, filter: filter};
  9741. };
  9742. var getQueryParams = function (params, searchQuery, removeempty) {
  9743. params.filter = typeof params.filter === 'Object' ? params.filter : (params.filter ? JSON.parse(params.filter) : {});
  9744. params.op = typeof params.op === 'Object' ? params.op : (params.op ? JSON.parse(params.op) : {});
  9745. params.filter = $.extend({}, params.filter, searchQuery.filter);
  9746. params.op = $.extend({}, params.op, searchQuery.op);
  9747. //移除empty的值
  9748. if (removeempty) {
  9749. $.each(params.filter, function (i, j) {
  9750. if ((j == '' || j == null || ($.isArray(j) && j.length == 0)) && !params.op[i].match(/null/i)) {
  9751. delete params.filter[i];
  9752. delete params.op[i];
  9753. }
  9754. });
  9755. }
  9756. params.filter = JSON.stringify(params.filter);
  9757. params.op = JSON.stringify(params.op);
  9758. return params;
  9759. };
  9760. $.extend($.fn.bootstrapTable.defaults, {
  9761. commonSearch: false,
  9762. titleForm: "Common search",
  9763. actionForm: "",
  9764. searchFormTemplate: "",
  9765. searchFormVisible: true,
  9766. searchClass: 'searchit',
  9767. showSearch: true,
  9768. renderDefault: true,
  9769. onCommonSearch: function (field, text) {
  9770. return false;
  9771. },
  9772. onPostCommonSearch: function (table) {
  9773. return false;
  9774. }
  9775. });
  9776. $.extend($.fn.bootstrapTable.defaults.icons, {
  9777. commonSearchIcon: 'glyphicon-search'
  9778. });
  9779. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  9780. 'common-search.bs.table': 'onCommonSearch',
  9781. 'post-common-search.bs.table': 'onPostCommonSearch'
  9782. });
  9783. $.extend($.fn.bootstrapTable.locales[$.fn.bootstrapTable.defaults.locale], {
  9784. formatCommonSearch: function () {
  9785. return "Common search";
  9786. },
  9787. formatCommonSubmitButton: function () {
  9788. return "Submit";
  9789. },
  9790. formatCommonResetButton: function () {
  9791. return "Reset";
  9792. },
  9793. formatCommonCloseButton: function () {
  9794. return "Close";
  9795. },
  9796. formatCommonChoose: function () {
  9797. return "Choose";
  9798. }
  9799. });
  9800. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  9801. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9802. _initHeader = BootstrapTable.prototype.initHeader,
  9803. _initToolbar = BootstrapTable.prototype.initToolbar,
  9804. _load = BootstrapTable.prototype.load,
  9805. _initSearch = BootstrapTable.prototype.initSearch;
  9806. BootstrapTable.prototype.initHeader = function () {
  9807. _initHeader.apply(this, Array.prototype.slice.apply(arguments));
  9808. this.$header.find('th[data-field]').each(function (i) {
  9809. var column = $(this).data();
  9810. if (typeof column['width'] !== 'undefined' && column['width'].toString().indexOf("%") === -1) {
  9811. $(".th-inner", this).outerWidth(column['width']);
  9812. $(this).css("max-width", column['width']);
  9813. }
  9814. });
  9815. this.options.stateField = this.header.stateField;
  9816. };
  9817. BootstrapTable.prototype.initToolbar = function () {
  9818. _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
  9819. if (!isSearchAvailble(this)) {
  9820. return;
  9821. }
  9822. var that = this,
  9823. html = [];
  9824. if (that.options.showSearch) {
  9825. html.push(sprintf('<div class="columns-%s pull-%s" style="margin-top:10px;margin-bottom:10px;">', this.options.buttonsAlign, this.options.buttonsAlign));
  9826. 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()));
  9827. html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.commonSearchIcon))
  9828. html.push('</button></div>');
  9829. }
  9830. if (that.$toolbar.find(".pull-right").size() > 0) {
  9831. $(html.join('')).insertBefore(that.$toolbar.find(".pull-right:first"));
  9832. } else {
  9833. that.$toolbar.append(html.join(''));
  9834. }
  9835. initCommonSearch(that.columns, that);
  9836. that.$toolbar.find('button[name="commonSearch"]')
  9837. .off('click').on('click', function () {
  9838. that.$commonsearch.toggleClass("hidden");
  9839. return;
  9840. });
  9841. that.$container.on("click", "." + that.options.searchClass, function () {
  9842. var value = $(this).data("value");
  9843. var field = $(this).data("field");
  9844. var ul = that.$container.closest(".panel-intro").find("ul[data-field='" + field + "']");
  9845. if (ul.length > 0) {
  9846. $('li a[data-value="' + value + '"][data-toggle="tab"]', ul).trigger('click');
  9847. return;
  9848. }
  9849. var obj = $("form [name='" + field + "']", that.$commonsearch);
  9850. if (obj.size() > 0) {
  9851. if (obj.is("select")) {
  9852. $("option[value='" + value + "']", obj).prop("selected", true);
  9853. } else if (obj.size() > 1) {
  9854. $("form [name='" + field + "'][value='" + value + "']", that.$commonsearch).prop("checked", true);
  9855. } else {
  9856. obj.val(value + "");
  9857. }
  9858. obj.trigger("change");
  9859. $("form", that.$commonsearch).trigger("submit");
  9860. }
  9861. });
  9862. var queryParams = that.options.queryParams;
  9863. //匹配默认搜索值
  9864. this.options.queryParams = function (params) {
  9865. return queryParams(getQueryParams(params, getSearchQuery(that, true)));
  9866. };
  9867. this.trigger('post-common-search', that);
  9868. };
  9869. BootstrapTable.prototype.onCommonSearch = function () {
  9870. var searchQuery = getSearchQuery(this);
  9871. this.trigger('common-search', this, searchQuery);
  9872. this.options.pageNumber = 1;
  9873. //this.options.pageSize = $.fn.bootstrapTable.defaults.pageSize;
  9874. this.refresh({});
  9875. };
  9876. BootstrapTable.prototype.load = function (data) {
  9877. _load.apply(this, Array.prototype.slice.apply(arguments));
  9878. if (!isSearchAvailble(this)) {
  9879. return;
  9880. }
  9881. };
  9882. BootstrapTable.prototype.initSearch = function () {
  9883. _initSearch.apply(this, Array.prototype.slice.apply(arguments));
  9884. if (!isSearchAvailble(this)) {
  9885. return;
  9886. }
  9887. var that = this;
  9888. var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
  9889. this.data = fp ? $.grep(this.data, function (item, i) {
  9890. for (var key in fp) {
  9891. var fval = fp[key].toLowerCase();
  9892. var value = item[key];
  9893. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
  9894. that.header.formatters[$.inArray(key, that.header.fields)],
  9895. [value, item, i], value);
  9896. if (!($.inArray(key, that.header.fields) !== -1 &&
  9897. (typeof value === 'string' || typeof value === 'number') &&
  9898. (value + '').toLowerCase().indexOf(fval) !== -1)) {
  9899. return false;
  9900. }
  9901. }
  9902. return true;
  9903. }) : this.data;
  9904. };
  9905. }(jQuery);
  9906. define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) {
  9907. return function () {
  9908. var ret, fn;
  9909. return ret || global.$.fn.bootstrapTable.defaults;
  9910. };
  9911. }(this)));
  9912. /**
  9913. * 将BootstrapTable的行使用自定义的模板来渲染
  9914. *
  9915. * @author: karson
  9916. * @version: v0.0.1
  9917. *
  9918. * @update 2017-06-24 <http://github.com/karsonzhang/fastadmin>
  9919. */
  9920. !function ($) {
  9921. 'use strict';
  9922. $.extend($.fn.bootstrapTable.defaults, {
  9923. //是否启用模板渲染
  9924. templateView: false,
  9925. //数据格式化的模板ID或格式函数
  9926. templateFormatter: "itemtpl",
  9927. //添加的父类的class
  9928. templateParentClass: "row row-flex",
  9929. //向table添加的class
  9930. templateTableClass: "table-template",
  9931. });
  9932. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9933. _initContainer = BootstrapTable.prototype.initContainer,
  9934. _initBody = BootstrapTable.prototype.initBody,
  9935. _initRow = BootstrapTable.prototype.initRow;
  9936. BootstrapTable.prototype.initContainer = function () {
  9937. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  9938. var that = this;
  9939. if (!that.options.templateView) {
  9940. return;
  9941. }
  9942. that.options.cardView = true;
  9943. };
  9944. BootstrapTable.prototype.initBody = function () {
  9945. var that = this;
  9946. $.extend(that.options, {
  9947. showHeader: !that.options.templateView ? $.fn.bootstrapTable.defaults.showHeader : false,
  9948. showFooter: !that.options.templateView ? $.fn.bootstrapTable.defaults.showFooter : false,
  9949. });
  9950. $(that.$el).toggleClass(that.options.templateTableClass, that.options.templateView);
  9951. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  9952. if (!that.options.templateView) {
  9953. return;
  9954. } else {
  9955. //由于Bootstrap是基于Table的,添加一个父类容器
  9956. $("> *:not(.no-records-found)", that.$body).wrapAll($("<div />").addClass(that.options.templateParentClass));
  9957. }
  9958. };
  9959. BootstrapTable.prototype.initRow = function (item, i, data, parentDom) {
  9960. var that = this;
  9961. //如果未启用则使用原生的initRow方法
  9962. if (!that.options.templateView) {
  9963. return _initRow.apply(that, Array.prototype.slice.apply(arguments));
  9964. }
  9965. var $content = '';
  9966. if (typeof that.options.templateFormatter === 'function') {
  9967. $content = that.options.templateFormatter.call(that, item, i, data);
  9968. } else {
  9969. var Template = require('template');
  9970. $content = Template(that.options.templateFormatter, {item: item, i: i, data: data});
  9971. }
  9972. return $content;
  9973. };
  9974. }(jQuery);
  9975. define("bootstrap-table-template", ["bootstrap-table","template"], (function (global) {
  9976. return function () {
  9977. var ret, fn;
  9978. return ret || global.$.fn.bootstrapTable.defaults;
  9979. };
  9980. }(this)));
  9981. /**
  9982. * @author Jay <jwang@dizsoft.com>
  9983. */
  9984. (function ($) {
  9985. 'use strict';
  9986. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  9987. $.extend($.fn.bootstrapTable.defaults, {
  9988. showJumpto: false,
  9989. exportOptions: {}
  9990. });
  9991. $.extend($.fn.bootstrapTable.locales, {
  9992. formatJumpto: function () {
  9993. return 'GO';
  9994. }
  9995. });
  9996. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  9997. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9998. _initPagination = BootstrapTable.prototype.initPagination;
  9999. BootstrapTable.prototype.initPagination = function () {
  10000. this.showToolbar = this.options.showExport;
  10001. _initPagination.apply(this, Array.prototype.slice.apply(arguments));
  10002. if (this.options.showJumpto) {
  10003. var that = this,
  10004. $pageGroup = this.$pagination.find('ul.pagination'),
  10005. $jumpto = $pageGroup.find('li.jumpto');
  10006. if (!$jumpto.length) {
  10007. $jumpto = $([
  10008. '<li class="jumpto">',
  10009. '<input type="text" class="form-control">',
  10010. '<button class="btn' +
  10011. sprintf(' btn-%s', this.options.buttonsClass) +
  10012. sprintf(' btn-%s', this.options.iconSize) +
  10013. '" title="' + this.options.formatJumpto() + '" ' +
  10014. ' type="button">'+this.options.formatJumpto(),
  10015. '</button>',
  10016. '</li>'].join('')).appendTo($pageGroup);
  10017. $jumpto.find('button').click(function () {
  10018. that.selectPage(parseInt($jumpto.find('input').val()));
  10019. });
  10020. }
  10021. }
  10022. };
  10023. })(jQuery);
  10024. define("bootstrap-table-jumpto", ["bootstrap-table"], (function (global) {
  10025. return function () {
  10026. var ret, fn;
  10027. return ret || global.$.fn.bootstrapTable.defaults;
  10028. };
  10029. }(this)));
  10030. (function ($) {
  10031. 'use strict';
  10032. // Reasonable defaults
  10033. var PIXEL_STEP = 10;
  10034. var LINE_HEIGHT = 40;
  10035. var PAGE_HEIGHT = 800;
  10036. function normalizeWheel(event) {
  10037. var sX = 0; // spinX
  10038. var sY = 0; // spinY
  10039. var pX = 0; // pixelX
  10040. var pY = 0; // pixelY
  10041. // Legacy
  10042. if ('detail' in event) {
  10043. sY = event.detail;
  10044. }
  10045. if ('wheelDelta' in event) {
  10046. sY = -event.wheelDelta / 120;
  10047. }
  10048. if ('wheelDeltaY' in event) {
  10049. sY = -event.wheelDeltaY / 120;
  10050. }
  10051. if ('wheelDeltaX' in event) {
  10052. sX = -event.wheelDeltaX / 120;
  10053. }
  10054. // side scrolling on FF with DOMMouseScroll
  10055. if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {
  10056. sX = sY;
  10057. sY = 0;
  10058. }
  10059. pX = sX * PIXEL_STEP;
  10060. pY = sY * PIXEL_STEP;
  10061. if ('deltaY' in event) {
  10062. pY = event.deltaY;
  10063. }
  10064. if ('deltaX' in event) {
  10065. pX = event.deltaX;
  10066. }
  10067. if ((pX || pY) && event.deltaMode) {
  10068. if (event.deltaMode === 1) {
  10069. // delta in LINE units
  10070. pX *= LINE_HEIGHT;
  10071. pY *= LINE_HEIGHT;
  10072. } else {
  10073. // delta in PAGE units
  10074. pX *= PAGE_HEIGHT;
  10075. pY *= PAGE_HEIGHT;
  10076. }
  10077. }
  10078. // Fall-back if spin cannot be determined
  10079. if (pX && !sX) {
  10080. sX = pX < 1 ? -1 : 1;
  10081. }
  10082. if (pY && !sY) {
  10083. sY = pY < 1 ? -1 : 1;
  10084. }
  10085. return {
  10086. spinX: sX,
  10087. spinY: sY,
  10088. pixelX: pX,
  10089. pixelY: pY
  10090. };
  10091. }
  10092. var cachedWidth = null;
  10093. var getScrollBarWidth = function getScrollBarWidth() {
  10094. if (cachedWidth === null) {
  10095. var inner = $('<p/>').addClass('fixed-table-scroll-inner'),
  10096. outer = $('<div/>').addClass('fixed-table-scroll-outer'),
  10097. w1 = void 0,
  10098. w2 = void 0;
  10099. outer.append(inner);
  10100. $('body').append(outer);
  10101. w1 = inner[0].offsetWidth;
  10102. outer.css('overflow', 'scroll');
  10103. w2 = inner[0].offsetWidth;
  10104. if (w1 === w2) {
  10105. w2 = outer[0].clientWidth;
  10106. }
  10107. outer.remove();
  10108. cachedWidth = w1 - w2;
  10109. }
  10110. return cachedWidth;
  10111. };
  10112. //获取原本表格体的滑块宽度
  10113. var getTableBodyScrollBarWidth = function getTableBodyScrollBarWidth(tableBody) {
  10114. return tableBody[0].scrollHeight > tableBody[0].clientHeight ? 15 : 0;
  10115. };
  10116. $.extend($.fn.bootstrapTable.defaults, {
  10117. fixedColumns: false,
  10118. fixedNumber: 0,
  10119. fixedRightNumber: 0
  10120. });
  10121. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  10122. _initBody = BootstrapTable.prototype.initBody,
  10123. _initContainer = BootstrapTable.prototype.initContainer,
  10124. _trigger = BootstrapTable.prototype.trigger,
  10125. _hideLoading = BootstrapTable.prototype.hideLoading,
  10126. _updateSelected = BootstrapTable.prototype.updateSelected;
  10127. BootstrapTable.prototype.fixedColumnsSupported = function () {
  10128. var that = this;
  10129. return that.options.fixedColumns && !that.options.detailView && !that.options.cardView;
  10130. };
  10131. BootstrapTable.prototype.initFixedContainer = function () {
  10132. if (!this.fixedColumnsSupported()) {
  10133. return;
  10134. }
  10135. if (this.options.fixedNumber) {
  10136. this.$tableContainer.find('.fixed-columns').size() == 0 && this.$tableContainer.append('<div class="fixed-columns"></div>');
  10137. this.$fixedColumns = this.$tableContainer.find('.fixed-columns');
  10138. }
  10139. if (this.options.fixedRightNumber) {
  10140. this.$tableContainer.find('.fixed-columns-right').size() == 0 && this.$tableContainer.append('<div class="fixed-columns-right"></div>');
  10141. this.$fixedColumnsRight = this.$tableContainer.find('.fixed-columns-right');
  10142. }
  10143. };
  10144. BootstrapTable.prototype.initContainer = function () {
  10145. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  10146. this.initFixedContainer();
  10147. };
  10148. BootstrapTable.prototype.initBody = function () {
  10149. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  10150. if (!this.fixedColumnsSupported()) {
  10151. return;
  10152. }
  10153. if (this.options.showHeader && this.options.height) {
  10154. return;
  10155. }
  10156. this.initFixedColumnsBody();
  10157. this.initFixedColumnsEvents();
  10158. };
  10159. BootstrapTable.prototype.trigger = function () {
  10160. var that = this;
  10161. _trigger.apply(this, Array.prototype.slice.apply(arguments));
  10162. if (arguments[0] === 'pre-body') {
  10163. //如果上来就是cardView 设置表格高度为auto
  10164. if (this.options.cardView) {
  10165. this.$tableBody.css("height", "auto");
  10166. }
  10167. }
  10168. //监听cardView 显示/隐藏fixed部分
  10169. if (arguments[0] === 'toggle') {
  10170. if (arguments[1]) {
  10171. this.$tableBody.css("height", "auto");
  10172. this.$fixedColumns && this.$fixedColumns.hide();
  10173. this.$fixedColumnsRight && this.$fixedColumnsRight.hide();
  10174. } else {
  10175. this.$tableBody.css("height", "100%");
  10176. this.$fixedColumns && this.$fixedColumns.show();
  10177. this.$fixedColumnsRight && this.$fixedColumnsRight.show();
  10178. this.$fixedHeaderRight && this.$fixedHeaderRight.scrollLeft(this.$tableBody.find('table').width());
  10179. this.$fixedBodyRight && this.$fixedBodyRight.scrollLeft(this.$tableBody.find('table').width());
  10180. }
  10181. }
  10182. if (!that.fixedColumnsSupported()) {
  10183. return;
  10184. }
  10185. if (arguments[0] === 'post-header') {
  10186. this.initFixedColumnsHeader();
  10187. } else if (arguments[0] === 'scroll-body') {
  10188. if (this.needFixedColumns && this.options.fixedNumber) {
  10189. this.$fixedBody && this.$fixedBody.scrollTop(this.$tableBody.scrollTop());
  10190. }
  10191. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10192. this.$fixedBodyRight && this.$fixedBodyRight.scrollTop(this.$tableBody.scrollTop());
  10193. }
  10194. } else if (arguments[0] === 'load-success') {
  10195. this.hideLoading();
  10196. }
  10197. };
  10198. BootstrapTable.prototype.updateSelected = function () {
  10199. var that = this;
  10200. _updateSelected.apply(this, Array.prototype.slice.apply(arguments));
  10201. if (!this.fixedColumnsSupported()) {
  10202. return;
  10203. }
  10204. this.$tableBody.find('tr').each(function (i, el) {
  10205. var $el = $(el);
  10206. var index = $el.data('index');
  10207. var classes = $el.attr('class');
  10208. var inputSelector = '[name="' + that.options.selectItemName + '"]';
  10209. var $input = $el.find(inputSelector);
  10210. if (typeof index === 'undefined') {
  10211. return;
  10212. }
  10213. var updateFixedBody = function updateFixedBody($fixedHeader, $fixedBody) {
  10214. var $tr = $fixedBody.find('tr[data-index="' + index + '"]');
  10215. $tr.attr('class', classes);
  10216. if ($input.length) {
  10217. $tr.find(inputSelector).prop('checked', $input.prop('checked'));
  10218. }
  10219. if (that.$selectAll.length) {
  10220. $fixedHeader.add($fixedBody).find('[name="btSelectAll"]').prop('checked', that.$selectAll.prop('checked'));
  10221. }
  10222. };
  10223. if (that.$fixedBody && that.options.fixedNumber) {
  10224. updateFixedBody(that.$fixedHeader, that.$fixedBody);
  10225. }
  10226. if (that.$fixedBodyRight && that.options.fixedRightNumber) {
  10227. updateFixedBody(that.$fixedHeaderRight, that.$fixedBodyRight);
  10228. }
  10229. });
  10230. };
  10231. BootstrapTable.prototype.hideLoading = function () {
  10232. _hideLoading.apply(this, Array.prototype.slice.apply(arguments));
  10233. if (this.needFixedColumns && this.options.fixedNumber) {
  10234. this.$fixedColumns.find('.fixed-table-loading').hide();
  10235. }
  10236. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10237. this.$fixedColumnsRight.find('.fixed-table-loading').hide();
  10238. }
  10239. };
  10240. BootstrapTable.prototype.initFixedColumnsHeader = function () {
  10241. var that = this;
  10242. if (this.options.height) {
  10243. this.needFixedColumns = this.$tableHeader.outerWidth(true) < this.$tableHeader.find('table').outerWidth(true);
  10244. } else {
  10245. this.needFixedColumns = this.$tableBody.outerWidth(true) < this.$tableBody.find('table').outerWidth(true);
  10246. }
  10247. var initFixedHeader = function initFixedHeader($fixedColumns, isRight) {
  10248. $fixedColumns.find('.fixed-table-header').remove();
  10249. $fixedColumns.append(that.$tableHeader.clone(true));
  10250. $fixedColumns.find('.fixed-table-header').css('margin-right', "");
  10251. $fixedColumns.css({
  10252. width: that.getFixedColumnsWidth(isRight)
  10253. });
  10254. return $fixedColumns.find('.fixed-table-header');
  10255. };
  10256. if (this.needFixedColumns && this.options.fixedNumber) {
  10257. this.$fixedHeader = initFixedHeader(this.$fixedColumns);
  10258. this.$fixedHeader.css('margin-right', '');
  10259. } else if (this.$fixedColumns) {
  10260. this.$fixedColumns.html('').css('width', '');
  10261. }
  10262. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10263. this.$fixedHeaderRight = initFixedHeader(this.$fixedColumnsRight, true);
  10264. this.$fixedHeaderRight.scrollLeft(this.$fixedHeaderRight.find('table').width());
  10265. } else if (this.$fixedColumnsRight) {
  10266. this.$fixedColumnsRight.html('').css('width', '');
  10267. }
  10268. this.initFixedColumnsBody();
  10269. this.initFixedColumnsEvents();
  10270. };
  10271. BootstrapTable.prototype.initFixedColumnsBody = function () {
  10272. var that = this;
  10273. var initFixedBody = function initFixedBody($fixedColumns, $fixedHeader) {
  10274. $fixedColumns.find('.fixed-table-body').remove();
  10275. $fixedColumns.append(that.$tableBody.clone(true));
  10276. var $fixedBody = $fixedColumns.find('.fixed-table-body');
  10277. var tableBody = that.$tableBody.get(0);
  10278. var scrollHeight = tableBody.scrollWidth > tableBody.clientWidth ? getScrollBarWidth() : 0;
  10279. var paginationHeight = $(".fixed-table-pagination").height();
  10280. if (typeof that.options.height !== 'undefined') paginationHeight = 0;
  10281. var height = that.$tableContainer.outerHeight(true) - scrollHeight - paginationHeight + 1;
  10282. $fixedColumns.css({
  10283. height: height,
  10284. "min-height": "calc(100% - " + (paginationHeight + scrollHeight) + "px)"
  10285. });
  10286. $fixedBody.css({
  10287. height: height - $fixedHeader.height(),
  10288. "min-height": "calc(100% - " + $fixedHeader.height() + "px)",
  10289. overflow: "hidden"
  10290. });
  10291. return $fixedBody;
  10292. };
  10293. if (this.needFixedColumns && this.options.fixedNumber) {
  10294. this.$fixedBody = initFixedBody(this.$fixedColumns, this.$fixedHeader);
  10295. }
  10296. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10297. this.$fixedBodyRight = initFixedBody(this.$fixedColumnsRight, this.$fixedHeaderRight);
  10298. this.$fixedBodyRight.scrollLeft(this.$fixedBodyRight.find('table').width());
  10299. this.$fixedBodyRight.css('overflow-y', 'hidden');
  10300. }
  10301. };
  10302. BootstrapTable.prototype.getFixedColumnsWidth = function (isRight) {
  10303. var visibleFields = this.getVisibleFields();
  10304. var width = 0;
  10305. var fixedNumber = this.options.fixedNumber;
  10306. var marginRight = 0;
  10307. if (isRight) {
  10308. visibleFields = visibleFields.reverse();
  10309. fixedNumber = this.options.fixedRightNumber;
  10310. //右侧固定列距离
  10311. this.$fixedColumnsRight.css('right', getTableBodyScrollBarWidth(this.$tableBody));
  10312. }
  10313. for (var i = 0; i < fixedNumber; i++) {
  10314. width += this.$header.find('th[data-field="' + visibleFields[i] + '"]').outerWidth();
  10315. }
  10316. return width + 1;
  10317. };
  10318. BootstrapTable.prototype.initFixedColumnsEvents = function () {
  10319. var that = this;
  10320. var toggleHover = function toggleHover(e, toggle) {
  10321. var tr = 'tr[data-index="' + $(e.currentTarget).data('index') + '"]';
  10322. var $trs = that.$tableBody.find(tr);
  10323. if (that.$fixedBody) {
  10324. $trs = $trs.add(that.$fixedBody.find(tr));
  10325. }
  10326. if (that.$fixedBodyRight) {
  10327. $trs = $trs.add(that.$fixedBodyRight.find(tr));
  10328. }
  10329. $trs.css('background-color', toggle ? $(e.currentTarget).css('background-color') : '');
  10330. };
  10331. this.$tableBody.find('tr').hover(function (e) {
  10332. toggleHover(e, true);
  10333. }, function (e) {
  10334. toggleHover(e, false);
  10335. });
  10336. var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
  10337. var mousewheel = isFirefox ? 'DOMMouseScroll' : 'mousewheel';
  10338. var updateScroll = function updateScroll(e, fixedBody) {
  10339. var normalized = normalizeWheel(e);
  10340. var deltaY = Math.ceil(normalized.pixelY);
  10341. var top = that.$tableBody.scrollTop() + deltaY;
  10342. if (deltaY < 0 && top > 0 || deltaY > 0 && top < fixedBody.scrollHeight - fixedBody.clientHeight) {
  10343. e.preventDefault();
  10344. }
  10345. that.$tableBody.scrollTop(top);
  10346. if (that.$fixedBody) {
  10347. that.$fixedBody.scrollTop(top);
  10348. }
  10349. if (that.$fixedBodyRight) {
  10350. that.$fixedBodyRight.scrollTop(top);
  10351. }
  10352. };
  10353. if (this.needFixedColumns && this.options.fixedNumber) {
  10354. this.$fixedBody.find('tr').hover(function (e) {
  10355. toggleHover(e, true);
  10356. }, function (e) {
  10357. toggleHover(e, false);
  10358. });
  10359. this.$fixedBody[0].addEventListener(mousewheel, function (e) {
  10360. //给鼠标滑轮绑定事件
  10361. updateScroll(e, that.$fixedBody[0]);
  10362. });
  10363. //给固定表格的checkbox绑定事件
  10364. this.$fixedBody.find('input[name="' + this.options.selectItemName + '"]').off("click").on('click', function (e) {
  10365. e.stopImmediatePropagation();
  10366. var index = $(e.target).data("index");
  10367. $(that.$selectItem[index]).trigger("click");
  10368. });
  10369. //绑定TD点击事件
  10370. this.$fixedBody.find('> table > tbody > tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
  10371. var index = $(this).closest("tr[data-index]").data("index");
  10372. $(that.$selectItem[index]).closest("tr[data-index]").find(">td:eq(" + $(this).index() + ")").trigger("click");
  10373. });
  10374. }
  10375. //给原本表格绑定scroll事件
  10376. $('div.fixed-table-body').off('scroll'); //给所有的body解绑 scroll
  10377. this.$tableBody.off('scroll').on('scroll', function (e) {
  10378. that.$tableHeader.scrollLeft(0);
  10379. if (that.$tableBody.scrollLeft() > 0) {
  10380. that.$tableHeader.scrollLeft(that.$tableBody.scrollLeft());
  10381. if (that.options.showFooter && !that.options.cardView) {
  10382. that.$tableFooter.scrollLeft(that.$tableBody.scrollLeft());
  10383. }
  10384. }
  10385. var top = that.$tableBody.scrollTop();
  10386. if (that.$fixedBody) {
  10387. that.$fixedBody.scrollTop(top);
  10388. }
  10389. if (that.$fixedBodyRight) {
  10390. that.$fixedBodyRight.scrollTop(top);
  10391. }
  10392. });
  10393. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10394. this.$fixedBodyRight.find('tr').hover(function (e) {
  10395. toggleHover(e, true);
  10396. }, function (e) {
  10397. toggleHover(e, false);
  10398. });
  10399. this.$fixedBodyRight[0].addEventListener(mousewheel, function (e) {
  10400. //给鼠标滑轮绑定事件
  10401. updateScroll(e, that.$fixedBodyRight[0]);
  10402. });
  10403. //给固定表格的checkbox绑定事件
  10404. this.$fixedBodyRight.find('input[name="' + this.options.selectItemName + '"]').off("click").on('click', function (e) {
  10405. e.stopImmediatePropagation();
  10406. var index = $(e.target).data("index");
  10407. $(that.$selectItem[index]).trigger("click");
  10408. });
  10409. //绑定TD点击事件
  10410. this.$fixedBodyRight.find('> table > tbody > tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
  10411. var index = $(this).closest("tr[data-index]").data("index");
  10412. $(that.$selectItem[index]).closest("tr[data-index]").find(">td:eq(" + $(this).index() + ")").trigger("click");
  10413. });
  10414. }
  10415. if (this.options.filterControl) {
  10416. $(this.$fixedColumns).off('keyup change').on('keyup change', function (e) {
  10417. var $target = $(e.target);
  10418. var value = $target.val();
  10419. var field = $target.parents('th').data('field');
  10420. var $coreTh = that.$header.find('th[data-field="' + field + '"]');
  10421. if ($target.is('input')) {
  10422. $coreTh.find('input').val(value);
  10423. } else if ($target.is('select')) {
  10424. var $select = $coreTh.find('select');
  10425. $select.find('option[selected]').removeAttr('selected');
  10426. $select.find('option[value="' + value + '"]').attr('selected', true);
  10427. }
  10428. that.triggerSearch();
  10429. });
  10430. }
  10431. };
  10432. })(jQuery);
  10433. define("bootstrap-table-fixed-columns", ["bootstrap-table"], (function (global) {
  10434. return function () {
  10435. var ret, fn;
  10436. return ret || global.$.fn.bootstrapTable.defaults;
  10437. };
  10438. }(this)));
  10439. 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) {
  10440. var Table = {
  10441. list: {},
  10442. // Bootstrap-table 基础配置
  10443. defaults: {
  10444. url: '',
  10445. sidePagination: 'server',
  10446. method: 'get', //请求方法
  10447. toolbar: ".toolbar", //工具栏
  10448. search: true, //是否启用快速搜索
  10449. cache: false,
  10450. commonSearch: true, //是否启用通用搜索
  10451. searchFormVisible: false, //是否始终显示搜索表单
  10452. titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
  10453. idTable: 'commonTable',
  10454. showExport: true,
  10455. exportDataType: "auto",
  10456. exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
  10457. exportOptions: {
  10458. fileName: 'export_' + Moment().format("YYYY-MM-DD"),
  10459. preventInjection: false,
  10460. mso: {
  10461. onMsoNumberFormat: function (cell, row, col) {
  10462. return !isNaN($(cell).text()) ? '\\@' : '';
  10463. },
  10464. },
  10465. ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列
  10466. },
  10467. pageSize: localStorage.getItem("pagesize") || 10,
  10468. pageList: [10, 15, 20, 25, 50, 'All'],
  10469. pagination: true,
  10470. clickToSelect: true, //是否启用点击选中
  10471. dblClickToEdit: true, //是否启用双击编辑
  10472. singleSelect: false, //是否启用单选
  10473. showRefresh: false,
  10474. showJumpto: true,
  10475. locale: Config.language == 'zh-cn' ? 'zh-CN' : 'en-US',
  10476. showToggle: true,
  10477. showColumns: true,
  10478. pk: 'id',
  10479. sortName: 'id',
  10480. sortOrder: 'desc',
  10481. paginationFirstText: __("First"),
  10482. paginationPreText: __("Previous"),
  10483. paginationNextText: __("Next"),
  10484. paginationLastText: __("Last"),
  10485. cardView: false, //卡片视图
  10486. iosCardView: true, //ios卡片视图
  10487. checkOnInit: true, //是否在初始化时判断
  10488. escape: true, //是否对内容进行转义
  10489. fixDropdownPosition: true, //是否修复下拉的定位
  10490. selectedIds: [],
  10491. selectedData: [],
  10492. extend: {
  10493. index_url: '',
  10494. add_url: '',
  10495. edit_url: '',
  10496. del_url: '',
  10497. import_url: '',
  10498. multi_url: '',
  10499. dragsort_url: 'ajax/weigh',
  10500. }
  10501. },
  10502. // Bootstrap-table 列配置
  10503. columnDefaults: {
  10504. align: 'center',
  10505. valign: 'middle',
  10506. },
  10507. config: {
  10508. checkboxtd: 'tbody>tr>td.bs-checkbox',
  10509. toolbar: '.toolbar',
  10510. refreshbtn: '.btn-refresh',
  10511. addbtn: '.btn-add',
  10512. editbtn: '.btn-edit',
  10513. delbtn: '.btn-del',
  10514. importbtn: '.btn-import',
  10515. multibtn: '.btn-multi',
  10516. disabledbtn: '.btn-disabled',
  10517. editonebtn: '.btn-editone',
  10518. restoreonebtn: '.btn-restoreone',
  10519. destroyonebtn: '.btn-destroyone',
  10520. restoreallbtn: '.btn-restoreall',
  10521. destroyallbtn: '.btn-destroyall',
  10522. dragsortfield: 'weigh',
  10523. },
  10524. button: {
  10525. edit: {
  10526. name: 'edit',
  10527. icon: 'fa fa-pencil',
  10528. title: __('Edit'),
  10529. extend: 'data-toggle="tooltip"',
  10530. classname: 'btn btn-xs btn-success btn-editone'
  10531. },
  10532. del: {
  10533. name: 'del',
  10534. icon: 'fa fa-trash',
  10535. title: __('Del'),
  10536. extend: 'data-toggle="tooltip"',
  10537. classname: 'btn btn-xs btn-danger btn-delone'
  10538. },
  10539. dragsort: {
  10540. name: 'dragsort',
  10541. icon: 'fa fa-arrows',
  10542. title: __('Drag to sort'),
  10543. extend: 'data-toggle="tooltip"',
  10544. classname: 'btn btn-xs btn-primary btn-dragsort'
  10545. }
  10546. },
  10547. api: {
  10548. init: function (defaults, columnDefaults, locales) {
  10549. defaults = defaults ? defaults : {};
  10550. columnDefaults = columnDefaults ? columnDefaults : {};
  10551. locales = locales ? locales : {};
  10552. $.fn.bootstrapTable.Constructor.prototype.getSelectItem = function () {
  10553. return this.$selectItem;
  10554. };
  10555. // 写入bootstrap-table默认配置
  10556. $.extend(true, $.fn.bootstrapTable.defaults, Table.defaults, defaults);
  10557. // 写入bootstrap-table column配置
  10558. $.extend($.fn.bootstrapTable.columnDefaults, Table.columnDefaults, columnDefaults);
  10559. // 写入bootstrap-table locale配置
  10560. $.extend($.fn.bootstrapTable.locales[Table.defaults.locale], {
  10561. formatCommonSearch: function () {
  10562. return __('Common search');
  10563. },
  10564. formatCommonSubmitButton: function () {
  10565. return __('Submit');
  10566. },
  10567. formatCommonResetButton: function () {
  10568. return __('Reset');
  10569. },
  10570. formatCommonCloseButton: function () {
  10571. return __('Close');
  10572. },
  10573. formatCommonChoose: function () {
  10574. return __('Choose');
  10575. },
  10576. formatJumpto: function () {
  10577. return __('Go');
  10578. }
  10579. }, locales);
  10580. // 如果是iOS设备则判断是否启用卡片视图
  10581. if ($.fn.bootstrapTable.defaults.iosCardView && navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
  10582. Table.defaults.cardView = true;
  10583. $.fn.bootstrapTable.defaults.cardView = true;
  10584. }
  10585. if (typeof defaults.exportTypes != 'undefined') {
  10586. $.fn.bootstrapTable.defaults.exportTypes = defaults.exportTypes;
  10587. }
  10588. },
  10589. // 绑定事件
  10590. bindevent: function (table) {
  10591. //Bootstrap-table的父元素,包含table,toolbar,pagnation
  10592. var parenttable = table.closest('.bootstrap-table');
  10593. //Bootstrap-table配置
  10594. var options = table.bootstrapTable('getOptions');
  10595. //Bootstrap操作区
  10596. var toolbar = $(options.toolbar, parenttable);
  10597. //跨页提示按钮
  10598. var tipsBtn = $(".btn-selected-tips", parenttable);
  10599. if (tipsBtn.size() === 0) {
  10600. 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);
  10601. }
  10602. //点击提示按钮
  10603. tipsBtn.off("click").on("click", function (e) {
  10604. table.trigger("uncheckbox");
  10605. table.bootstrapTable("refresh");
  10606. });
  10607. //当刷新表格时
  10608. table.on('uncheckbox', function (status, res, e) {
  10609. options.selectedIds = [];
  10610. options.selectedData = [];
  10611. tipsBtn.tooltip('hide');
  10612. tipsBtn.addClass('hide');
  10613. });
  10614. //表格加载出错时
  10615. table.on('load-error.bs.table', function (status, res, e) {
  10616. if (e.status === 0) {
  10617. return;
  10618. }
  10619. Toastr.error(__('Unknown data format'));
  10620. });
  10621. //当加载数据成功时
  10622. table.on('load-success.bs.table', function (e, data) {
  10623. if (typeof data.rows === 'undefined' && typeof data.code != 'undefined') {
  10624. Toastr.error(data.msg);
  10625. }
  10626. });
  10627. //当刷新表格时
  10628. table.on('refresh.bs.table', function (e, settings, data) {
  10629. $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
  10630. });
  10631. //当表格分页变更时
  10632. table.on('page-change.bs.table', function (e, page, pagesize) {
  10633. if (!isNaN(pagesize)) {
  10634. localStorage.setItem("pagesize", pagesize);
  10635. }
  10636. });
  10637. //当执行搜索时
  10638. table.on('search.bs.table common-search.bs.table', function (e, settings, data) {
  10639. table.trigger("uncheckbox");
  10640. });
  10641. if (options.dblClickToEdit) {
  10642. //当双击单元格时
  10643. table.on('dbl-click-row.bs.table', function (e, row, element, field) {
  10644. $(Table.config.editonebtn, element).trigger("click");
  10645. });
  10646. }
  10647. //渲染内容前
  10648. table.on('pre-body.bs.table', function (e, data) {
  10649. if (options.maintainSelected) {
  10650. $.each(data, function (i, row) {
  10651. row[options.stateField] = $.inArray(row[options.pk], options.selectedIds) > -1;
  10652. });
  10653. }
  10654. });
  10655. //当内容渲染完成后
  10656. table.on('post-body.bs.table', function (e, data) {
  10657. $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
  10658. if ($(Table.config.checkboxtd + ":first", table).find("input[type='checkbox'][data-index]").size() > 0) {
  10659. // 拖拽选择,需要重新绑定事件
  10660. require(['drag', 'drop'], function () {
  10661. var checkboxtd = $(Table.config.checkboxtd, table);
  10662. checkboxtd.drag("start", function (ev, dd) {
  10663. return $('<div class="selection" />').css('opacity', .65).appendTo(document.body);
  10664. }).drag(function (ev, dd) {
  10665. $(dd.proxy).css({
  10666. top: Math.min(ev.pageY, dd.startY),
  10667. left: Math.min(ev.pageX, dd.startX),
  10668. height: Math.abs(ev.pageY - dd.startY),
  10669. width: Math.abs(ev.pageX - dd.startX)
  10670. });
  10671. }).drag("end", function (ev, dd) {
  10672. $(dd.proxy).remove();
  10673. });
  10674. checkboxtd.drop("start", function () {
  10675. Table.api.toggleattr(this);
  10676. }).drop(function () {
  10677. // Table.api.toggleattr(this);
  10678. }).drop("end", function (e) {
  10679. var that = this;
  10680. setTimeout(function () {
  10681. if (e.type === 'mousemove') {
  10682. Table.api.toggleattr(that);
  10683. }
  10684. }, 0);
  10685. });
  10686. $.drop({
  10687. multi: true
  10688. });
  10689. });
  10690. }
  10691. });
  10692. var exportDataType = options.exportDataType;
  10693. // 处理选中筛选框后按钮的状态统一变更
  10694. table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table post-body.bs.table', function (e) {
  10695. var allIds = [];
  10696. $.each(table.bootstrapTable("getData"), function (i, item) {
  10697. allIds.push(typeof item[options.pk] != 'undefined' ? item[options.pk] : '');
  10698. });
  10699. var selectedIds = Table.api.selectedids(table, true),
  10700. selectedData = Table.api.selecteddata(table, true);
  10701. //开启分页checkbox分页记忆
  10702. if (options.maintainSelected) {
  10703. options.selectedIds = options.selectedIds.filter(function (element, index, self) {
  10704. return $.inArray(element, allIds) === -1;
  10705. }).concat(selectedIds);
  10706. options.selectedData = options.selectedData.filter(function (element, index, self) {
  10707. return $.inArray(element[options.pk], allIds) === -1;
  10708. }).concat(selectedData);
  10709. if (options.selectedIds.length > selectedIds.length) {
  10710. $("b", tipsBtn).text(options.selectedIds.length);
  10711. tipsBtn.removeClass('hide');
  10712. } else {
  10713. tipsBtn.addClass('hide');
  10714. }
  10715. } else {
  10716. options.selectedIds = selectedIds;
  10717. options.selectedData = selectedData;
  10718. }
  10719. //如果导出类型为auto时则自动判断
  10720. if (exportDataType === 'auto') {
  10721. options.exportDataType = selectedIds.length > 0 ? 'selected' : 'all';
  10722. }
  10723. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !options.selectedIds.length);
  10724. });
  10725. // 绑定TAB事件
  10726. $('.panel-heading [data-field] a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) {
  10727. var field = $(this).closest("[data-field]").data("field");
  10728. var value = $(this).data("value");
  10729. var object = $("[name='" + field + "']", table.closest(".bootstrap-table").find(".commonsearch-table"));
  10730. if (object.prop('tagName') == "SELECT") {
  10731. $("option[value='" + value + "']", object).prop("selected", true);
  10732. } else {
  10733. object.val(value);
  10734. }
  10735. table.trigger("uncheckbox");
  10736. table.bootstrapTable('refresh', {pageNumber: 1});
  10737. return false;
  10738. });
  10739. // 修复重置事件
  10740. $("form", table.closest(".bootstrap-table").find(".commonsearch-table")).on('reset', function () {
  10741. setTimeout(function () {
  10742. // $('.panel-heading [data-field] li.active a[data-toggle="tab"]').trigger('shown.bs.tab');
  10743. }, 0);
  10744. $('.panel-heading [data-field] li', table.closest(".panel-intro")).removeClass('active');
  10745. $('.panel-heading [data-field] li:first', table.closest(".panel-intro")).addClass('active');
  10746. });
  10747. // 刷新按钮事件
  10748. toolbar.on('click', Table.config.refreshbtn, function () {
  10749. table.bootstrapTable('refresh');
  10750. });
  10751. // 添加按钮事件
  10752. toolbar.on('click', Table.config.addbtn, function () {
  10753. var ids = Table.api.selectedids(table);
  10754. var url = options.extend.add_url;
  10755. if (url.indexOf("{ids}") !== -1) {
  10756. url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
  10757. }
  10758. Fast.api.open(url, $(this).data("original-title") || $(this).attr("title") || __('Add'), $(this).data() || {});
  10759. });
  10760. // 导入按钮事件
  10761. if ($(Table.config.importbtn, toolbar).size() > 0) {
  10762. require(['upload'], function (Upload) {
  10763. Upload.api.upload($(Table.config.importbtn, toolbar), function (data, ret) {
  10764. Fast.api.ajax({
  10765. url: options.extend.import_url,
  10766. data: {file: data.url},
  10767. }, function (data, ret) {
  10768. table.trigger("uncheckbox");
  10769. table.bootstrapTable('refresh');
  10770. });
  10771. });
  10772. });
  10773. }
  10774. // 批量编辑按钮事件
  10775. toolbar.on('click', Table.config.editbtn, function () {
  10776. var that = this;
  10777. var ids = Table.api.selectedids(table);
  10778. if (ids.length > 10) {
  10779. return;
  10780. }
  10781. var title = $(that).data('title') || $(that).attr("title") || __('Edit');
  10782. var data = $(that).data() || {};
  10783. delete data.title;
  10784. //循环弹出多个编辑框
  10785. $.each(Table.api.selecteddata(table), function (index, row) {
  10786. var url = options.extend.edit_url;
  10787. row = $.extend({}, row ? row : {}, {ids: row[options.pk]});
  10788. url = Table.api.replaceurl(url, row, table);
  10789. Fast.api.open(url, typeof title === 'function' ? title.call(table, row) : title, data);
  10790. });
  10791. });
  10792. //清空回收站
  10793. $(document).on('click', Table.config.destroyallbtn, function () {
  10794. var that = this;
  10795. Layer.confirm(__('Are you sure you want to truncate?'), function () {
  10796. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10797. Fast.api.ajax(url, function () {
  10798. Layer.closeAll();
  10799. table.trigger("uncheckbox");
  10800. table.bootstrapTable('refresh');
  10801. }, function () {
  10802. Layer.closeAll();
  10803. });
  10804. });
  10805. return false;
  10806. });
  10807. //全部还原
  10808. $(document).on('click', Table.config.restoreallbtn, function () {
  10809. var that = this;
  10810. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10811. Fast.api.ajax(url, function () {
  10812. Layer.closeAll();
  10813. table.trigger("uncheckbox");
  10814. table.bootstrapTable('refresh');
  10815. }, function () {
  10816. Layer.closeAll();
  10817. });
  10818. return false;
  10819. });
  10820. //销毁或删除
  10821. $(document).on('click', Table.config.restoreonebtn + ',' + Table.config.destroyonebtn, function () {
  10822. var that = this;
  10823. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10824. var row = Fast.api.getrowbyindex(table, $(that).data("row-index"));
  10825. Fast.api.ajax({
  10826. url: url,
  10827. data: {ids: row[options.pk]}
  10828. }, function () {
  10829. table.trigger("uncheckbox");
  10830. table.bootstrapTable('refresh');
  10831. });
  10832. return false;
  10833. });
  10834. // 批量操作按钮事件
  10835. toolbar.on('click', Table.config.multibtn, function () {
  10836. var ids = Table.api.selectedids(table);
  10837. Table.api.multi($(this).data("action"), ids, table, this);
  10838. });
  10839. // 批量删除按钮事件
  10840. toolbar.on('click', Table.config.delbtn, function () {
  10841. var that = this;
  10842. var ids = Table.api.selectedids(table);
  10843. Layer.confirm(
  10844. __('Are you sure you want to delete the %s selected item?', ids.length),
  10845. {icon: 3, title: __('Warning'), offset: 0, shadeClose: true, btn: [__('OK'), __('Cancel')]},
  10846. function (index) {
  10847. Table.api.multi("del", ids, table, that);
  10848. Layer.close(index);
  10849. }
  10850. );
  10851. });
  10852. // 拖拽排序
  10853. require(['dragsort'], function () {
  10854. //绑定拖动排序
  10855. $("tbody", table).dragsort({
  10856. itemSelector: 'tr:visible',
  10857. dragSelector: "a.btn-dragsort",
  10858. dragEnd: function (a, b) {
  10859. var element = $("a.btn-dragsort", this);
  10860. var data = table.bootstrapTable('getData');
  10861. var current = data[parseInt($(this).data("index"))];
  10862. var options = table.bootstrapTable('getOptions');
  10863. //改变的值和改变的ID集合
  10864. var ids = $.map($("tbody tr:visible", table), function (tr) {
  10865. return data[parseInt($(tr).data("index"))][options.pk];
  10866. });
  10867. var changeid = current[options.pk];
  10868. var pid = typeof current.pid != 'undefined' ? current.pid : '';
  10869. var params = {
  10870. url: table.bootstrapTable('getOptions').extend.dragsort_url,
  10871. data: {
  10872. ids: ids.join(','),
  10873. changeid: changeid,
  10874. pid: pid,
  10875. field: Table.config.dragsortfield,
  10876. orderway: options.sortOrder,
  10877. table: options.extend.table,
  10878. pk: options.pk
  10879. }
  10880. };
  10881. Fast.api.ajax(params, function (data, ret) {
  10882. var success = $(element).data("success") || $.noop;
  10883. if (typeof success === 'function') {
  10884. if (false === success.call(element, data, ret)) {
  10885. return false;
  10886. }
  10887. }
  10888. table.bootstrapTable('refresh');
  10889. }, function (data, ret) {
  10890. var error = $(element).data("error") || $.noop;
  10891. if (typeof error === 'function') {
  10892. if (false === error.call(element, data, ret)) {
  10893. return false;
  10894. }
  10895. }
  10896. table.bootstrapTable('refresh');
  10897. });
  10898. },
  10899. placeHolderTemplate: ""
  10900. });
  10901. });
  10902. table.on("click", "input[data-id][name='checkbox']", function (e) {
  10903. var ids = $(this).data("id");
  10904. table.bootstrapTable($(this).prop("checked") ? 'checkBy' : 'uncheckBy', {field: options.pk, values: [ids]});
  10905. });
  10906. table.on("click", "[data-id].btn-change", function (e) {
  10907. e.preventDefault();
  10908. var changer = $.proxy(function () {
  10909. Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this);
  10910. }, this);
  10911. if (typeof $(this).data("confirm") !== 'undefined') {
  10912. Layer.confirm($(this).data("confirm"), function (index) {
  10913. changer();
  10914. Layer.close(index);
  10915. });
  10916. } else {
  10917. changer();
  10918. }
  10919. });
  10920. table.on("click", "[data-id].btn-edit", function (e) {
  10921. e.preventDefault();
  10922. var ids = $(this).data("id");
  10923. var row = Table.api.getrowbyid(table, ids);
  10924. row.ids = ids;
  10925. var url = Table.api.replaceurl(options.extend.edit_url, row, table);
  10926. Fast.api.open(url, $(this).data("original-title") || $(this).attr("title") || __('Edit'), $(this).data() || {});
  10927. });
  10928. table.on("click", "[data-id].btn-del", function (e) {
  10929. e.preventDefault();
  10930. var id = $(this).data("id");
  10931. var that = this;
  10932. Layer.confirm(
  10933. __('Are you sure you want to delete this item?'),
  10934. {icon: 3, title: __('Warning'), shadeClose: true, btn: [__('OK'), __('Cancel')]},
  10935. function (index) {
  10936. Table.api.multi("del", id, table, that);
  10937. Layer.close(index);
  10938. }
  10939. );
  10940. });
  10941. //修复dropdown定位溢出的情况
  10942. if (options.fixDropdownPosition) {
  10943. var tableBody = table.closest(".fixed-table-body");
  10944. table.on('show.bs.dropdown fa.event.refreshdropdown', ".btn-group", function (e) {
  10945. var dropdownMenu = $(".dropdown-menu", this);
  10946. var btnGroup = $(this);
  10947. var isPullRight = dropdownMenu.hasClass("pull-right") || dropdownMenu.hasClass("dropdown-menu-right");
  10948. var left, top, position;
  10949. if (true || dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
  10950. position = 'fixed';
  10951. top = btnGroup.offset().top - $(window).scrollTop() + btnGroup.outerHeight();
  10952. if ((top + dropdownMenu.outerHeight()) > $(window).height()) {
  10953. top = btnGroup.offset().top - dropdownMenu.outerHeight() - 5;
  10954. }
  10955. left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
  10956. }
  10957. if (left || top) {
  10958. dropdownMenu.css({
  10959. position: position, left: left, top: top, right: 'inherit'
  10960. });
  10961. }
  10962. });
  10963. var checkdropdown = function () {
  10964. if ($(".btn-group.open", table).length > 0 && $(".btn-group.open .dropdown-menu", table).css("position") == 'fixed') {
  10965. $(".btn-group.open", table).trigger("fa.event.refreshdropdown");
  10966. }
  10967. };
  10968. $(window).on("scroll", function () {
  10969. checkdropdown();
  10970. });
  10971. tableBody.on("scroll", function () {
  10972. checkdropdown();
  10973. });
  10974. }
  10975. var id = table.attr("id");
  10976. Table.list[id] = table;
  10977. return table;
  10978. },
  10979. // 批量操作请求
  10980. multi: function (action, ids, table, element) {
  10981. var options = table.bootstrapTable('getOptions');
  10982. var data = element ? $(element).data() : {};
  10983. ids = ($.isArray(ids) ? ids.join(",") : ids);
  10984. var url = typeof data.url !== "undefined" ? data.url : (action == "del" ? options.extend.del_url : options.extend.multi_url);
  10985. var params = typeof data.params !== "undefined" ? (typeof data.params == 'object' ? $.param(data.params) : data.params) : '';
  10986. options = {url: url, data: {action: action, ids: ids, params: params}};
  10987. Fast.api.ajax(options, function (data, ret) {
  10988. table.trigger("uncheckbox");
  10989. var success = $(element).data("success") || $.noop;
  10990. if (typeof success === 'function') {
  10991. if (false === success.call(element, data, ret)) {
  10992. return false;
  10993. }
  10994. }
  10995. table.bootstrapTable('refresh');
  10996. }, function (data, ret) {
  10997. var error = $(element).data("error") || $.noop;
  10998. if (typeof error === 'function') {
  10999. if (false === error.call(element, data, ret)) {
  11000. return false;
  11001. }
  11002. }
  11003. });
  11004. },
  11005. // 单元格元素事件
  11006. events: {
  11007. operate: {
  11008. 'click .btn-editone': function (e, value, row, index) {
  11009. e.stopPropagation();
  11010. e.preventDefault();
  11011. var table = $(this).closest('table');
  11012. var options = table.bootstrapTable('getOptions');
  11013. var ids = row[options.pk];
  11014. row = $.extend({}, row ? row : {}, {ids: ids});
  11015. var url = options.extend.edit_url;
  11016. Fast.api.open(Table.api.replaceurl(url, row, table), $(this).data("original-title") || $(this).attr("title") || __('Edit'), $(this).data() || {});
  11017. },
  11018. 'click .btn-delone': function (e, value, row, index) {
  11019. e.stopPropagation();
  11020. e.preventDefault();
  11021. var that = this;
  11022. var top = $(that).offset().top - $(window).scrollTop();
  11023. var left = $(that).offset().left - $(window).scrollLeft() - 260;
  11024. if (top + 154 > $(window).height()) {
  11025. top = top - 154;
  11026. }
  11027. if ($(window).width() < 480) {
  11028. top = left = undefined;
  11029. }
  11030. Layer.confirm(
  11031. __('Are you sure you want to delete this item?'),
  11032. {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true, btn: [__('OK'), __('Cancel')]},
  11033. function (index) {
  11034. var table = $(that).closest('table');
  11035. var options = table.bootstrapTable('getOptions');
  11036. Table.api.multi("del", row[options.pk], table, that);
  11037. Layer.close(index);
  11038. }
  11039. );
  11040. }
  11041. },//单元格图片预览
  11042. image: {
  11043. 'click .img-center': function (e, value, row, index) {
  11044. var data = [];
  11045. value = value === null ? '' : value.toString();
  11046. var arr = value != '' ? value.split(",") : [];
  11047. var url;
  11048. $.each(arr, function (index, value) {
  11049. url = Fast.api.cdnurl(value);
  11050. data.push({
  11051. src: url,
  11052. thumb: url.match(/^(\/|data:image\\)/) ? url : url + Config.upload.thumbstyle
  11053. });
  11054. });
  11055. Layer.photos({
  11056. photos: {
  11057. "start": $(this).parent().index(),
  11058. "data": data
  11059. },
  11060. anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
  11061. });
  11062. },
  11063. }
  11064. },
  11065. // 单元格数据格式化
  11066. formatter: {
  11067. icon: function (value, row, index) {
  11068. value = value === null ? '' : value.toString();
  11069. value = value.indexOf(" ") > -1 ? value : "fa fa-" + value;
  11070. //渲染fontawesome图标
  11071. return '<i class="' + value + '"></i> ' + value;
  11072. },
  11073. image: function (value, row, index) {
  11074. value = value == null || value.length === 0 ? '' : value.toString();
  11075. value = value ? value : '/assets/img/blank.gif';
  11076. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  11077. var url = Fast.api.cdnurl(value, true);
  11078. url = url.match(/^(\/|data:image\\)/) ? url : url + Config.upload.thumbstyle;
  11079. return '<a href="javascript:"><img class="' + classname + '" src="' + url + '" /></a>';
  11080. },
  11081. images: function (value, row, index) {
  11082. value = value == null || value.length === 0 ? '' : value.toString();
  11083. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  11084. var arr = value != '' ? value.split(',') : [];
  11085. var html = [];
  11086. var url;
  11087. $.each(arr, function (i, value) {
  11088. value = value ? value : '/assets/img/blank.gif';
  11089. url = Fast.api.cdnurl(value, true);
  11090. url = url.match(/^(\/|data:image\\)/) ? url : url + Config.upload.thumbstyle;
  11091. html.push('<a href="javascript:"><img class="' + classname + '" src="' + url + '" /></a>');
  11092. });
  11093. return html.join(' ');
  11094. },
  11095. file: function (value, row, index) {
  11096. value = value == null || value.length === 0 ? '' : value.toString();
  11097. value = Fast.api.cdnurl(value, true);
  11098. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  11099. var suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(value);
  11100. suffix = suffix ? suffix[1] : 'file';
  11101. var url = Fast.api.fixurl("ajax/icon?suffix=" + suffix);
  11102. return '<a href="' + value + '" target="_blank"><img src="' + url + '" class="' + classname + '"></a>';
  11103. },
  11104. files: function (value, row, index) {
  11105. value = value == null || value.length === 0 ? '' : value.toString();
  11106. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  11107. var arr = value != '' ? value.split(',') : [];
  11108. var html = [];
  11109. var suffix, url;
  11110. $.each(arr, function (i, value) {
  11111. value = Fast.api.cdnurl(value, true);
  11112. suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(value);
  11113. suffix = suffix ? suffix[1] : 'file';
  11114. url = Fast.api.fixurl("ajax/icon?suffix=" + suffix);
  11115. html.push('<a href="' + value + '" target="_blank"><img src="' + url + '" class="' + classname + '"></a>');
  11116. });
  11117. return html.join(' ');
  11118. },
  11119. content: function (value, row, index) {
  11120. var width = this.width != undefined ? (this.width.match(/^\d+$/) ? this.width + "px" : this.width) : "250px";
  11121. return "<div style='white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:" + width + ";'>" + value + "</div>";
  11122. },
  11123. status: function (value, row, index) {
  11124. var custom = {normal: 'success', hidden: 'gray', deleted: 'danger', locked: 'info'};
  11125. if (typeof this.custom !== 'undefined') {
  11126. custom = $.extend(custom, this.custom);
  11127. }
  11128. this.custom = custom;
  11129. this.icon = 'fa fa-circle';
  11130. return Table.api.formatter.normal.call(this, value, row, index);
  11131. },
  11132. normal: function (value, row, index) {
  11133. var colorArr = ["primary", "success", "danger", "warning", "info", "gray", "red", "yellow", "aqua", "blue", "navy", "teal", "olive", "lime", "fuchsia", "purple", "maroon"];
  11134. var custom = {};
  11135. if (typeof this.custom !== 'undefined') {
  11136. custom = $.extend(custom, this.custom);
  11137. }
  11138. value = value == null || value.length === 0 ? '' : value.toString();
  11139. var keys = typeof this.searchList === 'object' ? Object.keys(this.searchList) : [];
  11140. var index = keys.indexOf(value);
  11141. var color = value && typeof custom[value] !== 'undefined' ? custom[value] : null;
  11142. var display = index > -1 ? this.searchList[value] : null;
  11143. var icon = typeof this.icon !== 'undefined' ? this.icon : null;
  11144. if (!color) {
  11145. color = index > -1 && typeof colorArr[index] !== 'undefined' ? colorArr[index] : 'primary';
  11146. }
  11147. if (!display) {
  11148. display = __(value.charAt(0).toUpperCase() + value.slice(1));
  11149. }
  11150. var html = '<span class="text-' + color + '">' + (icon ? '<i class="' + icon + '"></i> ' : '') + display + '</span>';
  11151. if (this.operate != false) {
  11152. html = '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + this.field + '" data-value="' + value + '">' + html + '</a>';
  11153. }
  11154. return html;
  11155. },
  11156. toggle: function (value, row, index) {
  11157. var table = this.table;
  11158. var options = table ? table.bootstrapTable('getOptions') : {};
  11159. var pk = options.pk || "id";
  11160. var color = typeof this.color !== 'undefined' ? this.color : 'success';
  11161. var yes = typeof this.yes !== 'undefined' ? this.yes : 1;
  11162. var no = typeof this.no !== 'undefined' ? this.no : 0;
  11163. var url = typeof this.url !== 'undefined' ? this.url : '';
  11164. var confirm = '';
  11165. var disable = false;
  11166. if (typeof this.confirm !== "undefined") {
  11167. confirm = typeof this.confirm === "function" ? this.confirm.call(this, value, row, index) : this.confirm;
  11168. }
  11169. if (typeof this.disable !== "undefined") {
  11170. disable = typeof this.disable === "function" ? this.disable.call(this, value, row, index) : this.disable;
  11171. }
  11172. return "<a href='javascript:;' data-toggle='tooltip' title='" + __('Click to toggle') + "' class='btn-change " + (disable ? 'btn disabled no-padding' : '') + "' data-index='" + index + "' data-id='"
  11173. + 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>";
  11174. },
  11175. url: function (value, row, index) {
  11176. value = value == null || value.length === 0 ? '' : value.toString();
  11177. 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>';
  11178. },
  11179. search: function (value, row, index) {
  11180. var field = this.field;
  11181. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  11182. value = row[this.customField];
  11183. field = this.customField;
  11184. }
  11185. return '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', value) + '" data-field="' + field + '" data-value="' + value + '">' + value + '</a>';
  11186. },
  11187. addtabs: function (value, row, index) {
  11188. var url = Table.api.replaceurl(this.url || '', row, this.table);
  11189. var title = this.atitle ? this.atitle : __("Search %s", value);
  11190. return '<a href="' + Fast.api.fixurl(url) + '" class="addtabsit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  11191. },
  11192. dialog: function (value, row, index) {
  11193. var url = Table.api.replaceurl(this.url || '', row, this.table);
  11194. var title = this.atitle ? this.atitle : __("View %s", value);
  11195. return '<a href="' + Fast.api.fixurl(url) + '" class="dialogit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  11196. },
  11197. flag: function (value, row, index) {
  11198. var that = this;
  11199. value = value == null || value.length === 0 ? '' : value.toString();
  11200. var colorArr = {index: 'success', hot: 'warning', recommend: 'danger', 'new': 'info'};
  11201. //如果字段列有定义custom
  11202. if (typeof this.custom !== 'undefined') {
  11203. colorArr = $.extend(colorArr, this.custom);
  11204. }
  11205. var field = this.field;
  11206. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  11207. value = row[this.customField];
  11208. field = this.customField;
  11209. }
  11210. if (typeof that.searchList === 'object' && typeof that.custom === 'undefined') {
  11211. var i = 0;
  11212. var searchValues = Object.values(colorArr);
  11213. $.each(that.searchList, function (key, val) {
  11214. if (typeof colorArr[key] == 'undefined') {
  11215. colorArr[key] = searchValues[i];
  11216. i = typeof searchValues[i + 1] === 'undefined' ? 0 : i + 1;
  11217. }
  11218. });
  11219. }
  11220. //渲染Flag
  11221. var html = [];
  11222. var arr = value != '' ? value.split(',') : [];
  11223. var color, display, label;
  11224. $.each(arr, function (i, value) {
  11225. value = value == null || value.length === 0 ? '' : value.toString();
  11226. if (value == '')
  11227. return true;
  11228. color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  11229. display = typeof that.searchList !== 'undefined' && typeof that.searchList[value] !== 'undefined' ? that.searchList[value] : __(value.charAt(0).toUpperCase() + value.slice(1));
  11230. label = '<span class="label label-' + color + '">' + display + '</span>';
  11231. if (that.operate) {
  11232. html.push('<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + field + '" data-value="' + value + '">' + label + '</a>');
  11233. } else {
  11234. html.push(label);
  11235. }
  11236. });
  11237. return html.join(' ');
  11238. },
  11239. label: function (value, row, index) {
  11240. return Table.api.formatter.flag.call(this, value, row, index);
  11241. },
  11242. datetime: function (value, row, index) {
  11243. var datetimeFormat = typeof this.datetimeFormat === 'undefined' ? 'YYYY-MM-DD HH:mm:ss' : this.datetimeFormat;
  11244. if (isNaN(value)) {
  11245. return value ? Moment(value).format(datetimeFormat) : __('None');
  11246. } else {
  11247. return value ? Moment(parseInt(value) * 1000).format(datetimeFormat) : __('None');
  11248. }
  11249. },
  11250. operate: function (value, row, index) {
  11251. var table = this.table;
  11252. // 操作配置
  11253. var options = table ? table.bootstrapTable('getOptions') : {};
  11254. // 默认按钮组
  11255. var buttons = $.extend([], this.buttons || []);
  11256. // 所有按钮名称
  11257. var names = [];
  11258. buttons.forEach(function (item) {
  11259. names.push(item.name);
  11260. });
  11261. if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
  11262. buttons.push(Table.button.dragsort);
  11263. }
  11264. if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
  11265. Table.button.edit.url = options.extend.edit_url;
  11266. buttons.push(Table.button.edit);
  11267. }
  11268. if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
  11269. buttons.push(Table.button.del);
  11270. }
  11271. return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
  11272. }
  11273. ,
  11274. buttons: function (value, row, index) {
  11275. // 默认按钮组
  11276. var buttons = $.extend([], this.buttons || []);
  11277. return Table.api.buttonlink(this, buttons, value, row, index, 'buttons');
  11278. }
  11279. },
  11280. buttonlink: function (column, buttons, value, row, index, type) {
  11281. var table = column.table;
  11282. column.clickToSelect = false;
  11283. type = typeof type === 'undefined' ? 'buttons' : type;
  11284. var options = table ? table.bootstrapTable('getOptions') : {};
  11285. var html = [];
  11286. var hidden, visible, disable, url, classname, icon, text, title, refresh, confirm, extend,
  11287. dropdown, link;
  11288. var fieldIndex = column.fieldIndex;
  11289. var dropdowns = {};
  11290. $.each(buttons, function (i, j) {
  11291. if (type === 'operate') {
  11292. if (j.name === 'dragsort' && typeof row[Table.config.dragsortfield] === 'undefined') {
  11293. return true;
  11294. }
  11295. if (['add', 'edit', 'del', 'multi', 'dragsort'].indexOf(j.name) > -1 && !options.extend[j.name + "_url"]) {
  11296. return true;
  11297. }
  11298. }
  11299. var attr = table.data(type + "-" + j.name);
  11300. if (typeof attr === 'undefined' || attr) {
  11301. hidden = typeof j.hidden === 'function' ? j.hidden.call(table, row, j) : (typeof j.hidden !== 'undefined' ? j.hidden : false);
  11302. if (hidden) {
  11303. return true;
  11304. }
  11305. visible = typeof j.visible === 'function' ? j.visible.call(table, row, j) : (typeof j.visible !== 'undefined' ? j.visible : true);
  11306. if (!visible) {
  11307. return true;
  11308. }
  11309. dropdown = j.dropdown ? j.dropdown : '';
  11310. url = j.url ? j.url : '';
  11311. url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
  11312. classname = j.classname ? j.classname : (dropdown ? 'btn-' + name + 'one' : 'btn-primary btn-' + name + 'one');
  11313. icon = j.icon ? j.icon : '';
  11314. text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : '';
  11315. title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text;
  11316. refresh = j.refresh ? 'data-refresh="' + j.refresh + '"' : '';
  11317. confirm = typeof j.confirm === 'function' ? j.confirm.call(table, row, j) : (typeof j.confirm !== 'undefined' ? j.confirm : false);
  11318. confirm = confirm ? 'data-confirm="' + confirm + '"' : '';
  11319. extend = j.extend ? j.extend : '';
  11320. disable = typeof j.disable === 'function' ? j.disable.call(table, row, j) : (typeof j.disable !== 'undefined' ? j.disable : false);
  11321. if (disable) {
  11322. classname = classname + ' disabled';
  11323. }
  11324. 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>';
  11325. if (dropdown) {
  11326. if (typeof dropdowns[dropdown] == 'undefined') {
  11327. dropdowns[dropdown] = [];
  11328. }
  11329. dropdowns[dropdown].push(link);
  11330. } else {
  11331. html.push(link);
  11332. }
  11333. }
  11334. });
  11335. if (!$.isEmptyObject(dropdowns)) {
  11336. var dropdownHtml = [];
  11337. $.each(dropdowns, function (i, j) {
  11338. 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>');
  11339. });
  11340. html.unshift(dropdownHtml);
  11341. }
  11342. return html.join(' ');
  11343. },
  11344. //替换URL中的数据
  11345. replaceurl: function (url, row, table) {
  11346. var options = table ? table.bootstrapTable('getOptions') : null;
  11347. var ids = options ? row[options.pk] : 0;
  11348. row.ids = ids ? ids : (typeof row.ids !== 'undefined' ? row.ids : 0);
  11349. url = url == null || url.length === 0 ? '' : url.toString();
  11350. //自动添加ids参数
  11351. url = !url.match(/\{ids\}/i) ? url + (url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + '{ids}' : url;
  11352. url = url.replace(/\{(.*?)\}/gi, function (matched) {
  11353. matched = matched.substring(1, matched.length - 1);
  11354. if (matched.indexOf(".") !== -1) {
  11355. var temp = row;
  11356. var arr = matched.split(/\./);
  11357. for (var i = 0; i < arr.length; i++) {
  11358. if (typeof temp[arr[i]] !== 'undefined') {
  11359. temp = temp[arr[i]];
  11360. }
  11361. }
  11362. return typeof temp === 'object' ? '' : temp;
  11363. }
  11364. return row[matched];
  11365. });
  11366. return url;
  11367. },
  11368. // 获取选中的条目ID集合
  11369. selectedids: function (table, current) {
  11370. var options = table.bootstrapTable('getOptions');
  11371. //如果有设置翻页记忆模式
  11372. if (!current && options.maintainSelected) {
  11373. return options.selectedIds;
  11374. }
  11375. return $.map(table.bootstrapTable('getSelections'), function (row) {
  11376. return row[options.pk];
  11377. });
  11378. },
  11379. //获取选中的数据
  11380. selecteddata: function (table, current) {
  11381. var options = table.bootstrapTable('getOptions');
  11382. //如果有设置翻页记忆模式
  11383. if (!current && options.maintainSelected) {
  11384. return options.selectedData;
  11385. }
  11386. return table.bootstrapTable('getSelections');
  11387. },
  11388. // 切换复选框状态
  11389. toggleattr: function (table) {
  11390. $("input[type='checkbox']", table).trigger('click');
  11391. },
  11392. // 根据行索引获取行数据
  11393. getrowdata: function (table, index) {
  11394. index = parseInt(index);
  11395. var data = table.bootstrapTable('getData');
  11396. return typeof data[index] !== 'undefined' ? data[index] : null;
  11397. },
  11398. // 根据行索引获取行数据
  11399. getrowbyindex: function (table, index) {
  11400. return Table.api.getrowdata(table, index);
  11401. },
  11402. // 根据主键ID获取行数据
  11403. getrowbyid: function (table, id) {
  11404. var row = {};
  11405. var options = table.bootstrapTable("getOptions");
  11406. $.each(Table.api.selecteddata(table), function (i, j) {
  11407. if (j[options.pk] == id) {
  11408. row = j;
  11409. return false;
  11410. }
  11411. });
  11412. return row;
  11413. }
  11414. },
  11415. };
  11416. return Table;
  11417. });
  11418. // jQuery List DragSort v0.5.2
  11419. // Website: http://dragsort.codeplex.com/
  11420. // License: http://dragsort.codeplex.com/license
  11421. (function($) {
  11422. $.fn.dragsort = function(options) {
  11423. if (options == "destroy") {
  11424. $(this.selector).trigger("dragsort-uninit");
  11425. return;
  11426. }
  11427. var opts = $.extend({}, $.fn.dragsort.defaults, options);
  11428. var lists = [];
  11429. var list = null, lastPos = null;
  11430. this.each(function(i, cont) {
  11431. //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
  11432. if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody"))
  11433. cont = $(cont).children().get(0);
  11434. var newList = {
  11435. draggedItem: null,
  11436. placeHolderItem: null,
  11437. pos: null,
  11438. offset: null,
  11439. offsetLimit: null,
  11440. scroll: null,
  11441. container: cont,
  11442. init: function() {
  11443. //set options to default values if not set
  11444. opts.tagName = opts.tagName == "" ? ($(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase()) : opts.tagName;
  11445. if (opts.itemSelector == "")
  11446. opts.itemSelector = opts.tagName;
  11447. if (opts.dragSelector == "")
  11448. opts.dragSelector = opts.tagName;
  11449. if (opts.placeHolderTemplate == "")
  11450. opts.placeHolderTemplate = "<" + opts.tagName + ">&nbsp;</" + opts.tagName + ">";
  11451. //listidx allows reference back to correct list variable instance
  11452. $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit);
  11453. this.styleDragHandlers(true);
  11454. },
  11455. uninit: function() {
  11456. var list = lists[$(this).attr("data-listidx")];
  11457. $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit");
  11458. list.styleDragHandlers(false);
  11459. },
  11460. getItems: function() {
  11461. return $(this.container).children(opts.itemSelector);
  11462. },
  11463. styleDragHandlers: function(cursor) {
  11464. this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : "");
  11465. },
  11466. grabItem: function(e) {
  11467. var list = lists[$(this).attr("data-listidx")];
  11468. var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0);
  11469. var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0;
  11470. //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return
  11471. if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem)
  11472. return;
  11473. //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,
  11474. //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude
  11475. //e.preventDefault();
  11476. //change cursor to move while dragging
  11477. var dragHandle = e.target;
  11478. while (!$(dragHandle).is(opts.dragSelector)) {
  11479. if (dragHandle == this) return;
  11480. dragHandle = dragHandle.parentNode;
  11481. }
  11482. $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor"));
  11483. $(dragHandle).css("cursor", "move");
  11484. //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work
  11485. var listElem = this;
  11486. var trigger = function() {
  11487. list.dragStart.call(listElem, e);
  11488. $(list.container).unbind("mousemove", trigger);
  11489. };
  11490. $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); });
  11491. },
  11492. dragStart: function(e) {
  11493. if (list != null && list.draggedItem != null)
  11494. list.dropItem();
  11495. list = lists[$(this).attr("data-listidx")];
  11496. list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName)
  11497. //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
  11498. list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem));
  11499. //calculate mouse offset relative to draggedItem
  11500. var mt = parseInt(list.draggedItem.css("marginTop"));
  11501. var ml = parseInt(list.draggedItem.css("marginLeft"));
  11502. list.offset = list.draggedItem.offset();
  11503. list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1;
  11504. list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1;
  11505. //calculate box the dragged item can't be dragged outside of
  11506. if (!opts.dragBetween) {
  11507. 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();
  11508. list.offsetLimit = $(list.container).offset();
  11509. list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth();
  11510. list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
  11511. }
  11512. //create placeholder item
  11513. var h = list.draggedItem.height();
  11514. var w = list.draggedItem.width();
  11515. if (opts.tagName == "tr") {
  11516. list.draggedItem.children().each(function() { $(this).width($(this).width()); });
  11517. list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true);
  11518. list.draggedItem.after(list.placeHolderItem);
  11519. //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html("&nbsp;"); });
  11520. list.placeHolderItem.children().each(function() { $(this).html("&nbsp;"); });
  11521. } else {
  11522. list.draggedItem.after(opts.placeHolderTemplate);
  11523. list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true);
  11524. }
  11525. if (opts.tagName == "td") {
  11526. var listTable = list.draggedItem.closest("table").get(0);
  11527. $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").appendTo("body").children().append(list.draggedItem);
  11528. }
  11529. //style draggedItem while dragging
  11530. var orig = list.draggedItem.attr("style");
  11531. list.draggedItem.attr("data-origstyle", orig ? orig : "");
  11532. list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w });
  11533. //auto-scroll setup
  11534. list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() };
  11535. list.scroll.scrollY = window.setInterval(function() {
  11536. if (opts.scrollContainer != window) {
  11537. $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY);
  11538. return;
  11539. }
  11540. var t = $(opts.scrollContainer).scrollTop();
  11541. if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) {
  11542. $(opts.scrollContainer).scrollTop(t + list.scroll.moveY);
  11543. list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1);
  11544. }
  11545. }, 10);
  11546. list.scroll.scrollX = window.setInterval(function() {
  11547. if (opts.scrollContainer != window) {
  11548. $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX);
  11549. return;
  11550. }
  11551. var l = $(opts.scrollContainer).scrollLeft();
  11552. if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) {
  11553. $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX);
  11554. list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1);
  11555. }
  11556. }, 10);
  11557. //misc
  11558. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  11559. list.setPos(e.pageX, e.pageY);
  11560. $(document).bind("mousemove", list.swapItems);
  11561. $(document).bind("mouseup", list.dropItem);
  11562. if (opts.scrollContainer != window)
  11563. $(window).bind("wheel", list.wheel);
  11564. },
  11565. //set position of draggedItem
  11566. setPos: function(x, y) {
  11567. //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner
  11568. var top = y - this.offset.top;
  11569. var left = x - this.offset.left;
  11570. //limit top, left to within box draggedItem can't be dragged outside of
  11571. if (!opts.dragBetween) {
  11572. top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
  11573. left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
  11574. }
  11575. //adjust top & left calculations to parent offset
  11576. var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin
  11577. if (parent != null) {
  11578. top -= parent.top;
  11579. left -= parent.left;
  11580. }
  11581. //set x or y auto-scroll amount
  11582. if (opts.scrollContainer == window) {
  11583. y -= $(window).scrollTop();
  11584. x -= $(window).scrollLeft();
  11585. y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5);
  11586. x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5);
  11587. } else {
  11588. var cont = $(opts.scrollContainer);
  11589. var offset = cont.offset();
  11590. y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top);
  11591. x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left);
  11592. }
  11593. list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x);
  11594. list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y);
  11595. //move draggedItem to new mouse cursor location
  11596. this.draggedItem.css({ top: top, left: left });
  11597. },
  11598. //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over
  11599. wheel: function(e) {
  11600. if (list && opts.scrollContainer != window) {
  11601. var cont = $(opts.scrollContainer);
  11602. var offset = cont.offset();
  11603. e = e.originalEvent;
  11604. if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) {
  11605. var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY;
  11606. cont.scrollTop(cont.scrollTop() + deltaY);
  11607. e.preventDefault();
  11608. }
  11609. }
  11610. },
  11611. //build a table recording all the positions of the moveable list items
  11612. buildPositionTable: function() {
  11613. var pos = [];
  11614. this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) {
  11615. var loc = $(this).offset();
  11616. loc.right = loc.left + $(this).outerWidth();
  11617. loc.bottom = loc.top + $(this).outerHeight();
  11618. loc.elm = this;
  11619. pos[i] = loc;
  11620. });
  11621. this.pos = pos;
  11622. },
  11623. dropItem: function() {
  11624. if (list.draggedItem == null)
  11625. return;
  11626. //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower
  11627. //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower)
  11628. var orig = list.draggedItem.attr("data-origstyle");
  11629. list.draggedItem.attr("style", orig);
  11630. if (orig == "")
  11631. list.draggedItem.removeAttr("style");
  11632. list.draggedItem.removeAttr("data-origstyle");
  11633. list.styleDragHandlers(true);
  11634. list.placeHolderItem.before(list.draggedItem);
  11635. list.placeHolderItem.remove();
  11636. $("[data-droptarget], .dragSortItem").remove();
  11637. window.clearInterval(list.scroll.scrollY);
  11638. window.clearInterval(list.scroll.scrollX);
  11639. //if position changed call dragEnd
  11640. if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem))
  11641. if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order
  11642. var pos = list.draggedItem.attr("data-origpos").split('-');
  11643. var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]);
  11644. if (nextItem.size() > 0)
  11645. nextItem.before(list.draggedItem);
  11646. else if (pos[1] == 0) //was the only item in list
  11647. $(lists[pos[0]].container).prepend(list.draggedItem);
  11648. else //was the last item in list
  11649. $(lists[pos[0]].container).append(list.draggedItem);
  11650. }
  11651. list.draggedItem.removeAttr("data-origpos");
  11652. list.draggedItem = null;
  11653. $(document).unbind("mousemove", list.swapItems);
  11654. $(document).unbind("mouseup", list.dropItem);
  11655. if (opts.scrollContainer != window)
  11656. $(window).unbind("wheel", list.wheel);
  11657. return false;
  11658. },
  11659. //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of
  11660. swapItems: function(e) {
  11661. if (list.draggedItem == null)
  11662. return false;
  11663. //move draggedItem to mouse location
  11664. list.setPos(e.pageX, e.pageY);
  11665. //retrieve list and item position mouse cursor is over
  11666. var ei = list.findPos(e.pageX, e.pageY);
  11667. var nlist = list;
  11668. for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) {
  11669. ei = lists[i].findPos(e.pageX, e.pageY);
  11670. nlist = lists[i];
  11671. }
  11672. //if not over another moveable list item return
  11673. if (ei == -1)
  11674. return false;
  11675. //save fixed items locations
  11676. var children = function() { return $(nlist.container).children().not(nlist.draggedItem); };
  11677. var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); });
  11678. //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after
  11679. if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left)
  11680. $(nlist.pos[ei].elm).before(list.placeHolderItem);
  11681. else
  11682. $(nlist.pos[ei].elm).after(list.placeHolderItem);
  11683. //restore fixed items location
  11684. fixed.each(function() {
  11685. var elm = children().eq(this.idx).get(0);
  11686. if (this != elm && children().index(this) < this.idx)
  11687. $(this).insertAfter(elm);
  11688. else if (this != elm)
  11689. $(this).insertBefore(elm);
  11690. });
  11691. //misc
  11692. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  11693. lastPos = list.draggedItem.offset();
  11694. return false;
  11695. },
  11696. //returns the index of the list item the mouse is over
  11697. findPos: function(x, y) {
  11698. for (var i = 0; i < this.pos.length; i++) {
  11699. if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y)
  11700. return i;
  11701. }
  11702. return -1;
  11703. },
  11704. //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position
  11705. createDropTargets: function() {
  11706. if (!opts.dragBetween)
  11707. return;
  11708. $(lists).each(function() {
  11709. var ph = $(this.container).find("[data-placeholder]");
  11710. var dt = $(this.container).find("[data-droptarget]");
  11711. if (ph.size() > 0 && dt.size() > 0)
  11712. dt.remove();
  11713. else if (ph.size() == 0 && dt.size() == 0) {
  11714. if (opts.tagName == "td")
  11715. $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container);
  11716. else
  11717. //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8)
  11718. $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true));
  11719. list.placeHolderItem.attr("data-placeholder", true);
  11720. }
  11721. });
  11722. }
  11723. };
  11724. newList.init();
  11725. lists.push(newList);
  11726. });
  11727. return this;
  11728. };
  11729. $.fn.dragsort.defaults = {
  11730. tagName:"",
  11731. itemSelector: "",
  11732. dragSelector: "",
  11733. dragSelectorExclude: "input, textarea",
  11734. dragEnd: function() { },
  11735. dragBetween: false,
  11736. placeHolderTemplate: "",
  11737. scrollContainer: window,
  11738. scrollSpeed: 5
  11739. };
  11740. })(jQuery);
  11741. define("dragsort", function(){});
  11742. /*!
  11743. * jquery.event.drag - v 2.2
  11744. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  11745. * Open Source MIT License - http://threedubmedia.com/code/license
  11746. */
  11747. ;(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);
  11748. define("drag", function(){});
  11749. /*!
  11750. * jquery.event.drop - v 2.2
  11751. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  11752. * Open Source MIT License - http://threedubmedia.com/code/license
  11753. */
  11754. ;(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);
  11755. define("drop", function(){});
  11756. /**
  11757. * http://git.oschina.net/hbbcs/bootStrap-addTabs
  11758. * Created by joe on 2015-12-19.
  11759. * Modified by Karson
  11760. */
  11761. (function ($) {
  11762. $.fn.addtabs = function (options) {
  11763. var obj = $(this);
  11764. options = $.extend({
  11765. content: '', //直接指定所有页面TABS内容
  11766. close: true, //是否可以关闭
  11767. monitor: 'body', //监视的区域
  11768. nav: '.nav-addtabs',
  11769. tab: '.tab-addtabs',
  11770. iframeUse: true, //使用iframe还是ajax
  11771. iframeHeight: $(window).height() - 50, //固定TAB中IFRAME高度,根据需要自己修改
  11772. iframeForceRefresh: false, //点击后强制加载对应的iframe
  11773. iframeForceRefreshTable: false, //点击后强制刷新对应的iframe中的table
  11774. callback: function () {
  11775. //关闭后回调函数
  11776. }
  11777. }, options || {});
  11778. var navobj = $(options.nav);
  11779. var tabobj = $(options.tab);
  11780. if (history.pushState) {
  11781. //浏览器前进后退事件
  11782. $(window).on("popstate", function (e) {
  11783. var state = e.originalEvent.state;
  11784. if (state) {
  11785. $("a[addtabs=" + state.id + "]", options.monitor).data("pushstate", true).trigger("click");
  11786. }
  11787. });
  11788. }
  11789. $(options.monitor).on('click', '[addtabs]', function (e) {
  11790. if ($(this).attr('url').indexOf("javascript:") !== 0) {
  11791. if ($(this).is("a")) {
  11792. e.preventDefault();
  11793. }
  11794. var id = $(this).attr('addtabs');
  11795. var title = $(this).attr('title') ? $(this).attr('title') : $.trim($(this).text());
  11796. var url = $(this).attr('url');
  11797. var content = options.content ? options.content : $(this).attr('content');
  11798. var ajax = $(this).attr('ajax') === '1' || $(this).attr('ajax') === 'true';
  11799. var state = ({
  11800. url: url, title: title, id: id, content: content, ajax: ajax
  11801. });
  11802. document.title = title;
  11803. if (history.pushState && !$(this).data("pushstate")) {
  11804. var pushurl = url.indexOf("ref=addtabs") === -1 ? (url + (url.indexOf("?") > -1 ? "&" : "?") + "ref=addtabs") : url;
  11805. try {
  11806. window.history.pushState(state, title, pushurl);
  11807. } catch (e) {
  11808. }
  11809. }
  11810. $(this).data("pushstate", null);
  11811. _add.call(this, {
  11812. id: id,
  11813. title: $(this).attr('title') ? $(this).attr('title') : $(this).html(),
  11814. content: content,
  11815. url: url,
  11816. ajax: ajax
  11817. });
  11818. }
  11819. });
  11820. navobj.on('click', '.close-tab', function () {
  11821. var id = $(this).prev("a").attr("aria-controls");
  11822. _close(id);
  11823. return false;
  11824. });
  11825. navobj.on('dblclick', 'li[role=presentation]', function () {
  11826. $(this).find(".close-tab").trigger("click");
  11827. });
  11828. navobj.on('click', 'li[role=presentation]', function () {
  11829. $("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click");
  11830. });
  11831. $(window).resize(function () {
  11832. if (typeof options.nav === 'object') {
  11833. var siblingsWidth = 0;
  11834. navobj.siblings().each(function () {
  11835. siblingsWidth += $(this).outerWidth();
  11836. });
  11837. navobj.width(navobj.parent().width() - siblingsWidth);
  11838. } else {
  11839. $("#nav").width($("#header").find("> .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20);
  11840. }
  11841. _drop();
  11842. });
  11843. var _add = function (opts) {
  11844. var id, tabid, conid, url;
  11845. id = opts.id;
  11846. tabid = 'tab_' + opts.id;
  11847. conid = 'con_' + opts.id;
  11848. url = opts.url;
  11849. url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1");
  11850. var tabitem = $('#' + tabid, navobj);
  11851. var conitem = $('#' + conid, tabobj);
  11852. navobj.find("[role='presentation']").removeClass('active');
  11853. tabobj.find("[role='tabpanel']").removeClass('active');
  11854. //如果TAB不存在,创建一个新的TAB
  11855. if (tabitem.size() === 0) {
  11856. //创建新TAB的title
  11857. 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>');
  11858. //是否允许关闭
  11859. if (options.close && $("li", navobj).size() > 0) {
  11860. tabitem.append(' <i class="close-tab fa fa-remove"></i>');
  11861. }
  11862. if (conitem.size() === 0) {
  11863. //创建新TAB的内容
  11864. conitem = $('<div role="tabpanel" class="tab-pane" id="' + conid + '"></div>');
  11865. //是否指定TAB内容
  11866. if (opts.content) {
  11867. conitem.append(opts.content);
  11868. } else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接
  11869. var height = options.iframeHeight;
  11870. 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>');
  11871. } else {
  11872. $.get(url, function (data) {
  11873. conitem.append(data);
  11874. });
  11875. }
  11876. tabobj.append(conitem);
  11877. }
  11878. //加入TABS
  11879. if ($('.tabdrop li', navobj).size() > 0) {
  11880. $('.tabdrop ul', navobj).append(tabitem);
  11881. } else {
  11882. navobj.append(tabitem);
  11883. }
  11884. } else {
  11885. //强制刷新iframe
  11886. if (options.iframeForceRefresh) {
  11887. $("#" + conid + " iframe").attr('src', function (i, val) {
  11888. return val;
  11889. });
  11890. } else if (options.iframeForceRefreshTable) {
  11891. try {
  11892. //检测iframe中是否存在刷新按钮
  11893. if ($("#" + conid + " iframe").contents().find(".btn-refresh:not([data-force-refresh=false])").size() > 0) {
  11894. $("#" + conid + " iframe")[0].contentWindow.$(".btn-refresh:not([data-force-refresh=false])").trigger("click");
  11895. }
  11896. } catch (e) {
  11897. }
  11898. }
  11899. }
  11900. localStorage.setItem("addtabs", $(this).prop('outerHTML'));
  11901. //激活TAB
  11902. tabitem.addClass('active');
  11903. conitem.addClass("active");
  11904. _drop();
  11905. };
  11906. var _close = function (id) {
  11907. var tabid = 'tab_' + id;
  11908. var conid = 'con_' + id;
  11909. var tabitem = $('#' + tabid, navobj);
  11910. var conitem = $('#' + conid, tabobj);
  11911. //如果关闭的是当前激活的TAB,激活他的前一个TAB
  11912. if (obj.find("li.active").not('.tabdrop').attr('id') === tabid) {
  11913. var prev = tabitem.prev().not(".tabdrop");
  11914. var next = tabitem.next().not(".tabdrop");
  11915. if (prev.size() > 0) {
  11916. prev.find('a').trigger("click");
  11917. } else if (next.size() > 0) {
  11918. next.find('a').trigger("click");
  11919. } else {
  11920. $(">li:not(.tabdrop):last > a", navobj).trigger('click');
  11921. }
  11922. }
  11923. //关闭TAB
  11924. tabitem.remove();
  11925. conitem.remove();
  11926. _drop();
  11927. options.callback();
  11928. };
  11929. var _drop = function () {
  11930. navobj.refreshAddtabs();
  11931. };
  11932. };
  11933. //刷新Addtabs
  11934. $.fn.refreshAddtabs = function () {
  11935. var navobj = $(this);
  11936. var dropdown = $(".tabdrop", navobj);
  11937. if (dropdown.size() === 0) {
  11938. dropdown = $('<li class="dropdown pull-right hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;">' +
  11939. '<i class="glyphicon glyphicon-align-justify"></i>' +
  11940. ' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>');
  11941. dropdown.prependTo(navobj);
  11942. }
  11943. //检测是否有下拉样式
  11944. if (navobj.parent().is('.tabs-below')) {
  11945. dropdown.addClass('dropup');
  11946. }
  11947. var collection = 0;
  11948. var maxwidth = navobj.width() - 65;
  11949. var liwidth = 0;
  11950. //检查超过一行的标签页
  11951. var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop');
  11952. var totalwidth = 0;
  11953. litabs.each(function () {
  11954. totalwidth += $(this).outerWidth(true);
  11955. });
  11956. if (navobj.width() < totalwidth) {
  11957. litabs.each(function () {
  11958. liwidth += $(this).outerWidth(true);
  11959. if (liwidth > maxwidth) {
  11960. dropdown.find('ul').append($(this));
  11961. collection++;
  11962. }
  11963. });
  11964. if (collection > 0) {
  11965. dropdown.removeClass('hide');
  11966. if (dropdown.find('.active').length === 1) {
  11967. dropdown.addClass('active');
  11968. } else {
  11969. dropdown.removeClass('active');
  11970. }
  11971. }
  11972. } else {
  11973. dropdown.addClass('hide');
  11974. }
  11975. };
  11976. })(jQuery);
  11977. define("addtabs", function(){});
  11978. /**
  11979. * @summary SelectPage
  11980. * @desc Simple and powerful selection plugin
  11981. * @file selectpage.js
  11982. * @version 2.19
  11983. * @author TerryZeng
  11984. * @contact https://terryz.github.io/
  11985. * @license MIT License
  11986. *
  11987. */
  11988. ;(function ($) {
  11989. "use strict";
  11990. /**
  11991. * Default options
  11992. */
  11993. var defaults = {
  11994. /**
  11995. * Data source
  11996. * @type {string|Object}
  11997. *
  11998. * string:server side request url address
  11999. * Object:JSON array,format:[{a:1,b:2,c:3},{...}]
  12000. */
  12001. data: undefined,
  12002. /**
  12003. * Language ('cn', 'en')
  12004. * @type string
  12005. * @default 'cn'
  12006. */
  12007. lang: 'cn',
  12008. /**
  12009. * Multiple select mode(tags)
  12010. * @type boolean
  12011. * @default false
  12012. */
  12013. multiple: false,
  12014. /**
  12015. * pagination or not
  12016. * @type boolean
  12017. * @default true
  12018. */
  12019. pagination: true,
  12020. /**
  12021. * Show up menu button
  12022. * @type boolean
  12023. * @default true
  12024. */
  12025. dropButton: true,
  12026. /**
  12027. * Result list visible size in pagination bar close
  12028. * @type number
  12029. * @default 10
  12030. */
  12031. listSize: 10,
  12032. /**
  12033. * Show control bar in multiple select mode
  12034. * @type boolean
  12035. * @default true
  12036. */
  12037. multipleControlbar: true,
  12038. /**
  12039. * Max selected item limited in multiple select mode
  12040. * @type number
  12041. * @default 0(unlimited)
  12042. */
  12043. maxSelectLimit: 0,
  12044. /**
  12045. * Select result item to close list, work on multiple select mode
  12046. * @type boolean
  12047. * @default false
  12048. */
  12049. selectToCloseList: false,
  12050. /**
  12051. * Init selected item key, the result will match to option.keyField option
  12052. * @type string
  12053. */
  12054. initRecord: undefined,
  12055. /**
  12056. * The table parameter in server side mode
  12057. * @type string
  12058. */
  12059. dbTable: 'tbl',
  12060. /**
  12061. * The value field, the value will fill to hidden element
  12062. * @type string
  12063. * @default 'id'
  12064. */
  12065. keyField: 'id',
  12066. /**
  12067. * The show text field, the text will show to input element or tags(multiple mode)
  12068. * @type string
  12069. * @default 'name'
  12070. */
  12071. showField: 'name',
  12072. /**
  12073. * Actually used to search field
  12074. * @type string
  12075. */
  12076. searchField: undefined,
  12077. /**
  12078. * Search type ('AND' or 'OR')
  12079. * @type string
  12080. * @default 'AND'
  12081. */
  12082. andOr: 'OR',
  12083. /**
  12084. * Result sort type
  12085. * @type array|boolean - if not set, will default used showField field
  12086. * @example
  12087. * orderBy : ['id desc']
  12088. */
  12089. orderBy: undefined,
  12090. /**
  12091. * Page size
  12092. * @type number
  12093. * @default 10
  12094. */
  12095. pageSize: 10,
  12096. /**
  12097. * Server side request parameters
  12098. * @type function
  12099. * @return object
  12100. * @example params : function(){return {'name':'aa','sex':1};}
  12101. */
  12102. params: undefined,
  12103. /**
  12104. * Custom result list item show text
  12105. * @type function
  12106. * @param data {object} row data
  12107. * @return string
  12108. */
  12109. formatItem: undefined,
  12110. /**
  12111. * Have some highlight item and lost focus, auto select the highlight item
  12112. * @type boolean
  12113. * @default false
  12114. */
  12115. autoFillResult: false,
  12116. /**
  12117. * Auto select first item in show up result list or search result
  12118. * depend on `autoFillResult` option set to true
  12119. * @type boolean
  12120. * @default false
  12121. */
  12122. autoSelectFirst: false,
  12123. /**
  12124. * Whether clear input element text when enter some keywords to search and no result return
  12125. * @type boolean
  12126. * @default true
  12127. */
  12128. noResultClean: true,
  12129. /**
  12130. * Select only mode
  12131. * @type boolean
  12132. */
  12133. selectOnly: false,
  12134. /**
  12135. * Input to search delay time, work on ajax data source
  12136. * @type number
  12137. * @default 0.5
  12138. */
  12139. inputDelay: 0.5,
  12140. /**
  12141. * -----------------------------------------Callback--------------------------------------------
  12142. */
  12143. /**
  12144. * Result list item selected callback
  12145. * @type function
  12146. * @param object - selected item json data
  12147. * @param self - plugin object
  12148. */
  12149. eSelect: undefined,
  12150. /**
  12151. * Before result list show up callback, you can do anything prepared
  12152. * @param self - plugin object
  12153. */
  12154. eOpen: undefined,
  12155. /**
  12156. * Server side return data convert callback
  12157. * @type function
  12158. * @param data {object} server side return data
  12159. * @param self {object} plugin object
  12160. * @return {object} return data format:
  12161. * @example
  12162. * {
  12163. * list : [{name:'aa',sex:1},{name:'bb',sex:1}...],
  12164. * totalRow : 100
  12165. * }
  12166. */
  12167. eAjaxSuccess: undefined,
  12168. /**
  12169. * Close selected item tag callback (multiple mode)
  12170. * @type function
  12171. * @param removeCount {number} remove item count
  12172. * @param self {object} plugin object
  12173. */
  12174. eTagRemove: undefined,
  12175. /**
  12176. * Clear selected item callback(single select mode)
  12177. * @type function
  12178. * @param self {object} plugin object
  12179. */
  12180. eClear: undefined
  12181. };
  12182. /**
  12183. * SelectPage class definition
  12184. * @constructor
  12185. * @param {Object} input - input element
  12186. * @param {Object} option
  12187. */
  12188. var SelectPage = function (input, option) {
  12189. //特殊字段处理
  12190. $.each({data: 'source', keyField: 'primaryKey', showField: 'field', pageSize: 'perPage'}, function (i, j) {
  12191. if (typeof option[j] !== 'undefined') {
  12192. option[i] = option[j];
  12193. delete option[j];
  12194. }
  12195. });
  12196. this.setOption(option);
  12197. this.setLanguage();
  12198. this.setCssClass();
  12199. this.setProp();
  12200. this.setElem(input);
  12201. this.setButtonAttrDefault();
  12202. this.setInitRecord();
  12203. this.eDropdownButton();
  12204. this.eInput();
  12205. this.eWhole();
  12206. };
  12207. /**
  12208. * Plugin version number
  12209. */
  12210. SelectPage.version = '2.19';
  12211. /**
  12212. * Plugin object cache key
  12213. */
  12214. SelectPage.dataKey = 'selectPageObject';
  12215. /**
  12216. * Options set
  12217. * @param {Object} option
  12218. */
  12219. SelectPage.prototype.setOption = function (option) {
  12220. //use showField to default
  12221. option.searchField = option.searchField || option.showField;
  12222. option.andOr = option.andOr.toUpperCase();
  12223. if (option.andOr !== 'AND' && option.andOr !== 'OR') option.andOr = 'AND';
  12224. //support multiple field set
  12225. var arr = ['searchField'];
  12226. for (var i = 0; i < arr.length; i++) {
  12227. option[arr[i]] = this.strToArray(option[arr[i]]);
  12228. }
  12229. //set default order field
  12230. option.orderBy = option.orderBy || option.showField;
  12231. //set multiple order field
  12232. //example: [ ['id', 'ASC'], ['name', 'DESC'] ]
  12233. if (option.orderBy !== false) option.orderBy = this.setOrderbyOption(option.orderBy, option.showField);
  12234. //close auto fill result and auto select first in multiple mode and select item not close list
  12235. if (option.multiple && !option.selectToCloseList) {
  12236. option.autoFillResult = false;
  12237. option.autoSelectFirst = false;
  12238. }
  12239. //show all item when pagination bar close, limited 200
  12240. if (!option.pagination) option.pageSize = 200;
  12241. if ($.type(option.listSize) !== 'number' || option.listSize < 0) option.listSize = 10;
  12242. if (typeof option.formatItem === 'string') {
  12243. var _formatItem = option.formatItem;
  12244. option.formatItem = function (row) {
  12245. if (typeof Template === 'function' && _formatItem.match(/\#([a-zA-Z0-9_\-]+)$/)) {
  12246. return Template(_formatItem.substring(1), row);
  12247. } else {
  12248. return _formatItem.replace(/\{(.*?)\}/gi, function (matched) {
  12249. matched = matched.substring(1, matched.length - 1);
  12250. return typeof row[matched] !== 'undefined' ? row[matched] : '';
  12251. });
  12252. }
  12253. };
  12254. }
  12255. this.option = option;
  12256. };
  12257. /**
  12258. * String convert to array
  12259. * @param str {string}
  12260. * @return {Array}
  12261. */
  12262. SelectPage.prototype.strToArray = function (str) {
  12263. return str ? str.replace(/[\s ]+/g, '').split(',') : '';
  12264. };
  12265. /**
  12266. * Set order field
  12267. * @param {Array} arg_order
  12268. * @param {string} arg_field - default sort field
  12269. * @return {Array}
  12270. */
  12271. SelectPage.prototype.setOrderbyOption = function (arg_order, arg_field) {
  12272. var arr = [], orders = [];
  12273. if (typeof arg_order === 'object') {
  12274. for (var i = 0; i < arg_order.length; i++) {
  12275. orders = $.trim(arg_order[i]).split(' ');
  12276. if (orders.length)
  12277. arr.push((orders.length === 2) ? orders.concat() : [orders[0], 'ASC']);
  12278. }
  12279. } else {
  12280. orders = $.trim(arg_order).split(' ');
  12281. arr[0] = (orders.length === 2) ? orders.concat() : (orders[0].toUpperCase().match(/^(ASC|DESC)$/i)) ? [arg_field, orders[0].toUpperCase()] : [orders[0], 'ASC'];
  12282. }
  12283. return arr;
  12284. };
  12285. /**
  12286. * i18n
  12287. */
  12288. SelectPage.prototype.setLanguage = function () {
  12289. var message, p = this.option;
  12290. switch (p.lang) {
  12291. // English
  12292. case 'en':
  12293. message = {
  12294. add_btn: 'Add button',
  12295. add_title: 'add a box',
  12296. del_btn: 'Del button',
  12297. del_title: 'delete a box',
  12298. next: 'Next',
  12299. next_title: 'Next' + p.pageSize + ' (Right key)',
  12300. prev: 'Prev',
  12301. prev_title: 'Prev' + p.pageSize + ' (Left key)',
  12302. first_title: 'First (Shift + Left key)',
  12303. last_title: 'Last (Shift + Right key)',
  12304. get_all_btn: 'Get All (Down key)',
  12305. get_all_alt: '(button)',
  12306. close_btn: 'Close (Tab key)',
  12307. close_alt: '(button)',
  12308. loading: 'loading...',
  12309. loading_alt: '(loading)',
  12310. page_info: 'page_num of page_count',
  12311. select_ng: 'Attention : Please choose from among the list.',
  12312. select_ok: 'OK : Correctly selected.',
  12313. not_found: 'not found',
  12314. ajax_error: 'An error occurred while connecting to server.',
  12315. clear: 'Clear content',
  12316. select_all: 'Select current page',
  12317. unselect_all: 'Clear current page',
  12318. clear_all: 'Clear all selected',
  12319. max_selected: 'You can only select up to max_selected_limit items'
  12320. };
  12321. break;
  12322. // 中文
  12323. case 'cn':
  12324. default:
  12325. message = {
  12326. add_btn: '添加按钮',
  12327. add_title: '添加区域',
  12328. del_btn: '删除按钮',
  12329. del_title: '删除区域',
  12330. next: '下一页',
  12331. next_title: '下' + p.pageSize + ' (→)',
  12332. prev: '上一页',
  12333. prev_title: '上' + p.pageSize + ' (←)',
  12334. first_title: '首页 (Shift + ←)',
  12335. last_title: '尾页 (Shift + →)',
  12336. get_all_btn: '获得全部 (↓)',
  12337. get_all_alt: '(按钮)',
  12338. close_btn: '关闭 (Tab键)',
  12339. close_alt: '(按钮)',
  12340. loading: '读取中...',
  12341. loading_alt: '(读取中)',
  12342. page_info: '第 page_num 页(共page_count页)',
  12343. select_ng: '请注意:请从列表中选择.',
  12344. select_ok: 'OK : 已经选择.',
  12345. not_found: '无查询结果',
  12346. ajax_error: '连接到服务器时发生错误!',
  12347. clear: '清除内容',
  12348. select_all: '选择当前页项目',
  12349. unselect_all: '取消选择当前页项目',
  12350. clear_all: '清除全部已选择项目',
  12351. max_selected: '最多只能选择 max_selected_limit 个项目'
  12352. };
  12353. break;
  12354. }
  12355. this.message = message;
  12356. };
  12357. /**
  12358. * Css classname defined
  12359. */
  12360. SelectPage.prototype.setCssClass = function () {
  12361. var css_class = {
  12362. container: 'sp_container',
  12363. container_open: 'sp_container_open',
  12364. re_area: 'sp_result_area',
  12365. result_open: 'sp_result_area_open',
  12366. control_box: 'sp_control_box',
  12367. //multiple select mode
  12368. element_box: 'sp_element_box',
  12369. navi: 'sp_navi',
  12370. //result list
  12371. results: 'sp_results',
  12372. re_off: 'sp_results_off',
  12373. select: 'sp_over',
  12374. select_ok: 'sp_select_ok',
  12375. select_ng: 'sp_select_ng',
  12376. selected: 'sp_selected',
  12377. input_off: 'sp_input_off',
  12378. message_box: 'sp_message_box',
  12379. disabled: 'sp_disabled',
  12380. button: 'sp_button',
  12381. caret_open: 'sp_caret_open',
  12382. btn_on: 'sp_btn_on',
  12383. btn_out: 'sp_btn_out',
  12384. input: 'sp_input',
  12385. clear_btn: 'sp_clear_btn',
  12386. align_right: 'sp_align_right'
  12387. };
  12388. this.css_class = css_class;
  12389. };
  12390. /**
  12391. * Plugin inner properties
  12392. */
  12393. SelectPage.prototype.setProp = function () {
  12394. this.prop = {
  12395. //input disabled status
  12396. disabled: false,
  12397. current_page: 1,
  12398. //total page
  12399. max_page: 1,
  12400. //ajax data loading status
  12401. is_loading: false,
  12402. xhr: false,
  12403. key_paging: false,
  12404. key_select: false,
  12405. //last selected item value
  12406. prev_value: '',
  12407. //last selected item text
  12408. selected_text: '',
  12409. last_input_time: undefined,
  12410. init_set: false
  12411. };
  12412. this.template = {
  12413. tag: {
  12414. content: '<li class="selected_tag" itemvalue="#item_value#">#item_text#<span class="tag_close"><i class="spfont sp-close"></i></span></li>',
  12415. textKey: '#item_text#',
  12416. valueKey: '#item_value#'
  12417. },
  12418. page: {
  12419. current: 'page_num',
  12420. total: 'page_count'
  12421. },
  12422. msg: {
  12423. maxSelectLimit: 'max_selected_limit'
  12424. }
  12425. };
  12426. };
  12427. /**
  12428. * Get the actual width/height of invisible DOM elements with jQuery.
  12429. * Source code come from dreamerslab/jquery.actual
  12430. * @param element
  12431. * @param method
  12432. * @returns {*}
  12433. */
  12434. SelectPage.prototype.elementRealSize = function (element, method) {
  12435. var defaults = {
  12436. absolute: false,
  12437. clone: false,
  12438. includeMargin: false,
  12439. display: 'block'
  12440. };
  12441. var configs = defaults, $target = element.eq(0), fix, restore, tmp = [], style = '', $hidden;
  12442. fix = function () {
  12443. // get all hidden parents
  12444. $hidden = $target.parents().addBack().filter(':hidden');
  12445. style += 'visibility: hidden !important; display: ' + configs.display + ' !important; ';
  12446. if (configs.absolute === true) style += 'position: absolute !important;';
  12447. // save the origin style props
  12448. // set the hidden el css to be got the actual value later
  12449. $hidden.each(function () {
  12450. // Save original style. If no style was set, attr() returns undefined
  12451. var $this = $(this), thisStyle = $this.attr('style');
  12452. tmp.push(thisStyle);
  12453. // Retain as much of the original style as possible, if there is one
  12454. $this.attr('style', thisStyle ? thisStyle + ';' + style : style);
  12455. });
  12456. };
  12457. restore = function () {
  12458. // restore origin style values
  12459. $hidden.each(function (i) {
  12460. var $this = $(this), _tmp = tmp[i];
  12461. if (_tmp === undefined) $this.removeAttr('style');
  12462. else $this.attr('style', _tmp);
  12463. });
  12464. };
  12465. fix();
  12466. // get the actual value with user specific methed
  12467. // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc
  12468. // configs.includeMargin only works for 'outerWidth' and 'outerHeight'
  12469. var actual = /(outer)/.test(method) ?
  12470. $target[method](configs.includeMargin) :
  12471. $target[method]();
  12472. restore();
  12473. // IMPORTANT, this plugin only return the value of the first element
  12474. return actual;
  12475. };
  12476. /**
  12477. * Dom building
  12478. * @param {Object} combo_input - original input element
  12479. */
  12480. SelectPage.prototype.setElem = function (combo_input) {
  12481. // 1. build Dom object
  12482. var elem = {}, p = this.option, css = this.css_class, msg = this.message, input = $(combo_input);
  12483. var cssWidth = input.css("width");
  12484. var orgWidth = input.outerWidth();
  12485. if (cssWidth.indexOf("%") > -1 || input.parent().size() > 0 && input.parent().width() == orgWidth) {
  12486. orgWidth = "100%";
  12487. } else {
  12488. // fix input width in hidden situation
  12489. if (orgWidth <= 0) orgWidth = this.elementRealSize(input, 'outerWidth');
  12490. if (orgWidth < 150) orgWidth = 150;
  12491. }
  12492. elem.combo_input = input.attr({'autocomplete': 'off'}).addClass(css.input).wrap('<div>');
  12493. if (p.selectOnly) elem.combo_input.prop('readonly', true);
  12494. elem.container = elem.combo_input.parent().addClass(css.container);
  12495. if (elem.combo_input.prop('disabled')) {
  12496. if (p.multiple) elem.container.addClass(css.disabled);
  12497. else elem.combo_input.addClass(css.input_off);
  12498. }
  12499. // set outer box width
  12500. elem.container.width(orgWidth);
  12501. elem.button = $('<div>').addClass(css.button);
  12502. //drop down button
  12503. elem.dropdown = $('<span class="sp_caret"></span>');
  12504. //clear button 'X' in single mode
  12505. elem.clear_btn = $('<div>').html($('<i>').addClass('spfont sp-close')).addClass(css.clear_btn).attr('title', msg.clear);
  12506. if (!p.dropButton) elem.clear_btn.addClass(css.align_right);
  12507. //main box in multiple mode
  12508. elem.element_box = $('<ul>').addClass(css.element_box);
  12509. if (p.multiple && p.multipleControlbar)
  12510. elem.control = $('<div>').addClass(css.control_box);
  12511. //result list box
  12512. elem.result_area = $('<div>').addClass(css.re_area);
  12513. //pagination bar
  12514. if (p.pagination) elem.navi = $('<div>').addClass('sp_pagination').append('<ul>');
  12515. elem.results = $('<ul>').addClass(css.results);
  12516. var namePrefix = '_text',
  12517. input_id = elem.combo_input.attr('id') || elem.combo_input.attr('name'),
  12518. input_name = elem.combo_input.attr('name') || 'selectPage',
  12519. hidden_name = input_name,
  12520. hidden_id = input_id;
  12521. //switch the id and name attributes of input/hidden element
  12522. elem.hidden = $('<input type="hidden" class="sp_hidden" />').attr({
  12523. name: hidden_name,
  12524. id: hidden_id
  12525. }).val('');
  12526. elem.combo_input.attr({
  12527. name: typeof input.data('name') !== 'undefined' ? input.data('name') : input_name + namePrefix,
  12528. id: input_id + namePrefix
  12529. });
  12530. // 2. DOM element put
  12531. elem.container.append(elem.hidden);
  12532. if (p.dropButton) {
  12533. elem.container.append(elem.button)
  12534. elem.button.append(elem.dropdown);
  12535. }
  12536. $(document.body).append(elem.result_area);
  12537. elem.result_area.append(elem.results);
  12538. if (p.pagination) elem.result_area.append(elem.navi);
  12539. //Multiple select mode
  12540. if (p.multiple) {
  12541. if (p.multipleControlbar) {
  12542. elem.control.append('<button type="button" class="btn btn-default sp_clear_all" ><i class="spfont sp-clear"></i></button>');
  12543. elem.control.append('<button type="button" class="btn btn-default sp_unselect_all" ><i class="spfont sp-unselect-all"></i></button>');
  12544. elem.control.append('<button type="button" class="btn btn-default sp_select_all" ><i class="spfont sp-select-all"></i></button>');
  12545. elem.control_text = $('<p>');
  12546. elem.control.append(elem.control_text);
  12547. elem.result_area.prepend(elem.control);
  12548. }
  12549. elem.container.addClass('sp_container_combo');
  12550. elem.combo_input.addClass('sp_combo_input').before(elem.element_box);
  12551. var li = $('<li>').addClass('input_box');
  12552. li.append(elem.combo_input);
  12553. elem.element_box.append(li);
  12554. if (elem.combo_input.attr('placeholder')) elem.combo_input.attr('placeholder_bak', elem.combo_input.attr('placeholder'));
  12555. }
  12556. this.elem = elem;
  12557. };
  12558. /**
  12559. * Drop down button set to default
  12560. */
  12561. SelectPage.prototype.setButtonAttrDefault = function () {
  12562. /*
  12563. if (this.option.selectOnly) {
  12564. if ($(this.elem.combo_input).val() !== '') {
  12565. if ($(this.elem.hidden).val() !== '') {
  12566. //选择条件
  12567. $(this.elem.combo_input).attr('title', this.message.select_ok).removeClass(this.css_class.select_ng).addClass(this.css_class.select_ok);
  12568. } else {
  12569. //输入方式
  12570. $(this.elem.combo_input).attr('title', this.message.select_ng).removeClass(this.css_class.select_ok).addClass(this.css_class.select_ng);
  12571. }
  12572. } else {
  12573. $(this.elem.hidden).val('');
  12574. $(this.elem.combo_input).removeAttr('title').removeClass(this.css_class.select_ng);
  12575. }
  12576. }
  12577. */
  12578. //this.elem.button.attr('title', this.message.get_all_btn);
  12579. if (this.option.dropButton)
  12580. this.elem.button.attr('title', this.message.close_btn);
  12581. };
  12582. /**
  12583. * Set item need selected after init
  12584. * set selected item ways:
  12585. * <input value="key">
  12586. * <input data-init="key">
  12587. */
  12588. SelectPage.prototype.setInitRecord = function (refresh) {
  12589. var self = this, p = self.option, el = self.elem, key = '';
  12590. if ($.type(el.combo_input.data('init')) != 'undefined')
  12591. p.initRecord = String(el.combo_input.data('init'));
  12592. //data-init and value attribute can be init plugin selected item
  12593. //but, if set data-init and value attribute in the same time, plugin will choose data-init attribute first
  12594. if (!refresh && !p.initRecord && el.combo_input.val())
  12595. p.initRecord = el.combo_input.val();
  12596. el.combo_input.val('');
  12597. if (!refresh) el.hidden.val(p.initRecord);
  12598. key = refresh && el.hidden.val() ? el.hidden.val() : p.initRecord;
  12599. if (key) {
  12600. if (typeof p.data === 'object') {
  12601. var data = new Array();
  12602. var keyarr = key.split(',');
  12603. $.each(keyarr, function (index, row) {
  12604. for (var i = 0; i < p.data.length; i++) {
  12605. if (p.data[i][p.keyField] == row) {
  12606. data.push(p.data[i]);
  12607. break;
  12608. }
  12609. }
  12610. });
  12611. if (!p.multiple && data.length > 1) data = [data[0]];
  12612. self.afterInit(self, data);
  12613. } else {//ajax data source mode to init selected item
  12614. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  12615. var _orgParams = {
  12616. searchTable: p.dbTable,
  12617. searchKey: p.keyField,
  12618. searchValue: key,
  12619. orderBy: p.orderBy,
  12620. showField: p.showField,
  12621. keyField: p.keyField,
  12622. keyValue: key,
  12623. searchField: p.searchField
  12624. };
  12625. if (_paramsFunc) {
  12626. var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
  12627. if (result && $.isPlainObject(result)) {
  12628. _params = $.extend({}, _orgParams, result);
  12629. } else {
  12630. _params = _orgParams;
  12631. }
  12632. } else {
  12633. _params = _orgParams;
  12634. }
  12635. $.ajax({
  12636. dataType: 'json',
  12637. type: 'POST',
  12638. url: p.data,
  12639. data: _params,
  12640. success: function (json) {
  12641. var d = null;
  12642. if (p.eAjaxSuccess && $.isFunction(p.eAjaxSuccess))
  12643. d = p.eAjaxSuccess(json);
  12644. self.afterInit(self, d.list);
  12645. },
  12646. error: function (jqXHR, textStatus, errorThrown) {
  12647. self.ajaxErrorNotify(self, errorThrown);
  12648. }
  12649. });
  12650. }
  12651. }
  12652. };
  12653. /**
  12654. * Selected item set to plugin
  12655. * @param {Object} self
  12656. * @param {Object} data - selected item data
  12657. */
  12658. SelectPage.prototype.afterInit = function (self, data) {
  12659. if (!data || ($.isArray(data) && data.length === 0)) return;
  12660. if (!$.isArray(data)) data = [data];
  12661. var p = self.option, css = self.css_class;
  12662. self.data = data;
  12663. if (p.multiple) {
  12664. self.prop.init_set = true;
  12665. self.clearAll(self);
  12666. $.each(data, function (i, row) {
  12667. var value = row[p.keyField];
  12668. var text = row[p.showField];
  12669. var item = {text: text, value: value};
  12670. if (!self.isAlreadySelected(self, item)) self.addNewTag(self, row, item);
  12671. });
  12672. self.tagValuesSet(self);
  12673. self.inputResize(self);
  12674. self.elem.hidden.blur();
  12675. self.prop.init_set = false;
  12676. } else {
  12677. var row = data[0];
  12678. var value = row[p.keyField];
  12679. var text = row[p.showField];
  12680. self.elem.combo_input.val(text);
  12681. self.elem.hidden.val(value);
  12682. self.prop.prev_value = text;
  12683. self.prop.selected_text = text;
  12684. if (p.selectOnly) {
  12685. self.elem.combo_input.attr('title', self.message.select_ok).removeClass(css.select_ng).addClass(css.select_ok);
  12686. }
  12687. self.putClearButton();
  12688. }
  12689. };
  12690. /**
  12691. * Drop down button event bind
  12692. */
  12693. SelectPage.prototype.eDropdownButton = function () {
  12694. var self = this;
  12695. if (self.option.dropButton) {
  12696. self.elem.button.mouseup(function (ev) {
  12697. ev.stopPropagation();
  12698. if (self.elem.result_area.is(':hidden') && !self.elem.combo_input.prop('disabled')) {
  12699. self.elem.combo_input.focus();
  12700. } else self.hideResults(self);
  12701. });
  12702. }
  12703. };
  12704. /**
  12705. * Events bind
  12706. */
  12707. SelectPage.prototype.eInput = function () {
  12708. var self = this, p = self.option, el = self.elem, msg = self.message;
  12709. var showList = function () {
  12710. self.prop.page_move = false;
  12711. self.suggest(self);
  12712. self.setCssFocusedInput(self);
  12713. };
  12714. el.combo_input.keyup(function (e) {
  12715. self.processKey(self, e);
  12716. }).keydown(function (e) {
  12717. self.processControl(self, e);
  12718. }).focus(function (e) {
  12719. //When focus on input, show the result list
  12720. if (el.result_area.is(':hidden')) {
  12721. e.stopPropagation();
  12722. self.prop.first_show = true;
  12723. showList();
  12724. }
  12725. });
  12726. el.container.on('click.SelectPage', 'div.' + self.css_class.clear_btn, function (e) {
  12727. e.stopPropagation();
  12728. if (!self.disabled(self)) {
  12729. self.clearAll(self, true);
  12730. self.elem.hidden.change();
  12731. if (p.eClear && $.isFunction(p.eClear)) p.eClear(self);
  12732. }
  12733. });
  12734. el.result_area.on('mousedown.SelectPage', function (e) {
  12735. e.stopPropagation();
  12736. });
  12737. if (p.multiple) {
  12738. if (p.multipleControlbar) {
  12739. //Select all item of current page
  12740. el.control.find('.sp_select_all').on('click.SelectPage', function (e) {
  12741. self.selectAllLine(self);
  12742. }).hover(function () {
  12743. el.control_text.html(msg.select_all);
  12744. }, function () {
  12745. el.control_text.html('');
  12746. });
  12747. //Cancel select all item of current page
  12748. el.control.find('.sp_unselect_all').on('click.SelectPage', function (e) {
  12749. self.unSelectAllLine(self);
  12750. }).hover(function () {
  12751. el.control_text.html(msg.unselect_all);
  12752. }, function () {
  12753. el.control_text.html('');
  12754. });
  12755. //Clear all selected item
  12756. el.control.find('.sp_clear_all').on('click.SelectPage', function (e) {
  12757. self.clearAll(self, true);
  12758. }).hover(function () {
  12759. el.control_text.html(msg.clear_all);
  12760. }, function () {
  12761. el.control_text.html('');
  12762. });
  12763. }
  12764. el.element_box.on('click.SelectPage', function (e) {
  12765. var srcEl = e.target || e.srcElement;
  12766. if ($(srcEl).is('ul')) el.combo_input.focus();
  12767. });
  12768. //Tag close
  12769. el.element_box.on('click.SelectPage', 'span.tag_close', function () {
  12770. var li = $(this).closest('li'), data = li.data('dataObj');
  12771. self.removeTag(self, li);
  12772. showList();
  12773. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove([data]);
  12774. });
  12775. self.inputResize(self);
  12776. }
  12777. };
  12778. /**
  12779. * Out of plugin area click event handler
  12780. */
  12781. SelectPage.prototype.eWhole = function () {
  12782. var self = this, css = self.css_class;
  12783. var cleanContent = function (obj) {
  12784. obj.elem.combo_input.val('');
  12785. if (!obj.option.multiple) obj.elem.hidden.val('');
  12786. obj.prop.selected_text = '';
  12787. };
  12788. //Out of plugin area
  12789. $(document.body).off('mousedown.selectPage').on('mousedown.selectPage', function (e) {
  12790. var ele = e.target || e.srcElement;
  12791. var sp = $(ele).closest('div.' + css.container);
  12792. //Open status result list
  12793. $('div.' + css.container + '.' + css.container_open).each(function () {
  12794. if (this == sp[0]) return;
  12795. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey);
  12796. if (!d.elem.combo_input.val() && d.elem.hidden.val() && !d.option.multiple) {
  12797. d.prop.current_page = 1;//reset page to 1
  12798. cleanContent(d);
  12799. d.hideResults(d);
  12800. return true;
  12801. }
  12802. if (d.elem.results.find('li').not('.' + css.message_box).length) {
  12803. if (d.option.autoFillResult) {
  12804. //have selected item, then hide result list
  12805. if (d.elem.hidden.val()) d.hideResults(d);
  12806. else if (d.elem.results.find('li.sp_over').length) {
  12807. //no one selected and have highlight item, select the highlight item
  12808. d.selectCurrentLine(d, true);
  12809. } else if (d.option.autoSelectFirst) {
  12810. //no one selected, no one highlight, select the first item
  12811. d.nextLine(d);
  12812. d.selectCurrentLine(d, true);
  12813. } else d.hideResults(d);
  12814. } else d.hideResults(d);
  12815. } else {
  12816. //when no one item match, clear search keywords
  12817. if (d.option.noResultClean) cleanContent(d);
  12818. else {
  12819. if (!d.option.multiple) d.elem.hidden.val('');
  12820. }
  12821. d.hideResults(d);
  12822. }
  12823. });
  12824. });
  12825. };
  12826. /**
  12827. * Result list event bind
  12828. */
  12829. SelectPage.prototype.eResultList = function () {
  12830. var self = this, css = this.css_class;
  12831. self.elem.results.children('li').hover(function () {
  12832. if (self.prop.key_select) {
  12833. self.prop.key_select = false;
  12834. return;
  12835. }
  12836. if (!$(this).hasClass(css.selected) && !$(this).hasClass(css.message_box)) {
  12837. $(this).addClass(css.select);
  12838. self.setCssFocusedResults(self);
  12839. }
  12840. }, function () {
  12841. $(this).removeClass(css.select);
  12842. }).click(function (e) {
  12843. if (self.prop.key_select) {
  12844. self.prop.key_select = false;
  12845. return;
  12846. }
  12847. e.preventDefault();
  12848. e.stopPropagation();
  12849. if (!$(this).hasClass(css.selected)) self.selectCurrentLine(self, false);
  12850. });
  12851. };
  12852. /**
  12853. * Reposition result list when list beyond the visible area
  12854. */
  12855. SelectPage.prototype.eScroll = function () {
  12856. var self = this, css = this.css_class;
  12857. $(window).on('scroll.SelectPage', function (e) {
  12858. $('div.' + css.container + '.' + css.container_open).each(function () {
  12859. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey),
  12860. offset = d.elem.result_area.offset(),
  12861. screenScrollTop = $(window).scrollTop(),
  12862. docHeight = $(document).height(),
  12863. viewHeight = $(window).height(),
  12864. listHeight = d.elem.result_area.outerHeight(),
  12865. listBottom = offset.top + listHeight,
  12866. hasOverflow = docHeight > viewHeight,
  12867. down = d.elem.result_area.hasClass('shadowDown');
  12868. if (hasOverflow) {
  12869. if (down) {//open down
  12870. if (listBottom > (viewHeight + screenScrollTop)) d.calcResultsSize(d);
  12871. } else {//open up
  12872. if (offset.top < screenScrollTop) d.calcResultsSize(d);
  12873. }
  12874. }
  12875. });
  12876. });
  12877. };
  12878. /**
  12879. * Page bar button event bind
  12880. */
  12881. SelectPage.prototype.ePaging = function () {
  12882. var self = this;
  12883. if (!self.option.pagination) return;
  12884. self.elem.navi.find('li.csFirstPage').off('click').on('click', function (ev) {
  12885. //$(self.elem.combo_input).focus();
  12886. ev.preventDefault();
  12887. self.firstPage(self);
  12888. });
  12889. self.elem.navi.find('li.csPreviousPage').off('click').on('click', function (ev) {
  12890. //$(self.elem.combo_input).focus();
  12891. ev.preventDefault();
  12892. self.prevPage(self);
  12893. });
  12894. self.elem.navi.find('li.csNextPage').off('click').on('click', function (ev) {
  12895. //$(self.elem.combo_input).focus();
  12896. ev.preventDefault();
  12897. self.nextPage(self);
  12898. });
  12899. self.elem.navi.find('li.csLastPage').off('click').on('click', function (ev) {
  12900. //$(self.elem.combo_input).focus();
  12901. ev.preventDefault();
  12902. self.lastPage(self);
  12903. });
  12904. };
  12905. /**
  12906. * Ajax request fail
  12907. * @param {Object} self
  12908. * @param {string} errorThrown
  12909. */
  12910. SelectPage.prototype.ajaxErrorNotify = function (self, errorThrown) {
  12911. self.showMessage(self.message.ajax_error);
  12912. };
  12913. /**
  12914. * Message box
  12915. * @param {Object} self
  12916. * @param msg {string} the text need to show
  12917. */
  12918. SelectPage.prototype.showMessage = function (self, msg) {
  12919. if (!msg) return;
  12920. var msgLi = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' + msg + '</li>';
  12921. self.elem.results.empty().append(msgLi).show();
  12922. self.calcResultsSize(self);
  12923. self.setOpenStatus(self, true);
  12924. self.elem.control.hide();
  12925. if (self.option.pagination) self.elem.navi.hide();
  12926. };
  12927. /**
  12928. * @desc Scroll
  12929. * @param {Object} self
  12930. * @param {boolean} enforce
  12931. */
  12932. SelectPage.prototype.scrollWindow = function (self, enforce) {
  12933. var current_result = self.getCurrentLine(self),
  12934. target_top = (current_result && !enforce) ? current_result.offset().top : self.elem.container.offset().top,
  12935. target_size;
  12936. self.prop.size_li = self.elem.results.children('li:first').outerHeight();
  12937. target_size = self.prop.size_li;
  12938. var gap, client_height = $(window).height(),
  12939. scroll_top = $(window).scrollTop(),
  12940. scroll_bottom = scroll_top + client_height - target_size;
  12941. if (current_result.length) {
  12942. if (target_top < scroll_top || target_size > client_height) {
  12943. //scroll to top
  12944. gap = target_top - scroll_top;
  12945. } else if (target_top > scroll_bottom) {
  12946. //scroll down
  12947. gap = target_top - scroll_bottom;
  12948. } else return; //do not scroll
  12949. } else if (target_top < scroll_top) gap = target_top - scroll_top;
  12950. window.scrollBy(0, gap);
  12951. };
  12952. /**
  12953. * change css class by status
  12954. * @param self
  12955. * @param status {boolean} true: open, false: close
  12956. */
  12957. SelectPage.prototype.setOpenStatus = function (self, status) {
  12958. var el = self.elem, css = self.css_class;
  12959. if (status) {
  12960. el.container.addClass(css.container_open);
  12961. el.result_area.addClass(css.result_open);
  12962. } else {
  12963. el.container.removeClass(css.container_open);
  12964. el.result_area.removeClass(css.result_open);
  12965. }
  12966. };
  12967. /**
  12968. * input element in focus css class set
  12969. * @param {Object} self
  12970. */
  12971. SelectPage.prototype.setCssFocusedInput = function (self) {
  12972. //$(self.elem.results).addClass(self.css_class.re_off);
  12973. //$(self.elem.combo_input).removeClass(self.css_class.input_off);
  12974. };
  12975. /**
  12976. * set result list get focus and input element lost focus
  12977. * @param {Object} self
  12978. */
  12979. SelectPage.prototype.setCssFocusedResults = function (self) {
  12980. //$(self.elem.results).removeClass(self.css_class.re_off);
  12981. //$(self.elem.combo_input).addClass(self.css_class.input_off);
  12982. };
  12983. /**
  12984. * Quick search input keywords listener
  12985. * @param {Object} self
  12986. */
  12987. SelectPage.prototype.checkValue = function (self) {
  12988. var now_value = self.elem.combo_input.val();
  12989. if (now_value != self.prop.prev_value) {
  12990. self.prop.prev_value = now_value;
  12991. self.prop.first_show = false;
  12992. if (self.option.selectOnly) self.setButtonAttrDefault();
  12993. if (!self.option.multiple && !now_value) {
  12994. self.elem.combo_input.val('');
  12995. self.elem.hidden.val('');
  12996. self.elem.clear_btn.remove();
  12997. }
  12998. self.suggest(self);
  12999. }
  13000. };
  13001. /**
  13002. * Input handle(regular input)
  13003. * @param {Object} self
  13004. * @param {Object} e - event object
  13005. */
  13006. SelectPage.prototype.processKey = function (self, e) {
  13007. if ($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9, 13]) === -1) {
  13008. if (e.keyCode != 16) self.setCssFocusedInput(self); // except Shift(16)
  13009. self.inputResize(self);
  13010. if ($.type(self.option.data) === 'string') {
  13011. self.prop.last_input_time = e.timeStamp;
  13012. setTimeout(function () {
  13013. if ((e.timeStamp - self.prop.last_input_time) === 0)
  13014. self.checkValue(self);
  13015. }, self.option.inputDelay * 1000);
  13016. } else {
  13017. self.checkValue(self);
  13018. }
  13019. }
  13020. }
  13021. /**
  13022. * Input handle(control key)
  13023. * @param {Object} self
  13024. * @param {Object} e - event object
  13025. */
  13026. SelectPage.prototype.processControl = function (self, e) {
  13027. if (($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9]) > -1 && self.elem.result_area.is(':visible')) ||
  13028. ($.inArray(e.keyCode, [13, 9]) > -1 && self.getCurrentLine(self))) {
  13029. e.preventDefault();
  13030. e.stopPropagation();
  13031. e.cancelBubble = true;
  13032. e.returnValue = false;
  13033. switch (e.keyCode) {
  13034. case 37:// left
  13035. if (e.shiftKey) self.firstPage(self);
  13036. else self.prevPage(self);
  13037. break;
  13038. case 38:// up
  13039. self.prop.key_select = true;
  13040. self.prevLine(self);
  13041. break;
  13042. case 39:// right
  13043. if (e.shiftKey) self.lastPage(self);
  13044. else self.nextPage(self);
  13045. break;
  13046. case 40:// down
  13047. if (self.elem.results.children('li').length) {
  13048. self.prop.key_select = true;
  13049. self.nextLine(self);
  13050. } else self.suggest(self);
  13051. break;
  13052. case 9:// tab
  13053. self.prop.key_paging = true;
  13054. self.selectCurrentLine(self, true);
  13055. //self.hideResults(self);
  13056. break;
  13057. case 13:// return
  13058. self.selectCurrentLine(self, true);
  13059. break;
  13060. case 27:// escape
  13061. self.prop.key_paging = true;
  13062. self.hideResults(self);
  13063. break;
  13064. }
  13065. }
  13066. };
  13067. /**
  13068. * Abort Ajax request
  13069. * @param {Object} self
  13070. */
  13071. SelectPage.prototype.abortAjax = function (self) {
  13072. if (self.prop.xhr) {
  13073. self.prop.xhr.abort();
  13074. self.prop.xhr = false;
  13075. }
  13076. };
  13077. /**
  13078. * Suggest result of search keywords
  13079. * @param {Object} self
  13080. */
  13081. SelectPage.prototype.suggest = function (self) {
  13082. var q_word, val = $.trim(self.elem.combo_input.val());
  13083. if (self.option.multiple) q_word = val;
  13084. else {
  13085. if (val && val === self.prop.selected_text) q_word = '';
  13086. else q_word = val;
  13087. }
  13088. q_word = q_word.split(/[\s ]+/);
  13089. //Before show up result list callback
  13090. if (self.option.eOpen && $.isFunction(self.option.eOpen))
  13091. self.option.eOpen.call(self);
  13092. self.abortAjax(self);
  13093. //self.setLoading(self);
  13094. var which_page_num = self.prop.current_page || 1;
  13095. if (typeof self.option.data == 'object') self.searchForJson(self, q_word, which_page_num);
  13096. else self.searchForDb(self, q_word, which_page_num);
  13097. };
  13098. /**
  13099. * Loading
  13100. * @param {Object} self
  13101. */
  13102. SelectPage.prototype.setLoading = function (self) {
  13103. if (self.elem.results.html() === '') {
  13104. //self.calcResultsSize(self);
  13105. self.setOpenStatus(self, true);
  13106. }
  13107. };
  13108. /**
  13109. * Search for ajax
  13110. * @param {Object} self
  13111. * @param {Array} q_word - query keyword
  13112. * @param {number} which_page_num - target page number
  13113. */
  13114. SelectPage.prototype.searchForDb = function (self, q_word, which_page_num) {
  13115. var p = self.option;
  13116. if (!p.eAjaxSuccess || !$.isFunction(p.eAjaxSuccess)) self.hideResults(self);
  13117. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  13118. //when have new query keyword, then reset page number to 1.
  13119. if (q_word.length && q_word[0] && q_word[0] !== self.prop.prev_value) which_page_num = 1;
  13120. var _orgParams = {
  13121. q_word: q_word,
  13122. pageNumber: which_page_num,
  13123. pageSize: p.pageSize,
  13124. andOr: p.andOr,
  13125. orderBy: p.orderBy,
  13126. searchTable: p.dbTable,
  13127. showField: self.option.showField,
  13128. keyField: self.option.keyField,
  13129. searchField: self.option.searchField
  13130. };
  13131. if (p.orderBy !== false) _orgParams.orderBy = p.orderBy;
  13132. _orgParams[searchKey] = q_word[0];
  13133. if (_paramsFunc) {
  13134. var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
  13135. if (result && $.isPlainObject(result)) {
  13136. _params = $.extend({}, _orgParams, result);
  13137. } else {
  13138. _params = _orgParams;
  13139. }
  13140. } else {
  13141. _params = _orgParams;
  13142. }
  13143. self.prop.xhr = $.ajax({
  13144. dataType: 'json',
  13145. url: p.data,
  13146. type: 'POST',
  13147. data: _params,
  13148. success: function (returnData) {
  13149. if (!returnData || !$.isPlainObject(returnData)) {
  13150. self.hideResults(self);
  13151. self.ajaxErrorNotify(self, errorThrown);
  13152. return;
  13153. }
  13154. var data = {}, json = {};
  13155. try {
  13156. data = p.eAjaxSuccess(returnData);
  13157. json.originalResult = data.list;
  13158. json.cnt_whole = data.totalRow;
  13159. } catch (e) {
  13160. self.showMessage(self, self.message.ajax_error);
  13161. return;
  13162. }
  13163. if (self.elem.navi) {
  13164. $(self.elem.navi).toggleClass("hide", json.cnt_whole <= json.originalResult.length);
  13165. }
  13166. json.candidate = [];
  13167. json.keyField = [];
  13168. if (typeof json.originalResult != 'object') {
  13169. self.prop.xhr = null;
  13170. self.notFoundSearch(self);
  13171. return;
  13172. }
  13173. json.cnt_page = json.originalResult.length;
  13174. for (var i = 0; i < json.cnt_page; i++) {
  13175. for (var key in json.originalResult[i]) {
  13176. if (key == p.keyField) {
  13177. json.keyField.push(json.originalResult[i][key]);
  13178. }
  13179. if (key == p.showField) {
  13180. json.candidate.push(json.originalResult[i][key]);
  13181. }
  13182. }
  13183. }
  13184. self.prepareResults(self, json, q_word, which_page_num);
  13185. },
  13186. error: function (jqXHR, textStatus, errorThrown) {
  13187. if (textStatus != 'abort') {
  13188. self.hideResults(self);
  13189. self.ajaxErrorNotify(self, errorThrown);
  13190. }
  13191. },
  13192. complete: function () {
  13193. self.prop.xhr = null;
  13194. }
  13195. });
  13196. };
  13197. /**
  13198. * Search for json data source
  13199. * @param {Object} self
  13200. * @param {Array} q_word
  13201. * @param {number} which_page_num
  13202. */
  13203. SelectPage.prototype.searchForJson = function (self, q_word, which_page_num) {
  13204. var p = self.option, matched = [], esc_q = [], sorted = [], json = {}, i = 0, arr_reg = [];
  13205. //query keyword filter
  13206. do {
  13207. //'/\W/g'正则代表全部不是字母,数字,下划线,汉字的字符
  13208. //将非法字符进行转义
  13209. esc_q[i] = q_word[i].replace(/\W/g, '\\$&').toString();
  13210. arr_reg[i] = new RegExp(esc_q[i], 'gi');
  13211. i++;
  13212. } while (i < q_word.length);
  13213. // SELECT * FROM data WHERE field LIKE q_word;
  13214. for (var i = 0; i < p.data.length; i++) {
  13215. var flag = false, row = p.data[i], itemText;
  13216. for (var j = 0; j < arr_reg.length; j++) {
  13217. itemText = row[p.searchField];
  13218. if (p.formatItem && $.isFunction(p.formatItem))
  13219. itemText = p.formatItem(row);
  13220. if (itemText.match(arr_reg[j])) {
  13221. flag = true;
  13222. if (p.andOr == 'OR') break;
  13223. } else {
  13224. flag = false;
  13225. if (p.andOr == 'AND') break;
  13226. }
  13227. }
  13228. if (flag) matched.push(row);
  13229. }
  13230. // (CASE WHEN ...) then く order some column
  13231. if (p.orderBy === false) sorted = matched.concat();
  13232. else {
  13233. var reg1 = new RegExp('^' + esc_q[0] + '$', 'gi'),
  13234. reg2 = new RegExp('^' + esc_q[0], 'gi'),
  13235. matched1 = [], matched2 = [], matched3 = [];
  13236. for (var i = 0; i < matched.length; i++) {
  13237. var orderField = p.orderBy[0][0];
  13238. var orderValue = String(matched[i][orderField]);
  13239. if (orderValue.match(reg1)) {
  13240. matched1.push(matched[i]);
  13241. } else if (orderValue.match(reg2)) {
  13242. matched2.push(matched[i]);
  13243. } else {
  13244. matched3.push(matched[i]);
  13245. }
  13246. }
  13247. if (p.orderBy[0][1].match(/^asc$/i)) {
  13248. matched1 = self.sortAsc(self, matched1);
  13249. matched2 = self.sortAsc(self, matched2);
  13250. matched3 = self.sortAsc(self, matched3);
  13251. } else {
  13252. matched1 = self.sortDesc(self, matched1);
  13253. matched2 = self.sortDesc(self, matched2);
  13254. matched3 = self.sortDesc(self, matched3);
  13255. }
  13256. sorted = sorted.concat(matched1).concat(matched2).concat(matched3);
  13257. }
  13258. /*
  13259. if (sorted.length === undefined || sorted.length === 0 ) {
  13260. self.notFoundSearch(self);
  13261. return;
  13262. }
  13263. */
  13264. json.cnt_whole = sorted.length;
  13265. //page_move used to distinguish between init plugin or page moving
  13266. if (!self.prop.page_move) {
  13267. //only single mode can be used page number relocation
  13268. if (!p.multiple) {
  13269. //get selected item belong page number
  13270. var currentValue = self.elem.hidden.val();
  13271. if ($.type(currentValue) !== 'undefined' && $.trim(currentValue) !== '') {
  13272. var index = 0;
  13273. $.each(sorted, function (i, row) {
  13274. if (row[p.keyField] == currentValue) {
  13275. index = i + 1;
  13276. return false;
  13277. }
  13278. });
  13279. which_page_num = Math.ceil(index / p.pageSize);
  13280. if (which_page_num < 1) which_page_num = 1;
  13281. self.prop.current_page = which_page_num;
  13282. }
  13283. }
  13284. } else {
  13285. //set page number to 1 when result number less then page size
  13286. if (sorted.length <= ((which_page_num - 1) * p.pageSize)) {
  13287. which_page_num = 1;
  13288. self.prop.current_page = 1;
  13289. }
  13290. }
  13291. //LIMIT xx OFFSET xx
  13292. var start = (which_page_num - 1) * p.pageSize, end = start + p.pageSize;
  13293. //save original data
  13294. json.originalResult = [];
  13295. //after data filter handle
  13296. for (var i = start; i < end; i++) {
  13297. if (sorted[i] === undefined) break;
  13298. json.originalResult.push(sorted[i]);
  13299. for (var key in sorted[i]) {
  13300. if (key == p.keyField) {
  13301. if (json.keyField === undefined) json.keyField = [];
  13302. json.keyField.push(sorted[i][key]);
  13303. }
  13304. if (key == p.showField) {
  13305. if (json.candidate === undefined) json.candidate = [];
  13306. json.candidate.push(sorted[i][key]);
  13307. }
  13308. }
  13309. }
  13310. if (json.candidate === undefined) json.candidate = [];
  13311. json.cnt_page = json.candidate.length;
  13312. self.prepareResults(self, json, q_word, which_page_num);
  13313. };
  13314. /**
  13315. * Set order asc
  13316. * @param {Object} self
  13317. * @param {Array} arr - result array
  13318. */
  13319. SelectPage.prototype.sortAsc = function (self, arr) {
  13320. arr.sort(function (a, b) {
  13321. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  13322. return $.type(valA) === 'number' ? valA - valB : String(valA).localeCompare(String(valB));
  13323. });
  13324. return arr;
  13325. };
  13326. /**
  13327. * Set order desc
  13328. * @param {Object} self
  13329. * @param {Array} arr - result array
  13330. */
  13331. SelectPage.prototype.sortDesc = function (self, arr) {
  13332. arr.sort(function (a, b) {
  13333. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  13334. return $.type(valA) === 'number' ? valB - valA : String(valB).localeCompare(String(valA));
  13335. });
  13336. return arr;
  13337. };
  13338. /**
  13339. * Not result found handle
  13340. * @param {Object} self
  13341. */
  13342. SelectPage.prototype.notFoundSearch = function (self) {
  13343. self.elem.results.empty();
  13344. self.calcResultsSize(self);
  13345. self.setOpenStatus(self, true);
  13346. self.setCssFocusedInput(self);
  13347. };
  13348. /**
  13349. * Prepare data to show
  13350. * @param {Object} self
  13351. * @param {Object} json - data result
  13352. * @param {Array} q_word - query keyword
  13353. * @param {number} which_page_num - target page number
  13354. */
  13355. SelectPage.prototype.prepareResults = function (self, json, q_word, which_page_num) {
  13356. self.data = json.originalResult;
  13357. if (self.option.pagination) self.setNavi(self, json.cnt_whole, json.cnt_page, which_page_num);
  13358. if (!json.keyField) json.keyField = false;
  13359. if (self.option.selectOnly && json.candidate.length === 1 && json.candidate[0] == q_word[0]) {
  13360. self.elem.hidden.val(json.keyField[0]);
  13361. this.setButtonAttrDefault();
  13362. }
  13363. var is_query = false;
  13364. if (q_word && q_word.length && q_word[0]) is_query = true;
  13365. self.displayResults(self, json, is_query);
  13366. };
  13367. /**
  13368. * Build page bar
  13369. * @param {Object} self
  13370. * @param {number} cnt_whole - total record count
  13371. * @param {number} cnt_page
  13372. * @param {number} page_num - current page number
  13373. */
  13374. SelectPage.prototype.setNavi = function (self, cnt_whole, cnt_page, page_num) {
  13375. var msg = self.message;
  13376. /**
  13377. * build pagination bar
  13378. */
  13379. var buildPageNav = function (self, pagebar, page_num, last_page) {
  13380. var updatePageInfo = function () {
  13381. var pageInfo = msg.page_info;
  13382. return pageInfo.replace(self.template.page.current, page_num).replace(self.template.page.total, last_page);
  13383. };
  13384. if (pagebar.find('li').length === 0) {
  13385. pagebar.hide().empty();
  13386. var iconFist = 'spfont sp-first',
  13387. iconPrev = 'spfont sp-previous',
  13388. iconNext = 'spfont sp-next',
  13389. iconLast = 'spfont sp-last';
  13390. pagebar.append('<li class="csFirstPage" title="' + msg.first_title + '" ><a href="javascript:void(0);"> <i class="' + iconFist + '"></i> </a></li>');
  13391. pagebar.append('<li class="csPreviousPage" title="' + msg.prev_title + '" ><a href="javascript:void(0);"><i class="' + iconPrev + '"></i></a></li>');
  13392. //pagination information
  13393. pagebar.append('<li class="pageInfoBox"><a href="javascript:void(0);"> ' + updatePageInfo() + ' </a></li>');
  13394. pagebar.append('<li class="csNextPage" title="' + msg.next_title + '" ><a href="javascript:void(0);"><i class="' + iconNext + '"></i></a></li>');
  13395. pagebar.append('<li class="csLastPage" title="' + msg.last_title + '" ><a href="javascript:void(0);"> <i class="' + iconLast + '"></i> </a></li>');
  13396. pagebar.show();
  13397. } else {
  13398. pagebar.find('li.pageInfoBox a').html(updatePageInfo());
  13399. }
  13400. };
  13401. var pagebar = self.elem.navi.find('ul'),
  13402. last_page = Math.ceil(cnt_whole / self.option.pageSize); //calculate total page
  13403. if (last_page === 0) page_num = 0;
  13404. else {
  13405. if (last_page < page_num) page_num = last_page;
  13406. else if (page_num === 0) page_num = 1;
  13407. }
  13408. self.prop.current_page = page_num;//update current page number
  13409. self.prop.max_page = last_page;//update page count
  13410. buildPageNav(self, pagebar, page_num, last_page);
  13411. //update paging status
  13412. var dClass = 'disabled',
  13413. first = pagebar.find('li.csFirstPage'),
  13414. previous = pagebar.find('li.csPreviousPage'),
  13415. next = pagebar.find('li.csNextPage'),
  13416. last = pagebar.find('li.csLastPage');
  13417. //first and previous
  13418. if (page_num === 1 || page_num === 0) {
  13419. if (!first.hasClass(dClass)) first.addClass(dClass);
  13420. if (!previous.hasClass(dClass)) previous.addClass(dClass);
  13421. } else {
  13422. if (first.hasClass(dClass)) first.removeClass(dClass);
  13423. if (previous.hasClass(dClass)) previous.removeClass(dClass);
  13424. }
  13425. //next and last
  13426. if (page_num === last_page || last_page === 0) {
  13427. if (!next.hasClass(dClass)) next.addClass(dClass);
  13428. if (!last.hasClass(dClass)) last.addClass(dClass);
  13429. } else {
  13430. if (next.hasClass(dClass)) next.removeClass(dClass);
  13431. if (last.hasClass(dClass)) last.removeClass(dClass);
  13432. }
  13433. if (last_page > 1) self.ePaging(); //pagination event bind
  13434. };
  13435. /**
  13436. * Render result list
  13437. * @param {Object} self
  13438. * @param {Object} json - result data
  13439. * @param {boolean} is_query - used to different from search to open and just click to open
  13440. */
  13441. SelectPage.prototype.displayResults = function (self, json, is_query) {
  13442. var p = self.option, el = self.elem;
  13443. el.results.hide().empty();
  13444. if (p.multiple && $.type(p.maxSelectLimit) === 'number' && p.maxSelectLimit > 0) {
  13445. var selectedSize = el.element_box.find('li.selected_tag').length;
  13446. if (selectedSize > 0 && selectedSize >= p.maxSelectLimit) {
  13447. var msg = self.message.max_selected;
  13448. self.showMessage(self, msg.replace(self.template.msg.maxSelectLimit, p.maxSelectLimit));
  13449. return;
  13450. }
  13451. }
  13452. if (json.candidate.length) {
  13453. var arr_candidate = json.candidate,
  13454. arr_primary_key = json.keyField,
  13455. keystr = el.hidden.val(),
  13456. keyArr = keystr ? keystr.split(',') : new Array(),
  13457. itemText = '';
  13458. for (var i = 0; i < arr_candidate.length; i++) {
  13459. if (p.formatItem && $.isFunction(p.formatItem)) {
  13460. try {
  13461. itemText = p.formatItem(json.originalResult[i]);
  13462. } catch (e) {
  13463. console.error('formatItem内容格式化函数内容设置不正确!');
  13464. itemText = arr_candidate[i];
  13465. }
  13466. } else itemText = arr_candidate[i];
  13467. var list = $('<li>').html(itemText).attr({
  13468. pkey: arr_primary_key[i],
  13469. index: i
  13470. });
  13471. if (!p.formatItem) list.attr('title', itemText);
  13472. //Set selected item highlight
  13473. if ($.inArray(arr_primary_key[i].toString(), keyArr) !== -1) {
  13474. list.addClass(self.css_class.selected);
  13475. }
  13476. //cache item data
  13477. list.data('dataObj', json.originalResult[i]);
  13478. el.results.append(list);
  13479. }
  13480. } else {
  13481. var li = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' +
  13482. self.message.not_found + '</li>';
  13483. el.results.append(li);
  13484. }
  13485. el.results.show();
  13486. if (p.multiple && p.multipleControlbar) el.control.show();
  13487. if (p.pagination) el.navi.show();
  13488. self.calcResultsSize(self);
  13489. self.setOpenStatus(self, true);
  13490. //Result item event bind
  13491. self.eResultList();
  13492. //scrolling listen
  13493. self.eScroll();
  13494. //auto highlight first item in search, have result and set autoSelectFirst to true situation
  13495. if (is_query && json.candidate.length && p.autoSelectFirst) self.nextLine(self);
  13496. };
  13497. /**
  13498. * Calculate result list size and position
  13499. * @param {Object} self
  13500. */
  13501. SelectPage.prototype.calcResultsSize = function (self) {
  13502. var p = self.option, el = self.elem;
  13503. var rePosition = function () {
  13504. if (el.container.css('position') === 'static') {
  13505. // position: static
  13506. var offset = el.combo_input.offset();
  13507. el.result_area.css({
  13508. top: offset.top + el.combo_input.outerHeight() + 'px',
  13509. left: offset.left + 'px'
  13510. });
  13511. } else {
  13512. if (!p.pagination) {
  13513. var itemHeight = el.results.find('li:first').outerHeight(true),
  13514. listHeight = itemHeight * p.listSize;
  13515. el.results.css({
  13516. 'max-height': listHeight,
  13517. 'overflow-y': 'auto'
  13518. });
  13519. }
  13520. //handle result list show up side(left, right, up or down)
  13521. var docWidth = $(document).width(),
  13522. docHeight = $(document).height(), //the document full height
  13523. viewHeight = $(window).height(), //browser visible area height
  13524. offset = el.container.offset(),
  13525. screenScrollTop = $(window).scrollTop(),
  13526. listWidth = el.result_area.outerWidth(),
  13527. //result list height
  13528. listHeight = el.result_area.outerHeight(),
  13529. //default left used input element left
  13530. defaultLeft = offset.left, //p.multiple ? -1 : 0;
  13531. //input element height
  13532. inputHeight = el.container.outerHeight(),
  13533. left = (offset.left + listWidth) > docWidth ?
  13534. defaultLeft - (listWidth - el.container.outerWidth()) :
  13535. defaultLeft,
  13536. //the actual top coordinate of input element(outer div)
  13537. screenTop = offset.top, //$(el.container).scrollTop();//offset.top - screenScrollTop;
  13538. top = 0, dist = 5, //set distance between input element and result list
  13539. //the actual top coordinate of result list
  13540. listBottom = screenTop + inputHeight + listHeight + dist,
  13541. listTop = screenTop + listHeight + dist,
  13542. hasOverflow = docHeight > viewHeight;
  13543. if ((screenTop - screenScrollTop - dist > listHeight) &&
  13544. (hasOverflow && listBottom > (viewHeight + screenScrollTop)) ||
  13545. (!hasOverflow && listBottom > viewHeight && screenTop >= listTop)) {
  13546. //open up
  13547. top = offset.top - listHeight - dist;
  13548. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowUp');
  13549. } else {
  13550. //open down
  13551. top = offset.top + (p.multiple ? el.container.outerHeight() : inputHeight);
  13552. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowDown');
  13553. top += dist;
  13554. }
  13555. return {
  13556. top: top + 'px', left: left + 'px'
  13557. };
  13558. }
  13559. };
  13560. if (el.result_area.is(':visible')) {
  13561. el.result_area.css(rePosition());
  13562. } else {
  13563. var pss = rePosition();
  13564. el.result_area.css(pss).show(1, function () {
  13565. var repss = rePosition();
  13566. if (pss.top !== repss.top || pss.left !== repss.left) el.result_area.css(repss);
  13567. });
  13568. }
  13569. };
  13570. /**
  13571. * hide result list
  13572. * @param {Object} self
  13573. */
  13574. SelectPage.prototype.hideResults = function (self) {
  13575. if (self.prop.key_paging) {
  13576. self.scrollWindow(self, true);
  13577. self.prop.key_paging = false;
  13578. }
  13579. self.setCssFocusedInput(self);
  13580. if (self.option.autoFillResult) {
  13581. //self.selectCurrentLine(self, true);
  13582. }
  13583. self.elem.results.empty();
  13584. self.elem.result_area.hide();
  13585. self.setOpenStatus(self, false);
  13586. //unbind window scroll listen
  13587. $(window).off('scroll.SelectPage');
  13588. self.abortAjax(self);
  13589. self.setButtonAttrDefault();
  13590. };
  13591. /**
  13592. * set plugin to disabled / enabled
  13593. * @param self
  13594. * @param disabled
  13595. */
  13596. SelectPage.prototype.disabled = function (self, disabled) {
  13597. var p = self.option, el = self.elem;
  13598. if ($.type(disabled) === 'undefined') return el.combo_input.prop('disabled');
  13599. if ($.type(disabled) === 'boolean') {
  13600. el.combo_input.prop('disabled', disabled);
  13601. if (disabled) el.container.addClass(self.css_class.disabled);
  13602. else el.container.removeClass(self.css_class.disabled);
  13603. }
  13604. };
  13605. /**
  13606. * Go fist page
  13607. * @param {Object} self
  13608. */
  13609. SelectPage.prototype.firstPage = function (self) {
  13610. if (self.prop.current_page > 1) {
  13611. self.prop.current_page = 1;
  13612. self.prop.page_move = true;
  13613. self.suggest(self);
  13614. }
  13615. };
  13616. /**
  13617. * Go previous page
  13618. * @param {Object} self
  13619. */
  13620. SelectPage.prototype.prevPage = function (self) {
  13621. if (self.prop.current_page > 1) {
  13622. self.prop.current_page--;
  13623. self.prop.page_move = true;
  13624. self.suggest(self);
  13625. }
  13626. };
  13627. /**
  13628. * Go next page
  13629. * @param {Object} self
  13630. */
  13631. SelectPage.prototype.nextPage = function (self) {
  13632. if (self.prop.current_page < self.prop.max_page) {
  13633. self.prop.current_page++;
  13634. self.prop.page_move = true;
  13635. self.suggest(self);
  13636. }
  13637. };
  13638. /**
  13639. * Go last page
  13640. * @param {Object} self
  13641. */
  13642. SelectPage.prototype.lastPage = function (self) {
  13643. if (self.prop.current_page < self.prop.max_page) {
  13644. self.prop.current_page = self.prop.max_page;
  13645. self.prop.page_move = true;
  13646. self.suggest(self);
  13647. }
  13648. };
  13649. /**
  13650. * do something after select/unSelect action
  13651. * @param {Object} self
  13652. * @param {boolean} reOpen
  13653. */
  13654. SelectPage.prototype.afterAction = function (self, reOpen) {
  13655. self.inputResize(self);
  13656. self.elem.combo_input.change();
  13657. self.setCssFocusedInput(self);
  13658. if (self.prop.init_set) return;
  13659. if (self.option.multiple) {
  13660. if (self.option.selectToCloseList) {
  13661. self.hideResults(self);
  13662. self.elem.combo_input.blur();
  13663. }
  13664. if (!self.option.selectToCloseList && reOpen) {
  13665. self.suggest(self);
  13666. self.elem.combo_input.focus();
  13667. }
  13668. } else {
  13669. self.hideResults(self);
  13670. self.elem.combo_input.blur();
  13671. }
  13672. };
  13673. /**
  13674. * Select current list item
  13675. * @param {Object} self
  13676. * @param {boolean} is_enter_key
  13677. */
  13678. SelectPage.prototype.selectCurrentLine = function (self, is_enter_key) {
  13679. self.scrollWindow(self, true);
  13680. var p = self.option, current = self.getCurrentLine(self);
  13681. if (current) {
  13682. var data = current.data('dataObj');
  13683. var text = data[p.showField] || current.text();
  13684. var value = current.attr('pkey');
  13685. if (!p.multiple) {
  13686. self.elem.combo_input.val(text);
  13687. self.elem.hidden.val(value);
  13688. } else {
  13689. //build tags in multiple selection mode
  13690. self.elem.combo_input.val('');
  13691. var item = {text: text, value: value};
  13692. if (!self.isAlreadySelected(self, item)) {
  13693. self.addNewTag(self, data, item);
  13694. self.tagValuesSet(self);
  13695. }
  13696. }
  13697. if (p.selectOnly) self.setButtonAttrDefault();
  13698. //Select item callback
  13699. if (p.eSelect && $.isFunction(p.eSelect)) p.eSelect(data, self);
  13700. self.prop.prev_value = self.elem.combo_input.val();
  13701. self.prop.selected_text = self.elem.combo_input.val();
  13702. self.putClearButton();
  13703. }
  13704. self.afterAction(self, true);
  13705. };
  13706. /**
  13707. * Show clear button when item selected in single selection mode
  13708. */
  13709. SelectPage.prototype.putClearButton = function () {
  13710. if (!this.option.multiple && !this.elem.combo_input.prop('disabled')) this.elem.container.append(this.elem.clear_btn);
  13711. };
  13712. /**
  13713. * Select all list item
  13714. * @param {Object} self
  13715. */
  13716. SelectPage.prototype.selectAllLine = function (self) {
  13717. var p = self.option, jsonarr = new Array();
  13718. self.elem.results.find('li').each(function (i, row) {
  13719. var $row = $(row), data = $row.data('dataObj');
  13720. var text = data[p.showField] || $row.text();
  13721. var value = $row.attr('pkey');
  13722. var item = {text: text, value: value};
  13723. if (!self.isAlreadySelected(self, item)) {
  13724. self.addNewTag(self, data, item);
  13725. self.tagValuesSet(self);
  13726. }
  13727. jsonarr.push(data);
  13728. //limited max selected items
  13729. if ($.type(p.maxSelectLimit) === 'number' &&
  13730. p.maxSelectLimit > 0 &&
  13731. p.maxSelectLimit === self.elem.element_box.find('li.selected_tag').length) {
  13732. return false;
  13733. }
  13734. });
  13735. if (p.eSelect && $.isFunction(p.eSelect)) p.eSelect(jsonarr, self);
  13736. self.afterAction(self, true);
  13737. };
  13738. /**
  13739. * Cancel select all item in current page
  13740. * @param {Object} self
  13741. */
  13742. SelectPage.prototype.unSelectAllLine = function (self) {
  13743. var p = self.option, size = self.elem.results.find('li').length, ds = [];
  13744. self.elem.results.find('li').each(function (i, row) {
  13745. var key = $(row).attr('pkey');
  13746. var tag = self.elem.element_box.find('li.selected_tag[itemvalue="' + key + '"]');
  13747. if (tag.length) ds.push(tag.data('dataObj'));
  13748. self.removeTag(self, tag);
  13749. });
  13750. self.afterAction(self, true);
  13751. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove(ds);
  13752. };
  13753. /**
  13754. * Clear all selected items
  13755. * @param {Object} self
  13756. * @param {boolean} open - open list after clear selected item
  13757. */
  13758. SelectPage.prototype.clearAll = function (self, open) {
  13759. var p = self.option, ds = [];
  13760. if (p.multiple) {
  13761. self.elem.element_box.find('li.selected_tag').each(function (i, row) {
  13762. ds.push($(row).data('dataObj'));
  13763. row.remove();
  13764. });
  13765. self.elem.element_box.find('li.selected_tag').remove();
  13766. }
  13767. self.reset(self);
  13768. self.afterAction(self, open);
  13769. if (p.multiple) {
  13770. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove(ds);
  13771. } else self.elem.clear_btn.remove();
  13772. };
  13773. /**
  13774. * reset
  13775. */
  13776. SelectPage.prototype.reset = function (self) {
  13777. self.elem.combo_input.val('');
  13778. self.elem.hidden.val('');
  13779. self.prop.prev_value = '';
  13780. self.prop.selected_text = '';
  13781. self.prop.current_page = 1;
  13782. };
  13783. /**
  13784. * Get current highlight item
  13785. * @param {Object} self
  13786. */
  13787. SelectPage.prototype.getCurrentLine = function (self) {
  13788. if (self.elem.result_area.is(':hidden')) return false;
  13789. var obj = self.elem.results.find('li.' + self.css_class.select);
  13790. if (obj.length) return obj;
  13791. else return false;
  13792. };
  13793. /**
  13794. * Check the result item is already selected or not
  13795. * @param {Object} self
  13796. * @param {Object} item - item info
  13797. */
  13798. SelectPage.prototype.isAlreadySelected = function (self, item) {
  13799. var isExist = false;
  13800. if (item.value) {
  13801. var keys = self.elem.hidden.val();
  13802. if (keys) {
  13803. var karr = keys.split(',');
  13804. if (karr && karr.length && $.inArray(item.value, karr) != -1) isExist = true;
  13805. }
  13806. }
  13807. return isExist;
  13808. };
  13809. /**
  13810. * Add a new tag in multiple selection mode
  13811. * @param {Object} self
  13812. * @param {object} data - raw row data
  13813. * @param {Object} item
  13814. */
  13815. SelectPage.prototype.addNewTag = function (self, data, item) {
  13816. if (!self.option.multiple || !data || !item) return;
  13817. var tmp = self.template.tag.content, tag;
  13818. tmp = tmp.replace(self.template.tag.textKey, item.text);
  13819. tmp = tmp.replace(self.template.tag.valueKey, item.value);
  13820. tag = $(tmp);
  13821. tag.data('dataObj', data);
  13822. if (self.elem.combo_input.prop('disabled')) tag.find('span.tag_close').hide();
  13823. self.elem.combo_input.closest('li').before(tag);
  13824. };
  13825. /**
  13826. * Remove a tag in multiple selection mode
  13827. * @param {Object} self
  13828. * @param {Object} item
  13829. */
  13830. SelectPage.prototype.removeTag = function (self, item) {
  13831. var key = $(item).attr('itemvalue');
  13832. var keys = self.elem.hidden.val();
  13833. if ($.type(key) != 'undefined' && keys) {
  13834. var keyarr = keys.split(','),
  13835. index = $.inArray(key.toString(), keyarr);
  13836. if (index != -1) {
  13837. keyarr.splice(index, 1);
  13838. self.elem.hidden.val(keyarr.toString()).trigger("change");
  13839. }
  13840. }
  13841. $(item).remove();
  13842. self.inputResize(self);
  13843. };
  13844. /**
  13845. * Selected item value(keyField) put in to hidden element
  13846. * @param {Object} self
  13847. */
  13848. SelectPage.prototype.tagValuesSet = function (self) {
  13849. if (!self.option.multiple) return;
  13850. var tags = self.elem.element_box.find('li.selected_tag');
  13851. if (tags && tags.length) {
  13852. var result = new Array();
  13853. $.each(tags, function (i, li) {
  13854. var v = $(li).attr('itemvalue');
  13855. if ($.type(v) !== 'undefined') result.push(v);
  13856. });
  13857. if (result.length) {
  13858. self.elem.hidden.val(result.join(',')).trigger("change");
  13859. }
  13860. }
  13861. };
  13862. /**
  13863. * auto resize input element width in multiple select mode
  13864. * @param {Object} self
  13865. */
  13866. SelectPage.prototype.inputResize = function (self) {
  13867. if (!self.option.multiple) return;
  13868. var width = '',
  13869. inputLi = self.elem.combo_input.closest('li');
  13870. var setDefaultSize = function (self, inputLi) {
  13871. inputLi.removeClass('full_width');
  13872. var minimumWidth = self.elem.combo_input.val().length + 1,
  13873. width = (minimumWidth * 0.75) + 'em';
  13874. self.elem.combo_input.css('width', width).removeAttr('placeholder');
  13875. };
  13876. if (self.elem.element_box.find('li.selected_tag').length === 0) {
  13877. if (!inputLi.hasClass('full_width')) inputLi.addClass('full_width');
  13878. if (self.elem.combo_input.attr('placeholder_bak')) {
  13879. self.elem.combo_input.attr('placeholder', self.elem.combo_input.attr('placeholder_bak')).removeAttr('style');
  13880. }
  13881. } else setDefaultSize(self, inputLi);
  13882. };
  13883. /**
  13884. * Move to next line
  13885. * @param {Object} self
  13886. */
  13887. SelectPage.prototype.nextLine = function (self) {
  13888. var obj = self.getCurrentLine(self), idx;
  13889. if (!obj) idx = -1;
  13890. else {
  13891. idx = self.elem.results.children('li').index(obj);
  13892. obj.removeClass(self.css_class.select);
  13893. }
  13894. idx++;
  13895. if (idx < self.elem.results.children('li').length) {
  13896. var next = self.elem.results.children('li').eq(idx);
  13897. next.addClass(self.css_class.select);
  13898. self.setCssFocusedResults(self);
  13899. } else self.setCssFocusedInput(self);
  13900. self.scrollWindow(self, false);
  13901. };
  13902. /**
  13903. * Move to previous line
  13904. * @param {Object} self
  13905. */
  13906. SelectPage.prototype.prevLine = function (self) {
  13907. var obj = self.getCurrentLine(self), idx;
  13908. if (!obj) idx = self.elem.results.children('li').length;
  13909. else {
  13910. idx = self.elem.results.children('li').index(obj);
  13911. obj.removeClass(self.css_class.select);
  13912. }
  13913. idx--;
  13914. if (idx > -1) {
  13915. var prev = self.elem.results.children('li').eq(idx);
  13916. prev.addClass(self.css_class.select);
  13917. self.setCssFocusedResults(self);
  13918. } else self.setCssFocusedInput(self);
  13919. self.scrollWindow(self, false);
  13920. };
  13921. /**
  13922. * SelectPage plugin definition
  13923. * @global
  13924. * @param option {Object} init plugin option
  13925. */
  13926. function Plugin(option) {
  13927. return this.each(function () {
  13928. var $this = $(this),
  13929. data = $this.data(SelectPage.dataKey),
  13930. params = $.extend({}, defaults, $this.data(), data && data.option, typeof option === 'object' && option);
  13931. if (!data) $this.data(SelectPage.dataKey, (data = new SelectPage(this, params)));
  13932. });
  13933. }
  13934. /**
  13935. * Get plugin object
  13936. * @param {object} obj
  13937. * @returns
  13938. */
  13939. function getPlugin(obj) {
  13940. return $(obj).closest('div.sp_container').find('input.sp_input');
  13941. }
  13942. /**
  13943. * Clear all selected item
  13944. */
  13945. function ClearSelected() {
  13946. return this.each(function () {
  13947. var $this = getPlugin(this),
  13948. data = $this.data(SelectPage.dataKey);
  13949. if (data) {
  13950. data.prop.init_set = true;
  13951. data.clearAll(data);
  13952. data.prop.init_set = false;
  13953. }
  13954. });
  13955. }
  13956. /**
  13957. * Refresh result list
  13958. * use case:
  13959. * 1.use $(obj).val('xxx') to modify selectpage selected item key
  13960. * 2.refresh selected item show content/tag text
  13961. */
  13962. function SelectedRefresh() {
  13963. return this.each(function () {
  13964. var $this = getPlugin(this),
  13965. data = $this.data(SelectPage.dataKey);
  13966. if (data && data.elem.hidden.val())
  13967. data.setInitRecord(true);
  13968. });
  13969. }
  13970. /**
  13971. * Modify plugin datasource, only work on json datasource mode
  13972. * @param {array} data - new datasource
  13973. * @example
  13974. * [{name:'aa',sex:1},{name:'bb',sex:0},{...}]
  13975. */
  13976. function ModifyDataSource(data) {
  13977. return this.each(function () {
  13978. if (data && $.isArray(data)) {
  13979. var $this = getPlugin(this),
  13980. plugin = $this.data(SelectPage.dataKey);
  13981. if (plugin) {
  13982. plugin.clearAll(plugin);
  13983. plugin.option.data = data;
  13984. }
  13985. }
  13986. });
  13987. }
  13988. /**
  13989. * Get plugin disabled status or Modify plugin disabled status
  13990. * @param disabled {boolean} set disabled status
  13991. */
  13992. function PluginDisabled(disabled) {
  13993. var status = false;
  13994. this.each(function () {
  13995. var $this = getPlugin(this),
  13996. plugin = $this.data(SelectPage.dataKey);
  13997. if (plugin) {
  13998. if ($.type(disabled) !== 'undefined')
  13999. plugin.disabled(plugin, disabled);
  14000. else
  14001. status = plugin.disabled(plugin);
  14002. }
  14003. });
  14004. return status;
  14005. }
  14006. /**
  14007. * Get selected item text
  14008. * @returns {string}
  14009. */
  14010. function GetInputText() {
  14011. var str = '';
  14012. this.each(function () {
  14013. var $this = getPlugin(this), data = $this.data(SelectPage.dataKey);
  14014. if (data) {
  14015. if (data.option.multiple) {
  14016. var tags = [];
  14017. data.elem.element_box.find('li.selected_tag').each(function (i, tag) {
  14018. tags.push($(tag).text());
  14019. });
  14020. str += tags.toString();
  14021. } else {
  14022. str += data.elem.combo_input.val();
  14023. }
  14024. }
  14025. });
  14026. return str;
  14027. }
  14028. var old = $.fn.selectPage;
  14029. $.fn.selectPage = Plugin;
  14030. $.fn.selectPage.Constructor = SelectPage;
  14031. $.fn.selectPageClear = ClearSelected;
  14032. $.fn.selectPageRefresh = SelectedRefresh;
  14033. $.fn.selectPageData = ModifyDataSource;
  14034. $.fn.selectPageDisabled = PluginDisabled;
  14035. $.fn.selectPageText = GetInputText;
  14036. // SelectPage no conflict
  14037. // =================
  14038. $.fn.selectPage.noConflict = function () {
  14039. $.fn.selectPage = old;
  14040. return this;
  14041. };
  14042. })(window.jQuery);
  14043. define("selectpage", function(){});