require-backend.min.js 915 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584
  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.3 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){t.zoom="undefined"==typeof t.zoom||!!t.zoom;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),t.zoom&&s.bigimg.on("wheel mousewheel",i(">img",s.bigimg),function(e){var t=i(this).offset(),n=e.originalEvent.wheelDelta>0,a=n?"+=":"-=",o=24,r=Math.floor(o/2);return!(!n&&(i(this).width()<50||i(this).height()<50))&&(i(this).width(a+o).height(a+o).offset({left:n?t.left-r:t.left+r,top:n?t.top-r:t.top+r}),!1)})},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.length > 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").length > 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.length > 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).length === 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").length > 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.3
  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. arrLen = arr.length;
  1017. for (i = 0; i < arrLen; ++i) {
  1018. res.push(fn(arr[i], i));
  1019. }
  1020. return res;
  1021. }
  1022. function extend(a, b) {
  1023. for (var i in b) {
  1024. if (hasOwnProp(b, i)) {
  1025. a[i] = b[i];
  1026. }
  1027. }
  1028. if (hasOwnProp(b, 'toString')) {
  1029. a.toString = b.toString;
  1030. }
  1031. if (hasOwnProp(b, 'valueOf')) {
  1032. a.valueOf = b.valueOf;
  1033. }
  1034. return a;
  1035. }
  1036. function createUTC(input, format, locale, strict) {
  1037. return createLocalOrUTC(input, format, locale, strict, true).utc();
  1038. }
  1039. function defaultParsingFlags() {
  1040. // We need to deep clone this object.
  1041. return {
  1042. empty: false,
  1043. unusedTokens: [],
  1044. unusedInput: [],
  1045. overflow: -2,
  1046. charsLeftOver: 0,
  1047. nullInput: false,
  1048. invalidEra: null,
  1049. invalidMonth: null,
  1050. invalidFormat: false,
  1051. userInvalidated: false,
  1052. iso: false,
  1053. parsedDateParts: [],
  1054. era: null,
  1055. meridiem: null,
  1056. rfc2822: false,
  1057. weekdayMismatch: false,
  1058. };
  1059. }
  1060. function getParsingFlags(m) {
  1061. if (m._pf == null) {
  1062. m._pf = defaultParsingFlags();
  1063. }
  1064. return m._pf;
  1065. }
  1066. var some;
  1067. if (Array.prototype.some) {
  1068. some = Array.prototype.some;
  1069. } else {
  1070. some = function (fun) {
  1071. var t = Object(this),
  1072. len = t.length >>> 0,
  1073. i;
  1074. for (i = 0; i < len; i++) {
  1075. if (i in t && fun.call(this, t[i], i, t)) {
  1076. return true;
  1077. }
  1078. }
  1079. return false;
  1080. };
  1081. }
  1082. function isValid(m) {
  1083. if (m._isValid == null) {
  1084. var flags = getParsingFlags(m),
  1085. parsedParts = some.call(flags.parsedDateParts, function (i) {
  1086. return i != null;
  1087. }),
  1088. isNowValid =
  1089. !isNaN(m._d.getTime()) &&
  1090. flags.overflow < 0 &&
  1091. !flags.empty &&
  1092. !flags.invalidEra &&
  1093. !flags.invalidMonth &&
  1094. !flags.invalidWeekday &&
  1095. !flags.weekdayMismatch &&
  1096. !flags.nullInput &&
  1097. !flags.invalidFormat &&
  1098. !flags.userInvalidated &&
  1099. (!flags.meridiem || (flags.meridiem && parsedParts));
  1100. if (m._strict) {
  1101. isNowValid =
  1102. isNowValid &&
  1103. flags.charsLeftOver === 0 &&
  1104. flags.unusedTokens.length === 0 &&
  1105. flags.bigHour === undefined;
  1106. }
  1107. if (Object.isFrozen == null || !Object.isFrozen(m)) {
  1108. m._isValid = isNowValid;
  1109. } else {
  1110. return isNowValid;
  1111. }
  1112. }
  1113. return m._isValid;
  1114. }
  1115. function createInvalid(flags) {
  1116. var m = createUTC(NaN);
  1117. if (flags != null) {
  1118. extend(getParsingFlags(m), flags);
  1119. } else {
  1120. getParsingFlags(m).userInvalidated = true;
  1121. }
  1122. return m;
  1123. }
  1124. // Plugins that add properties should also add the key here (null value),
  1125. // so we can properly clone ourselves.
  1126. var momentProperties = (hooks.momentProperties = []),
  1127. updateInProgress = false;
  1128. function copyConfig(to, from) {
  1129. var i,
  1130. prop,
  1131. val,
  1132. momentPropertiesLen = momentProperties.length;
  1133. if (!isUndefined(from._isAMomentObject)) {
  1134. to._isAMomentObject = from._isAMomentObject;
  1135. }
  1136. if (!isUndefined(from._i)) {
  1137. to._i = from._i;
  1138. }
  1139. if (!isUndefined(from._f)) {
  1140. to._f = from._f;
  1141. }
  1142. if (!isUndefined(from._l)) {
  1143. to._l = from._l;
  1144. }
  1145. if (!isUndefined(from._strict)) {
  1146. to._strict = from._strict;
  1147. }
  1148. if (!isUndefined(from._tzm)) {
  1149. to._tzm = from._tzm;
  1150. }
  1151. if (!isUndefined(from._isUTC)) {
  1152. to._isUTC = from._isUTC;
  1153. }
  1154. if (!isUndefined(from._offset)) {
  1155. to._offset = from._offset;
  1156. }
  1157. if (!isUndefined(from._pf)) {
  1158. to._pf = getParsingFlags(from);
  1159. }
  1160. if (!isUndefined(from._locale)) {
  1161. to._locale = from._locale;
  1162. }
  1163. if (momentPropertiesLen > 0) {
  1164. for (i = 0; i < momentPropertiesLen; i++) {
  1165. prop = momentProperties[i];
  1166. val = from[prop];
  1167. if (!isUndefined(val)) {
  1168. to[prop] = val;
  1169. }
  1170. }
  1171. }
  1172. return to;
  1173. }
  1174. // Moment prototype object
  1175. function Moment(config) {
  1176. copyConfig(this, config);
  1177. this._d = new Date(config._d != null ? config._d.getTime() : NaN);
  1178. if (!this.isValid()) {
  1179. this._d = new Date(NaN);
  1180. }
  1181. // Prevent infinite loop in case updateOffset creates new moment
  1182. // objects.
  1183. if (updateInProgress === false) {
  1184. updateInProgress = true;
  1185. hooks.updateOffset(this);
  1186. updateInProgress = false;
  1187. }
  1188. }
  1189. function isMoment(obj) {
  1190. return (
  1191. obj instanceof Moment || (obj != null && obj._isAMomentObject != null)
  1192. );
  1193. }
  1194. function warn(msg) {
  1195. if (
  1196. hooks.suppressDeprecationWarnings === false &&
  1197. typeof console !== 'undefined' &&
  1198. console.warn
  1199. ) {
  1200. console.warn('Deprecation warning: ' + msg);
  1201. }
  1202. }
  1203. function deprecate(msg, fn) {
  1204. var firstTime = true;
  1205. return extend(function () {
  1206. if (hooks.deprecationHandler != null) {
  1207. hooks.deprecationHandler(null, msg);
  1208. }
  1209. if (firstTime) {
  1210. var args = [],
  1211. arg,
  1212. i,
  1213. key,
  1214. argLen = arguments.length;
  1215. for (i = 0; i < argLen; i++) {
  1216. arg = '';
  1217. if (typeof arguments[i] === 'object') {
  1218. arg += '\n[' + i + '] ';
  1219. for (key in arguments[0]) {
  1220. if (hasOwnProp(arguments[0], key)) {
  1221. arg += key + ': ' + arguments[0][key] + ', ';
  1222. }
  1223. }
  1224. arg = arg.slice(0, -2); // Remove trailing comma and space
  1225. } else {
  1226. arg = arguments[i];
  1227. }
  1228. args.push(arg);
  1229. }
  1230. warn(
  1231. msg +
  1232. '\nArguments: ' +
  1233. Array.prototype.slice.call(args).join('') +
  1234. '\n' +
  1235. new Error().stack
  1236. );
  1237. firstTime = false;
  1238. }
  1239. return fn.apply(this, arguments);
  1240. }, fn);
  1241. }
  1242. var deprecations = {};
  1243. function deprecateSimple(name, msg) {
  1244. if (hooks.deprecationHandler != null) {
  1245. hooks.deprecationHandler(name, msg);
  1246. }
  1247. if (!deprecations[name]) {
  1248. warn(msg);
  1249. deprecations[name] = true;
  1250. }
  1251. }
  1252. hooks.suppressDeprecationWarnings = false;
  1253. hooks.deprecationHandler = null;
  1254. function isFunction(input) {
  1255. return (
  1256. (typeof Function !== 'undefined' && input instanceof Function) ||
  1257. Object.prototype.toString.call(input) === '[object Function]'
  1258. );
  1259. }
  1260. function set(config) {
  1261. var prop, i;
  1262. for (i in config) {
  1263. if (hasOwnProp(config, i)) {
  1264. prop = config[i];
  1265. if (isFunction(prop)) {
  1266. this[i] = prop;
  1267. } else {
  1268. this['_' + i] = prop;
  1269. }
  1270. }
  1271. }
  1272. this._config = config;
  1273. // Lenient ordinal parsing accepts just a number in addition to
  1274. // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
  1275. // TODO: Remove "ordinalParse" fallback in next major release.
  1276. this._dayOfMonthOrdinalParseLenient = new RegExp(
  1277. (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
  1278. '|' +
  1279. /\d{1,2}/.source
  1280. );
  1281. }
  1282. function mergeConfigs(parentConfig, childConfig) {
  1283. var res = extend({}, parentConfig),
  1284. prop;
  1285. for (prop in childConfig) {
  1286. if (hasOwnProp(childConfig, prop)) {
  1287. if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
  1288. res[prop] = {};
  1289. extend(res[prop], parentConfig[prop]);
  1290. extend(res[prop], childConfig[prop]);
  1291. } else if (childConfig[prop] != null) {
  1292. res[prop] = childConfig[prop];
  1293. } else {
  1294. delete res[prop];
  1295. }
  1296. }
  1297. }
  1298. for (prop in parentConfig) {
  1299. if (
  1300. hasOwnProp(parentConfig, prop) &&
  1301. !hasOwnProp(childConfig, prop) &&
  1302. isObject(parentConfig[prop])
  1303. ) {
  1304. // make sure changes to properties don't modify parent config
  1305. res[prop] = extend({}, res[prop]);
  1306. }
  1307. }
  1308. return res;
  1309. }
  1310. function Locale(config) {
  1311. if (config != null) {
  1312. this.set(config);
  1313. }
  1314. }
  1315. var keys;
  1316. if (Object.keys) {
  1317. keys = Object.keys;
  1318. } else {
  1319. keys = function (obj) {
  1320. var i,
  1321. res = [];
  1322. for (i in obj) {
  1323. if (hasOwnProp(obj, i)) {
  1324. res.push(i);
  1325. }
  1326. }
  1327. return res;
  1328. };
  1329. }
  1330. var defaultCalendar = {
  1331. sameDay: '[Today at] LT',
  1332. nextDay: '[Tomorrow at] LT',
  1333. nextWeek: 'dddd [at] LT',
  1334. lastDay: '[Yesterday at] LT',
  1335. lastWeek: '[Last] dddd [at] LT',
  1336. sameElse: 'L',
  1337. };
  1338. function calendar(key, mom, now) {
  1339. var output = this._calendar[key] || this._calendar['sameElse'];
  1340. return isFunction(output) ? output.call(mom, now) : output;
  1341. }
  1342. function zeroFill(number, targetLength, forceSign) {
  1343. var absNumber = '' + Math.abs(number),
  1344. zerosToFill = targetLength - absNumber.length,
  1345. sign = number >= 0;
  1346. return (
  1347. (sign ? (forceSign ? '+' : '') : '-') +
  1348. Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +
  1349. absNumber
  1350. );
  1351. }
  1352. var formattingTokens =
  1353. /(\[[^\[]*\])|(\\)?([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,
  1354. localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
  1355. formatFunctions = {},
  1356. formatTokenFunctions = {};
  1357. // token: 'M'
  1358. // padded: ['MM', 2]
  1359. // ordinal: 'Mo'
  1360. // callback: function () { this.month() + 1 }
  1361. function addFormatToken(token, padded, ordinal, callback) {
  1362. var func = callback;
  1363. if (typeof callback === 'string') {
  1364. func = function () {
  1365. return this[callback]();
  1366. };
  1367. }
  1368. if (token) {
  1369. formatTokenFunctions[token] = func;
  1370. }
  1371. if (padded) {
  1372. formatTokenFunctions[padded[0]] = function () {
  1373. return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
  1374. };
  1375. }
  1376. if (ordinal) {
  1377. formatTokenFunctions[ordinal] = function () {
  1378. return this.localeData().ordinal(
  1379. func.apply(this, arguments),
  1380. token
  1381. );
  1382. };
  1383. }
  1384. }
  1385. function removeFormattingTokens(input) {
  1386. if (input.match(/\[[\s\S]/)) {
  1387. return input.replace(/^\[|\]$/g, '');
  1388. }
  1389. return input.replace(/\\/g, '');
  1390. }
  1391. function makeFormatFunction(format) {
  1392. var array = format.match(formattingTokens),
  1393. i,
  1394. length;
  1395. for (i = 0, length = array.length; i < length; i++) {
  1396. if (formatTokenFunctions[array[i]]) {
  1397. array[i] = formatTokenFunctions[array[i]];
  1398. } else {
  1399. array[i] = removeFormattingTokens(array[i]);
  1400. }
  1401. }
  1402. return function (mom) {
  1403. var output = '',
  1404. i;
  1405. for (i = 0; i < length; i++) {
  1406. output += isFunction(array[i])
  1407. ? array[i].call(mom, format)
  1408. : array[i];
  1409. }
  1410. return output;
  1411. };
  1412. }
  1413. // format date using native date object
  1414. function formatMoment(m, format) {
  1415. if (!m.isValid()) {
  1416. return m.localeData().invalidDate();
  1417. }
  1418. format = expandFormat(format, m.localeData());
  1419. formatFunctions[format] =
  1420. formatFunctions[format] || makeFormatFunction(format);
  1421. return formatFunctions[format](m);
  1422. }
  1423. function expandFormat(format, locale) {
  1424. var i = 5;
  1425. function replaceLongDateFormatTokens(input) {
  1426. return locale.longDateFormat(input) || input;
  1427. }
  1428. localFormattingTokens.lastIndex = 0;
  1429. while (i >= 0 && localFormattingTokens.test(format)) {
  1430. format = format.replace(
  1431. localFormattingTokens,
  1432. replaceLongDateFormatTokens
  1433. );
  1434. localFormattingTokens.lastIndex = 0;
  1435. i -= 1;
  1436. }
  1437. return format;
  1438. }
  1439. var defaultLongDateFormat = {
  1440. LTS: 'h:mm:ss A',
  1441. LT: 'h:mm A',
  1442. L: 'MM/DD/YYYY',
  1443. LL: 'MMMM D, YYYY',
  1444. LLL: 'MMMM D, YYYY h:mm A',
  1445. LLLL: 'dddd, MMMM D, YYYY h:mm A',
  1446. };
  1447. function longDateFormat(key) {
  1448. var format = this._longDateFormat[key],
  1449. formatUpper = this._longDateFormat[key.toUpperCase()];
  1450. if (format || !formatUpper) {
  1451. return format;
  1452. }
  1453. this._longDateFormat[key] = formatUpper
  1454. .match(formattingTokens)
  1455. .map(function (tok) {
  1456. if (
  1457. tok === 'MMMM' ||
  1458. tok === 'MM' ||
  1459. tok === 'DD' ||
  1460. tok === 'dddd'
  1461. ) {
  1462. return tok.slice(1);
  1463. }
  1464. return tok;
  1465. })
  1466. .join('');
  1467. return this._longDateFormat[key];
  1468. }
  1469. var defaultInvalidDate = 'Invalid date';
  1470. function invalidDate() {
  1471. return this._invalidDate;
  1472. }
  1473. var defaultOrdinal = '%d',
  1474. defaultDayOfMonthOrdinalParse = /\d{1,2}/;
  1475. function ordinal(number) {
  1476. return this._ordinal.replace('%d', number);
  1477. }
  1478. var defaultRelativeTime = {
  1479. future: 'in %s',
  1480. past: '%s ago',
  1481. s: 'a few seconds',
  1482. ss: '%d seconds',
  1483. m: 'a minute',
  1484. mm: '%d minutes',
  1485. h: 'an hour',
  1486. hh: '%d hours',
  1487. d: 'a day',
  1488. dd: '%d days',
  1489. w: 'a week',
  1490. ww: '%d weeks',
  1491. M: 'a month',
  1492. MM: '%d months',
  1493. y: 'a year',
  1494. yy: '%d years',
  1495. };
  1496. function relativeTime(number, withoutSuffix, string, isFuture) {
  1497. var output = this._relativeTime[string];
  1498. return isFunction(output)
  1499. ? output(number, withoutSuffix, string, isFuture)
  1500. : output.replace(/%d/i, number);
  1501. }
  1502. function pastFuture(diff, output) {
  1503. var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
  1504. return isFunction(format) ? format(output) : format.replace(/%s/i, output);
  1505. }
  1506. var aliases = {};
  1507. function addUnitAlias(unit, shorthand) {
  1508. var lowerCase = unit.toLowerCase();
  1509. aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
  1510. }
  1511. function normalizeUnits(units) {
  1512. return typeof units === 'string'
  1513. ? aliases[units] || aliases[units.toLowerCase()]
  1514. : undefined;
  1515. }
  1516. function normalizeObjectUnits(inputObject) {
  1517. var normalizedInput = {},
  1518. normalizedProp,
  1519. prop;
  1520. for (prop in inputObject) {
  1521. if (hasOwnProp(inputObject, prop)) {
  1522. normalizedProp = normalizeUnits(prop);
  1523. if (normalizedProp) {
  1524. normalizedInput[normalizedProp] = inputObject[prop];
  1525. }
  1526. }
  1527. }
  1528. return normalizedInput;
  1529. }
  1530. var priorities = {};
  1531. function addUnitPriority(unit, priority) {
  1532. priorities[unit] = priority;
  1533. }
  1534. function getPrioritizedUnits(unitsObj) {
  1535. var units = [],
  1536. u;
  1537. for (u in unitsObj) {
  1538. if (hasOwnProp(unitsObj, u)) {
  1539. units.push({ unit: u, priority: priorities[u] });
  1540. }
  1541. }
  1542. units.sort(function (a, b) {
  1543. return a.priority - b.priority;
  1544. });
  1545. return units;
  1546. }
  1547. function isLeapYear(year) {
  1548. return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
  1549. }
  1550. function absFloor(number) {
  1551. if (number < 0) {
  1552. // -0 -> 0
  1553. return Math.ceil(number) || 0;
  1554. } else {
  1555. return Math.floor(number);
  1556. }
  1557. }
  1558. function toInt(argumentForCoercion) {
  1559. var coercedNumber = +argumentForCoercion,
  1560. value = 0;
  1561. if (coercedNumber !== 0 && isFinite(coercedNumber)) {
  1562. value = absFloor(coercedNumber);
  1563. }
  1564. return value;
  1565. }
  1566. function makeGetSet(unit, keepTime) {
  1567. return function (value) {
  1568. if (value != null) {
  1569. set$1(this, unit, value);
  1570. hooks.updateOffset(this, keepTime);
  1571. return this;
  1572. } else {
  1573. return get(this, unit);
  1574. }
  1575. };
  1576. }
  1577. function get(mom, unit) {
  1578. return mom.isValid()
  1579. ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]()
  1580. : NaN;
  1581. }
  1582. function set$1(mom, unit, value) {
  1583. if (mom.isValid() && !isNaN(value)) {
  1584. if (
  1585. unit === 'FullYear' &&
  1586. isLeapYear(mom.year()) &&
  1587. mom.month() === 1 &&
  1588. mom.date() === 29
  1589. ) {
  1590. value = toInt(value);
  1591. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](
  1592. value,
  1593. mom.month(),
  1594. daysInMonth(value, mom.month())
  1595. );
  1596. } else {
  1597. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
  1598. }
  1599. }
  1600. }
  1601. // MOMENTS
  1602. function stringGet(units) {
  1603. units = normalizeUnits(units);
  1604. if (isFunction(this[units])) {
  1605. return this[units]();
  1606. }
  1607. return this;
  1608. }
  1609. function stringSet(units, value) {
  1610. if (typeof units === 'object') {
  1611. units = normalizeObjectUnits(units);
  1612. var prioritized = getPrioritizedUnits(units),
  1613. i,
  1614. prioritizedLen = prioritized.length;
  1615. for (i = 0; i < prioritizedLen; i++) {
  1616. this[prioritized[i].unit](units[prioritized[i].unit]);
  1617. }
  1618. } else {
  1619. units = normalizeUnits(units);
  1620. if (isFunction(this[units])) {
  1621. return this[units](value);
  1622. }
  1623. }
  1624. return this;
  1625. }
  1626. var match1 = /\d/, // 0 - 9
  1627. match2 = /\d\d/, // 00 - 99
  1628. match3 = /\d{3}/, // 000 - 999
  1629. match4 = /\d{4}/, // 0000 - 9999
  1630. match6 = /[+-]?\d{6}/, // -999999 - 999999
  1631. match1to2 = /\d\d?/, // 0 - 99
  1632. match3to4 = /\d\d\d\d?/, // 999 - 9999
  1633. match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999
  1634. match1to3 = /\d{1,3}/, // 0 - 999
  1635. match1to4 = /\d{1,4}/, // 0 - 9999
  1636. match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999
  1637. matchUnsigned = /\d+/, // 0 - inf
  1638. matchSigned = /[+-]?\d+/, // -inf - inf
  1639. matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
  1640. matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z
  1641. matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
  1642. // any word (or two) characters or numbers including two/three word month in arabic.
  1643. // includes scottish gaelic two word and hyphenated months
  1644. matchWord =
  1645. /[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,
  1646. regexes;
  1647. regexes = {};
  1648. function addRegexToken(token, regex, strictRegex) {
  1649. regexes[token] = isFunction(regex)
  1650. ? regex
  1651. : function (isStrict, localeData) {
  1652. return isStrict && strictRegex ? strictRegex : regex;
  1653. };
  1654. }
  1655. function getParseRegexForToken(token, config) {
  1656. if (!hasOwnProp(regexes, token)) {
  1657. return new RegExp(unescapeFormat(token));
  1658. }
  1659. return regexes[token](config._strict, config._locale);
  1660. }
  1661. // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
  1662. function unescapeFormat(s) {
  1663. return regexEscape(
  1664. s
  1665. .replace('\\', '')
  1666. .replace(
  1667. /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
  1668. function (matched, p1, p2, p3, p4) {
  1669. return p1 || p2 || p3 || p4;
  1670. }
  1671. )
  1672. );
  1673. }
  1674. function regexEscape(s) {
  1675. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  1676. }
  1677. var tokens = {};
  1678. function addParseToken(token, callback) {
  1679. var i,
  1680. func = callback,
  1681. tokenLen;
  1682. if (typeof token === 'string') {
  1683. token = [token];
  1684. }
  1685. if (isNumber(callback)) {
  1686. func = function (input, array) {
  1687. array[callback] = toInt(input);
  1688. };
  1689. }
  1690. tokenLen = token.length;
  1691. for (i = 0; i < tokenLen; i++) {
  1692. tokens[token[i]] = func;
  1693. }
  1694. }
  1695. function addWeekParseToken(token, callback) {
  1696. addParseToken(token, function (input, array, config, token) {
  1697. config._w = config._w || {};
  1698. callback(input, config._w, config, token);
  1699. });
  1700. }
  1701. function addTimeToArrayFromToken(token, input, config) {
  1702. if (input != null && hasOwnProp(tokens, token)) {
  1703. tokens[token](input, config._a, config, token);
  1704. }
  1705. }
  1706. var YEAR = 0,
  1707. MONTH = 1,
  1708. DATE = 2,
  1709. HOUR = 3,
  1710. MINUTE = 4,
  1711. SECOND = 5,
  1712. MILLISECOND = 6,
  1713. WEEK = 7,
  1714. WEEKDAY = 8;
  1715. function mod(n, x) {
  1716. return ((n % x) + x) % x;
  1717. }
  1718. var indexOf;
  1719. if (Array.prototype.indexOf) {
  1720. indexOf = Array.prototype.indexOf;
  1721. } else {
  1722. indexOf = function (o) {
  1723. // I know
  1724. var i;
  1725. for (i = 0; i < this.length; ++i) {
  1726. if (this[i] === o) {
  1727. return i;
  1728. }
  1729. }
  1730. return -1;
  1731. };
  1732. }
  1733. function daysInMonth(year, month) {
  1734. if (isNaN(year) || isNaN(month)) {
  1735. return NaN;
  1736. }
  1737. var modMonth = mod(month, 12);
  1738. year += (month - modMonth) / 12;
  1739. return modMonth === 1
  1740. ? isLeapYear(year)
  1741. ? 29
  1742. : 28
  1743. : 31 - ((modMonth % 7) % 2);
  1744. }
  1745. // FORMATTING
  1746. addFormatToken('M', ['MM', 2], 'Mo', function () {
  1747. return this.month() + 1;
  1748. });
  1749. addFormatToken('MMM', 0, 0, function (format) {
  1750. return this.localeData().monthsShort(this, format);
  1751. });
  1752. addFormatToken('MMMM', 0, 0, function (format) {
  1753. return this.localeData().months(this, format);
  1754. });
  1755. // ALIASES
  1756. addUnitAlias('month', 'M');
  1757. // PRIORITY
  1758. addUnitPriority('month', 8);
  1759. // PARSING
  1760. addRegexToken('M', match1to2);
  1761. addRegexToken('MM', match1to2, match2);
  1762. addRegexToken('MMM', function (isStrict, locale) {
  1763. return locale.monthsShortRegex(isStrict);
  1764. });
  1765. addRegexToken('MMMM', function (isStrict, locale) {
  1766. return locale.monthsRegex(isStrict);
  1767. });
  1768. addParseToken(['M', 'MM'], function (input, array) {
  1769. array[MONTH] = toInt(input) - 1;
  1770. });
  1771. addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
  1772. var month = config._locale.monthsParse(input, token, config._strict);
  1773. // if we didn't find a month name, mark the date as invalid.
  1774. if (month != null) {
  1775. array[MONTH] = month;
  1776. } else {
  1777. getParsingFlags(config).invalidMonth = input;
  1778. }
  1779. });
  1780. // LOCALES
  1781. var defaultLocaleMonths =
  1782. 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
  1783. '_'
  1784. ),
  1785. defaultLocaleMonthsShort =
  1786. 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
  1787. MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
  1788. defaultMonthsShortRegex = matchWord,
  1789. defaultMonthsRegex = matchWord;
  1790. function localeMonths(m, format) {
  1791. if (!m) {
  1792. return isArray(this._months)
  1793. ? this._months
  1794. : this._months['standalone'];
  1795. }
  1796. return isArray(this._months)
  1797. ? this._months[m.month()]
  1798. : this._months[
  1799. (this._months.isFormat || MONTHS_IN_FORMAT).test(format)
  1800. ? 'format'
  1801. : 'standalone'
  1802. ][m.month()];
  1803. }
  1804. function localeMonthsShort(m, format) {
  1805. if (!m) {
  1806. return isArray(this._monthsShort)
  1807. ? this._monthsShort
  1808. : this._monthsShort['standalone'];
  1809. }
  1810. return isArray(this._monthsShort)
  1811. ? this._monthsShort[m.month()]
  1812. : this._monthsShort[
  1813. MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'
  1814. ][m.month()];
  1815. }
  1816. function handleStrictParse(monthName, format, strict) {
  1817. var i,
  1818. ii,
  1819. mom,
  1820. llc = monthName.toLocaleLowerCase();
  1821. if (!this._monthsParse) {
  1822. // this is not used
  1823. this._monthsParse = [];
  1824. this._longMonthsParse = [];
  1825. this._shortMonthsParse = [];
  1826. for (i = 0; i < 12; ++i) {
  1827. mom = createUTC([2000, i]);
  1828. this._shortMonthsParse[i] = this.monthsShort(
  1829. mom,
  1830. ''
  1831. ).toLocaleLowerCase();
  1832. this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
  1833. }
  1834. }
  1835. if (strict) {
  1836. if (format === 'MMM') {
  1837. ii = indexOf.call(this._shortMonthsParse, llc);
  1838. return ii !== -1 ? ii : null;
  1839. } else {
  1840. ii = indexOf.call(this._longMonthsParse, llc);
  1841. return ii !== -1 ? ii : null;
  1842. }
  1843. } else {
  1844. if (format === 'MMM') {
  1845. ii = indexOf.call(this._shortMonthsParse, llc);
  1846. if (ii !== -1) {
  1847. return ii;
  1848. }
  1849. ii = indexOf.call(this._longMonthsParse, llc);
  1850. return ii !== -1 ? ii : null;
  1851. } else {
  1852. ii = indexOf.call(this._longMonthsParse, llc);
  1853. if (ii !== -1) {
  1854. return ii;
  1855. }
  1856. ii = indexOf.call(this._shortMonthsParse, llc);
  1857. return ii !== -1 ? ii : null;
  1858. }
  1859. }
  1860. }
  1861. function localeMonthsParse(monthName, format, strict) {
  1862. var i, mom, regex;
  1863. if (this._monthsParseExact) {
  1864. return handleStrictParse.call(this, monthName, format, strict);
  1865. }
  1866. if (!this._monthsParse) {
  1867. this._monthsParse = [];
  1868. this._longMonthsParse = [];
  1869. this._shortMonthsParse = [];
  1870. }
  1871. // TODO: add sorting
  1872. // Sorting makes sure if one month (or abbr) is a prefix of another
  1873. // see sorting in computeMonthsParse
  1874. for (i = 0; i < 12; i++) {
  1875. // make the regex if we don't have it already
  1876. mom = createUTC([2000, i]);
  1877. if (strict && !this._longMonthsParse[i]) {
  1878. this._longMonthsParse[i] = new RegExp(
  1879. '^' + this.months(mom, '').replace('.', '') + '$',
  1880. 'i'
  1881. );
  1882. this._shortMonthsParse[i] = new RegExp(
  1883. '^' + this.monthsShort(mom, '').replace('.', '') + '$',
  1884. 'i'
  1885. );
  1886. }
  1887. if (!strict && !this._monthsParse[i]) {
  1888. regex =
  1889. '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
  1890. this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
  1891. }
  1892. // test the regex
  1893. if (
  1894. strict &&
  1895. format === 'MMMM' &&
  1896. this._longMonthsParse[i].test(monthName)
  1897. ) {
  1898. return i;
  1899. } else if (
  1900. strict &&
  1901. format === 'MMM' &&
  1902. this._shortMonthsParse[i].test(monthName)
  1903. ) {
  1904. return i;
  1905. } else if (!strict && this._monthsParse[i].test(monthName)) {
  1906. return i;
  1907. }
  1908. }
  1909. }
  1910. // MOMENTS
  1911. function setMonth(mom, value) {
  1912. var dayOfMonth;
  1913. if (!mom.isValid()) {
  1914. // No op
  1915. return mom;
  1916. }
  1917. if (typeof value === 'string') {
  1918. if (/^\d+$/.test(value)) {
  1919. value = toInt(value);
  1920. } else {
  1921. value = mom.localeData().monthsParse(value);
  1922. // TODO: Another silent failure?
  1923. if (!isNumber(value)) {
  1924. return mom;
  1925. }
  1926. }
  1927. }
  1928. dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
  1929. mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
  1930. return mom;
  1931. }
  1932. function getSetMonth(value) {
  1933. if (value != null) {
  1934. setMonth(this, value);
  1935. hooks.updateOffset(this, true);
  1936. return this;
  1937. } else {
  1938. return get(this, 'Month');
  1939. }
  1940. }
  1941. function getDaysInMonth() {
  1942. return daysInMonth(this.year(), this.month());
  1943. }
  1944. function monthsShortRegex(isStrict) {
  1945. if (this._monthsParseExact) {
  1946. if (!hasOwnProp(this, '_monthsRegex')) {
  1947. computeMonthsParse.call(this);
  1948. }
  1949. if (isStrict) {
  1950. return this._monthsShortStrictRegex;
  1951. } else {
  1952. return this._monthsShortRegex;
  1953. }
  1954. } else {
  1955. if (!hasOwnProp(this, '_monthsShortRegex')) {
  1956. this._monthsShortRegex = defaultMonthsShortRegex;
  1957. }
  1958. return this._monthsShortStrictRegex && isStrict
  1959. ? this._monthsShortStrictRegex
  1960. : this._monthsShortRegex;
  1961. }
  1962. }
  1963. function monthsRegex(isStrict) {
  1964. if (this._monthsParseExact) {
  1965. if (!hasOwnProp(this, '_monthsRegex')) {
  1966. computeMonthsParse.call(this);
  1967. }
  1968. if (isStrict) {
  1969. return this._monthsStrictRegex;
  1970. } else {
  1971. return this._monthsRegex;
  1972. }
  1973. } else {
  1974. if (!hasOwnProp(this, '_monthsRegex')) {
  1975. this._monthsRegex = defaultMonthsRegex;
  1976. }
  1977. return this._monthsStrictRegex && isStrict
  1978. ? this._monthsStrictRegex
  1979. : this._monthsRegex;
  1980. }
  1981. }
  1982. function computeMonthsParse() {
  1983. function cmpLenRev(a, b) {
  1984. return b.length - a.length;
  1985. }
  1986. var shortPieces = [],
  1987. longPieces = [],
  1988. mixedPieces = [],
  1989. i,
  1990. mom;
  1991. for (i = 0; i < 12; i++) {
  1992. // make the regex if we don't have it already
  1993. mom = createUTC([2000, i]);
  1994. shortPieces.push(this.monthsShort(mom, ''));
  1995. longPieces.push(this.months(mom, ''));
  1996. mixedPieces.push(this.months(mom, ''));
  1997. mixedPieces.push(this.monthsShort(mom, ''));
  1998. }
  1999. // Sorting makes sure if one month (or abbr) is a prefix of another it
  2000. // will match the longer piece.
  2001. shortPieces.sort(cmpLenRev);
  2002. longPieces.sort(cmpLenRev);
  2003. mixedPieces.sort(cmpLenRev);
  2004. for (i = 0; i < 12; i++) {
  2005. shortPieces[i] = regexEscape(shortPieces[i]);
  2006. longPieces[i] = regexEscape(longPieces[i]);
  2007. }
  2008. for (i = 0; i < 24; i++) {
  2009. mixedPieces[i] = regexEscape(mixedPieces[i]);
  2010. }
  2011. this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  2012. this._monthsShortRegex = this._monthsRegex;
  2013. this._monthsStrictRegex = new RegExp(
  2014. '^(' + longPieces.join('|') + ')',
  2015. 'i'
  2016. );
  2017. this._monthsShortStrictRegex = new RegExp(
  2018. '^(' + shortPieces.join('|') + ')',
  2019. 'i'
  2020. );
  2021. }
  2022. // FORMATTING
  2023. addFormatToken('Y', 0, 0, function () {
  2024. var y = this.year();
  2025. return y <= 9999 ? zeroFill(y, 4) : '+' + y;
  2026. });
  2027. addFormatToken(0, ['YY', 2], 0, function () {
  2028. return this.year() % 100;
  2029. });
  2030. addFormatToken(0, ['YYYY', 4], 0, 'year');
  2031. addFormatToken(0, ['YYYYY', 5], 0, 'year');
  2032. addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
  2033. // ALIASES
  2034. addUnitAlias('year', 'y');
  2035. // PRIORITIES
  2036. addUnitPriority('year', 1);
  2037. // PARSING
  2038. addRegexToken('Y', matchSigned);
  2039. addRegexToken('YY', match1to2, match2);
  2040. addRegexToken('YYYY', match1to4, match4);
  2041. addRegexToken('YYYYY', match1to6, match6);
  2042. addRegexToken('YYYYYY', match1to6, match6);
  2043. addParseToken(['YYYYY', 'YYYYYY'], YEAR);
  2044. addParseToken('YYYY', function (input, array) {
  2045. array[YEAR] =
  2046. input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
  2047. });
  2048. addParseToken('YY', function (input, array) {
  2049. array[YEAR] = hooks.parseTwoDigitYear(input);
  2050. });
  2051. addParseToken('Y', function (input, array) {
  2052. array[YEAR] = parseInt(input, 10);
  2053. });
  2054. // HELPERS
  2055. function daysInYear(year) {
  2056. return isLeapYear(year) ? 366 : 365;
  2057. }
  2058. // HOOKS
  2059. hooks.parseTwoDigitYear = function (input) {
  2060. return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
  2061. };
  2062. // MOMENTS
  2063. var getSetYear = makeGetSet('FullYear', true);
  2064. function getIsLeapYear() {
  2065. return isLeapYear(this.year());
  2066. }
  2067. function createDate(y, m, d, h, M, s, ms) {
  2068. // can't just apply() to create a date:
  2069. // https://stackoverflow.com/q/181348
  2070. var date;
  2071. // the date constructor remaps years 0-99 to 1900-1999
  2072. if (y < 100 && y >= 0) {
  2073. // preserve leap years using a full 400 year cycle, then reset
  2074. date = new Date(y + 400, m, d, h, M, s, ms);
  2075. if (isFinite(date.getFullYear())) {
  2076. date.setFullYear(y);
  2077. }
  2078. } else {
  2079. date = new Date(y, m, d, h, M, s, ms);
  2080. }
  2081. return date;
  2082. }
  2083. function createUTCDate(y) {
  2084. var date, args;
  2085. // the Date.UTC function remaps years 0-99 to 1900-1999
  2086. if (y < 100 && y >= 0) {
  2087. args = Array.prototype.slice.call(arguments);
  2088. // preserve leap years using a full 400 year cycle, then reset
  2089. args[0] = y + 400;
  2090. date = new Date(Date.UTC.apply(null, args));
  2091. if (isFinite(date.getUTCFullYear())) {
  2092. date.setUTCFullYear(y);
  2093. }
  2094. } else {
  2095. date = new Date(Date.UTC.apply(null, arguments));
  2096. }
  2097. return date;
  2098. }
  2099. // start-of-first-week - start-of-year
  2100. function firstWeekOffset(year, dow, doy) {
  2101. var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
  2102. fwd = 7 + dow - doy,
  2103. // first-week day local weekday -- which local weekday is fwd
  2104. fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  2105. return -fwdlw + fwd - 1;
  2106. }
  2107. // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
  2108. function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  2109. var localWeekday = (7 + weekday - dow) % 7,
  2110. weekOffset = firstWeekOffset(year, dow, doy),
  2111. dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
  2112. resYear,
  2113. resDayOfYear;
  2114. if (dayOfYear <= 0) {
  2115. resYear = year - 1;
  2116. resDayOfYear = daysInYear(resYear) + dayOfYear;
  2117. } else if (dayOfYear > daysInYear(year)) {
  2118. resYear = year + 1;
  2119. resDayOfYear = dayOfYear - daysInYear(year);
  2120. } else {
  2121. resYear = year;
  2122. resDayOfYear = dayOfYear;
  2123. }
  2124. return {
  2125. year: resYear,
  2126. dayOfYear: resDayOfYear,
  2127. };
  2128. }
  2129. function weekOfYear(mom, dow, doy) {
  2130. var weekOffset = firstWeekOffset(mom.year(), dow, doy),
  2131. week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
  2132. resWeek,
  2133. resYear;
  2134. if (week < 1) {
  2135. resYear = mom.year() - 1;
  2136. resWeek = week + weeksInYear(resYear, dow, doy);
  2137. } else if (week > weeksInYear(mom.year(), dow, doy)) {
  2138. resWeek = week - weeksInYear(mom.year(), dow, doy);
  2139. resYear = mom.year() + 1;
  2140. } else {
  2141. resYear = mom.year();
  2142. resWeek = week;
  2143. }
  2144. return {
  2145. week: resWeek,
  2146. year: resYear,
  2147. };
  2148. }
  2149. function weeksInYear(year, dow, doy) {
  2150. var weekOffset = firstWeekOffset(year, dow, doy),
  2151. weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  2152. return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
  2153. }
  2154. // FORMATTING
  2155. addFormatToken('w', ['ww', 2], 'wo', 'week');
  2156. addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
  2157. // ALIASES
  2158. addUnitAlias('week', 'w');
  2159. addUnitAlias('isoWeek', 'W');
  2160. // PRIORITIES
  2161. addUnitPriority('week', 5);
  2162. addUnitPriority('isoWeek', 5);
  2163. // PARSING
  2164. addRegexToken('w', match1to2);
  2165. addRegexToken('ww', match1to2, match2);
  2166. addRegexToken('W', match1to2);
  2167. addRegexToken('WW', match1to2, match2);
  2168. addWeekParseToken(
  2169. ['w', 'ww', 'W', 'WW'],
  2170. function (input, week, config, token) {
  2171. week[token.substr(0, 1)] = toInt(input);
  2172. }
  2173. );
  2174. // HELPERS
  2175. // LOCALES
  2176. function localeWeek(mom) {
  2177. return weekOfYear(mom, this._week.dow, this._week.doy).week;
  2178. }
  2179. var defaultLocaleWeek = {
  2180. dow: 0, // Sunday is the first day of the week.
  2181. doy: 6, // The week that contains Jan 6th is the first week of the year.
  2182. };
  2183. function localeFirstDayOfWeek() {
  2184. return this._week.dow;
  2185. }
  2186. function localeFirstDayOfYear() {
  2187. return this._week.doy;
  2188. }
  2189. // MOMENTS
  2190. function getSetWeek(input) {
  2191. var week = this.localeData().week(this);
  2192. return input == null ? week : this.add((input - week) * 7, 'd');
  2193. }
  2194. function getSetISOWeek(input) {
  2195. var week = weekOfYear(this, 1, 4).week;
  2196. return input == null ? week : this.add((input - week) * 7, 'd');
  2197. }
  2198. // FORMATTING
  2199. addFormatToken('d', 0, 'do', 'day');
  2200. addFormatToken('dd', 0, 0, function (format) {
  2201. return this.localeData().weekdaysMin(this, format);
  2202. });
  2203. addFormatToken('ddd', 0, 0, function (format) {
  2204. return this.localeData().weekdaysShort(this, format);
  2205. });
  2206. addFormatToken('dddd', 0, 0, function (format) {
  2207. return this.localeData().weekdays(this, format);
  2208. });
  2209. addFormatToken('e', 0, 0, 'weekday');
  2210. addFormatToken('E', 0, 0, 'isoWeekday');
  2211. // ALIASES
  2212. addUnitAlias('day', 'd');
  2213. addUnitAlias('weekday', 'e');
  2214. addUnitAlias('isoWeekday', 'E');
  2215. // PRIORITY
  2216. addUnitPriority('day', 11);
  2217. addUnitPriority('weekday', 11);
  2218. addUnitPriority('isoWeekday', 11);
  2219. // PARSING
  2220. addRegexToken('d', match1to2);
  2221. addRegexToken('e', match1to2);
  2222. addRegexToken('E', match1to2);
  2223. addRegexToken('dd', function (isStrict, locale) {
  2224. return locale.weekdaysMinRegex(isStrict);
  2225. });
  2226. addRegexToken('ddd', function (isStrict, locale) {
  2227. return locale.weekdaysShortRegex(isStrict);
  2228. });
  2229. addRegexToken('dddd', function (isStrict, locale) {
  2230. return locale.weekdaysRegex(isStrict);
  2231. });
  2232. addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
  2233. var weekday = config._locale.weekdaysParse(input, token, config._strict);
  2234. // if we didn't get a weekday name, mark the date as invalid
  2235. if (weekday != null) {
  2236. week.d = weekday;
  2237. } else {
  2238. getParsingFlags(config).invalidWeekday = input;
  2239. }
  2240. });
  2241. addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
  2242. week[token] = toInt(input);
  2243. });
  2244. // HELPERS
  2245. function parseWeekday(input, locale) {
  2246. if (typeof input !== 'string') {
  2247. return input;
  2248. }
  2249. if (!isNaN(input)) {
  2250. return parseInt(input, 10);
  2251. }
  2252. input = locale.weekdaysParse(input);
  2253. if (typeof input === 'number') {
  2254. return input;
  2255. }
  2256. return null;
  2257. }
  2258. function parseIsoWeekday(input, locale) {
  2259. if (typeof input === 'string') {
  2260. return locale.weekdaysParse(input) % 7 || 7;
  2261. }
  2262. return isNaN(input) ? null : input;
  2263. }
  2264. // LOCALES
  2265. function shiftWeekdays(ws, n) {
  2266. return ws.slice(n, 7).concat(ws.slice(0, n));
  2267. }
  2268. var defaultLocaleWeekdays =
  2269. 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
  2270. defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  2271. defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  2272. defaultWeekdaysRegex = matchWord,
  2273. defaultWeekdaysShortRegex = matchWord,
  2274. defaultWeekdaysMinRegex = matchWord;
  2275. function localeWeekdays(m, format) {
  2276. var weekdays = isArray(this._weekdays)
  2277. ? this._weekdays
  2278. : this._weekdays[
  2279. m && m !== true && this._weekdays.isFormat.test(format)
  2280. ? 'format'
  2281. : 'standalone'
  2282. ];
  2283. return m === true
  2284. ? shiftWeekdays(weekdays, this._week.dow)
  2285. : m
  2286. ? weekdays[m.day()]
  2287. : weekdays;
  2288. }
  2289. function localeWeekdaysShort(m) {
  2290. return m === true
  2291. ? shiftWeekdays(this._weekdaysShort, this._week.dow)
  2292. : m
  2293. ? this._weekdaysShort[m.day()]
  2294. : this._weekdaysShort;
  2295. }
  2296. function localeWeekdaysMin(m) {
  2297. return m === true
  2298. ? shiftWeekdays(this._weekdaysMin, this._week.dow)
  2299. : m
  2300. ? this._weekdaysMin[m.day()]
  2301. : this._weekdaysMin;
  2302. }
  2303. function handleStrictParse$1(weekdayName, format, strict) {
  2304. var i,
  2305. ii,
  2306. mom,
  2307. llc = weekdayName.toLocaleLowerCase();
  2308. if (!this._weekdaysParse) {
  2309. this._weekdaysParse = [];
  2310. this._shortWeekdaysParse = [];
  2311. this._minWeekdaysParse = [];
  2312. for (i = 0; i < 7; ++i) {
  2313. mom = createUTC([2000, 1]).day(i);
  2314. this._minWeekdaysParse[i] = this.weekdaysMin(
  2315. mom,
  2316. ''
  2317. ).toLocaleLowerCase();
  2318. this._shortWeekdaysParse[i] = this.weekdaysShort(
  2319. mom,
  2320. ''
  2321. ).toLocaleLowerCase();
  2322. this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
  2323. }
  2324. }
  2325. if (strict) {
  2326. if (format === 'dddd') {
  2327. ii = indexOf.call(this._weekdaysParse, llc);
  2328. return ii !== -1 ? ii : null;
  2329. } else if (format === 'ddd') {
  2330. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2331. return ii !== -1 ? ii : null;
  2332. } else {
  2333. ii = indexOf.call(this._minWeekdaysParse, llc);
  2334. return ii !== -1 ? ii : null;
  2335. }
  2336. } else {
  2337. if (format === 'dddd') {
  2338. ii = indexOf.call(this._weekdaysParse, llc);
  2339. if (ii !== -1) {
  2340. return ii;
  2341. }
  2342. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2343. if (ii !== -1) {
  2344. return ii;
  2345. }
  2346. ii = indexOf.call(this._minWeekdaysParse, llc);
  2347. return ii !== -1 ? ii : null;
  2348. } else if (format === 'ddd') {
  2349. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2350. if (ii !== -1) {
  2351. return ii;
  2352. }
  2353. ii = indexOf.call(this._weekdaysParse, llc);
  2354. if (ii !== -1) {
  2355. return ii;
  2356. }
  2357. ii = indexOf.call(this._minWeekdaysParse, llc);
  2358. return ii !== -1 ? ii : null;
  2359. } else {
  2360. ii = indexOf.call(this._minWeekdaysParse, llc);
  2361. if (ii !== -1) {
  2362. return ii;
  2363. }
  2364. ii = indexOf.call(this._weekdaysParse, llc);
  2365. if (ii !== -1) {
  2366. return ii;
  2367. }
  2368. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2369. return ii !== -1 ? ii : null;
  2370. }
  2371. }
  2372. }
  2373. function localeWeekdaysParse(weekdayName, format, strict) {
  2374. var i, mom, regex;
  2375. if (this._weekdaysParseExact) {
  2376. return handleStrictParse$1.call(this, weekdayName, format, strict);
  2377. }
  2378. if (!this._weekdaysParse) {
  2379. this._weekdaysParse = [];
  2380. this._minWeekdaysParse = [];
  2381. this._shortWeekdaysParse = [];
  2382. this._fullWeekdaysParse = [];
  2383. }
  2384. for (i = 0; i < 7; i++) {
  2385. // make the regex if we don't have it already
  2386. mom = createUTC([2000, 1]).day(i);
  2387. if (strict && !this._fullWeekdaysParse[i]) {
  2388. this._fullWeekdaysParse[i] = new RegExp(
  2389. '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$',
  2390. 'i'
  2391. );
  2392. this._shortWeekdaysParse[i] = new RegExp(
  2393. '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$',
  2394. 'i'
  2395. );
  2396. this._minWeekdaysParse[i] = new RegExp(
  2397. '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$',
  2398. 'i'
  2399. );
  2400. }
  2401. if (!this._weekdaysParse[i]) {
  2402. regex =
  2403. '^' +
  2404. this.weekdays(mom, '') +
  2405. '|^' +
  2406. this.weekdaysShort(mom, '') +
  2407. '|^' +
  2408. this.weekdaysMin(mom, '');
  2409. this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
  2410. }
  2411. // test the regex
  2412. if (
  2413. strict &&
  2414. format === 'dddd' &&
  2415. this._fullWeekdaysParse[i].test(weekdayName)
  2416. ) {
  2417. return i;
  2418. } else if (
  2419. strict &&
  2420. format === 'ddd' &&
  2421. this._shortWeekdaysParse[i].test(weekdayName)
  2422. ) {
  2423. return i;
  2424. } else if (
  2425. strict &&
  2426. format === 'dd' &&
  2427. this._minWeekdaysParse[i].test(weekdayName)
  2428. ) {
  2429. return i;
  2430. } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
  2431. return i;
  2432. }
  2433. }
  2434. }
  2435. // MOMENTS
  2436. function getSetDayOfWeek(input) {
  2437. if (!this.isValid()) {
  2438. return input != null ? this : NaN;
  2439. }
  2440. var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
  2441. if (input != null) {
  2442. input = parseWeekday(input, this.localeData());
  2443. return this.add(input - day, 'd');
  2444. } else {
  2445. return day;
  2446. }
  2447. }
  2448. function getSetLocaleDayOfWeek(input) {
  2449. if (!this.isValid()) {
  2450. return input != null ? this : NaN;
  2451. }
  2452. var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  2453. return input == null ? weekday : this.add(input - weekday, 'd');
  2454. }
  2455. function getSetISODayOfWeek(input) {
  2456. if (!this.isValid()) {
  2457. return input != null ? this : NaN;
  2458. }
  2459. // behaves the same as moment#day except
  2460. // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
  2461. // as a setter, sunday should belong to the previous week.
  2462. if (input != null) {
  2463. var weekday = parseIsoWeekday(input, this.localeData());
  2464. return this.day(this.day() % 7 ? weekday : weekday - 7);
  2465. } else {
  2466. return this.day() || 7;
  2467. }
  2468. }
  2469. function weekdaysRegex(isStrict) {
  2470. if (this._weekdaysParseExact) {
  2471. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2472. computeWeekdaysParse.call(this);
  2473. }
  2474. if (isStrict) {
  2475. return this._weekdaysStrictRegex;
  2476. } else {
  2477. return this._weekdaysRegex;
  2478. }
  2479. } else {
  2480. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2481. this._weekdaysRegex = defaultWeekdaysRegex;
  2482. }
  2483. return this._weekdaysStrictRegex && isStrict
  2484. ? this._weekdaysStrictRegex
  2485. : this._weekdaysRegex;
  2486. }
  2487. }
  2488. function weekdaysShortRegex(isStrict) {
  2489. if (this._weekdaysParseExact) {
  2490. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2491. computeWeekdaysParse.call(this);
  2492. }
  2493. if (isStrict) {
  2494. return this._weekdaysShortStrictRegex;
  2495. } else {
  2496. return this._weekdaysShortRegex;
  2497. }
  2498. } else {
  2499. if (!hasOwnProp(this, '_weekdaysShortRegex')) {
  2500. this._weekdaysShortRegex = defaultWeekdaysShortRegex;
  2501. }
  2502. return this._weekdaysShortStrictRegex && isStrict
  2503. ? this._weekdaysShortStrictRegex
  2504. : this._weekdaysShortRegex;
  2505. }
  2506. }
  2507. function weekdaysMinRegex(isStrict) {
  2508. if (this._weekdaysParseExact) {
  2509. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2510. computeWeekdaysParse.call(this);
  2511. }
  2512. if (isStrict) {
  2513. return this._weekdaysMinStrictRegex;
  2514. } else {
  2515. return this._weekdaysMinRegex;
  2516. }
  2517. } else {
  2518. if (!hasOwnProp(this, '_weekdaysMinRegex')) {
  2519. this._weekdaysMinRegex = defaultWeekdaysMinRegex;
  2520. }
  2521. return this._weekdaysMinStrictRegex && isStrict
  2522. ? this._weekdaysMinStrictRegex
  2523. : this._weekdaysMinRegex;
  2524. }
  2525. }
  2526. function computeWeekdaysParse() {
  2527. function cmpLenRev(a, b) {
  2528. return b.length - a.length;
  2529. }
  2530. var minPieces = [],
  2531. shortPieces = [],
  2532. longPieces = [],
  2533. mixedPieces = [],
  2534. i,
  2535. mom,
  2536. minp,
  2537. shortp,
  2538. longp;
  2539. for (i = 0; i < 7; i++) {
  2540. // make the regex if we don't have it already
  2541. mom = createUTC([2000, 1]).day(i);
  2542. minp = regexEscape(this.weekdaysMin(mom, ''));
  2543. shortp = regexEscape(this.weekdaysShort(mom, ''));
  2544. longp = regexEscape(this.weekdays(mom, ''));
  2545. minPieces.push(minp);
  2546. shortPieces.push(shortp);
  2547. longPieces.push(longp);
  2548. mixedPieces.push(minp);
  2549. mixedPieces.push(shortp);
  2550. mixedPieces.push(longp);
  2551. }
  2552. // Sorting makes sure if one weekday (or abbr) is a prefix of another it
  2553. // will match the longer piece.
  2554. minPieces.sort(cmpLenRev);
  2555. shortPieces.sort(cmpLenRev);
  2556. longPieces.sort(cmpLenRev);
  2557. mixedPieces.sort(cmpLenRev);
  2558. this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  2559. this._weekdaysShortRegex = this._weekdaysRegex;
  2560. this._weekdaysMinRegex = this._weekdaysRegex;
  2561. this._weekdaysStrictRegex = new RegExp(
  2562. '^(' + longPieces.join('|') + ')',
  2563. 'i'
  2564. );
  2565. this._weekdaysShortStrictRegex = new RegExp(
  2566. '^(' + shortPieces.join('|') + ')',
  2567. 'i'
  2568. );
  2569. this._weekdaysMinStrictRegex = new RegExp(
  2570. '^(' + minPieces.join('|') + ')',
  2571. 'i'
  2572. );
  2573. }
  2574. // FORMATTING
  2575. function hFormat() {
  2576. return this.hours() % 12 || 12;
  2577. }
  2578. function kFormat() {
  2579. return this.hours() || 24;
  2580. }
  2581. addFormatToken('H', ['HH', 2], 0, 'hour');
  2582. addFormatToken('h', ['hh', 2], 0, hFormat);
  2583. addFormatToken('k', ['kk', 2], 0, kFormat);
  2584. addFormatToken('hmm', 0, 0, function () {
  2585. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
  2586. });
  2587. addFormatToken('hmmss', 0, 0, function () {
  2588. return (
  2589. '' +
  2590. hFormat.apply(this) +
  2591. zeroFill(this.minutes(), 2) +
  2592. zeroFill(this.seconds(), 2)
  2593. );
  2594. });
  2595. addFormatToken('Hmm', 0, 0, function () {
  2596. return '' + this.hours() + zeroFill(this.minutes(), 2);
  2597. });
  2598. addFormatToken('Hmmss', 0, 0, function () {
  2599. return (
  2600. '' +
  2601. this.hours() +
  2602. zeroFill(this.minutes(), 2) +
  2603. zeroFill(this.seconds(), 2)
  2604. );
  2605. });
  2606. function meridiem(token, lowercase) {
  2607. addFormatToken(token, 0, 0, function () {
  2608. return this.localeData().meridiem(
  2609. this.hours(),
  2610. this.minutes(),
  2611. lowercase
  2612. );
  2613. });
  2614. }
  2615. meridiem('a', true);
  2616. meridiem('A', false);
  2617. // ALIASES
  2618. addUnitAlias('hour', 'h');
  2619. // PRIORITY
  2620. addUnitPriority('hour', 13);
  2621. // PARSING
  2622. function matchMeridiem(isStrict, locale) {
  2623. return locale._meridiemParse;
  2624. }
  2625. addRegexToken('a', matchMeridiem);
  2626. addRegexToken('A', matchMeridiem);
  2627. addRegexToken('H', match1to2);
  2628. addRegexToken('h', match1to2);
  2629. addRegexToken('k', match1to2);
  2630. addRegexToken('HH', match1to2, match2);
  2631. addRegexToken('hh', match1to2, match2);
  2632. addRegexToken('kk', match1to2, match2);
  2633. addRegexToken('hmm', match3to4);
  2634. addRegexToken('hmmss', match5to6);
  2635. addRegexToken('Hmm', match3to4);
  2636. addRegexToken('Hmmss', match5to6);
  2637. addParseToken(['H', 'HH'], HOUR);
  2638. addParseToken(['k', 'kk'], function (input, array, config) {
  2639. var kInput = toInt(input);
  2640. array[HOUR] = kInput === 24 ? 0 : kInput;
  2641. });
  2642. addParseToken(['a', 'A'], function (input, array, config) {
  2643. config._isPm = config._locale.isPM(input);
  2644. config._meridiem = input;
  2645. });
  2646. addParseToken(['h', 'hh'], function (input, array, config) {
  2647. array[HOUR] = toInt(input);
  2648. getParsingFlags(config).bigHour = true;
  2649. });
  2650. addParseToken('hmm', function (input, array, config) {
  2651. var pos = input.length - 2;
  2652. array[HOUR] = toInt(input.substr(0, pos));
  2653. array[MINUTE] = toInt(input.substr(pos));
  2654. getParsingFlags(config).bigHour = true;
  2655. });
  2656. addParseToken('hmmss', function (input, array, config) {
  2657. var pos1 = input.length - 4,
  2658. pos2 = input.length - 2;
  2659. array[HOUR] = toInt(input.substr(0, pos1));
  2660. array[MINUTE] = toInt(input.substr(pos1, 2));
  2661. array[SECOND] = toInt(input.substr(pos2));
  2662. getParsingFlags(config).bigHour = true;
  2663. });
  2664. addParseToken('Hmm', function (input, array, config) {
  2665. var pos = input.length - 2;
  2666. array[HOUR] = toInt(input.substr(0, pos));
  2667. array[MINUTE] = toInt(input.substr(pos));
  2668. });
  2669. addParseToken('Hmmss', function (input, array, config) {
  2670. var pos1 = input.length - 4,
  2671. pos2 = input.length - 2;
  2672. array[HOUR] = toInt(input.substr(0, pos1));
  2673. array[MINUTE] = toInt(input.substr(pos1, 2));
  2674. array[SECOND] = toInt(input.substr(pos2));
  2675. });
  2676. // LOCALES
  2677. function localeIsPM(input) {
  2678. // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
  2679. // Using charAt should be more compatible.
  2680. return (input + '').toLowerCase().charAt(0) === 'p';
  2681. }
  2682. var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i,
  2683. // Setting the hour should keep the time, because the user explicitly
  2684. // specified which hour they want. So trying to maintain the same hour (in
  2685. // a new timezone) makes sense. Adding/subtracting hours does not follow
  2686. // this rule.
  2687. getSetHour = makeGetSet('Hours', true);
  2688. function localeMeridiem(hours, minutes, isLower) {
  2689. if (hours > 11) {
  2690. return isLower ? 'pm' : 'PM';
  2691. } else {
  2692. return isLower ? 'am' : 'AM';
  2693. }
  2694. }
  2695. var baseConfig = {
  2696. calendar: defaultCalendar,
  2697. longDateFormat: defaultLongDateFormat,
  2698. invalidDate: defaultInvalidDate,
  2699. ordinal: defaultOrdinal,
  2700. dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
  2701. relativeTime: defaultRelativeTime,
  2702. months: defaultLocaleMonths,
  2703. monthsShort: defaultLocaleMonthsShort,
  2704. week: defaultLocaleWeek,
  2705. weekdays: defaultLocaleWeekdays,
  2706. weekdaysMin: defaultLocaleWeekdaysMin,
  2707. weekdaysShort: defaultLocaleWeekdaysShort,
  2708. meridiemParse: defaultLocaleMeridiemParse,
  2709. };
  2710. // internal storage for locale config files
  2711. var locales = {},
  2712. localeFamilies = {},
  2713. globalLocale;
  2714. function commonPrefix(arr1, arr2) {
  2715. var i,
  2716. minl = Math.min(arr1.length, arr2.length);
  2717. for (i = 0; i < minl; i += 1) {
  2718. if (arr1[i] !== arr2[i]) {
  2719. return i;
  2720. }
  2721. }
  2722. return minl;
  2723. }
  2724. function normalizeLocale(key) {
  2725. return key ? key.toLowerCase().replace('_', '-') : key;
  2726. }
  2727. // pick the locale from the array
  2728. // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
  2729. // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
  2730. function chooseLocale(names) {
  2731. var i = 0,
  2732. j,
  2733. next,
  2734. locale,
  2735. split;
  2736. while (i < names.length) {
  2737. split = normalizeLocale(names[i]).split('-');
  2738. j = split.length;
  2739. next = normalizeLocale(names[i + 1]);
  2740. next = next ? next.split('-') : null;
  2741. while (j > 0) {
  2742. locale = loadLocale(split.slice(0, j).join('-'));
  2743. if (locale) {
  2744. return locale;
  2745. }
  2746. if (
  2747. next &&
  2748. next.length >= j &&
  2749. commonPrefix(split, next) >= j - 1
  2750. ) {
  2751. //the next array item is better than a shallower substring of this one
  2752. break;
  2753. }
  2754. j--;
  2755. }
  2756. i++;
  2757. }
  2758. return globalLocale;
  2759. }
  2760. function isLocaleNameSane(name) {
  2761. // Prevent names that look like filesystem paths, i.e contain '/' or '\'
  2762. return name.match('^[^/\\\\]*$') != null;
  2763. }
  2764. function loadLocale(name) {
  2765. var oldLocale = null,
  2766. aliasedRequire;
  2767. // TODO: Find a better way to register and load all the locales in Node
  2768. if (
  2769. locales[name] === undefined &&
  2770. typeof module !== 'undefined' &&
  2771. module &&
  2772. module.exports &&
  2773. isLocaleNameSane(name)
  2774. ) {
  2775. try {
  2776. oldLocale = globalLocale._abbr;
  2777. aliasedRequire = require;
  2778. aliasedRequire('./locale/' + name);
  2779. getSetGlobalLocale(oldLocale);
  2780. } catch (e) {
  2781. // mark as not found to avoid repeating expensive file require call causing high CPU
  2782. // when trying to find en-US, en_US, en-us for every format call
  2783. locales[name] = null; // null means not found
  2784. }
  2785. }
  2786. return locales[name];
  2787. }
  2788. // This function will load locale and then set the global locale. If
  2789. // no arguments are passed in, it will simply return the current global
  2790. // locale key.
  2791. function getSetGlobalLocale(key, values) {
  2792. var data;
  2793. if (key) {
  2794. if (isUndefined(values)) {
  2795. data = getLocale(key);
  2796. } else {
  2797. data = defineLocale(key, values);
  2798. }
  2799. if (data) {
  2800. // moment.duration._locale = moment._locale = data;
  2801. globalLocale = data;
  2802. } else {
  2803. if (typeof console !== 'undefined' && console.warn) {
  2804. //warn user if arguments are passed but the locale could not be set
  2805. console.warn(
  2806. 'Locale ' + key + ' not found. Did you forget to load it?'
  2807. );
  2808. }
  2809. }
  2810. }
  2811. return globalLocale._abbr;
  2812. }
  2813. function defineLocale(name, config) {
  2814. if (config !== null) {
  2815. var locale,
  2816. parentConfig = baseConfig;
  2817. config.abbr = name;
  2818. if (locales[name] != null) {
  2819. deprecateSimple(
  2820. 'defineLocaleOverride',
  2821. 'use moment.updateLocale(localeName, config) to change ' +
  2822. 'an existing locale. moment.defineLocale(localeName, ' +
  2823. 'config) should only be used for creating a new locale ' +
  2824. 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'
  2825. );
  2826. parentConfig = locales[name]._config;
  2827. } else if (config.parentLocale != null) {
  2828. if (locales[config.parentLocale] != null) {
  2829. parentConfig = locales[config.parentLocale]._config;
  2830. } else {
  2831. locale = loadLocale(config.parentLocale);
  2832. if (locale != null) {
  2833. parentConfig = locale._config;
  2834. } else {
  2835. if (!localeFamilies[config.parentLocale]) {
  2836. localeFamilies[config.parentLocale] = [];
  2837. }
  2838. localeFamilies[config.parentLocale].push({
  2839. name: name,
  2840. config: config,
  2841. });
  2842. return null;
  2843. }
  2844. }
  2845. }
  2846. locales[name] = new Locale(mergeConfigs(parentConfig, config));
  2847. if (localeFamilies[name]) {
  2848. localeFamilies[name].forEach(function (x) {
  2849. defineLocale(x.name, x.config);
  2850. });
  2851. }
  2852. // backwards compat for now: also set the locale
  2853. // make sure we set the locale AFTER all child locales have been
  2854. // created, so we won't end up with the child locale set.
  2855. getSetGlobalLocale(name);
  2856. return locales[name];
  2857. } else {
  2858. // useful for testing
  2859. delete locales[name];
  2860. return null;
  2861. }
  2862. }
  2863. function updateLocale(name, config) {
  2864. if (config != null) {
  2865. var locale,
  2866. tmpLocale,
  2867. parentConfig = baseConfig;
  2868. if (locales[name] != null && locales[name].parentLocale != null) {
  2869. // Update existing child locale in-place to avoid memory-leaks
  2870. locales[name].set(mergeConfigs(locales[name]._config, config));
  2871. } else {
  2872. // MERGE
  2873. tmpLocale = loadLocale(name);
  2874. if (tmpLocale != null) {
  2875. parentConfig = tmpLocale._config;
  2876. }
  2877. config = mergeConfigs(parentConfig, config);
  2878. if (tmpLocale == null) {
  2879. // updateLocale is called for creating a new locale
  2880. // Set abbr so it will have a name (getters return
  2881. // undefined otherwise).
  2882. config.abbr = name;
  2883. }
  2884. locale = new Locale(config);
  2885. locale.parentLocale = locales[name];
  2886. locales[name] = locale;
  2887. }
  2888. // backwards compat for now: also set the locale
  2889. getSetGlobalLocale(name);
  2890. } else {
  2891. // pass null for config to unupdate, useful for tests
  2892. if (locales[name] != null) {
  2893. if (locales[name].parentLocale != null) {
  2894. locales[name] = locales[name].parentLocale;
  2895. if (name === getSetGlobalLocale()) {
  2896. getSetGlobalLocale(name);
  2897. }
  2898. } else if (locales[name] != null) {
  2899. delete locales[name];
  2900. }
  2901. }
  2902. }
  2903. return locales[name];
  2904. }
  2905. // returns locale data
  2906. function getLocale(key) {
  2907. var locale;
  2908. if (key && key._locale && key._locale._abbr) {
  2909. key = key._locale._abbr;
  2910. }
  2911. if (!key) {
  2912. return globalLocale;
  2913. }
  2914. if (!isArray(key)) {
  2915. //short-circuit everything else
  2916. locale = loadLocale(key);
  2917. if (locale) {
  2918. return locale;
  2919. }
  2920. key = [key];
  2921. }
  2922. return chooseLocale(key);
  2923. }
  2924. function listLocales() {
  2925. return keys(locales);
  2926. }
  2927. function checkOverflow(m) {
  2928. var overflow,
  2929. a = m._a;
  2930. if (a && getParsingFlags(m).overflow === -2) {
  2931. overflow =
  2932. a[MONTH] < 0 || a[MONTH] > 11
  2933. ? MONTH
  2934. : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
  2935. ? DATE
  2936. : a[HOUR] < 0 ||
  2937. a[HOUR] > 24 ||
  2938. (a[HOUR] === 24 &&
  2939. (a[MINUTE] !== 0 ||
  2940. a[SECOND] !== 0 ||
  2941. a[MILLISECOND] !== 0))
  2942. ? HOUR
  2943. : a[MINUTE] < 0 || a[MINUTE] > 59
  2944. ? MINUTE
  2945. : a[SECOND] < 0 || a[SECOND] > 59
  2946. ? SECOND
  2947. : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
  2948. ? MILLISECOND
  2949. : -1;
  2950. if (
  2951. getParsingFlags(m)._overflowDayOfYear &&
  2952. (overflow < YEAR || overflow > DATE)
  2953. ) {
  2954. overflow = DATE;
  2955. }
  2956. if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
  2957. overflow = WEEK;
  2958. }
  2959. if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
  2960. overflow = WEEKDAY;
  2961. }
  2962. getParsingFlags(m).overflow = overflow;
  2963. }
  2964. return m;
  2965. }
  2966. // iso 8601 regex
  2967. // 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)
  2968. var extendedIsoRegex =
  2969. /^\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)?)?$/,
  2970. basicIsoRegex =
  2971. /^\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)?)?$/,
  2972. tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
  2973. isoDates = [
  2974. ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
  2975. ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
  2976. ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
  2977. ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
  2978. ['YYYY-DDD', /\d{4}-\d{3}/],
  2979. ['YYYY-MM', /\d{4}-\d\d/, false],
  2980. ['YYYYYYMMDD', /[+-]\d{10}/],
  2981. ['YYYYMMDD', /\d{8}/],
  2982. ['GGGG[W]WWE', /\d{4}W\d{3}/],
  2983. ['GGGG[W]WW', /\d{4}W\d{2}/, false],
  2984. ['YYYYDDD', /\d{7}/],
  2985. ['YYYYMM', /\d{6}/, false],
  2986. ['YYYY', /\d{4}/, false],
  2987. ],
  2988. // iso time formats and regexes
  2989. isoTimes = [
  2990. ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
  2991. ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
  2992. ['HH:mm:ss', /\d\d:\d\d:\d\d/],
  2993. ['HH:mm', /\d\d:\d\d/],
  2994. ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
  2995. ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
  2996. ['HHmmss', /\d\d\d\d\d\d/],
  2997. ['HHmm', /\d\d\d\d/],
  2998. ['HH', /\d\d/],
  2999. ],
  3000. aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
  3001. // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
  3002. rfc2822 =
  3003. /^(?:(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}))$/,
  3004. obsOffsets = {
  3005. UT: 0,
  3006. GMT: 0,
  3007. EDT: -4 * 60,
  3008. EST: -5 * 60,
  3009. CDT: -5 * 60,
  3010. CST: -6 * 60,
  3011. MDT: -6 * 60,
  3012. MST: -7 * 60,
  3013. PDT: -7 * 60,
  3014. PST: -8 * 60,
  3015. };
  3016. // date from iso format
  3017. function configFromISO(config) {
  3018. var i,
  3019. l,
  3020. string = config._i,
  3021. match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
  3022. allowTime,
  3023. dateFormat,
  3024. timeFormat,
  3025. tzFormat,
  3026. isoDatesLen = isoDates.length,
  3027. isoTimesLen = isoTimes.length;
  3028. if (match) {
  3029. getParsingFlags(config).iso = true;
  3030. for (i = 0, l = isoDatesLen; i < l; i++) {
  3031. if (isoDates[i][1].exec(match[1])) {
  3032. dateFormat = isoDates[i][0];
  3033. allowTime = isoDates[i][2] !== false;
  3034. break;
  3035. }
  3036. }
  3037. if (dateFormat == null) {
  3038. config._isValid = false;
  3039. return;
  3040. }
  3041. if (match[3]) {
  3042. for (i = 0, l = isoTimesLen; i < l; i++) {
  3043. if (isoTimes[i][1].exec(match[3])) {
  3044. // match[2] should be 'T' or space
  3045. timeFormat = (match[2] || ' ') + isoTimes[i][0];
  3046. break;
  3047. }
  3048. }
  3049. if (timeFormat == null) {
  3050. config._isValid = false;
  3051. return;
  3052. }
  3053. }
  3054. if (!allowTime && timeFormat != null) {
  3055. config._isValid = false;
  3056. return;
  3057. }
  3058. if (match[4]) {
  3059. if (tzRegex.exec(match[4])) {
  3060. tzFormat = 'Z';
  3061. } else {
  3062. config._isValid = false;
  3063. return;
  3064. }
  3065. }
  3066. config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
  3067. configFromStringAndFormat(config);
  3068. } else {
  3069. config._isValid = false;
  3070. }
  3071. }
  3072. function extractFromRFC2822Strings(
  3073. yearStr,
  3074. monthStr,
  3075. dayStr,
  3076. hourStr,
  3077. minuteStr,
  3078. secondStr
  3079. ) {
  3080. var result = [
  3081. untruncateYear(yearStr),
  3082. defaultLocaleMonthsShort.indexOf(monthStr),
  3083. parseInt(dayStr, 10),
  3084. parseInt(hourStr, 10),
  3085. parseInt(minuteStr, 10),
  3086. ];
  3087. if (secondStr) {
  3088. result.push(parseInt(secondStr, 10));
  3089. }
  3090. return result;
  3091. }
  3092. function untruncateYear(yearStr) {
  3093. var year = parseInt(yearStr, 10);
  3094. if (year <= 49) {
  3095. return 2000 + year;
  3096. } else if (year <= 999) {
  3097. return 1900 + year;
  3098. }
  3099. return year;
  3100. }
  3101. function preprocessRFC2822(s) {
  3102. // Remove comments and folding whitespace and replace multiple-spaces with a single space
  3103. return s
  3104. .replace(/\([^)]*\)|[\n\t]/g, ' ')
  3105. .replace(/(\s\s+)/g, ' ')
  3106. .replace(/^\s\s*/, '')
  3107. .replace(/\s\s*$/, '');
  3108. }
  3109. function checkWeekday(weekdayStr, parsedInput, config) {
  3110. if (weekdayStr) {
  3111. // TODO: Replace the vanilla JS Date object with an independent day-of-week check.
  3112. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
  3113. weekdayActual = new Date(
  3114. parsedInput[0],
  3115. parsedInput[1],
  3116. parsedInput[2]
  3117. ).getDay();
  3118. if (weekdayProvided !== weekdayActual) {
  3119. getParsingFlags(config).weekdayMismatch = true;
  3120. config._isValid = false;
  3121. return false;
  3122. }
  3123. }
  3124. return true;
  3125. }
  3126. function calculateOffset(obsOffset, militaryOffset, numOffset) {
  3127. if (obsOffset) {
  3128. return obsOffsets[obsOffset];
  3129. } else if (militaryOffset) {
  3130. // the only allowed military tz is Z
  3131. return 0;
  3132. } else {
  3133. var hm = parseInt(numOffset, 10),
  3134. m = hm % 100,
  3135. h = (hm - m) / 100;
  3136. return h * 60 + m;
  3137. }
  3138. }
  3139. // date and time from ref 2822 format
  3140. function configFromRFC2822(config) {
  3141. var match = rfc2822.exec(preprocessRFC2822(config._i)),
  3142. parsedArray;
  3143. if (match) {
  3144. parsedArray = extractFromRFC2822Strings(
  3145. match[4],
  3146. match[3],
  3147. match[2],
  3148. match[5],
  3149. match[6],
  3150. match[7]
  3151. );
  3152. if (!checkWeekday(match[1], parsedArray, config)) {
  3153. return;
  3154. }
  3155. config._a = parsedArray;
  3156. config._tzm = calculateOffset(match[8], match[9], match[10]);
  3157. config._d = createUTCDate.apply(null, config._a);
  3158. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  3159. getParsingFlags(config).rfc2822 = true;
  3160. } else {
  3161. config._isValid = false;
  3162. }
  3163. }
  3164. // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict
  3165. function configFromString(config) {
  3166. var matched = aspNetJsonRegex.exec(config._i);
  3167. if (matched !== null) {
  3168. config._d = new Date(+matched[1]);
  3169. return;
  3170. }
  3171. configFromISO(config);
  3172. if (config._isValid === false) {
  3173. delete config._isValid;
  3174. } else {
  3175. return;
  3176. }
  3177. configFromRFC2822(config);
  3178. if (config._isValid === false) {
  3179. delete config._isValid;
  3180. } else {
  3181. return;
  3182. }
  3183. if (config._strict) {
  3184. config._isValid = false;
  3185. } else {
  3186. // Final attempt, use Input Fallback
  3187. hooks.createFromInputFallback(config);
  3188. }
  3189. }
  3190. hooks.createFromInputFallback = deprecate(
  3191. 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
  3192. 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
  3193. 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',
  3194. function (config) {
  3195. config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
  3196. }
  3197. );
  3198. // Pick the first defined of two or three arguments.
  3199. function defaults(a, b, c) {
  3200. if (a != null) {
  3201. return a;
  3202. }
  3203. if (b != null) {
  3204. return b;
  3205. }
  3206. return c;
  3207. }
  3208. function currentDateArray(config) {
  3209. // hooks is actually the exported moment object
  3210. var nowValue = new Date(hooks.now());
  3211. if (config._useUTC) {
  3212. return [
  3213. nowValue.getUTCFullYear(),
  3214. nowValue.getUTCMonth(),
  3215. nowValue.getUTCDate(),
  3216. ];
  3217. }
  3218. return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
  3219. }
  3220. // convert an array to a date.
  3221. // the array should mirror the parameters below
  3222. // note: all values past the year are optional and will default to the lowest possible value.
  3223. // [year, month, day , hour, minute, second, millisecond]
  3224. function configFromArray(config) {
  3225. var i,
  3226. date,
  3227. input = [],
  3228. currentDate,
  3229. expectedWeekday,
  3230. yearToUse;
  3231. if (config._d) {
  3232. return;
  3233. }
  3234. currentDate = currentDateArray(config);
  3235. //compute day of the year from weeks and weekdays
  3236. if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
  3237. dayOfYearFromWeekInfo(config);
  3238. }
  3239. //if the day of the year is set, figure out what it is
  3240. if (config._dayOfYear != null) {
  3241. yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
  3242. if (
  3243. config._dayOfYear > daysInYear(yearToUse) ||
  3244. config._dayOfYear === 0
  3245. ) {
  3246. getParsingFlags(config)._overflowDayOfYear = true;
  3247. }
  3248. date = createUTCDate(yearToUse, 0, config._dayOfYear);
  3249. config._a[MONTH] = date.getUTCMonth();
  3250. config._a[DATE] = date.getUTCDate();
  3251. }
  3252. // Default to current date.
  3253. // * if no year, month, day of month are given, default to today
  3254. // * if day of month is given, default month and year
  3255. // * if month is given, default only year
  3256. // * if year is given, don't default anything
  3257. for (i = 0; i < 3 && config._a[i] == null; ++i) {
  3258. config._a[i] = input[i] = currentDate[i];
  3259. }
  3260. // Zero out whatever was not defaulted, including time
  3261. for (; i < 7; i++) {
  3262. config._a[i] = input[i] =
  3263. config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];
  3264. }
  3265. // Check for 24:00:00.000
  3266. if (
  3267. config._a[HOUR] === 24 &&
  3268. config._a[MINUTE] === 0 &&
  3269. config._a[SECOND] === 0 &&
  3270. config._a[MILLISECOND] === 0
  3271. ) {
  3272. config._nextDay = true;
  3273. config._a[HOUR] = 0;
  3274. }
  3275. config._d = (config._useUTC ? createUTCDate : createDate).apply(
  3276. null,
  3277. input
  3278. );
  3279. expectedWeekday = config._useUTC
  3280. ? config._d.getUTCDay()
  3281. : config._d.getDay();
  3282. // Apply timezone offset from input. The actual utcOffset can be changed
  3283. // with parseZone.
  3284. if (config._tzm != null) {
  3285. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  3286. }
  3287. if (config._nextDay) {
  3288. config._a[HOUR] = 24;
  3289. }
  3290. // check for mismatching day of week
  3291. if (
  3292. config._w &&
  3293. typeof config._w.d !== 'undefined' &&
  3294. config._w.d !== expectedWeekday
  3295. ) {
  3296. getParsingFlags(config).weekdayMismatch = true;
  3297. }
  3298. }
  3299. function dayOfYearFromWeekInfo(config) {
  3300. var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
  3301. w = config._w;
  3302. if (w.GG != null || w.W != null || w.E != null) {
  3303. dow = 1;
  3304. doy = 4;
  3305. // TODO: We need to take the current isoWeekYear, but that depends on
  3306. // how we interpret now (local, utc, fixed offset). So create
  3307. // a now version of current config (take local/utc/offset flags, and
  3308. // create now).
  3309. weekYear = defaults(
  3310. w.GG,
  3311. config._a[YEAR],
  3312. weekOfYear(createLocal(), 1, 4).year
  3313. );
  3314. week = defaults(w.W, 1);
  3315. weekday = defaults(w.E, 1);
  3316. if (weekday < 1 || weekday > 7) {
  3317. weekdayOverflow = true;
  3318. }
  3319. } else {
  3320. dow = config._locale._week.dow;
  3321. doy = config._locale._week.doy;
  3322. curWeek = weekOfYear(createLocal(), dow, doy);
  3323. weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
  3324. // Default to current week.
  3325. week = defaults(w.w, curWeek.week);
  3326. if (w.d != null) {
  3327. // weekday -- low day numbers are considered next week
  3328. weekday = w.d;
  3329. if (weekday < 0 || weekday > 6) {
  3330. weekdayOverflow = true;
  3331. }
  3332. } else if (w.e != null) {
  3333. // local weekday -- counting starts from beginning of week
  3334. weekday = w.e + dow;
  3335. if (w.e < 0 || w.e > 6) {
  3336. weekdayOverflow = true;
  3337. }
  3338. } else {
  3339. // default to beginning of week
  3340. weekday = dow;
  3341. }
  3342. }
  3343. if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
  3344. getParsingFlags(config)._overflowWeeks = true;
  3345. } else if (weekdayOverflow != null) {
  3346. getParsingFlags(config)._overflowWeekday = true;
  3347. } else {
  3348. temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
  3349. config._a[YEAR] = temp.year;
  3350. config._dayOfYear = temp.dayOfYear;
  3351. }
  3352. }
  3353. // constant that refers to the ISO standard
  3354. hooks.ISO_8601 = function () {};
  3355. // constant that refers to the RFC 2822 form
  3356. hooks.RFC_2822 = function () {};
  3357. // date from string and format string
  3358. function configFromStringAndFormat(config) {
  3359. // TODO: Move this to another part of the creation flow to prevent circular deps
  3360. if (config._f === hooks.ISO_8601) {
  3361. configFromISO(config);
  3362. return;
  3363. }
  3364. if (config._f === hooks.RFC_2822) {
  3365. configFromRFC2822(config);
  3366. return;
  3367. }
  3368. config._a = [];
  3369. getParsingFlags(config).empty = true;
  3370. // This array is used to make a Date, either with `new Date` or `Date.UTC`
  3371. var string = '' + config._i,
  3372. i,
  3373. parsedInput,
  3374. tokens,
  3375. token,
  3376. skipped,
  3377. stringLength = string.length,
  3378. totalParsedInputLength = 0,
  3379. era,
  3380. tokenLen;
  3381. tokens =
  3382. expandFormat(config._f, config._locale).match(formattingTokens) || [];
  3383. tokenLen = tokens.length;
  3384. for (i = 0; i < tokenLen; i++) {
  3385. token = tokens[i];
  3386. parsedInput = (string.match(getParseRegexForToken(token, config)) ||
  3387. [])[0];
  3388. if (parsedInput) {
  3389. skipped = string.substr(0, string.indexOf(parsedInput));
  3390. if (skipped.length > 0) {
  3391. getParsingFlags(config).unusedInput.push(skipped);
  3392. }
  3393. string = string.slice(
  3394. string.indexOf(parsedInput) + parsedInput.length
  3395. );
  3396. totalParsedInputLength += parsedInput.length;
  3397. }
  3398. // don't parse if it's not a known token
  3399. if (formatTokenFunctions[token]) {
  3400. if (parsedInput) {
  3401. getParsingFlags(config).empty = false;
  3402. } else {
  3403. getParsingFlags(config).unusedTokens.push(token);
  3404. }
  3405. addTimeToArrayFromToken(token, parsedInput, config);
  3406. } else if (config._strict && !parsedInput) {
  3407. getParsingFlags(config).unusedTokens.push(token);
  3408. }
  3409. }
  3410. // add remaining unparsed input length to the string
  3411. getParsingFlags(config).charsLeftOver =
  3412. stringLength - totalParsedInputLength;
  3413. if (string.length > 0) {
  3414. getParsingFlags(config).unusedInput.push(string);
  3415. }
  3416. // clear _12h flag if hour is <= 12
  3417. if (
  3418. config._a[HOUR] <= 12 &&
  3419. getParsingFlags(config).bigHour === true &&
  3420. config._a[HOUR] > 0
  3421. ) {
  3422. getParsingFlags(config).bigHour = undefined;
  3423. }
  3424. getParsingFlags(config).parsedDateParts = config._a.slice(0);
  3425. getParsingFlags(config).meridiem = config._meridiem;
  3426. // handle meridiem
  3427. config._a[HOUR] = meridiemFixWrap(
  3428. config._locale,
  3429. config._a[HOUR],
  3430. config._meridiem
  3431. );
  3432. // handle era
  3433. era = getParsingFlags(config).era;
  3434. if (era !== null) {
  3435. config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);
  3436. }
  3437. configFromArray(config);
  3438. checkOverflow(config);
  3439. }
  3440. function meridiemFixWrap(locale, hour, meridiem) {
  3441. var isPm;
  3442. if (meridiem == null) {
  3443. // nothing to do
  3444. return hour;
  3445. }
  3446. if (locale.meridiemHour != null) {
  3447. return locale.meridiemHour(hour, meridiem);
  3448. } else if (locale.isPM != null) {
  3449. // Fallback
  3450. isPm = locale.isPM(meridiem);
  3451. if (isPm && hour < 12) {
  3452. hour += 12;
  3453. }
  3454. if (!isPm && hour === 12) {
  3455. hour = 0;
  3456. }
  3457. return hour;
  3458. } else {
  3459. // this is not supposed to happen
  3460. return hour;
  3461. }
  3462. }
  3463. // date from string and array of format strings
  3464. function configFromStringAndArray(config) {
  3465. var tempConfig,
  3466. bestMoment,
  3467. scoreToBeat,
  3468. i,
  3469. currentScore,
  3470. validFormatFound,
  3471. bestFormatIsValid = false,
  3472. configfLen = config._f.length;
  3473. if (configfLen === 0) {
  3474. getParsingFlags(config).invalidFormat = true;
  3475. config._d = new Date(NaN);
  3476. return;
  3477. }
  3478. for (i = 0; i < configfLen; i++) {
  3479. currentScore = 0;
  3480. validFormatFound = false;
  3481. tempConfig = copyConfig({}, config);
  3482. if (config._useUTC != null) {
  3483. tempConfig._useUTC = config._useUTC;
  3484. }
  3485. tempConfig._f = config._f[i];
  3486. configFromStringAndFormat(tempConfig);
  3487. if (isValid(tempConfig)) {
  3488. validFormatFound = true;
  3489. }
  3490. // if there is any input that was not parsed add a penalty for that format
  3491. currentScore += getParsingFlags(tempConfig).charsLeftOver;
  3492. //or tokens
  3493. currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
  3494. getParsingFlags(tempConfig).score = currentScore;
  3495. if (!bestFormatIsValid) {
  3496. if (
  3497. scoreToBeat == null ||
  3498. currentScore < scoreToBeat ||
  3499. validFormatFound
  3500. ) {
  3501. scoreToBeat = currentScore;
  3502. bestMoment = tempConfig;
  3503. if (validFormatFound) {
  3504. bestFormatIsValid = true;
  3505. }
  3506. }
  3507. } else {
  3508. if (currentScore < scoreToBeat) {
  3509. scoreToBeat = currentScore;
  3510. bestMoment = tempConfig;
  3511. }
  3512. }
  3513. }
  3514. extend(config, bestMoment || tempConfig);
  3515. }
  3516. function configFromObject(config) {
  3517. if (config._d) {
  3518. return;
  3519. }
  3520. var i = normalizeObjectUnits(config._i),
  3521. dayOrDate = i.day === undefined ? i.date : i.day;
  3522. config._a = map(
  3523. [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],
  3524. function (obj) {
  3525. return obj && parseInt(obj, 10);
  3526. }
  3527. );
  3528. configFromArray(config);
  3529. }
  3530. function createFromConfig(config) {
  3531. var res = new Moment(checkOverflow(prepareConfig(config)));
  3532. if (res._nextDay) {
  3533. // Adding is smart enough around DST
  3534. res.add(1, 'd');
  3535. res._nextDay = undefined;
  3536. }
  3537. return res;
  3538. }
  3539. function prepareConfig(config) {
  3540. var input = config._i,
  3541. format = config._f;
  3542. config._locale = config._locale || getLocale(config._l);
  3543. if (input === null || (format === undefined && input === '')) {
  3544. return createInvalid({ nullInput: true });
  3545. }
  3546. if (typeof input === 'string') {
  3547. config._i = input = config._locale.preparse(input);
  3548. }
  3549. if (isMoment(input)) {
  3550. return new Moment(checkOverflow(input));
  3551. } else if (isDate(input)) {
  3552. config._d = input;
  3553. } else if (isArray(format)) {
  3554. configFromStringAndArray(config);
  3555. } else if (format) {
  3556. configFromStringAndFormat(config);
  3557. } else {
  3558. configFromInput(config);
  3559. }
  3560. if (!isValid(config)) {
  3561. config._d = null;
  3562. }
  3563. return config;
  3564. }
  3565. function configFromInput(config) {
  3566. var input = config._i;
  3567. if (isUndefined(input)) {
  3568. config._d = new Date(hooks.now());
  3569. } else if (isDate(input)) {
  3570. config._d = new Date(input.valueOf());
  3571. } else if (typeof input === 'string') {
  3572. configFromString(config);
  3573. } else if (isArray(input)) {
  3574. config._a = map(input.slice(0), function (obj) {
  3575. return parseInt(obj, 10);
  3576. });
  3577. configFromArray(config);
  3578. } else if (isObject(input)) {
  3579. configFromObject(config);
  3580. } else if (isNumber(input)) {
  3581. // from milliseconds
  3582. config._d = new Date(input);
  3583. } else {
  3584. hooks.createFromInputFallback(config);
  3585. }
  3586. }
  3587. function createLocalOrUTC(input, format, locale, strict, isUTC) {
  3588. var c = {};
  3589. if (format === true || format === false) {
  3590. strict = format;
  3591. format = undefined;
  3592. }
  3593. if (locale === true || locale === false) {
  3594. strict = locale;
  3595. locale = undefined;
  3596. }
  3597. if (
  3598. (isObject(input) && isObjectEmpty(input)) ||
  3599. (isArray(input) && input.length === 0)
  3600. ) {
  3601. input = undefined;
  3602. }
  3603. // object construction must be done this way.
  3604. // https://github.com/moment/moment/issues/1423
  3605. c._isAMomentObject = true;
  3606. c._useUTC = c._isUTC = isUTC;
  3607. c._l = locale;
  3608. c._i = input;
  3609. c._f = format;
  3610. c._strict = strict;
  3611. return createFromConfig(c);
  3612. }
  3613. function createLocal(input, format, locale, strict) {
  3614. return createLocalOrUTC(input, format, locale, strict, false);
  3615. }
  3616. var prototypeMin = deprecate(
  3617. 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
  3618. function () {
  3619. var other = createLocal.apply(null, arguments);
  3620. if (this.isValid() && other.isValid()) {
  3621. return other < this ? this : other;
  3622. } else {
  3623. return createInvalid();
  3624. }
  3625. }
  3626. ),
  3627. prototypeMax = deprecate(
  3628. 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
  3629. function () {
  3630. var other = createLocal.apply(null, arguments);
  3631. if (this.isValid() && other.isValid()) {
  3632. return other > this ? this : other;
  3633. } else {
  3634. return createInvalid();
  3635. }
  3636. }
  3637. );
  3638. // Pick a moment m from moments so that m[fn](other) is true for all
  3639. // other. This relies on the function fn to be transitive.
  3640. //
  3641. // moments should either be an array of moment objects or an array, whose
  3642. // first element is an array of moment objects.
  3643. function pickBy(fn, moments) {
  3644. var res, i;
  3645. if (moments.length === 1 && isArray(moments[0])) {
  3646. moments = moments[0];
  3647. }
  3648. if (!moments.length) {
  3649. return createLocal();
  3650. }
  3651. res = moments[0];
  3652. for (i = 1; i < moments.length; ++i) {
  3653. if (!moments[i].isValid() || moments[i][fn](res)) {
  3654. res = moments[i];
  3655. }
  3656. }
  3657. return res;
  3658. }
  3659. // TODO: Use [].sort instead?
  3660. function min() {
  3661. var args = [].slice.call(arguments, 0);
  3662. return pickBy('isBefore', args);
  3663. }
  3664. function max() {
  3665. var args = [].slice.call(arguments, 0);
  3666. return pickBy('isAfter', args);
  3667. }
  3668. var now = function () {
  3669. return Date.now ? Date.now() : +new Date();
  3670. };
  3671. var ordering = [
  3672. 'year',
  3673. 'quarter',
  3674. 'month',
  3675. 'week',
  3676. 'day',
  3677. 'hour',
  3678. 'minute',
  3679. 'second',
  3680. 'millisecond',
  3681. ];
  3682. function isDurationValid(m) {
  3683. var key,
  3684. unitHasDecimal = false,
  3685. i,
  3686. orderLen = ordering.length;
  3687. for (key in m) {
  3688. if (
  3689. hasOwnProp(m, key) &&
  3690. !(
  3691. indexOf.call(ordering, key) !== -1 &&
  3692. (m[key] == null || !isNaN(m[key]))
  3693. )
  3694. ) {
  3695. return false;
  3696. }
  3697. }
  3698. for (i = 0; i < orderLen; ++i) {
  3699. if (m[ordering[i]]) {
  3700. if (unitHasDecimal) {
  3701. return false; // only allow non-integers for smallest unit
  3702. }
  3703. if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
  3704. unitHasDecimal = true;
  3705. }
  3706. }
  3707. }
  3708. return true;
  3709. }
  3710. function isValid$1() {
  3711. return this._isValid;
  3712. }
  3713. function createInvalid$1() {
  3714. return createDuration(NaN);
  3715. }
  3716. function Duration(duration) {
  3717. var normalizedInput = normalizeObjectUnits(duration),
  3718. years = normalizedInput.year || 0,
  3719. quarters = normalizedInput.quarter || 0,
  3720. months = normalizedInput.month || 0,
  3721. weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
  3722. days = normalizedInput.day || 0,
  3723. hours = normalizedInput.hour || 0,
  3724. minutes = normalizedInput.minute || 0,
  3725. seconds = normalizedInput.second || 0,
  3726. milliseconds = normalizedInput.millisecond || 0;
  3727. this._isValid = isDurationValid(normalizedInput);
  3728. // representation for dateAddRemove
  3729. this._milliseconds =
  3730. +milliseconds +
  3731. seconds * 1e3 + // 1000
  3732. minutes * 6e4 + // 1000 * 60
  3733. hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
  3734. // Because of dateAddRemove treats 24 hours as different from a
  3735. // day when working around DST, we need to store them separately
  3736. this._days = +days + weeks * 7;
  3737. // It is impossible to translate months into days without knowing
  3738. // which months you are are talking about, so we have to store
  3739. // it separately.
  3740. this._months = +months + quarters * 3 + years * 12;
  3741. this._data = {};
  3742. this._locale = getLocale();
  3743. this._bubble();
  3744. }
  3745. function isDuration(obj) {
  3746. return obj instanceof Duration;
  3747. }
  3748. function absRound(number) {
  3749. if (number < 0) {
  3750. return Math.round(-1 * number) * -1;
  3751. } else {
  3752. return Math.round(number);
  3753. }
  3754. }
  3755. // compare two arrays, return the number of differences
  3756. function compareArrays(array1, array2, dontConvert) {
  3757. var len = Math.min(array1.length, array2.length),
  3758. lengthDiff = Math.abs(array1.length - array2.length),
  3759. diffs = 0,
  3760. i;
  3761. for (i = 0; i < len; i++) {
  3762. if (
  3763. (dontConvert && array1[i] !== array2[i]) ||
  3764. (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))
  3765. ) {
  3766. diffs++;
  3767. }
  3768. }
  3769. return diffs + lengthDiff;
  3770. }
  3771. // FORMATTING
  3772. function offset(token, separator) {
  3773. addFormatToken(token, 0, 0, function () {
  3774. var offset = this.utcOffset(),
  3775. sign = '+';
  3776. if (offset < 0) {
  3777. offset = -offset;
  3778. sign = '-';
  3779. }
  3780. return (
  3781. sign +
  3782. zeroFill(~~(offset / 60), 2) +
  3783. separator +
  3784. zeroFill(~~offset % 60, 2)
  3785. );
  3786. });
  3787. }
  3788. offset('Z', ':');
  3789. offset('ZZ', '');
  3790. // PARSING
  3791. addRegexToken('Z', matchShortOffset);
  3792. addRegexToken('ZZ', matchShortOffset);
  3793. addParseToken(['Z', 'ZZ'], function (input, array, config) {
  3794. config._useUTC = true;
  3795. config._tzm = offsetFromString(matchShortOffset, input);
  3796. });
  3797. // HELPERS
  3798. // timezone chunker
  3799. // '+10:00' > ['10', '00']
  3800. // '-1530' > ['-15', '30']
  3801. var chunkOffset = /([\+\-]|\d\d)/gi;
  3802. function offsetFromString(matcher, string) {
  3803. var matches = (string || '').match(matcher),
  3804. chunk,
  3805. parts,
  3806. minutes;
  3807. if (matches === null) {
  3808. return null;
  3809. }
  3810. chunk = matches[matches.length - 1] || [];
  3811. parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
  3812. minutes = +(parts[1] * 60) + toInt(parts[2]);
  3813. return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
  3814. }
  3815. // Return a moment from input, that is local/utc/zone equivalent to model.
  3816. function cloneWithOffset(input, model) {
  3817. var res, diff;
  3818. if (model._isUTC) {
  3819. res = model.clone();
  3820. diff =
  3821. (isMoment(input) || isDate(input)
  3822. ? input.valueOf()
  3823. : createLocal(input).valueOf()) - res.valueOf();
  3824. // Use low-level api, because this fn is low-level api.
  3825. res._d.setTime(res._d.valueOf() + diff);
  3826. hooks.updateOffset(res, false);
  3827. return res;
  3828. } else {
  3829. return createLocal(input).local();
  3830. }
  3831. }
  3832. function getDateOffset(m) {
  3833. // On Firefox.24 Date#getTimezoneOffset returns a floating point.
  3834. // https://github.com/moment/moment/pull/1871
  3835. return -Math.round(m._d.getTimezoneOffset());
  3836. }
  3837. // HOOKS
  3838. // This function will be called whenever a moment is mutated.
  3839. // It is intended to keep the offset in sync with the timezone.
  3840. hooks.updateOffset = function () {};
  3841. // MOMENTS
  3842. // keepLocalTime = true means only change the timezone, without
  3843. // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
  3844. // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
  3845. // +0200, so we adjust the time as needed, to be valid.
  3846. //
  3847. // Keeping the time actually adds/subtracts (one hour)
  3848. // from the actual represented time. That is why we call updateOffset
  3849. // a second time. In case it wants us to change the offset again
  3850. // _changeInProgress == true case, then we have to adjust, because
  3851. // there is no such time in the given timezone.
  3852. function getSetOffset(input, keepLocalTime, keepMinutes) {
  3853. var offset = this._offset || 0,
  3854. localAdjust;
  3855. if (!this.isValid()) {
  3856. return input != null ? this : NaN;
  3857. }
  3858. if (input != null) {
  3859. if (typeof input === 'string') {
  3860. input = offsetFromString(matchShortOffset, input);
  3861. if (input === null) {
  3862. return this;
  3863. }
  3864. } else if (Math.abs(input) < 16 && !keepMinutes) {
  3865. input = input * 60;
  3866. }
  3867. if (!this._isUTC && keepLocalTime) {
  3868. localAdjust = getDateOffset(this);
  3869. }
  3870. this._offset = input;
  3871. this._isUTC = true;
  3872. if (localAdjust != null) {
  3873. this.add(localAdjust, 'm');
  3874. }
  3875. if (offset !== input) {
  3876. if (!keepLocalTime || this._changeInProgress) {
  3877. addSubtract(
  3878. this,
  3879. createDuration(input - offset, 'm'),
  3880. 1,
  3881. false
  3882. );
  3883. } else if (!this._changeInProgress) {
  3884. this._changeInProgress = true;
  3885. hooks.updateOffset(this, true);
  3886. this._changeInProgress = null;
  3887. }
  3888. }
  3889. return this;
  3890. } else {
  3891. return this._isUTC ? offset : getDateOffset(this);
  3892. }
  3893. }
  3894. function getSetZone(input, keepLocalTime) {
  3895. if (input != null) {
  3896. if (typeof input !== 'string') {
  3897. input = -input;
  3898. }
  3899. this.utcOffset(input, keepLocalTime);
  3900. return this;
  3901. } else {
  3902. return -this.utcOffset();
  3903. }
  3904. }
  3905. function setOffsetToUTC(keepLocalTime) {
  3906. return this.utcOffset(0, keepLocalTime);
  3907. }
  3908. function setOffsetToLocal(keepLocalTime) {
  3909. if (this._isUTC) {
  3910. this.utcOffset(0, keepLocalTime);
  3911. this._isUTC = false;
  3912. if (keepLocalTime) {
  3913. this.subtract(getDateOffset(this), 'm');
  3914. }
  3915. }
  3916. return this;
  3917. }
  3918. function setOffsetToParsedOffset() {
  3919. if (this._tzm != null) {
  3920. this.utcOffset(this._tzm, false, true);
  3921. } else if (typeof this._i === 'string') {
  3922. var tZone = offsetFromString(matchOffset, this._i);
  3923. if (tZone != null) {
  3924. this.utcOffset(tZone);
  3925. } else {
  3926. this.utcOffset(0, true);
  3927. }
  3928. }
  3929. return this;
  3930. }
  3931. function hasAlignedHourOffset(input) {
  3932. if (!this.isValid()) {
  3933. return false;
  3934. }
  3935. input = input ? createLocal(input).utcOffset() : 0;
  3936. return (this.utcOffset() - input) % 60 === 0;
  3937. }
  3938. function isDaylightSavingTime() {
  3939. return (
  3940. this.utcOffset() > this.clone().month(0).utcOffset() ||
  3941. this.utcOffset() > this.clone().month(5).utcOffset()
  3942. );
  3943. }
  3944. function isDaylightSavingTimeShifted() {
  3945. if (!isUndefined(this._isDSTShifted)) {
  3946. return this._isDSTShifted;
  3947. }
  3948. var c = {},
  3949. other;
  3950. copyConfig(c, this);
  3951. c = prepareConfig(c);
  3952. if (c._a) {
  3953. other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
  3954. this._isDSTShifted =
  3955. this.isValid() && compareArrays(c._a, other.toArray()) > 0;
  3956. } else {
  3957. this._isDSTShifted = false;
  3958. }
  3959. return this._isDSTShifted;
  3960. }
  3961. function isLocal() {
  3962. return this.isValid() ? !this._isUTC : false;
  3963. }
  3964. function isUtcOffset() {
  3965. return this.isValid() ? this._isUTC : false;
  3966. }
  3967. function isUtc() {
  3968. return this.isValid() ? this._isUTC && this._offset === 0 : false;
  3969. }
  3970. // ASP.NET json date format regex
  3971. var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,
  3972. // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
  3973. // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
  3974. // and further modified to allow for strings containing both week and day
  3975. isoRegex =
  3976. /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
  3977. function createDuration(input, key) {
  3978. var duration = input,
  3979. // matching against regexp is expensive, do it on demand
  3980. match = null,
  3981. sign,
  3982. ret,
  3983. diffRes;
  3984. if (isDuration(input)) {
  3985. duration = {
  3986. ms: input._milliseconds,
  3987. d: input._days,
  3988. M: input._months,
  3989. };
  3990. } else if (isNumber(input) || !isNaN(+input)) {
  3991. duration = {};
  3992. if (key) {
  3993. duration[key] = +input;
  3994. } else {
  3995. duration.milliseconds = +input;
  3996. }
  3997. } else if ((match = aspNetRegex.exec(input))) {
  3998. sign = match[1] === '-' ? -1 : 1;
  3999. duration = {
  4000. y: 0,
  4001. d: toInt(match[DATE]) * sign,
  4002. h: toInt(match[HOUR]) * sign,
  4003. m: toInt(match[MINUTE]) * sign,
  4004. s: toInt(match[SECOND]) * sign,
  4005. ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match
  4006. };
  4007. } else if ((match = isoRegex.exec(input))) {
  4008. sign = match[1] === '-' ? -1 : 1;
  4009. duration = {
  4010. y: parseIso(match[2], sign),
  4011. M: parseIso(match[3], sign),
  4012. w: parseIso(match[4], sign),
  4013. d: parseIso(match[5], sign),
  4014. h: parseIso(match[6], sign),
  4015. m: parseIso(match[7], sign),
  4016. s: parseIso(match[8], sign),
  4017. };
  4018. } else if (duration == null) {
  4019. // checks for null or undefined
  4020. duration = {};
  4021. } else if (
  4022. typeof duration === 'object' &&
  4023. ('from' in duration || 'to' in duration)
  4024. ) {
  4025. diffRes = momentsDifference(
  4026. createLocal(duration.from),
  4027. createLocal(duration.to)
  4028. );
  4029. duration = {};
  4030. duration.ms = diffRes.milliseconds;
  4031. duration.M = diffRes.months;
  4032. }
  4033. ret = new Duration(duration);
  4034. if (isDuration(input) && hasOwnProp(input, '_locale')) {
  4035. ret._locale = input._locale;
  4036. }
  4037. if (isDuration(input) && hasOwnProp(input, '_isValid')) {
  4038. ret._isValid = input._isValid;
  4039. }
  4040. return ret;
  4041. }
  4042. createDuration.fn = Duration.prototype;
  4043. createDuration.invalid = createInvalid$1;
  4044. function parseIso(inp, sign) {
  4045. // We'd normally use ~~inp for this, but unfortunately it also
  4046. // converts floats to ints.
  4047. // inp may be undefined, so careful calling replace on it.
  4048. var res = inp && parseFloat(inp.replace(',', '.'));
  4049. // apply sign while we're at it
  4050. return (isNaN(res) ? 0 : res) * sign;
  4051. }
  4052. function positiveMomentsDifference(base, other) {
  4053. var res = {};
  4054. res.months =
  4055. other.month() - base.month() + (other.year() - base.year()) * 12;
  4056. if (base.clone().add(res.months, 'M').isAfter(other)) {
  4057. --res.months;
  4058. }
  4059. res.milliseconds = +other - +base.clone().add(res.months, 'M');
  4060. return res;
  4061. }
  4062. function momentsDifference(base, other) {
  4063. var res;
  4064. if (!(base.isValid() && other.isValid())) {
  4065. return { milliseconds: 0, months: 0 };
  4066. }
  4067. other = cloneWithOffset(other, base);
  4068. if (base.isBefore(other)) {
  4069. res = positiveMomentsDifference(base, other);
  4070. } else {
  4071. res = positiveMomentsDifference(other, base);
  4072. res.milliseconds = -res.milliseconds;
  4073. res.months = -res.months;
  4074. }
  4075. return res;
  4076. }
  4077. // TODO: remove 'name' arg after deprecation is removed
  4078. function createAdder(direction, name) {
  4079. return function (val, period) {
  4080. var dur, tmp;
  4081. //invert the arguments, but complain about it
  4082. if (period !== null && !isNaN(+period)) {
  4083. deprecateSimple(
  4084. name,
  4085. 'moment().' +
  4086. name +
  4087. '(period, number) is deprecated. Please use moment().' +
  4088. name +
  4089. '(number, period). ' +
  4090. 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'
  4091. );
  4092. tmp = val;
  4093. val = period;
  4094. period = tmp;
  4095. }
  4096. dur = createDuration(val, period);
  4097. addSubtract(this, dur, direction);
  4098. return this;
  4099. };
  4100. }
  4101. function addSubtract(mom, duration, isAdding, updateOffset) {
  4102. var milliseconds = duration._milliseconds,
  4103. days = absRound(duration._days),
  4104. months = absRound(duration._months);
  4105. if (!mom.isValid()) {
  4106. // No op
  4107. return;
  4108. }
  4109. updateOffset = updateOffset == null ? true : updateOffset;
  4110. if (months) {
  4111. setMonth(mom, get(mom, 'Month') + months * isAdding);
  4112. }
  4113. if (days) {
  4114. set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
  4115. }
  4116. if (milliseconds) {
  4117. mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
  4118. }
  4119. if (updateOffset) {
  4120. hooks.updateOffset(mom, days || months);
  4121. }
  4122. }
  4123. var add = createAdder(1, 'add'),
  4124. subtract = createAdder(-1, 'subtract');
  4125. function isString(input) {
  4126. return typeof input === 'string' || input instanceof String;
  4127. }
  4128. // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined
  4129. function isMomentInput(input) {
  4130. return (
  4131. isMoment(input) ||
  4132. isDate(input) ||
  4133. isString(input) ||
  4134. isNumber(input) ||
  4135. isNumberOrStringArray(input) ||
  4136. isMomentInputObject(input) ||
  4137. input === null ||
  4138. input === undefined
  4139. );
  4140. }
  4141. function isMomentInputObject(input) {
  4142. var objectTest = isObject(input) && !isObjectEmpty(input),
  4143. propertyTest = false,
  4144. properties = [
  4145. 'years',
  4146. 'year',
  4147. 'y',
  4148. 'months',
  4149. 'month',
  4150. 'M',
  4151. 'days',
  4152. 'day',
  4153. 'd',
  4154. 'dates',
  4155. 'date',
  4156. 'D',
  4157. 'hours',
  4158. 'hour',
  4159. 'h',
  4160. 'minutes',
  4161. 'minute',
  4162. 'm',
  4163. 'seconds',
  4164. 'second',
  4165. 's',
  4166. 'milliseconds',
  4167. 'millisecond',
  4168. 'ms',
  4169. ],
  4170. i,
  4171. property,
  4172. propertyLen = properties.length;
  4173. for (i = 0; i < propertyLen; i += 1) {
  4174. property = properties[i];
  4175. propertyTest = propertyTest || hasOwnProp(input, property);
  4176. }
  4177. return objectTest && propertyTest;
  4178. }
  4179. function isNumberOrStringArray(input) {
  4180. var arrayTest = isArray(input),
  4181. dataTypeTest = false;
  4182. if (arrayTest) {
  4183. dataTypeTest =
  4184. input.filter(function (item) {
  4185. return !isNumber(item) && isString(input);
  4186. }).length === 0;
  4187. }
  4188. return arrayTest && dataTypeTest;
  4189. }
  4190. function isCalendarSpec(input) {
  4191. var objectTest = isObject(input) && !isObjectEmpty(input),
  4192. propertyTest = false,
  4193. properties = [
  4194. 'sameDay',
  4195. 'nextDay',
  4196. 'lastDay',
  4197. 'nextWeek',
  4198. 'lastWeek',
  4199. 'sameElse',
  4200. ],
  4201. i,
  4202. property;
  4203. for (i = 0; i < properties.length; i += 1) {
  4204. property = properties[i];
  4205. propertyTest = propertyTest || hasOwnProp(input, property);
  4206. }
  4207. return objectTest && propertyTest;
  4208. }
  4209. function getCalendarFormat(myMoment, now) {
  4210. var diff = myMoment.diff(now, 'days', true);
  4211. return diff < -6
  4212. ? 'sameElse'
  4213. : diff < -1
  4214. ? 'lastWeek'
  4215. : diff < 0
  4216. ? 'lastDay'
  4217. : diff < 1
  4218. ? 'sameDay'
  4219. : diff < 2
  4220. ? 'nextDay'
  4221. : diff < 7
  4222. ? 'nextWeek'
  4223. : 'sameElse';
  4224. }
  4225. function calendar$1(time, formats) {
  4226. // Support for single parameter, formats only overload to the calendar function
  4227. if (arguments.length === 1) {
  4228. if (!arguments[0]) {
  4229. time = undefined;
  4230. formats = undefined;
  4231. } else if (isMomentInput(arguments[0])) {
  4232. time = arguments[0];
  4233. formats = undefined;
  4234. } else if (isCalendarSpec(arguments[0])) {
  4235. formats = arguments[0];
  4236. time = undefined;
  4237. }
  4238. }
  4239. // We want to compare the start of today, vs this.
  4240. // Getting start-of-today depends on whether we're local/utc/offset or not.
  4241. var now = time || createLocal(),
  4242. sod = cloneWithOffset(now, this).startOf('day'),
  4243. format = hooks.calendarFormat(this, sod) || 'sameElse',
  4244. output =
  4245. formats &&
  4246. (isFunction(formats[format])
  4247. ? formats[format].call(this, now)
  4248. : formats[format]);
  4249. return this.format(
  4250. output || this.localeData().calendar(format, this, createLocal(now))
  4251. );
  4252. }
  4253. function clone() {
  4254. return new Moment(this);
  4255. }
  4256. function isAfter(input, units) {
  4257. var localInput = isMoment(input) ? input : createLocal(input);
  4258. if (!(this.isValid() && localInput.isValid())) {
  4259. return false;
  4260. }
  4261. units = normalizeUnits(units) || 'millisecond';
  4262. if (units === 'millisecond') {
  4263. return this.valueOf() > localInput.valueOf();
  4264. } else {
  4265. return localInput.valueOf() < this.clone().startOf(units).valueOf();
  4266. }
  4267. }
  4268. function isBefore(input, units) {
  4269. var localInput = isMoment(input) ? input : createLocal(input);
  4270. if (!(this.isValid() && localInput.isValid())) {
  4271. return false;
  4272. }
  4273. units = normalizeUnits(units) || 'millisecond';
  4274. if (units === 'millisecond') {
  4275. return this.valueOf() < localInput.valueOf();
  4276. } else {
  4277. return this.clone().endOf(units).valueOf() < localInput.valueOf();
  4278. }
  4279. }
  4280. function isBetween(from, to, units, inclusivity) {
  4281. var localFrom = isMoment(from) ? from : createLocal(from),
  4282. localTo = isMoment(to) ? to : createLocal(to);
  4283. if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
  4284. return false;
  4285. }
  4286. inclusivity = inclusivity || '()';
  4287. return (
  4288. (inclusivity[0] === '('
  4289. ? this.isAfter(localFrom, units)
  4290. : !this.isBefore(localFrom, units)) &&
  4291. (inclusivity[1] === ')'
  4292. ? this.isBefore(localTo, units)
  4293. : !this.isAfter(localTo, units))
  4294. );
  4295. }
  4296. function isSame(input, units) {
  4297. var localInput = isMoment(input) ? input : createLocal(input),
  4298. inputMs;
  4299. if (!(this.isValid() && localInput.isValid())) {
  4300. return false;
  4301. }
  4302. units = normalizeUnits(units) || 'millisecond';
  4303. if (units === 'millisecond') {
  4304. return this.valueOf() === localInput.valueOf();
  4305. } else {
  4306. inputMs = localInput.valueOf();
  4307. return (
  4308. this.clone().startOf(units).valueOf() <= inputMs &&
  4309. inputMs <= this.clone().endOf(units).valueOf()
  4310. );
  4311. }
  4312. }
  4313. function isSameOrAfter(input, units) {
  4314. return this.isSame(input, units) || this.isAfter(input, units);
  4315. }
  4316. function isSameOrBefore(input, units) {
  4317. return this.isSame(input, units) || this.isBefore(input, units);
  4318. }
  4319. function diff(input, units, asFloat) {
  4320. var that, zoneDelta, output;
  4321. if (!this.isValid()) {
  4322. return NaN;
  4323. }
  4324. that = cloneWithOffset(input, this);
  4325. if (!that.isValid()) {
  4326. return NaN;
  4327. }
  4328. zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  4329. units = normalizeUnits(units);
  4330. switch (units) {
  4331. case 'year':
  4332. output = monthDiff(this, that) / 12;
  4333. break;
  4334. case 'month':
  4335. output = monthDiff(this, that);
  4336. break;
  4337. case 'quarter':
  4338. output = monthDiff(this, that) / 3;
  4339. break;
  4340. case 'second':
  4341. output = (this - that) / 1e3;
  4342. break; // 1000
  4343. case 'minute':
  4344. output = (this - that) / 6e4;
  4345. break; // 1000 * 60
  4346. case 'hour':
  4347. output = (this - that) / 36e5;
  4348. break; // 1000 * 60 * 60
  4349. case 'day':
  4350. output = (this - that - zoneDelta) / 864e5;
  4351. break; // 1000 * 60 * 60 * 24, negate dst
  4352. case 'week':
  4353. output = (this - that - zoneDelta) / 6048e5;
  4354. break; // 1000 * 60 * 60 * 24 * 7, negate dst
  4355. default:
  4356. output = this - that;
  4357. }
  4358. return asFloat ? output : absFloor(output);
  4359. }
  4360. function monthDiff(a, b) {
  4361. if (a.date() < b.date()) {
  4362. // end-of-month calculations work correct when the start month has more
  4363. // days than the end month.
  4364. return -monthDiff(b, a);
  4365. }
  4366. // difference in months
  4367. var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
  4368. // b is in (anchor - 1 month, anchor + 1 month)
  4369. anchor = a.clone().add(wholeMonthDiff, 'months'),
  4370. anchor2,
  4371. adjust;
  4372. if (b - anchor < 0) {
  4373. anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
  4374. // linear across the month
  4375. adjust = (b - anchor) / (anchor - anchor2);
  4376. } else {
  4377. anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
  4378. // linear across the month
  4379. adjust = (b - anchor) / (anchor2 - anchor);
  4380. }
  4381. //check for negative zero, return zero if negative zero
  4382. return -(wholeMonthDiff + adjust) || 0;
  4383. }
  4384. hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
  4385. hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
  4386. function toString() {
  4387. return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
  4388. }
  4389. function toISOString(keepOffset) {
  4390. if (!this.isValid()) {
  4391. return null;
  4392. }
  4393. var utc = keepOffset !== true,
  4394. m = utc ? this.clone().utc() : this;
  4395. if (m.year() < 0 || m.year() > 9999) {
  4396. return formatMoment(
  4397. m,
  4398. utc
  4399. ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'
  4400. : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'
  4401. );
  4402. }
  4403. if (isFunction(Date.prototype.toISOString)) {
  4404. // native implementation is ~50x faster, use it when we can
  4405. if (utc) {
  4406. return this.toDate().toISOString();
  4407. } else {
  4408. return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)
  4409. .toISOString()
  4410. .replace('Z', formatMoment(m, 'Z'));
  4411. }
  4412. }
  4413. return formatMoment(
  4414. m,
  4415. utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'
  4416. );
  4417. }
  4418. /**
  4419. * Return a human readable representation of a moment that can
  4420. * also be evaluated to get a new moment which is the same
  4421. *
  4422. * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
  4423. */
  4424. function inspect() {
  4425. if (!this.isValid()) {
  4426. return 'moment.invalid(/* ' + this._i + ' */)';
  4427. }
  4428. var func = 'moment',
  4429. zone = '',
  4430. prefix,
  4431. year,
  4432. datetime,
  4433. suffix;
  4434. if (!this.isLocal()) {
  4435. func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
  4436. zone = 'Z';
  4437. }
  4438. prefix = '[' + func + '("]';
  4439. year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';
  4440. datetime = '-MM-DD[T]HH:mm:ss.SSS';
  4441. suffix = zone + '[")]';
  4442. return this.format(prefix + year + datetime + suffix);
  4443. }
  4444. function format(inputString) {
  4445. if (!inputString) {
  4446. inputString = this.isUtc()
  4447. ? hooks.defaultFormatUtc
  4448. : hooks.defaultFormat;
  4449. }
  4450. var output = formatMoment(this, inputString);
  4451. return this.localeData().postformat(output);
  4452. }
  4453. function from(time, withoutSuffix) {
  4454. if (
  4455. this.isValid() &&
  4456. ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
  4457. ) {
  4458. return createDuration({ to: this, from: time })
  4459. .locale(this.locale())
  4460. .humanize(!withoutSuffix);
  4461. } else {
  4462. return this.localeData().invalidDate();
  4463. }
  4464. }
  4465. function fromNow(withoutSuffix) {
  4466. return this.from(createLocal(), withoutSuffix);
  4467. }
  4468. function to(time, withoutSuffix) {
  4469. if (
  4470. this.isValid() &&
  4471. ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
  4472. ) {
  4473. return createDuration({ from: this, to: time })
  4474. .locale(this.locale())
  4475. .humanize(!withoutSuffix);
  4476. } else {
  4477. return this.localeData().invalidDate();
  4478. }
  4479. }
  4480. function toNow(withoutSuffix) {
  4481. return this.to(createLocal(), withoutSuffix);
  4482. }
  4483. // If passed a locale key, it will set the locale for this
  4484. // instance. Otherwise, it will return the locale configuration
  4485. // variables for this instance.
  4486. function locale(key) {
  4487. var newLocaleData;
  4488. if (key === undefined) {
  4489. return this._locale._abbr;
  4490. } else {
  4491. newLocaleData = getLocale(key);
  4492. if (newLocaleData != null) {
  4493. this._locale = newLocaleData;
  4494. }
  4495. return this;
  4496. }
  4497. }
  4498. var lang = deprecate(
  4499. 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
  4500. function (key) {
  4501. if (key === undefined) {
  4502. return this.localeData();
  4503. } else {
  4504. return this.locale(key);
  4505. }
  4506. }
  4507. );
  4508. function localeData() {
  4509. return this._locale;
  4510. }
  4511. var MS_PER_SECOND = 1000,
  4512. MS_PER_MINUTE = 60 * MS_PER_SECOND,
  4513. MS_PER_HOUR = 60 * MS_PER_MINUTE,
  4514. MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
  4515. // actual modulo - handles negative numbers (for dates before 1970):
  4516. function mod$1(dividend, divisor) {
  4517. return ((dividend % divisor) + divisor) % divisor;
  4518. }
  4519. function localStartOfDate(y, m, d) {
  4520. // the date constructor remaps years 0-99 to 1900-1999
  4521. if (y < 100 && y >= 0) {
  4522. // preserve leap years using a full 400 year cycle, then reset
  4523. return new Date(y + 400, m, d) - MS_PER_400_YEARS;
  4524. } else {
  4525. return new Date(y, m, d).valueOf();
  4526. }
  4527. }
  4528. function utcStartOfDate(y, m, d) {
  4529. // Date.UTC remaps years 0-99 to 1900-1999
  4530. if (y < 100 && y >= 0) {
  4531. // preserve leap years using a full 400 year cycle, then reset
  4532. return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
  4533. } else {
  4534. return Date.UTC(y, m, d);
  4535. }
  4536. }
  4537. function startOf(units) {
  4538. var time, startOfDate;
  4539. units = normalizeUnits(units);
  4540. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  4541. return this;
  4542. }
  4543. startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  4544. switch (units) {
  4545. case 'year':
  4546. time = startOfDate(this.year(), 0, 1);
  4547. break;
  4548. case 'quarter':
  4549. time = startOfDate(
  4550. this.year(),
  4551. this.month() - (this.month() % 3),
  4552. 1
  4553. );
  4554. break;
  4555. case 'month':
  4556. time = startOfDate(this.year(), this.month(), 1);
  4557. break;
  4558. case 'week':
  4559. time = startOfDate(
  4560. this.year(),
  4561. this.month(),
  4562. this.date() - this.weekday()
  4563. );
  4564. break;
  4565. case 'isoWeek':
  4566. time = startOfDate(
  4567. this.year(),
  4568. this.month(),
  4569. this.date() - (this.isoWeekday() - 1)
  4570. );
  4571. break;
  4572. case 'day':
  4573. case 'date':
  4574. time = startOfDate(this.year(), this.month(), this.date());
  4575. break;
  4576. case 'hour':
  4577. time = this._d.valueOf();
  4578. time -= mod$1(
  4579. time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
  4580. MS_PER_HOUR
  4581. );
  4582. break;
  4583. case 'minute':
  4584. time = this._d.valueOf();
  4585. time -= mod$1(time, MS_PER_MINUTE);
  4586. break;
  4587. case 'second':
  4588. time = this._d.valueOf();
  4589. time -= mod$1(time, MS_PER_SECOND);
  4590. break;
  4591. }
  4592. this._d.setTime(time);
  4593. hooks.updateOffset(this, true);
  4594. return this;
  4595. }
  4596. function endOf(units) {
  4597. var time, startOfDate;
  4598. units = normalizeUnits(units);
  4599. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  4600. return this;
  4601. }
  4602. startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  4603. switch (units) {
  4604. case 'year':
  4605. time = startOfDate(this.year() + 1, 0, 1) - 1;
  4606. break;
  4607. case 'quarter':
  4608. time =
  4609. startOfDate(
  4610. this.year(),
  4611. this.month() - (this.month() % 3) + 3,
  4612. 1
  4613. ) - 1;
  4614. break;
  4615. case 'month':
  4616. time = startOfDate(this.year(), this.month() + 1, 1) - 1;
  4617. break;
  4618. case 'week':
  4619. time =
  4620. startOfDate(
  4621. this.year(),
  4622. this.month(),
  4623. this.date() - this.weekday() + 7
  4624. ) - 1;
  4625. break;
  4626. case 'isoWeek':
  4627. time =
  4628. startOfDate(
  4629. this.year(),
  4630. this.month(),
  4631. this.date() - (this.isoWeekday() - 1) + 7
  4632. ) - 1;
  4633. break;
  4634. case 'day':
  4635. case 'date':
  4636. time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
  4637. break;
  4638. case 'hour':
  4639. time = this._d.valueOf();
  4640. time +=
  4641. MS_PER_HOUR -
  4642. mod$1(
  4643. time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
  4644. MS_PER_HOUR
  4645. ) -
  4646. 1;
  4647. break;
  4648. case 'minute':
  4649. time = this._d.valueOf();
  4650. time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
  4651. break;
  4652. case 'second':
  4653. time = this._d.valueOf();
  4654. time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
  4655. break;
  4656. }
  4657. this._d.setTime(time);
  4658. hooks.updateOffset(this, true);
  4659. return this;
  4660. }
  4661. function valueOf() {
  4662. return this._d.valueOf() - (this._offset || 0) * 60000;
  4663. }
  4664. function unix() {
  4665. return Math.floor(this.valueOf() / 1000);
  4666. }
  4667. function toDate() {
  4668. return new Date(this.valueOf());
  4669. }
  4670. function toArray() {
  4671. var m = this;
  4672. return [
  4673. m.year(),
  4674. m.month(),
  4675. m.date(),
  4676. m.hour(),
  4677. m.minute(),
  4678. m.second(),
  4679. m.millisecond(),
  4680. ];
  4681. }
  4682. function toObject() {
  4683. var m = this;
  4684. return {
  4685. years: m.year(),
  4686. months: m.month(),
  4687. date: m.date(),
  4688. hours: m.hours(),
  4689. minutes: m.minutes(),
  4690. seconds: m.seconds(),
  4691. milliseconds: m.milliseconds(),
  4692. };
  4693. }
  4694. function toJSON() {
  4695. // new Date(NaN).toJSON() === null
  4696. return this.isValid() ? this.toISOString() : null;
  4697. }
  4698. function isValid$2() {
  4699. return isValid(this);
  4700. }
  4701. function parsingFlags() {
  4702. return extend({}, getParsingFlags(this));
  4703. }
  4704. function invalidAt() {
  4705. return getParsingFlags(this).overflow;
  4706. }
  4707. function creationData() {
  4708. return {
  4709. input: this._i,
  4710. format: this._f,
  4711. locale: this._locale,
  4712. isUTC: this._isUTC,
  4713. strict: this._strict,
  4714. };
  4715. }
  4716. addFormatToken('N', 0, 0, 'eraAbbr');
  4717. addFormatToken('NN', 0, 0, 'eraAbbr');
  4718. addFormatToken('NNN', 0, 0, 'eraAbbr');
  4719. addFormatToken('NNNN', 0, 0, 'eraName');
  4720. addFormatToken('NNNNN', 0, 0, 'eraNarrow');
  4721. addFormatToken('y', ['y', 1], 'yo', 'eraYear');
  4722. addFormatToken('y', ['yy', 2], 0, 'eraYear');
  4723. addFormatToken('y', ['yyy', 3], 0, 'eraYear');
  4724. addFormatToken('y', ['yyyy', 4], 0, 'eraYear');
  4725. addRegexToken('N', matchEraAbbr);
  4726. addRegexToken('NN', matchEraAbbr);
  4727. addRegexToken('NNN', matchEraAbbr);
  4728. addRegexToken('NNNN', matchEraName);
  4729. addRegexToken('NNNNN', matchEraNarrow);
  4730. addParseToken(
  4731. ['N', 'NN', 'NNN', 'NNNN', 'NNNNN'],
  4732. function (input, array, config, token) {
  4733. var era = config._locale.erasParse(input, token, config._strict);
  4734. if (era) {
  4735. getParsingFlags(config).era = era;
  4736. } else {
  4737. getParsingFlags(config).invalidEra = input;
  4738. }
  4739. }
  4740. );
  4741. addRegexToken('y', matchUnsigned);
  4742. addRegexToken('yy', matchUnsigned);
  4743. addRegexToken('yyy', matchUnsigned);
  4744. addRegexToken('yyyy', matchUnsigned);
  4745. addRegexToken('yo', matchEraYearOrdinal);
  4746. addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);
  4747. addParseToken(['yo'], function (input, array, config, token) {
  4748. var match;
  4749. if (config._locale._eraYearOrdinalRegex) {
  4750. match = input.match(config._locale._eraYearOrdinalRegex);
  4751. }
  4752. if (config._locale.eraYearOrdinalParse) {
  4753. array[YEAR] = config._locale.eraYearOrdinalParse(input, match);
  4754. } else {
  4755. array[YEAR] = parseInt(input, 10);
  4756. }
  4757. });
  4758. function localeEras(m, format) {
  4759. var i,
  4760. l,
  4761. date,
  4762. eras = this._eras || getLocale('en')._eras;
  4763. for (i = 0, l = eras.length; i < l; ++i) {
  4764. switch (typeof eras[i].since) {
  4765. case 'string':
  4766. // truncate time
  4767. date = hooks(eras[i].since).startOf('day');
  4768. eras[i].since = date.valueOf();
  4769. break;
  4770. }
  4771. switch (typeof eras[i].until) {
  4772. case 'undefined':
  4773. eras[i].until = +Infinity;
  4774. break;
  4775. case 'string':
  4776. // truncate time
  4777. date = hooks(eras[i].until).startOf('day').valueOf();
  4778. eras[i].until = date.valueOf();
  4779. break;
  4780. }
  4781. }
  4782. return eras;
  4783. }
  4784. function localeErasParse(eraName, format, strict) {
  4785. var i,
  4786. l,
  4787. eras = this.eras(),
  4788. name,
  4789. abbr,
  4790. narrow;
  4791. eraName = eraName.toUpperCase();
  4792. for (i = 0, l = eras.length; i < l; ++i) {
  4793. name = eras[i].name.toUpperCase();
  4794. abbr = eras[i].abbr.toUpperCase();
  4795. narrow = eras[i].narrow.toUpperCase();
  4796. if (strict) {
  4797. switch (format) {
  4798. case 'N':
  4799. case 'NN':
  4800. case 'NNN':
  4801. if (abbr === eraName) {
  4802. return eras[i];
  4803. }
  4804. break;
  4805. case 'NNNN':
  4806. if (name === eraName) {
  4807. return eras[i];
  4808. }
  4809. break;
  4810. case 'NNNNN':
  4811. if (narrow === eraName) {
  4812. return eras[i];
  4813. }
  4814. break;
  4815. }
  4816. } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
  4817. return eras[i];
  4818. }
  4819. }
  4820. }
  4821. function localeErasConvertYear(era, year) {
  4822. var dir = era.since <= era.until ? +1 : -1;
  4823. if (year === undefined) {
  4824. return hooks(era.since).year();
  4825. } else {
  4826. return hooks(era.since).year() + (year - era.offset) * dir;
  4827. }
  4828. }
  4829. function getEraName() {
  4830. var i,
  4831. l,
  4832. val,
  4833. eras = this.localeData().eras();
  4834. for (i = 0, l = eras.length; i < l; ++i) {
  4835. // truncate time
  4836. val = this.clone().startOf('day').valueOf();
  4837. if (eras[i].since <= val && val <= eras[i].until) {
  4838. return eras[i].name;
  4839. }
  4840. if (eras[i].until <= val && val <= eras[i].since) {
  4841. return eras[i].name;
  4842. }
  4843. }
  4844. return '';
  4845. }
  4846. function getEraNarrow() {
  4847. var i,
  4848. l,
  4849. val,
  4850. eras = this.localeData().eras();
  4851. for (i = 0, l = eras.length; i < l; ++i) {
  4852. // truncate time
  4853. val = this.clone().startOf('day').valueOf();
  4854. if (eras[i].since <= val && val <= eras[i].until) {
  4855. return eras[i].narrow;
  4856. }
  4857. if (eras[i].until <= val && val <= eras[i].since) {
  4858. return eras[i].narrow;
  4859. }
  4860. }
  4861. return '';
  4862. }
  4863. function getEraAbbr() {
  4864. var i,
  4865. l,
  4866. val,
  4867. eras = this.localeData().eras();
  4868. for (i = 0, l = eras.length; i < l; ++i) {
  4869. // truncate time
  4870. val = this.clone().startOf('day').valueOf();
  4871. if (eras[i].since <= val && val <= eras[i].until) {
  4872. return eras[i].abbr;
  4873. }
  4874. if (eras[i].until <= val && val <= eras[i].since) {
  4875. return eras[i].abbr;
  4876. }
  4877. }
  4878. return '';
  4879. }
  4880. function getEraYear() {
  4881. var i,
  4882. l,
  4883. dir,
  4884. val,
  4885. eras = this.localeData().eras();
  4886. for (i = 0, l = eras.length; i < l; ++i) {
  4887. dir = eras[i].since <= eras[i].until ? +1 : -1;
  4888. // truncate time
  4889. val = this.clone().startOf('day').valueOf();
  4890. if (
  4891. (eras[i].since <= val && val <= eras[i].until) ||
  4892. (eras[i].until <= val && val <= eras[i].since)
  4893. ) {
  4894. return (
  4895. (this.year() - hooks(eras[i].since).year()) * dir +
  4896. eras[i].offset
  4897. );
  4898. }
  4899. }
  4900. return this.year();
  4901. }
  4902. function erasNameRegex(isStrict) {
  4903. if (!hasOwnProp(this, '_erasNameRegex')) {
  4904. computeErasParse.call(this);
  4905. }
  4906. return isStrict ? this._erasNameRegex : this._erasRegex;
  4907. }
  4908. function erasAbbrRegex(isStrict) {
  4909. if (!hasOwnProp(this, '_erasAbbrRegex')) {
  4910. computeErasParse.call(this);
  4911. }
  4912. return isStrict ? this._erasAbbrRegex : this._erasRegex;
  4913. }
  4914. function erasNarrowRegex(isStrict) {
  4915. if (!hasOwnProp(this, '_erasNarrowRegex')) {
  4916. computeErasParse.call(this);
  4917. }
  4918. return isStrict ? this._erasNarrowRegex : this._erasRegex;
  4919. }
  4920. function matchEraAbbr(isStrict, locale) {
  4921. return locale.erasAbbrRegex(isStrict);
  4922. }
  4923. function matchEraName(isStrict, locale) {
  4924. return locale.erasNameRegex(isStrict);
  4925. }
  4926. function matchEraNarrow(isStrict, locale) {
  4927. return locale.erasNarrowRegex(isStrict);
  4928. }
  4929. function matchEraYearOrdinal(isStrict, locale) {
  4930. return locale._eraYearOrdinalRegex || matchUnsigned;
  4931. }
  4932. function computeErasParse() {
  4933. var abbrPieces = [],
  4934. namePieces = [],
  4935. narrowPieces = [],
  4936. mixedPieces = [],
  4937. i,
  4938. l,
  4939. eras = this.eras();
  4940. for (i = 0, l = eras.length; i < l; ++i) {
  4941. namePieces.push(regexEscape(eras[i].name));
  4942. abbrPieces.push(regexEscape(eras[i].abbr));
  4943. narrowPieces.push(regexEscape(eras[i].narrow));
  4944. mixedPieces.push(regexEscape(eras[i].name));
  4945. mixedPieces.push(regexEscape(eras[i].abbr));
  4946. mixedPieces.push(regexEscape(eras[i].narrow));
  4947. }
  4948. this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  4949. this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');
  4950. this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');
  4951. this._erasNarrowRegex = new RegExp(
  4952. '^(' + narrowPieces.join('|') + ')',
  4953. 'i'
  4954. );
  4955. }
  4956. // FORMATTING
  4957. addFormatToken(0, ['gg', 2], 0, function () {
  4958. return this.weekYear() % 100;
  4959. });
  4960. addFormatToken(0, ['GG', 2], 0, function () {
  4961. return this.isoWeekYear() % 100;
  4962. });
  4963. function addWeekYearFormatToken(token, getter) {
  4964. addFormatToken(0, [token, token.length], 0, getter);
  4965. }
  4966. addWeekYearFormatToken('gggg', 'weekYear');
  4967. addWeekYearFormatToken('ggggg', 'weekYear');
  4968. addWeekYearFormatToken('GGGG', 'isoWeekYear');
  4969. addWeekYearFormatToken('GGGGG', 'isoWeekYear');
  4970. // ALIASES
  4971. addUnitAlias('weekYear', 'gg');
  4972. addUnitAlias('isoWeekYear', 'GG');
  4973. // PRIORITY
  4974. addUnitPriority('weekYear', 1);
  4975. addUnitPriority('isoWeekYear', 1);
  4976. // PARSING
  4977. addRegexToken('G', matchSigned);
  4978. addRegexToken('g', matchSigned);
  4979. addRegexToken('GG', match1to2, match2);
  4980. addRegexToken('gg', match1to2, match2);
  4981. addRegexToken('GGGG', match1to4, match4);
  4982. addRegexToken('gggg', match1to4, match4);
  4983. addRegexToken('GGGGG', match1to6, match6);
  4984. addRegexToken('ggggg', match1to6, match6);
  4985. addWeekParseToken(
  4986. ['gggg', 'ggggg', 'GGGG', 'GGGGG'],
  4987. function (input, week, config, token) {
  4988. week[token.substr(0, 2)] = toInt(input);
  4989. }
  4990. );
  4991. addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
  4992. week[token] = hooks.parseTwoDigitYear(input);
  4993. });
  4994. // MOMENTS
  4995. function getSetWeekYear(input) {
  4996. return getSetWeekYearHelper.call(
  4997. this,
  4998. input,
  4999. this.week(),
  5000. this.weekday(),
  5001. this.localeData()._week.dow,
  5002. this.localeData()._week.doy
  5003. );
  5004. }
  5005. function getSetISOWeekYear(input) {
  5006. return getSetWeekYearHelper.call(
  5007. this,
  5008. input,
  5009. this.isoWeek(),
  5010. this.isoWeekday(),
  5011. 1,
  5012. 4
  5013. );
  5014. }
  5015. function getISOWeeksInYear() {
  5016. return weeksInYear(this.year(), 1, 4);
  5017. }
  5018. function getISOWeeksInISOWeekYear() {
  5019. return weeksInYear(this.isoWeekYear(), 1, 4);
  5020. }
  5021. function getWeeksInYear() {
  5022. var weekInfo = this.localeData()._week;
  5023. return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
  5024. }
  5025. function getWeeksInWeekYear() {
  5026. var weekInfo = this.localeData()._week;
  5027. return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
  5028. }
  5029. function getSetWeekYearHelper(input, week, weekday, dow, doy) {
  5030. var weeksTarget;
  5031. if (input == null) {
  5032. return weekOfYear(this, dow, doy).year;
  5033. } else {
  5034. weeksTarget = weeksInYear(input, dow, doy);
  5035. if (week > weeksTarget) {
  5036. week = weeksTarget;
  5037. }
  5038. return setWeekAll.call(this, input, week, weekday, dow, doy);
  5039. }
  5040. }
  5041. function setWeekAll(weekYear, week, weekday, dow, doy) {
  5042. var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
  5043. date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  5044. this.year(date.getUTCFullYear());
  5045. this.month(date.getUTCMonth());
  5046. this.date(date.getUTCDate());
  5047. return this;
  5048. }
  5049. // FORMATTING
  5050. addFormatToken('Q', 0, 'Qo', 'quarter');
  5051. // ALIASES
  5052. addUnitAlias('quarter', 'Q');
  5053. // PRIORITY
  5054. addUnitPriority('quarter', 7);
  5055. // PARSING
  5056. addRegexToken('Q', match1);
  5057. addParseToken('Q', function (input, array) {
  5058. array[MONTH] = (toInt(input) - 1) * 3;
  5059. });
  5060. // MOMENTS
  5061. function getSetQuarter(input) {
  5062. return input == null
  5063. ? Math.ceil((this.month() + 1) / 3)
  5064. : this.month((input - 1) * 3 + (this.month() % 3));
  5065. }
  5066. // FORMATTING
  5067. addFormatToken('D', ['DD', 2], 'Do', 'date');
  5068. // ALIASES
  5069. addUnitAlias('date', 'D');
  5070. // PRIORITY
  5071. addUnitPriority('date', 9);
  5072. // PARSING
  5073. addRegexToken('D', match1to2);
  5074. addRegexToken('DD', match1to2, match2);
  5075. addRegexToken('Do', function (isStrict, locale) {
  5076. // TODO: Remove "ordinalParse" fallback in next major release.
  5077. return isStrict
  5078. ? locale._dayOfMonthOrdinalParse || locale._ordinalParse
  5079. : locale._dayOfMonthOrdinalParseLenient;
  5080. });
  5081. addParseToken(['D', 'DD'], DATE);
  5082. addParseToken('Do', function (input, array) {
  5083. array[DATE] = toInt(input.match(match1to2)[0]);
  5084. });
  5085. // MOMENTS
  5086. var getSetDayOfMonth = makeGetSet('Date', true);
  5087. // FORMATTING
  5088. addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
  5089. // ALIASES
  5090. addUnitAlias('dayOfYear', 'DDD');
  5091. // PRIORITY
  5092. addUnitPriority('dayOfYear', 4);
  5093. // PARSING
  5094. addRegexToken('DDD', match1to3);
  5095. addRegexToken('DDDD', match3);
  5096. addParseToken(['DDD', 'DDDD'], function (input, array, config) {
  5097. config._dayOfYear = toInt(input);
  5098. });
  5099. // HELPERS
  5100. // MOMENTS
  5101. function getSetDayOfYear(input) {
  5102. var dayOfYear =
  5103. Math.round(
  5104. (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5
  5105. ) + 1;
  5106. return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
  5107. }
  5108. // FORMATTING
  5109. addFormatToken('m', ['mm', 2], 0, 'minute');
  5110. // ALIASES
  5111. addUnitAlias('minute', 'm');
  5112. // PRIORITY
  5113. addUnitPriority('minute', 14);
  5114. // PARSING
  5115. addRegexToken('m', match1to2);
  5116. addRegexToken('mm', match1to2, match2);
  5117. addParseToken(['m', 'mm'], MINUTE);
  5118. // MOMENTS
  5119. var getSetMinute = makeGetSet('Minutes', false);
  5120. // FORMATTING
  5121. addFormatToken('s', ['ss', 2], 0, 'second');
  5122. // ALIASES
  5123. addUnitAlias('second', 's');
  5124. // PRIORITY
  5125. addUnitPriority('second', 15);
  5126. // PARSING
  5127. addRegexToken('s', match1to2);
  5128. addRegexToken('ss', match1to2, match2);
  5129. addParseToken(['s', 'ss'], SECOND);
  5130. // MOMENTS
  5131. var getSetSecond = makeGetSet('Seconds', false);
  5132. // FORMATTING
  5133. addFormatToken('S', 0, 0, function () {
  5134. return ~~(this.millisecond() / 100);
  5135. });
  5136. addFormatToken(0, ['SS', 2], 0, function () {
  5137. return ~~(this.millisecond() / 10);
  5138. });
  5139. addFormatToken(0, ['SSS', 3], 0, 'millisecond');
  5140. addFormatToken(0, ['SSSS', 4], 0, function () {
  5141. return this.millisecond() * 10;
  5142. });
  5143. addFormatToken(0, ['SSSSS', 5], 0, function () {
  5144. return this.millisecond() * 100;
  5145. });
  5146. addFormatToken(0, ['SSSSSS', 6], 0, function () {
  5147. return this.millisecond() * 1000;
  5148. });
  5149. addFormatToken(0, ['SSSSSSS', 7], 0, function () {
  5150. return this.millisecond() * 10000;
  5151. });
  5152. addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
  5153. return this.millisecond() * 100000;
  5154. });
  5155. addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
  5156. return this.millisecond() * 1000000;
  5157. });
  5158. // ALIASES
  5159. addUnitAlias('millisecond', 'ms');
  5160. // PRIORITY
  5161. addUnitPriority('millisecond', 16);
  5162. // PARSING
  5163. addRegexToken('S', match1to3, match1);
  5164. addRegexToken('SS', match1to3, match2);
  5165. addRegexToken('SSS', match1to3, match3);
  5166. var token, getSetMillisecond;
  5167. for (token = 'SSSS'; token.length <= 9; token += 'S') {
  5168. addRegexToken(token, matchUnsigned);
  5169. }
  5170. function parseMs(input, array) {
  5171. array[MILLISECOND] = toInt(('0.' + input) * 1000);
  5172. }
  5173. for (token = 'S'; token.length <= 9; token += 'S') {
  5174. addParseToken(token, parseMs);
  5175. }
  5176. getSetMillisecond = makeGetSet('Milliseconds', false);
  5177. // FORMATTING
  5178. addFormatToken('z', 0, 0, 'zoneAbbr');
  5179. addFormatToken('zz', 0, 0, 'zoneName');
  5180. // MOMENTS
  5181. function getZoneAbbr() {
  5182. return this._isUTC ? 'UTC' : '';
  5183. }
  5184. function getZoneName() {
  5185. return this._isUTC ? 'Coordinated Universal Time' : '';
  5186. }
  5187. var proto = Moment.prototype;
  5188. proto.add = add;
  5189. proto.calendar = calendar$1;
  5190. proto.clone = clone;
  5191. proto.diff = diff;
  5192. proto.endOf = endOf;
  5193. proto.format = format;
  5194. proto.from = from;
  5195. proto.fromNow = fromNow;
  5196. proto.to = to;
  5197. proto.toNow = toNow;
  5198. proto.get = stringGet;
  5199. proto.invalidAt = invalidAt;
  5200. proto.isAfter = isAfter;
  5201. proto.isBefore = isBefore;
  5202. proto.isBetween = isBetween;
  5203. proto.isSame = isSame;
  5204. proto.isSameOrAfter = isSameOrAfter;
  5205. proto.isSameOrBefore = isSameOrBefore;
  5206. proto.isValid = isValid$2;
  5207. proto.lang = lang;
  5208. proto.locale = locale;
  5209. proto.localeData = localeData;
  5210. proto.max = prototypeMax;
  5211. proto.min = prototypeMin;
  5212. proto.parsingFlags = parsingFlags;
  5213. proto.set = stringSet;
  5214. proto.startOf = startOf;
  5215. proto.subtract = subtract;
  5216. proto.toArray = toArray;
  5217. proto.toObject = toObject;
  5218. proto.toDate = toDate;
  5219. proto.toISOString = toISOString;
  5220. proto.inspect = inspect;
  5221. if (typeof Symbol !== 'undefined' && Symbol.for != null) {
  5222. proto[Symbol.for('nodejs.util.inspect.custom')] = function () {
  5223. return 'Moment<' + this.format() + '>';
  5224. };
  5225. }
  5226. proto.toJSON = toJSON;
  5227. proto.toString = toString;
  5228. proto.unix = unix;
  5229. proto.valueOf = valueOf;
  5230. proto.creationData = creationData;
  5231. proto.eraName = getEraName;
  5232. proto.eraNarrow = getEraNarrow;
  5233. proto.eraAbbr = getEraAbbr;
  5234. proto.eraYear = getEraYear;
  5235. proto.year = getSetYear;
  5236. proto.isLeapYear = getIsLeapYear;
  5237. proto.weekYear = getSetWeekYear;
  5238. proto.isoWeekYear = getSetISOWeekYear;
  5239. proto.quarter = proto.quarters = getSetQuarter;
  5240. proto.month = getSetMonth;
  5241. proto.daysInMonth = getDaysInMonth;
  5242. proto.week = proto.weeks = getSetWeek;
  5243. proto.isoWeek = proto.isoWeeks = getSetISOWeek;
  5244. proto.weeksInYear = getWeeksInYear;
  5245. proto.weeksInWeekYear = getWeeksInWeekYear;
  5246. proto.isoWeeksInYear = getISOWeeksInYear;
  5247. proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
  5248. proto.date = getSetDayOfMonth;
  5249. proto.day = proto.days = getSetDayOfWeek;
  5250. proto.weekday = getSetLocaleDayOfWeek;
  5251. proto.isoWeekday = getSetISODayOfWeek;
  5252. proto.dayOfYear = getSetDayOfYear;
  5253. proto.hour = proto.hours = getSetHour;
  5254. proto.minute = proto.minutes = getSetMinute;
  5255. proto.second = proto.seconds = getSetSecond;
  5256. proto.millisecond = proto.milliseconds = getSetMillisecond;
  5257. proto.utcOffset = getSetOffset;
  5258. proto.utc = setOffsetToUTC;
  5259. proto.local = setOffsetToLocal;
  5260. proto.parseZone = setOffsetToParsedOffset;
  5261. proto.hasAlignedHourOffset = hasAlignedHourOffset;
  5262. proto.isDST = isDaylightSavingTime;
  5263. proto.isLocal = isLocal;
  5264. proto.isUtcOffset = isUtcOffset;
  5265. proto.isUtc = isUtc;
  5266. proto.isUTC = isUtc;
  5267. proto.zoneAbbr = getZoneAbbr;
  5268. proto.zoneName = getZoneName;
  5269. proto.dates = deprecate(
  5270. 'dates accessor is deprecated. Use date instead.',
  5271. getSetDayOfMonth
  5272. );
  5273. proto.months = deprecate(
  5274. 'months accessor is deprecated. Use month instead',
  5275. getSetMonth
  5276. );
  5277. proto.years = deprecate(
  5278. 'years accessor is deprecated. Use year instead',
  5279. getSetYear
  5280. );
  5281. proto.zone = deprecate(
  5282. 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',
  5283. getSetZone
  5284. );
  5285. proto.isDSTShifted = deprecate(
  5286. 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',
  5287. isDaylightSavingTimeShifted
  5288. );
  5289. function createUnix(input) {
  5290. return createLocal(input * 1000);
  5291. }
  5292. function createInZone() {
  5293. return createLocal.apply(null, arguments).parseZone();
  5294. }
  5295. function preParsePostFormat(string) {
  5296. return string;
  5297. }
  5298. var proto$1 = Locale.prototype;
  5299. proto$1.calendar = calendar;
  5300. proto$1.longDateFormat = longDateFormat;
  5301. proto$1.invalidDate = invalidDate;
  5302. proto$1.ordinal = ordinal;
  5303. proto$1.preparse = preParsePostFormat;
  5304. proto$1.postformat = preParsePostFormat;
  5305. proto$1.relativeTime = relativeTime;
  5306. proto$1.pastFuture = pastFuture;
  5307. proto$1.set = set;
  5308. proto$1.eras = localeEras;
  5309. proto$1.erasParse = localeErasParse;
  5310. proto$1.erasConvertYear = localeErasConvertYear;
  5311. proto$1.erasAbbrRegex = erasAbbrRegex;
  5312. proto$1.erasNameRegex = erasNameRegex;
  5313. proto$1.erasNarrowRegex = erasNarrowRegex;
  5314. proto$1.months = localeMonths;
  5315. proto$1.monthsShort = localeMonthsShort;
  5316. proto$1.monthsParse = localeMonthsParse;
  5317. proto$1.monthsRegex = monthsRegex;
  5318. proto$1.monthsShortRegex = monthsShortRegex;
  5319. proto$1.week = localeWeek;
  5320. proto$1.firstDayOfYear = localeFirstDayOfYear;
  5321. proto$1.firstDayOfWeek = localeFirstDayOfWeek;
  5322. proto$1.weekdays = localeWeekdays;
  5323. proto$1.weekdaysMin = localeWeekdaysMin;
  5324. proto$1.weekdaysShort = localeWeekdaysShort;
  5325. proto$1.weekdaysParse = localeWeekdaysParse;
  5326. proto$1.weekdaysRegex = weekdaysRegex;
  5327. proto$1.weekdaysShortRegex = weekdaysShortRegex;
  5328. proto$1.weekdaysMinRegex = weekdaysMinRegex;
  5329. proto$1.isPM = localeIsPM;
  5330. proto$1.meridiem = localeMeridiem;
  5331. function get$1(format, index, field, setter) {
  5332. var locale = getLocale(),
  5333. utc = createUTC().set(setter, index);
  5334. return locale[field](utc, format);
  5335. }
  5336. function listMonthsImpl(format, index, field) {
  5337. if (isNumber(format)) {
  5338. index = format;
  5339. format = undefined;
  5340. }
  5341. format = format || '';
  5342. if (index != null) {
  5343. return get$1(format, index, field, 'month');
  5344. }
  5345. var i,
  5346. out = [];
  5347. for (i = 0; i < 12; i++) {
  5348. out[i] = get$1(format, i, field, 'month');
  5349. }
  5350. return out;
  5351. }
  5352. // ()
  5353. // (5)
  5354. // (fmt, 5)
  5355. // (fmt)
  5356. // (true)
  5357. // (true, 5)
  5358. // (true, fmt, 5)
  5359. // (true, fmt)
  5360. function listWeekdaysImpl(localeSorted, format, index, field) {
  5361. if (typeof localeSorted === 'boolean') {
  5362. if (isNumber(format)) {
  5363. index = format;
  5364. format = undefined;
  5365. }
  5366. format = format || '';
  5367. } else {
  5368. format = localeSorted;
  5369. index = format;
  5370. localeSorted = false;
  5371. if (isNumber(format)) {
  5372. index = format;
  5373. format = undefined;
  5374. }
  5375. format = format || '';
  5376. }
  5377. var locale = getLocale(),
  5378. shift = localeSorted ? locale._week.dow : 0,
  5379. i,
  5380. out = [];
  5381. if (index != null) {
  5382. return get$1(format, (index + shift) % 7, field, 'day');
  5383. }
  5384. for (i = 0; i < 7; i++) {
  5385. out[i] = get$1(format, (i + shift) % 7, field, 'day');
  5386. }
  5387. return out;
  5388. }
  5389. function listMonths(format, index) {
  5390. return listMonthsImpl(format, index, 'months');
  5391. }
  5392. function listMonthsShort(format, index) {
  5393. return listMonthsImpl(format, index, 'monthsShort');
  5394. }
  5395. function listWeekdays(localeSorted, format, index) {
  5396. return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
  5397. }
  5398. function listWeekdaysShort(localeSorted, format, index) {
  5399. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
  5400. }
  5401. function listWeekdaysMin(localeSorted, format, index) {
  5402. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
  5403. }
  5404. getSetGlobalLocale('en', {
  5405. eras: [
  5406. {
  5407. since: '0001-01-01',
  5408. until: +Infinity,
  5409. offset: 1,
  5410. name: 'Anno Domini',
  5411. narrow: 'AD',
  5412. abbr: 'AD',
  5413. },
  5414. {
  5415. since: '0000-12-31',
  5416. until: -Infinity,
  5417. offset: 1,
  5418. name: 'Before Christ',
  5419. narrow: 'BC',
  5420. abbr: 'BC',
  5421. },
  5422. ],
  5423. dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  5424. ordinal: function (number) {
  5425. var b = number % 10,
  5426. output =
  5427. toInt((number % 100) / 10) === 1
  5428. ? 'th'
  5429. : b === 1
  5430. ? 'st'
  5431. : b === 2
  5432. ? 'nd'
  5433. : b === 3
  5434. ? 'rd'
  5435. : 'th';
  5436. return number + output;
  5437. },
  5438. });
  5439. // Side effect imports
  5440. hooks.lang = deprecate(
  5441. 'moment.lang is deprecated. Use moment.locale instead.',
  5442. getSetGlobalLocale
  5443. );
  5444. hooks.langData = deprecate(
  5445. 'moment.langData is deprecated. Use moment.localeData instead.',
  5446. getLocale
  5447. );
  5448. var mathAbs = Math.abs;
  5449. function abs() {
  5450. var data = this._data;
  5451. this._milliseconds = mathAbs(this._milliseconds);
  5452. this._days = mathAbs(this._days);
  5453. this._months = mathAbs(this._months);
  5454. data.milliseconds = mathAbs(data.milliseconds);
  5455. data.seconds = mathAbs(data.seconds);
  5456. data.minutes = mathAbs(data.minutes);
  5457. data.hours = mathAbs(data.hours);
  5458. data.months = mathAbs(data.months);
  5459. data.years = mathAbs(data.years);
  5460. return this;
  5461. }
  5462. function addSubtract$1(duration, input, value, direction) {
  5463. var other = createDuration(input, value);
  5464. duration._milliseconds += direction * other._milliseconds;
  5465. duration._days += direction * other._days;
  5466. duration._months += direction * other._months;
  5467. return duration._bubble();
  5468. }
  5469. // supports only 2.0-style add(1, 's') or add(duration)
  5470. function add$1(input, value) {
  5471. return addSubtract$1(this, input, value, 1);
  5472. }
  5473. // supports only 2.0-style subtract(1, 's') or subtract(duration)
  5474. function subtract$1(input, value) {
  5475. return addSubtract$1(this, input, value, -1);
  5476. }
  5477. function absCeil(number) {
  5478. if (number < 0) {
  5479. return Math.floor(number);
  5480. } else {
  5481. return Math.ceil(number);
  5482. }
  5483. }
  5484. function bubble() {
  5485. var milliseconds = this._milliseconds,
  5486. days = this._days,
  5487. months = this._months,
  5488. data = this._data,
  5489. seconds,
  5490. minutes,
  5491. hours,
  5492. years,
  5493. monthsFromDays;
  5494. // if we have a mix of positive and negative values, bubble down first
  5495. // check: https://github.com/moment/moment/issues/2166
  5496. if (
  5497. !(
  5498. (milliseconds >= 0 && days >= 0 && months >= 0) ||
  5499. (milliseconds <= 0 && days <= 0 && months <= 0)
  5500. )
  5501. ) {
  5502. milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
  5503. days = 0;
  5504. months = 0;
  5505. }
  5506. // The following code bubbles up values, see the tests for
  5507. // examples of what that means.
  5508. data.milliseconds = milliseconds % 1000;
  5509. seconds = absFloor(milliseconds / 1000);
  5510. data.seconds = seconds % 60;
  5511. minutes = absFloor(seconds / 60);
  5512. data.minutes = minutes % 60;
  5513. hours = absFloor(minutes / 60);
  5514. data.hours = hours % 24;
  5515. days += absFloor(hours / 24);
  5516. // convert days to months
  5517. monthsFromDays = absFloor(daysToMonths(days));
  5518. months += monthsFromDays;
  5519. days -= absCeil(monthsToDays(monthsFromDays));
  5520. // 12 months -> 1 year
  5521. years = absFloor(months / 12);
  5522. months %= 12;
  5523. data.days = days;
  5524. data.months = months;
  5525. data.years = years;
  5526. return this;
  5527. }
  5528. function daysToMonths(days) {
  5529. // 400 years have 146097 days (taking into account leap year rules)
  5530. // 400 years have 12 months === 4800
  5531. return (days * 4800) / 146097;
  5532. }
  5533. function monthsToDays(months) {
  5534. // the reverse of daysToMonths
  5535. return (months * 146097) / 4800;
  5536. }
  5537. function as(units) {
  5538. if (!this.isValid()) {
  5539. return NaN;
  5540. }
  5541. var days,
  5542. months,
  5543. milliseconds = this._milliseconds;
  5544. units = normalizeUnits(units);
  5545. if (units === 'month' || units === 'quarter' || units === 'year') {
  5546. days = this._days + milliseconds / 864e5;
  5547. months = this._months + daysToMonths(days);
  5548. switch (units) {
  5549. case 'month':
  5550. return months;
  5551. case 'quarter':
  5552. return months / 3;
  5553. case 'year':
  5554. return months / 12;
  5555. }
  5556. } else {
  5557. // handle milliseconds separately because of floating point math errors (issue #1867)
  5558. days = this._days + Math.round(monthsToDays(this._months));
  5559. switch (units) {
  5560. case 'week':
  5561. return days / 7 + milliseconds / 6048e5;
  5562. case 'day':
  5563. return days + milliseconds / 864e5;
  5564. case 'hour':
  5565. return days * 24 + milliseconds / 36e5;
  5566. case 'minute':
  5567. return days * 1440 + milliseconds / 6e4;
  5568. case 'second':
  5569. return days * 86400 + milliseconds / 1000;
  5570. // Math.floor prevents floating point math errors here
  5571. case 'millisecond':
  5572. return Math.floor(days * 864e5) + milliseconds;
  5573. default:
  5574. throw new Error('Unknown unit ' + units);
  5575. }
  5576. }
  5577. }
  5578. // TODO: Use this.as('ms')?
  5579. function valueOf$1() {
  5580. if (!this.isValid()) {
  5581. return NaN;
  5582. }
  5583. return (
  5584. this._milliseconds +
  5585. this._days * 864e5 +
  5586. (this._months % 12) * 2592e6 +
  5587. toInt(this._months / 12) * 31536e6
  5588. );
  5589. }
  5590. function makeAs(alias) {
  5591. return function () {
  5592. return this.as(alias);
  5593. };
  5594. }
  5595. var asMilliseconds = makeAs('ms'),
  5596. asSeconds = makeAs('s'),
  5597. asMinutes = makeAs('m'),
  5598. asHours = makeAs('h'),
  5599. asDays = makeAs('d'),
  5600. asWeeks = makeAs('w'),
  5601. asMonths = makeAs('M'),
  5602. asQuarters = makeAs('Q'),
  5603. asYears = makeAs('y');
  5604. function clone$1() {
  5605. return createDuration(this);
  5606. }
  5607. function get$2(units) {
  5608. units = normalizeUnits(units);
  5609. return this.isValid() ? this[units + 's']() : NaN;
  5610. }
  5611. function makeGetter(name) {
  5612. return function () {
  5613. return this.isValid() ? this._data[name] : NaN;
  5614. };
  5615. }
  5616. var milliseconds = makeGetter('milliseconds'),
  5617. seconds = makeGetter('seconds'),
  5618. minutes = makeGetter('minutes'),
  5619. hours = makeGetter('hours'),
  5620. days = makeGetter('days'),
  5621. months = makeGetter('months'),
  5622. years = makeGetter('years');
  5623. function weeks() {
  5624. return absFloor(this.days() / 7);
  5625. }
  5626. var round = Math.round,
  5627. thresholds = {
  5628. ss: 44, // a few seconds to seconds
  5629. s: 45, // seconds to minute
  5630. m: 45, // minutes to hour
  5631. h: 22, // hours to day
  5632. d: 26, // days to month/week
  5633. w: null, // weeks to month
  5634. M: 11, // months to year
  5635. };
  5636. // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
  5637. function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
  5638. return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
  5639. }
  5640. function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {
  5641. var duration = createDuration(posNegDuration).abs(),
  5642. seconds = round(duration.as('s')),
  5643. minutes = round(duration.as('m')),
  5644. hours = round(duration.as('h')),
  5645. days = round(duration.as('d')),
  5646. months = round(duration.as('M')),
  5647. weeks = round(duration.as('w')),
  5648. years = round(duration.as('y')),
  5649. a =
  5650. (seconds <= thresholds.ss && ['s', seconds]) ||
  5651. (seconds < thresholds.s && ['ss', seconds]) ||
  5652. (minutes <= 1 && ['m']) ||
  5653. (minutes < thresholds.m && ['mm', minutes]) ||
  5654. (hours <= 1 && ['h']) ||
  5655. (hours < thresholds.h && ['hh', hours]) ||
  5656. (days <= 1 && ['d']) ||
  5657. (days < thresholds.d && ['dd', days]);
  5658. if (thresholds.w != null) {
  5659. a =
  5660. a ||
  5661. (weeks <= 1 && ['w']) ||
  5662. (weeks < thresholds.w && ['ww', weeks]);
  5663. }
  5664. a = a ||
  5665. (months <= 1 && ['M']) ||
  5666. (months < thresholds.M && ['MM', months]) ||
  5667. (years <= 1 && ['y']) || ['yy', years];
  5668. a[2] = withoutSuffix;
  5669. a[3] = +posNegDuration > 0;
  5670. a[4] = locale;
  5671. return substituteTimeAgo.apply(null, a);
  5672. }
  5673. // This function allows you to set the rounding function for relative time strings
  5674. function getSetRelativeTimeRounding(roundingFunction) {
  5675. if (roundingFunction === undefined) {
  5676. return round;
  5677. }
  5678. if (typeof roundingFunction === 'function') {
  5679. round = roundingFunction;
  5680. return true;
  5681. }
  5682. return false;
  5683. }
  5684. // This function allows you to set a threshold for relative time strings
  5685. function getSetRelativeTimeThreshold(threshold, limit) {
  5686. if (thresholds[threshold] === undefined) {
  5687. return false;
  5688. }
  5689. if (limit === undefined) {
  5690. return thresholds[threshold];
  5691. }
  5692. thresholds[threshold] = limit;
  5693. if (threshold === 's') {
  5694. thresholds.ss = limit - 1;
  5695. }
  5696. return true;
  5697. }
  5698. function humanize(argWithSuffix, argThresholds) {
  5699. if (!this.isValid()) {
  5700. return this.localeData().invalidDate();
  5701. }
  5702. var withSuffix = false,
  5703. th = thresholds,
  5704. locale,
  5705. output;
  5706. if (typeof argWithSuffix === 'object') {
  5707. argThresholds = argWithSuffix;
  5708. argWithSuffix = false;
  5709. }
  5710. if (typeof argWithSuffix === 'boolean') {
  5711. withSuffix = argWithSuffix;
  5712. }
  5713. if (typeof argThresholds === 'object') {
  5714. th = Object.assign({}, thresholds, argThresholds);
  5715. if (argThresholds.s != null && argThresholds.ss == null) {
  5716. th.ss = argThresholds.s - 1;
  5717. }
  5718. }
  5719. locale = this.localeData();
  5720. output = relativeTime$1(this, !withSuffix, th, locale);
  5721. if (withSuffix) {
  5722. output = locale.pastFuture(+this, output);
  5723. }
  5724. return locale.postformat(output);
  5725. }
  5726. var abs$1 = Math.abs;
  5727. function sign(x) {
  5728. return (x > 0) - (x < 0) || +x;
  5729. }
  5730. function toISOString$1() {
  5731. // for ISO strings we do not use the normal bubbling rules:
  5732. // * milliseconds bubble up until they become hours
  5733. // * days do not bubble at all
  5734. // * months bubble up until they become years
  5735. // This is because there is no context-free conversion between hours and days
  5736. // (think of clock changes)
  5737. // and also not between days and months (28-31 days per month)
  5738. if (!this.isValid()) {
  5739. return this.localeData().invalidDate();
  5740. }
  5741. var seconds = abs$1(this._milliseconds) / 1000,
  5742. days = abs$1(this._days),
  5743. months = abs$1(this._months),
  5744. minutes,
  5745. hours,
  5746. years,
  5747. s,
  5748. total = this.asSeconds(),
  5749. totalSign,
  5750. ymSign,
  5751. daysSign,
  5752. hmsSign;
  5753. if (!total) {
  5754. // this is the same as C#'s (Noda) and python (isodate)...
  5755. // but not other JS (goog.date)
  5756. return 'P0D';
  5757. }
  5758. // 3600 seconds -> 60 minutes -> 1 hour
  5759. minutes = absFloor(seconds / 60);
  5760. hours = absFloor(minutes / 60);
  5761. seconds %= 60;
  5762. minutes %= 60;
  5763. // 12 months -> 1 year
  5764. years = absFloor(months / 12);
  5765. months %= 12;
  5766. // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
  5767. s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
  5768. totalSign = total < 0 ? '-' : '';
  5769. ymSign = sign(this._months) !== sign(total) ? '-' : '';
  5770. daysSign = sign(this._days) !== sign(total) ? '-' : '';
  5771. hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
  5772. return (
  5773. totalSign +
  5774. 'P' +
  5775. (years ? ymSign + years + 'Y' : '') +
  5776. (months ? ymSign + months + 'M' : '') +
  5777. (days ? daysSign + days + 'D' : '') +
  5778. (hours || minutes || seconds ? 'T' : '') +
  5779. (hours ? hmsSign + hours + 'H' : '') +
  5780. (minutes ? hmsSign + minutes + 'M' : '') +
  5781. (seconds ? hmsSign + s + 'S' : '')
  5782. );
  5783. }
  5784. var proto$2 = Duration.prototype;
  5785. proto$2.isValid = isValid$1;
  5786. proto$2.abs = abs;
  5787. proto$2.add = add$1;
  5788. proto$2.subtract = subtract$1;
  5789. proto$2.as = as;
  5790. proto$2.asMilliseconds = asMilliseconds;
  5791. proto$2.asSeconds = asSeconds;
  5792. proto$2.asMinutes = asMinutes;
  5793. proto$2.asHours = asHours;
  5794. proto$2.asDays = asDays;
  5795. proto$2.asWeeks = asWeeks;
  5796. proto$2.asMonths = asMonths;
  5797. proto$2.asQuarters = asQuarters;
  5798. proto$2.asYears = asYears;
  5799. proto$2.valueOf = valueOf$1;
  5800. proto$2._bubble = bubble;
  5801. proto$2.clone = clone$1;
  5802. proto$2.get = get$2;
  5803. proto$2.milliseconds = milliseconds;
  5804. proto$2.seconds = seconds;
  5805. proto$2.minutes = minutes;
  5806. proto$2.hours = hours;
  5807. proto$2.days = days;
  5808. proto$2.weeks = weeks;
  5809. proto$2.months = months;
  5810. proto$2.years = years;
  5811. proto$2.humanize = humanize;
  5812. proto$2.toISOString = toISOString$1;
  5813. proto$2.toString = toISOString$1;
  5814. proto$2.toJSON = toISOString$1;
  5815. proto$2.locale = locale;
  5816. proto$2.localeData = localeData;
  5817. proto$2.toIsoString = deprecate(
  5818. 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',
  5819. toISOString$1
  5820. );
  5821. proto$2.lang = lang;
  5822. // FORMATTING
  5823. addFormatToken('X', 0, 0, 'unix');
  5824. addFormatToken('x', 0, 0, 'valueOf');
  5825. // PARSING
  5826. addRegexToken('x', matchSigned);
  5827. addRegexToken('X', matchTimestamp);
  5828. addParseToken('X', function (input, array, config) {
  5829. config._d = new Date(parseFloat(input) * 1000);
  5830. });
  5831. addParseToken('x', function (input, array, config) {
  5832. config._d = new Date(toInt(input));
  5833. });
  5834. //! moment.js
  5835. hooks.version = '2.29.3';
  5836. setHookCallback(createLocal);
  5837. hooks.fn = proto;
  5838. hooks.min = min;
  5839. hooks.max = max;
  5840. hooks.now = now;
  5841. hooks.utc = createUTC;
  5842. hooks.unix = createUnix;
  5843. hooks.months = listMonths;
  5844. hooks.isDate = isDate;
  5845. hooks.locale = getSetGlobalLocale;
  5846. hooks.invalid = createInvalid;
  5847. hooks.duration = createDuration;
  5848. hooks.isMoment = isMoment;
  5849. hooks.weekdays = listWeekdays;
  5850. hooks.parseZone = createInZone;
  5851. hooks.localeData = getLocale;
  5852. hooks.isDuration = isDuration;
  5853. hooks.monthsShort = listMonthsShort;
  5854. hooks.weekdaysMin = listWeekdaysMin;
  5855. hooks.defineLocale = defineLocale;
  5856. hooks.updateLocale = updateLocale;
  5857. hooks.locales = listLocales;
  5858. hooks.weekdaysShort = listWeekdaysShort;
  5859. hooks.normalizeUnits = normalizeUnits;
  5860. hooks.relativeTimeRounding = getSetRelativeTimeRounding;
  5861. hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
  5862. hooks.calendarFormat = getCalendarFormat;
  5863. hooks.prototype = proto;
  5864. // currently HTML5 input type only supports 24-hour formats
  5865. hooks.HTML5_FMT = {
  5866. DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
  5867. DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
  5868. DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
  5869. DATE: 'YYYY-MM-DD', // <input type="date" />
  5870. TIME: 'HH:mm', // <input type="time" />
  5871. TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
  5872. TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
  5873. WEEK: 'GGGG-[W]WW', // <input type="week" />
  5874. MONTH: 'YYYY-MM', // <input type="month" />
  5875. };
  5876. return hooks;
  5877. })));
  5878. define('moment', ['moment/moment'], function (main) { return main; });
  5879. define('backend',['fast', 'template', 'moment'], function (Fast, Template, Moment) {
  5880. var Backend = {
  5881. api: {
  5882. sidebar: function (params) {
  5883. colorArr = ['red', 'green', 'yellow', 'blue', 'teal', 'orange', 'purple'];
  5884. $colorNums = colorArr.length;
  5885. badgeList = {};
  5886. $.each(params, function (k, v) {
  5887. $url = Fast.api.fixurl(k);
  5888. if ($.isArray(v)) {
  5889. $nums = typeof v[0] !== 'undefined' ? v[0] : 0;
  5890. $color = typeof v[1] !== 'undefined' ? v[1] : colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  5891. $class = typeof v[2] !== 'undefined' ? v[2] : 'label';
  5892. } else {
  5893. $nums = v;
  5894. $color = colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  5895. $class = 'label';
  5896. }
  5897. //必须nums大于0才显示
  5898. badgeList[$url] = $nums > 0 ? '<small class="' + $class + ' pull-right bg-' + $color + '">' + $nums + '</small>' : '';
  5899. });
  5900. $.each(badgeList, function (k, v) {
  5901. var anchor = top.window.$("li a[addtabs][url='" + k + "']");
  5902. if (anchor) {
  5903. top.window.$(".pull-right-container", anchor).html(v);
  5904. top.window.$(".nav-addtabs li a[node-id='" + anchor.attr("addtabs") + "'] .pull-right-container").html(v);
  5905. }
  5906. });
  5907. },
  5908. addtabs: function (url, title, icon) {
  5909. var dom = "a[url='{url}']"
  5910. var leftlink = top.window.$(dom.replace(/\{url\}/, url));
  5911. if (leftlink.length > 0) {
  5912. leftlink.trigger("click");
  5913. } else {
  5914. url = Fast.api.fixurl(url);
  5915. leftlink = top.window.$(dom.replace(/\{url\}/, url));
  5916. if (leftlink.length > 0) {
  5917. var event = leftlink.parent().hasClass("active") ? "dblclick" : "click";
  5918. leftlink.trigger(event);
  5919. } else {
  5920. var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
  5921. leftlink = top.window.$(dom.replace(/\{url\}/, baseurl));
  5922. //能找到相对地址
  5923. if (leftlink.length > 0) {
  5924. icon = typeof icon !== 'undefined' ? icon : leftlink.find("i").attr("class");
  5925. title = typeof title !== 'undefined' ? title : leftlink.find("span:first").text();
  5926. leftlink.trigger("fa.event.toggleitem");
  5927. }
  5928. var navnode = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
  5929. if (navnode.length > 0) {
  5930. navnode.trigger("click");
  5931. } else {
  5932. //追加新的tab
  5933. var id = Math.floor(new Date().valueOf() * Math.random());
  5934. icon = typeof icon !== 'undefined' ? icon : 'fa fa-circle-o';
  5935. title = typeof title !== 'undefined' ? title : '';
  5936. top.window.$("<a />").append('<i class="' + icon + '"></i> <span>' + title + '</span>').prop("href", url).attr({
  5937. url: url,
  5938. addtabs: id
  5939. }).addClass("hide").appendTo(top.window.document.body).trigger("click");
  5940. }
  5941. }
  5942. }
  5943. },
  5944. closetabs: function (url) {
  5945. if (typeof url === 'undefined') {
  5946. top.window.$("ul.nav-addtabs li.active .close-tab").trigger("click");
  5947. } else {
  5948. var dom = "a[url='{url}']"
  5949. var navlink = top.window.$(dom.replace(/\{url\}/, url));
  5950. if (navlink.length === 0) {
  5951. url = Fast.api.fixurl(url);
  5952. navlink = top.window.$(dom.replace(/\{url\}/, url));
  5953. if (navlink.length === 0) {
  5954. } else {
  5955. var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
  5956. navlink = top.window.$(dom.replace(/\{url\}/, baseurl));
  5957. //能找到相对地址
  5958. if (navlink.length === 0) {
  5959. navlink = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
  5960. }
  5961. }
  5962. }
  5963. if (navlink.length > 0 && navlink.attr('addtabs')) {
  5964. top.window.$("ul.nav-addtabs li#tab_" + navlink.attr('addtabs') + " .close-tab").trigger("click");
  5965. }
  5966. }
  5967. },
  5968. replaceids: function (elem, url) {
  5969. //如果有需要替换ids的
  5970. if (url.indexOf("{ids}") > -1) {
  5971. var ids = 0;
  5972. var tableId = $(elem).data("table-id");
  5973. if (tableId && $("#" + tableId).length > 0 && $("#" + tableId).data("bootstrap.table")) {
  5974. var Table = require("table");
  5975. ids = Table.api.selectedids($("#" + tableId)).join(",");
  5976. }
  5977. url = url.replace(/\{ids\}/g, ids);
  5978. }
  5979. return url;
  5980. },
  5981. refreshmenu: function () {
  5982. top.window.$(".sidebar-menu").trigger("refresh");
  5983. },
  5984. gettablecolumnbutton: function (options) {
  5985. if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
  5986. var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
  5987. if (tableOptions) {
  5988. var columnObj = null;
  5989. $.each(tableOptions.columns, function (i, columns) {
  5990. $.each(columns, function (j, column) {
  5991. if (typeof column.fieldIndex !== 'undefined' && column.fieldIndex === options.fieldIndex) {
  5992. columnObj = column;
  5993. return false;
  5994. }
  5995. });
  5996. if (columnObj) {
  5997. return false;
  5998. }
  5999. });
  6000. if (columnObj) {
  6001. return columnObj['buttons'][options.buttonIndex];
  6002. }
  6003. }
  6004. }
  6005. return null;
  6006. },
  6007. },
  6008. init: function () {
  6009. //公共代码
  6010. //添加ios-fix兼容iOS下的iframe
  6011. if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
  6012. $("html").addClass("ios-fix");
  6013. }
  6014. //配置Toastr的参数
  6015. Toastr.options.positionClass = Config.controllername === 'index' ? "toast-top-right-index" : "toast-top-right";
  6016. //点击包含.btn-dialog的元素时弹出dialog
  6017. $(document).on('click', '.btn-dialog,.dialogit', function (e) {
  6018. var that = this;
  6019. var options = $.extend({}, $(that).data() || {});
  6020. var url = Backend.api.replaceids(that, $(that).data("url") || $(that).attr('href'));
  6021. var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
  6022. var button = Backend.api.gettablecolumnbutton(options);
  6023. if (button && typeof button.callback === 'function') {
  6024. options.callback = button.callback;
  6025. }
  6026. if (typeof options.confirm !== 'undefined') {
  6027. Layer.confirm(options.confirm, function (index) {
  6028. Backend.api.open(url, title, options);
  6029. Layer.close(index);
  6030. });
  6031. } else {
  6032. window[$(that).data("window") || 'self'].Backend.api.open(url, title, options);
  6033. }
  6034. return false;
  6035. });
  6036. //点击包含.btn-addtabs的元素时新增选项卡
  6037. $(document).on('click', '.btn-addtabs,.addtabsit', function (e) {
  6038. var that = this;
  6039. var options = $.extend({}, $(that).data() || {});
  6040. var url = Backend.api.replaceids(that, $(that).data("url") || $(that).attr('href'));
  6041. var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
  6042. var icon = $(that).attr("icon") || $(that).data("icon");
  6043. if (typeof options.confirm !== 'undefined') {
  6044. Layer.confirm(options.confirm, function (index) {
  6045. Backend.api.addtabs(url, title, icon);
  6046. Layer.close(index);
  6047. });
  6048. } else {
  6049. Backend.api.addtabs(url, title, icon);
  6050. }
  6051. return false;
  6052. });
  6053. //点击包含.btn-ajax的元素时发送Ajax请求
  6054. $(document).on('click', '.btn-ajax,.ajaxit', function (e) {
  6055. var that = this;
  6056. var options = $.extend({}, $(that).data() || {});
  6057. if (typeof options.url === 'undefined' && $(that).attr("href")) {
  6058. options.url = $(that).attr("href");
  6059. }
  6060. options.url = Backend.api.replaceids(this, options.url);
  6061. var success = typeof options.success === 'function' ? options.success : null;
  6062. var error = typeof options.error === 'function' ? options.error : null;
  6063. delete options.success;
  6064. delete options.error;
  6065. var button = Backend.api.gettablecolumnbutton(options);
  6066. if (button) {
  6067. if (typeof button.success === 'function') {
  6068. success = button.success;
  6069. }
  6070. if (typeof button.error === 'function') {
  6071. error = button.error;
  6072. }
  6073. }
  6074. //如果未设备成功的回调,设定了自动刷新的情况下自动进行刷新
  6075. if (!success && typeof options.tableId !== 'undefined' && typeof options.refresh !== 'undefined' && options.refresh) {
  6076. success = function () {
  6077. $("#" + options.tableId).bootstrapTable('refresh');
  6078. }
  6079. }
  6080. if (typeof options.confirm !== 'undefined') {
  6081. Layer.confirm(options.confirm, function (index) {
  6082. Backend.api.ajax(options, success, error);
  6083. Layer.close(index);
  6084. });
  6085. } else {
  6086. Backend.api.ajax(options, success, error);
  6087. }
  6088. return false;
  6089. });
  6090. $(document).on('click', '.btn-click,.clickit', function (e) {
  6091. var that = this;
  6092. var options = $.extend({}, $(that).data() || {});
  6093. var row = {};
  6094. if (typeof options.tableId !== 'undefined') {
  6095. var index = parseInt(options.rowIndex);
  6096. var data = $("#" + options.tableId).bootstrapTable('getData');
  6097. row = typeof data[index] !== 'undefined' ? data[index] : {};
  6098. }
  6099. var button = Backend.api.gettablecolumnbutton(options);
  6100. var click = typeof button.click === 'function' ? button.click : $.noop;
  6101. if (typeof options.confirm !== 'undefined') {
  6102. Layer.confirm(options.confirm, function (index) {
  6103. click.apply(that, [options, row, button]);
  6104. Layer.close(index);
  6105. });
  6106. } else {
  6107. click.apply(that, [options, row, button]);
  6108. }
  6109. return false;
  6110. });
  6111. //修复含有fixed-footer类的body边距
  6112. if ($(".fixed-footer").length > 0) {
  6113. $(document.body).css("padding-bottom", $(".fixed-footer").outerHeight());
  6114. }
  6115. //修复不在iframe时layer-footer隐藏的问题
  6116. if ($(".layer-footer").length > 0 && self === top) {
  6117. $(".layer-footer").show();
  6118. }
  6119. //tooltip和popover
  6120. if (!('ontouchstart' in document.documentElement)) {
  6121. $('body').tooltip({selector: '[data-toggle="tooltip"]'});
  6122. }
  6123. $('body').popover({selector: '[data-toggle="popover"]'});
  6124. }
  6125. };
  6126. Backend.api = $.extend(Fast.api, Backend.api);
  6127. //将Template渲染至全局,以便于在子框架中调用
  6128. window.Template = Template;
  6129. //将Moment渲染至全局,以便于在子框架中调用
  6130. window.Moment = Moment;
  6131. //将Backend渲染至全局,以便于在子框架中调用
  6132. window.Backend = Backend;
  6133. Backend.init();
  6134. return Backend;
  6135. });
  6136. define('backend-init',['backend'], function (Backend) {
  6137. });
  6138. //! moment.js locale configuration
  6139. //! locale : Chinese (China) [zh-cn]
  6140. //! author : suupic : https://github.com/suupic
  6141. //! author : Zeno Zeng : https://github.com/zenozeng
  6142. //! author : uu109 : https://github.com/uu109
  6143. ;(function (global, factory) {
  6144. typeof exports === 'object' && typeof module !== 'undefined'
  6145. && typeof require === 'function' ? factory(require('../moment')) :
  6146. typeof define === 'function' && define.amd ? define('moment/locale/zh-cn',['../moment'], factory) :
  6147. factory(global.moment)
  6148. }(this, (function (moment) { 'use strict';
  6149. //! moment.js locale configuration
  6150. var zhCn = moment.defineLocale('zh-cn', {
  6151. months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split(
  6152. '_'
  6153. ),
  6154. monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
  6155. '_'
  6156. ),
  6157. weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  6158. weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  6159. weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
  6160. longDateFormat: {
  6161. LT: 'HH:mm',
  6162. LTS: 'HH:mm:ss',
  6163. L: 'YYYY/MM/DD',
  6164. LL: 'YYYY年M月D日',
  6165. LLL: 'YYYY年M月D日Ah点mm分',
  6166. LLLL: 'YYYY年M月D日ddddAh点mm分',
  6167. l: 'YYYY/M/D',
  6168. ll: 'YYYY年M月D日',
  6169. lll: 'YYYY年M月D日 HH:mm',
  6170. llll: 'YYYY年M月D日dddd HH:mm',
  6171. },
  6172. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  6173. meridiemHour: function (hour, meridiem) {
  6174. if (hour === 12) {
  6175. hour = 0;
  6176. }
  6177. if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
  6178. return hour;
  6179. } else if (meridiem === '下午' || meridiem === '晚上') {
  6180. return hour + 12;
  6181. } else {
  6182. // '中午'
  6183. return hour >= 11 ? hour : hour + 12;
  6184. }
  6185. },
  6186. meridiem: function (hour, minute, isLower) {
  6187. var hm = hour * 100 + minute;
  6188. if (hm < 600) {
  6189. return '凌晨';
  6190. } else if (hm < 900) {
  6191. return '早上';
  6192. } else if (hm < 1130) {
  6193. return '上午';
  6194. } else if (hm < 1230) {
  6195. return '中午';
  6196. } else if (hm < 1800) {
  6197. return '下午';
  6198. } else {
  6199. return '晚上';
  6200. }
  6201. },
  6202. calendar: {
  6203. sameDay: '[今天]LT',
  6204. nextDay: '[明天]LT',
  6205. nextWeek: function (now) {
  6206. if (now.week() !== this.week()) {
  6207. return '[下]dddLT';
  6208. } else {
  6209. return '[本]dddLT';
  6210. }
  6211. },
  6212. lastDay: '[昨天]LT',
  6213. lastWeek: function (now) {
  6214. if (this.week() !== now.week()) {
  6215. return '[上]dddLT';
  6216. } else {
  6217. return '[本]dddLT';
  6218. }
  6219. },
  6220. sameElse: 'L',
  6221. },
  6222. dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
  6223. ordinal: function (number, period) {
  6224. switch (period) {
  6225. case 'd':
  6226. case 'D':
  6227. case 'DDD':
  6228. return number + '日';
  6229. case 'M':
  6230. return number + '月';
  6231. case 'w':
  6232. case 'W':
  6233. return number + '周';
  6234. default:
  6235. return number;
  6236. }
  6237. },
  6238. relativeTime: {
  6239. future: '%s后',
  6240. past: '%s前',
  6241. s: '几秒',
  6242. ss: '%d 秒',
  6243. m: '1 分钟',
  6244. mm: '%d 分钟',
  6245. h: '1 小时',
  6246. hh: '%d 小时',
  6247. d: '1 天',
  6248. dd: '%d 天',
  6249. w: '1 周',
  6250. ww: '%d 周',
  6251. M: '1 个月',
  6252. MM: '%d 个月',
  6253. y: '1 年',
  6254. yy: '%d 年',
  6255. },
  6256. week: {
  6257. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  6258. dow: 1, // Monday is the first day of the week.
  6259. doy: 4, // The week that contains Jan 4th is the first week of the year.
  6260. },
  6261. });
  6262. return zhCn;
  6263. })));
  6264. (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);
  6265. define("bootstrap-table", ["bootstrap"], (function (global) {
  6266. return function () {
  6267. var ret, fn;
  6268. return ret || global.$.fn.bootstrapTable;
  6269. };
  6270. }(this)));
  6271. /**
  6272. * Bootstrap Table Chinese translation
  6273. * Author: Zhixin Wen<wenzhixin2010@gmail.com>
  6274. */
  6275. (function ($) {
  6276. 'use strict';
  6277. $.fn.bootstrapTable.locales['zh-CN'] = {
  6278. formatLoadingMessage: function () {
  6279. return '正在努力地加载数据中,请稍候……';
  6280. },
  6281. formatRecordsPerPage: function (pageNumber) {
  6282. return '每页显示 ' + pageNumber + ' 条记录';
  6283. },
  6284. formatShowingRows: function (pageFrom, pageTo, totalRows) {
  6285. return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
  6286. },
  6287. formatSearch: function () {
  6288. return '搜索';
  6289. },
  6290. formatNoMatches: function () {
  6291. return '没有找到匹配的记录';
  6292. },
  6293. formatPaginationSwitch: function () {
  6294. return '隐藏/显示分页';
  6295. },
  6296. formatRefresh: function () {
  6297. return '刷新';
  6298. },
  6299. formatToggle: function () {
  6300. return '切换';
  6301. },
  6302. formatColumns: function () {
  6303. return '列';
  6304. },
  6305. formatExport: function () {
  6306. return '导出数据';
  6307. },
  6308. formatClearFilters: function () {
  6309. return '清空过滤';
  6310. }
  6311. };
  6312. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
  6313. })(jQuery);
  6314. define("bootstrap-table-lang", ["bootstrap-table"], (function (global) {
  6315. return function () {
  6316. var ret, fn;
  6317. return ret || global.$.fn.bootstrapTable.defaults;
  6318. };
  6319. }(this)));
  6320. /*
  6321. tableExport.jquery.plugin
  6322. Version 1.10.26
  6323. Copyright (c) 2015-2021 hhurz, https://github.com/hhurz/tableExport.jquery.plugin
  6324. Based on https://github.com/kayalshri/tableExport.jquery.plugin
  6325. Licensed under the MIT License
  6326. */
  6327. 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)};
  6328. $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})}};
  6329. $jscomp.polyfill("Array.prototype.find",function(d){return d?d:function(d,y){return $jscomp.findInternal(this,d,y).v}},"es6","es3");
  6330. (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})}
  6331. 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&&
  6332. "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&&
  6333. "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&&
  6334. (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&&
  6335. 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+=
  6336. 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,
  6337. 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,
  6338. 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&&
  6339. (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]);
  6340. (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")&&
  6341. (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)+
  6342. 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=
  6343. 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)}}
  6344. 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;
  6345. 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";
  6346. 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+=
  6347. 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&&""!==
  6348. 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,
  6349. "")});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:
  6350. "")+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))&&
  6351. (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=
  6352. 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=
  6353. 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,
  6354. 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/
  6355. 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,
  6356. "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();
  6357. 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,")?
  6358. 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"===
  6359. 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)+
  6360. "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",
  6361. 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",
  6362. 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",
  6363. 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,
  6364. 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,
  6365. 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&&
  6366. (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&&
  6367. "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+=
  6368. "\\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,
  6369. 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++});
  6370. 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"),
  6371. "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=
  6372. "";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,
  6373. 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=
  6374. 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;
  6375. 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=
  6376. 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'+
  6377. 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);
  6378. 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>'+
  6379. (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';
  6380. 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"===
  6381. 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,
  6382. 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&&
  6383. (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:"")+'")'});
  6384. 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:
  6385. 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+
  6386. 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:'+
  6387. 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,
  6388. 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+
  6389. 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)"!==
  6390. 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" '+
  6391. 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+=
  6392. "</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;}";
  6393. 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),
  6394. 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,
  6395. 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,
  6396. 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})});
  6397. "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=
  6398. "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,
  6399. 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=
  6400. 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=
  6401. 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&&
  6402. !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&&
  6403. (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*
  6404. 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))}});
  6405. "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&&
  6406. (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&&
  6407. !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=
  6408. 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,
  6409. 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),
  6410. 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();
  6411. return this}})(jQuery);
  6412. define("tableexport", ["jquery"], (function (global) {
  6413. return function () {
  6414. var ret, fn;
  6415. return ret || global.$.fn.extend;
  6416. };
  6417. }(this)));
  6418. !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);
  6419. define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (global) {
  6420. return function () {
  6421. var ret, fn;
  6422. return ret || global.$.fn.bootstrapTable.defaults;
  6423. };
  6424. }(this)));
  6425. (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});
  6426. define('upload',['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined, Dropzone, Template) {
  6427. var Upload = {
  6428. list: {},
  6429. options: {},
  6430. config: {
  6431. container: document.body,
  6432. classname: '.plupload:not([initialized]),.faupload:not([initialized])',
  6433. 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>',
  6434. },
  6435. events: {
  6436. //初始化
  6437. onInit: function () {
  6438. },
  6439. //上传成功的回调
  6440. onUploadSuccess: function (up, ret, file) {
  6441. var button = up.element;
  6442. var onUploadSuccess = up.options.onUploadSuccess;
  6443. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  6444. //上传成功后回调
  6445. if (button) {
  6446. //如果有文本框则填充
  6447. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  6448. if (input_id) {
  6449. var urlArr = [];
  6450. var inputObj = $("#" + input_id);
  6451. if ($(button).data("multiple") && inputObj.val() !== "") {
  6452. urlArr.push(inputObj.val());
  6453. }
  6454. var url = Config.upload.fullmode ? Fast.api.cdnurl(data.url) : data.url;
  6455. urlArr.push(url);
  6456. inputObj.val(urlArr.join(",")).trigger("change").trigger("validate");
  6457. }
  6458. //如果有回调函数
  6459. var onDomUploadSuccess = $(button).data("upload-success");
  6460. if (onDomUploadSuccess) {
  6461. if (typeof onDomUploadSuccess !== 'function' && typeof Upload.api.custom[onDomUploadSuccess] === 'function') {
  6462. onDomUploadSuccess = Upload.api.custom[onDomUploadSuccess];
  6463. }
  6464. if (typeof onDomUploadSuccess === 'function') {
  6465. var result = onDomUploadSuccess.call(button, data, ret);
  6466. if (result === false)
  6467. return;
  6468. }
  6469. }
  6470. }
  6471. if (typeof onUploadSuccess === 'function') {
  6472. var result = onUploadSuccess.call(button, data, ret);
  6473. if (result === false)
  6474. return;
  6475. }
  6476. },
  6477. //上传错误的回调
  6478. onUploadError: function (up, ret, file) {
  6479. var button = up.element;
  6480. var onUploadError = up.options.onUploadError;
  6481. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  6482. if (button) {
  6483. var onDomUploadError = $(button).data("upload-error");
  6484. if (onDomUploadError) {
  6485. if (typeof onDomUploadError !== 'function' && typeof Upload.api.custom[onDomUploadError] === 'function') {
  6486. onDomUploadError = Upload.api.custom[onDomUploadError];
  6487. }
  6488. if (typeof onDomUploadError === 'function') {
  6489. var result = onDomUploadError.call(button, data, ret);
  6490. if (result === false)
  6491. return;
  6492. }
  6493. }
  6494. }
  6495. if (typeof onUploadError === 'function') {
  6496. var result = onUploadError.call(button, data, ret);
  6497. if (result === false) {
  6498. return;
  6499. }
  6500. }
  6501. Toastr.error(ret.msg.toString().replace(/(<([^>]+)>)/gi, "") + "(code:" + ret.code + ")");
  6502. },
  6503. //服务器响应数据后
  6504. onUploadResponse: function (response, up, file) {
  6505. try {
  6506. var ret = typeof response === 'object' ? response : JSON.parse(response);
  6507. if (!ret.hasOwnProperty('code')) {
  6508. $.extend(ret, {code: -2, msg: response, data: null});
  6509. }
  6510. } catch (e) {
  6511. var ret = {code: -1, msg: e.message, data: null};
  6512. }
  6513. return ret;
  6514. },
  6515. //上传全部结束后
  6516. onUploadComplete: function (up, files) {
  6517. var button = up.element;
  6518. var onUploadComplete = up.options.onUploadComplete;
  6519. if (button) {
  6520. var onDomUploadComplete = $(button).data("upload-complete");
  6521. if (onDomUploadComplete) {
  6522. if (typeof onDomUploadComplete !== 'function' && typeof Upload.api.custom[onDomUploadComplete] === 'function') {
  6523. onDomUploadComplete = Upload.api.custom[onDomUploadComplete];
  6524. }
  6525. if (typeof onDomUploadComplete === 'function') {
  6526. var result = onDomUploadComplete.call(button, files);
  6527. if (result === false)
  6528. return;
  6529. }
  6530. }
  6531. }
  6532. if (typeof onUploadComplete === 'function') {
  6533. var result = onUploadComplete.call(button, files);
  6534. if (result === false) {
  6535. return;
  6536. }
  6537. }
  6538. }
  6539. },
  6540. api: {
  6541. //上传接口
  6542. upload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6543. element = typeof element === 'undefined' ? Upload.config.classname : element;
  6544. $(element, Upload.config.container).each(function () {
  6545. if ($(this).attr("initialized")) {
  6546. return true;
  6547. }
  6548. $(this).attr("initialized", true);
  6549. var that = this;
  6550. var id = $(this).prop("id") || $(this).prop("name") || Dropzone.uuidv4();
  6551. var url = $(this).data("url");
  6552. var maxsize = $(this).data("maxsize");
  6553. var maxcount = $(this).data("maxcount");
  6554. var mimetype = $(this).data("mimetype");
  6555. var multipart = $(this).data("multipart");
  6556. var multiple = $(this).data("multiple");
  6557. //填充ID
  6558. var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
  6559. //预览ID
  6560. var preview_id = $(that).data("preview-id") ? $(that).data("preview-id") : "";
  6561. //上传URL
  6562. url = url ? url : Config.upload.uploadurl;
  6563. url = Fast.api.fixurl(url);
  6564. var chunking = false, chunkSize = Config.upload.chunksize || 2097152, timeout = Config.upload.timeout || 600000;
  6565. //最大可上传文件大小
  6566. maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize;
  6567. //文件类型
  6568. mimetype = typeof mimetype !== "undefined" ? mimetype : Config.upload.mimetype;
  6569. //请求的表单参数
  6570. multipart = typeof multipart !== "undefined" ? multipart : Config.upload.multipart;
  6571. //是否支持批量上传
  6572. multiple = typeof multiple !== "undefined" ? multiple : Config.upload.multiple;
  6573. //后缀特殊处理
  6574. mimetype = mimetype.split(",").map(function (k) {
  6575. return k.indexOf("/") > -1 ? k : (!k || k === "*" || k.charAt(0) === "." ? k : "." + k);
  6576. }).join(",");
  6577. mimetype = mimetype === '*' ? null : mimetype;
  6578. //最大文件限制转换成mb
  6579. var maxFilesize = (function (maxsize) {
  6580. var matches = maxsize.toString().match(/^([0-9\.]+)(\w+)$/);
  6581. var size = matches ? parseFloat(matches[1]) : parseFloat(maxsize),
  6582. unit = matches ? matches[2].toLowerCase() : 'b';
  6583. var unitDict = {'b': 0, 'k': 1, 'kb': 1, 'm': 2, 'mb': 2, 'gb': 3, 'g': 3, 'tb': 4, 't': 4};
  6584. var y = typeof unitDict[unit] !== 'undefined' ? unitDict[unit] : 0;
  6585. var bytes = size * Math.pow(1024, y);
  6586. return bytes / Math.pow(1024, 2);
  6587. }(maxsize));
  6588. var options = $(this).data() || {};
  6589. options = $.extend(true, {}, options, $(this).data("upload-options") || {});
  6590. delete options.success;
  6591. delete options.url;
  6592. multipart = $.isArray(multipart) ? {} : multipart;
  6593. var params = $(this).data("params") || {};
  6594. var category = typeof params.category !== 'undefined' ? params.category : ($(this).data("category") || '');
  6595. if (category) {
  6596. // multipart.category = category;
  6597. }
  6598. Upload.list[id] = new Dropzone(this, $.extend({
  6599. url: url,
  6600. params: function (files, xhr, chunk) {
  6601. var params = multipart;
  6602. if (chunk) {
  6603. return $.extend({}, params, {
  6604. filesize: chunk.file.size,
  6605. filename: chunk.file.name,
  6606. chunkid: chunk.file.upload.uuid,
  6607. chunkindex: chunk.index,
  6608. chunkcount: chunk.file.upload.totalChunkCount,
  6609. chunksize: this.options.chunkSize,
  6610. chunkfilesize: chunk.dataBlock.data.size,
  6611. width: chunk.file.width || 0,
  6612. height: chunk.file.height || 0,
  6613. type: chunk.file.type,
  6614. });
  6615. }
  6616. return params;
  6617. },
  6618. chunking: chunking,
  6619. chunkSize: chunkSize,
  6620. maxFilesize: maxFilesize,
  6621. acceptedFiles: mimetype,
  6622. maxFiles: (maxcount && parseInt(maxcount) > 1 ? maxcount : (multiple ? null : 1)),
  6623. timeout: timeout,
  6624. parallelUploads: 1,
  6625. previewsContainer: false,
  6626. dictDefaultMessage: __("Drop files here to upload"),
  6627. dictFallbackMessage: __("Your browser does not support drag'n'drop file uploads"),
  6628. dictFallbackText: __("Please use the fallback form below to upload your files like in the olden days"),
  6629. dictFileTooBig: __("File is too big (%sMiB), Max filesize: %sMiB", "{{filesize}}", "{{maxFilesize}}"),
  6630. dictInvalidFileType: __("You can't upload files of this type"),
  6631. dictResponseError: __("Server responded with %s code.", "{{statusCode}}"),
  6632. dictCancelUpload: __("Cancel upload"),
  6633. dictUploadCanceled: __("Upload canceled"),
  6634. dictCancelUploadConfirmation: __("Are you sure you want to cancel this upload?"),
  6635. dictRemoveFile: __("Remove file"),
  6636. dictMaxFilesExceeded: __("You can only upload a maximum of %s files", "{{maxFiles}}"),
  6637. init: function () {
  6638. Upload.events.onInit.call(this);
  6639. //必须添加dz-message,否则点击icon无法唤起上传窗口
  6640. $(">i", this.element).addClass("dz-message");
  6641. this.options.elementHtml = $(this.element).html();
  6642. },
  6643. sending: function (file, xhr, formData) {
  6644. if (typeof file.category !== 'undefined') {
  6645. formData.append('category', file.category);
  6646. }
  6647. },
  6648. addedfile: function (file) {
  6649. var params = $(this.element).data("params") || {};
  6650. var category = typeof params.category !== 'undefined' ? params.category : ($(this.element).data("category") || '');
  6651. file.category = typeof category === 'function' ? category.call(this, file) : category;
  6652. },
  6653. addedfiles: function (files) {
  6654. if (this.options.maxFiles && (!this.options.maxFiles || this.options.maxFiles > 1) && this.options.inputId) {
  6655. var inputObj = $("#" + this.options.inputId);
  6656. if (inputObj.length > 0) {
  6657. var value = $.trim(inputObj.val());
  6658. var nums = value === '' ? 0 : value.split(/\,/).length;
  6659. var remain = this.options.maxFiles - nums;
  6660. if (remain === 0 || files.length > remain) {
  6661. files = Array.prototype.slice.call(files, remain);
  6662. for (var i = 0; i < files.length; i++) {
  6663. this.removeFile(files[i]);
  6664. }
  6665. Toastr.error(__("You can only upload a maximum of %s files", this.options.maxFiles));
  6666. }
  6667. }
  6668. }
  6669. },
  6670. success: function (file, response) {
  6671. var ret = Upload.events.onUploadResponse(response, this, file);
  6672. file.ret = ret;
  6673. if (ret.code === 1) {
  6674. Upload.events.onUploadSuccess(this, ret, file);
  6675. } else {
  6676. Upload.events.onUploadError(this, ret, file);
  6677. }
  6678. },
  6679. error: function (file, response, xhr) {
  6680. var responseObj = $("<div>" + (xhr && typeof xhr.responseText !== 'undefined' ? xhr.responseText : response) + "</div>");
  6681. responseObj.find("style, title, script").remove();
  6682. var msg = responseObj.text() || __('Network error');
  6683. var ret = {code: 0, data: null, msg: msg};
  6684. Upload.events.onUploadError(this, ret, file);
  6685. },
  6686. uploadprogress: function (file, progress, bytesSent) {
  6687. if (file.upload.chunked) {
  6688. $(this.element).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + Math.floor((file.upload.bytesSent / file.size) * 100) + "%");
  6689. }
  6690. },
  6691. totaluploadprogress: function (progress, bytesSent) {
  6692. if (this.getActiveFiles().length > 0 && !this.options.chunking) {
  6693. $(this.element).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + Math.floor(progress) + "%");
  6694. }
  6695. },
  6696. queuecomplete: function () {
  6697. Upload.events.onUploadComplete(this, this.files);
  6698. this.removeAllFiles(true);
  6699. $(this.element).prop("disabled", false).html(this.options.elementHtml);
  6700. },
  6701. chunkSuccess: function (chunk, file, response) {
  6702. },
  6703. chunksUploaded: function (file, done) {
  6704. var that = this;
  6705. Fast.api.ajax({
  6706. url: this.options.url,
  6707. data: $.extend({}, multipart, {
  6708. action: 'merge',
  6709. filesize: file.size,
  6710. filename: file.name,
  6711. chunkid: file.upload.uuid,
  6712. chunkcount: file.upload.totalChunkCount,
  6713. })
  6714. }, function (data, ret) {
  6715. done(JSON.stringify(ret));
  6716. return false;
  6717. }, function (data, ret) {
  6718. file.accepted = false;
  6719. that._errorProcessing([file], ret.msg);
  6720. });
  6721. },
  6722. onUploadSuccess: onUploadSuccess,
  6723. onUploadError: onUploadError,
  6724. onUploadComplete: onUploadComplete,
  6725. }, Upload.options, options));
  6726. //拖动排序
  6727. if (preview_id && multiple) {
  6728. require(['dragsort'], function () {
  6729. $("#" + preview_id).dragsort({
  6730. dragSelector: "li a:not(.btn-trash)",
  6731. dragEnd: function () {
  6732. $("#" + preview_id).trigger("fa.preview.change");
  6733. },
  6734. placeHolderTemplate: '<li class="col-xs-3"></li>'
  6735. });
  6736. });
  6737. }
  6738. //刷新隐藏textarea的值
  6739. var refresh = function (name) {
  6740. var data = {};
  6741. var textarea = $("textarea[name='" + name + "']");
  6742. var container = textarea.prev("ul");
  6743. $.each($("input,select,textarea", container).serializeArray(), function (i, j) {
  6744. var reg = /\[?(\w+)\]?\[(\w+)\]$/g;
  6745. var match = reg.exec(j.name);
  6746. if (!match)
  6747. return true;
  6748. if (!isNaN(match[2])) {
  6749. data[i] = j.value;
  6750. } else {
  6751. match[1] = "x" + parseInt(match[1]);
  6752. if (typeof data[match[1]] === 'undefined') {
  6753. data[match[1]] = {};
  6754. }
  6755. data[match[1]][match[2]] = j.value;
  6756. }
  6757. });
  6758. var result = [];
  6759. $.each(data, function (i, j) {
  6760. result.push(j);
  6761. });
  6762. textarea.val(JSON.stringify(result));
  6763. };
  6764. if (preview_id && input_id) {
  6765. $(document.body).on("keyup change", "#" + input_id, function (e) {
  6766. var inputStr = $("#" + input_id).val();
  6767. var inputArr = inputStr.split(/\,/);
  6768. $("#" + preview_id).empty();
  6769. var tpl = $("#" + preview_id).data("template") ? $("#" + preview_id).data("template") : "";
  6770. var extend = $("#" + preview_id).next().is("textarea") ? $("#" + preview_id).next("textarea").val() : "{}";
  6771. var json = {};
  6772. try {
  6773. json = JSON.parse(extend);
  6774. } catch (e) {
  6775. }
  6776. $.each(inputArr, function (i, j) {
  6777. if (!j) {
  6778. return true;
  6779. }
  6780. var suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(j);
  6781. suffix = suffix ? suffix[1] : 'file';
  6782. j = Config.upload.fullmode ? Fast.api.cdnurl(j) : j;
  6783. var value = (json && typeof json[i] !== 'undefined' ? json[i] : null);
  6784. var data = {url: j, fullurl: Fast.api.cdnurl(j), data: $(that).data(), key: i, index: i, value: value, row: value, suffix: suffix};
  6785. var html = tpl ? Template(tpl, data) : Template.render(Upload.config.previewtpl, data);
  6786. $("#" + preview_id).append(html);
  6787. });
  6788. refresh($("#" + preview_id).data("name"));
  6789. });
  6790. $("#" + input_id).trigger("change");
  6791. }
  6792. if (preview_id) {
  6793. //监听文本框改变事件
  6794. $("#" + preview_id).on('change keyup', "input,textarea,select", function () {
  6795. refresh($(this).closest("ul").data("name"));
  6796. });
  6797. // 监听事件
  6798. $(document.body).on("fa.preview.change", "#" + preview_id, function () {
  6799. var urlArr = [];
  6800. $("#" + preview_id + " [data-url]").each(function (i, j) {
  6801. urlArr.push($(this).data("url"));
  6802. });
  6803. if (input_id) {
  6804. $("#" + input_id).val(urlArr.join(","));
  6805. }
  6806. refresh($("#" + preview_id).data("name"));
  6807. });
  6808. // 移除按钮事件
  6809. $(document.body).on("click", "#" + preview_id + " .btn-trash", function () {
  6810. $(this).closest("li").remove();
  6811. $("#" + preview_id).trigger("fa.preview.change");
  6812. });
  6813. }
  6814. if (input_id) {
  6815. //粘贴上传、拖拽上传
  6816. $("body").on('paste drop', "#" + input_id, function (event) {
  6817. var originEvent = event.originalEvent;
  6818. var button = $(".plupload[data-input-id='" + $(this).attr("id") + "'],.faupload[data-input-id='" + $(this).attr("id") + "']");
  6819. if (event.type === 'paste' && originEvent.clipboardData && originEvent.clipboardData.items) {
  6820. var items = originEvent.clipboardData.items;
  6821. if ((items.length === 1 && items[0].type.indexOf("text") > -1) || (items.length === 2 && items[1].type.indexOf("text") > -1)) {
  6822. } else {
  6823. Upload.list[button.attr("id")].paste(originEvent);
  6824. return false;
  6825. }
  6826. }
  6827. if (event.type === 'drop' && originEvent.dataTransfer && originEvent.dataTransfer.files) {
  6828. Upload.list[button.attr("id")].drop(originEvent);
  6829. return false;
  6830. }
  6831. });
  6832. }
  6833. });
  6834. },
  6835. /**
  6836. * @deprecated Use upload instead.
  6837. */
  6838. plupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6839. return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete);
  6840. },
  6841. /**
  6842. * @deprecated Use upload instead.
  6843. */
  6844. faupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6845. return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete);
  6846. },
  6847. // AJAX异步上传
  6848. send: function (file, onUploadSuccess, onUploadError, onUploadComplete) {
  6849. var index = Layer.msg(__('Uploading'), {offset: 't', time: 0});
  6850. var id = "dropzone-" + Dropzone.uuidv4();
  6851. $('<button type="button" id="' + id + '" class="btn btn-danger hidden faupload" />').appendTo("body");
  6852. $("#" + id).data("upload-complete", function (files) {
  6853. Layer.close(index);
  6854. Upload.list[id].removeAllFiles(true);
  6855. });
  6856. Upload.api.upload("#" + id, onUploadSuccess, onUploadError, onUploadComplete);
  6857. setTimeout(function () {
  6858. Upload.list[id].addFile(file);
  6859. }, 1);
  6860. },
  6861. custom: {
  6862. //自定义上传完成回调
  6863. afteruploadcallback: function (response) {
  6864. console.log(this, response);
  6865. alert("Custom Callback,Response URL:" + response.url);
  6866. },
  6867. }
  6868. }
  6869. }
  6870. ;
  6871. return Upload;
  6872. });
  6873. /*! nice-validator 1.1.5
  6874. * (c) 2012-2020 Jony Zhang <niceue@live.com>, MIT Licensed
  6875. * https://github.com/niceue/nice-validator
  6876. */
  6877. ;(function(factory) {
  6878. typeof module === 'object' && module.exports ? module.exports = factory( require( 'jquery' ) ) :
  6879. typeof define === 'function' && define.amd ? define('validator',['jquery'], factory) :
  6880. factory(jQuery);
  6881. }(function($, undefined) {
  6882. 'use strict';
  6883. var NS = 'validator',
  6884. CLS_NS = '.' + NS,
  6885. CLS_NS_RULE = '.rule',
  6886. CLS_NS_FIELD = '.field',
  6887. CLS_NS_FORM = '.form',
  6888. CLS_WRAPPER = 'nice-' + NS,
  6889. CLS_MSG_BOX = 'msg-box',
  6890. ARIA_INVALID = 'aria-invalid',
  6891. DATA_RULE = 'data-rule',
  6892. DATA_MSG = 'data-msg',
  6893. DATA_TIP = 'data-tip',
  6894. DATA_OK = 'data-ok',
  6895. DATA_TIMELY = 'data-timely',
  6896. DATA_TARGET = 'data-target',
  6897. DATA_DISPLAY = 'data-display',
  6898. DATA_MUST = 'data-must',
  6899. NOVALIDATE = 'novalidate',
  6900. INPUT_SELECTOR = ':verifiable',
  6901. rRules = /(&)?(!)?\b(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?\s*(;|\|)?/g,
  6902. rRule = /(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?/,
  6903. rDisplay = /(?:([^:;\(\[]*):)?(.*)/,
  6904. rDoubleBytes = /[^\x00-\xff]/g,
  6905. rPos = /top|right|bottom|left/,
  6906. rAjaxType = /(?:(cors|jsonp):)?(?:(post|get):)?(.+)/i,
  6907. rUnsafe = /[<>'"`\\]|&#x?\d+[A-F]?;?|%3[A-F]/gmi,
  6908. noop = $.noop,
  6909. proxy = $.proxy,
  6910. trim = $.trim,
  6911. isFunction = $.isFunction,
  6912. isString = function(s) {
  6913. return typeof s === 'string';
  6914. },
  6915. isObject = function(o) {
  6916. return o && Object.prototype.toString.call(o) === '[object Object]';
  6917. },
  6918. isIE = document.documentMode || +(navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1),
  6919. attr = function(el, key, value) {
  6920. if (!el || !el.tagName) return null;
  6921. if (value !== undefined) {
  6922. if (value === null) el.removeAttribute(key);
  6923. else el.setAttribute(key, '' + value);
  6924. } else {
  6925. return el.getAttribute(key);
  6926. }
  6927. },
  6928. novalidateonce,
  6929. preinitialized = {},
  6930. defaults = {
  6931. debug: 0,
  6932. theme: 'default',
  6933. ignore: '',
  6934. focusInvalid: true,
  6935. focusCleanup: false,
  6936. stopOnError: false,
  6937. beforeSubmit: null,
  6938. valid: null,
  6939. invalid: null,
  6940. validation: null,
  6941. formClass: 'n-default',
  6942. validClass: 'n-valid',
  6943. invalidClass: 'n-invalid',
  6944. bindClassTo: null
  6945. },
  6946. fieldDefaults = {
  6947. timely: 1,
  6948. display: null,
  6949. target: null,
  6950. ignoreBlank: false,
  6951. showOk: true,
  6952. // Translate ajax response to validation result
  6953. dataFilter: function (data) {
  6954. if ( isString(data) || ( isObject(data) && ('error' in data || 'ok' in data) ) ) {
  6955. return data;
  6956. }
  6957. },
  6958. msgMaker: function(opt) {
  6959. var html;
  6960. html = '<span role="alert" class="msg-wrap n-'+ opt.type + '">' + opt.arrow;
  6961. if (opt.result) {
  6962. $.each(opt.result, function(i, obj){
  6963. html += '<span class="n-'+ obj.type +'">' + opt.icon + '<span class="n-msg">' + obj.msg + '</span></span>';
  6964. });
  6965. } else {
  6966. html += opt.icon + '<span class="n-msg">' + opt.msg + '</span>';
  6967. }
  6968. html += '</span>';
  6969. return html;
  6970. },
  6971. msgWrapper: 'span',
  6972. msgArrow: '',
  6973. msgIcon: '<span class="n-icon"></span>',
  6974. msgClass: 'n-right',
  6975. msgStyle: '',
  6976. msgShow: null,
  6977. msgHide: null
  6978. },
  6979. themes = {};
  6980. /** jQuery Plugin
  6981. * @param {Object} options
  6982. debug {Boolean} 0 Whether to enable debug mode
  6983. timely {Number} 1 Whether to enable timely validation
  6984. theme {String} 'default' Theme name
  6985. stopOnError {Boolean} false Whether to stop validate when found an error input
  6986. focusCleanup {Boolean} false Whether to clean up the field message when focus the field
  6987. focusInvalid {Boolean} true Whether to focus the field that is invalid
  6988. ignoreBlank {Boolean} false When the field has no value, whether to ignore validation
  6989. ignore {jqSelector} '' Ignored fields (Using jQuery selector)
  6990. beforeSubmit {Function} Do something before submit form
  6991. dataFilter {Function} Convert ajax results
  6992. valid {Function} Triggered when the form is valid
  6993. invalid {Function} Triggered when the form is invalid
  6994. validClass {String} 'n-valid' Add this class name to a valid field
  6995. invalidClass {String} 'n-invalid' Add this class name to a invalid field
  6996. bindClassTo {jqSelector} ':verifiable' Which element should the className binding to
  6997. display {Function} Callback function to get dynamic display
  6998. target {Function} Callback function to get dynamic target
  6999. msgShow {Function} Trigger this callback when show message
  7000. msgHide {Function} Trigger this callback when hide message
  7001. msgWrapper {String} 'span' Message wrapper tag name
  7002. msgMaker {Function} Callback function to make message HTML
  7003. msgArrow {String} Message arrow template
  7004. msgIcon {String} Message icon template
  7005. msgStyle {String} Custom message css style
  7006. msgClass {String} Additional added to the message class names
  7007. formClass {String} Additional added to the form class names
  7008. messages {Object} Custom messages for the current instance
  7009. rules {Object} Custom rules for the current instance
  7010. fields {Object} Field validation configuration
  7011. {String} key name|#id
  7012. {String|Object} value Rule string or an object which can pass more arguments
  7013. fields[key][rule] {String} Rule string
  7014. fields[key][display] {String|Function}
  7015. fields[key][tip] {String} Custom tip message
  7016. fields[key][ok] {String} Custom success message
  7017. fields[key][msg] {Object} Custom error message
  7018. fields[key][msgStyle] {String} Custom message style
  7019. fields[key][msgClass] {String} A className which added to message placeholder element
  7020. fields[key][msgWrapper] {String} Tag name of the message placeholder element
  7021. fields[key][msgMaker] {Function} A function to custom message HTML
  7022. fields[key][dataFilter] {Function} A function to convert ajax results
  7023. fields[key][valid] {Function} A function triggered when field is valid
  7024. fields[key][invalid] {Function} A function triggered when field is invalid
  7025. fields[key][must] {Boolean} If set true, we always check the field even has remote checking
  7026. fields[key][timely] {Boolean} Whether to enable timely validation
  7027. fields[key][target] {jqSelector} Define placement of a message
  7028. */
  7029. $.fn.validator = function(options) {
  7030. var that = this,
  7031. args = arguments;
  7032. if (that.is(INPUT_SELECTOR)) return that;
  7033. if (!that.is('form')) that = this.find('form');
  7034. if (!that.length) that = this;
  7035. that.each(function() {
  7036. var instance = $(this).data(NS);
  7037. if (instance) {
  7038. if ( isString(options) ) {
  7039. if ( options.charAt(0) === '_' ) return;
  7040. instance[options].apply(instance, [].slice.call(args, 1));
  7041. }
  7042. else if (options) {
  7043. instance._reset(true);
  7044. instance._init(this, options);
  7045. }
  7046. } else {
  7047. new Validator(this, options);
  7048. }
  7049. });
  7050. return this;
  7051. };
  7052. // Validate a field, or an area
  7053. $.fn.isValid = function(callback, hideMsg) {
  7054. var me = _getInstance(this[0]),
  7055. hasCallback = isFunction(callback),
  7056. ret, opt;
  7057. if (!me) return true;
  7058. if (!hasCallback && hideMsg === undefined) hideMsg = callback;
  7059. me.checkOnly = !!hideMsg;
  7060. opt = me.options;
  7061. ret = me._multiValidate(
  7062. this.is(INPUT_SELECTOR) ? this : this.find(INPUT_SELECTOR),
  7063. function(isValid){
  7064. if (!isValid && opt.focusInvalid && !me.checkOnly) {
  7065. // navigate to the error element
  7066. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  7067. }
  7068. if (hasCallback) {
  7069. if (callback.length) {
  7070. callback(isValid);
  7071. } else if (isValid) {
  7072. callback();
  7073. }
  7074. }
  7075. me.checkOnly = false;
  7076. }
  7077. );
  7078. // If you pass a callback, we maintain the jQuery object chain
  7079. return hasCallback ? this : ret;
  7080. };
  7081. $.extend($.expr.pseudos || $.expr[':'], {
  7082. // A faster selector than ":input:not(:submit,:button,:reset,:image,:disabled,[contenteditable])"
  7083. verifiable: function(elem) {
  7084. var name = elem.nodeName.toLowerCase();
  7085. return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
  7086. name === 'select' ||
  7087. name === 'textarea' ||
  7088. elem.contentEditable === 'true'
  7089. ) && !elem.disabled;
  7090. },
  7091. // any value, but not only whitespace
  7092. filled: function(elem) {
  7093. return !!trim($(elem).val());
  7094. }
  7095. });
  7096. /**
  7097. * Creates a new Validator
  7098. *
  7099. * @class
  7100. * @param {Element} element - form element
  7101. * @param {Object} options - options for validator
  7102. */
  7103. function Validator(element, options) {
  7104. var me = this;
  7105. if ( !(me instanceof Validator) ) {
  7106. return new Validator(element, options);
  7107. }
  7108. if (Validator.pending) {
  7109. $(window).on('validatorready', init);
  7110. } else {
  7111. init();
  7112. }
  7113. function init() {
  7114. me.$el = $(element);
  7115. if (me.$el.length) {
  7116. me._init(me.$el[0], options);
  7117. }
  7118. else if (isString(element)) {
  7119. preinitialized[element] = options;
  7120. }
  7121. }
  7122. }
  7123. Validator.prototype = {
  7124. _init: function(element, options) {
  7125. var me = this,
  7126. opt, themeOpt, dataOpt;
  7127. // Initialization options
  7128. if ( isFunction(options) ) {
  7129. options = {
  7130. valid: options
  7131. };
  7132. }
  7133. options = me._opt = options || {};
  7134. dataOpt = attr(element, 'data-'+ NS +'-option');
  7135. dataOpt = me._dataOpt = dataOpt && dataOpt.charAt(0) === '{' ? (new Function('return ' + dataOpt))() : {};
  7136. themeOpt = me._themeOpt = themes[ options.theme || dataOpt.theme || defaults.theme ];
  7137. opt = me.options = $.extend({}, defaults, fieldDefaults, themeOpt, me.options, options, dataOpt);
  7138. me.rules = new Rules(opt.rules, true);
  7139. me.messages = new Messages(opt.messages, true);
  7140. me.Field = _createFieldFactory(me);
  7141. me.elements = me.elements || {};
  7142. me.deferred = {};
  7143. me.errors = {};
  7144. me.fields = {};
  7145. // Initialization fields
  7146. me._initFields(opt.fields);
  7147. // Initialization events and make a cache
  7148. if ( !me.$el.data(NS) ) {
  7149. me.$el.data(NS, me).addClass(CLS_WRAPPER +' '+ opt.formClass)
  7150. .on('form-submit-validate', function(e, a, $form, opts, veto) {
  7151. me.vetoed = veto.veto = !me.isValid;
  7152. me.ajaxFormOptions = opts;
  7153. })
  7154. .on('submit'+ CLS_NS +' validate'+ CLS_NS, proxy(me, '_submit'))
  7155. .on('reset'+ CLS_NS, proxy(me, '_reset'))
  7156. .on('showmsg'+ CLS_NS, proxy(me, '_showmsg'))
  7157. .on('hidemsg'+ CLS_NS, proxy(me, '_hidemsg'))
  7158. .on('focusin'+ CLS_NS + ' click'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusin'))
  7159. .on('focusout'+ CLS_NS +' validate'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusout'))
  7160. .on('keyup'+ CLS_NS +' input'+ CLS_NS + ' compositionstart compositionend', INPUT_SELECTOR, proxy(me, '_focusout'))
  7161. .on('click'+ CLS_NS, ':radio,:checkbox', 'click', proxy(me, '_focusout'))
  7162. .on('change'+ CLS_NS, 'select,input[type="file"]', 'change', proxy(me, '_focusout'));
  7163. // cache the novalidate attribute value
  7164. me._NOVALIDATE = attr(element, NOVALIDATE);
  7165. // Initialization is complete, stop off default HTML5 form validation
  7166. // If use "jQuery.attr('novalidate')" in IE7 will complain: "SCRIPT3: Member not found."
  7167. attr(element, NOVALIDATE, NOVALIDATE);
  7168. }
  7169. // Display all messages in target container
  7170. if ( isString(opt.target) ) {
  7171. me.$el.find(opt.target).addClass('msg-container');
  7172. }
  7173. },
  7174. // Guess whether the form use ajax submit
  7175. _guessAjax: function(form) {
  7176. var me = this;
  7177. if ( !(me.isAjaxSubmit = !!me.options.valid) ) {
  7178. // if there is a "valid.form" event
  7179. var events = ($._data || $.data)(form, 'events');
  7180. me.isAjaxSubmit = issetEvent(events, 'valid', 'form') || issetEvent(events, 'submit', 'form-plugin');
  7181. }
  7182. function issetEvent(events, name, namespace) {
  7183. return !!(
  7184. events && events[name]
  7185. && $.map(events[name], function(e){
  7186. return ~e.namespace.indexOf(namespace) ? 1 : null;
  7187. }).length )
  7188. }
  7189. },
  7190. _initFields: function(fields) {
  7191. var me = this, k, arr, i,
  7192. clear = fields === null;
  7193. // Processing field information
  7194. if (clear) fields = me.fields;
  7195. if ( isObject(fields) ) {
  7196. for (k in fields) {
  7197. if (~k.indexOf(',')) {
  7198. arr = k.split(',');
  7199. i = arr.length;
  7200. while (i--) {
  7201. initField(trim(arr[i]), fields[k]);
  7202. }
  7203. } else {
  7204. initField(k, fields[k]);
  7205. }
  7206. }
  7207. }
  7208. // Parsing DOM rules
  7209. me.$el.find(INPUT_SELECTOR).each(function() {
  7210. me._parse(this);
  7211. });
  7212. function initField(k, v) {
  7213. // delete a field from settings
  7214. if ( v === null || clear ) {
  7215. var el = me.elements[k];
  7216. if (el) me._resetElement(el, true);
  7217. delete me.fields[k];
  7218. } else {
  7219. me.fields[k] = new me.Field(k, isString(v) ? {rule: v} : v, me.fields[k]);
  7220. }
  7221. }
  7222. },
  7223. // Parsing a field
  7224. _parse: function(el) {
  7225. var me = this,
  7226. field,
  7227. key = el.name,
  7228. display,
  7229. timely,
  7230. dataRule = attr(el, DATA_RULE);
  7231. dataRule && attr(el, DATA_RULE, null);
  7232. // If the field has passed the key as id mode, or it doesn't has a name
  7233. if ( el.id && (
  7234. ('#' + el.id in me.fields) ||
  7235. !key ||
  7236. // If dataRule and element are diffrent from old's, we use ID mode.
  7237. (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
  7238. )
  7239. ) {
  7240. key = '#' + el.id;
  7241. }
  7242. // Generate id
  7243. if (!key) {
  7244. key = '#' + (el.id = 'N' + String(Math.random()).slice(-12));
  7245. }
  7246. field = me.getField(key, true);
  7247. // The priority of passing parameter by DOM is higher than by JS.
  7248. field.rule = dataRule || field.rule;
  7249. if (display = attr(el, DATA_DISPLAY)) {
  7250. field.display = display;
  7251. }
  7252. if (field.rule) {
  7253. if ( attr(el, DATA_MUST) !== null || /\b(?:match|checked)\b/.test(field.rule) ) {
  7254. field.must = true;
  7255. }
  7256. if ( /\brequired\b/.test(field.rule) ) {
  7257. field.required = true;
  7258. }
  7259. if (timely = attr(el, DATA_TIMELY)) {
  7260. field.timely = +timely;
  7261. } else if (field.timely > 3) {
  7262. attr(el, DATA_TIMELY, field.timely);
  7263. }
  7264. me._parseRule(field);
  7265. field.old = {};
  7266. }
  7267. if ( isString(field.target) ) {
  7268. attr(el, DATA_TARGET, field.target);
  7269. }
  7270. if ( isString(field.tip) ) {
  7271. attr(el, DATA_TIP, field.tip);
  7272. }
  7273. return me.fields[key] = field;
  7274. },
  7275. // Parsing field rules
  7276. _parseRule: function(field) {
  7277. var arr = rDisplay.exec(field.rule);
  7278. if (!arr) return;
  7279. // current rule index
  7280. field._i = 0;
  7281. if (arr[1]) {
  7282. field.display = arr[1];
  7283. }
  7284. if (arr[2]) {
  7285. field._rules = [];
  7286. arr[2].replace(rRules, function(){
  7287. var args = arguments;
  7288. args[4] = args[4] || args[5];
  7289. field._rules.push({
  7290. and: args[1] === '&',
  7291. not: args[2] === '!',
  7292. or: args[6] === '|',
  7293. method: args[3],
  7294. params: args[4] ? $.map( args[4].split(', '), trim ) : undefined
  7295. });
  7296. });
  7297. }
  7298. },
  7299. // Verify a zone
  7300. _multiValidate: function($inputs, doneCallback){
  7301. var me = this,
  7302. opt = me.options;
  7303. me.hasError = false;
  7304. if (opt.ignore) {
  7305. $inputs = $inputs.not(opt.ignore);
  7306. }
  7307. $inputs.each(function() {
  7308. me._validate(this);
  7309. if (me.hasError && opt.stopOnError) {
  7310. // stop the validation
  7311. return false;
  7312. }
  7313. });
  7314. // Need to wait for all fields validation complete, especially asynchronous validation
  7315. if (doneCallback) {
  7316. me.validating = true;
  7317. $.when.apply(
  7318. null,
  7319. $.map(me.deferred, function(v){return v;})
  7320. ).done(function(){
  7321. doneCallback.call(me, !me.hasError);
  7322. me.validating = false;
  7323. });
  7324. }
  7325. // If the form does not contain asynchronous validation, the return value is correct.
  7326. // Otherwise, you should detect form validation result through "doneCallback".
  7327. return !$.isEmptyObject(me.deferred) ? undefined : !me.hasError;
  7328. },
  7329. // Validate the whole form
  7330. _submit: function(e) {
  7331. var me = this,
  7332. opt = me.options,
  7333. form = e.target,
  7334. canSubmit = e.type === 'submit' && form.tagName === 'FORM' && !e.isDefaultPrevented();
  7335. e.preventDefault();
  7336. if (
  7337. novalidateonce && ~(novalidateonce = false) ||
  7338. // Prevent duplicate submission
  7339. me.submiting ||
  7340. // Receive the "validate" event only from the form.
  7341. e.type === 'validate' && me.$el[0] !== form ||
  7342. // trigger the beforeSubmit callback.
  7343. isFunction(opt.beforeSubmit) && opt.beforeSubmit.call(me, form) === false
  7344. ) {
  7345. return;
  7346. }
  7347. if (me.isAjaxSubmit === undefined) {
  7348. me._guessAjax(form);
  7349. }
  7350. me._debug('log', '\n<<< event: ' + e.type);
  7351. me._reset();
  7352. me.submiting = true;
  7353. me._multiValidate(
  7354. me.$el.find(INPUT_SELECTOR),
  7355. function(isValid){
  7356. var ret = (isValid || opt.debug === 2) ? 'valid' : 'invalid',
  7357. errors;
  7358. if (!isValid) {
  7359. if (opt.focusInvalid) {
  7360. // navigate to the error element
  7361. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  7362. }
  7363. errors = $.map(me.errors, function(err){return err;});
  7364. }
  7365. // releasing submit
  7366. me.submiting = false;
  7367. me.isValid = isValid;
  7368. // trigger callback and event
  7369. isFunction(opt[ret]) && opt[ret].call(me, form, errors);
  7370. me.$el.trigger(ret + CLS_NS_FORM, [form, errors]);
  7371. me._debug('log', '>>> ' + ret);
  7372. if (!isValid) return;
  7373. // For jquery.form plugin
  7374. if (me.vetoed) {
  7375. $(form).ajaxSubmit(me.ajaxFormOptions);
  7376. }
  7377. else if (canSubmit && !me.isAjaxSubmit) {
  7378. document.createElement('form').submit.call(form);
  7379. }
  7380. }
  7381. );
  7382. },
  7383. _reset: function(e) {
  7384. var me = this;
  7385. me.errors = {};
  7386. if (e) {
  7387. me.reseting = true;
  7388. me.$el.find(INPUT_SELECTOR).each( function(){
  7389. me._resetElement(this);
  7390. });
  7391. delete me.reseting;
  7392. }
  7393. },
  7394. _resetElement: function(el, all) {
  7395. this._setClass(el, null);
  7396. this.hideMsg(el);
  7397. },
  7398. // Handle events: "focusin/click"
  7399. _focusin: function(e) {
  7400. var me = this,
  7401. opt = me.options,
  7402. el = e.target,
  7403. timely,
  7404. msg;
  7405. if ( me.validating || ( e.type==='click' && document.activeElement === el ) ) {
  7406. return;
  7407. }
  7408. if (opt.focusCleanup) {
  7409. if ( attr(el, ARIA_INVALID) === 'true' ) {
  7410. me._setClass(el, null);
  7411. me.hideMsg(el);
  7412. }
  7413. }
  7414. msg = attr(el, DATA_TIP);
  7415. if (msg) {
  7416. me.showMsg(el, {
  7417. type: 'tip',
  7418. msg: msg
  7419. });
  7420. } else {
  7421. if (attr(el, DATA_RULE)) {
  7422. me._parse(el);
  7423. }
  7424. if (timely = attr(el, DATA_TIMELY)) {
  7425. if ( timely === 8 || timely === 9 ) {
  7426. me._focusout(e);
  7427. }
  7428. }
  7429. }
  7430. },
  7431. // Handle events: "focusout/validate/keyup/click/change/input/compositionstart/compositionend"
  7432. _focusout: function(e) {
  7433. var me = this,
  7434. opt = me.options,
  7435. el = e.target,
  7436. etype = e.type,
  7437. etype0,
  7438. focusin = etype === 'focusin',
  7439. special = etype === 'validate',
  7440. elem,
  7441. field,
  7442. old,
  7443. value,
  7444. timestamp,
  7445. key, specialKey,
  7446. timely,
  7447. timer = 0;
  7448. if (etype === 'compositionstart') {
  7449. me.pauseValidate = true;
  7450. }
  7451. if (etype === 'compositionend') {
  7452. me.pauseValidate = false;
  7453. }
  7454. if (me.pauseValidate) {
  7455. return;
  7456. }
  7457. // For checkbox and radio
  7458. elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
  7459. // Get field
  7460. if (!(field = me.getField(elem)) || !field.rule) {
  7461. return;
  7462. }
  7463. // Cache event type
  7464. etype0 = field._e;
  7465. field._e = etype;
  7466. timely = field.timely;
  7467. if (!special) {
  7468. if (!timely || (_checkable(el) && etype !== 'click')) {
  7469. return;
  7470. }
  7471. value = field.getValue();
  7472. // not validate field unless fill a value
  7473. if ( field.ignoreBlank && !value && !focusin ) {
  7474. me.hideMsg(el);
  7475. return;
  7476. }
  7477. if ( etype === 'focusout' ) {
  7478. if (etype0 === 'change') {
  7479. return;
  7480. }
  7481. if ( timely === 2 || timely === 8 ) {
  7482. old = field.old;
  7483. if (value && old) {
  7484. if (field.isValid && !old.showOk) {
  7485. me.hideMsg(el);
  7486. } else {
  7487. me._makeMsg(el, field, old);
  7488. }
  7489. } else {
  7490. return;
  7491. }
  7492. }
  7493. }
  7494. else {
  7495. if ( timely < 2 && !e.data ) {
  7496. return;
  7497. }
  7498. // mark timestamp to reduce the frequency of the received event
  7499. timestamp = +new Date();
  7500. if ( timestamp - (el._ts || 0) < 100 ) {
  7501. return;
  7502. }
  7503. el._ts = timestamp;
  7504. // handle keyup
  7505. if ( etype === 'keyup' ) {
  7506. if (etype0 === 'input') {
  7507. return;
  7508. }
  7509. key = e.keyCode;
  7510. specialKey = {
  7511. 8: 1, // Backspace
  7512. 9: 1, // Tab
  7513. 16: 1, // Shift
  7514. 32: 1, // Space
  7515. 46: 1 // Delete
  7516. };
  7517. // only gets focus, no validation
  7518. if ( key === 9 && !value ) {
  7519. return;
  7520. }
  7521. // do not validate, if triggered by these keys
  7522. if ( key < 48 && !specialKey[key] ) {
  7523. return;
  7524. }
  7525. }
  7526. if ( !focusin ) {
  7527. // keyboard events, reducing the frequency of validation
  7528. timer = timely <100 ? (etype === 'click' || el.tagName === 'SELECT') ? 0 : 400 : timely;
  7529. }
  7530. }
  7531. }
  7532. // if the current field is ignored
  7533. if ( opt.ignore && $(el).is(opt.ignore) ) {
  7534. return;
  7535. }
  7536. clearTimeout(field._t);
  7537. if (timer) {
  7538. field._t = setTimeout(function() {
  7539. me._validate(el, field);
  7540. }, timer);
  7541. } else {
  7542. if (special) field.old = {};
  7543. me._validate(el, field);
  7544. }
  7545. },
  7546. _setClass: function(el, isValid) {
  7547. var $el = $(el), opt = this.options;
  7548. if (opt.bindClassTo) {
  7549. $el = $el.closest(opt.bindClassTo);
  7550. }
  7551. $el.removeClass( opt.invalidClass + ' ' + opt.validClass );
  7552. if (isValid !== null) {
  7553. $el.addClass( isValid ? opt.validClass : opt.invalidClass );
  7554. }
  7555. },
  7556. _showmsg: function(e, type, msg) {
  7557. var me = this,
  7558. el = e.target;
  7559. if ( me.$el.is(el) ) {
  7560. if (isObject(type)) {
  7561. me.showMsg(type)
  7562. }
  7563. else if ( type === 'tip' ) {
  7564. me.$el.find(INPUT_SELECTOR +'['+ DATA_TIP +']', el).each(function(){
  7565. me.showMsg(this, {type: type, msg: msg});
  7566. });
  7567. }
  7568. }
  7569. else {
  7570. me.showMsg(el, {type: type, msg: msg});
  7571. }
  7572. },
  7573. _hidemsg: function(e) {
  7574. var $el = $(e.target);
  7575. if ( $el.is(INPUT_SELECTOR) ) {
  7576. this.hideMsg($el);
  7577. }
  7578. },
  7579. // Validated a field
  7580. _validatedField: function(el, field, ret) {
  7581. var me = this,
  7582. opt = me.options,
  7583. isValid = field.isValid = ret.isValid = !!ret.isValid,
  7584. callback = isValid ? 'valid' : 'invalid';
  7585. ret.key = field.key;
  7586. ret.ruleName = field._r;
  7587. ret.id = el.id;
  7588. ret.value = field.value;
  7589. me.elements[field.key] = ret.element = el;
  7590. me.isValid = me.$el[0].isValid = isValid ? me.isFormValid() : isValid;
  7591. if (isValid) {
  7592. ret.type = 'ok';
  7593. } else {
  7594. if (me.submiting) {
  7595. me.errors[field.key] = ret.msg;
  7596. }
  7597. me.hasError = true;
  7598. }
  7599. // cache result
  7600. field.old = ret;
  7601. // trigger callback
  7602. isFunction(field[callback]) && field[callback].call(me, el, ret);
  7603. isFunction(opt.validation) && opt.validation.call(me, el, ret);
  7604. // trigger event
  7605. $(el).attr( ARIA_INVALID, isValid ? null : true )
  7606. .trigger( callback + CLS_NS_FIELD, [ret, me] );
  7607. me.$el.triggerHandler('validation', [ret, me]);
  7608. if (me.checkOnly) return;
  7609. // set className
  7610. me._setClass(el, ret.skip || ret.type === 'tip' ? null : isValid);
  7611. me._makeMsg.apply(me, arguments);
  7612. },
  7613. _makeMsg: function(el, field, ret) {
  7614. // show or hide the message
  7615. if (field.msgMaker) {
  7616. ret = $.extend({}, ret);
  7617. if (field._e === 'focusin') {
  7618. ret.type = 'tip';
  7619. }
  7620. this[ ret.showOk || ret.msg || ret.type === 'tip' ? 'showMsg' : 'hideMsg' ](el, ret, field);
  7621. }
  7622. },
  7623. // Validated a rule
  7624. _validatedRule: function(el, field, ret, msgOpt) {
  7625. field = field || me.getField(el);
  7626. msgOpt = msgOpt || {};
  7627. var me = this,
  7628. msg,
  7629. rule,
  7630. method = field._r,
  7631. timely = field.timely,
  7632. special = timely === 9 || timely === 8,
  7633. transfer,
  7634. temp,
  7635. isValid = false;
  7636. // use null to break validation from a field
  7637. if (ret === null) {
  7638. me._validatedField(el, field, {isValid: true, skip: true});
  7639. field._i = 0;
  7640. return;
  7641. }
  7642. else if (ret === undefined) {
  7643. transfer = true;
  7644. }
  7645. else if (ret === true || ret === '') {
  7646. isValid = true;
  7647. }
  7648. else if (isString(ret)) {
  7649. msg = ret;
  7650. }
  7651. else if (isObject(ret)) {
  7652. if (ret.error) {
  7653. msg = ret.error;
  7654. } else {
  7655. msg = ret.ok;
  7656. isValid = true;
  7657. }
  7658. }
  7659. else {
  7660. isValid = !!ret
  7661. }
  7662. rule = field._rules[field._i];
  7663. if (rule.not) {
  7664. msg = undefined;
  7665. isValid = method === 'required' || !isValid;
  7666. }
  7667. if (rule.or) {
  7668. if (isValid) {
  7669. while ( field._i < field._rules.length && field._rules[field._i].or ) {
  7670. field._i++;
  7671. }
  7672. } else {
  7673. transfer = true;
  7674. }
  7675. }
  7676. else if (rule.and) {
  7677. if (!field.isValid) transfer = true;
  7678. }
  7679. if (transfer) {
  7680. isValid = true;
  7681. }
  7682. // message analysis, and throw rule level event
  7683. else {
  7684. if (isValid) {
  7685. if (field.showOk !== false) {
  7686. temp = attr(el, DATA_OK);
  7687. msg = temp === null ? isString(field.ok) ? field.ok : msg : temp;
  7688. if (!isString(msg) && isString(field.showOk)) {
  7689. msg = field.showOk;
  7690. }
  7691. if (isString(msg)) {
  7692. msgOpt.showOk = isValid;
  7693. }
  7694. }
  7695. }
  7696. if (!isValid || special) {
  7697. /* rule message priority:
  7698. 1. custom DOM message
  7699. 2. custom field message;
  7700. 3. global defined message;
  7701. 4. rule returned message;
  7702. 5. default message;
  7703. */
  7704. msg = (_getDataMsg(el, field, msg || rule.msg || me.messages[method]) || me.messages.fallback).replace(/\{0\|?([^\}]*)\}/, function(m, defaultDisplay){
  7705. return me._getDisplay(el, field.display) || defaultDisplay || me.messages[0];
  7706. });
  7707. }
  7708. if (!isValid) field.isValid = isValid;
  7709. msgOpt.msg = msg;
  7710. $(el).trigger( (isValid ? 'valid' : 'invalid') + CLS_NS_RULE, [method, msg]);
  7711. }
  7712. if (special && (!transfer || rule.and)) {
  7713. if (!isValid && !field._m) field._m = msg;
  7714. field._v = field._v || [];
  7715. field._v.push({
  7716. type: isValid ? !transfer ? 'ok' : 'tip' : 'error',
  7717. msg: msg || rule.msg
  7718. });
  7719. }
  7720. me._debug('log', ' ' + field._i + ': ' + method + ' => ' + (isValid || msg));
  7721. // the current rule has passed, continue to validate
  7722. if ( (isValid || special) && field._i < field._rules.length - 1) {
  7723. field._i++;
  7724. me._checkRule(el, field);
  7725. }
  7726. // field was invalid, or all fields was valid
  7727. else {
  7728. field._i = 0;
  7729. if (special) {
  7730. msgOpt.isValid = field.isValid;
  7731. msgOpt.result = field._v;
  7732. msgOpt.msg = field._m || '';
  7733. if (!field.value && (field._e === 'focusin')) {
  7734. msgOpt.type = 'tip';
  7735. }
  7736. } else {
  7737. msgOpt.isValid = isValid;
  7738. }
  7739. me._validatedField(el, field, msgOpt);
  7740. delete field._m;
  7741. delete field._v;
  7742. }
  7743. },
  7744. // Verify a rule form a field
  7745. _checkRule: function(el, field) {
  7746. var me = this,
  7747. ret,
  7748. fn,
  7749. old,
  7750. key = field.key,
  7751. rule = field._rules[field._i],
  7752. method = rule.method,
  7753. params = rule.params;
  7754. // request has been sent, wait it
  7755. if (me.submiting && me.deferred[key]) {
  7756. return;
  7757. }
  7758. old = field.old;
  7759. field._r = method;
  7760. if (old && !field.must && !rule.must && rule.result !== undefined &&
  7761. old.ruleName === method && old.id === el.id &&
  7762. field.value && old.value === field.value )
  7763. {
  7764. // get result from cache
  7765. ret = rule.result;
  7766. }
  7767. else {
  7768. // get result from current rule
  7769. fn = _getDataRule(el, method) || me.rules[method] || noop;
  7770. ret = fn.call(field, el, params, field);
  7771. if (fn.msg) rule.msg = fn.msg;
  7772. }
  7773. // asynchronous validation
  7774. if (isObject(ret) && isFunction(ret.then)) {
  7775. me.deferred[key] = ret;
  7776. // whether the field valid is unknown
  7777. field.isValid = undefined;
  7778. // show loading message
  7779. !me.checkOnly && me.showMsg(el, {
  7780. type: 'loading',
  7781. msg: me.messages.loading
  7782. }, field);
  7783. // waiting to parse the response data
  7784. ret.then(
  7785. function(d, textStatus, jqXHR) {
  7786. var data = trim(jqXHR.responseText),
  7787. result,
  7788. dataFilter = field.dataFilter;
  7789. // detect if data is json or jsonp format
  7790. if (/jsonp?/.test(this.dataType)) {
  7791. data = d;
  7792. } else if (data.charAt(0) === '{') {
  7793. data = $.parseJSON(data);
  7794. }
  7795. // filter data
  7796. result = dataFilter.call(this, data, field);
  7797. if (result === undefined) result = dataFilter.call(this, data.data, field);
  7798. rule.data = this.data;
  7799. rule.result = field.old ? result : undefined;
  7800. me._validatedRule(el, field, result);
  7801. },
  7802. function(jqXHR, textStatus){
  7803. me._validatedRule(el, field, me.messages[textStatus] || textStatus);
  7804. }
  7805. ).always(function(){
  7806. delete me.deferred[key];
  7807. });
  7808. }
  7809. // other result
  7810. else {
  7811. me._validatedRule(el, field, ret);
  7812. }
  7813. },
  7814. // Processing the validation
  7815. _validate: function(el, field) {
  7816. var me = this;
  7817. // doesn't validate the element that has "disabled" or "novalidate" attribute
  7818. if ( el.disabled || attr(el, NOVALIDATE) !== null ) {
  7819. return;
  7820. }
  7821. field = field || me.getField(el);
  7822. if (!field) return;
  7823. if (!field._rules) me._parse(el);
  7824. if (!field._rules) return;
  7825. me._debug('info', field.key);
  7826. field.isValid = true;
  7827. field.element = el;
  7828. // Cache the value
  7829. field.value = field.getValue();
  7830. // if the field is not required, and that has a blank value
  7831. if (!field.required && !field.must && !field.value) {
  7832. if (!_checkable(el)) {
  7833. me._validatedField(el, field, {isValid: true});
  7834. return true;
  7835. }
  7836. }
  7837. me._checkRule(el, field);
  7838. return field.isValid;
  7839. },
  7840. _debug: function(type, messages) {
  7841. if (window.console && this.options.debug) {
  7842. console[type](messages);
  7843. }
  7844. },
  7845. /**
  7846. * Detecting whether the value of an element that matches a rule
  7847. *
  7848. * @method test
  7849. * @param {Element} el - input element
  7850. * @param {String} rule - rule name
  7851. */
  7852. test: function(el, rule) {
  7853. var me = this,
  7854. ret,
  7855. parts = rRule.exec(rule),
  7856. field,
  7857. method,
  7858. params;
  7859. if (parts) {
  7860. method = parts[1];
  7861. if (method in me.rules) {
  7862. params = parts[2] || parts[3];
  7863. params = params ? params.split(', ') : undefined;
  7864. field = me.getField(el, true);
  7865. field._r = method;
  7866. field.value = field.getValue();
  7867. ret = me.rules[method].call(field, el, params);
  7868. }
  7869. }
  7870. return ret === true || ret === undefined || ret === null;
  7871. },
  7872. _getDisplay: function(el, str) {
  7873. return !isString(str) ? isFunction(str) ? str.call(this, el) : '' : str;
  7874. },
  7875. _getMsgOpt: function(obj, field) {
  7876. var opt = field ? field : this.options;
  7877. return $.extend({
  7878. type: 'error',
  7879. pos: _getPos(opt.msgClass),
  7880. target: opt.target,
  7881. wrapper: opt.msgWrapper,
  7882. style: opt.msgStyle,
  7883. cls: opt.msgClass,
  7884. arrow: opt.msgArrow,
  7885. icon: opt.msgIcon
  7886. }, isString(obj) ? {msg: obj} : obj);
  7887. },
  7888. _getMsgDOM: function(el, msgOpt) {
  7889. var $el = $(el), $msgbox, datafor, tgt, container;
  7890. if ( $el.is(INPUT_SELECTOR) ) {
  7891. tgt = msgOpt.target || attr(el, DATA_TARGET);
  7892. if (tgt) {
  7893. tgt = !isFunction(tgt) ? tgt.charAt(0) === '#' ? $(tgt) : this.$el.find(tgt) : tgt.call(this, el);
  7894. if (tgt.length) {
  7895. if ( tgt.is(INPUT_SELECTOR) ) {
  7896. $el = tgt
  7897. el = tgt.get(0);
  7898. } else if ( tgt.hasClass(CLS_MSG_BOX) ) {
  7899. $msgbox = tgt;
  7900. } else {
  7901. container = tgt;
  7902. }
  7903. }
  7904. }
  7905. if (!$msgbox) {
  7906. datafor = (!_checkable(el) || !el.name) && el.id ? el.id : el.name;
  7907. $msgbox = (container || this.$el).find(msgOpt.wrapper + '.' + CLS_MSG_BOX + '[for="' + datafor + '"]');
  7908. }
  7909. } else {
  7910. $msgbox = $el;
  7911. }
  7912. // Create new message box
  7913. if (!msgOpt.hide && !$msgbox.length) {
  7914. $msgbox = $('<'+ msgOpt.wrapper + '>').attr({
  7915. 'class': CLS_MSG_BOX + (msgOpt.cls ? ' ' + msgOpt.cls : ''),
  7916. 'style': msgOpt.style || undefined,
  7917. 'for': datafor
  7918. });
  7919. if (container) {
  7920. $msgbox.appendTo(container);
  7921. } else {
  7922. if ( _checkable(el) ) {
  7923. var $parent = $el.parent();
  7924. $msgbox.appendTo( $parent.is('label') ? $parent.parent() : $parent );
  7925. } else {
  7926. $msgbox[!msgOpt.pos || msgOpt.pos === 'right' ? 'insertAfter' : 'insertBefore']($el);
  7927. }
  7928. }
  7929. }
  7930. return $msgbox;
  7931. },
  7932. /**
  7933. * Show validation message
  7934. *
  7935. * @method showMsg
  7936. * @param {Element} el - input element
  7937. * @param {Object} msgOpt
  7938. */
  7939. showMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  7940. if (!el) return;
  7941. var me = this,
  7942. opt = me.options,
  7943. msgShow,
  7944. msgMaker,
  7945. temp,
  7946. $msgbox;
  7947. if (isObject(el) && !el.jquery && !msgOpt) {
  7948. $.each(el, function(key, msg) {
  7949. var el = me.elements[key] || me.$el.find(_key2selector(key))[0];
  7950. me.showMsg(el, msg);
  7951. });
  7952. return;
  7953. }
  7954. if ($(el).is(INPUT_SELECTOR)) {
  7955. field = field || me.getField(el);
  7956. }
  7957. if (!(msgMaker = (field || opt).msgMaker)) {
  7958. return;
  7959. }
  7960. msgOpt = me._getMsgOpt(msgOpt, field);
  7961. el = (el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]') : $(el)).get(0);
  7962. // ok or tip
  7963. if (!msgOpt.msg && msgOpt.type !== 'error') {
  7964. temp = attr(el, 'data-' + msgOpt.type);
  7965. if (temp !== null) msgOpt.msg = temp;
  7966. }
  7967. if ( !isString(msgOpt.msg) ) {
  7968. return;
  7969. }
  7970. $msgbox = me._getMsgDOM(el, msgOpt);
  7971. !rPos.test($msgbox[0].className) && $msgbox.addClass(msgOpt.cls);
  7972. if ( isIE === 6 && msgOpt.pos === 'bottom' ) {
  7973. $msgbox[0].style.marginTop = $(el).outerHeight() + 'px';
  7974. }
  7975. $msgbox.html( msgMaker.call(me, msgOpt) )[0].style.display = '';
  7976. if (isFunction(msgShow = field && field.msgShow || opt.msgShow)) {
  7977. msgShow.call(me, $msgbox, msgOpt.type);
  7978. }
  7979. },
  7980. /**
  7981. * Hide validation message
  7982. *
  7983. * @method hideMsg
  7984. * @param {Element} el - input element
  7985. * @param {Object} msgOpt optional
  7986. */
  7987. hideMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  7988. var me = this,
  7989. opt = me.options,
  7990. msgHide,
  7991. $msgbox;
  7992. el = $(el).get(0);
  7993. if ($(el).is(INPUT_SELECTOR)) {
  7994. field = field || me.getField(el);
  7995. if (field) {
  7996. if (field.isValid || me.reseting) attr(el, ARIA_INVALID, null);
  7997. }
  7998. }
  7999. msgOpt = me._getMsgOpt(msgOpt, field);
  8000. msgOpt.hide = true;
  8001. $msgbox = me._getMsgDOM(el, msgOpt);
  8002. if (!$msgbox.length) return;
  8003. if ( isFunction(msgHide = field && field.msgHide || opt.msgHide) ) {
  8004. msgHide.call(me, $msgbox, msgOpt.type);
  8005. } else {
  8006. $msgbox[0].style.display = 'none';
  8007. $msgbox[0].innerHTML = '';
  8008. }
  8009. },
  8010. /**
  8011. * Get field information
  8012. *
  8013. * @method getField
  8014. * @param {Element} - input element
  8015. * @return {Object} field
  8016. */
  8017. getField: function(el, must) {
  8018. var me = this,
  8019. key,
  8020. field;
  8021. if (isString(el)) {
  8022. key = el;
  8023. el = undefined;
  8024. } else {
  8025. if (attr(el, DATA_RULE)) {
  8026. return me._parse(el);
  8027. }
  8028. if (el.id && '#' + el.id in me.fields || !el.name) {
  8029. key = '#' + el.id;
  8030. } else {
  8031. key = el.name;
  8032. }
  8033. }
  8034. if ( (field = me.fields[key]) || must && (field = new me.Field(key)) ) {
  8035. field.element = el;
  8036. }
  8037. return field;
  8038. },
  8039. /**
  8040. * Config a field
  8041. *
  8042. * @method: setField
  8043. * @param {String} key
  8044. * @param {Object} obj
  8045. */
  8046. setField: function(key, obj) {
  8047. var fields = {};
  8048. if (!key) return;
  8049. // update this field
  8050. if (isString(key)) {
  8051. fields[key] = obj;
  8052. }
  8053. // update fields
  8054. else {
  8055. fields = key;
  8056. }
  8057. this._initFields(fields);
  8058. },
  8059. /**
  8060. * Detecting whether the form is valid
  8061. *
  8062. * @method isFormValid
  8063. * @return {Boolean}
  8064. */
  8065. isFormValid: function() {
  8066. var fields = this.fields, k, field;
  8067. for (k in fields) {
  8068. field = fields[k];
  8069. if (!field._rules || !field.required && !field.must && !field.value) continue;
  8070. if (!field.isValid) return false;
  8071. }
  8072. return true;
  8073. },
  8074. /**
  8075. * Prevent submission form
  8076. *
  8077. * @method holdSubmit
  8078. * @param {Boolean} hold - If set to false, will release the hold
  8079. */
  8080. holdSubmit: function(hold) {
  8081. this.submiting = hold === undefined || hold;
  8082. },
  8083. /**
  8084. * Clean validation messages
  8085. *
  8086. * @method cleanUp
  8087. */
  8088. cleanUp: function() {
  8089. this._reset(1);
  8090. },
  8091. /**
  8092. * Destroy the validation
  8093. *
  8094. * @method destroy
  8095. */
  8096. destroy: function() {
  8097. this._reset(1);
  8098. this.$el.off(CLS_NS).removeData(NS);
  8099. attr(this.$el[0], NOVALIDATE, this._NOVALIDATE);
  8100. }
  8101. };
  8102. /**
  8103. * Create Field Factory
  8104. *
  8105. * @class
  8106. * @param {Object} context
  8107. * @return {Function} Factory
  8108. */
  8109. function _createFieldFactory(context) {
  8110. function FieldFactory() {
  8111. var options = this.options;
  8112. for (var i in options) {
  8113. if (i in fieldDefaults) this[i] = options[i];
  8114. }
  8115. $.extend(this, {
  8116. _valHook: function() {
  8117. return this.element.contentEditable === 'true' ? 'text' : 'val';
  8118. },
  8119. getValue: function() {
  8120. var elem = this.element;
  8121. if (elem.type === 'number' && elem.validity && elem.validity.badInput) {
  8122. return 'NaN';
  8123. }
  8124. return $(elem)[this._valHook()]();
  8125. },
  8126. setValue: function(value) {
  8127. $(this.element)[this._valHook()](this.value = value);
  8128. },
  8129. // Get a range of validation messages
  8130. getRangeMsg: function(value, params, suffix) {
  8131. if (!params) return;
  8132. var me = this,
  8133. msg = me.messages[me._r] || '',
  8134. result,
  8135. p = params[0].split('~'),
  8136. e = params[1] === 'false',
  8137. a = p[0],
  8138. b = p[1],
  8139. c = 'rg',
  8140. args = [''],
  8141. isNumber = trim(value) && +value === +value;
  8142. function compare(large, small) {
  8143. return !e ? large >= small : large > small;
  8144. }
  8145. if (p.length === 2) {
  8146. if (a && b) {
  8147. if (isNumber && compare(value, +a) && compare(+b, value)) {
  8148. result = true;
  8149. }
  8150. args = args.concat(p);
  8151. c = e ? 'gtlt' : 'rg';
  8152. }
  8153. else if (a && !b) {
  8154. if (isNumber && compare(value, +a)) {
  8155. result = true;
  8156. }
  8157. args.push(a);
  8158. c = e ? 'gt' : 'gte';
  8159. }
  8160. else if (!a && b) {
  8161. if (isNumber && compare(+b, value)) {
  8162. result = true;
  8163. }
  8164. args.push(b);
  8165. c = e ? 'lt' : 'lte';
  8166. }
  8167. }
  8168. else {
  8169. if (value === +a) {
  8170. result = true;
  8171. }
  8172. args.push(a);
  8173. c = 'eq';
  8174. }
  8175. if (msg) {
  8176. if (suffix && msg[c + suffix]) {
  8177. c += suffix;
  8178. }
  8179. args[0] = msg[c];
  8180. }
  8181. return result || me._rules && ( me._rules[me._i].msg = me.renderMsg.apply(null, args) );
  8182. },
  8183. // Render message template
  8184. renderMsg: function() {
  8185. var args = arguments,
  8186. tpl = args[0],
  8187. i = args.length;
  8188. if (!tpl) return;
  8189. while (--i) {
  8190. tpl = tpl.replace('{' + i + '}', args[i]);
  8191. }
  8192. return tpl;
  8193. }
  8194. });
  8195. }
  8196. function Field(key, obj, oldField) {
  8197. this.key = key;
  8198. this.validator = context;
  8199. $.extend(this, oldField, obj);
  8200. }
  8201. FieldFactory.prototype = context;
  8202. Field.prototype = new FieldFactory();
  8203. return Field;
  8204. }
  8205. /**
  8206. * Create Rules
  8207. *
  8208. * @class
  8209. * @param {Object} obj rules
  8210. * @param {Object} context context
  8211. */
  8212. function Rules(obj, context) {
  8213. if (!isObject(obj)) return;
  8214. var k, that = context ? context === true ? this : context : Rules.prototype;
  8215. for (k in obj) {
  8216. if (_checkRuleName(k)) {
  8217. that[k] = _getRule(obj[k]);
  8218. }
  8219. }
  8220. }
  8221. /**
  8222. * Create Messages
  8223. *
  8224. * @class
  8225. * @param {Object} obj rules
  8226. * @param {Object} context context
  8227. */
  8228. function Messages(obj, context) {
  8229. if (!isObject(obj)) return;
  8230. var k, that = context ? context === true ? this : context : Messages.prototype;
  8231. for (k in obj) {
  8232. that[k] = obj[k];
  8233. }
  8234. }
  8235. // Rule converted factory
  8236. function _getRule(fn) {
  8237. switch ($.type(fn)) {
  8238. case 'function':
  8239. return fn;
  8240. case 'array':
  8241. var f = function() {
  8242. return fn[0].test(this.value) || fn[1] || false;
  8243. };
  8244. f.msg = fn[1];
  8245. return f;
  8246. case 'regexp':
  8247. return function() {
  8248. return fn.test(this.value);
  8249. };
  8250. }
  8251. }
  8252. // Get instance by an element
  8253. function _getInstance(el) {
  8254. var wrap, k, options;
  8255. if (!el || !el.tagName) return;
  8256. switch (el.tagName) {
  8257. case 'INPUT':
  8258. case 'SELECT':
  8259. case 'TEXTAREA':
  8260. case 'BUTTON':
  8261. case 'FIELDSET':
  8262. wrap = el.form || $(el).closest('.' + CLS_WRAPPER);
  8263. break;
  8264. case 'FORM':
  8265. wrap = el;
  8266. break;
  8267. default:
  8268. wrap = $(el).closest('.' + CLS_WRAPPER);
  8269. }
  8270. for (k in preinitialized) {
  8271. if ($(wrap).is(k)) {
  8272. options = preinitialized[k];
  8273. break;
  8274. }
  8275. }
  8276. return $(wrap).data(NS) || $(wrap)[NS](options).data(NS);
  8277. }
  8278. // Get custom rules on the node
  8279. function _getDataRule(el, method) {
  8280. var fn = trim(attr(el, DATA_RULE + '-' + method));
  8281. if ( fn && (fn = new Function('return ' + fn)()) ) {
  8282. return _getRule(fn);
  8283. }
  8284. }
  8285. // Get custom messages on the node
  8286. function _getDataMsg(el, field, m) {
  8287. var msg = field.msg,
  8288. item = field._r;
  8289. if ( isObject(msg) ) msg = msg[item];
  8290. if ( !isString(msg) ) {
  8291. msg = attr(el, DATA_MSG + '-' + item) || attr(el, DATA_MSG) || ( m ? isString(m) ? m : m[item] : '');
  8292. }
  8293. return msg;
  8294. }
  8295. // Get message position
  8296. function _getPos(str) {
  8297. var pos;
  8298. if (str) pos = rPos.exec(str);
  8299. return pos && pos[0];
  8300. }
  8301. // Check whether the element is checkbox or radio
  8302. function _checkable(el) {
  8303. return el.tagName === 'INPUT' && el.type === 'checkbox' || el.type === 'radio';
  8304. }
  8305. // Parse date string to timestamp
  8306. function _parseDate(str) {
  8307. return Date.parse(str.replace(/\.|\-/g, '/'));
  8308. }
  8309. // Rule name only allows alphanumeric characters and underscores
  8310. function _checkRuleName(name) {
  8311. return /^\w+$/.test(name);
  8312. }
  8313. // Translate field key to jQuery selector.
  8314. function _key2selector(key) {
  8315. var isID = key.charAt(0) === '#';
  8316. key = key.replace(/([:.{(|)}/\[\]])/g, '\\$1');
  8317. return isID ? key : '[name="'+ key +'"]:first';
  8318. }
  8319. // Fixed a issue cause by refresh page in IE.
  8320. $(window).on('beforeunload', function(){
  8321. this.focus();
  8322. });
  8323. $(document)
  8324. .on('click', ':submit', function(){
  8325. var input = this, attrNode;
  8326. if (!input.form) return;
  8327. // Shim for "formnovalidate"
  8328. attrNode = input.getAttributeNode('formnovalidate');
  8329. if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
  8330. novalidateonce = true;
  8331. }
  8332. })
  8333. // Automatic initializing form validation
  8334. .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
  8335. if ( attr(this, NOVALIDATE) !== null ) return;
  8336. var $form = $(this), me;
  8337. if ( !$form.data(NS) && (me = _getInstance(this)) ) {
  8338. if ( !$.isEmptyObject(me.fields) ) {
  8339. // Execute event handler
  8340. if (e.type === 'focusin') {
  8341. me._focusin(e);
  8342. } else {
  8343. me._submit(e);
  8344. }
  8345. } else {
  8346. attr(this, NOVALIDATE, NOVALIDATE);
  8347. $form.off(CLS_NS).removeData(NS);
  8348. }
  8349. }
  8350. });
  8351. new Messages({
  8352. fallback: 'This field is not valid.',
  8353. loading: 'Validating...'
  8354. });
  8355. // Built-in rules (global)
  8356. new Rules({
  8357. /**
  8358. * required
  8359. *
  8360. * @example:
  8361. required
  8362. required(jqSelector)
  8363. required(anotherRule)
  8364. required(not, -1)
  8365. required(from, .contact)
  8366. */
  8367. required: function(element, params) {
  8368. var me = this,
  8369. val = trim(me.value),
  8370. isValid = true;
  8371. if (params) {
  8372. if ( params.length === 1 ) {
  8373. if ( !_checkRuleName(params[0]) ) {
  8374. if (!val && !$(params[0], me.$el).length ) {
  8375. return null;
  8376. }
  8377. }
  8378. else if ( me.rules[params[0]] ) {
  8379. if ( !val && !me.test(element, params[0]) ) {
  8380. return null;
  8381. }
  8382. me._r = 'required'
  8383. }
  8384. }
  8385. else if ( params[0] === 'not' ) {
  8386. $.each(params.slice(1), function() {
  8387. return (isValid = val !== trim(this));
  8388. });
  8389. }
  8390. else if ( params[0] === 'from' ) {
  8391. var $elements = me.$el.find(params[1]),
  8392. VALIDATED = '_validated_',
  8393. ret;
  8394. isValid = $elements.filter(function(){
  8395. var field = me.getField(this);
  8396. return field && !!trim(field.getValue());
  8397. }).length >= (params[2] || 1);
  8398. if (isValid) {
  8399. if (!val) ret = null;
  8400. } else {
  8401. ret = _getDataMsg($elements[0], me) || false;
  8402. }
  8403. if ( !$(element).data(VALIDATED) ) {
  8404. $elements.data(VALIDATED, 1).each(function(){
  8405. if (element !== this) {
  8406. me._validate(this);
  8407. }
  8408. }).removeData(VALIDATED);
  8409. }
  8410. return ret;
  8411. }
  8412. }
  8413. return isValid && !!val;
  8414. },
  8415. /**
  8416. * integer
  8417. *
  8418. * @example:
  8419. integer
  8420. integer[+]
  8421. integer[+0]
  8422. integer[-]
  8423. integer[-0]
  8424. */
  8425. integer: function(element, params) {
  8426. var re, z = '0|',
  8427. p = '[1-9]\\d*',
  8428. key = params ? params[0] : '*';
  8429. switch (key) {
  8430. case '+':
  8431. re = p;
  8432. break;
  8433. case '-':
  8434. re = '-' + p;
  8435. break;
  8436. case '+0':
  8437. re = z + p;
  8438. break;
  8439. case '-0':
  8440. re = z + '-' + p;
  8441. break;
  8442. default:
  8443. re = z + '-?' + p;
  8444. }
  8445. re = '^(?:' + re + ')$';
  8446. return new RegExp(re).test(this.value) || (this.messages.integer && this.messages.integer[key]);
  8447. },
  8448. /**
  8449. * match another field
  8450. *
  8451. * @example:
  8452. match[password] Match the password field (two values ​​must be the same)
  8453. match[eq, password] Ditto
  8454. match[neq, count] The value must be not equal to the value of the count field
  8455. match[lt, count] The value must be less than the value of the count field
  8456. match[lte, count] The value must be less than or equal to the value of the count field
  8457. match[gt, count] The value must be greater than the value of the count field
  8458. match[gte, count] The value must be greater than or equal to the value of the count field
  8459. match[gte, startDate, date]
  8460. match[gte, startTime, time]
  8461. **/
  8462. match: function(element, params) {
  8463. if (!params) return;
  8464. var me = this,
  8465. isValid = true,
  8466. a, b,
  8467. key, msg, type = 'eq', parser,
  8468. selector2, elem2, field2;
  8469. if (params.length === 1) {
  8470. key = params[0];
  8471. } else {
  8472. type = params[0];
  8473. key = params[1];
  8474. }
  8475. selector2 = _key2selector(key);
  8476. elem2 = me.$el.find(selector2)[0];
  8477. // If the compared field is not exist
  8478. if (!elem2) return;
  8479. field2 = me.getField(elem2);
  8480. a = me.value;
  8481. b = field2.getValue();
  8482. if (!me._match) {
  8483. me.$el.on('valid'+CLS_NS_FIELD+CLS_NS, selector2, function(){
  8484. $(element).trigger('validate');
  8485. });
  8486. me._match = field2._match = 1;
  8487. }
  8488. // If both fields are blank
  8489. if (!me.required && a === '' && b === '') {
  8490. return null;
  8491. }
  8492. parser = params[2];
  8493. if (parser) {
  8494. if (/^date(time)?$/i.test(parser)) {
  8495. a = _parseDate(a);
  8496. b = _parseDate(b);
  8497. } else if (parser === 'time') {
  8498. a = +a.replace(/:/g, '');
  8499. b = +b.replace(/:/g, '');
  8500. }
  8501. }
  8502. // If the compared field is incorrect, we only ensure that this field is correct.
  8503. if (type !== 'eq' && !isNaN(+a) && isNaN(+b)) {
  8504. return true;
  8505. }
  8506. switch (type) {
  8507. case 'lt':
  8508. isValid = +a < +b; break;
  8509. case 'lte':
  8510. isValid = +a <= +b; break;
  8511. case 'gte':
  8512. isValid = +a >= +b; break;
  8513. case 'gt':
  8514. isValid = +a > +b; break;
  8515. case 'neq':
  8516. isValid = a !== b; break;
  8517. default:
  8518. isValid = a === b;
  8519. }
  8520. return isValid || (
  8521. isObject(me.messages.match)
  8522. && me.messages.match[type].replace( '{1}', me._getDisplay( elem2, field2.display || key ) )
  8523. );
  8524. },
  8525. /**
  8526. * range numbers
  8527. *
  8528. * @example:
  8529. range[0~99] Number 0-99
  8530. range[0~] Number greater than or equal to 0
  8531. range[~100] Number less than or equal to 100
  8532. **/
  8533. range: function(element, params) {
  8534. return this.getRangeMsg(this.value, params);
  8535. },
  8536. /**
  8537. * how many checkbox or radio inputs that checked
  8538. *
  8539. * @example:
  8540. checked; no empty, same to required
  8541. checked[1~3] 1-3 items
  8542. checked[1~] greater than 1 item
  8543. checked[~3] less than 3 items
  8544. checked[3] 3 items
  8545. **/
  8546. checked: function(element, params) {
  8547. if ( !_checkable(element) ) return;
  8548. var me = this,
  8549. elem, count;
  8550. if (element.name) {
  8551. count = me.$el.find('input[name="' + element.name + '"]').filter(function() {
  8552. var el = this;
  8553. if (!elem && _checkable(el)) elem = el;
  8554. return !el.disabled && el.checked;
  8555. }).length;
  8556. } else {
  8557. elem = element;
  8558. count = elem.checked;
  8559. }
  8560. if (params) {
  8561. return me.getRangeMsg(count, params);
  8562. } else {
  8563. return !!count || _getDataMsg(elem, me, '') || me.messages.required || false;
  8564. }
  8565. },
  8566. /**
  8567. * length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
  8568. *
  8569. * @example:
  8570. length[6~16] 6-16 characters
  8571. length[6~] Greater than 6 characters
  8572. length[~16] Less than 16 characters
  8573. length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
  8574. **/
  8575. length: function(element, params) {
  8576. var value = this.value,
  8577. len = (params[1] === 'true' ? value.replace(rDoubleBytes, 'xx') : value).length;
  8578. return this.getRangeMsg(len, params, (params[1] ? '_2' : ''));
  8579. },
  8580. /**
  8581. * remote validation
  8582. *
  8583. * @description
  8584. * remote([get:]url [, name1, [name2 ...]]);
  8585. * Adaptation three kinds of results (Front for the successful, followed by a failure):
  8586. 1. text:
  8587. '' 'Error Message'
  8588. 2. json:
  8589. {"ok": ""} {"error": "Error Message"}
  8590. 3. json wrapper:
  8591. {"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
  8592. * @example
  8593. The simplest: remote(path/to/server);
  8594. With parameters: remote(path/to/server, name1, name2, ...);
  8595. By GET: remote(get:path/to/server, name1, name2, ...);
  8596. Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
  8597. Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)
  8598. CORS remote(cors:path/to/server)
  8599. JSONP remote(jsonp:path/to/server)
  8600. */
  8601. remote: function(element, params) {
  8602. if (!params) return;
  8603. var me = this,
  8604. arr = rAjaxType.exec(params[0]),
  8605. rule = me._rules[me._i],
  8606. data = {},
  8607. queryString = '',
  8608. url = arr[3],
  8609. type = arr[2] || 'POST', // GET / POST
  8610. rType = (arr[1]||'').toLowerCase(), // CORS / JSONP
  8611. dataType;
  8612. rule.must = true;
  8613. data[element.name] = me.value;
  8614. // There are extra fields
  8615. if (params[1]) {
  8616. $.map(params.slice(1), function(name) {
  8617. var arr, key;
  8618. if (~name.indexOf('=')) {
  8619. queryString += '&' + name;
  8620. } else {
  8621. arr = name.split(':');
  8622. name = trim(arr[0]);
  8623. key = trim(arr[1]) || name;
  8624. data[ name ] = me.$el.find( _key2selector(key) ).val();
  8625. }
  8626. });
  8627. }
  8628. data = $.param(data) + queryString;
  8629. if (!me.must && rule.data && rule.data === data) {
  8630. return rule.result;
  8631. }
  8632. // Cross-domain request, force jsonp dataType
  8633. if (rType !== 'cors' && /^https?:/.test(url) && !~url.indexOf(location.host)) {
  8634. dataType = 'jsonp';
  8635. }
  8636. // Asynchronous validation need return jqXHR objects
  8637. return $.ajax({
  8638. url: url,
  8639. type: type,
  8640. data: data,
  8641. dataType: dataType
  8642. });
  8643. },
  8644. /**
  8645. * filter characters, direct filtration without prompting error (support custom regular expressions)
  8646. *
  8647. * @example
  8648. * filter filtering unsafe characters
  8649. * filter(regexp) filtering the "regexp" matched characters
  8650. */
  8651. filter: function(element, params) {
  8652. var value = this.value,
  8653. temp = value.replace( params ? (new RegExp('[' + params[0] + ']', 'gm')) : rUnsafe, '' );
  8654. if (temp !== value) this.setValue(temp);
  8655. }
  8656. });
  8657. /**
  8658. * Config global options
  8659. *
  8660. * @static config
  8661. * @param {Object} options
  8662. */
  8663. Validator.config = function(key, value) {
  8664. if (isObject(key)) {
  8665. $.each(key, _config);
  8666. }
  8667. else if (isString(key)) {
  8668. _config(key, value);
  8669. }
  8670. function _config(k, o) {
  8671. if (k === 'rules') {
  8672. new Rules(o);
  8673. }
  8674. else if (k === 'messages') {
  8675. new Messages(o);
  8676. }
  8677. else if (k in fieldDefaults) {
  8678. fieldDefaults[k] = o;
  8679. }
  8680. else {
  8681. defaults[k] = o;
  8682. }
  8683. }
  8684. };
  8685. /**
  8686. * Config themes
  8687. *
  8688. * @static setTheme
  8689. * @param {String|Object} name
  8690. * @param {Object} obj
  8691. * @example
  8692. .setTheme( themeName, themeOptions )
  8693. .setTheme( multiThemes )
  8694. */
  8695. Validator.setTheme = function(name, obj) {
  8696. if ( isObject(name) ) {
  8697. $.extend(true, themes, name);
  8698. }
  8699. else if ( isString(name) && isObject(obj) ) {
  8700. themes[name] = $.extend(themes[name], obj);
  8701. }
  8702. };
  8703. /**
  8704. * Resource loader
  8705. *
  8706. * @static load
  8707. * @param {String} str
  8708. * @example
  8709. .load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css
  8710. .load('local=zh-CN&css=') // load: local/zh-CN.js
  8711. .load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css
  8712. .load('local') // dito
  8713. */
  8714. Validator.load = function(str) {
  8715. if (!str) return;
  8716. var doc = document,
  8717. params = {},
  8718. node = doc.scripts[0],
  8719. dir, el, ONLOAD;
  8720. str.replace(/([^?=&]+)=([^&#]*)/g, function(m, key, value){
  8721. params[key] = value;
  8722. });
  8723. dir = params.dir || Validator.dir;
  8724. if (!Validator.css && params.css !== '') {
  8725. el = doc.createElement('link');
  8726. el.rel = 'stylesheet';
  8727. el.href = Validator.css = dir + 'jquery.validator.css';
  8728. node.parentNode.insertBefore(el, node);
  8729. }
  8730. if (!Validator.local && ~str.indexOf('local') && params.local !== '') {
  8731. Validator.local = (params.local || doc.documentElement.lang || 'en').replace('_','-');
  8732. Validator.pending = 1;
  8733. el = doc.createElement('script');
  8734. el.src = dir + 'local/' + Validator.local + '.js';
  8735. ONLOAD = 'onload' in el ? 'onload' : 'onreadystatechange';
  8736. el[ONLOAD] = function() {
  8737. if (!el.readyState || /loaded|complete/.test(el.readyState)) {
  8738. el = el[ONLOAD] = null;
  8739. delete Validator.pending;
  8740. $(window).triggerHandler('validatorready');
  8741. }
  8742. };
  8743. node.parentNode.insertBefore(el, node);
  8744. }
  8745. };
  8746. // Auto loading resources
  8747. (function(){
  8748. var scripts = document.scripts,
  8749. i = scripts.length, node, arr,
  8750. re = /(.*validator(?:\.min)?.js)(\?.*(?:local|css|dir)(?:=[\w\-]*)?)?/;
  8751. while (i-- && !arr) {
  8752. node = scripts[i];
  8753. arr = (node.hasAttribute ? node.src : node.getAttribute('src',4)||'').match(re);
  8754. }
  8755. if (!arr) return;
  8756. Validator.dir = arr[1].split('/').slice(0, -1).join('/')+'/';
  8757. Validator.load(arr[2]);
  8758. })();
  8759. return $[NS] = Validator;
  8760. }));
  8761. /*********************************
  8762. * Themes, rules, and i18n support
  8763. * Locale: Chinese; 中文
  8764. *********************************/
  8765. (function(factory) {
  8766. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  8767. typeof define === 'function' && define.amd ? define('validator-lang',['jquery'], factory) :
  8768. factory(jQuery);
  8769. }(function($) {
  8770. /* Global configuration
  8771. */
  8772. $.validator.config({
  8773. //stopOnError: true,
  8774. //focusCleanup: true,
  8775. //theme: 'yellow_right',
  8776. //timely: 2,
  8777. // Custom rules
  8778. rules: {
  8779. digits: [/^\d+$/, "请填写数字"]
  8780. ,letters: [/^[a-z]+$/i, "请填写字母"]
  8781. ,date: [/^\d{4}-\d{2}-\d{2}$/, "请填写有效的日期,格式:yyyy-mm-dd"]
  8782. ,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请填写有效的时间,00:00到23:59之间"]
  8783. ,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "请填写有效的邮箱"]
  8784. ,url: [/^(https?|s?ftp):\/\/\S+$/i, "请填写有效的网址"]
  8785. ,qq: [/^[1-9]\d{4,}$/, "请填写有效的QQ号"]
  8786. ,IDcard: [/^\d{6}(19|2\d)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)?$/, "请填写正确的身份证号码"]
  8787. ,tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "请填写有效的电话号码"]
  8788. ,mobile: [/^1[3-9]\d{9}$/, "请填写有效的手机号"]
  8789. ,zipcode: [/^\d{6}$/, "请检查邮政编码格式"]
  8790. ,chinese: [/^[\u0391-\uFFE5]+$/, "请填写中文字符"]
  8791. ,username: [/^\w{3,12}$/, "请填写3-12位数字、字母、下划线"]
  8792. ,password: [/^[\S]{6,16}$/, "请填写6-16位字符,不能包含空格"]
  8793. ,accept: function (element, params){
  8794. if (!params) return true;
  8795. var ext = params[0],
  8796. value = $(element).val();
  8797. return (ext === '*') ||
  8798. (new RegExp(".(?:" + ext + ")$", "i")).test(value) ||
  8799. this.renderMsg("只接受{1}后缀的文件", ext.replace(/\|/g, ','));
  8800. }
  8801. },
  8802. // Default error messages
  8803. messages: {
  8804. 0: "此处",
  8805. fallback: "{0}格式不正确",
  8806. loading: "正在验证...",
  8807. error: "网络异常",
  8808. timeout: "请求超时",
  8809. required: "{0}不能为空",
  8810. remote: "{0}已被使用",
  8811. integer: {
  8812. '*': "请填写整数",
  8813. '+': "请填写正整数",
  8814. '+0': "请填写正整数或0",
  8815. '-': "请填写负整数",
  8816. '-0': "请填写负整数或0"
  8817. },
  8818. match: {
  8819. eq: "{0}与{1}不一致",
  8820. neq: "{0}与{1}不能相同",
  8821. lt: "{0}必须小于{1}",
  8822. gt: "{0}必须大于{1}",
  8823. lte: "{0}不能大于{1}",
  8824. gte: "{0}不能小于{1}"
  8825. },
  8826. range: {
  8827. rg: "请填写{1}到{2}的数",
  8828. gte: "请填写不小于{1}的数",
  8829. lte: "请填写最大{1}的数",
  8830. gtlt: "请填写{1}到{2}之间的数",
  8831. gt: "请填写大于{1}的数",
  8832. lt: "请填写小于{1}的数"
  8833. },
  8834. checked: {
  8835. eq: "请选择{1}项",
  8836. rg: "请选择{1}到{2}项",
  8837. gte: "请至少选择{1}项",
  8838. lte: "请最多选择{1}项"
  8839. },
  8840. length: {
  8841. eq: "请填写{1}个字符",
  8842. rg: "请填写{1}到{2}个字符",
  8843. gte: "请至少填写{1}个字符",
  8844. lte: "请最多填写{1}个字符",
  8845. eq_2: "",
  8846. rg_2: "",
  8847. gte_2: "",
  8848. lte_2: ""
  8849. }
  8850. }
  8851. });
  8852. /* Themes
  8853. */
  8854. var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
  8855. $.validator.setTheme({
  8856. 'simple_right': {
  8857. formClass: 'n-simple',
  8858. msgClass: 'n-right'
  8859. },
  8860. 'simple_bottom': {
  8861. formClass: 'n-simple',
  8862. msgClass: 'n-bottom'
  8863. },
  8864. 'yellow_top': {
  8865. formClass: 'n-yellow',
  8866. msgClass: 'n-top',
  8867. msgArrow: TPL_ARROW
  8868. },
  8869. 'yellow_right': {
  8870. formClass: 'n-yellow',
  8871. msgClass: 'n-right',
  8872. msgArrow: TPL_ARROW
  8873. },
  8874. 'yellow_right_effect': {
  8875. formClass: 'n-yellow',
  8876. msgClass: 'n-right',
  8877. msgArrow: TPL_ARROW,
  8878. msgShow: function($msgbox, type){
  8879. var $el = $msgbox.children();
  8880. if ($el.is(':animated')) return;
  8881. if (type === 'error') {
  8882. $el.css({left: '20px', opacity: 0})
  8883. .delay(100).show().stop()
  8884. .animate({left: '-4px', opacity: 1}, 150)
  8885. .animate({left: '3px'}, 80)
  8886. .animate({left: 0}, 80);
  8887. } else {
  8888. $el.css({left: 0, opacity: 1}).fadeIn(200);
  8889. }
  8890. },
  8891. msgHide: function($msgbox, type){
  8892. var $el = $msgbox.children();
  8893. $el.stop().delay(100).show()
  8894. .animate({left: '20px', opacity: 0}, 300, function(){
  8895. $msgbox.hide();
  8896. });
  8897. }
  8898. }
  8899. });
  8900. }));
  8901. define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], function ($, undefined, Upload, Validator, undefined) {
  8902. var Form = {
  8903. config: {
  8904. 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>'
  8905. },
  8906. events: {
  8907. validator: function (form, success, error, submit) {
  8908. if (!form.is("form"))
  8909. return;
  8910. //绑定表单事件
  8911. form.validator($.extend({
  8912. rules: {
  8913. username: [/^\w{3,30}$/, __('Username must be 3 to 30 characters')],
  8914. password: [/^[\S]{6,30}$/, __('Password must be 6 to 30 characters')]
  8915. },
  8916. validClass: 'has-success',
  8917. invalidClass: 'has-error',
  8918. bindClassTo: '.form-group',
  8919. formClass: 'n-default n-bootstrap',
  8920. msgClass: 'n-right',
  8921. stopOnError: true,
  8922. display: function (elem) {
  8923. return $(elem).closest('.form-group').find(".control-label").text().replace(/\:/, '');
  8924. },
  8925. dataFilter: function (data) {
  8926. if (data.code === 1) {
  8927. return data.msg ? {"ok": data.msg} : '';
  8928. } else {
  8929. return data.msg;
  8930. }
  8931. },
  8932. target: function (input) {
  8933. var target = $(input).data("target");
  8934. if (target && $(target).length > 0) {
  8935. return $(target);
  8936. }
  8937. var $formitem = $(input).closest('.form-group'),
  8938. $msgbox = $formitem.find('span.msg-box');
  8939. if (!$msgbox.length) {
  8940. return [];
  8941. }
  8942. return $msgbox;
  8943. },
  8944. valid: function (ret) {
  8945. var that = this, submitBtn = $(".layer-footer [type=submit]", form);
  8946. that.holdSubmit(true);
  8947. submitBtn.addClass("disabled");
  8948. //验证通过提交表单
  8949. var submitResult = Form.api.submit($(ret), function (data, ret) {
  8950. that.holdSubmit(false);
  8951. submitBtn.removeClass("disabled");
  8952. if (false === $(this).triggerHandler("success.form", [data, ret])) {
  8953. return false;
  8954. }
  8955. if (typeof success === 'function') {
  8956. if (false === success.call($(this), data, ret)) {
  8957. return false;
  8958. }
  8959. }
  8960. //提示及关闭当前窗口
  8961. var msg = ret.hasOwnProperty("msg") && ret.msg !== "" ? ret.msg : __('Operation completed');
  8962. parent.Toastr.success(msg);
  8963. parent.$(".btn-refresh").trigger("click");
  8964. var index = parent.Layer.getFrameIndex(window.name);
  8965. parent.Layer.close(index);
  8966. return false;
  8967. }, function (data, ret) {
  8968. that.holdSubmit(false);
  8969. if (false === $(this).triggerHandler("error.form", [data, ret])) {
  8970. return false;
  8971. }
  8972. submitBtn.removeClass("disabled");
  8973. if (typeof error === 'function') {
  8974. if (false === error.call($(this), data, ret)) {
  8975. return false;
  8976. }
  8977. }
  8978. }, submit);
  8979. //如果提交失败则释放锁定
  8980. if (!submitResult) {
  8981. that.holdSubmit(false);
  8982. submitBtn.removeClass("disabled");
  8983. }
  8984. return false;
  8985. }
  8986. }, form.data("validator-options") || {}));
  8987. //移除提交按钮的disabled类
  8988. $(".layer-footer [type=submit],.fixed-footer [type=submit],.normal-footer [type=submit]", form).removeClass("disabled");
  8989. //自定义关闭按钮事件
  8990. form.on("click", ".layer-close", function () {
  8991. var index = parent.Layer.getFrameIndex(window.name);
  8992. parent.Layer.close(index);
  8993. return false;
  8994. });
  8995. },
  8996. selectpicker: function (form) {
  8997. //绑定select元素事件
  8998. if ($(".selectpicker", form).length > 0) {
  8999. require(['bootstrap-select', 'bootstrap-select-lang'], function () {
  9000. $('.selectpicker', form).selectpicker();
  9001. $(form).on("reset", function () {
  9002. setTimeout(function () {
  9003. $('.selectpicker').selectpicker('refresh').trigger("change");
  9004. }, 1);
  9005. });
  9006. });
  9007. }
  9008. },
  9009. selectpage: function (form) {
  9010. //绑定selectpage元素事件
  9011. if ($(".selectpage", form).length > 0) {
  9012. require(['selectpage'], function () {
  9013. $('.selectpage', form).selectPage({
  9014. eAjaxSuccess: function (data) {
  9015. data.list = typeof data.rows !== 'undefined' ? data.rows : (typeof data.list !== 'undefined' ? data.list : []);
  9016. data.totalRow = typeof data.total !== 'undefined' ? data.total : (typeof data.totalRow !== 'undefined' ? data.totalRow : data.list.length);
  9017. return data;
  9018. }
  9019. });
  9020. });
  9021. //给隐藏的元素添加上validate验证触发事件
  9022. $(document).on("change", ".sp_hidden", function () {
  9023. $(this).trigger("validate");
  9024. });
  9025. $(document).on("change", ".sp_input", function () {
  9026. $(this).closest(".sp_container").find(".sp_hidden").trigger("change");
  9027. });
  9028. $(form).on("reset", function () {
  9029. setTimeout(function () {
  9030. $('.selectpage', form).selectPageClear();
  9031. }, 1);
  9032. });
  9033. }
  9034. },
  9035. cxselect: function (form) {
  9036. //绑定cxselect元素事件
  9037. if ($("[data-toggle='cxselect']", form).length > 0) {
  9038. require(['cxselect'], function () {
  9039. $.cxSelect.defaults.jsonName = 'name';
  9040. $.cxSelect.defaults.jsonValue = 'value';
  9041. $.cxSelect.defaults.jsonSpace = 'data';
  9042. $("[data-toggle='cxselect']", form).cxSelect();
  9043. });
  9044. }
  9045. },
  9046. citypicker: function (form) {
  9047. //绑定城市远程插件
  9048. if ($("[data-toggle='city-picker']", form).length > 0) {
  9049. require(['citypicker'], function () {
  9050. $(form).on("reset", function () {
  9051. setTimeout(function () {
  9052. $("[data-toggle='city-picker']").citypicker('refresh');
  9053. }, 1);
  9054. });
  9055. });
  9056. }
  9057. },
  9058. datetimepicker: function (form) {
  9059. //绑定日期时间元素事件
  9060. if ($(".datetimepicker", form).length > 0) {
  9061. require(['bootstrap-datetimepicker'], function () {
  9062. var options = {
  9063. format: 'YYYY-MM-DD HH:mm:ss',
  9064. icons: {
  9065. time: 'fa fa-clock-o',
  9066. date: 'fa fa-calendar',
  9067. up: 'fa fa-chevron-up',
  9068. down: 'fa fa-chevron-down',
  9069. previous: 'fa fa-chevron-left',
  9070. next: 'fa fa-chevron-right',
  9071. today: 'fa fa-history',
  9072. clear: 'fa fa-trash',
  9073. close: 'fa fa-remove'
  9074. },
  9075. showTodayButton: true,
  9076. showClose: true
  9077. };
  9078. $('.datetimepicker', form).parent().css('position', 'relative');
  9079. $('.datetimepicker', form).datetimepicker(options).on('dp.change', function (e) {
  9080. $(this, document).trigger("changed");
  9081. });
  9082. });
  9083. }
  9084. },
  9085. daterangepicker: function (form) {
  9086. //绑定日期时间元素事件
  9087. if ($(".datetimerange", form).length > 0) {
  9088. require(['bootstrap-daterangepicker'], function () {
  9089. var ranges = {};
  9090. ranges[__('Today')] = [Moment().startOf('day'), Moment().endOf('day')];
  9091. ranges[__('Yesterday')] = [Moment().subtract(1, 'days').startOf('day'), Moment().subtract(1, 'days').endOf('day')];
  9092. ranges[__('Last 7 Days')] = [Moment().subtract(6, 'days').startOf('day'), Moment().endOf('day')];
  9093. ranges[__('Last 30 Days')] = [Moment().subtract(29, 'days').startOf('day'), Moment().endOf('day')];
  9094. ranges[__('This Month')] = [Moment().startOf('month'), Moment().endOf('month')];
  9095. ranges[__('Last Month')] = [Moment().subtract(1, 'month').startOf('month'), Moment().subtract(1, 'month').endOf('month')];
  9096. var options = {
  9097. timePicker: false,
  9098. autoUpdateInput: false,
  9099. timePickerSeconds: true,
  9100. timePicker24Hour: true,
  9101. autoApply: true,
  9102. locale: {
  9103. format: 'YYYY-MM-DD HH:mm:ss',
  9104. customRangeLabel: __("Custom Range"),
  9105. applyLabel: __("Apply"),
  9106. cancelLabel: __("Clear"),
  9107. },
  9108. ranges: ranges,
  9109. };
  9110. var origincallback = function (start, end) {
  9111. $(this.element).val(start.format(this.locale.format) + " - " + end.format(this.locale.format));
  9112. $(this.element).trigger('blur');
  9113. };
  9114. $(".datetimerange", form).each(function () {
  9115. var callback = typeof $(this).data('callback') == 'function' ? $(this).data('callback') : origincallback;
  9116. $(this).on('apply.daterangepicker', function (ev, picker) {
  9117. callback.call(picker, picker.startDate, picker.endDate);
  9118. });
  9119. $(this).on('cancel.daterangepicker', function (ev, picker) {
  9120. $(this).val('').trigger('blur');
  9121. });
  9122. $(this).daterangepicker($.extend(true, options, $(this).data() || {}, $(this).data("daterangepicker-options") || {}));
  9123. });
  9124. });
  9125. }
  9126. },
  9127. /**
  9128. * 绑定上传事件
  9129. * @param form
  9130. * @deprecated Use faupload instead.
  9131. */
  9132. plupload: function (form) {
  9133. Form.events.faupload(form);
  9134. },
  9135. /**
  9136. * 绑定上传事件
  9137. * @param form
  9138. */
  9139. faupload: function (form) {
  9140. //绑定上传元素事件
  9141. if ($(".plupload,.faupload", form).length > 0) {
  9142. Upload.api.upload($(".plupload,.faupload", form));
  9143. }
  9144. },
  9145. faselect: function (form) {
  9146. //绑定fachoose选择附件事件
  9147. if ($(".faselect,.fachoose", form).length > 0) {
  9148. $(".faselect,.fachoose", form).off('click').on('click', function () {
  9149. var that = this;
  9150. var multiple = $(this).data("multiple") ? $(this).data("multiple") : false;
  9151. var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : '';
  9152. var admin_id = $(this).data("admin-id") ? $(this).data("admin-id") : '';
  9153. var user_id = $(this).data("user-id") ? $(this).data("user-id") : '';
  9154. mimetype = mimetype.replace(/\/\*/ig, '/');
  9155. var url = $(this).data("url") ? $(this).data("url") : (typeof Backend !== 'undefined' ? "general/attachment/select" : "user/attachment");
  9156. parent.Fast.api.open(url + "?element_id=" + $(this).attr("id") + "&multiple=" + multiple + "&mimetype=" + mimetype + "&admin_id=" + admin_id + "&user_id=" + user_id, __('Choose'), {
  9157. callback: function (data) {
  9158. var button = $("#" + $(that).attr("id"));
  9159. var maxcount = $(button).data("maxcount");
  9160. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  9161. maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
  9162. if (input_id && data.multiple) {
  9163. var urlArr = [];
  9164. var inputObj = $("#" + input_id);
  9165. var value = $.trim(inputObj.val());
  9166. if (value !== "") {
  9167. urlArr.push(inputObj.val());
  9168. }
  9169. var nums = value === '' ? 0 : value.split(/\,/).length;
  9170. var files = data.url !== "" ? data.url.split(/\,/) : [];
  9171. $.each(files, function (i, j) {
  9172. var url = Config.upload.fullmode ? Fast.api.cdnurl(j) : j;
  9173. urlArr.push(url);
  9174. });
  9175. if (maxcount > 0) {
  9176. var remains = maxcount - nums;
  9177. if (files.length > remains) {
  9178. Toastr.error(__('You can choose up to %d file%s', remains));
  9179. return false;
  9180. }
  9181. }
  9182. var result = urlArr.join(",");
  9183. inputObj.val(result).trigger("change").trigger("validate");
  9184. } else {
  9185. var url = Config.upload.fullmode ? Fast.api.cdnurl(data.url) : data.url;
  9186. $("#" + input_id).val(url).trigger("change").trigger("validate");
  9187. }
  9188. }
  9189. });
  9190. return false;
  9191. });
  9192. }
  9193. },
  9194. fieldlist: function (form) {
  9195. //绑定fieldlist
  9196. if ($(".fieldlist", form).length > 0) {
  9197. require(['dragsort', 'template'], function (undefined, Template) {
  9198. //刷新隐藏textarea的值
  9199. var refresh = function (container) {
  9200. var data = {};
  9201. var name = container.data("name");
  9202. var textarea = $("textarea[name='" + name + "']", form);
  9203. var template = container.data("template");
  9204. $.each($("input,select,textarea", container).serializeArray(), function (i, j) {
  9205. var reg = /\[(\w+)\]\[(\w+)\]$/g;
  9206. var match = reg.exec(j.name);
  9207. if (!match)
  9208. return true;
  9209. match[1] = "x" + parseInt(match[1]);
  9210. if (typeof data[match[1]] == 'undefined') {
  9211. data[match[1]] = {};
  9212. }
  9213. data[match[1]][match[2]] = j.value;
  9214. });
  9215. var result = template ? [] : {};
  9216. $.each(data, function (i, j) {
  9217. if (j) {
  9218. if (!template) {
  9219. if (j.key != '') {
  9220. result[j.key] = j.value;
  9221. }
  9222. } else {
  9223. result.push(j);
  9224. }
  9225. }
  9226. });
  9227. textarea.val(JSON.stringify(result));
  9228. };
  9229. //追加一行数据
  9230. var append = function (container, row, initial) {
  9231. var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
  9232. var index = container.data("index");
  9233. var name = container.data("name");
  9234. var template = container.data("template");
  9235. var data = container.data();
  9236. index = index ? parseInt(index) : 0;
  9237. container.data("index", index + 1);
  9238. row = row ? row : {};
  9239. row = typeof row.key === 'undefined' || typeof row.value === 'undefined' ? {key: '', value: row} : row;
  9240. var options = container.data("fieldlist-options") || {};
  9241. var vars = {index: index, name: name, data: data, options: options, key: row.key, value: row.value, row: row.value};
  9242. var html = template ? Template(template, vars) : Template.render(Form.config.fieldlisttpl, vars);
  9243. var obj = $(html);
  9244. if ((options.deleteBtn === false || options.removeBtn === false) && initial)
  9245. obj.find(".btn-remove").remove();
  9246. if (options.dragsortBtn === false && initial)
  9247. obj.find(".btn-dragsort").remove();
  9248. if ((options.readonlyKey === true || options.disableKey === true) && initial) {
  9249. obj.find("input[name$='[key]']").prop("readonly", true);
  9250. }
  9251. obj.attr("fieldlist-item", true);
  9252. obj.insertAfter($(tagName + "[fieldlist-item]", container).length > 0 ? $(tagName + "[fieldlist-item]:last", container) : $(tagName + ":first", container));
  9253. if ($(".btn-append,.append", container).length > 0) {
  9254. //兼容旧版本事件
  9255. $(".btn-append,.append", container).trigger("fa.event.appendfieldlist", obj);
  9256. } else {
  9257. //新版本事件
  9258. container.trigger("fa.event.appendfieldlist", obj);
  9259. }
  9260. return obj;
  9261. };
  9262. var fieldlist = $(".fieldlist", form);
  9263. //监听文本框改变事件
  9264. $(document).on('change keyup changed', ".fieldlist input,.fieldlist textarea,.fieldlist select", function () {
  9265. var container = $(this).closest(".fieldlist");
  9266. refresh(container);
  9267. });
  9268. //追加控制(点击按钮)
  9269. fieldlist.on("click", ".btn-append,.append", function (e, row) {
  9270. var container = $(this).closest(".fieldlist");
  9271. append(container, row);
  9272. // refresh(container);
  9273. });
  9274. //移除控制(点击按钮)
  9275. fieldlist.on("click", ".btn-remove", function () {
  9276. var container = $(this).closest(".fieldlist");
  9277. var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
  9278. $(this).closest(tagName).remove();
  9279. refresh(container);
  9280. });
  9281. //追加控制(通过事件)
  9282. fieldlist.on("fa.event.appendtofieldlist", function (e, row) {
  9283. var container = $(this);
  9284. append(container, row);
  9285. refresh(container);
  9286. });
  9287. //根据textarea内容重新渲染
  9288. fieldlist.on("fa.event.refreshfieldlist", function () {
  9289. var container = $(this);
  9290. var textarea = $("textarea[name='" + container.data("name") + "']", form);
  9291. //先清空已有的数据
  9292. $("[fieldlist-item]", container).remove();
  9293. var json = {};
  9294. try {
  9295. json = JSON.parse(textarea.val());
  9296. } catch (e) {
  9297. }
  9298. $.each(json, function (i, j) {
  9299. append(container, {key: i, value: j}, true);
  9300. });
  9301. });
  9302. //拖拽排序
  9303. fieldlist.each(function () {
  9304. var container = $(this);
  9305. var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
  9306. container.dragsort({
  9307. itemSelector: tagName,
  9308. dragSelector: ".btn-dragsort",
  9309. dragEnd: function () {
  9310. refresh(container);
  9311. },
  9312. placeHolderTemplate: $("<" + tagName + "/>")
  9313. });
  9314. if (typeof container.data("options") === 'object' && container.data("options").appendBtn === false) {
  9315. $(".btn-append,.append", container).hide();
  9316. }
  9317. $("textarea[name='" + container.data("name") + "']", form).on("fa.event.refreshfieldlist", function () {
  9318. //兼容旧版本事件
  9319. $(this).closest(".fieldlist").trigger("fa.event.refreshfieldlist");
  9320. });
  9321. });
  9322. fieldlist.trigger("fa.event.refreshfieldlist");
  9323. });
  9324. }
  9325. },
  9326. switcher: function (form) {
  9327. form.on("click", "[data-toggle='switcher']", function () {
  9328. if ($(this).hasClass("disabled")) {
  9329. return false;
  9330. }
  9331. var switcher = $.proxy(function () {
  9332. var input = $(this).prev("input");
  9333. input = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : input;
  9334. if (input.length > 0) {
  9335. var yes = $(this).data("yes");
  9336. var no = $(this).data("no");
  9337. if (input.val() == yes) {
  9338. input.val(no);
  9339. $("i", this).addClass("fa-flip-horizontal text-gray");
  9340. } else {
  9341. input.val(yes);
  9342. $("i", this).removeClass("fa-flip-horizontal text-gray");
  9343. }
  9344. input.trigger('change');
  9345. }
  9346. }, this);
  9347. if (typeof $(this).data("confirm") !== 'undefined') {
  9348. Layer.confirm($(this).data("confirm"), function (index) {
  9349. switcher();
  9350. Layer.close(index);
  9351. });
  9352. } else {
  9353. switcher();
  9354. }
  9355. return false;
  9356. });
  9357. },
  9358. bindevent: function (form) {
  9359. },
  9360. slider: function (form) {
  9361. if ($(".slider", form).length > 0) {
  9362. require(['bootstrap-slider'], function () {
  9363. $('.slider').removeClass('hidden').css('width', function (index, value) {
  9364. return $(this).parents('.form-control').width();
  9365. }).slider().on('slide', function (ev) {
  9366. var data = $(this).data();
  9367. if (typeof data.unit !== 'undefined') {
  9368. $(this).parents('.form-control').siblings('.value').text(ev.value + data.unit);
  9369. }
  9370. });
  9371. });
  9372. }
  9373. },
  9374. tagsinput: function (form) {
  9375. if ($("[data-role='tagsinput']", form).length > 0) {
  9376. require(['tagsinput', 'autocomplete'], function () {
  9377. $("[data-role='tagsinput']").tagsinput();
  9378. });
  9379. }
  9380. },
  9381. autocomplete: function (form) {
  9382. if ($("[data-role='autocomplete']", form).length > 0) {
  9383. require(['autocomplete'], function () {
  9384. $("[data-role='autocomplete']").autocomplete();
  9385. });
  9386. }
  9387. },
  9388. favisible: function (form) {
  9389. if ($("[data-favisible]", form).length == 0) {
  9390. return;
  9391. }
  9392. var checkCondition = function (condition) {
  9393. var conditionArr = condition.split(/&&/);
  9394. var success = 0;
  9395. var baseregex = /^([a-z0-9\_]+)([>|<|=|\!]=?)(.*)$/i, strregex = /^('|")(.*)('|")$/, regregex = /^regex:(.*)$/;
  9396. // @formatter:off
  9397. var operator_result = {
  9398. '>': function(a, b) { return a > b; },
  9399. '>=': function(a, b) { return a >= b; },
  9400. '<': function(a, b) { return a < b; },
  9401. '<=': function(a, b) { return a <= b; },
  9402. '==': function(a, b) { return a == b; },
  9403. '!=': function(a, b) { return a != b; },
  9404. 'in': function(a, b) { return b.split(/\,/).indexOf(a) > -1; },
  9405. 'regex': function(a, b) {
  9406. var regParts = b.match(/^\/(.*?)\/([gim]*)$/);
  9407. var regexp = regParts ? new RegExp(regParts[1], regParts[2]) : new RegExp(b);
  9408. return regexp.test(a);
  9409. }
  9410. };
  9411. // @formatter:on
  9412. var dataArr = form.serializeArray(), dataObj = {}, fieldName, fieldValue;
  9413. $(dataArr).each(function (i, field) {
  9414. fieldName = field.name;
  9415. fieldValue = field.value;
  9416. fieldName = fieldName.substr(-2) === '[]' ? fieldName.substr(0, fieldName.length - 2) : fieldName;
  9417. dataObj[fieldName] = typeof dataObj[fieldName] !== 'undefined' ? [dataObj[fieldName], fieldValue].join(',') : fieldValue;
  9418. });
  9419. $.each(conditionArr, function (i, item) {
  9420. var basematches = baseregex.exec(item);
  9421. if (basematches) {
  9422. var name = basematches[1], operator = basematches[2], value = basematches[3].toString();
  9423. if (operator === '=') {
  9424. var strmatches = strregex.exec(value);
  9425. operator = strmatches ? '==' : 'in';
  9426. value = strmatches ? strmatches[2] : value;
  9427. }
  9428. var regmatches = regregex.exec(value);
  9429. if (regmatches) {
  9430. operator = 'regex';
  9431. value = regmatches[1];
  9432. }
  9433. var chkname = "row[" + name + "]";
  9434. if (typeof dataObj[chkname] === 'undefined') {
  9435. return false;
  9436. }
  9437. var objvalue = dataObj[chkname];
  9438. if ($.isArray(objvalue)) {
  9439. objvalue = dataObj[chkname].join(",");
  9440. }
  9441. if (['>', '>=', '<', '<='].indexOf(operator) > -1) {
  9442. objvalue = parseFloat(objvalue);
  9443. value = parseFloat(value);
  9444. }
  9445. var result = operator_result[operator](objvalue, value);
  9446. success += (result ? 1 : 0);
  9447. }
  9448. });
  9449. return success === conditionArr.length;
  9450. };
  9451. form.on("keyup change click configchange", "input,select", function () {
  9452. $("[data-favisible][data-favisible!='']", form).each(function () {
  9453. var visible = $(this).data("favisible");
  9454. var groupArr = visible.split(/\|\|/);
  9455. var success = 0;
  9456. $.each(groupArr, function (i, j) {
  9457. if (checkCondition(j)) {
  9458. success++;
  9459. }
  9460. });
  9461. if (success > 0) {
  9462. $(this).removeClass("hidden");
  9463. } else {
  9464. $(this).addClass("hidden");
  9465. }
  9466. });
  9467. });
  9468. //追加上忽略元素
  9469. setTimeout(function () {
  9470. form.data('validator').options.ignore += ((form.data('validator').options.ignore ? ',' : '') + '[data-favisible] :hidden,[data-favisible]:hidden');
  9471. }, 0);
  9472. $("input,select", form).trigger("configchange");
  9473. }
  9474. },
  9475. api: {
  9476. submit: function (form, success, error, submit) {
  9477. if (form.length === 0) {
  9478. Toastr.error("表单未初始化完成,无法提交");
  9479. return false;
  9480. }
  9481. if (typeof submit === 'function') {
  9482. if (false === submit.call(form, success, error)) {
  9483. return false;
  9484. }
  9485. }
  9486. var type = form.attr("method") ? form.attr("method").toUpperCase() : 'GET';
  9487. type = type && (type === 'GET' || type === 'POST') ? type : 'GET';
  9488. url = form.attr("action");
  9489. url = url ? url : location.href;
  9490. //修复当存在多选项元素时提交的BUG
  9491. var params = {};
  9492. var multipleList = $("[name$='[]']", form);
  9493. if (multipleList.length > 0) {
  9494. var postFields = form.serializeArray().map(function (obj) {
  9495. return $(obj).prop("name");
  9496. });
  9497. $.each(multipleList, function (i, j) {
  9498. if (postFields.indexOf($(this).prop("name")) < 0) {
  9499. params[$(this).prop("name")] = '';
  9500. }
  9501. });
  9502. }
  9503. //调用Ajax请求方法
  9504. Fast.api.ajax({
  9505. type: type,
  9506. url: url,
  9507. data: form.serialize() + (Object.keys(params).length > 0 ? '&' + $.param(params) : ''),
  9508. dataType: 'json',
  9509. complete: function (xhr) {
  9510. var token = xhr.getResponseHeader('__token__');
  9511. if (token) {
  9512. $("input[name='__token__']").val(token);
  9513. }
  9514. }
  9515. }, function (data, ret) {
  9516. $('.form-group', form).removeClass('has-feedback has-success has-error');
  9517. if (data && typeof data === 'object') {
  9518. //刷新客户端token
  9519. if (typeof data.token !== 'undefined') {
  9520. $("input[name='__token__']").val(data.token);
  9521. }
  9522. //调用客户端事件
  9523. if (typeof data.callback !== 'undefined' && typeof data.callback === 'function') {
  9524. data.callback.call(form, data);
  9525. }
  9526. }
  9527. if (typeof success === 'function') {
  9528. if (false === success.call(form, data, ret)) {
  9529. return false;
  9530. }
  9531. }
  9532. }, function (data, ret) {
  9533. if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
  9534. $("input[name='__token__']").val(data.token);
  9535. }
  9536. if (typeof error === 'function') {
  9537. if (false === error.call(form, data, ret)) {
  9538. return false;
  9539. }
  9540. }
  9541. });
  9542. return true;
  9543. },
  9544. bindevent: function (form, success, error, submit) {
  9545. form = typeof form === 'object' ? form : $(form);
  9546. var events = Form.events;
  9547. events.bindevent(form);
  9548. events.validator(form, success, error, submit);
  9549. events.selectpicker(form);
  9550. events.daterangepicker(form);
  9551. events.selectpage(form);
  9552. events.cxselect(form);
  9553. events.citypicker(form);
  9554. events.datetimepicker(form);
  9555. events.faupload(form);
  9556. events.faselect(form);
  9557. events.fieldlist(form);
  9558. events.slider(form);
  9559. events.switcher(form);
  9560. events.tagsinput(form);
  9561. events.autocomplete(form);
  9562. events.favisible(form);
  9563. },
  9564. custom: {}
  9565. },
  9566. };
  9567. return Form;
  9568. });
  9569. /**
  9570. * FastAdmin通用搜索
  9571. *
  9572. * @author: pppscn <35696959@qq.com>
  9573. * @update 2017-05-07 <https://gitee.com/pp/fastadmin>
  9574. *
  9575. * @author: Karson <karson@fastadmin.net>
  9576. * @update 2018-04-05 <https://gitee.com/karson/fastadmin>
  9577. */
  9578. !function ($) {
  9579. 'use strict';
  9580. var ColumnsForSearch = [];
  9581. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  9582. var initCommonSearch = function (pColumns, that) {
  9583. var vFormCommon = createFormCommon(pColumns, that);
  9584. var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden");
  9585. vModal += vFormCommon;
  9586. vModal += "</div>";
  9587. that.$container.prepend($(vModal));
  9588. that.$commonsearch = $(".commonsearch-table", that.$container);
  9589. var form = $("form.form-commonsearch", that.$commonsearch);
  9590. require(['form'], function (Form) {
  9591. Form.api.bindevent(form);
  9592. form.validator("destroy");
  9593. });
  9594. // 表单提交
  9595. form.on("submit", function (event) {
  9596. event.preventDefault();
  9597. that.onCommonSearch();
  9598. return false;
  9599. });
  9600. // 重置搜索
  9601. form.on("click", "button[type=reset]", function (event) {
  9602. form[0].reset();
  9603. setTimeout(function () {
  9604. that.onCommonSearch();
  9605. }, 0);
  9606. });
  9607. };
  9608. var createFormCommon = function (pColumns, that) {
  9609. // 如果有使用模板则直接返回模板的内容
  9610. if (that.options.searchFormTemplate) {
  9611. return Template(that.options.searchFormTemplate, {columns: pColumns, table: that});
  9612. }
  9613. var htmlForm = [];
  9614. htmlForm.push(sprintf('<form class="form-horizontal form-commonsearch" novalidate method="post" action="%s" >', that.options.actionForm));
  9615. htmlForm.push('<fieldset>');
  9616. if (that.options.titleForm.length > 0)
  9617. htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
  9618. htmlForm.push('<div class="row">');
  9619. for (var i in pColumns) {
  9620. var vObjCol = pColumns[i];
  9621. if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
  9622. var query = Fast.api.query(vObjCol.field);
  9623. var operate = Fast.api.query(vObjCol.field + "-operate");
  9624. var renderDefault = that.options.renderDefault && (typeof vObjCol.renderDefault == 'undefined' || vObjCol.renderDefault);
  9625. vObjCol.defaultValue = renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue);
  9626. vObjCol.operate = renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate);
  9627. ColumnsForSearch.push(vObjCol);
  9628. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  9629. htmlForm.push(sprintf('<label for="%s" class="control-label col-xs-4">%s</label>', vObjCol.field, vObjCol.title));
  9630. htmlForm.push('<div class="col-xs-8">');
  9631. vObjCol.operate = vObjCol.operate ? vObjCol.operate.toUpperCase() : '=';
  9632. 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));
  9633. var addClass = typeof vObjCol.addClass === 'undefined' ? (typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass) : 'form-control ' + vObjCol.addClass;
  9634. var extend = typeof vObjCol.extend === 'undefined' ? '' : vObjCol.extend;
  9635. var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style);
  9636. extend = typeof vObjCol.data !== 'undefined' && extend == '' ? vObjCol.data : extend;
  9637. extend = typeof vObjCol.autocomplete !== 'undefined' ? extend + ' autocomplete="' + (vObjCol.autocomplete === false || vObjCol.autocomplete === 'off' ? 'off' : 'on') + '"' : extend;
  9638. if (vObjCol.searchList) {
  9639. if (typeof vObjCol.searchList === 'function') {
  9640. htmlForm.push(vObjCol.searchList.call(this, vObjCol));
  9641. } else {
  9642. var optionList = [sprintf('<option value="">%s</option>', that.options.formatCommonChoose())];
  9643. if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') {
  9644. (function (vObjCol, that) {
  9645. $.when(vObjCol.searchList).done(function (ret) {
  9646. var searchList = [];
  9647. if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) {
  9648. searchList = ret.data.searchlist;
  9649. } else if (ret.constructor === Array || ret.constructor === Object) {
  9650. searchList = ret;
  9651. }
  9652. var optionList = createOptionList(searchList, vObjCol, that);
  9653. $("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).html(optionList.join('')).trigger("change");
  9654. });
  9655. })(vObjCol, that);
  9656. } else {
  9657. optionList = createOptionList(vObjCol.searchList, vObjCol, that);
  9658. }
  9659. htmlForm.push(sprintf('<select class="%s" name="%s" %s %s>%s</select>', addClass, vObjCol.field, style, extend, optionList.join('')));
  9660. }
  9661. } else {
  9662. var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder;
  9663. var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type;
  9664. var defaultValue = typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue;
  9665. if (/BETWEEN$/.test(vObjCol.operate)) {
  9666. var defaultValueArr = defaultValue.toString().match(/\|/) ? defaultValue.split('|') : ['', ''];
  9667. var placeholderArr = placeholder.toString().match(/\|/) ? placeholder.split('|') : [placeholder, placeholder];
  9668. htmlForm.push('<div class="row row-between">');
  9669. 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));
  9670. 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));
  9671. htmlForm.push('</div>');
  9672. } else {
  9673. 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));
  9674. }
  9675. }
  9676. htmlForm.push('</div>');
  9677. htmlForm.push('</div>');
  9678. }
  9679. }
  9680. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  9681. htmlForm.push(createFormBtn(that).join(''));
  9682. htmlForm.push('</div>');
  9683. htmlForm.push('</div>');
  9684. htmlForm.push('</fieldset>');
  9685. htmlForm.push('</form>');
  9686. return htmlForm.join('');
  9687. };
  9688. var createFormBtn = function (that) {
  9689. var htmlBtn = [];
  9690. var searchSubmit = that.options.formatCommonSubmitButton();
  9691. var searchReset = that.options.formatCommonResetButton();
  9692. htmlBtn.push('<div class="col-sm-8 col-xs-offset-4">');
  9693. htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" formnovalidate>%s</button> ', searchSubmit));
  9694. htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
  9695. htmlBtn.push('</div>');
  9696. return htmlBtn;
  9697. };
  9698. var createOptionList = function (searchList, vObjCol, that) {
  9699. var isArray = searchList.constructor === Array;
  9700. var optionList = [];
  9701. optionList.push(sprintf('<option value="">%s</option>', that.options.formatCommonChoose()));
  9702. $.each(searchList, function (key, value) {
  9703. if (value.constructor === Object) {
  9704. key = value.id;
  9705. value = value.name;
  9706. } else {
  9707. key = isArray ? value : key;
  9708. }
  9709. optionList.push(sprintf("<option value='" + key + "' %s>" + value + "</option>", key == vObjCol.defaultValue ? 'selected' : ''));
  9710. });
  9711. return optionList;
  9712. };
  9713. var isSearchAvailble = function (that) {
  9714. //只支持服务端搜索
  9715. if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) {
  9716. return false;
  9717. }
  9718. return true;
  9719. };
  9720. var getSearchQuery = function (that, removeempty) {
  9721. var op = {};
  9722. var filter = {};
  9723. var value = '';
  9724. $("form.form-commonsearch .operate", that.$commonsearch).each(function (i) {
  9725. var name = $(this).data("name");
  9726. var sym = $(this).is("select") ? $("option:selected", this).val() : $(this).val().toUpperCase();
  9727. var obj = $("[name='" + name + "']", that.$commonsearch);
  9728. if (obj.length == 0)
  9729. return true;
  9730. var vObjCol = ColumnsForSearch[i];
  9731. var process = !that.options.searchFormTemplate && vObjCol && typeof vObjCol.process == 'function' ? vObjCol.process : null;
  9732. if (obj.length > 1) {
  9733. if (/BETWEEN$/.test(sym)) {
  9734. var value_begin = $.trim($("[name='" + name + "']:first", that.$commonsearch).val()),
  9735. value_end = $.trim($("[name='" + name + "']:last", that.$commonsearch).val());
  9736. if (value_begin.length || value_end.length) {
  9737. if (process) {
  9738. value_begin = process(value_begin, 'begin');
  9739. value_end = process(value_end, 'end');
  9740. }
  9741. value = value_begin + ',' + value_end;
  9742. } else {
  9743. value = '';
  9744. }
  9745. //如果是时间筛选,将operate置为RANGE
  9746. if ($("[name='" + name + "']:first", that.$commonsearch).hasClass("datetimepicker")) {
  9747. sym = 'RANGE';
  9748. }
  9749. } else {
  9750. value = $("[name='" + name + "']:checked", that.$commonsearch).val();
  9751. value = process ? process(value) : value;
  9752. }
  9753. } else {
  9754. value = process ? process(obj.val()) : obj.val();
  9755. }
  9756. if (removeempty && (value == '' || value == null || ($.isArray(value) && value.length == 0)) && !sym.match(/null/i)) {
  9757. return true;
  9758. }
  9759. op[name] = sym;
  9760. filter[name] = value;
  9761. });
  9762. return {op: op, filter: filter};
  9763. };
  9764. var getQueryParams = function (params, searchQuery, removeempty) {
  9765. params.filter = typeof params.filter === 'Object' ? params.filter : (params.filter ? JSON.parse(params.filter) : {});
  9766. params.op = typeof params.op === 'Object' ? params.op : (params.op ? JSON.parse(params.op) : {});
  9767. params.filter = $.extend({}, params.filter, searchQuery.filter);
  9768. params.op = $.extend({}, params.op, searchQuery.op);
  9769. //移除empty的值
  9770. if (removeempty) {
  9771. $.each(params.filter, function (i, j) {
  9772. if ((j == '' || j == null || ($.isArray(j) && j.length == 0)) && !params.op[i].match(/null/i)) {
  9773. delete params.filter[i];
  9774. delete params.op[i];
  9775. }
  9776. });
  9777. }
  9778. params.filter = JSON.stringify(params.filter);
  9779. params.op = JSON.stringify(params.op);
  9780. return params;
  9781. };
  9782. $.extend($.fn.bootstrapTable.defaults, {
  9783. commonSearch: false,
  9784. titleForm: "Common search",
  9785. actionForm: "",
  9786. searchFormTemplate: "",
  9787. searchFormVisible: true,
  9788. searchClass: 'searchit',
  9789. showSearch: true,
  9790. renderDefault: true,
  9791. onCommonSearch: function (field, text) {
  9792. return false;
  9793. },
  9794. onPostCommonSearch: function (table) {
  9795. return false;
  9796. }
  9797. });
  9798. $.extend($.fn.bootstrapTable.defaults.icons, {
  9799. commonSearchIcon: 'glyphicon-search'
  9800. });
  9801. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  9802. 'common-search.bs.table': 'onCommonSearch',
  9803. 'post-common-search.bs.table': 'onPostCommonSearch'
  9804. });
  9805. $.extend($.fn.bootstrapTable.locales[$.fn.bootstrapTable.defaults.locale], {
  9806. formatCommonSearch: function () {
  9807. return "Common search";
  9808. },
  9809. formatCommonSubmitButton: function () {
  9810. return "Submit";
  9811. },
  9812. formatCommonResetButton: function () {
  9813. return "Reset";
  9814. },
  9815. formatCommonCloseButton: function () {
  9816. return "Close";
  9817. },
  9818. formatCommonChoose: function () {
  9819. return "Choose";
  9820. }
  9821. });
  9822. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  9823. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9824. _initHeader = BootstrapTable.prototype.initHeader,
  9825. _initToolbar = BootstrapTable.prototype.initToolbar,
  9826. _load = BootstrapTable.prototype.load,
  9827. _initSearch = BootstrapTable.prototype.initSearch;
  9828. BootstrapTable.prototype.initHeader = function () {
  9829. _initHeader.apply(this, Array.prototype.slice.apply(arguments));
  9830. this.$header.find('th[data-field]').each(function (i) {
  9831. var column = $(this).data();
  9832. if (typeof column['width'] !== 'undefined' && column['width'].toString().indexOf("%") === -1) {
  9833. $(".th-inner", this).outerWidth(column['width']);
  9834. $(this).css("max-width", column['width']);
  9835. }
  9836. });
  9837. this.options.stateField = this.header.stateField;
  9838. };
  9839. BootstrapTable.prototype.initToolbar = function () {
  9840. _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
  9841. if (!isSearchAvailble(this)) {
  9842. return;
  9843. }
  9844. var that = this,
  9845. html = [];
  9846. if (that.options.showSearch) {
  9847. html.push(sprintf('<div class="columns-%s pull-%s" style="margin-top:10px;margin-bottom:10px;">', this.options.buttonsAlign, this.options.buttonsAlign));
  9848. 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()));
  9849. html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.commonSearchIcon))
  9850. html.push('</button></div>');
  9851. }
  9852. if (that.$toolbar.find(".pull-right").length > 0) {
  9853. $(html.join('')).insertBefore(that.$toolbar.find(".pull-right:first"));
  9854. } else {
  9855. that.$toolbar.append(html.join(''));
  9856. }
  9857. initCommonSearch(that.columns, that);
  9858. that.$toolbar.find('button[name="commonSearch"]')
  9859. .off('click').on('click', function () {
  9860. that.$commonsearch.toggleClass("hidden");
  9861. return;
  9862. });
  9863. that.$container.on("click", "." + that.options.searchClass, function () {
  9864. var value = $(this).data("value");
  9865. var field = $(this).data("field");
  9866. var ul = that.$container.closest(".panel-intro").find("ul[data-field='" + field + "']");
  9867. if (ul.length > 0) {
  9868. $('li a[data-value="' + value + '"][data-toggle="tab"]', ul).trigger('click');
  9869. return;
  9870. }
  9871. var obj = $("form [name='" + field + "']", that.$commonsearch);
  9872. if (obj.length > 0) {
  9873. if (obj.is("select")) {
  9874. $("option[value='" + value + "']", obj).prop("selected", true);
  9875. } else if (obj.length > 1) {
  9876. $("form [name='" + field + "'][value='" + value + "']", that.$commonsearch).prop("checked", true);
  9877. } else {
  9878. obj.val(value + "");
  9879. }
  9880. obj.trigger("change");
  9881. $("form", that.$commonsearch).trigger("submit");
  9882. }
  9883. });
  9884. var queryParams = that.options.queryParams;
  9885. //匹配默认搜索值
  9886. this.options.queryParams = function (params) {
  9887. return queryParams(getQueryParams(params, getSearchQuery(that, true)));
  9888. };
  9889. this.trigger('post-common-search', that);
  9890. };
  9891. BootstrapTable.prototype.onCommonSearch = function () {
  9892. var searchQuery = getSearchQuery(this);
  9893. this.trigger('common-search', this, searchQuery);
  9894. this.options.pageNumber = 1;
  9895. //this.options.pageSize = $.fn.bootstrapTable.defaults.pageSize;
  9896. this.refresh({});
  9897. };
  9898. BootstrapTable.prototype.load = function (data) {
  9899. _load.apply(this, Array.prototype.slice.apply(arguments));
  9900. if (!isSearchAvailble(this)) {
  9901. return;
  9902. }
  9903. };
  9904. BootstrapTable.prototype.initSearch = function () {
  9905. _initSearch.apply(this, Array.prototype.slice.apply(arguments));
  9906. if (!isSearchAvailble(this)) {
  9907. return;
  9908. }
  9909. var that = this;
  9910. var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
  9911. this.data = fp ? $.grep(this.data, function (item, i) {
  9912. for (var key in fp) {
  9913. var fval = fp[key].toLowerCase();
  9914. var value = item[key];
  9915. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
  9916. that.header.formatters[$.inArray(key, that.header.fields)],
  9917. [value, item, i], value);
  9918. if (!($.inArray(key, that.header.fields) !== -1 &&
  9919. (typeof value === 'string' || typeof value === 'number') &&
  9920. (value + '').toLowerCase().indexOf(fval) !== -1)) {
  9921. return false;
  9922. }
  9923. }
  9924. return true;
  9925. }) : this.data;
  9926. };
  9927. }(jQuery);
  9928. define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) {
  9929. return function () {
  9930. var ret, fn;
  9931. return ret || global.$.fn.bootstrapTable.defaults;
  9932. };
  9933. }(this)));
  9934. /**
  9935. * 将BootstrapTable的行使用自定义的模板来渲染
  9936. *
  9937. * @author: karson
  9938. * @version: v0.0.1
  9939. *
  9940. * @update 2017-06-24 <http://github.com/karsonzhang/fastadmin>
  9941. */
  9942. !function ($) {
  9943. 'use strict';
  9944. $.extend($.fn.bootstrapTable.defaults, {
  9945. //是否启用模板渲染
  9946. templateView: false,
  9947. //数据格式化的模板ID或格式函数
  9948. templateFormatter: "itemtpl",
  9949. //添加的父类的class
  9950. templateParentClass: "row row-flex",
  9951. //向table添加的class
  9952. templateTableClass: "table-template",
  9953. });
  9954. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9955. _initContainer = BootstrapTable.prototype.initContainer,
  9956. _initBody = BootstrapTable.prototype.initBody,
  9957. _initRow = BootstrapTable.prototype.initRow;
  9958. BootstrapTable.prototype.initContainer = function () {
  9959. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  9960. var that = this;
  9961. if (!that.options.templateView) {
  9962. return;
  9963. }
  9964. that.options.cardView = true;
  9965. };
  9966. BootstrapTable.prototype.initBody = function () {
  9967. var that = this;
  9968. $.extend(that.options, {
  9969. showHeader: !that.options.templateView ? $.fn.bootstrapTable.defaults.showHeader : false,
  9970. showFooter: !that.options.templateView ? $.fn.bootstrapTable.defaults.showFooter : false,
  9971. });
  9972. $(that.$el).toggleClass(that.options.templateTableClass, that.options.templateView);
  9973. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  9974. if (!that.options.templateView) {
  9975. return;
  9976. } else {
  9977. //由于Bootstrap是基于Table的,添加一个父类容器
  9978. $("> *:not(.no-records-found)", that.$body).wrapAll($("<div />").addClass(that.options.templateParentClass));
  9979. }
  9980. };
  9981. BootstrapTable.prototype.initRow = function (item, i, data, parentDom) {
  9982. var that = this;
  9983. //如果未启用则使用原生的initRow方法
  9984. if (!that.options.templateView) {
  9985. return _initRow.apply(that, Array.prototype.slice.apply(arguments));
  9986. }
  9987. var $content = '';
  9988. if (typeof that.options.templateFormatter === 'function') {
  9989. $content = that.options.templateFormatter.call(that, item, i, data);
  9990. } else {
  9991. var Template = require('template');
  9992. $content = Template(that.options.templateFormatter, {item: item, i: i, data: data});
  9993. }
  9994. return $content;
  9995. };
  9996. }(jQuery);
  9997. define("bootstrap-table-template", ["bootstrap-table","template"], (function (global) {
  9998. return function () {
  9999. var ret, fn;
  10000. return ret || global.$.fn.bootstrapTable.defaults;
  10001. };
  10002. }(this)));
  10003. /**
  10004. * @author Jay <jwang@dizsoft.com>
  10005. */
  10006. (function ($) {
  10007. 'use strict';
  10008. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  10009. $.extend($.fn.bootstrapTable.defaults, {
  10010. showJumpto: false,
  10011. exportOptions: {}
  10012. });
  10013. $.extend($.fn.bootstrapTable.locales, {
  10014. formatJumpto: function () {
  10015. return 'GO';
  10016. }
  10017. });
  10018. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  10019. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  10020. _initPagination = BootstrapTable.prototype.initPagination;
  10021. BootstrapTable.prototype.initPagination = function () {
  10022. this.showToolbar = this.options.showExport;
  10023. _initPagination.apply(this, Array.prototype.slice.apply(arguments));
  10024. if (this.options.showJumpto) {
  10025. var that = this,
  10026. $pageGroup = this.$pagination.find('ul.pagination'),
  10027. $jumpto = $pageGroup.find('li.jumpto');
  10028. if (!$jumpto.length) {
  10029. $jumpto = $([
  10030. '<li class="jumpto">',
  10031. '<input type="text" class="form-control">',
  10032. '<button class="btn' +
  10033. sprintf(' btn-%s', this.options.buttonsClass) +
  10034. sprintf(' btn-%s', this.options.iconSize) +
  10035. '" title="' + this.options.formatJumpto() + '" ' +
  10036. ' type="button">'+this.options.formatJumpto(),
  10037. '</button>',
  10038. '</li>'].join('')).appendTo($pageGroup);
  10039. $jumpto.find('button').click(function () {
  10040. that.selectPage(parseInt($jumpto.find('input').val()));
  10041. });
  10042. }
  10043. }
  10044. };
  10045. })(jQuery);
  10046. define("bootstrap-table-jumpto", ["bootstrap-table"], (function (global) {
  10047. return function () {
  10048. var ret, fn;
  10049. return ret || global.$.fn.bootstrapTable.defaults;
  10050. };
  10051. }(this)));
  10052. (function ($) {
  10053. 'use strict';
  10054. // Reasonable defaults
  10055. var PIXEL_STEP = 10;
  10056. var LINE_HEIGHT = 40;
  10057. var PAGE_HEIGHT = 800;
  10058. function normalizeWheel(event) {
  10059. var sX = 0; // spinX
  10060. var sY = 0; // spinY
  10061. var pX = 0; // pixelX
  10062. var pY = 0; // pixelY
  10063. // Legacy
  10064. if ('detail' in event) {
  10065. sY = event.detail;
  10066. }
  10067. if ('wheelDelta' in event) {
  10068. sY = -event.wheelDelta / 120;
  10069. }
  10070. if ('wheelDeltaY' in event) {
  10071. sY = -event.wheelDeltaY / 120;
  10072. }
  10073. if ('wheelDeltaX' in event) {
  10074. sX = -event.wheelDeltaX / 120;
  10075. }
  10076. // side scrolling on FF with DOMMouseScroll
  10077. if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {
  10078. sX = sY;
  10079. sY = 0;
  10080. }
  10081. pX = sX * PIXEL_STEP;
  10082. pY = sY * PIXEL_STEP;
  10083. if ('deltaY' in event) {
  10084. pY = event.deltaY;
  10085. }
  10086. if ('deltaX' in event) {
  10087. pX = event.deltaX;
  10088. }
  10089. if ((pX || pY) && event.deltaMode) {
  10090. if (event.deltaMode === 1) {
  10091. // delta in LINE units
  10092. pX *= LINE_HEIGHT;
  10093. pY *= LINE_HEIGHT;
  10094. } else {
  10095. // delta in PAGE units
  10096. pX *= PAGE_HEIGHT;
  10097. pY *= PAGE_HEIGHT;
  10098. }
  10099. }
  10100. // Fall-back if spin cannot be determined
  10101. if (pX && !sX) {
  10102. sX = pX < 1 ? -1 : 1;
  10103. }
  10104. if (pY && !sY) {
  10105. sY = pY < 1 ? -1 : 1;
  10106. }
  10107. return {
  10108. spinX: sX,
  10109. spinY: sY,
  10110. pixelX: pX,
  10111. pixelY: pY
  10112. };
  10113. }
  10114. var cachedWidth = null;
  10115. var getScrollBarWidth = function getScrollBarWidth() {
  10116. if (cachedWidth === null) {
  10117. var inner = $('<p/>').addClass('fixed-table-scroll-inner'),
  10118. outer = $('<div/>').addClass('fixed-table-scroll-outer'),
  10119. w1 = void 0,
  10120. w2 = void 0;
  10121. outer.append(inner);
  10122. $('body').append(outer);
  10123. w1 = inner[0].offsetWidth;
  10124. outer.css('overflow', 'scroll');
  10125. w2 = inner[0].offsetWidth;
  10126. if (w1 === w2) {
  10127. w2 = outer[0].clientWidth;
  10128. }
  10129. outer.remove();
  10130. cachedWidth = w1 - w2;
  10131. }
  10132. return cachedWidth;
  10133. };
  10134. //获取原本表格体的滑块宽度
  10135. var getTableBodyScrollBarWidth = function getTableBodyScrollBarWidth(tableBody) {
  10136. return tableBody[0].scrollHeight > tableBody[0].clientHeight ? 15 : 0;
  10137. };
  10138. $.extend($.fn.bootstrapTable.defaults, {
  10139. fixedColumns: false,
  10140. fixedNumber: 0,
  10141. fixedRightNumber: 0
  10142. });
  10143. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  10144. _initBody = BootstrapTable.prototype.initBody,
  10145. _initContainer = BootstrapTable.prototype.initContainer,
  10146. _trigger = BootstrapTable.prototype.trigger,
  10147. _hideLoading = BootstrapTable.prototype.hideLoading,
  10148. _updateSelected = BootstrapTable.prototype.updateSelected;
  10149. BootstrapTable.prototype.fixedColumnsSupported = function () {
  10150. var that = this;
  10151. return that.options.fixedColumns && !that.options.detailView && !that.options.cardView;
  10152. };
  10153. BootstrapTable.prototype.initFixedContainer = function () {
  10154. if (!this.fixedColumnsSupported()) {
  10155. return;
  10156. }
  10157. if (this.options.fixedNumber) {
  10158. this.$tableContainer.find('.fixed-columns').size() == 0 && this.$tableContainer.append('<div class="fixed-columns"></div>');
  10159. this.$fixedColumns = this.$tableContainer.find('.fixed-columns');
  10160. }
  10161. if (this.options.fixedRightNumber) {
  10162. this.$tableContainer.find('.fixed-columns-right').size() == 0 && this.$tableContainer.append('<div class="fixed-columns-right"></div>');
  10163. this.$fixedColumnsRight = this.$tableContainer.find('.fixed-columns-right');
  10164. }
  10165. };
  10166. BootstrapTable.prototype.initContainer = function () {
  10167. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  10168. this.initFixedContainer();
  10169. };
  10170. BootstrapTable.prototype.initBody = function () {
  10171. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  10172. if (!this.fixedColumnsSupported()) {
  10173. return;
  10174. }
  10175. if (this.options.showHeader && this.options.height) {
  10176. return;
  10177. }
  10178. this.initFixedColumnsBody();
  10179. this.initFixedColumnsEvents();
  10180. };
  10181. BootstrapTable.prototype.trigger = function () {
  10182. var that = this;
  10183. _trigger.apply(this, Array.prototype.slice.apply(arguments));
  10184. if (arguments[0] === 'pre-body') {
  10185. //如果上来就是cardView 设置表格高度为auto
  10186. if (this.options.cardView) {
  10187. this.$tableBody.css("height", "auto");
  10188. }
  10189. }
  10190. //监听cardView 显示/隐藏fixed部分
  10191. if (arguments[0] === 'toggle') {
  10192. if (arguments[1]) {
  10193. this.$tableBody.css("height", "auto");
  10194. this.$fixedColumns && this.$fixedColumns.hide();
  10195. this.$fixedColumnsRight && this.$fixedColumnsRight.hide();
  10196. } else {
  10197. this.$tableBody.css("height", "100%");
  10198. this.$fixedColumns && this.$fixedColumns.show();
  10199. this.$fixedColumnsRight && this.$fixedColumnsRight.show();
  10200. this.$fixedHeaderRight && this.$fixedHeaderRight.scrollLeft(this.$tableBody.find('table').width());
  10201. this.$fixedBodyRight && this.$fixedBodyRight.scrollLeft(this.$tableBody.find('table').width());
  10202. }
  10203. }
  10204. if (!that.fixedColumnsSupported()) {
  10205. return;
  10206. }
  10207. if (arguments[0] === 'post-header') {
  10208. this.initFixedColumnsHeader();
  10209. } else if (arguments[0] === 'scroll-body') {
  10210. if (this.needFixedColumns && this.options.fixedNumber) {
  10211. this.$fixedBody && this.$fixedBody.scrollTop(this.$tableBody.scrollTop());
  10212. }
  10213. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10214. this.$fixedBodyRight && this.$fixedBodyRight.scrollTop(this.$tableBody.scrollTop());
  10215. }
  10216. } else if (arguments[0] === 'load-success') {
  10217. this.hideLoading();
  10218. }
  10219. };
  10220. BootstrapTable.prototype.updateSelected = function () {
  10221. var that = this;
  10222. _updateSelected.apply(this, Array.prototype.slice.apply(arguments));
  10223. if (!this.fixedColumnsSupported()) {
  10224. return;
  10225. }
  10226. this.$tableBody.find('tr').each(function (i, el) {
  10227. var $el = $(el);
  10228. var index = $el.data('index');
  10229. var classes = $el.attr('class');
  10230. var inputSelector = '[name="' + that.options.selectItemName + '"]';
  10231. var $input = $el.find(inputSelector);
  10232. if (typeof index === 'undefined') {
  10233. return;
  10234. }
  10235. var updateFixedBody = function updateFixedBody($fixedHeader, $fixedBody) {
  10236. var $tr = $fixedBody.find('tr[data-index="' + index + '"]');
  10237. $tr.attr('class', classes);
  10238. if ($input.length) {
  10239. $tr.find(inputSelector).prop('checked', $input.prop('checked'));
  10240. }
  10241. if (that.$selectAll.length) {
  10242. $fixedHeader.add($fixedBody).find('[name="btSelectAll"]').prop('checked', that.$selectAll.prop('checked'));
  10243. }
  10244. };
  10245. if (that.$fixedBody && that.options.fixedNumber) {
  10246. updateFixedBody(that.$fixedHeader, that.$fixedBody);
  10247. }
  10248. if (that.$fixedBodyRight && that.options.fixedRightNumber) {
  10249. updateFixedBody(that.$fixedHeaderRight, that.$fixedBodyRight);
  10250. }
  10251. });
  10252. };
  10253. BootstrapTable.prototype.hideLoading = function () {
  10254. _hideLoading.apply(this, Array.prototype.slice.apply(arguments));
  10255. if (this.needFixedColumns && this.options.fixedNumber) {
  10256. this.$fixedColumns.find('.fixed-table-loading').hide();
  10257. }
  10258. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10259. this.$fixedColumnsRight.find('.fixed-table-loading').hide();
  10260. }
  10261. };
  10262. BootstrapTable.prototype.initFixedColumnsHeader = function () {
  10263. var that = this;
  10264. if (this.options.height) {
  10265. this.needFixedColumns = this.$tableHeader.outerWidth(true) < this.$tableHeader.find('table').outerWidth(true);
  10266. } else {
  10267. this.needFixedColumns = this.$tableBody.outerWidth(true) < this.$tableBody.find('table').outerWidth(true);
  10268. }
  10269. var initFixedHeader = function initFixedHeader($fixedColumns, isRight) {
  10270. $fixedColumns.find('.fixed-table-header').remove();
  10271. $fixedColumns.append(that.$tableHeader.clone(true));
  10272. $fixedColumns.find('.fixed-table-header').css('margin-right', "");
  10273. $fixedColumns.css({
  10274. width: that.getFixedColumnsWidth(isRight)
  10275. });
  10276. return $fixedColumns.find('.fixed-table-header');
  10277. };
  10278. if (this.needFixedColumns && this.options.fixedNumber) {
  10279. this.$fixedHeader = initFixedHeader(this.$fixedColumns);
  10280. this.$fixedHeader.css('margin-right', '');
  10281. } else if (this.$fixedColumns) {
  10282. this.$fixedColumns.html('').css('width', '');
  10283. }
  10284. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10285. this.$fixedHeaderRight = initFixedHeader(this.$fixedColumnsRight, true);
  10286. this.$fixedHeaderRight.scrollLeft(this.$fixedHeaderRight.find('table').width());
  10287. } else if (this.$fixedColumnsRight) {
  10288. this.$fixedColumnsRight.html('').css('width', '');
  10289. }
  10290. this.initFixedColumnsBody();
  10291. this.initFixedColumnsEvents();
  10292. };
  10293. BootstrapTable.prototype.initFixedColumnsBody = function () {
  10294. var that = this;
  10295. var initFixedBody = function initFixedBody($fixedColumns, $fixedHeader) {
  10296. $fixedColumns.find('.fixed-table-body').remove();
  10297. $fixedColumns.append(that.$tableBody.clone(true));
  10298. var $fixedBody = $fixedColumns.find('.fixed-table-body');
  10299. var tableBody = that.$tableBody.get(0);
  10300. var scrollHeight = tableBody.scrollWidth > tableBody.clientWidth ? getScrollBarWidth() : 0;
  10301. var paginationHeight = $(".fixed-table-pagination").height();
  10302. if (typeof that.options.height !== 'undefined') paginationHeight = 0;
  10303. var height = that.$tableContainer.outerHeight(true) - scrollHeight - paginationHeight + 1;
  10304. $fixedColumns.css({
  10305. height: height,
  10306. "min-height": "calc(100% - " + (paginationHeight + scrollHeight) + "px)"
  10307. });
  10308. $fixedBody.css({
  10309. height: height - $fixedHeader.height(),
  10310. "min-height": "calc(100% - " + $fixedHeader.height() + "px)",
  10311. overflow: "hidden"
  10312. });
  10313. return $fixedBody;
  10314. };
  10315. if (this.needFixedColumns && this.options.fixedNumber) {
  10316. this.$fixedBody = initFixedBody(this.$fixedColumns, this.$fixedHeader);
  10317. }
  10318. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10319. this.$fixedBodyRight = initFixedBody(this.$fixedColumnsRight, this.$fixedHeaderRight);
  10320. this.$fixedBodyRight.scrollLeft(this.$fixedBodyRight.find('table').width());
  10321. this.$fixedBodyRight.css('overflow-y', 'hidden');
  10322. }
  10323. };
  10324. BootstrapTable.prototype.getFixedColumnsWidth = function (isRight) {
  10325. var visibleFields = this.getVisibleFields();
  10326. var width = 0;
  10327. var fixedNumber = this.options.fixedNumber;
  10328. var marginRight = 0;
  10329. if (isRight) {
  10330. visibleFields = visibleFields.reverse();
  10331. fixedNumber = this.options.fixedRightNumber;
  10332. //右侧固定列距离
  10333. this.$fixedColumnsRight.css('right', getTableBodyScrollBarWidth(this.$tableBody));
  10334. }
  10335. for (var i = 0; i < fixedNumber; i++) {
  10336. width += this.$header.find('th[data-field="' + visibleFields[i] + '"]').outerWidth();
  10337. }
  10338. return width + 1;
  10339. };
  10340. BootstrapTable.prototype.initFixedColumnsEvents = function () {
  10341. var that = this;
  10342. var toggleHover = function toggleHover(e, toggle) {
  10343. var tr = 'tr[data-index="' + $(e.currentTarget).data('index') + '"]';
  10344. var $trs = that.$tableBody.find(tr);
  10345. if (that.$fixedBody) {
  10346. $trs = $trs.add(that.$fixedBody.find(tr));
  10347. }
  10348. if (that.$fixedBodyRight) {
  10349. $trs = $trs.add(that.$fixedBodyRight.find(tr));
  10350. }
  10351. $trs.css('background-color', toggle ? $(e.currentTarget).css('background-color') : '');
  10352. };
  10353. this.$tableBody.find('tr').hover(function (e) {
  10354. toggleHover(e, true);
  10355. }, function (e) {
  10356. toggleHover(e, false);
  10357. });
  10358. var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
  10359. var mousewheel = isFirefox ? 'DOMMouseScroll' : 'mousewheel';
  10360. var updateScroll = function updateScroll(e, fixedBody) {
  10361. var normalized = normalizeWheel(e);
  10362. var deltaY = Math.ceil(normalized.pixelY);
  10363. var top = that.$tableBody.scrollTop() + deltaY;
  10364. if (deltaY < 0 && top > 0 || deltaY > 0 && top < fixedBody.scrollHeight - fixedBody.clientHeight) {
  10365. e.preventDefault();
  10366. }
  10367. that.$tableBody.scrollTop(top);
  10368. if (that.$fixedBody) {
  10369. that.$fixedBody.scrollTop(top);
  10370. }
  10371. if (that.$fixedBodyRight) {
  10372. that.$fixedBodyRight.scrollTop(top);
  10373. }
  10374. };
  10375. if (this.needFixedColumns && this.options.fixedNumber) {
  10376. this.$fixedBody.find('tr').hover(function (e) {
  10377. toggleHover(e, true);
  10378. }, function (e) {
  10379. toggleHover(e, false);
  10380. });
  10381. this.$fixedBody[0].addEventListener(mousewheel, function (e) {
  10382. //给鼠标滑轮绑定事件
  10383. updateScroll(e, that.$fixedBody[0]);
  10384. });
  10385. //给固定表格的checkbox绑定事件
  10386. this.$fixedBody.find('input[name="' + this.options.selectItemName + '"]').off("click").on('click', function (e) {
  10387. e.stopImmediatePropagation();
  10388. var index = $(e.target).data("index");
  10389. $(that.$selectItem[index]).trigger("click");
  10390. });
  10391. //绑定TD点击事件
  10392. this.$fixedBody.find('> table > tbody > tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
  10393. var index = $(this).closest("tr[data-index]").data("index");
  10394. $(that.$selectItem[index]).closest("tr[data-index]").find(">td:eq(" + $(this).index() + ")").trigger("click");
  10395. });
  10396. }
  10397. //给原本表格绑定scroll事件
  10398. $('div.fixed-table-body').off('scroll'); //给所有的body解绑 scroll
  10399. this.$tableBody.off('scroll').on('scroll', function (e) {
  10400. that.$tableHeader.scrollLeft(0);
  10401. if (that.$tableBody.scrollLeft() > 0) {
  10402. that.$tableHeader.scrollLeft(that.$tableBody.scrollLeft());
  10403. if (that.options.showFooter && !that.options.cardView) {
  10404. that.$tableFooter.scrollLeft(that.$tableBody.scrollLeft());
  10405. }
  10406. }
  10407. var top = that.$tableBody.scrollTop();
  10408. if (that.$fixedBody) {
  10409. that.$fixedBody.scrollTop(top);
  10410. }
  10411. if (that.$fixedBodyRight) {
  10412. that.$fixedBodyRight.scrollTop(top);
  10413. }
  10414. });
  10415. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10416. this.$fixedBodyRight.find('tr').hover(function (e) {
  10417. toggleHover(e, true);
  10418. }, function (e) {
  10419. toggleHover(e, false);
  10420. });
  10421. this.$fixedBodyRight[0].addEventListener(mousewheel, function (e) {
  10422. //给鼠标滑轮绑定事件
  10423. updateScroll(e, that.$fixedBodyRight[0]);
  10424. });
  10425. //给固定表格的checkbox绑定事件
  10426. this.$fixedBodyRight.find('input[name="' + this.options.selectItemName + '"]').off("click").on('click', function (e) {
  10427. e.stopImmediatePropagation();
  10428. var index = $(e.target).data("index");
  10429. $(that.$selectItem[index]).trigger("click");
  10430. });
  10431. //绑定TD点击事件
  10432. this.$fixedBodyRight.find('> table > tbody > tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
  10433. var index = $(this).closest("tr[data-index]").data("index");
  10434. $(that.$selectItem[index]).closest("tr[data-index]").find(">td:eq(" + $(this).index() + ")").trigger("click");
  10435. });
  10436. }
  10437. if (this.options.filterControl) {
  10438. $(this.$fixedColumns).off('keyup change').on('keyup change', function (e) {
  10439. var $target = $(e.target);
  10440. var value = $target.val();
  10441. var field = $target.parents('th').data('field');
  10442. var $coreTh = that.$header.find('th[data-field="' + field + '"]');
  10443. if ($target.is('input')) {
  10444. $coreTh.find('input').val(value);
  10445. } else if ($target.is('select')) {
  10446. var $select = $coreTh.find('select');
  10447. $select.find('option[selected]').removeAttr('selected');
  10448. $select.find('option[value="' + value + '"]').attr('selected', true);
  10449. }
  10450. that.triggerSearch();
  10451. });
  10452. }
  10453. };
  10454. })(jQuery);
  10455. define("bootstrap-table-fixed-columns", ["bootstrap-table"], (function (global) {
  10456. return function () {
  10457. var ret, fn;
  10458. return ret || global.$.fn.bootstrapTable.defaults;
  10459. };
  10460. }(this)));
  10461. 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) {
  10462. var Table = {
  10463. list: {},
  10464. // Bootstrap-table 基础配置
  10465. defaults: {
  10466. url: '',
  10467. sidePagination: 'server',
  10468. method: 'get', //请求方法
  10469. toolbar: ".toolbar", //工具栏
  10470. search: true, //是否启用快速搜索
  10471. cache: false,
  10472. commonSearch: true, //是否启用通用搜索
  10473. searchFormVisible: false, //是否始终显示搜索表单
  10474. titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
  10475. idTable: 'commonTable',
  10476. showExport: true,
  10477. exportDataType: "auto",
  10478. exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
  10479. exportOptions: {
  10480. fileName: 'export_' + Moment().format("YYYY-MM-DD"),
  10481. preventInjection: false,
  10482. mso: {
  10483. onMsoNumberFormat: function (cell, row, col) {
  10484. return !isNaN($(cell).text()) ? '\\@' : '';
  10485. },
  10486. },
  10487. ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列
  10488. },
  10489. pageSize: Config.pagesize || localStorage.getItem("pagesize") || 10,
  10490. pageList: [10, 15, 20, 25, 50, 'All'],
  10491. pagination: true,
  10492. clickToSelect: true, //是否启用点击选中
  10493. dblClickToEdit: true, //是否启用双击编辑
  10494. singleSelect: false, //是否启用单选
  10495. showRefresh: false,
  10496. showJumpto: true,
  10497. locale: Config.language == 'zh-cn' ? 'zh-CN' : 'en-US',
  10498. showToggle: true,
  10499. showColumns: true,
  10500. pk: 'id',
  10501. sortName: 'id',
  10502. sortOrder: 'desc',
  10503. paginationFirstText: __("First"),
  10504. paginationPreText: __("Previous"),
  10505. paginationNextText: __("Next"),
  10506. paginationLastText: __("Last"),
  10507. cardView: false, //卡片视图
  10508. iosCardView: true, //ios卡片视图
  10509. checkOnInit: true, //是否在初始化时判断
  10510. escape: true, //是否对内容进行转义
  10511. fixDropdownPosition: true, //是否修复下拉的定位
  10512. selectedIds: [],
  10513. selectedData: [],
  10514. extend: {
  10515. index_url: '',
  10516. add_url: '',
  10517. edit_url: '',
  10518. del_url: '',
  10519. import_url: '',
  10520. multi_url: '',
  10521. dragsort_url: 'ajax/weigh',
  10522. }
  10523. },
  10524. // Bootstrap-table 列配置
  10525. columnDefaults: {
  10526. align: 'center',
  10527. valign: 'middle',
  10528. },
  10529. config: {
  10530. checkboxtd: 'tbody>tr>td.bs-checkbox',
  10531. toolbar: '.toolbar',
  10532. refreshbtn: '.btn-refresh',
  10533. addbtn: '.btn-add',
  10534. editbtn: '.btn-edit',
  10535. delbtn: '.btn-del',
  10536. importbtn: '.btn-import',
  10537. multibtn: '.btn-multi',
  10538. disabledbtn: '.btn-disabled',
  10539. editonebtn: '.btn-editone',
  10540. restoreonebtn: '.btn-restoreone',
  10541. destroyonebtn: '.btn-destroyone',
  10542. restoreallbtn: '.btn-restoreall',
  10543. destroyallbtn: '.btn-destroyall',
  10544. dragsortfield: 'weigh',
  10545. },
  10546. button: {
  10547. edit: {
  10548. name: 'edit',
  10549. icon: 'fa fa-pencil',
  10550. title: __('Edit'),
  10551. extend: 'data-toggle="tooltip"',
  10552. classname: 'btn btn-xs btn-success btn-editone'
  10553. },
  10554. del: {
  10555. name: 'del',
  10556. icon: 'fa fa-trash',
  10557. title: __('Del'),
  10558. extend: 'data-toggle="tooltip"',
  10559. classname: 'btn btn-xs btn-danger btn-delone'
  10560. },
  10561. dragsort: {
  10562. name: 'dragsort',
  10563. icon: 'fa fa-arrows',
  10564. title: __('Drag to sort'),
  10565. extend: 'data-toggle="tooltip"',
  10566. classname: 'btn btn-xs btn-primary btn-dragsort'
  10567. }
  10568. },
  10569. api: {
  10570. init: function (defaults, columnDefaults, locales) {
  10571. defaults = defaults ? defaults : {};
  10572. columnDefaults = columnDefaults ? columnDefaults : {};
  10573. locales = locales ? locales : {};
  10574. $.fn.bootstrapTable.Constructor.prototype.getSelectItem = function () {
  10575. return this.$selectItem;
  10576. };
  10577. var _onPageListChange = $.fn.bootstrapTable.Constructor.prototype.onPageListChange;
  10578. $.fn.bootstrapTable.Constructor.prototype.onPageListChange = function () {
  10579. _onPageListChange.apply(this, Array.prototype.slice.apply(arguments));
  10580. localStorage.setItem('pagesize', this.options.pageSize);
  10581. return false;
  10582. };
  10583. // 写入bootstrap-table默认配置
  10584. $.extend(true, $.fn.bootstrapTable.defaults, Table.defaults, defaults);
  10585. // 写入bootstrap-table column配置
  10586. $.extend($.fn.bootstrapTable.columnDefaults, Table.columnDefaults, columnDefaults);
  10587. // 写入bootstrap-table locale配置
  10588. $.extend($.fn.bootstrapTable.locales[Table.defaults.locale], {
  10589. formatCommonSearch: function () {
  10590. return __('Common search');
  10591. },
  10592. formatCommonSubmitButton: function () {
  10593. return __('Submit');
  10594. },
  10595. formatCommonResetButton: function () {
  10596. return __('Reset');
  10597. },
  10598. formatCommonCloseButton: function () {
  10599. return __('Close');
  10600. },
  10601. formatCommonChoose: function () {
  10602. return __('Choose');
  10603. },
  10604. formatJumpto: function () {
  10605. return __('Go');
  10606. }
  10607. }, locales);
  10608. // 如果是iOS设备则判断是否启用卡片视图
  10609. if ($.fn.bootstrapTable.defaults.iosCardView && navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
  10610. Table.defaults.cardView = true;
  10611. $.fn.bootstrapTable.defaults.cardView = true;
  10612. }
  10613. if (typeof defaults.exportTypes != 'undefined') {
  10614. $.fn.bootstrapTable.defaults.exportTypes = defaults.exportTypes;
  10615. }
  10616. },
  10617. // 绑定事件
  10618. bindevent: function (table) {
  10619. //Bootstrap-table的父元素,包含table,toolbar,pagnation
  10620. var parenttable = table.closest('.bootstrap-table');
  10621. //Bootstrap-table配置
  10622. var options = table.bootstrapTable('getOptions');
  10623. //Bootstrap操作区
  10624. var toolbar = $(options.toolbar, parenttable);
  10625. //跨页提示按钮
  10626. var tipsBtn = $(".btn-selected-tips", parenttable);
  10627. if (tipsBtn.length === 0) {
  10628. 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);
  10629. }
  10630. //点击提示按钮
  10631. tipsBtn.off("click").on("click", function (e) {
  10632. table.trigger("uncheckbox");
  10633. table.bootstrapTable("refresh");
  10634. });
  10635. //当刷新表格时
  10636. table.on('uncheckbox', function (status, res, e) {
  10637. options.selectedIds = [];
  10638. options.selectedData = [];
  10639. tipsBtn.tooltip('hide');
  10640. tipsBtn.addClass('hide');
  10641. });
  10642. //表格加载出错时
  10643. table.on('load-error.bs.table', function (status, res, e) {
  10644. if (e.status === 0) {
  10645. return;
  10646. }
  10647. Toastr.error(__('Unknown data format'));
  10648. });
  10649. //当加载数据成功时
  10650. table.on('load-success.bs.table', function (e, data) {
  10651. if (typeof data.rows === 'undefined' && typeof data.code != 'undefined') {
  10652. Toastr.error(data.msg);
  10653. }
  10654. });
  10655. //当刷新表格时
  10656. table.on('refresh.bs.table', function (e, settings, data) {
  10657. $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
  10658. });
  10659. //当执行搜索时
  10660. table.on('search.bs.table common-search.bs.table', function (e, settings, data) {
  10661. table.trigger("uncheckbox");
  10662. });
  10663. if (options.dblClickToEdit) {
  10664. //当双击单元格时
  10665. table.on('dbl-click-row.bs.table', function (e, row, element, field) {
  10666. $(Table.config.editonebtn, element).trigger("click");
  10667. });
  10668. }
  10669. //渲染内容前
  10670. table.on('pre-body.bs.table', function (e, data) {
  10671. if (options.maintainSelected) {
  10672. $.each(data, function (i, row) {
  10673. row[options.stateField] = $.inArray(row[options.pk], options.selectedIds) > -1;
  10674. });
  10675. }
  10676. });
  10677. //当内容渲染完成后
  10678. table.on('post-body.bs.table', function (e, data) {
  10679. $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
  10680. if ($(Table.config.checkboxtd + ":first", table).find("input[type='checkbox'][data-index]").length > 0) {
  10681. // 拖拽选择,需要重新绑定事件
  10682. require(['drag', 'drop'], function () {
  10683. var checkboxtd = $(Table.config.checkboxtd, table);
  10684. checkboxtd.drag("start", function (ev, dd) {
  10685. return $('<div class="selection" />').css('opacity', .65).appendTo(document.body);
  10686. }).drag(function (ev, dd) {
  10687. $(dd.proxy).css({
  10688. top: Math.min(ev.pageY, dd.startY),
  10689. left: Math.min(ev.pageX, dd.startX),
  10690. height: Math.abs(ev.pageY - dd.startY),
  10691. width: Math.abs(ev.pageX - dd.startX)
  10692. });
  10693. }).drag("end", function (ev, dd) {
  10694. $(dd.proxy).remove();
  10695. });
  10696. checkboxtd.drop("start", function () {
  10697. Table.api.toggleattr(this);
  10698. }).drop(function () {
  10699. // Table.api.toggleattr(this);
  10700. }).drop("end", function (e) {
  10701. var that = this;
  10702. setTimeout(function () {
  10703. if (e.type === 'mousemove') {
  10704. Table.api.toggleattr(that);
  10705. }
  10706. }, 0);
  10707. });
  10708. $.drop({
  10709. multi: true
  10710. });
  10711. });
  10712. }
  10713. });
  10714. var exportDataType = options.exportDataType;
  10715. // 处理选中筛选框后按钮的状态统一变更
  10716. table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table post-body.bs.table', function (e) {
  10717. var allIds = [];
  10718. $.each(table.bootstrapTable("getData"), function (i, item) {
  10719. allIds.push(typeof item[options.pk] != 'undefined' ? item[options.pk] : '');
  10720. });
  10721. var selectedIds = Table.api.selectedids(table, true),
  10722. selectedData = Table.api.selecteddata(table, true);
  10723. //开启分页checkbox分页记忆
  10724. if (options.maintainSelected) {
  10725. options.selectedIds = options.selectedIds.filter(function (element, index, self) {
  10726. return $.inArray(element, allIds) === -1;
  10727. }).concat(selectedIds);
  10728. options.selectedData = options.selectedData.filter(function (element, index, self) {
  10729. return $.inArray(element[options.pk], allIds) === -1;
  10730. }).concat(selectedData);
  10731. if (options.selectedIds.length > selectedIds.length) {
  10732. $("b", tipsBtn).text(options.selectedIds.length);
  10733. tipsBtn.removeClass('hide');
  10734. } else {
  10735. tipsBtn.addClass('hide');
  10736. }
  10737. } else {
  10738. options.selectedIds = selectedIds;
  10739. options.selectedData = selectedData;
  10740. }
  10741. //如果导出类型为auto时则自动判断
  10742. if (exportDataType === 'auto') {
  10743. options.exportDataType = selectedIds.length > 0 ? 'selected' : 'all';
  10744. }
  10745. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !options.selectedIds.length);
  10746. });
  10747. // 绑定TAB事件
  10748. $('.panel-heading [data-field] a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) {
  10749. var field = $(this).closest("[data-field]").data("field");
  10750. var value = $(this).data("value");
  10751. var object = $("[name='" + field + "']", table.closest(".bootstrap-table").find(".commonsearch-table"));
  10752. if (object.prop('tagName') == "SELECT") {
  10753. $("option[value='" + value + "']", object).prop("selected", true);
  10754. } else {
  10755. object.val(value);
  10756. }
  10757. table.trigger("uncheckbox");
  10758. table.bootstrapTable('refresh', {pageNumber: 1});
  10759. return false;
  10760. });
  10761. // 修复重置事件
  10762. $("form", table.closest(".bootstrap-table").find(".commonsearch-table")).on('reset', function () {
  10763. setTimeout(function () {
  10764. // $('.panel-heading [data-field] li.active a[data-toggle="tab"]').trigger('shown.bs.tab');
  10765. }, 0);
  10766. $('.panel-heading [data-field] li', table.closest(".panel-intro")).removeClass('active');
  10767. $('.panel-heading [data-field] li:first', table.closest(".panel-intro")).addClass('active');
  10768. });
  10769. // 刷新按钮事件
  10770. toolbar.on('click', Table.config.refreshbtn, function () {
  10771. table.bootstrapTable('refresh');
  10772. });
  10773. // 添加按钮事件
  10774. toolbar.on('click', Table.config.addbtn, function () {
  10775. var ids = Table.api.selectedids(table);
  10776. var url = options.extend.add_url;
  10777. if (url.indexOf("{ids}") !== -1) {
  10778. url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
  10779. }
  10780. Fast.api.open(url, $(this).data("original-title") || $(this).attr("title") || __('Add'), $(this).data() || {});
  10781. });
  10782. // 导入按钮事件
  10783. if ($(Table.config.importbtn, toolbar).length > 0) {
  10784. require(['upload'], function (Upload) {
  10785. Upload.api.upload($(Table.config.importbtn, toolbar), function (data, ret) {
  10786. Fast.api.ajax({
  10787. url: options.extend.import_url,
  10788. data: {file: data.url},
  10789. }, function (data, ret) {
  10790. table.trigger("uncheckbox");
  10791. table.bootstrapTable('refresh');
  10792. });
  10793. });
  10794. });
  10795. }
  10796. // 批量编辑按钮事件
  10797. toolbar.on('click', Table.config.editbtn, function () {
  10798. var that = this;
  10799. var ids = Table.api.selectedids(table);
  10800. if (ids.length > 10) {
  10801. return;
  10802. }
  10803. var title = $(that).data('title') || $(that).attr("title") || __('Edit');
  10804. var data = $(that).data() || {};
  10805. delete data.title;
  10806. //循环弹出多个编辑框
  10807. $.each(Table.api.selecteddata(table), function (index, row) {
  10808. var url = options.extend.edit_url;
  10809. row = $.extend({}, row ? row : {}, {ids: row[options.pk]});
  10810. url = Table.api.replaceurl(url, row, table);
  10811. Fast.api.open(url, typeof title === 'function' ? title.call(table, row) : title, data);
  10812. });
  10813. });
  10814. //清空回收站
  10815. $(document).on('click', Table.config.destroyallbtn, function () {
  10816. var that = this;
  10817. Layer.confirm(__('Are you sure you want to truncate?'), function () {
  10818. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10819. Fast.api.ajax(url, function () {
  10820. Layer.closeAll();
  10821. table.trigger("uncheckbox");
  10822. table.bootstrapTable('refresh');
  10823. }, function () {
  10824. Layer.closeAll();
  10825. });
  10826. });
  10827. return false;
  10828. });
  10829. //全部还原
  10830. $(document).on('click', Table.config.restoreallbtn, function () {
  10831. var that = this;
  10832. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10833. Fast.api.ajax(url, function () {
  10834. Layer.closeAll();
  10835. table.trigger("uncheckbox");
  10836. table.bootstrapTable('refresh');
  10837. }, function () {
  10838. Layer.closeAll();
  10839. });
  10840. return false;
  10841. });
  10842. //销毁或删除
  10843. $(document).on('click', Table.config.restoreonebtn + ',' + Table.config.destroyonebtn, function () {
  10844. var that = this;
  10845. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10846. var row = Fast.api.getrowbyindex(table, $(that).data("row-index"));
  10847. Fast.api.ajax({
  10848. url: url,
  10849. data: {ids: row[options.pk]}
  10850. }, function () {
  10851. table.trigger("uncheckbox");
  10852. table.bootstrapTable('refresh');
  10853. });
  10854. return false;
  10855. });
  10856. // 批量操作按钮事件
  10857. toolbar.on('click', Table.config.multibtn, function () {
  10858. var ids = Table.api.selectedids(table);
  10859. Table.api.multi($(this).data("action"), ids, table, this);
  10860. });
  10861. // 批量删除按钮事件
  10862. toolbar.on('click', Table.config.delbtn, function () {
  10863. var that = this;
  10864. var ids = Table.api.selectedids(table);
  10865. Layer.confirm(
  10866. __('Are you sure you want to delete the %s selected item?', ids.length),
  10867. {icon: 3, title: __('Warning'), offset: 0, shadeClose: true, btn: [__('OK'), __('Cancel')]},
  10868. function (index) {
  10869. Table.api.multi("del", ids, table, that);
  10870. Layer.close(index);
  10871. }
  10872. );
  10873. });
  10874. // 拖拽排序
  10875. require(['dragsort'], function () {
  10876. //绑定拖动排序
  10877. $("tbody", table).dragsort({
  10878. itemSelector: 'tr:visible',
  10879. dragSelector: "a.btn-dragsort",
  10880. dragEnd: function (a, b) {
  10881. var element = $("a.btn-dragsort", this);
  10882. var data = table.bootstrapTable('getData');
  10883. var current = data[parseInt($(this).data("index"))];
  10884. var options = table.bootstrapTable('getOptions');
  10885. //改变的值和改变的ID集合
  10886. var ids = $.map($("tbody tr:visible", table), function (tr) {
  10887. return data[parseInt($(tr).data("index"))][options.pk];
  10888. });
  10889. var changeid = current[options.pk];
  10890. var pid = typeof current.pid != 'undefined' ? current.pid : '';
  10891. var params = {
  10892. url: table.bootstrapTable('getOptions').extend.dragsort_url,
  10893. data: {
  10894. ids: ids.join(','),
  10895. changeid: changeid,
  10896. pid: pid,
  10897. field: Table.config.dragsortfield,
  10898. orderway: options.sortOrder,
  10899. table: options.extend.table,
  10900. pk: options.pk
  10901. }
  10902. };
  10903. Fast.api.ajax(params, function (data, ret) {
  10904. var success = $(element).data("success") || $.noop;
  10905. if (typeof success === 'function') {
  10906. if (false === success.call(element, data, ret)) {
  10907. return false;
  10908. }
  10909. }
  10910. table.bootstrapTable('refresh');
  10911. }, function (data, ret) {
  10912. var error = $(element).data("error") || $.noop;
  10913. if (typeof error === 'function') {
  10914. if (false === error.call(element, data, ret)) {
  10915. return false;
  10916. }
  10917. }
  10918. table.bootstrapTable('refresh');
  10919. });
  10920. },
  10921. placeHolderTemplate: ""
  10922. });
  10923. });
  10924. table.on("click", "input[data-id][name='checkbox']", function (e) {
  10925. var ids = $(this).data("id");
  10926. table.bootstrapTable($(this).prop("checked") ? 'checkBy' : 'uncheckBy', {field: options.pk, values: [ids]});
  10927. });
  10928. table.on("click", "[data-id].btn-change", function (e) {
  10929. e.preventDefault();
  10930. var changer = $.proxy(function () {
  10931. Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this);
  10932. }, this);
  10933. if (typeof $(this).data("confirm") !== 'undefined') {
  10934. Layer.confirm($(this).data("confirm"), function (index) {
  10935. changer();
  10936. Layer.close(index);
  10937. });
  10938. } else {
  10939. changer();
  10940. }
  10941. });
  10942. table.on("click", "[data-id].btn-edit", function (e) {
  10943. e.preventDefault();
  10944. var ids = $(this).data("id");
  10945. var row = Table.api.getrowbyid(table, ids);
  10946. row.ids = ids;
  10947. var url = Table.api.replaceurl(options.extend.edit_url, row, table);
  10948. Fast.api.open(url, $(this).data("original-title") || $(this).attr("title") || __('Edit'), $(this).data() || {});
  10949. });
  10950. table.on("click", "[data-id].btn-del", function (e) {
  10951. e.preventDefault();
  10952. var id = $(this).data("id");
  10953. var that = this;
  10954. Layer.confirm(
  10955. __('Are you sure you want to delete this item?'),
  10956. {icon: 3, title: __('Warning'), shadeClose: true, btn: [__('OK'), __('Cancel')]},
  10957. function (index) {
  10958. Table.api.multi("del", id, table, that);
  10959. Layer.close(index);
  10960. }
  10961. );
  10962. });
  10963. //修复dropdown定位溢出的情况
  10964. if (options.fixDropdownPosition) {
  10965. var tableBody = table.closest(".fixed-table-body");
  10966. table.on('show.bs.dropdown fa.event.refreshdropdown', ".btn-group", function (e) {
  10967. var dropdownMenu = $(".dropdown-menu", this);
  10968. var btnGroup = $(this);
  10969. var isPullRight = dropdownMenu.hasClass("pull-right") || dropdownMenu.hasClass("dropdown-menu-right");
  10970. var left, top, position;
  10971. if (true || dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
  10972. position = 'fixed';
  10973. top = btnGroup.offset().top - $(window).scrollTop() + btnGroup.outerHeight();
  10974. if ((top + dropdownMenu.outerHeight()) > $(window).height()) {
  10975. top = btnGroup.offset().top - dropdownMenu.outerHeight() - 5;
  10976. }
  10977. left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
  10978. }
  10979. if (left || top) {
  10980. dropdownMenu.css({
  10981. position: position, left: left, top: top, right: 'inherit'
  10982. });
  10983. }
  10984. });
  10985. var checkdropdown = function () {
  10986. if ($(".btn-group.open", table).length > 0 && $(".btn-group.open .dropdown-menu", table).css("position") == 'fixed') {
  10987. $(".btn-group.open", table).trigger("fa.event.refreshdropdown");
  10988. }
  10989. };
  10990. $(window).on("scroll", function () {
  10991. checkdropdown();
  10992. });
  10993. tableBody.on("scroll", function () {
  10994. checkdropdown();
  10995. });
  10996. }
  10997. var id = table.attr("id");
  10998. Table.list[id] = table;
  10999. return table;
  11000. },
  11001. // 批量操作请求
  11002. multi: function (action, ids, table, element) {
  11003. var options = table.bootstrapTable('getOptions');
  11004. var data = element ? $(element).data() : {};
  11005. ids = ($.isArray(ids) ? ids.join(",") : ids);
  11006. var url = typeof data.url !== "undefined" ? data.url : (action == "del" ? options.extend.del_url : options.extend.multi_url);
  11007. var params = typeof data.params !== "undefined" ? (typeof data.params == 'object' ? $.param(data.params) : data.params) : '';
  11008. options = {url: url, data: {action: action, ids: ids, params: params}};
  11009. Fast.api.ajax(options, function (data, ret) {
  11010. table.trigger("uncheckbox");
  11011. var success = $(element).data("success") || $.noop;
  11012. if (typeof success === 'function') {
  11013. if (false === success.call(element, data, ret)) {
  11014. return false;
  11015. }
  11016. }
  11017. table.bootstrapTable('refresh');
  11018. }, function (data, ret) {
  11019. var error = $(element).data("error") || $.noop;
  11020. if (typeof error === 'function') {
  11021. if (false === error.call(element, data, ret)) {
  11022. return false;
  11023. }
  11024. }
  11025. });
  11026. },
  11027. // 单元格元素事件
  11028. events: {
  11029. operate: {
  11030. 'click .btn-editone': function (e, value, row, index) {
  11031. e.stopPropagation();
  11032. e.preventDefault();
  11033. var table = $(this).closest('table');
  11034. var options = table.bootstrapTable('getOptions');
  11035. var ids = row[options.pk];
  11036. row = $.extend({}, row ? row : {}, {ids: ids});
  11037. var url = options.extend.edit_url;
  11038. Fast.api.open(Table.api.replaceurl(url, row, table), $(this).data("original-title") || $(this).attr("title") || __('Edit'), $(this).data() || {});
  11039. },
  11040. 'click .btn-delone': function (e, value, row, index) {
  11041. e.stopPropagation();
  11042. e.preventDefault();
  11043. var that = this;
  11044. var top = $(that).offset().top - $(window).scrollTop();
  11045. var left = $(that).offset().left - $(window).scrollLeft() - 260;
  11046. if (top + 154 > $(window).height()) {
  11047. top = top - 154;
  11048. }
  11049. if ($(window).width() < 480) {
  11050. top = left = undefined;
  11051. }
  11052. Layer.confirm(
  11053. __('Are you sure you want to delete this item?'),
  11054. {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true, btn: [__('OK'), __('Cancel')]},
  11055. function (index) {
  11056. var table = $(that).closest('table');
  11057. var options = table.bootstrapTable('getOptions');
  11058. Table.api.multi("del", row[options.pk], table, that);
  11059. Layer.close(index);
  11060. }
  11061. );
  11062. }
  11063. },//单元格图片预览
  11064. image: {
  11065. 'click .img-center': function (e, value, row, index) {
  11066. var data = [];
  11067. value = value === null ? '' : value.toString();
  11068. var arr = value != '' ? value.split(",") : [];
  11069. var url;
  11070. $.each(arr, function (index, value) {
  11071. url = Fast.api.cdnurl(value);
  11072. data.push({
  11073. src: url,
  11074. thumb: url.match(/^(\/|data:image\\)/) ? url : url + Config.upload.thumbstyle
  11075. });
  11076. });
  11077. Layer.photos({
  11078. photos: {
  11079. "start": $(this).parent().index(),
  11080. "data": data
  11081. },
  11082. anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
  11083. });
  11084. },
  11085. }
  11086. },
  11087. // 单元格数据格式化
  11088. formatter: {
  11089. icon: function (value, row, index) {
  11090. value = value === null ? '' : value.toString();
  11091. value = value.indexOf(" ") > -1 ? value : "fa fa-" + value;
  11092. //渲染fontawesome图标
  11093. return '<i class="' + value + '"></i> ' + value;
  11094. },
  11095. image: function (value, row, index) {
  11096. value = value == null || value.length === 0 ? '' : value.toString();
  11097. value = value ? value : '/assets/img/blank.gif';
  11098. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  11099. var url = Fast.api.cdnurl(value, true);
  11100. url = url.match(/^(\/|data:image\\)/) ? url : url + Config.upload.thumbstyle;
  11101. return '<a href="javascript:"><img class="' + classname + '" src="' + url + '" /></a>';
  11102. },
  11103. images: function (value, row, index) {
  11104. value = value == null || value.length === 0 ? '' : value.toString();
  11105. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  11106. var arr = value != '' ? value.split(',') : [];
  11107. var html = [];
  11108. var url;
  11109. $.each(arr, function (i, value) {
  11110. value = value ? value : '/assets/img/blank.gif';
  11111. url = Fast.api.cdnurl(value, true);
  11112. url = url.match(/^(\/|data:image\\)/) ? url : url + Config.upload.thumbstyle;
  11113. html.push('<a href="javascript:"><img class="' + classname + '" src="' + url + '" /></a>');
  11114. });
  11115. return html.join(' ');
  11116. },
  11117. file: function (value, row, index) {
  11118. value = value == null || value.length === 0 ? '' : value.toString();
  11119. value = Fast.api.cdnurl(value, true);
  11120. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  11121. var suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(value);
  11122. suffix = suffix ? suffix[1] : 'file';
  11123. var url = Fast.api.fixurl("ajax/icon?suffix=" + suffix);
  11124. return '<a href="' + value + '" target="_blank"><img src="' + url + '" class="' + classname + '"></a>';
  11125. },
  11126. files: function (value, row, index) {
  11127. value = value == null || value.length === 0 ? '' : value.toString();
  11128. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  11129. var arr = value != '' ? value.split(',') : [];
  11130. var html = [];
  11131. var suffix, url;
  11132. $.each(arr, function (i, value) {
  11133. value = Fast.api.cdnurl(value, true);
  11134. suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(value);
  11135. suffix = suffix ? suffix[1] : 'file';
  11136. url = Fast.api.fixurl("ajax/icon?suffix=" + suffix);
  11137. html.push('<a href="' + value + '" target="_blank"><img src="' + url + '" class="' + classname + '"></a>');
  11138. });
  11139. return html.join(' ');
  11140. },
  11141. content: function (value, row, index) {
  11142. var width = this.width != undefined ? (this.width.match(/^\d+$/) ? this.width + "px" : this.width) : "250px";
  11143. return "<div style='white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:" + width + ";'>" + value + "</div>";
  11144. },
  11145. status: function (value, row, index) {
  11146. var custom = {normal: 'success', hidden: 'gray', deleted: 'danger', locked: 'info'};
  11147. if (typeof this.custom !== 'undefined') {
  11148. custom = $.extend(custom, this.custom);
  11149. }
  11150. this.custom = custom;
  11151. this.icon = 'fa fa-circle';
  11152. return Table.api.formatter.normal.call(this, value, row, index);
  11153. },
  11154. normal: function (value, row, index) {
  11155. var colorArr = ["primary", "success", "danger", "warning", "info", "gray", "red", "yellow", "aqua", "blue", "navy", "teal", "olive", "lime", "fuchsia", "purple", "maroon"];
  11156. var custom = {};
  11157. if (typeof this.custom !== 'undefined') {
  11158. custom = $.extend(custom, this.custom);
  11159. }
  11160. value = value == null || value.length === 0 ? '' : value.toString();
  11161. var keys = typeof this.searchList === 'object' ? Object.keys(this.searchList) : [];
  11162. var index = keys.indexOf(value);
  11163. var color = value && typeof custom[value] !== 'undefined' ? custom[value] : null;
  11164. var display = index > -1 ? this.searchList[value] : null;
  11165. var icon = typeof this.icon !== 'undefined' ? this.icon : null;
  11166. if (!color) {
  11167. color = index > -1 && typeof colorArr[index] !== 'undefined' ? colorArr[index] : 'primary';
  11168. }
  11169. if (!display) {
  11170. display = __(value.charAt(0).toUpperCase() + value.slice(1));
  11171. }
  11172. var html = '<span class="text-' + color + '">' + (icon ? '<i class="' + icon + '"></i> ' : '') + display + '</span>';
  11173. if (this.operate != false) {
  11174. html = '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + this.field + '" data-value="' + value + '">' + html + '</a>';
  11175. }
  11176. return html;
  11177. },
  11178. toggle: function (value, row, index) {
  11179. var table = this.table;
  11180. var options = table ? table.bootstrapTable('getOptions') : {};
  11181. var pk = options.pk || "id";
  11182. var color = typeof this.color !== 'undefined' ? this.color : 'success';
  11183. var yes = typeof this.yes !== 'undefined' ? this.yes : 1;
  11184. var no = typeof this.no !== 'undefined' ? this.no : 0;
  11185. var url = typeof this.url !== 'undefined' ? this.url : '';
  11186. var confirm = '';
  11187. var disable = false;
  11188. if (typeof this.confirm !== "undefined") {
  11189. confirm = typeof this.confirm === "function" ? this.confirm.call(this, value, row, index) : this.confirm;
  11190. }
  11191. if (typeof this.disable !== "undefined") {
  11192. disable = typeof this.disable === "function" ? this.disable.call(this, value, row, index) : this.disable;
  11193. }
  11194. return "<a href='javascript:;' data-toggle='tooltip' title='" + __('Click to toggle') + "' class='btn-change " + (disable ? 'btn disabled no-padding' : '') + "' data-index='" + index + "' data-id='"
  11195. + 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>";
  11196. },
  11197. url: function (value, row, index) {
  11198. value = value == null || value.length === 0 ? '' : value.toString();
  11199. 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>';
  11200. },
  11201. search: function (value, row, index) {
  11202. var field = this.field;
  11203. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  11204. value = row[this.customField];
  11205. field = this.customField;
  11206. }
  11207. return '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', value) + '" data-field="' + field + '" data-value="' + value + '">' + value + '</a>';
  11208. },
  11209. addtabs: function (value, row, index) {
  11210. var url = Table.api.replaceurl(this.url || '', row, this.table);
  11211. var title = this.atitle ? this.atitle : __("Search %s", value);
  11212. return '<a href="' + Fast.api.fixurl(url) + '" class="addtabsit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  11213. },
  11214. dialog: function (value, row, index) {
  11215. var url = Table.api.replaceurl(this.url || '', row, this.table);
  11216. var title = this.atitle ? this.atitle : __("View %s", value);
  11217. return '<a href="' + Fast.api.fixurl(url) + '" class="dialogit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  11218. },
  11219. flag: function (value, row, index) {
  11220. var that = this;
  11221. value = value == null || value.length === 0 ? '' : value.toString();
  11222. var colorArr = {index: 'success', hot: 'warning', recommend: 'danger', 'new': 'info'};
  11223. //如果字段列有定义custom
  11224. if (typeof this.custom !== 'undefined') {
  11225. colorArr = $.extend(colorArr, this.custom);
  11226. }
  11227. var field = this.field;
  11228. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  11229. value = row[this.customField];
  11230. field = this.customField;
  11231. }
  11232. if (typeof that.searchList === 'object' && typeof that.custom === 'undefined') {
  11233. var i = 0;
  11234. var searchValues = Object.values(colorArr);
  11235. $.each(that.searchList, function (key, val) {
  11236. if (typeof colorArr[key] == 'undefined') {
  11237. colorArr[key] = searchValues[i];
  11238. i = typeof searchValues[i + 1] === 'undefined' ? 0 : i + 1;
  11239. }
  11240. });
  11241. }
  11242. //渲染Flag
  11243. var html = [];
  11244. var arr = value != '' ? value.split(',') : [];
  11245. var color, display, label;
  11246. $.each(arr, function (i, value) {
  11247. value = value == null || value.length === 0 ? '' : value.toString();
  11248. if (value == '')
  11249. return true;
  11250. color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  11251. display = typeof that.searchList !== 'undefined' && typeof that.searchList[value] !== 'undefined' ? that.searchList[value] : __(value.charAt(0).toUpperCase() + value.slice(1));
  11252. label = '<span class="label label-' + color + '">' + display + '</span>';
  11253. if (that.operate) {
  11254. html.push('<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + field + '" data-value="' + value + '">' + label + '</a>');
  11255. } else {
  11256. html.push(label);
  11257. }
  11258. });
  11259. return html.join(' ');
  11260. },
  11261. label: function (value, row, index) {
  11262. return Table.api.formatter.flag.call(this, value, row, index);
  11263. },
  11264. datetime: function (value, row, index) {
  11265. var datetimeFormat = typeof this.datetimeFormat === 'undefined' ? 'YYYY-MM-DD HH:mm:ss' : this.datetimeFormat;
  11266. if (isNaN(value)) {
  11267. return value ? Moment(value).format(datetimeFormat) : __('None');
  11268. } else {
  11269. return value ? Moment(parseInt(value) * 1000).format(datetimeFormat) : __('None');
  11270. }
  11271. },
  11272. operate: function (value, row, index) {
  11273. var table = this.table;
  11274. // 操作配置
  11275. var options = table ? table.bootstrapTable('getOptions') : {};
  11276. // 默认按钮组
  11277. var buttons = $.extend([], this.buttons || []);
  11278. // 所有按钮名称
  11279. var names = [];
  11280. buttons.forEach(function (item) {
  11281. names.push(item.name);
  11282. });
  11283. if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
  11284. buttons.push(Table.button.dragsort);
  11285. }
  11286. if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
  11287. Table.button.edit.url = options.extend.edit_url;
  11288. buttons.push(Table.button.edit);
  11289. }
  11290. if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
  11291. buttons.push(Table.button.del);
  11292. }
  11293. return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
  11294. }
  11295. ,
  11296. buttons: function (value, row, index) {
  11297. // 默认按钮组
  11298. var buttons = $.extend([], this.buttons || []);
  11299. return Table.api.buttonlink(this, buttons, value, row, index, 'buttons');
  11300. }
  11301. },
  11302. buttonlink: function (column, buttons, value, row, index, type) {
  11303. var table = column.table;
  11304. column.clickToSelect = false;
  11305. type = typeof type === 'undefined' ? 'buttons' : type;
  11306. var options = table ? table.bootstrapTable('getOptions') : {};
  11307. var html = [];
  11308. var hidden, visible, disable, url, classname, icon, text, title, refresh, confirm, extend,
  11309. dropdown, link;
  11310. var fieldIndex = column.fieldIndex;
  11311. var dropdowns = {};
  11312. $.each(buttons, function (i, j) {
  11313. if (type === 'operate') {
  11314. if (j.name === 'dragsort' && typeof row[Table.config.dragsortfield] === 'undefined') {
  11315. return true;
  11316. }
  11317. if (['add', 'edit', 'del', 'multi', 'dragsort'].indexOf(j.name) > -1 && !options.extend[j.name + "_url"]) {
  11318. return true;
  11319. }
  11320. }
  11321. var attr = table.data(type + "-" + j.name);
  11322. if (typeof attr === 'undefined' || attr) {
  11323. hidden = typeof j.hidden === 'function' ? j.hidden.call(table, row, j) : (typeof j.hidden !== 'undefined' ? j.hidden : false);
  11324. if (hidden) {
  11325. return true;
  11326. }
  11327. visible = typeof j.visible === 'function' ? j.visible.call(table, row, j) : (typeof j.visible !== 'undefined' ? j.visible : true);
  11328. if (!visible) {
  11329. return true;
  11330. }
  11331. dropdown = j.dropdown ? j.dropdown : '';
  11332. url = j.url ? j.url : '';
  11333. url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
  11334. classname = j.classname ? j.classname : (dropdown ? 'btn-' + name + 'one' : 'btn-primary btn-' + name + 'one');
  11335. icon = j.icon ? j.icon : '';
  11336. text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : '';
  11337. title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text;
  11338. refresh = j.refresh ? 'data-refresh="' + j.refresh + '"' : '';
  11339. confirm = typeof j.confirm === 'function' ? j.confirm.call(table, row, j) : (typeof j.confirm !== 'undefined' ? j.confirm : false);
  11340. confirm = confirm ? 'data-confirm="' + confirm + '"' : '';
  11341. extend = j.extend ? j.extend : '';
  11342. disable = typeof j.disable === 'function' ? j.disable.call(table, row, j) : (typeof j.disable !== 'undefined' ? j.disable : false);
  11343. if (disable) {
  11344. classname = classname + ' disabled';
  11345. }
  11346. 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>';
  11347. if (dropdown) {
  11348. if (typeof dropdowns[dropdown] == 'undefined') {
  11349. dropdowns[dropdown] = [];
  11350. }
  11351. dropdowns[dropdown].push(link);
  11352. } else {
  11353. html.push(link);
  11354. }
  11355. }
  11356. });
  11357. if (!$.isEmptyObject(dropdowns)) {
  11358. var dropdownHtml = [];
  11359. $.each(dropdowns, function (i, j) {
  11360. 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>');
  11361. });
  11362. html.unshift(dropdownHtml);
  11363. }
  11364. return html.join(' ');
  11365. },
  11366. //替换URL中的数据
  11367. replaceurl: function (url, row, table) {
  11368. var options = table ? table.bootstrapTable('getOptions') : null;
  11369. var ids = options ? row[options.pk] : 0;
  11370. row.ids = ids ? ids : (typeof row.ids !== 'undefined' ? row.ids : 0);
  11371. url = url == null || url.length === 0 ? '' : url.toString();
  11372. //自动添加ids参数
  11373. url = !url.match(/\{ids\}/i) ? url + (url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + '{ids}' : url;
  11374. url = url.replace(/\{(.*?)\}/gi, function (matched) {
  11375. matched = matched.substring(1, matched.length - 1);
  11376. if (matched.indexOf(".") !== -1) {
  11377. var temp = row;
  11378. var arr = matched.split(/\./);
  11379. for (var i = 0; i < arr.length; i++) {
  11380. if (typeof temp[arr[i]] !== 'undefined') {
  11381. temp = temp[arr[i]];
  11382. }
  11383. }
  11384. return typeof temp === 'object' ? '' : temp;
  11385. }
  11386. return row[matched];
  11387. });
  11388. return url;
  11389. },
  11390. // 获取选中的条目ID集合
  11391. selectedids: function (table, current) {
  11392. var options = table.bootstrapTable('getOptions');
  11393. //如果有设置翻页记忆模式
  11394. if (!current && options.maintainSelected) {
  11395. return options.selectedIds;
  11396. }
  11397. return $.map(table.bootstrapTable('getSelections'), function (row) {
  11398. return row[options.pk];
  11399. });
  11400. },
  11401. //获取选中的数据
  11402. selecteddata: function (table, current) {
  11403. var options = table.bootstrapTable('getOptions');
  11404. //如果有设置翻页记忆模式
  11405. if (!current && options.maintainSelected) {
  11406. return options.selectedData;
  11407. }
  11408. return table.bootstrapTable('getSelections');
  11409. },
  11410. // 切换复选框状态
  11411. toggleattr: function (table) {
  11412. $("input[type='checkbox']", table).trigger('click');
  11413. },
  11414. // 根据行索引获取行数据
  11415. getrowdata: function (table, index) {
  11416. index = parseInt(index);
  11417. var data = table.bootstrapTable('getData');
  11418. return typeof data[index] !== 'undefined' ? data[index] : null;
  11419. },
  11420. // 根据行索引获取行数据
  11421. getrowbyindex: function (table, index) {
  11422. return Table.api.getrowdata(table, index);
  11423. },
  11424. // 根据主键ID获取行数据
  11425. getrowbyid: function (table, id) {
  11426. var row = {};
  11427. var options = table.bootstrapTable("getOptions");
  11428. $.each(Table.api.selecteddata(table), function (i, j) {
  11429. if (j[options.pk] == id) {
  11430. row = j;
  11431. return false;
  11432. }
  11433. });
  11434. return row;
  11435. }
  11436. },
  11437. };
  11438. return Table;
  11439. });
  11440. // jQuery List DragSort v0.5.2
  11441. // Website: http://dragsort.codeplex.com/
  11442. // License: http://dragsort.codeplex.com/license
  11443. (function($) {
  11444. $.fn.dragsort = function(options) {
  11445. if (options == "destroy") {
  11446. $(this.selector).trigger("dragsort-uninit");
  11447. return;
  11448. }
  11449. var opts = $.extend({}, $.fn.dragsort.defaults, options);
  11450. var lists = [];
  11451. var list = null, lastPos = null;
  11452. this.each(function(i, cont) {
  11453. //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
  11454. if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody"))
  11455. cont = $(cont).children().get(0);
  11456. var newList = {
  11457. draggedItem: null,
  11458. placeHolderItem: null,
  11459. pos: null,
  11460. offset: null,
  11461. offsetLimit: null,
  11462. scroll: null,
  11463. container: cont,
  11464. init: function() {
  11465. //set options to default values if not set
  11466. opts.tagName = opts.tagName == "" ? ($(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase()) : opts.tagName;
  11467. if (opts.itemSelector == "")
  11468. opts.itemSelector = opts.tagName;
  11469. if (opts.dragSelector == "")
  11470. opts.dragSelector = opts.tagName;
  11471. if (opts.placeHolderTemplate == "")
  11472. opts.placeHolderTemplate = "<" + opts.tagName + ">&nbsp;</" + opts.tagName + ">";
  11473. //listidx allows reference back to correct list variable instance
  11474. $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit);
  11475. this.styleDragHandlers(true);
  11476. },
  11477. uninit: function() {
  11478. var list = lists[$(this).attr("data-listidx")];
  11479. $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit");
  11480. list.styleDragHandlers(false);
  11481. },
  11482. getItems: function() {
  11483. return $(this.container).children(opts.itemSelector);
  11484. },
  11485. styleDragHandlers: function(cursor) {
  11486. this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : "");
  11487. },
  11488. grabItem: function(e) {
  11489. var list = lists[$(this).attr("data-listidx")];
  11490. var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0);
  11491. var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0;
  11492. //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return
  11493. if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem)
  11494. return;
  11495. //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,
  11496. //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude
  11497. //e.preventDefault();
  11498. //change cursor to move while dragging
  11499. var dragHandle = e.target;
  11500. while (!$(dragHandle).is(opts.dragSelector)) {
  11501. if (dragHandle == this) return;
  11502. dragHandle = dragHandle.parentNode;
  11503. }
  11504. $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor"));
  11505. $(dragHandle).css("cursor", "move");
  11506. //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work
  11507. var listElem = this;
  11508. var trigger = function() {
  11509. list.dragStart.call(listElem, e);
  11510. $(list.container).unbind("mousemove", trigger);
  11511. };
  11512. $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); });
  11513. },
  11514. dragStart: function(e) {
  11515. if (list != null && list.draggedItem != null)
  11516. list.dropItem();
  11517. list = lists[$(this).attr("data-listidx")];
  11518. list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName)
  11519. //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
  11520. list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem));
  11521. //calculate mouse offset relative to draggedItem
  11522. var mt = parseInt(list.draggedItem.css("marginTop"));
  11523. var ml = parseInt(list.draggedItem.css("marginLeft"));
  11524. list.offset = list.draggedItem.offset();
  11525. list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1;
  11526. list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1;
  11527. //calculate box the dragged item can't be dragged outside of
  11528. if (!opts.dragBetween) {
  11529. 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();
  11530. list.offsetLimit = $(list.container).offset();
  11531. list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth();
  11532. list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
  11533. }
  11534. //create placeholder item
  11535. var h = list.draggedItem.height();
  11536. var w = list.draggedItem.width();
  11537. if (opts.tagName == "tr") {
  11538. list.draggedItem.children().each(function() { $(this).width($(this).width()); });
  11539. list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true);
  11540. list.draggedItem.after(list.placeHolderItem);
  11541. //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html("&nbsp;"); });
  11542. list.placeHolderItem.children().each(function() { $(this).html("&nbsp;"); });
  11543. } else {
  11544. list.draggedItem.after(opts.placeHolderTemplate);
  11545. list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true);
  11546. }
  11547. if (opts.tagName == "td") {
  11548. var listTable = list.draggedItem.closest("table").get(0);
  11549. $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").appendTo("body").children().append(list.draggedItem);
  11550. }
  11551. //style draggedItem while dragging
  11552. var orig = list.draggedItem.attr("style");
  11553. list.draggedItem.attr("data-origstyle", orig ? orig : "");
  11554. list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w });
  11555. //auto-scroll setup
  11556. list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() };
  11557. list.scroll.scrollY = window.setInterval(function() {
  11558. if (opts.scrollContainer != window) {
  11559. $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY);
  11560. return;
  11561. }
  11562. var t = $(opts.scrollContainer).scrollTop();
  11563. if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) {
  11564. $(opts.scrollContainer).scrollTop(t + list.scroll.moveY);
  11565. list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1);
  11566. }
  11567. }, 10);
  11568. list.scroll.scrollX = window.setInterval(function() {
  11569. if (opts.scrollContainer != window) {
  11570. $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX);
  11571. return;
  11572. }
  11573. var l = $(opts.scrollContainer).scrollLeft();
  11574. if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) {
  11575. $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX);
  11576. list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1);
  11577. }
  11578. }, 10);
  11579. //misc
  11580. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  11581. list.setPos(e.pageX, e.pageY);
  11582. $(document).bind("mousemove", list.swapItems);
  11583. $(document).bind("mouseup", list.dropItem);
  11584. if (opts.scrollContainer != window)
  11585. $(window).bind("wheel", list.wheel);
  11586. },
  11587. //set position of draggedItem
  11588. setPos: function(x, y) {
  11589. //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner
  11590. var top = y - this.offset.top;
  11591. var left = x - this.offset.left;
  11592. //limit top, left to within box draggedItem can't be dragged outside of
  11593. if (!opts.dragBetween) {
  11594. top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
  11595. left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
  11596. }
  11597. //adjust top & left calculations to parent offset
  11598. var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin
  11599. if (parent != null) {
  11600. top -= parent.top;
  11601. left -= parent.left;
  11602. }
  11603. //set x or y auto-scroll amount
  11604. if (opts.scrollContainer == window) {
  11605. y -= $(window).scrollTop();
  11606. x -= $(window).scrollLeft();
  11607. y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5);
  11608. x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5);
  11609. } else {
  11610. var cont = $(opts.scrollContainer);
  11611. var offset = cont.offset();
  11612. y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top);
  11613. x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left);
  11614. }
  11615. list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x);
  11616. list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y);
  11617. //move draggedItem to new mouse cursor location
  11618. this.draggedItem.css({ top: top, left: left });
  11619. },
  11620. //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over
  11621. wheel: function(e) {
  11622. if (list && opts.scrollContainer != window) {
  11623. var cont = $(opts.scrollContainer);
  11624. var offset = cont.offset();
  11625. e = e.originalEvent;
  11626. if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) {
  11627. var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY;
  11628. cont.scrollTop(cont.scrollTop() + deltaY);
  11629. e.preventDefault();
  11630. }
  11631. }
  11632. },
  11633. //build a table recording all the positions of the moveable list items
  11634. buildPositionTable: function() {
  11635. var pos = [];
  11636. this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) {
  11637. var loc = $(this).offset();
  11638. loc.right = loc.left + $(this).outerWidth();
  11639. loc.bottom = loc.top + $(this).outerHeight();
  11640. loc.elm = this;
  11641. pos[i] = loc;
  11642. });
  11643. this.pos = pos;
  11644. },
  11645. dropItem: function() {
  11646. if (list.draggedItem == null)
  11647. return;
  11648. //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower
  11649. //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower)
  11650. var orig = list.draggedItem.attr("data-origstyle");
  11651. list.draggedItem.attr("style", orig);
  11652. if (orig == "")
  11653. list.draggedItem.removeAttr("style");
  11654. list.draggedItem.removeAttr("data-origstyle");
  11655. list.styleDragHandlers(true);
  11656. list.placeHolderItem.before(list.draggedItem);
  11657. list.placeHolderItem.remove();
  11658. $("[data-droptarget], .dragSortItem").remove();
  11659. window.clearInterval(list.scroll.scrollY);
  11660. window.clearInterval(list.scroll.scrollX);
  11661. //if position changed call dragEnd
  11662. if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem))
  11663. if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order
  11664. var pos = list.draggedItem.attr("data-origpos").split('-');
  11665. var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]);
  11666. if (nextItem.size() > 0)
  11667. nextItem.before(list.draggedItem);
  11668. else if (pos[1] == 0) //was the only item in list
  11669. $(lists[pos[0]].container).prepend(list.draggedItem);
  11670. else //was the last item in list
  11671. $(lists[pos[0]].container).append(list.draggedItem);
  11672. }
  11673. list.draggedItem.removeAttr("data-origpos");
  11674. list.draggedItem = null;
  11675. $(document).unbind("mousemove", list.swapItems);
  11676. $(document).unbind("mouseup", list.dropItem);
  11677. if (opts.scrollContainer != window)
  11678. $(window).unbind("wheel", list.wheel);
  11679. return false;
  11680. },
  11681. //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of
  11682. swapItems: function(e) {
  11683. if (list.draggedItem == null)
  11684. return false;
  11685. //move draggedItem to mouse location
  11686. list.setPos(e.pageX, e.pageY);
  11687. //retrieve list and item position mouse cursor is over
  11688. var ei = list.findPos(e.pageX, e.pageY);
  11689. var nlist = list;
  11690. for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) {
  11691. ei = lists[i].findPos(e.pageX, e.pageY);
  11692. nlist = lists[i];
  11693. }
  11694. //if not over another moveable list item return
  11695. if (ei == -1)
  11696. return false;
  11697. //save fixed items locations
  11698. var children = function() { return $(nlist.container).children().not(nlist.draggedItem); };
  11699. var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); });
  11700. //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after
  11701. if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left)
  11702. $(nlist.pos[ei].elm).before(list.placeHolderItem);
  11703. else
  11704. $(nlist.pos[ei].elm).after(list.placeHolderItem);
  11705. //restore fixed items location
  11706. fixed.each(function() {
  11707. var elm = children().eq(this.idx).get(0);
  11708. if (this != elm && children().index(this) < this.idx)
  11709. $(this).insertAfter(elm);
  11710. else if (this != elm)
  11711. $(this).insertBefore(elm);
  11712. });
  11713. //misc
  11714. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  11715. lastPos = list.draggedItem.offset();
  11716. return false;
  11717. },
  11718. //returns the index of the list item the mouse is over
  11719. findPos: function(x, y) {
  11720. for (var i = 0; i < this.pos.length; i++) {
  11721. if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y)
  11722. return i;
  11723. }
  11724. return -1;
  11725. },
  11726. //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position
  11727. createDropTargets: function() {
  11728. if (!opts.dragBetween)
  11729. return;
  11730. $(lists).each(function() {
  11731. var ph = $(this.container).find("[data-placeholder]");
  11732. var dt = $(this.container).find("[data-droptarget]");
  11733. if (ph.size() > 0 && dt.size() > 0)
  11734. dt.remove();
  11735. else if (ph.size() == 0 && dt.size() == 0) {
  11736. if (opts.tagName == "td")
  11737. $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container);
  11738. else
  11739. //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8)
  11740. $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true));
  11741. list.placeHolderItem.attr("data-placeholder", true);
  11742. }
  11743. });
  11744. }
  11745. };
  11746. newList.init();
  11747. lists.push(newList);
  11748. });
  11749. return this;
  11750. };
  11751. $.fn.dragsort.defaults = {
  11752. tagName:"",
  11753. itemSelector: "",
  11754. dragSelector: "",
  11755. dragSelectorExclude: "input, textarea",
  11756. dragEnd: function() { },
  11757. dragBetween: false,
  11758. placeHolderTemplate: "",
  11759. scrollContainer: window,
  11760. scrollSpeed: 5
  11761. };
  11762. })(jQuery);
  11763. define("dragsort", function(){});
  11764. /*!
  11765. * jquery.event.drag - v 2.2
  11766. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  11767. * Open Source MIT License - http://threedubmedia.com/code/license
  11768. */
  11769. ;(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);
  11770. define("drag", function(){});
  11771. /*!
  11772. * jquery.event.drop - v 2.2
  11773. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  11774. * Open Source MIT License - http://threedubmedia.com/code/license
  11775. */
  11776. ;(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);
  11777. define("drop", function(){});
  11778. /**
  11779. * http://git.oschina.net/hbbcs/bootStrap-addTabs
  11780. * Created by joe on 2015-12-19.
  11781. * Modified by Karson
  11782. */
  11783. (function ($) {
  11784. $.fn.addtabs = function (options) {
  11785. var obj = $(this);
  11786. options = $.extend({
  11787. content: '', //直接指定所有页面TABS内容
  11788. close: true, //是否可以关闭
  11789. monitor: 'body', //监视的区域
  11790. nav: '.nav-addtabs',
  11791. tab: '.tab-addtabs',
  11792. iframeUse: true, //使用iframe还是ajax
  11793. iframeHeight: $(window).height() - 50, //固定TAB中IFRAME高度,根据需要自己修改
  11794. iframeForceRefresh: false, //点击后强制加载对应的iframe
  11795. iframeForceRefreshTable: false, //点击后强制刷新对应的iframe中的table
  11796. callback: function () {
  11797. //关闭后回调函数
  11798. }
  11799. }, options || {});
  11800. var navobj = $(options.nav);
  11801. var tabobj = $(options.tab);
  11802. if (history.pushState) {
  11803. //浏览器前进后退事件
  11804. $(window).on("popstate", function (e) {
  11805. var state = e.originalEvent.state;
  11806. if (state) {
  11807. $("a[addtabs=" + state.id + "]", options.monitor).data("pushstate", true).trigger("click");
  11808. }
  11809. });
  11810. }
  11811. $(options.monitor).on('click', '[addtabs]', function (e) {
  11812. if ($(this).attr('url').indexOf("javascript:") !== 0) {
  11813. if ($(this).is("a")) {
  11814. e.preventDefault();
  11815. }
  11816. var id = $(this).attr('addtabs');
  11817. var title = $(this).attr('title') ? $(this).attr('title') : $.trim($(this).text());
  11818. var url = $(this).attr('url');
  11819. var content = options.content ? options.content : $(this).attr('content');
  11820. var ajax = $(this).attr('ajax') === '1' || $(this).attr('ajax') === 'true';
  11821. var state = ({
  11822. url: url, title: title, id: id, content: content, ajax: ajax
  11823. });
  11824. document.title = title;
  11825. if (history.pushState && !$(this).data("pushstate")) {
  11826. var pushurl = url.indexOf("ref=addtabs") === -1 ? (url + (url.indexOf("?") > -1 ? "&" : "?") + "ref=addtabs") : url;
  11827. try {
  11828. window.history.pushState(state, title, pushurl);
  11829. } catch (e) {
  11830. }
  11831. }
  11832. $(this).data("pushstate", null);
  11833. _add.call(this, {
  11834. id: id,
  11835. title: $(this).attr('title') ? $(this).attr('title') : $(this).html(),
  11836. content: content,
  11837. url: url,
  11838. ajax: ajax
  11839. });
  11840. }
  11841. });
  11842. navobj.on('click', '.close-tab', function () {
  11843. var id = $(this).prev("a").attr("aria-controls");
  11844. _close(id);
  11845. return false;
  11846. });
  11847. navobj.on('dblclick', 'li[role=presentation]', function () {
  11848. $(this).find(".close-tab").trigger("click");
  11849. });
  11850. navobj.on('click', 'li[role=presentation]', function () {
  11851. $("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click");
  11852. });
  11853. $(window).resize(function () {
  11854. if (typeof options.nav === 'object') {
  11855. var siblingsWidth = 0;
  11856. navobj.siblings().each(function () {
  11857. siblingsWidth += $(this).outerWidth();
  11858. });
  11859. navobj.width(navobj.parent().width() - siblingsWidth);
  11860. } else {
  11861. $("#nav").width($("#header").find("> .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20);
  11862. }
  11863. _drop();
  11864. });
  11865. var _add = function (opts) {
  11866. var id, tabid, conid, url;
  11867. id = opts.id;
  11868. tabid = 'tab_' + opts.id;
  11869. conid = 'con_' + opts.id;
  11870. url = opts.url;
  11871. url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1");
  11872. var tabitem = $('#' + tabid, navobj);
  11873. var conitem = $('#' + conid, tabobj);
  11874. navobj.find("[role='presentation']").removeClass('active');
  11875. tabobj.find("[role='tabpanel']").removeClass('active');
  11876. //如果TAB不存在,创建一个新的TAB
  11877. if (tabitem.size() === 0) {
  11878. //创建新TAB的title
  11879. 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>');
  11880. //是否允许关闭
  11881. if (options.close && $("li", navobj).size() > 0) {
  11882. tabitem.append(' <i class="close-tab fa fa-remove"></i>');
  11883. }
  11884. if (conitem.size() === 0) {
  11885. //创建新TAB的内容
  11886. conitem = $('<div role="tabpanel" class="tab-pane" id="' + conid + '"></div>');
  11887. //是否指定TAB内容
  11888. if (opts.content) {
  11889. conitem.append(opts.content);
  11890. } else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接
  11891. var height = options.iframeHeight;
  11892. 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>');
  11893. } else {
  11894. $.get(url, function (data) {
  11895. conitem.append(data);
  11896. });
  11897. }
  11898. tabobj.append(conitem);
  11899. }
  11900. //加入TABS
  11901. if ($('.tabdrop li', navobj).size() > 0) {
  11902. $('.tabdrop ul', navobj).append(tabitem);
  11903. } else {
  11904. navobj.append(tabitem);
  11905. }
  11906. } else {
  11907. //强制刷新iframe
  11908. if (options.iframeForceRefresh) {
  11909. $("#" + conid + " iframe").attr('src', function (i, val) {
  11910. return val;
  11911. });
  11912. } else if (options.iframeForceRefreshTable) {
  11913. try {
  11914. //检测iframe中是否存在刷新按钮
  11915. if ($("#" + conid + " iframe").contents().find(".btn-refresh:not([data-force-refresh=false])").size() > 0) {
  11916. $("#" + conid + " iframe")[0].contentWindow.$(".btn-refresh:not([data-force-refresh=false])").trigger("click");
  11917. }
  11918. } catch (e) {
  11919. }
  11920. }
  11921. }
  11922. localStorage.setItem("addtabs", $(this).prop('outerHTML'));
  11923. //激活TAB
  11924. tabitem.addClass('active');
  11925. conitem.addClass("active");
  11926. _drop();
  11927. };
  11928. var _close = function (id) {
  11929. var tabid = 'tab_' + id;
  11930. var conid = 'con_' + id;
  11931. var tabitem = $('#' + tabid, navobj);
  11932. var conitem = $('#' + conid, tabobj);
  11933. //如果关闭的是当前激活的TAB,激活他的前一个TAB
  11934. if (obj.find("li.active").not('.tabdrop').attr('id') === tabid) {
  11935. var prev = tabitem.prev().not(".tabdrop");
  11936. var next = tabitem.next().not(".tabdrop");
  11937. if (prev.size() > 0) {
  11938. prev.find('a').trigger("click");
  11939. } else if (next.size() > 0) {
  11940. next.find('a').trigger("click");
  11941. } else {
  11942. $(">li:not(.tabdrop):last > a", navobj).trigger('click');
  11943. }
  11944. }
  11945. //关闭TAB
  11946. tabitem.remove();
  11947. conitem.remove();
  11948. _drop();
  11949. options.callback();
  11950. };
  11951. var _drop = function () {
  11952. navobj.refreshAddtabs();
  11953. };
  11954. };
  11955. //刷新Addtabs
  11956. $.fn.refreshAddtabs = function () {
  11957. var navobj = $(this);
  11958. var dropdown = $(".tabdrop", navobj);
  11959. if (dropdown.size() === 0) {
  11960. dropdown = $('<li class="dropdown pull-right hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;">' +
  11961. '<i class="glyphicon glyphicon-align-justify"></i>' +
  11962. ' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>');
  11963. dropdown.prependTo(navobj);
  11964. }
  11965. //检测是否有下拉样式
  11966. if (navobj.parent().is('.tabs-below')) {
  11967. dropdown.addClass('dropup');
  11968. }
  11969. var collection = 0;
  11970. var maxwidth = navobj.width() - 65;
  11971. var liwidth = 0;
  11972. //检查超过一行的标签页
  11973. var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop');
  11974. var totalwidth = 0;
  11975. litabs.each(function () {
  11976. totalwidth += $(this).outerWidth(true);
  11977. });
  11978. if (navobj.width() < totalwidth) {
  11979. litabs.each(function () {
  11980. liwidth += $(this).outerWidth(true);
  11981. if (liwidth > maxwidth) {
  11982. dropdown.find('ul').append($(this));
  11983. collection++;
  11984. }
  11985. });
  11986. if (collection > 0) {
  11987. dropdown.removeClass('hide');
  11988. if (dropdown.find('.active').length === 1) {
  11989. dropdown.addClass('active');
  11990. } else {
  11991. dropdown.removeClass('active');
  11992. }
  11993. }
  11994. } else {
  11995. dropdown.addClass('hide');
  11996. }
  11997. };
  11998. })(jQuery);
  11999. define("addtabs", function(){});
  12000. /**
  12001. * @summary SelectPage
  12002. * @desc Simple and powerful selection plugin
  12003. * @file selectpage.js
  12004. * @version 2.20
  12005. * @author TerryZeng
  12006. * @contact https://terryz.github.io/
  12007. * @license MIT License
  12008. *
  12009. */
  12010. ;(function ($) {
  12011. "use strict";
  12012. /**
  12013. * Default options
  12014. */
  12015. var defaults = {
  12016. /**
  12017. * Data source
  12018. * @type {string|Object}
  12019. *
  12020. * string:server side request url address
  12021. * Object:JSON array,format:[{a:1,b:2,c:3},{...}]
  12022. */
  12023. data: undefined,
  12024. /**
  12025. * Language ('cn', 'en')
  12026. * @type string
  12027. * @default 'cn'
  12028. */
  12029. lang: 'cn',
  12030. /**
  12031. * Multiple select mode(tags)
  12032. * @type boolean
  12033. * @default false
  12034. */
  12035. multiple: false,
  12036. /**
  12037. * pagination or not
  12038. * @type boolean
  12039. * @default true
  12040. */
  12041. pagination: true,
  12042. /**
  12043. * Show up menu button
  12044. * @type boolean
  12045. * @default true
  12046. */
  12047. dropButton: true,
  12048. /**
  12049. * Result list visible size in pagination bar close
  12050. * @type number
  12051. * @default 10
  12052. */
  12053. listSize: 10,
  12054. /**
  12055. * Show control bar in multiple select mode
  12056. * @type boolean
  12057. * @default true
  12058. */
  12059. multipleControlbar: true,
  12060. /**
  12061. * Max selected item limited in multiple select mode
  12062. * @type number
  12063. * @default 0(unlimited)
  12064. */
  12065. maxSelectLimit: 0,
  12066. /**
  12067. * Select result item to close list, work on multiple select mode
  12068. * @type boolean
  12069. * @default false
  12070. */
  12071. selectToCloseList: false,
  12072. /**
  12073. * Init selected item key, the result will match to option.keyField option
  12074. * @type string
  12075. */
  12076. initRecord: undefined,
  12077. /**
  12078. * The table parameter in server side mode
  12079. * @type string
  12080. */
  12081. dbTable: 'tbl',
  12082. /**
  12083. * The value field, the value will fill to hidden element
  12084. * @type string
  12085. * @default 'id'
  12086. */
  12087. keyField: 'id',
  12088. /**
  12089. * The show text field, the text will show to input element or tags(multiple mode)
  12090. * @type string
  12091. * @default 'name'
  12092. */
  12093. showField: 'name',
  12094. /**
  12095. * Actually used to search field
  12096. * @type string
  12097. */
  12098. searchField: undefined,
  12099. /**
  12100. * Search type ('AND' or 'OR')
  12101. * @type string
  12102. * @default 'AND'
  12103. */
  12104. andOr: 'OR',
  12105. /**
  12106. * Used to separate search content
  12107. * @see SelectPage.prototype.suggest()
  12108. */
  12109. separator: ',',
  12110. /**
  12111. * Result sort type
  12112. * @type array|boolean - if not set, will default used showField field
  12113. * @example
  12114. * orderBy : ['id desc']
  12115. */
  12116. orderBy: undefined,
  12117. /**
  12118. * Page size
  12119. * @type number
  12120. * @default 10
  12121. */
  12122. pageSize: 10,
  12123. /**
  12124. * Server side request parameters
  12125. * @type function
  12126. * @return object
  12127. * @example params : function(){return {'name':'aa','sex':1};}
  12128. */
  12129. params: undefined,
  12130. /**
  12131. * Custom result list item show text
  12132. * @type function
  12133. * @param data {object} row data
  12134. * @return string
  12135. */
  12136. formatItem: undefined,
  12137. /**
  12138. * Have some highlight item and lost focus, auto select the highlight item
  12139. * @type boolean
  12140. * @default false
  12141. */
  12142. autoFillResult: false,
  12143. /**
  12144. * Auto select first item in show up result list or search result
  12145. * depend on `autoFillResult` option set to true
  12146. * @type boolean
  12147. * @default false
  12148. */
  12149. autoSelectFirst: false,
  12150. /**
  12151. * Whether clear input element text when enter some keywords to search and no result return
  12152. * @type boolean
  12153. * @default true
  12154. */
  12155. noResultClean: true,
  12156. /**
  12157. * Select only mode
  12158. * @type boolean
  12159. */
  12160. selectOnly: false,
  12161. /**
  12162. * Input to search delay time, work on ajax data source
  12163. * @type number
  12164. * @default 0.5
  12165. */
  12166. inputDelay: 0.5,
  12167. /**
  12168. * -----------------------------------------Callback--------------------------------------------
  12169. */
  12170. /**
  12171. * Result list item selected callback
  12172. * @type function
  12173. * @param object - selected item json data
  12174. * @param self - plugin object
  12175. */
  12176. eSelect: undefined,
  12177. /**
  12178. * Before result list show up callback, you can do anything prepared
  12179. * @param self - plugin object
  12180. */
  12181. eOpen: undefined,
  12182. /**
  12183. * Server side return data convert callback
  12184. * @type function
  12185. * @param data {object} server side return data
  12186. * @param self {object} plugin object
  12187. * @return {object} return data format:
  12188. * @example
  12189. * {
  12190. * list : [{name:'aa',sex:1},{name:'bb',sex:1}...],
  12191. * totalRow : 100
  12192. * }
  12193. */
  12194. eAjaxSuccess: undefined,
  12195. /**
  12196. * Close selected item tag callback (multiple mode)
  12197. * @type function
  12198. * @param removeCount {number} remove item count
  12199. * @param self {object} plugin object
  12200. */
  12201. eTagRemove: undefined,
  12202. /**
  12203. * Clear selected item callback(single select mode)
  12204. * @type function
  12205. * @param self {object} plugin object
  12206. */
  12207. eClear: undefined
  12208. };
  12209. /**
  12210. * SelectPage class definition
  12211. * @constructor
  12212. * @param {Object} input - input element
  12213. * @param {Object} option
  12214. */
  12215. var SelectPage = function (input, option) {
  12216. //特殊字段处理
  12217. $.each({data: 'source', keyField: 'primaryKey', showField: 'field', pageSize: 'perPage'}, function (i, j) {
  12218. if (typeof option[j] !== 'undefined') {
  12219. option[i] = option[j];
  12220. delete option[j];
  12221. }
  12222. });
  12223. this.setOption(option);
  12224. this.setLanguage();
  12225. this.setCssClass();
  12226. this.setProp();
  12227. this.setElem(input);
  12228. this.setButtonAttrDefault();
  12229. this.setInitRecord();
  12230. this.eDropdownButton();
  12231. this.eInput();
  12232. this.eWhole();
  12233. };
  12234. /**
  12235. * Plugin version number
  12236. */
  12237. SelectPage.version = '2.19';
  12238. /**
  12239. * Plugin object cache key
  12240. */
  12241. SelectPage.dataKey = 'selectPageObject';
  12242. /**
  12243. * Options set
  12244. * @param {Object} option
  12245. */
  12246. SelectPage.prototype.setOption = function (option) {
  12247. //use showField to default
  12248. option.searchField = option.searchField || option.showField;
  12249. option.andOr = option.andOr.toUpperCase();
  12250. if (option.andOr !== 'AND' && option.andOr !== 'OR') option.andOr = 'AND';
  12251. //support multiple field set
  12252. var arr = ['searchField'];
  12253. for (var i = 0; i < arr.length; i++) {
  12254. option[arr[i]] = this.strToArray(option[arr[i]]);
  12255. }
  12256. //set default order field
  12257. option.orderBy = option.orderBy || option.showField;
  12258. //set multiple order field
  12259. //example: [ ['id', 'ASC'], ['name', 'DESC'] ]
  12260. if (option.orderBy !== false) option.orderBy = this.setOrderbyOption(option.orderBy, option.showField);
  12261. //close auto fill result and auto select first in multiple mode and select item not close list
  12262. if (option.multiple && !option.selectToCloseList) {
  12263. option.autoFillResult = false;
  12264. option.autoSelectFirst = false;
  12265. }
  12266. //show all item when pagination bar close, limited 200
  12267. if (!option.pagination) option.pageSize = 200;
  12268. if ($.type(option.listSize) !== 'number' || option.listSize < 0) option.listSize = 10;
  12269. if (typeof option.formatItem === 'string') {
  12270. var _formatItem = option.formatItem;
  12271. option.formatItem = function (row) {
  12272. if (typeof Template === 'function' && _formatItem.match(/\#([a-zA-Z0-9_\-]+)$/)) {
  12273. return Template(_formatItem.substring(1), row);
  12274. } else {
  12275. return _formatItem.replace(/\{(.*?)\}/gi, function (matched) {
  12276. matched = matched.substring(1, matched.length - 1);
  12277. return typeof row[matched] !== 'undefined' ? row[matched] : '';
  12278. });
  12279. }
  12280. };
  12281. }
  12282. this.option = option;
  12283. };
  12284. /**
  12285. * String convert to array
  12286. * @param str {string}
  12287. * @return {Array}
  12288. */
  12289. SelectPage.prototype.strToArray = function (str) {
  12290. return str ? str.replace(/[\s ]+/g, '').split(',') : '';
  12291. };
  12292. /**
  12293. * Set order field
  12294. * @param {Array} arg_order
  12295. * @param {string} arg_field - default sort field
  12296. * @return {Array}
  12297. */
  12298. SelectPage.prototype.setOrderbyOption = function (arg_order, arg_field) {
  12299. var arr = [], orders = [];
  12300. if (typeof arg_order === 'object') {
  12301. for (var i = 0; i < arg_order.length; i++) {
  12302. orders = $.trim(arg_order[i]).split(' ');
  12303. if (orders.length)
  12304. arr.push((orders.length === 2) ? orders.concat() : [orders[0], 'ASC']);
  12305. }
  12306. } else {
  12307. orders = $.trim(arg_order).split(' ');
  12308. arr[0] = (orders.length === 2) ? orders.concat() : (orders[0].toUpperCase().match(/^(ASC|DESC)$/i)) ? [arg_field, orders[0].toUpperCase()] : [orders[0], 'ASC'];
  12309. }
  12310. return arr;
  12311. };
  12312. /**
  12313. * i18n
  12314. */
  12315. SelectPage.prototype.setLanguage = function () {
  12316. var message, p = this.option;
  12317. switch (p.lang) {
  12318. // English
  12319. case 'en':
  12320. message = {
  12321. add_btn: 'Add button',
  12322. add_title: 'add a box',
  12323. del_btn: 'Del button',
  12324. del_title: 'delete a box',
  12325. next: 'Next',
  12326. next_title: 'Next' + p.pageSize + ' (Right key)',
  12327. prev: 'Prev',
  12328. prev_title: 'Prev' + p.pageSize + ' (Left key)',
  12329. first_title: 'First (Shift + Left key)',
  12330. last_title: 'Last (Shift + Right key)',
  12331. get_all_btn: 'Get All (Down key)',
  12332. get_all_alt: '(button)',
  12333. close_btn: 'Close (Tab key)',
  12334. close_alt: '(button)',
  12335. loading: 'loading...',
  12336. loading_alt: '(loading)',
  12337. page_info: 'page_num of page_count',
  12338. select_ng: 'Attention : Please choose from among the list.',
  12339. select_ok: 'OK : Correctly selected.',
  12340. not_found: 'not found',
  12341. ajax_error: 'An error occurred while connecting to server.',
  12342. clear: 'Clear content',
  12343. select_all: 'Select current page',
  12344. unselect_all: 'Clear current page',
  12345. clear_all: 'Clear all selected',
  12346. max_selected: 'You can only select up to max_selected_limit items'
  12347. };
  12348. break;
  12349. // 中文
  12350. case 'cn':
  12351. default:
  12352. message = {
  12353. add_btn: '添加按钮',
  12354. add_title: '添加区域',
  12355. del_btn: '删除按钮',
  12356. del_title: '删除区域',
  12357. next: '下一页',
  12358. next_title: '下' + p.pageSize + ' (→)',
  12359. prev: '上一页',
  12360. prev_title: '上' + p.pageSize + ' (←)',
  12361. first_title: '首页 (Shift + ←)',
  12362. last_title: '尾页 (Shift + →)',
  12363. get_all_btn: '获得全部 (↓)',
  12364. get_all_alt: '(按钮)',
  12365. close_btn: '关闭 (Tab键)',
  12366. close_alt: '(按钮)',
  12367. loading: '读取中...',
  12368. loading_alt: '(读取中)',
  12369. page_info: '第 page_num 页(共page_count页)',
  12370. select_ng: '请注意:请从列表中选择.',
  12371. select_ok: 'OK : 已经选择.',
  12372. not_found: '无查询结果',
  12373. ajax_error: '连接到服务器时发生错误!',
  12374. clear: '清除内容',
  12375. select_all: '选择当前页项目',
  12376. unselect_all: '取消选择当前页项目',
  12377. clear_all: '清除全部已选择项目',
  12378. max_selected: '最多只能选择 max_selected_limit 个项目'
  12379. };
  12380. break;
  12381. }
  12382. this.message = message;
  12383. };
  12384. /**
  12385. * Css classname defined
  12386. */
  12387. SelectPage.prototype.setCssClass = function () {
  12388. var css_class = {
  12389. container: 'sp_container',
  12390. container_open: 'sp_container_open',
  12391. re_area: 'sp_result_area',
  12392. result_open: 'sp_result_area_open',
  12393. control_box: 'sp_control_box',
  12394. //multiple select mode
  12395. element_box: 'sp_element_box',
  12396. navi: 'sp_navi',
  12397. //result list
  12398. results: 'sp_results',
  12399. re_off: 'sp_results_off',
  12400. select: 'sp_over',
  12401. select_ok: 'sp_select_ok',
  12402. select_ng: 'sp_select_ng',
  12403. selected: 'sp_selected',
  12404. input_off: 'sp_input_off',
  12405. message_box: 'sp_message_box',
  12406. disabled: 'sp_disabled',
  12407. button: 'sp_button',
  12408. caret_open: 'sp_caret_open',
  12409. btn_on: 'sp_btn_on',
  12410. btn_out: 'sp_btn_out',
  12411. input: 'sp_input',
  12412. clear_btn: 'sp_clear_btn',
  12413. align_right: 'sp_align_right'
  12414. };
  12415. this.css_class = css_class;
  12416. };
  12417. /**
  12418. * Plugin inner properties
  12419. */
  12420. SelectPage.prototype.setProp = function () {
  12421. this.prop = {
  12422. //input disabled status
  12423. disabled: false,
  12424. current_page: 1,
  12425. //total page
  12426. max_page: 1,
  12427. //ajax data loading status
  12428. is_loading: false,
  12429. xhr: false,
  12430. key_paging: false,
  12431. key_select: false,
  12432. //last selected item value
  12433. prev_value: '',
  12434. //last selected item text
  12435. selected_text: '',
  12436. last_input_time: undefined,
  12437. init_set: false
  12438. };
  12439. this.template = {
  12440. tag: {
  12441. content: '<li class="selected_tag" itemvalue="#item_value#">#item_text#<span class="tag_close"><i class="spfont sp-close"></i></span></li>',
  12442. textKey: '#item_text#',
  12443. valueKey: '#item_value#'
  12444. },
  12445. page: {
  12446. current: 'page_num',
  12447. total: 'page_count'
  12448. },
  12449. msg: {
  12450. maxSelectLimit: 'max_selected_limit'
  12451. }
  12452. };
  12453. };
  12454. /**
  12455. * Get the actual width/height of invisible DOM elements with jQuery.
  12456. * Source code come from dreamerslab/jquery.actual
  12457. * @param element
  12458. * @param method
  12459. * @returns {*}
  12460. */
  12461. SelectPage.prototype.elementRealSize = function (element, method) {
  12462. var defaults = {
  12463. absolute: false,
  12464. clone: false,
  12465. includeMargin: false,
  12466. display: 'block'
  12467. };
  12468. var configs = defaults, $target = element.eq(0), fix, restore, tmp = [], style = '', $hidden;
  12469. fix = function () {
  12470. // get all hidden parents
  12471. $hidden = $target.parents().addBack().filter(':hidden');
  12472. style += 'visibility: hidden !important; display: ' + configs.display + ' !important; ';
  12473. if (configs.absolute === true) style += 'position: absolute !important;';
  12474. // save the origin style props
  12475. // set the hidden el css to be got the actual value later
  12476. $hidden.each(function () {
  12477. // Save original style. If no style was set, attr() returns undefined
  12478. var $this = $(this), thisStyle = $this.attr('style');
  12479. tmp.push(thisStyle);
  12480. // Retain as much of the original style as possible, if there is one
  12481. $this.attr('style', thisStyle ? thisStyle + ';' + style : style);
  12482. });
  12483. };
  12484. restore = function () {
  12485. // restore origin style values
  12486. $hidden.each(function (i) {
  12487. var $this = $(this), _tmp = tmp[i];
  12488. if (_tmp === undefined) $this.removeAttr('style');
  12489. else $this.attr('style', _tmp);
  12490. });
  12491. };
  12492. fix();
  12493. // get the actual value with user specific methed
  12494. // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc
  12495. // configs.includeMargin only works for 'outerWidth' and 'outerHeight'
  12496. var actual = /(outer)/.test(method) ?
  12497. $target[method](configs.includeMargin) :
  12498. $target[method]();
  12499. restore();
  12500. // IMPORTANT, this plugin only return the value of the first element
  12501. return actual;
  12502. };
  12503. /**
  12504. * Dom building
  12505. * @param {Object} combo_input - original input element
  12506. */
  12507. SelectPage.prototype.setElem = function (combo_input) {
  12508. // 1. build Dom object
  12509. var elem = {}, p = this.option, css = this.css_class, msg = this.message, input = $(combo_input);
  12510. var cssWidth = input.css("width");
  12511. var orgWidth = input.outerWidth();
  12512. if (cssWidth.indexOf("%") > -1 || input.parent().size() > 0 && input.parent().width() == orgWidth) {
  12513. orgWidth = "100%";
  12514. } else {
  12515. // fix input width in hidden situation
  12516. if (orgWidth <= 0) orgWidth = this.elementRealSize(input, 'outerWidth');
  12517. if (orgWidth < 150) orgWidth = 150;
  12518. }
  12519. elem.combo_input = input.attr({'autocomplete': 'off'}).addClass(css.input).wrap('<div>');
  12520. if (p.selectOnly) elem.combo_input.prop('readonly', true);
  12521. elem.container = elem.combo_input.parent().addClass(css.container);
  12522. if (elem.combo_input.prop('disabled')) {
  12523. if (p.multiple) elem.container.addClass(css.disabled);
  12524. else elem.combo_input.addClass(css.input_off);
  12525. }
  12526. // set outer box width
  12527. elem.container.width(orgWidth);
  12528. elem.button = $('<div>').addClass(css.button);
  12529. //drop down button
  12530. elem.dropdown = $('<span class="sp_caret"></span>');
  12531. //clear button 'X' in single mode
  12532. elem.clear_btn = $('<div>').html($('<i>').addClass('spfont sp-close')).addClass(css.clear_btn).attr('title', msg.clear);
  12533. if (!p.dropButton) elem.clear_btn.addClass(css.align_right);
  12534. //main box in multiple mode
  12535. elem.element_box = $('<ul>').addClass(css.element_box);
  12536. if (p.multiple && p.multipleControlbar)
  12537. elem.control = $('<div>').addClass(css.control_box);
  12538. //result list box
  12539. elem.result_area = $('<div>').addClass(css.re_area);
  12540. //pagination bar
  12541. if (p.pagination) elem.navi = $('<div>').addClass('sp_pagination').append('<ul>');
  12542. elem.results = $('<ul>').addClass(css.results);
  12543. var namePrefix = '_text',
  12544. input_id = elem.combo_input.attr('id') || elem.combo_input.attr('name'),
  12545. input_name = elem.combo_input.attr('name') || 'selectPage',
  12546. hidden_name = input_name,
  12547. hidden_id = input_id;
  12548. //switch the id and name attributes of input/hidden element
  12549. elem.hidden = $('<input type="hidden" class="sp_hidden" />').attr({
  12550. name: hidden_name,
  12551. id: hidden_id
  12552. }).val('');
  12553. elem.combo_input.attr({
  12554. name: typeof input.data('name') !== 'undefined' ? input.data('name') : input_name + namePrefix,
  12555. id: input_id + namePrefix
  12556. });
  12557. elem.hidden.attr("data-rule", elem.combo_input.data("rule") || '');
  12558. elem.combo_input.attr("novalidate", "novalidate");
  12559. // 2. DOM element put
  12560. elem.container.append(elem.hidden);
  12561. if (p.dropButton) {
  12562. elem.container.append(elem.button)
  12563. elem.button.append(elem.dropdown);
  12564. }
  12565. $(document.body).append(elem.result_area);
  12566. elem.result_area.append(elem.results);
  12567. if (p.pagination) elem.result_area.append(elem.navi);
  12568. //Multiple select mode
  12569. if (p.multiple) {
  12570. if (p.multipleControlbar) {
  12571. elem.control.append('<button type="button" class="btn btn-default sp_clear_all" ><i class="spfont sp-clear"></i></button>');
  12572. elem.control.append('<button type="button" class="btn btn-default sp_unselect_all" ><i class="spfont sp-unselect-all"></i></button>');
  12573. elem.control.append('<button type="button" class="btn btn-default sp_select_all" ><i class="spfont sp-select-all"></i></button>');
  12574. elem.control_text = $('<p>');
  12575. elem.control.append(elem.control_text);
  12576. elem.result_area.prepend(elem.control);
  12577. }
  12578. elem.container.addClass('sp_container_combo');
  12579. elem.combo_input.addClass('sp_combo_input').before(elem.element_box);
  12580. var li = $('<li>').addClass('input_box');
  12581. li.append(elem.combo_input);
  12582. elem.element_box.append(li);
  12583. if (elem.combo_input.attr('placeholder')) elem.combo_input.attr('placeholder_bak', elem.combo_input.attr('placeholder'));
  12584. }
  12585. this.elem = elem;
  12586. };
  12587. /**
  12588. * Drop down button set to default
  12589. */
  12590. SelectPage.prototype.setButtonAttrDefault = function () {
  12591. /*
  12592. if (this.option.selectOnly) {
  12593. if ($(this.elem.combo_input).val() !== '') {
  12594. if ($(this.elem.hidden).val() !== '') {
  12595. //选择条件
  12596. $(this.elem.combo_input).attr('title', this.message.select_ok).removeClass(this.css_class.select_ng).addClass(this.css_class.select_ok);
  12597. } else {
  12598. //输入方式
  12599. $(this.elem.combo_input).attr('title', this.message.select_ng).removeClass(this.css_class.select_ok).addClass(this.css_class.select_ng);
  12600. }
  12601. } else {
  12602. $(this.elem.hidden).val('');
  12603. $(this.elem.combo_input).removeAttr('title').removeClass(this.css_class.select_ng);
  12604. }
  12605. }
  12606. */
  12607. //this.elem.button.attr('title', this.message.get_all_btn);
  12608. if (this.option.dropButton)
  12609. this.elem.button.attr('title', this.message.close_btn);
  12610. };
  12611. /**
  12612. * Set item need selected after init
  12613. * set selected item ways:
  12614. * <input value="key">
  12615. * <input data-init="key">
  12616. */
  12617. SelectPage.prototype.setInitRecord = function (refresh) {
  12618. var self = this, p = self.option, el = self.elem, key = '';
  12619. if ($.type(el.combo_input.data('init')) != 'undefined')
  12620. p.initRecord = String(el.combo_input.data('init'));
  12621. //data-init and value attribute can be init plugin selected item
  12622. //but, if set data-init and value attribute in the same time, plugin will choose data-init attribute first
  12623. if (!refresh && !p.initRecord && el.combo_input.val())
  12624. p.initRecord = el.combo_input.val();
  12625. el.combo_input.val('');
  12626. if (!refresh) el.hidden.val(p.initRecord);
  12627. key = refresh && el.hidden.val() ? el.hidden.val() : p.initRecord;
  12628. if (key) {
  12629. if (typeof p.data === 'object') {
  12630. var data = new Array();
  12631. var keyarr = key.split(',');
  12632. $.each(keyarr, function (index, row) {
  12633. for (var i = 0; i < p.data.length; i++) {
  12634. if (p.data[i][p.keyField] == row) {
  12635. data.push(p.data[i]);
  12636. break;
  12637. }
  12638. }
  12639. });
  12640. if (!p.multiple && data.length > 1) data = [data[0]];
  12641. self.afterInit(self, data);
  12642. } else {//ajax data source mode to init selected item
  12643. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  12644. var _orgParams = {
  12645. searchTable: p.dbTable,
  12646. searchKey: p.keyField,
  12647. searchValue: key,
  12648. orderBy: p.orderBy,
  12649. showField: p.showField,
  12650. keyField: p.keyField,
  12651. keyValue: key,
  12652. searchField: p.searchField
  12653. };
  12654. if (_paramsFunc) {
  12655. var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
  12656. if (result && $.isPlainObject(result)) {
  12657. _params = $.extend({}, _orgParams, result);
  12658. } else {
  12659. _params = _orgParams;
  12660. }
  12661. } else {
  12662. _params = _orgParams;
  12663. }
  12664. $.ajax({
  12665. dataType: 'json',
  12666. type: 'POST',
  12667. url: p.data,
  12668. data: _params,
  12669. success: function (json) {
  12670. var d = null;
  12671. if (p.eAjaxSuccess && $.isFunction(p.eAjaxSuccess))
  12672. d = p.eAjaxSuccess(json);
  12673. self.afterInit(self, d.list);
  12674. },
  12675. error: function (jqXHR, textStatus, errorThrown) {
  12676. self.ajaxErrorNotify(self, errorThrown);
  12677. }
  12678. });
  12679. }
  12680. }
  12681. };
  12682. /**
  12683. * Selected item set to plugin
  12684. * @param {Object} self
  12685. * @param {Object} data - selected item data
  12686. */
  12687. SelectPage.prototype.afterInit = function (self, data) {
  12688. if (!data || ($.isArray(data) && data.length === 0)) return;
  12689. if (!$.isArray(data)) data = [data];
  12690. var p = self.option, css = self.css_class;
  12691. self.data = data;
  12692. if (p.multiple) {
  12693. self.prop.init_set = true;
  12694. self.clearAll(self);
  12695. $.each(data, function (i, row) {
  12696. var value = row[p.keyField];
  12697. var text = row[p.showField];
  12698. var item = {text: text, value: value};
  12699. if (!self.isAlreadySelected(self, item)) self.addNewTag(self, row, item);
  12700. });
  12701. self.tagValuesSet(self);
  12702. self.inputResize(self);
  12703. self.elem.hidden.blur();
  12704. self.prop.init_set = false;
  12705. } else {
  12706. var row = data[0];
  12707. var value = row[p.keyField];
  12708. var text = row[p.showField];
  12709. self.elem.combo_input.val(text);
  12710. self.elem.hidden.val(value);
  12711. self.prop.prev_value = text;
  12712. self.prop.selected_text = text;
  12713. if (p.selectOnly) {
  12714. self.elem.combo_input.attr('title', self.message.select_ok).removeClass(css.select_ng).addClass(css.select_ok);
  12715. }
  12716. self.putClearButton();
  12717. }
  12718. };
  12719. /**
  12720. * Drop down button event bind
  12721. */
  12722. SelectPage.prototype.eDropdownButton = function () {
  12723. var self = this;
  12724. if (self.option.dropButton) {
  12725. self.elem.button.mouseup(function (ev) {
  12726. ev.stopPropagation();
  12727. if (self.elem.result_area.is(':hidden') && !self.elem.combo_input.prop('disabled')) {
  12728. self.elem.combo_input.focus();
  12729. } else self.hideResults(self);
  12730. });
  12731. }
  12732. };
  12733. /**
  12734. * Events bind
  12735. */
  12736. SelectPage.prototype.eInput = function () {
  12737. var self = this, p = self.option, el = self.elem, msg = self.message;
  12738. var showList = function () {
  12739. self.prop.page_move = false;
  12740. self.suggest(self);
  12741. self.setCssFocusedInput(self);
  12742. };
  12743. el.combo_input.keyup(function (e) {
  12744. self.processKey(self, e);
  12745. }).keydown(function (e) {
  12746. self.processControl(self, e);
  12747. }).focus(function (e) {
  12748. //When focus on input, show the result list
  12749. if (el.result_area.is(':hidden')) {
  12750. e.stopPropagation();
  12751. self.prop.first_show = true;
  12752. showList();
  12753. }
  12754. });
  12755. el.container.on('click.SelectPage', 'div.' + self.css_class.clear_btn, function (e) {
  12756. e.stopPropagation();
  12757. if (!self.disabled(self)) {
  12758. self.clearAll(self, true);
  12759. self.elem.hidden.change();
  12760. if (p.eClear && $.isFunction(p.eClear)) p.eClear(self);
  12761. }
  12762. });
  12763. el.result_area.on('mousedown.SelectPage', function (e) {
  12764. e.stopPropagation();
  12765. });
  12766. if (p.multiple) {
  12767. if (p.multipleControlbar) {
  12768. //Select all item of current page
  12769. el.control.find('.sp_select_all').on('click.SelectPage', function (e) {
  12770. self.selectAllLine(self);
  12771. }).hover(function () {
  12772. el.control_text.html(msg.select_all);
  12773. }, function () {
  12774. el.control_text.html('');
  12775. });
  12776. //Cancel select all item of current page
  12777. el.control.find('.sp_unselect_all').on('click.SelectPage', function (e) {
  12778. self.unSelectAllLine(self);
  12779. }).hover(function () {
  12780. el.control_text.html(msg.unselect_all);
  12781. }, function () {
  12782. el.control_text.html('');
  12783. });
  12784. //Clear all selected item
  12785. el.control.find('.sp_clear_all').on('click.SelectPage', function (e) {
  12786. self.clearAll(self, true);
  12787. }).hover(function () {
  12788. el.control_text.html(msg.clear_all);
  12789. }, function () {
  12790. el.control_text.html('');
  12791. });
  12792. }
  12793. el.element_box.on('click.SelectPage', function (e) {
  12794. var srcEl = e.target || e.srcElement;
  12795. if ($(srcEl).is('ul')) el.combo_input.focus();
  12796. });
  12797. //Tag close
  12798. el.element_box.on('click.SelectPage', 'span.tag_close', function () {
  12799. var li = $(this).closest('li'), data = li.data('dataObj');
  12800. self.removeTag(self, li);
  12801. showList();
  12802. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove([data]);
  12803. });
  12804. self.inputResize(self);
  12805. }
  12806. };
  12807. /**
  12808. * Out of plugin area click event handler
  12809. */
  12810. SelectPage.prototype.eWhole = function () {
  12811. var self = this, css = self.css_class;
  12812. var cleanContent = function (obj) {
  12813. obj.elem.combo_input.val('');
  12814. if (!obj.option.multiple) obj.elem.hidden.val('');
  12815. obj.prop.selected_text = '';
  12816. };
  12817. //Out of plugin area
  12818. $(document.body).off('mousedown.selectPage').on('mousedown.selectPage', function (e) {
  12819. var ele = e.target || e.srcElement;
  12820. var sp = $(ele).closest('div.' + css.container);
  12821. //Open status result list
  12822. $('div.' + css.container + '.' + css.container_open).each(function () {
  12823. if (this == sp[0]) return;
  12824. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey);
  12825. if (!d.elem.combo_input.val() && d.elem.hidden.val() && !d.option.multiple) {
  12826. d.prop.current_page = 1;//reset page to 1
  12827. cleanContent(d);
  12828. d.hideResults(d);
  12829. return true;
  12830. }
  12831. if (d.elem.results.find('li').not('.' + css.message_box).length) {
  12832. if (d.option.autoFillResult) {
  12833. //have selected item, then hide result list
  12834. if (d.elem.hidden.val()) d.hideResults(d);
  12835. else if (d.elem.results.find('li.sp_over').length) {
  12836. //no one selected and have highlight item, select the highlight item
  12837. d.selectCurrentLine(d, true);
  12838. } else if (d.option.autoSelectFirst) {
  12839. //no one selected, no one highlight, select the first item
  12840. d.nextLine(d);
  12841. d.selectCurrentLine(d, true);
  12842. } else d.hideResults(d);
  12843. } else d.hideResults(d);
  12844. } else {
  12845. //when no one item match, clear search keywords
  12846. if (d.option.noResultClean) cleanContent(d);
  12847. else {
  12848. if (!d.option.multiple) d.elem.hidden.val('');
  12849. }
  12850. d.hideResults(d);
  12851. }
  12852. });
  12853. });
  12854. };
  12855. /**
  12856. * Result list event bind
  12857. */
  12858. SelectPage.prototype.eResultList = function () {
  12859. var self = this, css = this.css_class;
  12860. self.elem.results.children('li').hover(function () {
  12861. if (self.prop.key_select) {
  12862. self.prop.key_select = false;
  12863. return;
  12864. }
  12865. if (!$(this).hasClass(css.selected) && !$(this).hasClass(css.message_box)) {
  12866. $(this).addClass(css.select);
  12867. self.setCssFocusedResults(self);
  12868. }
  12869. }, function () {
  12870. $(this).removeClass(css.select);
  12871. }).click(function (e) {
  12872. if (self.prop.key_select) {
  12873. self.prop.key_select = false;
  12874. return;
  12875. }
  12876. e.preventDefault();
  12877. e.stopPropagation();
  12878. if (!$(this).hasClass(css.selected)) self.selectCurrentLine(self, false);
  12879. });
  12880. };
  12881. /**
  12882. * Reposition result list when list beyond the visible area
  12883. */
  12884. SelectPage.prototype.eScroll = function () {
  12885. var self = this, css = this.css_class;
  12886. $(window).on('scroll.SelectPage', function (e) {
  12887. $('div.' + css.container + '.' + css.container_open).each(function () {
  12888. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey),
  12889. offset = d.elem.result_area.offset(),
  12890. screenScrollTop = $(window).scrollTop(),
  12891. docHeight = $(document).height(),
  12892. viewHeight = $(window).height(),
  12893. listHeight = d.elem.result_area.outerHeight(),
  12894. listBottom = offset.top + listHeight,
  12895. hasOverflow = docHeight > viewHeight,
  12896. down = d.elem.result_area.hasClass('shadowDown');
  12897. if (hasOverflow) {
  12898. if (down) {//open down
  12899. if (listBottom > (viewHeight + screenScrollTop)) d.calcResultsSize(d);
  12900. } else {//open up
  12901. if (offset.top < screenScrollTop) d.calcResultsSize(d);
  12902. }
  12903. }
  12904. });
  12905. });
  12906. };
  12907. /**
  12908. * Page bar button event bind
  12909. */
  12910. SelectPage.prototype.ePaging = function () {
  12911. var self = this;
  12912. if (!self.option.pagination) return;
  12913. self.elem.navi.find('li.csFirstPage').off('click').on('click', function (ev) {
  12914. //$(self.elem.combo_input).focus();
  12915. ev.preventDefault();
  12916. self.firstPage(self);
  12917. });
  12918. self.elem.navi.find('li.csPreviousPage').off('click').on('click', function (ev) {
  12919. //$(self.elem.combo_input).focus();
  12920. ev.preventDefault();
  12921. self.prevPage(self);
  12922. });
  12923. self.elem.navi.find('li.csNextPage').off('click').on('click', function (ev) {
  12924. //$(self.elem.combo_input).focus();
  12925. ev.preventDefault();
  12926. self.nextPage(self);
  12927. });
  12928. self.elem.navi.find('li.csLastPage').off('click').on('click', function (ev) {
  12929. //$(self.elem.combo_input).focus();
  12930. ev.preventDefault();
  12931. self.lastPage(self);
  12932. });
  12933. };
  12934. /**
  12935. * Ajax request fail
  12936. * @param {Object} self
  12937. * @param {string} errorThrown
  12938. */
  12939. SelectPage.prototype.ajaxErrorNotify = function (self, errorThrown) {
  12940. self.showMessage(self.message.ajax_error);
  12941. };
  12942. /**
  12943. * Message box
  12944. * @param {Object} self
  12945. * @param msg {string} the text need to show
  12946. */
  12947. SelectPage.prototype.showMessage = function (self, msg) {
  12948. if (!msg) return;
  12949. var msgLi = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' + msg + '</li>';
  12950. self.elem.results.empty().append(msgLi).show();
  12951. self.calcResultsSize(self);
  12952. self.setOpenStatus(self, true);
  12953. self.elem.control.hide();
  12954. if (self.option.pagination) self.elem.navi.hide();
  12955. };
  12956. /**
  12957. * @desc Scroll
  12958. * @param {Object} self
  12959. * @param {boolean} enforce
  12960. */
  12961. SelectPage.prototype.scrollWindow = function (self, enforce) {
  12962. var current_result = self.getCurrentLine(self),
  12963. target_top = (current_result && !enforce) ? current_result.offset().top : self.elem.container.offset().top,
  12964. target_size;
  12965. self.prop.size_li = self.elem.results.children('li:first').outerHeight();
  12966. target_size = self.prop.size_li;
  12967. var gap, client_height = $(window).height(),
  12968. scroll_top = $(window).scrollTop(),
  12969. scroll_bottom = scroll_top + client_height - target_size;
  12970. if (current_result.length) {
  12971. if (target_top < scroll_top || target_size > client_height) {
  12972. //scroll to top
  12973. gap = target_top - scroll_top;
  12974. } else if (target_top > scroll_bottom) {
  12975. //scroll down
  12976. gap = target_top - scroll_bottom;
  12977. } else return; //do not scroll
  12978. } else if (target_top < scroll_top) gap = target_top - scroll_top;
  12979. window.scrollBy(0, gap);
  12980. };
  12981. /**
  12982. * change css class by status
  12983. * @param self
  12984. * @param status {boolean} true: open, false: close
  12985. */
  12986. SelectPage.prototype.setOpenStatus = function (self, status) {
  12987. var el = self.elem, css = self.css_class;
  12988. if (status) {
  12989. el.container.addClass(css.container_open);
  12990. el.result_area.addClass(css.result_open);
  12991. } else {
  12992. el.container.removeClass(css.container_open);
  12993. el.result_area.removeClass(css.result_open);
  12994. }
  12995. };
  12996. /**
  12997. * input element in focus css class set
  12998. * @param {Object} self
  12999. */
  13000. SelectPage.prototype.setCssFocusedInput = function (self) {
  13001. //$(self.elem.results).addClass(self.css_class.re_off);
  13002. //$(self.elem.combo_input).removeClass(self.css_class.input_off);
  13003. };
  13004. /**
  13005. * set result list get focus and input element lost focus
  13006. * @param {Object} self
  13007. */
  13008. SelectPage.prototype.setCssFocusedResults = function (self) {
  13009. //$(self.elem.results).removeClass(self.css_class.re_off);
  13010. //$(self.elem.combo_input).addClass(self.css_class.input_off);
  13011. };
  13012. /**
  13013. * Quick search input keywords listener
  13014. * @param {Object} self
  13015. */
  13016. SelectPage.prototype.checkValue = function (self) {
  13017. var now_value = self.elem.combo_input.val();
  13018. if (now_value != self.prop.prev_value) {
  13019. self.prop.prev_value = now_value;
  13020. self.prop.first_show = false;
  13021. if (self.option.selectOnly) self.setButtonAttrDefault();
  13022. if (!self.option.multiple && !now_value) {
  13023. self.elem.combo_input.val('');
  13024. self.elem.hidden.val('');
  13025. self.elem.clear_btn.remove();
  13026. }
  13027. self.suggest(self);
  13028. }
  13029. };
  13030. /**
  13031. * Input handle(regular input)
  13032. * @param {Object} self
  13033. * @param {Object} e - event object
  13034. */
  13035. SelectPage.prototype.processKey = function (self, e) {
  13036. if ($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9, 13]) === -1) {
  13037. if (e.keyCode != 16) self.setCssFocusedInput(self); // except Shift(16)
  13038. self.inputResize(self);
  13039. if ($.type(self.option.data) === 'string') {
  13040. self.prop.last_input_time = e.timeStamp;
  13041. setTimeout(function () {
  13042. if ((e.timeStamp - self.prop.last_input_time) === 0)
  13043. self.checkValue(self);
  13044. }, self.option.inputDelay * 1000);
  13045. } else {
  13046. self.checkValue(self);
  13047. }
  13048. }
  13049. }
  13050. /**
  13051. * Input handle(control key)
  13052. * @param {Object} self
  13053. * @param {Object} e - event object
  13054. */
  13055. SelectPage.prototype.processControl = function (self, e) {
  13056. if (($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9]) > -1 && self.elem.result_area.is(':visible')) ||
  13057. ($.inArray(e.keyCode, [13, 9]) > -1 && self.getCurrentLine(self))) {
  13058. e.preventDefault();
  13059. e.stopPropagation();
  13060. e.cancelBubble = true;
  13061. e.returnValue = false;
  13062. switch (e.keyCode) {
  13063. case 37:// left
  13064. if (e.shiftKey) self.firstPage(self);
  13065. else self.prevPage(self);
  13066. break;
  13067. case 38:// up
  13068. self.prop.key_select = true;
  13069. self.prevLine(self);
  13070. break;
  13071. case 39:// right
  13072. if (e.shiftKey) self.lastPage(self);
  13073. else self.nextPage(self);
  13074. break;
  13075. case 40:// down
  13076. if (self.elem.results.children('li').length) {
  13077. self.prop.key_select = true;
  13078. self.nextLine(self);
  13079. } else self.suggest(self);
  13080. break;
  13081. case 9:// tab
  13082. self.prop.key_paging = true;
  13083. self.selectCurrentLine(self, true);
  13084. //self.hideResults(self);
  13085. break;
  13086. case 13:// return
  13087. self.selectCurrentLine(self, true);
  13088. break;
  13089. case 27:// escape
  13090. self.prop.key_paging = true;
  13091. self.hideResults(self);
  13092. break;
  13093. }
  13094. }
  13095. };
  13096. /**
  13097. * Abort Ajax request
  13098. * @param {Object} self
  13099. */
  13100. SelectPage.prototype.abortAjax = function (self) {
  13101. if (self.prop.xhr) {
  13102. self.prop.xhr.abort();
  13103. self.prop.xhr = false;
  13104. }
  13105. };
  13106. /**
  13107. * Suggest result of search keywords
  13108. * @param {Object} self
  13109. */
  13110. SelectPage.prototype.suggest = function (self) {
  13111. var q_word, val = $.trim(self.elem.combo_input.val());
  13112. if (self.option.multiple) q_word = val;
  13113. else {
  13114. if (val && val === self.prop.selected_text) q_word = '';
  13115. else q_word = val;
  13116. }
  13117. q_word = q_word.split(self.option.separator);
  13118. //Before show up result list callback
  13119. if (self.option.eOpen && $.isFunction(self.option.eOpen))
  13120. self.option.eOpen.call(self);
  13121. self.abortAjax(self);
  13122. //self.setLoading(self);
  13123. var which_page_num = self.prop.current_page || 1;
  13124. if (typeof self.option.data == 'object') self.searchForJson(self, q_word, which_page_num);
  13125. else self.searchForDb(self, q_word, which_page_num);
  13126. };
  13127. /**
  13128. * Loading
  13129. * @param {Object} self
  13130. */
  13131. SelectPage.prototype.setLoading = function (self) {
  13132. if (self.elem.results.html() === '') {
  13133. //self.calcResultsSize(self);
  13134. self.setOpenStatus(self, true);
  13135. }
  13136. };
  13137. /**
  13138. * Search for ajax
  13139. * @param {Object} self
  13140. * @param {Array} q_word - query keyword
  13141. * @param {number} which_page_num - target page number
  13142. */
  13143. SelectPage.prototype.searchForDb = function (self, q_word, which_page_num) {
  13144. var p = self.option;
  13145. if (!p.eAjaxSuccess || !$.isFunction(p.eAjaxSuccess)) self.hideResults(self);
  13146. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  13147. //when have new query keyword, then reset page number to 1.
  13148. if (q_word.length && q_word[0] && q_word.join(self.option.separator) !== self.prop.prev_value) which_page_num = 1;
  13149. var _orgParams = {
  13150. q_word: q_word,
  13151. pageNumber: which_page_num,
  13152. pageSize: p.pageSize,
  13153. andOr: p.andOr,
  13154. orderBy: p.orderBy,
  13155. searchTable: p.dbTable,
  13156. showField: self.option.showField,
  13157. keyField: self.option.keyField,
  13158. searchField: self.option.searchField
  13159. };
  13160. if (p.orderBy !== false) _orgParams.orderBy = p.orderBy;
  13161. // 这个应该是历史遗留了,没仔细追逻辑,先留着。
  13162. _orgParams[searchKey] = q_word[0];
  13163. if (_paramsFunc) {
  13164. var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
  13165. if (result && $.isPlainObject(result)) {
  13166. _params = $.extend({}, _orgParams, result);
  13167. } else {
  13168. _params = _orgParams;
  13169. }
  13170. } else {
  13171. _params = _orgParams;
  13172. }
  13173. self.prop.xhr = $.ajax({
  13174. dataType: 'json',
  13175. url: p.data,
  13176. type: 'POST',
  13177. data: _params,
  13178. success: function (returnData) {
  13179. if (!returnData || !$.isPlainObject(returnData)) {
  13180. self.hideResults(self);
  13181. self.ajaxErrorNotify(self, errorThrown);
  13182. return;
  13183. }
  13184. var data = {}, json = {};
  13185. try {
  13186. data = p.eAjaxSuccess(returnData);
  13187. json.originalResult = data.list;
  13188. json.cnt_whole = data.totalRow;
  13189. } catch (e) {
  13190. self.showMessage(self, self.message.ajax_error);
  13191. return;
  13192. }
  13193. if (self.elem.navi) {
  13194. $(self.elem.navi).toggleClass("hide", json.cnt_whole <= json.originalResult.length);
  13195. }
  13196. json.candidate = [];
  13197. json.keyField = [];
  13198. if (typeof json.originalResult != 'object') {
  13199. self.prop.xhr = null;
  13200. self.notFoundSearch(self);
  13201. return;
  13202. }
  13203. json.cnt_page = json.originalResult.length;
  13204. for (var i = 0; i < json.cnt_page; i++) {
  13205. for (var key in json.originalResult[i]) {
  13206. if (key == p.keyField) {
  13207. json.keyField.push(json.originalResult[i][key]);
  13208. }
  13209. if (key == p.showField) {
  13210. json.candidate.push(json.originalResult[i][key]);
  13211. }
  13212. }
  13213. }
  13214. self.prepareResults(self, json, q_word, which_page_num);
  13215. },
  13216. error: function (jqXHR, textStatus, errorThrown) {
  13217. if (textStatus != 'abort') {
  13218. self.hideResults(self);
  13219. self.ajaxErrorNotify(self, errorThrown);
  13220. }
  13221. },
  13222. complete: function () {
  13223. self.prop.xhr = null;
  13224. }
  13225. });
  13226. };
  13227. /**
  13228. * Search for json data source
  13229. * @param {Object} self
  13230. * @param {Array} q_word
  13231. * @param {number} which_page_num
  13232. */
  13233. SelectPage.prototype.searchForJson = function (self, q_word, which_page_num) {
  13234. var p = self.option, matched = [], esc_q = [], sorted = [], json = {}, i = 0, arr_reg = [];
  13235. //query keyword filter
  13236. do {
  13237. //'/\W/g'正则代表全部不是字母,数字,下划线,汉字的字符
  13238. //将非法字符进行转义
  13239. esc_q[i] = q_word[i].replace(/\W/g, '\\$&').toString();
  13240. arr_reg[i] = new RegExp(esc_q[i], 'gi');
  13241. i++;
  13242. } while (i < q_word.length);
  13243. // SELECT * FROM data WHERE field LIKE q_word;
  13244. for (var i = 0; i < p.data.length; i++) {
  13245. var flag = false, row = p.data[i], itemText;
  13246. for (var j = 0; j < arr_reg.length; j++) {
  13247. itemText = row[p.searchField];
  13248. if (p.formatItem && $.isFunction(p.formatItem))
  13249. itemText = p.formatItem(row);
  13250. if (itemText.match(arr_reg[j])) {
  13251. flag = true;
  13252. if (p.andOr == 'OR') break;
  13253. } else {
  13254. flag = false;
  13255. if (p.andOr == 'AND') break;
  13256. }
  13257. }
  13258. if (flag) matched.push(row);
  13259. }
  13260. // (CASE WHEN ...) then く order some column
  13261. if (p.orderBy === false) sorted = matched.concat();
  13262. else {
  13263. var reg1 = new RegExp('^' + esc_q[0] + '$', 'gi'),
  13264. reg2 = new RegExp('^' + esc_q[0], 'gi'),
  13265. matched1 = [], matched2 = [], matched3 = [];
  13266. for (var i = 0; i < matched.length; i++) {
  13267. var orderField = p.orderBy[0][0];
  13268. var orderValue = String(matched[i][orderField]);
  13269. if (orderValue.match(reg1)) {
  13270. matched1.push(matched[i]);
  13271. } else if (orderValue.match(reg2)) {
  13272. matched2.push(matched[i]);
  13273. } else {
  13274. matched3.push(matched[i]);
  13275. }
  13276. }
  13277. if (p.orderBy[0][1].match(/^asc$/i)) {
  13278. matched1 = self.sortAsc(self, matched1);
  13279. matched2 = self.sortAsc(self, matched2);
  13280. matched3 = self.sortAsc(self, matched3);
  13281. } else {
  13282. matched1 = self.sortDesc(self, matched1);
  13283. matched2 = self.sortDesc(self, matched2);
  13284. matched3 = self.sortDesc(self, matched3);
  13285. }
  13286. sorted = sorted.concat(matched1).concat(matched2).concat(matched3);
  13287. }
  13288. /*
  13289. if (sorted.length === undefined || sorted.length === 0 ) {
  13290. self.notFoundSearch(self);
  13291. return;
  13292. }
  13293. */
  13294. json.cnt_whole = sorted.length;
  13295. //page_move used to distinguish between init plugin or page moving
  13296. if (!self.prop.page_move) {
  13297. //only single mode can be used page number relocation
  13298. if (!p.multiple) {
  13299. //get selected item belong page number
  13300. var currentValue = self.elem.hidden.val();
  13301. if ($.type(currentValue) !== 'undefined' && $.trim(currentValue) !== '') {
  13302. var index = 0;
  13303. $.each(sorted, function (i, row) {
  13304. if (row[p.keyField] == currentValue) {
  13305. index = i + 1;
  13306. return false;
  13307. }
  13308. });
  13309. which_page_num = Math.ceil(index / p.pageSize);
  13310. if (which_page_num < 1) which_page_num = 1;
  13311. self.prop.current_page = which_page_num;
  13312. }
  13313. }
  13314. } else {
  13315. //set page number to 1 when result number less then page size
  13316. if (sorted.length <= ((which_page_num - 1) * p.pageSize)) {
  13317. which_page_num = 1;
  13318. self.prop.current_page = 1;
  13319. }
  13320. }
  13321. //LIMIT xx OFFSET xx
  13322. var start = (which_page_num - 1) * p.pageSize, end = start + p.pageSize;
  13323. //save original data
  13324. json.originalResult = [];
  13325. //after data filter handle
  13326. for (var i = start; i < end; i++) {
  13327. if (sorted[i] === undefined) break;
  13328. json.originalResult.push(sorted[i]);
  13329. for (var key in sorted[i]) {
  13330. if (key == p.keyField) {
  13331. if (json.keyField === undefined) json.keyField = [];
  13332. json.keyField.push(sorted[i][key]);
  13333. }
  13334. if (key == p.showField) {
  13335. if (json.candidate === undefined) json.candidate = [];
  13336. json.candidate.push(sorted[i][key]);
  13337. }
  13338. }
  13339. }
  13340. if (json.candidate === undefined) json.candidate = [];
  13341. json.cnt_page = json.candidate.length;
  13342. self.prepareResults(self, json, q_word, which_page_num);
  13343. };
  13344. /**
  13345. * Set order asc
  13346. * @param {Object} self
  13347. * @param {Array} arr - result array
  13348. */
  13349. SelectPage.prototype.sortAsc = function (self, arr) {
  13350. arr.sort(function (a, b) {
  13351. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  13352. return $.type(valA) === 'number' ? valA - valB : String(valA).localeCompare(String(valB));
  13353. });
  13354. return arr;
  13355. };
  13356. /**
  13357. * Set order desc
  13358. * @param {Object} self
  13359. * @param {Array} arr - result array
  13360. */
  13361. SelectPage.prototype.sortDesc = function (self, arr) {
  13362. arr.sort(function (a, b) {
  13363. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  13364. return $.type(valA) === 'number' ? valB - valA : String(valB).localeCompare(String(valA));
  13365. });
  13366. return arr;
  13367. };
  13368. /**
  13369. * Not result found handle
  13370. * @param {Object} self
  13371. */
  13372. SelectPage.prototype.notFoundSearch = function (self) {
  13373. self.elem.results.empty();
  13374. self.calcResultsSize(self);
  13375. self.setOpenStatus(self, true);
  13376. self.setCssFocusedInput(self);
  13377. };
  13378. /**
  13379. * Prepare data to show
  13380. * @param {Object} self
  13381. * @param {Object} json - data result
  13382. * @param {Array} q_word - query keyword
  13383. * @param {number} which_page_num - target page number
  13384. */
  13385. SelectPage.prototype.prepareResults = function (self, json, q_word, which_page_num) {
  13386. self.data = json.originalResult;
  13387. if (self.option.pagination) self.setNavi(self, json.cnt_whole, json.cnt_page, which_page_num);
  13388. if (!json.keyField) json.keyField = false;
  13389. if (self.option.selectOnly && json.candidate.length === 1 && json.candidate[0] == q_word[0]) {
  13390. self.elem.hidden.val(json.keyField[0]);
  13391. this.setButtonAttrDefault();
  13392. }
  13393. var is_query = false;
  13394. if (q_word && q_word.length && q_word[0]) is_query = true;
  13395. self.displayResults(self, json, is_query);
  13396. };
  13397. /**
  13398. * Build page bar
  13399. * @param {Object} self
  13400. * @param {number} cnt_whole - total record count
  13401. * @param {number} cnt_page
  13402. * @param {number} page_num - current page number
  13403. */
  13404. SelectPage.prototype.setNavi = function (self, cnt_whole, cnt_page, page_num) {
  13405. var msg = self.message;
  13406. /**
  13407. * build pagination bar
  13408. */
  13409. var buildPageNav = function (self, pagebar, page_num, last_page) {
  13410. var updatePageInfo = function () {
  13411. var pageInfo = msg.page_info;
  13412. return pageInfo.replace(self.template.page.current, page_num).replace(self.template.page.total, last_page);
  13413. };
  13414. if (pagebar.find('li').length === 0) {
  13415. pagebar.hide().empty();
  13416. var iconFist = 'spfont sp-first',
  13417. iconPrev = 'spfont sp-previous',
  13418. iconNext = 'spfont sp-next',
  13419. iconLast = 'spfont sp-last';
  13420. pagebar.append('<li class="csFirstPage" title="' + msg.first_title + '" ><a href="javascript:void(0);"> <i class="' + iconFist + '"></i> </a></li>');
  13421. pagebar.append('<li class="csPreviousPage" title="' + msg.prev_title + '" ><a href="javascript:void(0);"><i class="' + iconPrev + '"></i></a></li>');
  13422. //pagination information
  13423. pagebar.append('<li class="pageInfoBox"><a href="javascript:void(0);"> ' + updatePageInfo() + ' </a></li>');
  13424. pagebar.append('<li class="csNextPage" title="' + msg.next_title + '" ><a href="javascript:void(0);"><i class="' + iconNext + '"></i></a></li>');
  13425. pagebar.append('<li class="csLastPage" title="' + msg.last_title + '" ><a href="javascript:void(0);"> <i class="' + iconLast + '"></i> </a></li>');
  13426. pagebar.show();
  13427. } else {
  13428. pagebar.find('li.pageInfoBox a').html(updatePageInfo());
  13429. }
  13430. };
  13431. var pagebar = self.elem.navi.find('ul'),
  13432. last_page = Math.ceil(cnt_whole / self.option.pageSize); //calculate total page
  13433. if (last_page === 0) page_num = 0;
  13434. else {
  13435. if (last_page < page_num) page_num = last_page;
  13436. else if (page_num === 0) page_num = 1;
  13437. }
  13438. self.prop.current_page = page_num;//update current page number
  13439. self.prop.max_page = last_page;//update page count
  13440. buildPageNav(self, pagebar, page_num, last_page);
  13441. //update paging status
  13442. var dClass = 'disabled',
  13443. first = pagebar.find('li.csFirstPage'),
  13444. previous = pagebar.find('li.csPreviousPage'),
  13445. next = pagebar.find('li.csNextPage'),
  13446. last = pagebar.find('li.csLastPage');
  13447. //first and previous
  13448. if (page_num === 1 || page_num === 0) {
  13449. if (!first.hasClass(dClass)) first.addClass(dClass);
  13450. if (!previous.hasClass(dClass)) previous.addClass(dClass);
  13451. } else {
  13452. if (first.hasClass(dClass)) first.removeClass(dClass);
  13453. if (previous.hasClass(dClass)) previous.removeClass(dClass);
  13454. }
  13455. //next and last
  13456. if (page_num === last_page || last_page === 0) {
  13457. if (!next.hasClass(dClass)) next.addClass(dClass);
  13458. if (!last.hasClass(dClass)) last.addClass(dClass);
  13459. } else {
  13460. if (next.hasClass(dClass)) next.removeClass(dClass);
  13461. if (last.hasClass(dClass)) last.removeClass(dClass);
  13462. }
  13463. if (last_page > 1) self.ePaging(); //pagination event bind
  13464. };
  13465. /**
  13466. * Render result list
  13467. * @param {Object} self
  13468. * @param {Object} json - result data
  13469. * @param {boolean} is_query - used to different from search to open and just click to open
  13470. */
  13471. SelectPage.prototype.displayResults = function (self, json, is_query) {
  13472. var p = self.option, el = self.elem;
  13473. el.results.hide().empty();
  13474. if (p.multiple && $.type(p.maxSelectLimit) === 'number' && p.maxSelectLimit > 0) {
  13475. var selectedSize = el.element_box.find('li.selected_tag').length;
  13476. if (selectedSize > 0 && selectedSize >= p.maxSelectLimit) {
  13477. var msg = self.message.max_selected;
  13478. self.showMessage(self, msg.replace(self.template.msg.maxSelectLimit, p.maxSelectLimit));
  13479. return;
  13480. }
  13481. }
  13482. if (json.candidate.length) {
  13483. var arr_candidate = json.candidate,
  13484. arr_primary_key = json.keyField,
  13485. keystr = el.hidden.val(),
  13486. keyArr = keystr ? keystr.split(',') : new Array(),
  13487. itemText = '';
  13488. for (var i = 0; i < arr_candidate.length; i++) {
  13489. if (p.formatItem && $.isFunction(p.formatItem)) {
  13490. try {
  13491. itemText = p.formatItem(json.originalResult[i]);
  13492. } catch (e) {
  13493. console.error('formatItem内容格式化函数内容设置不正确!');
  13494. itemText = arr_candidate[i];
  13495. }
  13496. } else itemText = arr_candidate[i];
  13497. var list = $('<li>').html(itemText).attr({
  13498. pkey: arr_primary_key[i],
  13499. index: i
  13500. });
  13501. if (!p.formatItem) list.attr('title', itemText);
  13502. //Set selected item highlight
  13503. if ($.inArray(arr_primary_key[i].toString(), keyArr) !== -1) {
  13504. list.addClass(self.css_class.selected);
  13505. }
  13506. //cache item data
  13507. list.data('dataObj', json.originalResult[i]);
  13508. el.results.append(list);
  13509. }
  13510. } else {
  13511. var li = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' +
  13512. self.message.not_found + '</li>';
  13513. el.results.append(li);
  13514. }
  13515. el.results.show();
  13516. if (p.multiple && p.multipleControlbar) el.control.show();
  13517. if (p.pagination) el.navi.show();
  13518. self.calcResultsSize(self);
  13519. self.setOpenStatus(self, true);
  13520. //Result item event bind
  13521. self.eResultList();
  13522. //scrolling listen
  13523. self.eScroll();
  13524. //auto highlight first item in search, have result and set autoSelectFirst to true situation
  13525. if (is_query && json.candidate.length && p.autoSelectFirst) self.nextLine(self);
  13526. };
  13527. /**
  13528. * Calculate result list size and position
  13529. * @param {Object} self
  13530. */
  13531. SelectPage.prototype.calcResultsSize = function (self) {
  13532. var p = self.option, el = self.elem;
  13533. var rePosition = function () {
  13534. if (el.container.css('position') === 'static') {
  13535. // position: static
  13536. var offset = el.combo_input.offset();
  13537. el.result_area.css({
  13538. top: offset.top + el.combo_input.outerHeight() + 'px',
  13539. left: offset.left + 'px'
  13540. });
  13541. } else {
  13542. if (!p.pagination) {
  13543. var itemHeight = el.results.find('li:first').outerHeight(true),
  13544. listHeight = itemHeight * p.listSize;
  13545. el.results.css({
  13546. 'max-height': listHeight,
  13547. 'overflow-y': 'auto'
  13548. });
  13549. }
  13550. //handle result list show up side(left, right, up or down)
  13551. var docWidth = $(document).width(),
  13552. docHeight = $(document).height(), //the document full height
  13553. viewHeight = $(window).height(), //browser visible area height
  13554. offset = el.container.offset(),
  13555. screenScrollTop = $(window).scrollTop(),
  13556. listWidth = el.result_area.outerWidth(),
  13557. //result list height
  13558. listHeight = el.result_area.outerHeight(),
  13559. //default left used input element left
  13560. defaultLeft = offset.left, //p.multiple ? -1 : 0;
  13561. //input element height
  13562. inputHeight = el.container.outerHeight(),
  13563. left = (offset.left + listWidth) > docWidth ?
  13564. defaultLeft - (listWidth - el.container.outerWidth()) :
  13565. defaultLeft,
  13566. //the actual top coordinate of input element(outer div)
  13567. screenTop = offset.top, //$(el.container).scrollTop();//offset.top - screenScrollTop;
  13568. top = 0, dist = 5, //set distance between input element and result list
  13569. //the actual top coordinate of result list
  13570. listBottom = screenTop + inputHeight + listHeight + dist,
  13571. listTop = screenTop + listHeight + dist,
  13572. hasOverflow = docHeight > viewHeight;
  13573. if ((screenTop - screenScrollTop - dist > listHeight) &&
  13574. (hasOverflow && listBottom > (viewHeight + screenScrollTop)) ||
  13575. (!hasOverflow && listBottom > viewHeight && screenTop >= listTop)) {
  13576. //open up
  13577. top = offset.top - listHeight - dist;
  13578. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowUp');
  13579. } else {
  13580. //open down
  13581. top = offset.top + (p.multiple ? el.container.outerHeight() : inputHeight);
  13582. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowDown');
  13583. top += dist;
  13584. }
  13585. return {
  13586. top: top + 'px', left: left + 'px'
  13587. };
  13588. }
  13589. };
  13590. if (el.result_area.is(':visible')) {
  13591. el.result_area.css(rePosition());
  13592. } else {
  13593. var pss = rePosition();
  13594. el.result_area.css(pss).show(1, function () {
  13595. var repss = rePosition();
  13596. if (pss.top !== repss.top || pss.left !== repss.left) el.result_area.css(repss);
  13597. });
  13598. }
  13599. };
  13600. /**
  13601. * hide result list
  13602. * @param {Object} self
  13603. */
  13604. SelectPage.prototype.hideResults = function (self) {
  13605. if (self.prop.key_paging) {
  13606. self.scrollWindow(self, true);
  13607. self.prop.key_paging = false;
  13608. }
  13609. self.setCssFocusedInput(self);
  13610. if (self.option.autoFillResult) {
  13611. //self.selectCurrentLine(self, true);
  13612. }
  13613. self.elem.results.empty();
  13614. self.elem.result_area.hide();
  13615. self.setOpenStatus(self, false);
  13616. //unbind window scroll listen
  13617. $(window).off('scroll.SelectPage');
  13618. self.abortAjax(self);
  13619. self.setButtonAttrDefault();
  13620. };
  13621. /**
  13622. * set plugin to disabled / enabled
  13623. * @param self
  13624. * @param disabled
  13625. */
  13626. SelectPage.prototype.disabled = function (self, disabled) {
  13627. var p = self.option, el = self.elem;
  13628. if ($.type(disabled) === 'undefined') return el.combo_input.prop('disabled');
  13629. if ($.type(disabled) === 'boolean') {
  13630. el.combo_input.prop('disabled', disabled);
  13631. if (disabled) el.container.addClass(self.css_class.disabled);
  13632. else el.container.removeClass(self.css_class.disabled);
  13633. }
  13634. };
  13635. /**
  13636. * Go fist page
  13637. * @param {Object} self
  13638. */
  13639. SelectPage.prototype.firstPage = function (self) {
  13640. if (self.prop.current_page > 1) {
  13641. self.prop.current_page = 1;
  13642. self.prop.page_move = true;
  13643. self.suggest(self);
  13644. }
  13645. };
  13646. /**
  13647. * Go previous page
  13648. * @param {Object} self
  13649. */
  13650. SelectPage.prototype.prevPage = function (self) {
  13651. if (self.prop.current_page > 1) {
  13652. self.prop.current_page--;
  13653. self.prop.page_move = true;
  13654. self.suggest(self);
  13655. }
  13656. };
  13657. /**
  13658. * Go next page
  13659. * @param {Object} self
  13660. */
  13661. SelectPage.prototype.nextPage = function (self) {
  13662. if (self.prop.current_page < self.prop.max_page) {
  13663. self.prop.current_page++;
  13664. self.prop.page_move = true;
  13665. self.suggest(self);
  13666. }
  13667. };
  13668. /**
  13669. * Go last page
  13670. * @param {Object} self
  13671. */
  13672. SelectPage.prototype.lastPage = function (self) {
  13673. if (self.prop.current_page < self.prop.max_page) {
  13674. self.prop.current_page = self.prop.max_page;
  13675. self.prop.page_move = true;
  13676. self.suggest(self);
  13677. }
  13678. };
  13679. /**
  13680. * do something after select/unSelect action
  13681. * @param {Object} self
  13682. * @param {boolean} reOpen
  13683. */
  13684. SelectPage.prototype.afterAction = function (self, reOpen) {
  13685. self.inputResize(self);
  13686. self.elem.combo_input.change();
  13687. self.setCssFocusedInput(self);
  13688. if (self.prop.init_set) return;
  13689. if (self.option.multiple) {
  13690. if (self.option.selectToCloseList) {
  13691. self.hideResults(self);
  13692. self.elem.combo_input.blur();
  13693. }
  13694. if (!self.option.selectToCloseList && reOpen) {
  13695. self.suggest(self);
  13696. self.elem.combo_input.focus();
  13697. }
  13698. } else {
  13699. self.hideResults(self);
  13700. self.elem.combo_input.blur();
  13701. }
  13702. };
  13703. /**
  13704. * Select current list item
  13705. * @param {Object} self
  13706. * @param {boolean} is_enter_key
  13707. */
  13708. SelectPage.prototype.selectCurrentLine = function (self, is_enter_key) {
  13709. self.scrollWindow(self, true);
  13710. var p = self.option, current = self.getCurrentLine(self);
  13711. if (current) {
  13712. var data = current.data('dataObj');
  13713. var text = data[p.showField] || current.text();
  13714. var value = current.attr('pkey');
  13715. if (!p.multiple) {
  13716. self.elem.combo_input.val(text);
  13717. self.elem.hidden.val(value);
  13718. } else {
  13719. //build tags in multiple selection mode
  13720. self.elem.combo_input.val('');
  13721. var item = {text: text, value: value};
  13722. if (!self.isAlreadySelected(self, item)) {
  13723. self.addNewTag(self, data, item);
  13724. self.tagValuesSet(self);
  13725. }
  13726. }
  13727. if (p.selectOnly) self.setButtonAttrDefault();
  13728. //Select item callback
  13729. if (p.eSelect && $.isFunction(p.eSelect)) p.eSelect(data, self);
  13730. self.prop.prev_value = self.elem.combo_input.val();
  13731. self.prop.selected_text = self.elem.combo_input.val();
  13732. self.putClearButton();
  13733. }
  13734. self.afterAction(self, true);
  13735. };
  13736. /**
  13737. * Show clear button when item selected in single selection mode
  13738. */
  13739. SelectPage.prototype.putClearButton = function () {
  13740. if (!this.option.multiple && !this.elem.combo_input.prop('disabled')) this.elem.container.append(this.elem.clear_btn);
  13741. };
  13742. /**
  13743. * Select all list item
  13744. * @param {Object} self
  13745. */
  13746. SelectPage.prototype.selectAllLine = function (self) {
  13747. var p = self.option, jsonarr = new Array();
  13748. self.elem.results.find('li').each(function (i, row) {
  13749. var $row = $(row), data = $row.data('dataObj');
  13750. var text = data[p.showField] || $row.text();
  13751. var value = $row.attr('pkey');
  13752. var item = {text: text, value: value};
  13753. if (!self.isAlreadySelected(self, item)) {
  13754. self.addNewTag(self, data, item);
  13755. self.tagValuesSet(self);
  13756. }
  13757. jsonarr.push(data);
  13758. //limited max selected items
  13759. if ($.type(p.maxSelectLimit) === 'number' &&
  13760. p.maxSelectLimit > 0 &&
  13761. p.maxSelectLimit === self.elem.element_box.find('li.selected_tag').length) {
  13762. return false;
  13763. }
  13764. });
  13765. if (p.eSelect && $.isFunction(p.eSelect)) p.eSelect(jsonarr, self);
  13766. self.afterAction(self, true);
  13767. };
  13768. /**
  13769. * Cancel select all item in current page
  13770. * @param {Object} self
  13771. */
  13772. SelectPage.prototype.unSelectAllLine = function (self) {
  13773. var p = self.option, size = self.elem.results.find('li').length, ds = [];
  13774. self.elem.results.find('li').each(function (i, row) {
  13775. var key = $(row).attr('pkey');
  13776. var tag = self.elem.element_box.find('li.selected_tag[itemvalue="' + key + '"]');
  13777. if (tag.length) ds.push(tag.data('dataObj'));
  13778. self.removeTag(self, tag);
  13779. });
  13780. self.afterAction(self, true);
  13781. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove(ds);
  13782. };
  13783. /**
  13784. * Clear all selected items
  13785. * @param {Object} self
  13786. * @param {boolean} open - open list after clear selected item
  13787. */
  13788. SelectPage.prototype.clearAll = function (self, open) {
  13789. var p = self.option, ds = [];
  13790. if (p.multiple) {
  13791. self.elem.element_box.find('li.selected_tag').each(function (i, row) {
  13792. ds.push($(row).data('dataObj'));
  13793. row.remove();
  13794. });
  13795. self.elem.element_box.find('li.selected_tag').remove();
  13796. }
  13797. self.reset(self);
  13798. self.afterAction(self, open);
  13799. if (p.multiple) {
  13800. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove(ds);
  13801. } else self.elem.clear_btn.remove();
  13802. };
  13803. /**
  13804. * reset
  13805. */
  13806. SelectPage.prototype.reset = function (self) {
  13807. self.elem.combo_input.val('');
  13808. self.elem.hidden.val('');
  13809. self.prop.prev_value = '';
  13810. self.prop.selected_text = '';
  13811. self.prop.current_page = 1;
  13812. };
  13813. /**
  13814. * Get current highlight item
  13815. * @param {Object} self
  13816. */
  13817. SelectPage.prototype.getCurrentLine = function (self) {
  13818. if (self.elem.result_area.is(':hidden')) return false;
  13819. var obj = self.elem.results.find('li.' + self.css_class.select);
  13820. if (obj.length) return obj;
  13821. else return false;
  13822. };
  13823. /**
  13824. * Check the result item is already selected or not
  13825. * @param {Object} self
  13826. * @param {Object} item - item info
  13827. */
  13828. SelectPage.prototype.isAlreadySelected = function (self, item) {
  13829. var isExist = false;
  13830. if (item.value) {
  13831. var keys = self.elem.hidden.val();
  13832. if (keys) {
  13833. var karr = keys.split(',');
  13834. if (karr && karr.length && $.inArray(item.value, karr) != -1) isExist = true;
  13835. }
  13836. }
  13837. return isExist;
  13838. };
  13839. /**
  13840. * Add a new tag in multiple selection mode
  13841. * @param {Object} self
  13842. * @param {object} data - raw row data
  13843. * @param {Object} item
  13844. */
  13845. SelectPage.prototype.addNewTag = function (self, data, item) {
  13846. if (!self.option.multiple || !data || !item) return;
  13847. var tmp = self.template.tag.content, tag;
  13848. tmp = tmp.replace(self.template.tag.textKey, item.text);
  13849. tmp = tmp.replace(self.template.tag.valueKey, item.value);
  13850. tag = $(tmp);
  13851. tag.data('dataObj', data);
  13852. if (self.elem.combo_input.prop('disabled')) tag.find('span.tag_close').hide();
  13853. self.elem.combo_input.closest('li').before(tag);
  13854. };
  13855. /**
  13856. * Remove a tag in multiple selection mode
  13857. * @param {Object} self
  13858. * @param {Object} item
  13859. */
  13860. SelectPage.prototype.removeTag = function (self, item) {
  13861. var key = $(item).attr('itemvalue');
  13862. var keys = self.elem.hidden.val();
  13863. if ($.type(key) != 'undefined' && keys) {
  13864. var keyarr = keys.split(','),
  13865. index = $.inArray(key.toString(), keyarr);
  13866. if (index != -1) {
  13867. keyarr.splice(index, 1);
  13868. self.elem.hidden.val(keyarr.toString()).trigger("change");
  13869. }
  13870. }
  13871. $(item).remove();
  13872. self.inputResize(self);
  13873. };
  13874. /**
  13875. * Selected item value(keyField) put in to hidden element
  13876. * @param {Object} self
  13877. */
  13878. SelectPage.prototype.tagValuesSet = function (self) {
  13879. if (!self.option.multiple) return;
  13880. var tags = self.elem.element_box.find('li.selected_tag');
  13881. if (tags && tags.length) {
  13882. var result = new Array();
  13883. $.each(tags, function (i, li) {
  13884. var v = $(li).attr('itemvalue');
  13885. if ($.type(v) !== 'undefined') result.push(v);
  13886. });
  13887. if (result.length) {
  13888. self.elem.hidden.val(result.join(',')).trigger("change");
  13889. }
  13890. }
  13891. };
  13892. /**
  13893. * auto resize input element width in multiple select mode
  13894. * @param {Object} self
  13895. */
  13896. SelectPage.prototype.inputResize = function (self) {
  13897. if (!self.option.multiple) return;
  13898. var width = '',
  13899. inputLi = self.elem.combo_input.closest('li');
  13900. var setDefaultSize = function (self, inputLi) {
  13901. inputLi.removeClass('full_width');
  13902. var minimumWidth = self.elem.combo_input.val().length + 1,
  13903. width = (minimumWidth * 0.75) + 'em';
  13904. self.elem.combo_input.css('width', width).removeAttr('placeholder');
  13905. };
  13906. if (self.elem.element_box.find('li.selected_tag').length === 0) {
  13907. if (!inputLi.hasClass('full_width')) inputLi.addClass('full_width');
  13908. if (self.elem.combo_input.attr('placeholder_bak')) {
  13909. self.elem.combo_input.attr('placeholder', self.elem.combo_input.attr('placeholder_bak')).removeAttr('style');
  13910. }
  13911. } else setDefaultSize(self, inputLi);
  13912. };
  13913. /**
  13914. * Move to next line
  13915. * @param {Object} self
  13916. */
  13917. SelectPage.prototype.nextLine = function (self) {
  13918. var obj = self.getCurrentLine(self), idx;
  13919. if (!obj) idx = -1;
  13920. else {
  13921. idx = self.elem.results.children('li').index(obj);
  13922. obj.removeClass(self.css_class.select);
  13923. }
  13924. idx++;
  13925. if (idx < self.elem.results.children('li').length) {
  13926. var next = self.elem.results.children('li').eq(idx);
  13927. next.addClass(self.css_class.select);
  13928. self.setCssFocusedResults(self);
  13929. } else self.setCssFocusedInput(self);
  13930. self.scrollWindow(self, false);
  13931. };
  13932. /**
  13933. * Move to previous line
  13934. * @param {Object} self
  13935. */
  13936. SelectPage.prototype.prevLine = function (self) {
  13937. var obj = self.getCurrentLine(self), idx;
  13938. if (!obj) idx = self.elem.results.children('li').length;
  13939. else {
  13940. idx = self.elem.results.children('li').index(obj);
  13941. obj.removeClass(self.css_class.select);
  13942. }
  13943. idx--;
  13944. if (idx > -1) {
  13945. var prev = self.elem.results.children('li').eq(idx);
  13946. prev.addClass(self.css_class.select);
  13947. self.setCssFocusedResults(self);
  13948. } else self.setCssFocusedInput(self);
  13949. self.scrollWindow(self, false);
  13950. };
  13951. /**
  13952. * SelectPage plugin definition
  13953. * @global
  13954. * @param option {Object} init plugin option
  13955. */
  13956. function Plugin(option) {
  13957. return this.each(function () {
  13958. var $this = $(this),
  13959. data = $this.data(SelectPage.dataKey),
  13960. params = $.extend({}, defaults, $this.data(), data && data.option, typeof option === 'object' && option);
  13961. if (!data) $this.data(SelectPage.dataKey, (data = new SelectPage(this, params)));
  13962. });
  13963. }
  13964. /**
  13965. * Get plugin object
  13966. * @param {object} obj
  13967. * @returns
  13968. */
  13969. function getPlugin(obj) {
  13970. return $(obj).closest('div.sp_container').find('input.sp_input');
  13971. }
  13972. /**
  13973. * Clear all selected item
  13974. */
  13975. function ClearSelected() {
  13976. return this.each(function () {
  13977. var $this = getPlugin(this),
  13978. data = $this.data(SelectPage.dataKey);
  13979. if (data) {
  13980. data.prop.init_set = true;
  13981. data.clearAll(data);
  13982. data.prop.init_set = false;
  13983. }
  13984. });
  13985. }
  13986. /**
  13987. * Refresh result list
  13988. * use case:
  13989. * 1.use $(obj).val('xxx') to modify selectpage selected item key
  13990. * 2.refresh selected item show content/tag text
  13991. */
  13992. function SelectedRefresh() {
  13993. return this.each(function () {
  13994. var $this = getPlugin(this),
  13995. data = $this.data(SelectPage.dataKey);
  13996. if (data && data.elem.hidden.val())
  13997. data.setInitRecord(true);
  13998. });
  13999. }
  14000. /**
  14001. * Modify plugin datasource, only work on json datasource mode
  14002. * @param {array} data - new datasource
  14003. * @example
  14004. * [{name:'aa',sex:1},{name:'bb',sex:0},{...}]
  14005. */
  14006. function ModifyDataSource(data) {
  14007. return this.each(function () {
  14008. if (data && $.isArray(data)) {
  14009. var $this = getPlugin(this),
  14010. plugin = $this.data(SelectPage.dataKey);
  14011. if (plugin) {
  14012. plugin.clearAll(plugin);
  14013. plugin.option.data = data;
  14014. }
  14015. }
  14016. });
  14017. }
  14018. /**
  14019. * Get plugin disabled status or Modify plugin disabled status
  14020. * @param disabled {boolean} set disabled status
  14021. */
  14022. function PluginDisabled(disabled) {
  14023. var status = false;
  14024. this.each(function () {
  14025. var $this = getPlugin(this),
  14026. plugin = $this.data(SelectPage.dataKey);
  14027. if (plugin) {
  14028. if ($.type(disabled) !== 'undefined')
  14029. plugin.disabled(plugin, disabled);
  14030. else
  14031. status = plugin.disabled(plugin);
  14032. }
  14033. });
  14034. return status;
  14035. }
  14036. /**
  14037. * Get selected item text
  14038. * @returns {string}
  14039. */
  14040. function GetInputText() {
  14041. var str = '';
  14042. this.each(function () {
  14043. var $this = getPlugin(this), data = $this.data(SelectPage.dataKey);
  14044. if (data) {
  14045. if (data.option.multiple) {
  14046. var tags = [];
  14047. data.elem.element_box.find('li.selected_tag').each(function (i, tag) {
  14048. tags.push($(tag).text());
  14049. });
  14050. str += tags.toString();
  14051. } else {
  14052. str += data.elem.combo_input.val();
  14053. }
  14054. }
  14055. });
  14056. return str;
  14057. }
  14058. var old = $.fn.selectPage;
  14059. $.fn.selectPage = Plugin;
  14060. $.fn.selectPage.Constructor = SelectPage;
  14061. $.fn.selectPageClear = ClearSelected;
  14062. $.fn.selectPageRefresh = SelectedRefresh;
  14063. $.fn.selectPageData = ModifyDataSource;
  14064. $.fn.selectPageDisabled = PluginDisabled;
  14065. $.fn.selectPageText = GetInputText;
  14066. // SelectPage no conflict
  14067. // =================
  14068. $.fn.selectPage.noConflict = function () {
  14069. $.fn.selectPage = old;
  14070. return this;
  14071. };
  14072. })(window.jQuery);
  14073. define("selectpage", function(){});