require-frontend.min.js 897 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191
  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', 'frontend', 'frontend-init', 'table', 'form', 'dragsort', 'drag', 'drop', '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. 'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',
  49. 'dragsort': '../libs/fastadmin-dragsort/jquery.dragsort',
  50. 'sortable': '../libs/Sortable/Sortable.min',
  51. 'addtabs': '../libs/fastadmin-addtabs/jquery.addtabs',
  52. 'slimscroll': '../libs/jquery-slimscroll/jquery.slimscroll',
  53. 'validator': '../libs/nice-validator/dist/jquery.validator',
  54. 'validator-lang': '../libs/nice-validator/dist/local/zh-CN',
  55. 'toastr': '../libs/toastr/toastr',
  56. 'jstree': '../libs/jstree/dist/jstree.min',
  57. 'layer': '../libs/fastadmin-layer/dist/layer',
  58. 'cookie': '../libs/jquery.cookie/jquery.cookie',
  59. 'cxselect': '../libs/fastadmin-cxselect/js/jquery.cxselect',
  60. 'template': '../libs/art-template/dist/template-native',
  61. 'selectpage': '../libs/fastadmin-selectpage/selectpage',
  62. 'citypicker': '../libs/fastadmin-citypicker/dist/js/city-picker.min',
  63. 'citypicker-data': '../libs/fastadmin-citypicker/dist/js/city-picker.data'
  64. },
  65. // shim依赖配置
  66. shim: {
  67. 'addons': ['frontend'],
  68. 'bootstrap': ['jquery'],
  69. 'bootstrap-table': {
  70. deps: ['bootstrap'],
  71. exports: '$.fn.bootstrapTable'
  72. },
  73. 'bootstrap-table-lang': {
  74. deps: ['bootstrap-table'],
  75. exports: '$.fn.bootstrapTable.defaults'
  76. },
  77. 'bootstrap-table-export': {
  78. deps: ['bootstrap-table', 'tableexport'],
  79. exports: '$.fn.bootstrapTable.defaults'
  80. },
  81. 'bootstrap-table-fixed-columns': {
  82. deps: ['bootstrap-table'],
  83. exports: '$.fn.bootstrapTable.defaults'
  84. },
  85. 'bootstrap-table-mobile': {
  86. deps: ['bootstrap-table'],
  87. exports: '$.fn.bootstrapTable.defaults'
  88. },
  89. 'bootstrap-table-advancedsearch': {
  90. deps: ['bootstrap-table'],
  91. exports: '$.fn.bootstrapTable.defaults'
  92. },
  93. 'bootstrap-table-commonsearch': {
  94. deps: ['bootstrap-table'],
  95. exports: '$.fn.bootstrapTable.defaults'
  96. },
  97. 'bootstrap-table-template': {
  98. deps: ['bootstrap-table', 'template'],
  99. exports: '$.fn.bootstrapTable.defaults'
  100. },
  101. 'bootstrap-table-jumpto': {
  102. deps: ['bootstrap-table'],
  103. exports: '$.fn.bootstrapTable.defaults'
  104. },
  105. 'tableexport': {
  106. deps: ['jquery'],
  107. exports: '$.fn.extend'
  108. },
  109. 'slimscroll': {
  110. deps: ['jquery'],
  111. exports: '$.fn.extend'
  112. },
  113. 'adminlte': {
  114. deps: ['bootstrap', 'slimscroll'],
  115. exports: '$.AdminLTE'
  116. },
  117. 'bootstrap-daterangepicker': [
  118. 'moment/locale/zh-cn'
  119. ],
  120. 'bootstrap-datetimepicker': [
  121. 'moment/locale/zh-cn',
  122. ],
  123. 'bootstrap-select-lang': ['bootstrap-select'],
  124. 'jstree': ['css!../libs/jstree/dist/themes/default/style.css'],
  125. 'validator-lang': ['validator'],
  126. 'citypicker': ['citypicker-data', 'css!../libs/fastadmin-citypicker/dist/css/city-picker.css']
  127. },
  128. baseUrl: requirejs.s.contexts._.config.config.site.cdnurl + '/assets/js/', //资源基础路径
  129. map: {
  130. '*': {
  131. 'css': '../libs/require-css/css.min'
  132. }
  133. },
  134. waitSeconds: 60,
  135. charset: 'utf-8' // 文件编码
  136. });
  137. require(['jquery', 'bootstrap'], function ($, undefined) {
  138. //初始配置
  139. var Config = requirejs.s.contexts._.config.config;
  140. //将Config渲染到全局
  141. window.Config = Config;
  142. // 配置语言包的路径
  143. var paths = {};
  144. paths['lang'] = Config.moduleurl + '/ajax/lang?callback=define&controllername=' + Config.controllername + '&lang=' + Config.language + '&v=' + Config.site.version;
  145. // 避免目录冲突
  146. paths['frontend/'] = 'frontend/';
  147. require.config({paths: paths});
  148. // 初始化
  149. $(function () {
  150. require(['fast'], function (Fast) {
  151. require(['frontend', 'frontend-init', 'addons'], function (Frontend, Addons) {
  152. //加载相应模块
  153. if (Config.jsname) {
  154. require([Config.jsname], function (Controller) {
  155. Controller[Config.actionname] != undefined && Controller[Config.actionname]();
  156. }, function (e) {
  157. console.error(e);
  158. // 这里可捕获模块加载的错误
  159. });
  160. }
  161. });
  162. });
  163. });
  164. });
  165. define("require-frontend", function(){});
  166. 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});
  167. /*! layer-v3.5.3 Web 通用弹出层组件 MIT License http://layer.layui.com/ By 贤心 */
  168. ;!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);
  169. /*
  170. * Toastr
  171. * Copyright 2012-2015
  172. * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
  173. * All Rights Reserved.
  174. * Use, reproduction, distribution, and modification of this code is subject to the terms and
  175. * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
  176. *
  177. * ARIA Support: Greta Krafsig
  178. *
  179. * Project: https://github.com/CodeSeven/toastr
  180. */
  181. /* global define */
  182. (function (define) {
  183. define('toastr',['jquery'], function ($) {
  184. return (function () {
  185. var $container;
  186. var listener;
  187. var toastId = 0;
  188. var toastType = {
  189. error: 'error',
  190. info: 'info',
  191. success: 'success',
  192. warning: 'warning'
  193. };
  194. var toastr = {
  195. clear: clear,
  196. remove: remove,
  197. error: error,
  198. getContainer: getContainer,
  199. info: info,
  200. options: {},
  201. subscribe: subscribe,
  202. success: success,
  203. version: '2.1.3',
  204. warning: warning
  205. };
  206. var previousToast;
  207. return toastr;
  208. ////////////////
  209. function error(message, title, optionsOverride) {
  210. return notify({
  211. type: toastType.error,
  212. iconClass: getOptions().iconClasses.error,
  213. message: message,
  214. optionsOverride: optionsOverride,
  215. title: title
  216. });
  217. }
  218. function getContainer(options, create) {
  219. if (!options) { options = getOptions(); }
  220. $container = $('#' + options.containerId);
  221. if ($container.length) {
  222. return $container;
  223. }
  224. if (create) {
  225. $container = createContainer(options);
  226. }
  227. return $container;
  228. }
  229. function info(message, title, optionsOverride) {
  230. return notify({
  231. type: toastType.info,
  232. iconClass: getOptions().iconClasses.info,
  233. message: message,
  234. optionsOverride: optionsOverride,
  235. title: title
  236. });
  237. }
  238. function subscribe(callback) {
  239. listener = callback;
  240. }
  241. function success(message, title, optionsOverride) {
  242. return notify({
  243. type: toastType.success,
  244. iconClass: getOptions().iconClasses.success,
  245. message: message,
  246. optionsOverride: optionsOverride,
  247. title: title
  248. });
  249. }
  250. function warning(message, title, optionsOverride) {
  251. return notify({
  252. type: toastType.warning,
  253. iconClass: getOptions().iconClasses.warning,
  254. message: message,
  255. optionsOverride: optionsOverride,
  256. title: title
  257. });
  258. }
  259. function clear($toastElement, clearOptions) {
  260. var options = getOptions();
  261. if (!$container) { getContainer(options); }
  262. if (!clearToast($toastElement, options, clearOptions)) {
  263. clearContainer(options);
  264. }
  265. }
  266. function remove($toastElement) {
  267. var options = getOptions();
  268. if (!$container) { getContainer(options); }
  269. if ($toastElement && $(':focus', $toastElement).length === 0) {
  270. removeToast($toastElement);
  271. return;
  272. }
  273. if ($container.children().length) {
  274. $container.remove();
  275. }
  276. }
  277. // internal functions
  278. function clearContainer (options) {
  279. var toastsToClear = $container.children();
  280. for (var i = toastsToClear.length - 1; i >= 0; i--) {
  281. clearToast($(toastsToClear[i]), options);
  282. }
  283. }
  284. function clearToast ($toastElement, options, clearOptions) {
  285. var force = clearOptions && clearOptions.force ? clearOptions.force : false;
  286. if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
  287. $toastElement[options.hideMethod]({
  288. duration: options.hideDuration,
  289. easing: options.hideEasing,
  290. complete: function () { removeToast($toastElement); }
  291. });
  292. return true;
  293. }
  294. return false;
  295. }
  296. function createContainer(options) {
  297. $container = $('<div/>')
  298. .attr('id', options.containerId)
  299. .addClass(options.positionClass);
  300. $container.appendTo($(options.target));
  301. return $container;
  302. }
  303. function getDefaults() {
  304. return {
  305. tapToDismiss: true,
  306. toastClass: 'toast',
  307. containerId: 'toast-container',
  308. debug: false,
  309. showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
  310. showDuration: 300,
  311. showEasing: 'swing', //swing and linear are built into jQuery
  312. onShown: undefined,
  313. hideMethod: 'fadeOut',
  314. hideDuration: 1000,
  315. hideEasing: 'swing',
  316. onHidden: undefined,
  317. closeMethod: false,
  318. closeDuration: false,
  319. closeEasing: false,
  320. closeOnHover: true,
  321. extendedTimeOut: 1000,
  322. iconClasses: {
  323. error: 'toast-error',
  324. info: 'toast-info',
  325. success: 'toast-success',
  326. warning: 'toast-warning'
  327. },
  328. iconClass: 'toast-info',
  329. positionClass: 'toast-top-right',
  330. timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
  331. titleClass: 'toast-title',
  332. messageClass: 'toast-message',
  333. escapeHtml: false,
  334. target: 'body',
  335. closeHtml: '<button type="button">&times;</button>',
  336. closeClass: 'toast-close-button',
  337. newestOnTop: true,
  338. preventDuplicates: false,
  339. progressBar: false,
  340. progressClass: 'toast-progress',
  341. rtl: false
  342. };
  343. }
  344. function publish(args) {
  345. if (!listener) { return; }
  346. listener(args);
  347. }
  348. function notify(map) {
  349. var options = getOptions();
  350. var iconClass = map.iconClass || options.iconClass;
  351. if (typeof (map.optionsOverride) !== 'undefined') {
  352. options = $.extend(options, map.optionsOverride);
  353. iconClass = map.optionsOverride.iconClass || iconClass;
  354. }
  355. if (shouldExit(options, map)) { return; }
  356. toastId++;
  357. $container = getContainer(options, true);
  358. var intervalId = null;
  359. var $toastElement = $('<div/>');
  360. var $titleElement = $('<div/>');
  361. var $messageElement = $('<div/>');
  362. var $progressElement = $('<div/>');
  363. var $closeElement = $(options.closeHtml);
  364. var progressBar = {
  365. intervalId: null,
  366. hideEta: null,
  367. maxHideTime: null
  368. };
  369. var response = {
  370. toastId: toastId,
  371. state: 'visible',
  372. startTime: new Date(),
  373. options: options,
  374. map: map
  375. };
  376. personalizeToast();
  377. displayToast();
  378. handleEvents();
  379. publish(response);
  380. if (options.debug && console) {
  381. console.log(response);
  382. }
  383. return $toastElement;
  384. function escapeHtml(source) {
  385. if (source == null) {
  386. source = '';
  387. }
  388. return source
  389. .replace(/&/g, '&amp;')
  390. .replace(/"/g, '&quot;')
  391. .replace(/'/g, '&#39;')
  392. .replace(/</g, '&lt;')
  393. .replace(/>/g, '&gt;');
  394. }
  395. function personalizeToast() {
  396. setIcon();
  397. setTitle();
  398. setMessage();
  399. setCloseButton();
  400. setProgressBar();
  401. setRTL();
  402. setSequence();
  403. setAria();
  404. }
  405. function setAria() {
  406. var ariaValue = '';
  407. switch (map.iconClass) {
  408. case 'toast-success':
  409. case 'toast-info':
  410. ariaValue = 'polite';
  411. break;
  412. default:
  413. ariaValue = 'assertive';
  414. }
  415. $toastElement.attr('aria-live', ariaValue);
  416. }
  417. function handleEvents() {
  418. if (options.closeOnHover) {
  419. $toastElement.hover(stickAround, delayedHideToast);
  420. }
  421. if (!options.onclick && options.tapToDismiss) {
  422. $toastElement.click(hideToast);
  423. }
  424. if (options.closeButton && $closeElement) {
  425. $closeElement.click(function (event) {
  426. if (event.stopPropagation) {
  427. event.stopPropagation();
  428. } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
  429. event.cancelBubble = true;
  430. }
  431. if (options.onCloseClick) {
  432. options.onCloseClick(event);
  433. }
  434. hideToast(true);
  435. });
  436. }
  437. if (options.onclick) {
  438. $toastElement.click(function (event) {
  439. options.onclick(event);
  440. hideToast();
  441. });
  442. }
  443. }
  444. function displayToast() {
  445. $toastElement.hide();
  446. $toastElement[options.showMethod](
  447. {duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
  448. );
  449. if (options.timeOut > 0) {
  450. intervalId = setTimeout(hideToast, options.timeOut);
  451. progressBar.maxHideTime = parseFloat(options.timeOut);
  452. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  453. if (options.progressBar) {
  454. progressBar.intervalId = setInterval(updateProgress, 10);
  455. }
  456. }
  457. }
  458. function setIcon() {
  459. if (map.iconClass) {
  460. $toastElement.addClass(options.toastClass).addClass(iconClass);
  461. }
  462. }
  463. function setSequence() {
  464. if (options.newestOnTop) {
  465. $container.prepend($toastElement);
  466. } else {
  467. $container.append($toastElement);
  468. }
  469. }
  470. function setTitle() {
  471. if (map.title) {
  472. var suffix = map.title;
  473. if (options.escapeHtml) {
  474. suffix = escapeHtml(map.title);
  475. }
  476. $titleElement.append(suffix).addClass(options.titleClass);
  477. $toastElement.append($titleElement);
  478. }
  479. }
  480. function setMessage() {
  481. if (map.message) {
  482. var suffix = map.message;
  483. if (options.escapeHtml) {
  484. suffix = escapeHtml(map.message);
  485. }
  486. $messageElement.append(suffix).addClass(options.messageClass);
  487. $toastElement.append($messageElement);
  488. }
  489. }
  490. function setCloseButton() {
  491. if (options.closeButton) {
  492. $closeElement.addClass(options.closeClass).attr('role', 'button');
  493. $toastElement.prepend($closeElement);
  494. }
  495. }
  496. function setProgressBar() {
  497. if (options.progressBar) {
  498. $progressElement.addClass(options.progressClass);
  499. $toastElement.prepend($progressElement);
  500. }
  501. }
  502. function setRTL() {
  503. if (options.rtl) {
  504. $toastElement.addClass('rtl');
  505. }
  506. }
  507. function shouldExit(options, map) {
  508. if (options.preventDuplicates) {
  509. if (map.message === previousToast) {
  510. return true;
  511. } else {
  512. previousToast = map.message;
  513. }
  514. }
  515. return false;
  516. }
  517. function hideToast(override) {
  518. var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
  519. var duration = override && options.closeDuration !== false ?
  520. options.closeDuration : options.hideDuration;
  521. var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
  522. if ($(':focus', $toastElement).length && !override) {
  523. return;
  524. }
  525. clearTimeout(progressBar.intervalId);
  526. return $toastElement[method]({
  527. duration: duration,
  528. easing: easing,
  529. complete: function () {
  530. removeToast($toastElement);
  531. clearTimeout(intervalId);
  532. if (options.onHidden && response.state !== 'hidden') {
  533. options.onHidden();
  534. }
  535. response.state = 'hidden';
  536. response.endTime = new Date();
  537. publish(response);
  538. }
  539. });
  540. }
  541. function delayedHideToast() {
  542. if (options.timeOut > 0 || options.extendedTimeOut > 0) {
  543. intervalId = setTimeout(hideToast, options.extendedTimeOut);
  544. progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
  545. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  546. }
  547. }
  548. function stickAround() {
  549. clearTimeout(intervalId);
  550. progressBar.hideEta = 0;
  551. $toastElement.stop(true, true)[options.showMethod](
  552. {duration: options.showDuration, easing: options.showEasing}
  553. );
  554. }
  555. function updateProgress() {
  556. var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
  557. $progressElement.width(percentage + '%');
  558. }
  559. }
  560. function getOptions() {
  561. return $.extend({}, getDefaults(), toastr.options);
  562. }
  563. function removeToast($toastElement) {
  564. if (!$container) { $container = getContainer(); }
  565. if ($toastElement.is(':visible')) {
  566. return;
  567. }
  568. $toastElement.remove();
  569. $toastElement = null;
  570. if ($container.children().length === 0) {
  571. $container.remove();
  572. previousToast = undefined;
  573. }
  574. }
  575. })();
  576. });
  577. }(typeof define === 'function' && define.amd ? define : function (deps, factory) {
  578. if (typeof module !== 'undefined' && module.exports) { //Node
  579. module.exports = factory(require('jquery'));
  580. } else {
  581. window.toastr = factory(window.jQuery);
  582. }
  583. }));
  584. define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) {
  585. var Fast = {
  586. config: {
  587. //toastr默认配置
  588. toastr: {
  589. "closeButton": true,
  590. "debug": false,
  591. "newestOnTop": false,
  592. "progressBar": false,
  593. "positionClass": "toast-top-center",
  594. "preventDuplicates": false,
  595. "onclick": null,
  596. "showDuration": "300",
  597. "hideDuration": "1000",
  598. "timeOut": "5000",
  599. "extendedTimeOut": "1000",
  600. "showEasing": "swing",
  601. "hideEasing": "linear",
  602. "showMethod": "fadeIn",
  603. "hideMethod": "fadeOut"
  604. }
  605. },
  606. events: {
  607. //请求成功的回调
  608. onAjaxSuccess: function (ret, onAjaxSuccess) {
  609. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  610. var msg = typeof ret.msg !== 'undefined' && ret.msg ? ret.msg : __('Operation completed');
  611. if (typeof onAjaxSuccess === 'function') {
  612. var result = onAjaxSuccess.call(this, data, ret);
  613. if (result === false)
  614. return;
  615. }
  616. Toastr.success(msg);
  617. },
  618. //请求错误的回调
  619. onAjaxError: function (ret, onAjaxError) {
  620. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  621. if (typeof onAjaxError === 'function') {
  622. var result = onAjaxError.call(this, data, ret);
  623. if (result === false) {
  624. return;
  625. }
  626. }
  627. Toastr.error(ret.msg);
  628. },
  629. //服务器响应数据后
  630. onAjaxResponse: function (response) {
  631. try {
  632. var ret = typeof response === 'object' ? response : JSON.parse(response);
  633. if (!ret.hasOwnProperty('code')) {
  634. $.extend(ret, {code: -2, msg: response, data: null});
  635. }
  636. } catch (e) {
  637. var ret = {code: -1, msg: e.message, data: null};
  638. }
  639. return ret;
  640. }
  641. },
  642. api: {
  643. //发送Ajax请求
  644. ajax: function (options, success, error) {
  645. options = typeof options === 'string' ? {url: options} : options;
  646. var index;
  647. if (typeof options.loading === 'undefined' || options.loading) {
  648. index = Layer.load(options.loading || 0);
  649. }
  650. options = $.extend({
  651. type: "POST",
  652. dataType: "json",
  653. xhrFields: {
  654. withCredentials: true
  655. },
  656. success: function (ret) {
  657. index && Layer.close(index);
  658. ret = Fast.events.onAjaxResponse(ret);
  659. if (ret.code === 1) {
  660. Fast.events.onAjaxSuccess(ret, success);
  661. } else {
  662. Fast.events.onAjaxError(ret, error);
  663. }
  664. },
  665. error: function (xhr) {
  666. index && Layer.close(index);
  667. var ret = {code: xhr.status, msg: xhr.statusText, data: null};
  668. Fast.events.onAjaxError(ret, error);
  669. }
  670. }, options);
  671. return $.ajax(options);
  672. },
  673. //修复URL
  674. fixurl: function (url) {
  675. if (url.substr(0, 1) !== "/") {
  676. var r = new RegExp('^(?:[a-z]+:)?//', 'i');
  677. if (!r.test(url)) {
  678. url = Config.moduleurl + "/" + url;
  679. }
  680. } else if (url.substr(0, 8) === "/addons/") {
  681. url = Config.__PUBLIC__.replace(/(\/*$)/g, "") + url;
  682. }
  683. return url;
  684. },
  685. //获取修复后可访问的cdn链接
  686. cdnurl: function (url, domain) {
  687. var rule = new RegExp("^((?:[a-z]+:)?\\/\\/|data:image\\/)", "i");
  688. var cdnurl = Config.upload.cdnurl;
  689. url = rule.test(url) || (cdnurl && url.indexOf(cdnurl) === 0) ? url : cdnurl + url;
  690. if (domain && !rule.test(url)) {
  691. domain = typeof domain === 'string' ? domain : location.origin;
  692. url = domain + url;
  693. }
  694. return url;
  695. },
  696. //查询Url参数
  697. query: function (name, url) {
  698. if (!url) {
  699. url = window.location.href;
  700. }
  701. name = name.replace(/[\[\]]/g, "\\$&");
  702. var regex = new RegExp("[?&/]" + name + "([=/]([^&#/?]*)|&|#|$)"),
  703. results = regex.exec(url);
  704. if (!results)
  705. return null;
  706. if (!results[2])
  707. return '';
  708. return decodeURIComponent(results[2].replace(/\+/g, " "));
  709. },
  710. //打开一个弹出窗口
  711. open: function (url, title, options) {
  712. title = options && options.title ? options.title : (title ? title : "");
  713. url = Fast.api.fixurl(url);
  714. url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
  715. var area = Fast.config.openArea != undefined ? Fast.config.openArea : [$(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%'];
  716. options = $.extend({
  717. type: 2,
  718. title: title,
  719. shadeClose: true,
  720. shade: false,
  721. maxmin: true,
  722. moveOut: true,
  723. area: area,
  724. content: url,
  725. zIndex: Layer.zIndex,
  726. success: function (layero, index) {
  727. var that = this;
  728. //存储callback事件
  729. $(layero).data("callback", that.callback);
  730. //$(layero).removeClass("layui-layer-border");
  731. Layer.setTop(layero);
  732. try {
  733. var frame = Layer.getChildFrame('html', index);
  734. var layerfooter = frame.find(".layer-footer");
  735. Fast.api.layerfooter(layero, index, that);
  736. //绑定事件
  737. if (layerfooter.length > 0) {
  738. // 监听窗口内的元素及属性变化
  739. // Firefox和Chrome早期版本中带有前缀
  740. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
  741. if (MutationObserver) {
  742. // 选择目标节点
  743. var target = layerfooter[0];
  744. // 创建观察者对象
  745. var observer = new MutationObserver(function (mutations) {
  746. Fast.api.layerfooter(layero, index, that);
  747. mutations.forEach(function (mutation) {
  748. });
  749. });
  750. // 配置观察选项:
  751. var config = {attributes: true, childList: true, characterData: true, subtree: true}
  752. // 传入目标节点和观察选项
  753. observer.observe(target, config);
  754. // 随后,你还可以停止观察
  755. // observer.disconnect();
  756. }
  757. }
  758. } catch (e) {
  759. }
  760. if ($(layero).height() > $(window).height()) {
  761. //当弹出窗口大于浏览器可视高度时,重定位
  762. Layer.style(index, {
  763. top: 0,
  764. height: $(window).height()
  765. });
  766. }
  767. }
  768. }, options ? options : {});
  769. if ($(window).width() < 480 || (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && top.$(".tab-pane.active").length > 0)) {
  770. if (top.$(".tab-pane.active").length > 0) {
  771. options.area = [top.$(".tab-pane.active").width() + "px", top.$(".tab-pane.active").height() + "px"];
  772. options.offset = [top.$(".tab-pane.active").scrollTop() + "px", "0px"];
  773. } else {
  774. options.area = [$(window).width() + "px", $(window).height() + "px"];
  775. options.offset = ["0px", "0px"];
  776. }
  777. }
  778. return Layer.open(options);
  779. },
  780. //关闭窗口并回传数据
  781. close: function (data) {
  782. var index = parent.Layer.getFrameIndex(window.name);
  783. var callback = parent.$("#layui-layer" + index).data("callback");
  784. //再执行关闭
  785. parent.Layer.close(index);
  786. //再调用回传函数
  787. if (typeof callback === 'function') {
  788. callback.call(undefined, data);
  789. }
  790. },
  791. layerfooter: function (layero, index, that) {
  792. var frame = Layer.getChildFrame('html', index);
  793. var layerfooter = frame.find(".layer-footer");
  794. if (layerfooter.length > 0) {
  795. $(".layui-layer-footer", layero).remove();
  796. var footer = $("<div />").addClass('layui-layer-btn layui-layer-footer');
  797. footer.html(layerfooter.html());
  798. if ($(".row", footer).length === 0) {
  799. $(">", footer).wrapAll("<div class='row'></div>");
  800. }
  801. footer.insertAfter(layero.find('.layui-layer-content'));
  802. //绑定事件
  803. footer.on("click", ".btn", function () {
  804. if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
  805. return;
  806. }
  807. var index = footer.find('.btn').index(this);
  808. $(".btn:eq(" + index + ")", layerfooter).trigger("click");
  809. });
  810. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  811. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  812. //重设iframe高度
  813. $("iframe", layero).height(layero.height() - titHeight - btnHeight);
  814. }
  815. //修复iOS下弹出窗口的高度和iOS下iframe无法滚动的BUG
  816. if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
  817. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  818. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  819. $("iframe", layero).parent().css("height", layero.height() - titHeight - btnHeight);
  820. $("iframe", layero).css("height", "100%");
  821. }
  822. },
  823. success: function (options, callback) {
  824. var type = typeof options === 'function';
  825. if (type) {
  826. callback = options;
  827. }
  828. return Layer.msg(__('Operation completed'), $.extend({
  829. offset: 0, icon: 1
  830. }, type ? {} : options), callback);
  831. },
  832. error: function (options, callback) {
  833. var type = typeof options === 'function';
  834. if (type) {
  835. callback = options;
  836. }
  837. return Layer.msg(__('Operation failed'), $.extend({
  838. offset: 0, icon: 2
  839. }, type ? {} : options), callback);
  840. },
  841. msg: function (message, url) {
  842. var callback = typeof url === 'function' ? url : function () {
  843. if (typeof url !== 'undefined' && url) {
  844. location.href = url;
  845. }
  846. };
  847. Layer.msg(message, {
  848. time: 2000
  849. }, callback);
  850. },
  851. toastr: Toastr,
  852. layer: Layer
  853. },
  854. lang: function () {
  855. var args = arguments,
  856. string = args[0],
  857. i = 1;
  858. string = string.toLowerCase();
  859. //string = typeof Lang[string] != 'undefined' ? Lang[string] : string;
  860. if (typeof Lang !== 'undefined' && typeof Lang[string] !== 'undefined') {
  861. if (typeof Lang[string] == 'object')
  862. return Lang[string];
  863. string = Lang[string];
  864. } else if (string.indexOf('.') !== -1 && false) {
  865. var arr = string.split('.');
  866. var current = Lang[arr[0]];
  867. for (var i = 1; i < arr.length; i++) {
  868. current = typeof current[arr[i]] != 'undefined' ? current[arr[i]] : '';
  869. if (typeof current != 'object')
  870. break;
  871. }
  872. if (typeof current == 'object')
  873. return current;
  874. string = current;
  875. } else {
  876. string = args[0];
  877. }
  878. return string.replace(/%((%)|s|d)/g, function (m) {
  879. // m is the matched format, e.g. %s, %d
  880. var val = null;
  881. if (m[2]) {
  882. val = m[2];
  883. } else {
  884. val = args[i];
  885. // A switch statement so that the formatter can be extended. Default is %s
  886. switch (m) {
  887. case '%d':
  888. val = parseFloat(val);
  889. if (isNaN(val)) {
  890. val = 0;
  891. }
  892. break;
  893. }
  894. i++;
  895. }
  896. return val;
  897. });
  898. },
  899. init: function () {
  900. // 对相对地址进行处理
  901. $.ajaxSetup({
  902. beforeSend: function (xhr, setting) {
  903. setting.url = Fast.api.fixurl(setting.url);
  904. }
  905. });
  906. Layer.config({
  907. skin: 'layui-layer-fast'
  908. });
  909. // 绑定ESC关闭窗口事件
  910. $(window).keyup(function (e) {
  911. if (e.keyCode == 27) {
  912. if ($(".layui-layer").length > 0) {
  913. var index = 0;
  914. $(".layui-layer").each(function () {
  915. index = Math.max(index, parseInt($(this).attr("times")));
  916. });
  917. if (index) {
  918. Layer.close(index);
  919. }
  920. }
  921. }
  922. });
  923. //公共代码
  924. //配置Toastr的参数
  925. Toastr.options = Fast.config.toastr;
  926. }
  927. };
  928. //将Layer暴露到全局中去
  929. window.Layer = Layer;
  930. //将Toastr暴露到全局中去
  931. window.Toastr = Toastr;
  932. //将语言方法暴露到全局中去
  933. window.__ = Fast.lang;
  934. //将Fast渲染至全局
  935. window.Fast = Fast;
  936. //默认初始化执行的代码
  937. Fast.init();
  938. return Fast;
  939. });
  940. /*!art-template - Template Engine | http://aui.github.com/artTemplate/*/
  941. !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}();
  942. //! moment.js
  943. //! version : 2.29.3
  944. //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
  945. //! license : MIT
  946. //! momentjs.com
  947. ;(function (global, factory) {
  948. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  949. typeof define === 'function' && define.amd ? define('moment/moment',factory) :
  950. global.moment = factory()
  951. }(this, (function () { 'use strict';
  952. var hookCallback;
  953. function hooks() {
  954. return hookCallback.apply(null, arguments);
  955. }
  956. // This is done to register the method called with moment()
  957. // without creating circular dependencies.
  958. function setHookCallback(callback) {
  959. hookCallback = callback;
  960. }
  961. function isArray(input) {
  962. return (
  963. input instanceof Array ||
  964. Object.prototype.toString.call(input) === '[object Array]'
  965. );
  966. }
  967. function isObject(input) {
  968. // IE8 will treat undefined and null as object if it wasn't for
  969. // input != null
  970. return (
  971. input != null &&
  972. Object.prototype.toString.call(input) === '[object Object]'
  973. );
  974. }
  975. function hasOwnProp(a, b) {
  976. return Object.prototype.hasOwnProperty.call(a, b);
  977. }
  978. function isObjectEmpty(obj) {
  979. if (Object.getOwnPropertyNames) {
  980. return Object.getOwnPropertyNames(obj).length === 0;
  981. } else {
  982. var k;
  983. for (k in obj) {
  984. if (hasOwnProp(obj, k)) {
  985. return false;
  986. }
  987. }
  988. return true;
  989. }
  990. }
  991. function isUndefined(input) {
  992. return input === void 0;
  993. }
  994. function isNumber(input) {
  995. return (
  996. typeof input === 'number' ||
  997. Object.prototype.toString.call(input) === '[object Number]'
  998. );
  999. }
  1000. function isDate(input) {
  1001. return (
  1002. input instanceof Date ||
  1003. Object.prototype.toString.call(input) === '[object Date]'
  1004. );
  1005. }
  1006. function map(arr, fn) {
  1007. var res = [],
  1008. i,
  1009. arrLen = arr.length;
  1010. for (i = 0; i < arrLen; ++i) {
  1011. res.push(fn(arr[i], i));
  1012. }
  1013. return res;
  1014. }
  1015. function extend(a, b) {
  1016. for (var i in b) {
  1017. if (hasOwnProp(b, i)) {
  1018. a[i] = b[i];
  1019. }
  1020. }
  1021. if (hasOwnProp(b, 'toString')) {
  1022. a.toString = b.toString;
  1023. }
  1024. if (hasOwnProp(b, 'valueOf')) {
  1025. a.valueOf = b.valueOf;
  1026. }
  1027. return a;
  1028. }
  1029. function createUTC(input, format, locale, strict) {
  1030. return createLocalOrUTC(input, format, locale, strict, true).utc();
  1031. }
  1032. function defaultParsingFlags() {
  1033. // We need to deep clone this object.
  1034. return {
  1035. empty: false,
  1036. unusedTokens: [],
  1037. unusedInput: [],
  1038. overflow: -2,
  1039. charsLeftOver: 0,
  1040. nullInput: false,
  1041. invalidEra: null,
  1042. invalidMonth: null,
  1043. invalidFormat: false,
  1044. userInvalidated: false,
  1045. iso: false,
  1046. parsedDateParts: [],
  1047. era: null,
  1048. meridiem: null,
  1049. rfc2822: false,
  1050. weekdayMismatch: false,
  1051. };
  1052. }
  1053. function getParsingFlags(m) {
  1054. if (m._pf == null) {
  1055. m._pf = defaultParsingFlags();
  1056. }
  1057. return m._pf;
  1058. }
  1059. var some;
  1060. if (Array.prototype.some) {
  1061. some = Array.prototype.some;
  1062. } else {
  1063. some = function (fun) {
  1064. var t = Object(this),
  1065. len = t.length >>> 0,
  1066. i;
  1067. for (i = 0; i < len; i++) {
  1068. if (i in t && fun.call(this, t[i], i, t)) {
  1069. return true;
  1070. }
  1071. }
  1072. return false;
  1073. };
  1074. }
  1075. function isValid(m) {
  1076. if (m._isValid == null) {
  1077. var flags = getParsingFlags(m),
  1078. parsedParts = some.call(flags.parsedDateParts, function (i) {
  1079. return i != null;
  1080. }),
  1081. isNowValid =
  1082. !isNaN(m._d.getTime()) &&
  1083. flags.overflow < 0 &&
  1084. !flags.empty &&
  1085. !flags.invalidEra &&
  1086. !flags.invalidMonth &&
  1087. !flags.invalidWeekday &&
  1088. !flags.weekdayMismatch &&
  1089. !flags.nullInput &&
  1090. !flags.invalidFormat &&
  1091. !flags.userInvalidated &&
  1092. (!flags.meridiem || (flags.meridiem && parsedParts));
  1093. if (m._strict) {
  1094. isNowValid =
  1095. isNowValid &&
  1096. flags.charsLeftOver === 0 &&
  1097. flags.unusedTokens.length === 0 &&
  1098. flags.bigHour === undefined;
  1099. }
  1100. if (Object.isFrozen == null || !Object.isFrozen(m)) {
  1101. m._isValid = isNowValid;
  1102. } else {
  1103. return isNowValid;
  1104. }
  1105. }
  1106. return m._isValid;
  1107. }
  1108. function createInvalid(flags) {
  1109. var m = createUTC(NaN);
  1110. if (flags != null) {
  1111. extend(getParsingFlags(m), flags);
  1112. } else {
  1113. getParsingFlags(m).userInvalidated = true;
  1114. }
  1115. return m;
  1116. }
  1117. // Plugins that add properties should also add the key here (null value),
  1118. // so we can properly clone ourselves.
  1119. var momentProperties = (hooks.momentProperties = []),
  1120. updateInProgress = false;
  1121. function copyConfig(to, from) {
  1122. var i,
  1123. prop,
  1124. val,
  1125. momentPropertiesLen = momentProperties.length;
  1126. if (!isUndefined(from._isAMomentObject)) {
  1127. to._isAMomentObject = from._isAMomentObject;
  1128. }
  1129. if (!isUndefined(from._i)) {
  1130. to._i = from._i;
  1131. }
  1132. if (!isUndefined(from._f)) {
  1133. to._f = from._f;
  1134. }
  1135. if (!isUndefined(from._l)) {
  1136. to._l = from._l;
  1137. }
  1138. if (!isUndefined(from._strict)) {
  1139. to._strict = from._strict;
  1140. }
  1141. if (!isUndefined(from._tzm)) {
  1142. to._tzm = from._tzm;
  1143. }
  1144. if (!isUndefined(from._isUTC)) {
  1145. to._isUTC = from._isUTC;
  1146. }
  1147. if (!isUndefined(from._offset)) {
  1148. to._offset = from._offset;
  1149. }
  1150. if (!isUndefined(from._pf)) {
  1151. to._pf = getParsingFlags(from);
  1152. }
  1153. if (!isUndefined(from._locale)) {
  1154. to._locale = from._locale;
  1155. }
  1156. if (momentPropertiesLen > 0) {
  1157. for (i = 0; i < momentPropertiesLen; i++) {
  1158. prop = momentProperties[i];
  1159. val = from[prop];
  1160. if (!isUndefined(val)) {
  1161. to[prop] = val;
  1162. }
  1163. }
  1164. }
  1165. return to;
  1166. }
  1167. // Moment prototype object
  1168. function Moment(config) {
  1169. copyConfig(this, config);
  1170. this._d = new Date(config._d != null ? config._d.getTime() : NaN);
  1171. if (!this.isValid()) {
  1172. this._d = new Date(NaN);
  1173. }
  1174. // Prevent infinite loop in case updateOffset creates new moment
  1175. // objects.
  1176. if (updateInProgress === false) {
  1177. updateInProgress = true;
  1178. hooks.updateOffset(this);
  1179. updateInProgress = false;
  1180. }
  1181. }
  1182. function isMoment(obj) {
  1183. return (
  1184. obj instanceof Moment || (obj != null && obj._isAMomentObject != null)
  1185. );
  1186. }
  1187. function warn(msg) {
  1188. if (
  1189. hooks.suppressDeprecationWarnings === false &&
  1190. typeof console !== 'undefined' &&
  1191. console.warn
  1192. ) {
  1193. console.warn('Deprecation warning: ' + msg);
  1194. }
  1195. }
  1196. function deprecate(msg, fn) {
  1197. var firstTime = true;
  1198. return extend(function () {
  1199. if (hooks.deprecationHandler != null) {
  1200. hooks.deprecationHandler(null, msg);
  1201. }
  1202. if (firstTime) {
  1203. var args = [],
  1204. arg,
  1205. i,
  1206. key,
  1207. argLen = arguments.length;
  1208. for (i = 0; i < argLen; i++) {
  1209. arg = '';
  1210. if (typeof arguments[i] === 'object') {
  1211. arg += '\n[' + i + '] ';
  1212. for (key in arguments[0]) {
  1213. if (hasOwnProp(arguments[0], key)) {
  1214. arg += key + ': ' + arguments[0][key] + ', ';
  1215. }
  1216. }
  1217. arg = arg.slice(0, -2); // Remove trailing comma and space
  1218. } else {
  1219. arg = arguments[i];
  1220. }
  1221. args.push(arg);
  1222. }
  1223. warn(
  1224. msg +
  1225. '\nArguments: ' +
  1226. Array.prototype.slice.call(args).join('') +
  1227. '\n' +
  1228. new Error().stack
  1229. );
  1230. firstTime = false;
  1231. }
  1232. return fn.apply(this, arguments);
  1233. }, fn);
  1234. }
  1235. var deprecations = {};
  1236. function deprecateSimple(name, msg) {
  1237. if (hooks.deprecationHandler != null) {
  1238. hooks.deprecationHandler(name, msg);
  1239. }
  1240. if (!deprecations[name]) {
  1241. warn(msg);
  1242. deprecations[name] = true;
  1243. }
  1244. }
  1245. hooks.suppressDeprecationWarnings = false;
  1246. hooks.deprecationHandler = null;
  1247. function isFunction(input) {
  1248. return (
  1249. (typeof Function !== 'undefined' && input instanceof Function) ||
  1250. Object.prototype.toString.call(input) === '[object Function]'
  1251. );
  1252. }
  1253. function set(config) {
  1254. var prop, i;
  1255. for (i in config) {
  1256. if (hasOwnProp(config, i)) {
  1257. prop = config[i];
  1258. if (isFunction(prop)) {
  1259. this[i] = prop;
  1260. } else {
  1261. this['_' + i] = prop;
  1262. }
  1263. }
  1264. }
  1265. this._config = config;
  1266. // Lenient ordinal parsing accepts just a number in addition to
  1267. // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
  1268. // TODO: Remove "ordinalParse" fallback in next major release.
  1269. this._dayOfMonthOrdinalParseLenient = new RegExp(
  1270. (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
  1271. '|' +
  1272. /\d{1,2}/.source
  1273. );
  1274. }
  1275. function mergeConfigs(parentConfig, childConfig) {
  1276. var res = extend({}, parentConfig),
  1277. prop;
  1278. for (prop in childConfig) {
  1279. if (hasOwnProp(childConfig, prop)) {
  1280. if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
  1281. res[prop] = {};
  1282. extend(res[prop], parentConfig[prop]);
  1283. extend(res[prop], childConfig[prop]);
  1284. } else if (childConfig[prop] != null) {
  1285. res[prop] = childConfig[prop];
  1286. } else {
  1287. delete res[prop];
  1288. }
  1289. }
  1290. }
  1291. for (prop in parentConfig) {
  1292. if (
  1293. hasOwnProp(parentConfig, prop) &&
  1294. !hasOwnProp(childConfig, prop) &&
  1295. isObject(parentConfig[prop])
  1296. ) {
  1297. // make sure changes to properties don't modify parent config
  1298. res[prop] = extend({}, res[prop]);
  1299. }
  1300. }
  1301. return res;
  1302. }
  1303. function Locale(config) {
  1304. if (config != null) {
  1305. this.set(config);
  1306. }
  1307. }
  1308. var keys;
  1309. if (Object.keys) {
  1310. keys = Object.keys;
  1311. } else {
  1312. keys = function (obj) {
  1313. var i,
  1314. res = [];
  1315. for (i in obj) {
  1316. if (hasOwnProp(obj, i)) {
  1317. res.push(i);
  1318. }
  1319. }
  1320. return res;
  1321. };
  1322. }
  1323. var defaultCalendar = {
  1324. sameDay: '[Today at] LT',
  1325. nextDay: '[Tomorrow at] LT',
  1326. nextWeek: 'dddd [at] LT',
  1327. lastDay: '[Yesterday at] LT',
  1328. lastWeek: '[Last] dddd [at] LT',
  1329. sameElse: 'L',
  1330. };
  1331. function calendar(key, mom, now) {
  1332. var output = this._calendar[key] || this._calendar['sameElse'];
  1333. return isFunction(output) ? output.call(mom, now) : output;
  1334. }
  1335. function zeroFill(number, targetLength, forceSign) {
  1336. var absNumber = '' + Math.abs(number),
  1337. zerosToFill = targetLength - absNumber.length,
  1338. sign = number >= 0;
  1339. return (
  1340. (sign ? (forceSign ? '+' : '') : '-') +
  1341. Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +
  1342. absNumber
  1343. );
  1344. }
  1345. var formattingTokens =
  1346. /(\[[^\[]*\])|(\\)?([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,
  1347. localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
  1348. formatFunctions = {},
  1349. formatTokenFunctions = {};
  1350. // token: 'M'
  1351. // padded: ['MM', 2]
  1352. // ordinal: 'Mo'
  1353. // callback: function () { this.month() + 1 }
  1354. function addFormatToken(token, padded, ordinal, callback) {
  1355. var func = callback;
  1356. if (typeof callback === 'string') {
  1357. func = function () {
  1358. return this[callback]();
  1359. };
  1360. }
  1361. if (token) {
  1362. formatTokenFunctions[token] = func;
  1363. }
  1364. if (padded) {
  1365. formatTokenFunctions[padded[0]] = function () {
  1366. return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
  1367. };
  1368. }
  1369. if (ordinal) {
  1370. formatTokenFunctions[ordinal] = function () {
  1371. return this.localeData().ordinal(
  1372. func.apply(this, arguments),
  1373. token
  1374. );
  1375. };
  1376. }
  1377. }
  1378. function removeFormattingTokens(input) {
  1379. if (input.match(/\[[\s\S]/)) {
  1380. return input.replace(/^\[|\]$/g, '');
  1381. }
  1382. return input.replace(/\\/g, '');
  1383. }
  1384. function makeFormatFunction(format) {
  1385. var array = format.match(formattingTokens),
  1386. i,
  1387. length;
  1388. for (i = 0, length = array.length; i < length; i++) {
  1389. if (formatTokenFunctions[array[i]]) {
  1390. array[i] = formatTokenFunctions[array[i]];
  1391. } else {
  1392. array[i] = removeFormattingTokens(array[i]);
  1393. }
  1394. }
  1395. return function (mom) {
  1396. var output = '',
  1397. i;
  1398. for (i = 0; i < length; i++) {
  1399. output += isFunction(array[i])
  1400. ? array[i].call(mom, format)
  1401. : array[i];
  1402. }
  1403. return output;
  1404. };
  1405. }
  1406. // format date using native date object
  1407. function formatMoment(m, format) {
  1408. if (!m.isValid()) {
  1409. return m.localeData().invalidDate();
  1410. }
  1411. format = expandFormat(format, m.localeData());
  1412. formatFunctions[format] =
  1413. formatFunctions[format] || makeFormatFunction(format);
  1414. return formatFunctions[format](m);
  1415. }
  1416. function expandFormat(format, locale) {
  1417. var i = 5;
  1418. function replaceLongDateFormatTokens(input) {
  1419. return locale.longDateFormat(input) || input;
  1420. }
  1421. localFormattingTokens.lastIndex = 0;
  1422. while (i >= 0 && localFormattingTokens.test(format)) {
  1423. format = format.replace(
  1424. localFormattingTokens,
  1425. replaceLongDateFormatTokens
  1426. );
  1427. localFormattingTokens.lastIndex = 0;
  1428. i -= 1;
  1429. }
  1430. return format;
  1431. }
  1432. var defaultLongDateFormat = {
  1433. LTS: 'h:mm:ss A',
  1434. LT: 'h:mm A',
  1435. L: 'MM/DD/YYYY',
  1436. LL: 'MMMM D, YYYY',
  1437. LLL: 'MMMM D, YYYY h:mm A',
  1438. LLLL: 'dddd, MMMM D, YYYY h:mm A',
  1439. };
  1440. function longDateFormat(key) {
  1441. var format = this._longDateFormat[key],
  1442. formatUpper = this._longDateFormat[key.toUpperCase()];
  1443. if (format || !formatUpper) {
  1444. return format;
  1445. }
  1446. this._longDateFormat[key] = formatUpper
  1447. .match(formattingTokens)
  1448. .map(function (tok) {
  1449. if (
  1450. tok === 'MMMM' ||
  1451. tok === 'MM' ||
  1452. tok === 'DD' ||
  1453. tok === 'dddd'
  1454. ) {
  1455. return tok.slice(1);
  1456. }
  1457. return tok;
  1458. })
  1459. .join('');
  1460. return this._longDateFormat[key];
  1461. }
  1462. var defaultInvalidDate = 'Invalid date';
  1463. function invalidDate() {
  1464. return this._invalidDate;
  1465. }
  1466. var defaultOrdinal = '%d',
  1467. defaultDayOfMonthOrdinalParse = /\d{1,2}/;
  1468. function ordinal(number) {
  1469. return this._ordinal.replace('%d', number);
  1470. }
  1471. var defaultRelativeTime = {
  1472. future: 'in %s',
  1473. past: '%s ago',
  1474. s: 'a few seconds',
  1475. ss: '%d seconds',
  1476. m: 'a minute',
  1477. mm: '%d minutes',
  1478. h: 'an hour',
  1479. hh: '%d hours',
  1480. d: 'a day',
  1481. dd: '%d days',
  1482. w: 'a week',
  1483. ww: '%d weeks',
  1484. M: 'a month',
  1485. MM: '%d months',
  1486. y: 'a year',
  1487. yy: '%d years',
  1488. };
  1489. function relativeTime(number, withoutSuffix, string, isFuture) {
  1490. var output = this._relativeTime[string];
  1491. return isFunction(output)
  1492. ? output(number, withoutSuffix, string, isFuture)
  1493. : output.replace(/%d/i, number);
  1494. }
  1495. function pastFuture(diff, output) {
  1496. var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
  1497. return isFunction(format) ? format(output) : format.replace(/%s/i, output);
  1498. }
  1499. var aliases = {};
  1500. function addUnitAlias(unit, shorthand) {
  1501. var lowerCase = unit.toLowerCase();
  1502. aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
  1503. }
  1504. function normalizeUnits(units) {
  1505. return typeof units === 'string'
  1506. ? aliases[units] || aliases[units.toLowerCase()]
  1507. : undefined;
  1508. }
  1509. function normalizeObjectUnits(inputObject) {
  1510. var normalizedInput = {},
  1511. normalizedProp,
  1512. prop;
  1513. for (prop in inputObject) {
  1514. if (hasOwnProp(inputObject, prop)) {
  1515. normalizedProp = normalizeUnits(prop);
  1516. if (normalizedProp) {
  1517. normalizedInput[normalizedProp] = inputObject[prop];
  1518. }
  1519. }
  1520. }
  1521. return normalizedInput;
  1522. }
  1523. var priorities = {};
  1524. function addUnitPriority(unit, priority) {
  1525. priorities[unit] = priority;
  1526. }
  1527. function getPrioritizedUnits(unitsObj) {
  1528. var units = [],
  1529. u;
  1530. for (u in unitsObj) {
  1531. if (hasOwnProp(unitsObj, u)) {
  1532. units.push({ unit: u, priority: priorities[u] });
  1533. }
  1534. }
  1535. units.sort(function (a, b) {
  1536. return a.priority - b.priority;
  1537. });
  1538. return units;
  1539. }
  1540. function isLeapYear(year) {
  1541. return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
  1542. }
  1543. function absFloor(number) {
  1544. if (number < 0) {
  1545. // -0 -> 0
  1546. return Math.ceil(number) || 0;
  1547. } else {
  1548. return Math.floor(number);
  1549. }
  1550. }
  1551. function toInt(argumentForCoercion) {
  1552. var coercedNumber = +argumentForCoercion,
  1553. value = 0;
  1554. if (coercedNumber !== 0 && isFinite(coercedNumber)) {
  1555. value = absFloor(coercedNumber);
  1556. }
  1557. return value;
  1558. }
  1559. function makeGetSet(unit, keepTime) {
  1560. return function (value) {
  1561. if (value != null) {
  1562. set$1(this, unit, value);
  1563. hooks.updateOffset(this, keepTime);
  1564. return this;
  1565. } else {
  1566. return get(this, unit);
  1567. }
  1568. };
  1569. }
  1570. function get(mom, unit) {
  1571. return mom.isValid()
  1572. ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]()
  1573. : NaN;
  1574. }
  1575. function set$1(mom, unit, value) {
  1576. if (mom.isValid() && !isNaN(value)) {
  1577. if (
  1578. unit === 'FullYear' &&
  1579. isLeapYear(mom.year()) &&
  1580. mom.month() === 1 &&
  1581. mom.date() === 29
  1582. ) {
  1583. value = toInt(value);
  1584. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](
  1585. value,
  1586. mom.month(),
  1587. daysInMonth(value, mom.month())
  1588. );
  1589. } else {
  1590. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
  1591. }
  1592. }
  1593. }
  1594. // MOMENTS
  1595. function stringGet(units) {
  1596. units = normalizeUnits(units);
  1597. if (isFunction(this[units])) {
  1598. return this[units]();
  1599. }
  1600. return this;
  1601. }
  1602. function stringSet(units, value) {
  1603. if (typeof units === 'object') {
  1604. units = normalizeObjectUnits(units);
  1605. var prioritized = getPrioritizedUnits(units),
  1606. i,
  1607. prioritizedLen = prioritized.length;
  1608. for (i = 0; i < prioritizedLen; i++) {
  1609. this[prioritized[i].unit](units[prioritized[i].unit]);
  1610. }
  1611. } else {
  1612. units = normalizeUnits(units);
  1613. if (isFunction(this[units])) {
  1614. return this[units](value);
  1615. }
  1616. }
  1617. return this;
  1618. }
  1619. var match1 = /\d/, // 0 - 9
  1620. match2 = /\d\d/, // 00 - 99
  1621. match3 = /\d{3}/, // 000 - 999
  1622. match4 = /\d{4}/, // 0000 - 9999
  1623. match6 = /[+-]?\d{6}/, // -999999 - 999999
  1624. match1to2 = /\d\d?/, // 0 - 99
  1625. match3to4 = /\d\d\d\d?/, // 999 - 9999
  1626. match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999
  1627. match1to3 = /\d{1,3}/, // 0 - 999
  1628. match1to4 = /\d{1,4}/, // 0 - 9999
  1629. match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999
  1630. matchUnsigned = /\d+/, // 0 - inf
  1631. matchSigned = /[+-]?\d+/, // -inf - inf
  1632. matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
  1633. matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z
  1634. matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
  1635. // any word (or two) characters or numbers including two/three word month in arabic.
  1636. // includes scottish gaelic two word and hyphenated months
  1637. matchWord =
  1638. /[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,
  1639. regexes;
  1640. regexes = {};
  1641. function addRegexToken(token, regex, strictRegex) {
  1642. regexes[token] = isFunction(regex)
  1643. ? regex
  1644. : function (isStrict, localeData) {
  1645. return isStrict && strictRegex ? strictRegex : regex;
  1646. };
  1647. }
  1648. function getParseRegexForToken(token, config) {
  1649. if (!hasOwnProp(regexes, token)) {
  1650. return new RegExp(unescapeFormat(token));
  1651. }
  1652. return regexes[token](config._strict, config._locale);
  1653. }
  1654. // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
  1655. function unescapeFormat(s) {
  1656. return regexEscape(
  1657. s
  1658. .replace('\\', '')
  1659. .replace(
  1660. /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
  1661. function (matched, p1, p2, p3, p4) {
  1662. return p1 || p2 || p3 || p4;
  1663. }
  1664. )
  1665. );
  1666. }
  1667. function regexEscape(s) {
  1668. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  1669. }
  1670. var tokens = {};
  1671. function addParseToken(token, callback) {
  1672. var i,
  1673. func = callback,
  1674. tokenLen;
  1675. if (typeof token === 'string') {
  1676. token = [token];
  1677. }
  1678. if (isNumber(callback)) {
  1679. func = function (input, array) {
  1680. array[callback] = toInt(input);
  1681. };
  1682. }
  1683. tokenLen = token.length;
  1684. for (i = 0; i < tokenLen; i++) {
  1685. tokens[token[i]] = func;
  1686. }
  1687. }
  1688. function addWeekParseToken(token, callback) {
  1689. addParseToken(token, function (input, array, config, token) {
  1690. config._w = config._w || {};
  1691. callback(input, config._w, config, token);
  1692. });
  1693. }
  1694. function addTimeToArrayFromToken(token, input, config) {
  1695. if (input != null && hasOwnProp(tokens, token)) {
  1696. tokens[token](input, config._a, config, token);
  1697. }
  1698. }
  1699. var YEAR = 0,
  1700. MONTH = 1,
  1701. DATE = 2,
  1702. HOUR = 3,
  1703. MINUTE = 4,
  1704. SECOND = 5,
  1705. MILLISECOND = 6,
  1706. WEEK = 7,
  1707. WEEKDAY = 8;
  1708. function mod(n, x) {
  1709. return ((n % x) + x) % x;
  1710. }
  1711. var indexOf;
  1712. if (Array.prototype.indexOf) {
  1713. indexOf = Array.prototype.indexOf;
  1714. } else {
  1715. indexOf = function (o) {
  1716. // I know
  1717. var i;
  1718. for (i = 0; i < this.length; ++i) {
  1719. if (this[i] === o) {
  1720. return i;
  1721. }
  1722. }
  1723. return -1;
  1724. };
  1725. }
  1726. function daysInMonth(year, month) {
  1727. if (isNaN(year) || isNaN(month)) {
  1728. return NaN;
  1729. }
  1730. var modMonth = mod(month, 12);
  1731. year += (month - modMonth) / 12;
  1732. return modMonth === 1
  1733. ? isLeapYear(year)
  1734. ? 29
  1735. : 28
  1736. : 31 - ((modMonth % 7) % 2);
  1737. }
  1738. // FORMATTING
  1739. addFormatToken('M', ['MM', 2], 'Mo', function () {
  1740. return this.month() + 1;
  1741. });
  1742. addFormatToken('MMM', 0, 0, function (format) {
  1743. return this.localeData().monthsShort(this, format);
  1744. });
  1745. addFormatToken('MMMM', 0, 0, function (format) {
  1746. return this.localeData().months(this, format);
  1747. });
  1748. // ALIASES
  1749. addUnitAlias('month', 'M');
  1750. // PRIORITY
  1751. addUnitPriority('month', 8);
  1752. // PARSING
  1753. addRegexToken('M', match1to2);
  1754. addRegexToken('MM', match1to2, match2);
  1755. addRegexToken('MMM', function (isStrict, locale) {
  1756. return locale.monthsShortRegex(isStrict);
  1757. });
  1758. addRegexToken('MMMM', function (isStrict, locale) {
  1759. return locale.monthsRegex(isStrict);
  1760. });
  1761. addParseToken(['M', 'MM'], function (input, array) {
  1762. array[MONTH] = toInt(input) - 1;
  1763. });
  1764. addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
  1765. var month = config._locale.monthsParse(input, token, config._strict);
  1766. // if we didn't find a month name, mark the date as invalid.
  1767. if (month != null) {
  1768. array[MONTH] = month;
  1769. } else {
  1770. getParsingFlags(config).invalidMonth = input;
  1771. }
  1772. });
  1773. // LOCALES
  1774. var defaultLocaleMonths =
  1775. 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
  1776. '_'
  1777. ),
  1778. defaultLocaleMonthsShort =
  1779. 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
  1780. MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
  1781. defaultMonthsShortRegex = matchWord,
  1782. defaultMonthsRegex = matchWord;
  1783. function localeMonths(m, format) {
  1784. if (!m) {
  1785. return isArray(this._months)
  1786. ? this._months
  1787. : this._months['standalone'];
  1788. }
  1789. return isArray(this._months)
  1790. ? this._months[m.month()]
  1791. : this._months[
  1792. (this._months.isFormat || MONTHS_IN_FORMAT).test(format)
  1793. ? 'format'
  1794. : 'standalone'
  1795. ][m.month()];
  1796. }
  1797. function localeMonthsShort(m, format) {
  1798. if (!m) {
  1799. return isArray(this._monthsShort)
  1800. ? this._monthsShort
  1801. : this._monthsShort['standalone'];
  1802. }
  1803. return isArray(this._monthsShort)
  1804. ? this._monthsShort[m.month()]
  1805. : this._monthsShort[
  1806. MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'
  1807. ][m.month()];
  1808. }
  1809. function handleStrictParse(monthName, format, strict) {
  1810. var i,
  1811. ii,
  1812. mom,
  1813. llc = monthName.toLocaleLowerCase();
  1814. if (!this._monthsParse) {
  1815. // this is not used
  1816. this._monthsParse = [];
  1817. this._longMonthsParse = [];
  1818. this._shortMonthsParse = [];
  1819. for (i = 0; i < 12; ++i) {
  1820. mom = createUTC([2000, i]);
  1821. this._shortMonthsParse[i] = this.monthsShort(
  1822. mom,
  1823. ''
  1824. ).toLocaleLowerCase();
  1825. this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
  1826. }
  1827. }
  1828. if (strict) {
  1829. if (format === 'MMM') {
  1830. ii = indexOf.call(this._shortMonthsParse, llc);
  1831. return ii !== -1 ? ii : null;
  1832. } else {
  1833. ii = indexOf.call(this._longMonthsParse, llc);
  1834. return ii !== -1 ? ii : null;
  1835. }
  1836. } else {
  1837. if (format === 'MMM') {
  1838. ii = indexOf.call(this._shortMonthsParse, llc);
  1839. if (ii !== -1) {
  1840. return ii;
  1841. }
  1842. ii = indexOf.call(this._longMonthsParse, llc);
  1843. return ii !== -1 ? ii : null;
  1844. } else {
  1845. ii = indexOf.call(this._longMonthsParse, llc);
  1846. if (ii !== -1) {
  1847. return ii;
  1848. }
  1849. ii = indexOf.call(this._shortMonthsParse, llc);
  1850. return ii !== -1 ? ii : null;
  1851. }
  1852. }
  1853. }
  1854. function localeMonthsParse(monthName, format, strict) {
  1855. var i, mom, regex;
  1856. if (this._monthsParseExact) {
  1857. return handleStrictParse.call(this, monthName, format, strict);
  1858. }
  1859. if (!this._monthsParse) {
  1860. this._monthsParse = [];
  1861. this._longMonthsParse = [];
  1862. this._shortMonthsParse = [];
  1863. }
  1864. // TODO: add sorting
  1865. // Sorting makes sure if one month (or abbr) is a prefix of another
  1866. // see sorting in computeMonthsParse
  1867. for (i = 0; i < 12; i++) {
  1868. // make the regex if we don't have it already
  1869. mom = createUTC([2000, i]);
  1870. if (strict && !this._longMonthsParse[i]) {
  1871. this._longMonthsParse[i] = new RegExp(
  1872. '^' + this.months(mom, '').replace('.', '') + '$',
  1873. 'i'
  1874. );
  1875. this._shortMonthsParse[i] = new RegExp(
  1876. '^' + this.monthsShort(mom, '').replace('.', '') + '$',
  1877. 'i'
  1878. );
  1879. }
  1880. if (!strict && !this._monthsParse[i]) {
  1881. regex =
  1882. '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
  1883. this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
  1884. }
  1885. // test the regex
  1886. if (
  1887. strict &&
  1888. format === 'MMMM' &&
  1889. this._longMonthsParse[i].test(monthName)
  1890. ) {
  1891. return i;
  1892. } else if (
  1893. strict &&
  1894. format === 'MMM' &&
  1895. this._shortMonthsParse[i].test(monthName)
  1896. ) {
  1897. return i;
  1898. } else if (!strict && this._monthsParse[i].test(monthName)) {
  1899. return i;
  1900. }
  1901. }
  1902. }
  1903. // MOMENTS
  1904. function setMonth(mom, value) {
  1905. var dayOfMonth;
  1906. if (!mom.isValid()) {
  1907. // No op
  1908. return mom;
  1909. }
  1910. if (typeof value === 'string') {
  1911. if (/^\d+$/.test(value)) {
  1912. value = toInt(value);
  1913. } else {
  1914. value = mom.localeData().monthsParse(value);
  1915. // TODO: Another silent failure?
  1916. if (!isNumber(value)) {
  1917. return mom;
  1918. }
  1919. }
  1920. }
  1921. dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
  1922. mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
  1923. return mom;
  1924. }
  1925. function getSetMonth(value) {
  1926. if (value != null) {
  1927. setMonth(this, value);
  1928. hooks.updateOffset(this, true);
  1929. return this;
  1930. } else {
  1931. return get(this, 'Month');
  1932. }
  1933. }
  1934. function getDaysInMonth() {
  1935. return daysInMonth(this.year(), this.month());
  1936. }
  1937. function monthsShortRegex(isStrict) {
  1938. if (this._monthsParseExact) {
  1939. if (!hasOwnProp(this, '_monthsRegex')) {
  1940. computeMonthsParse.call(this);
  1941. }
  1942. if (isStrict) {
  1943. return this._monthsShortStrictRegex;
  1944. } else {
  1945. return this._monthsShortRegex;
  1946. }
  1947. } else {
  1948. if (!hasOwnProp(this, '_monthsShortRegex')) {
  1949. this._monthsShortRegex = defaultMonthsShortRegex;
  1950. }
  1951. return this._monthsShortStrictRegex && isStrict
  1952. ? this._monthsShortStrictRegex
  1953. : this._monthsShortRegex;
  1954. }
  1955. }
  1956. function monthsRegex(isStrict) {
  1957. if (this._monthsParseExact) {
  1958. if (!hasOwnProp(this, '_monthsRegex')) {
  1959. computeMonthsParse.call(this);
  1960. }
  1961. if (isStrict) {
  1962. return this._monthsStrictRegex;
  1963. } else {
  1964. return this._monthsRegex;
  1965. }
  1966. } else {
  1967. if (!hasOwnProp(this, '_monthsRegex')) {
  1968. this._monthsRegex = defaultMonthsRegex;
  1969. }
  1970. return this._monthsStrictRegex && isStrict
  1971. ? this._monthsStrictRegex
  1972. : this._monthsRegex;
  1973. }
  1974. }
  1975. function computeMonthsParse() {
  1976. function cmpLenRev(a, b) {
  1977. return b.length - a.length;
  1978. }
  1979. var shortPieces = [],
  1980. longPieces = [],
  1981. mixedPieces = [],
  1982. i,
  1983. mom;
  1984. for (i = 0; i < 12; i++) {
  1985. // make the regex if we don't have it already
  1986. mom = createUTC([2000, i]);
  1987. shortPieces.push(this.monthsShort(mom, ''));
  1988. longPieces.push(this.months(mom, ''));
  1989. mixedPieces.push(this.months(mom, ''));
  1990. mixedPieces.push(this.monthsShort(mom, ''));
  1991. }
  1992. // Sorting makes sure if one month (or abbr) is a prefix of another it
  1993. // will match the longer piece.
  1994. shortPieces.sort(cmpLenRev);
  1995. longPieces.sort(cmpLenRev);
  1996. mixedPieces.sort(cmpLenRev);
  1997. for (i = 0; i < 12; i++) {
  1998. shortPieces[i] = regexEscape(shortPieces[i]);
  1999. longPieces[i] = regexEscape(longPieces[i]);
  2000. }
  2001. for (i = 0; i < 24; i++) {
  2002. mixedPieces[i] = regexEscape(mixedPieces[i]);
  2003. }
  2004. this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  2005. this._monthsShortRegex = this._monthsRegex;
  2006. this._monthsStrictRegex = new RegExp(
  2007. '^(' + longPieces.join('|') + ')',
  2008. 'i'
  2009. );
  2010. this._monthsShortStrictRegex = new RegExp(
  2011. '^(' + shortPieces.join('|') + ')',
  2012. 'i'
  2013. );
  2014. }
  2015. // FORMATTING
  2016. addFormatToken('Y', 0, 0, function () {
  2017. var y = this.year();
  2018. return y <= 9999 ? zeroFill(y, 4) : '+' + y;
  2019. });
  2020. addFormatToken(0, ['YY', 2], 0, function () {
  2021. return this.year() % 100;
  2022. });
  2023. addFormatToken(0, ['YYYY', 4], 0, 'year');
  2024. addFormatToken(0, ['YYYYY', 5], 0, 'year');
  2025. addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
  2026. // ALIASES
  2027. addUnitAlias('year', 'y');
  2028. // PRIORITIES
  2029. addUnitPriority('year', 1);
  2030. // PARSING
  2031. addRegexToken('Y', matchSigned);
  2032. addRegexToken('YY', match1to2, match2);
  2033. addRegexToken('YYYY', match1to4, match4);
  2034. addRegexToken('YYYYY', match1to6, match6);
  2035. addRegexToken('YYYYYY', match1to6, match6);
  2036. addParseToken(['YYYYY', 'YYYYYY'], YEAR);
  2037. addParseToken('YYYY', function (input, array) {
  2038. array[YEAR] =
  2039. input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
  2040. });
  2041. addParseToken('YY', function (input, array) {
  2042. array[YEAR] = hooks.parseTwoDigitYear(input);
  2043. });
  2044. addParseToken('Y', function (input, array) {
  2045. array[YEAR] = parseInt(input, 10);
  2046. });
  2047. // HELPERS
  2048. function daysInYear(year) {
  2049. return isLeapYear(year) ? 366 : 365;
  2050. }
  2051. // HOOKS
  2052. hooks.parseTwoDigitYear = function (input) {
  2053. return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
  2054. };
  2055. // MOMENTS
  2056. var getSetYear = makeGetSet('FullYear', true);
  2057. function getIsLeapYear() {
  2058. return isLeapYear(this.year());
  2059. }
  2060. function createDate(y, m, d, h, M, s, ms) {
  2061. // can't just apply() to create a date:
  2062. // https://stackoverflow.com/q/181348
  2063. var date;
  2064. // the date constructor remaps years 0-99 to 1900-1999
  2065. if (y < 100 && y >= 0) {
  2066. // preserve leap years using a full 400 year cycle, then reset
  2067. date = new Date(y + 400, m, d, h, M, s, ms);
  2068. if (isFinite(date.getFullYear())) {
  2069. date.setFullYear(y);
  2070. }
  2071. } else {
  2072. date = new Date(y, m, d, h, M, s, ms);
  2073. }
  2074. return date;
  2075. }
  2076. function createUTCDate(y) {
  2077. var date, args;
  2078. // the Date.UTC function remaps years 0-99 to 1900-1999
  2079. if (y < 100 && y >= 0) {
  2080. args = Array.prototype.slice.call(arguments);
  2081. // preserve leap years using a full 400 year cycle, then reset
  2082. args[0] = y + 400;
  2083. date = new Date(Date.UTC.apply(null, args));
  2084. if (isFinite(date.getUTCFullYear())) {
  2085. date.setUTCFullYear(y);
  2086. }
  2087. } else {
  2088. date = new Date(Date.UTC.apply(null, arguments));
  2089. }
  2090. return date;
  2091. }
  2092. // start-of-first-week - start-of-year
  2093. function firstWeekOffset(year, dow, doy) {
  2094. var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
  2095. fwd = 7 + dow - doy,
  2096. // first-week day local weekday -- which local weekday is fwd
  2097. fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  2098. return -fwdlw + fwd - 1;
  2099. }
  2100. // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
  2101. function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  2102. var localWeekday = (7 + weekday - dow) % 7,
  2103. weekOffset = firstWeekOffset(year, dow, doy),
  2104. dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
  2105. resYear,
  2106. resDayOfYear;
  2107. if (dayOfYear <= 0) {
  2108. resYear = year - 1;
  2109. resDayOfYear = daysInYear(resYear) + dayOfYear;
  2110. } else if (dayOfYear > daysInYear(year)) {
  2111. resYear = year + 1;
  2112. resDayOfYear = dayOfYear - daysInYear(year);
  2113. } else {
  2114. resYear = year;
  2115. resDayOfYear = dayOfYear;
  2116. }
  2117. return {
  2118. year: resYear,
  2119. dayOfYear: resDayOfYear,
  2120. };
  2121. }
  2122. function weekOfYear(mom, dow, doy) {
  2123. var weekOffset = firstWeekOffset(mom.year(), dow, doy),
  2124. week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
  2125. resWeek,
  2126. resYear;
  2127. if (week < 1) {
  2128. resYear = mom.year() - 1;
  2129. resWeek = week + weeksInYear(resYear, dow, doy);
  2130. } else if (week > weeksInYear(mom.year(), dow, doy)) {
  2131. resWeek = week - weeksInYear(mom.year(), dow, doy);
  2132. resYear = mom.year() + 1;
  2133. } else {
  2134. resYear = mom.year();
  2135. resWeek = week;
  2136. }
  2137. return {
  2138. week: resWeek,
  2139. year: resYear,
  2140. };
  2141. }
  2142. function weeksInYear(year, dow, doy) {
  2143. var weekOffset = firstWeekOffset(year, dow, doy),
  2144. weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  2145. return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
  2146. }
  2147. // FORMATTING
  2148. addFormatToken('w', ['ww', 2], 'wo', 'week');
  2149. addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
  2150. // ALIASES
  2151. addUnitAlias('week', 'w');
  2152. addUnitAlias('isoWeek', 'W');
  2153. // PRIORITIES
  2154. addUnitPriority('week', 5);
  2155. addUnitPriority('isoWeek', 5);
  2156. // PARSING
  2157. addRegexToken('w', match1to2);
  2158. addRegexToken('ww', match1to2, match2);
  2159. addRegexToken('W', match1to2);
  2160. addRegexToken('WW', match1to2, match2);
  2161. addWeekParseToken(
  2162. ['w', 'ww', 'W', 'WW'],
  2163. function (input, week, config, token) {
  2164. week[token.substr(0, 1)] = toInt(input);
  2165. }
  2166. );
  2167. // HELPERS
  2168. // LOCALES
  2169. function localeWeek(mom) {
  2170. return weekOfYear(mom, this._week.dow, this._week.doy).week;
  2171. }
  2172. var defaultLocaleWeek = {
  2173. dow: 0, // Sunday is the first day of the week.
  2174. doy: 6, // The week that contains Jan 6th is the first week of the year.
  2175. };
  2176. function localeFirstDayOfWeek() {
  2177. return this._week.dow;
  2178. }
  2179. function localeFirstDayOfYear() {
  2180. return this._week.doy;
  2181. }
  2182. // MOMENTS
  2183. function getSetWeek(input) {
  2184. var week = this.localeData().week(this);
  2185. return input == null ? week : this.add((input - week) * 7, 'd');
  2186. }
  2187. function getSetISOWeek(input) {
  2188. var week = weekOfYear(this, 1, 4).week;
  2189. return input == null ? week : this.add((input - week) * 7, 'd');
  2190. }
  2191. // FORMATTING
  2192. addFormatToken('d', 0, 'do', 'day');
  2193. addFormatToken('dd', 0, 0, function (format) {
  2194. return this.localeData().weekdaysMin(this, format);
  2195. });
  2196. addFormatToken('ddd', 0, 0, function (format) {
  2197. return this.localeData().weekdaysShort(this, format);
  2198. });
  2199. addFormatToken('dddd', 0, 0, function (format) {
  2200. return this.localeData().weekdays(this, format);
  2201. });
  2202. addFormatToken('e', 0, 0, 'weekday');
  2203. addFormatToken('E', 0, 0, 'isoWeekday');
  2204. // ALIASES
  2205. addUnitAlias('day', 'd');
  2206. addUnitAlias('weekday', 'e');
  2207. addUnitAlias('isoWeekday', 'E');
  2208. // PRIORITY
  2209. addUnitPriority('day', 11);
  2210. addUnitPriority('weekday', 11);
  2211. addUnitPriority('isoWeekday', 11);
  2212. // PARSING
  2213. addRegexToken('d', match1to2);
  2214. addRegexToken('e', match1to2);
  2215. addRegexToken('E', match1to2);
  2216. addRegexToken('dd', function (isStrict, locale) {
  2217. return locale.weekdaysMinRegex(isStrict);
  2218. });
  2219. addRegexToken('ddd', function (isStrict, locale) {
  2220. return locale.weekdaysShortRegex(isStrict);
  2221. });
  2222. addRegexToken('dddd', function (isStrict, locale) {
  2223. return locale.weekdaysRegex(isStrict);
  2224. });
  2225. addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
  2226. var weekday = config._locale.weekdaysParse(input, token, config._strict);
  2227. // if we didn't get a weekday name, mark the date as invalid
  2228. if (weekday != null) {
  2229. week.d = weekday;
  2230. } else {
  2231. getParsingFlags(config).invalidWeekday = input;
  2232. }
  2233. });
  2234. addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
  2235. week[token] = toInt(input);
  2236. });
  2237. // HELPERS
  2238. function parseWeekday(input, locale) {
  2239. if (typeof input !== 'string') {
  2240. return input;
  2241. }
  2242. if (!isNaN(input)) {
  2243. return parseInt(input, 10);
  2244. }
  2245. input = locale.weekdaysParse(input);
  2246. if (typeof input === 'number') {
  2247. return input;
  2248. }
  2249. return null;
  2250. }
  2251. function parseIsoWeekday(input, locale) {
  2252. if (typeof input === 'string') {
  2253. return locale.weekdaysParse(input) % 7 || 7;
  2254. }
  2255. return isNaN(input) ? null : input;
  2256. }
  2257. // LOCALES
  2258. function shiftWeekdays(ws, n) {
  2259. return ws.slice(n, 7).concat(ws.slice(0, n));
  2260. }
  2261. var defaultLocaleWeekdays =
  2262. 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
  2263. defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  2264. defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  2265. defaultWeekdaysRegex = matchWord,
  2266. defaultWeekdaysShortRegex = matchWord,
  2267. defaultWeekdaysMinRegex = matchWord;
  2268. function localeWeekdays(m, format) {
  2269. var weekdays = isArray(this._weekdays)
  2270. ? this._weekdays
  2271. : this._weekdays[
  2272. m && m !== true && this._weekdays.isFormat.test(format)
  2273. ? 'format'
  2274. : 'standalone'
  2275. ];
  2276. return m === true
  2277. ? shiftWeekdays(weekdays, this._week.dow)
  2278. : m
  2279. ? weekdays[m.day()]
  2280. : weekdays;
  2281. }
  2282. function localeWeekdaysShort(m) {
  2283. return m === true
  2284. ? shiftWeekdays(this._weekdaysShort, this._week.dow)
  2285. : m
  2286. ? this._weekdaysShort[m.day()]
  2287. : this._weekdaysShort;
  2288. }
  2289. function localeWeekdaysMin(m) {
  2290. return m === true
  2291. ? shiftWeekdays(this._weekdaysMin, this._week.dow)
  2292. : m
  2293. ? this._weekdaysMin[m.day()]
  2294. : this._weekdaysMin;
  2295. }
  2296. function handleStrictParse$1(weekdayName, format, strict) {
  2297. var i,
  2298. ii,
  2299. mom,
  2300. llc = weekdayName.toLocaleLowerCase();
  2301. if (!this._weekdaysParse) {
  2302. this._weekdaysParse = [];
  2303. this._shortWeekdaysParse = [];
  2304. this._minWeekdaysParse = [];
  2305. for (i = 0; i < 7; ++i) {
  2306. mom = createUTC([2000, 1]).day(i);
  2307. this._minWeekdaysParse[i] = this.weekdaysMin(
  2308. mom,
  2309. ''
  2310. ).toLocaleLowerCase();
  2311. this._shortWeekdaysParse[i] = this.weekdaysShort(
  2312. mom,
  2313. ''
  2314. ).toLocaleLowerCase();
  2315. this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
  2316. }
  2317. }
  2318. if (strict) {
  2319. if (format === 'dddd') {
  2320. ii = indexOf.call(this._weekdaysParse, llc);
  2321. return ii !== -1 ? ii : null;
  2322. } else if (format === 'ddd') {
  2323. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2324. return ii !== -1 ? ii : null;
  2325. } else {
  2326. ii = indexOf.call(this._minWeekdaysParse, llc);
  2327. return ii !== -1 ? ii : null;
  2328. }
  2329. } else {
  2330. if (format === 'dddd') {
  2331. ii = indexOf.call(this._weekdaysParse, llc);
  2332. if (ii !== -1) {
  2333. return ii;
  2334. }
  2335. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2336. if (ii !== -1) {
  2337. return ii;
  2338. }
  2339. ii = indexOf.call(this._minWeekdaysParse, llc);
  2340. return ii !== -1 ? ii : null;
  2341. } else if (format === 'ddd') {
  2342. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2343. if (ii !== -1) {
  2344. return ii;
  2345. }
  2346. ii = indexOf.call(this._weekdaysParse, llc);
  2347. if (ii !== -1) {
  2348. return ii;
  2349. }
  2350. ii = indexOf.call(this._minWeekdaysParse, llc);
  2351. return ii !== -1 ? ii : null;
  2352. } else {
  2353. ii = indexOf.call(this._minWeekdaysParse, llc);
  2354. if (ii !== -1) {
  2355. return ii;
  2356. }
  2357. ii = indexOf.call(this._weekdaysParse, llc);
  2358. if (ii !== -1) {
  2359. return ii;
  2360. }
  2361. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2362. return ii !== -1 ? ii : null;
  2363. }
  2364. }
  2365. }
  2366. function localeWeekdaysParse(weekdayName, format, strict) {
  2367. var i, mom, regex;
  2368. if (this._weekdaysParseExact) {
  2369. return handleStrictParse$1.call(this, weekdayName, format, strict);
  2370. }
  2371. if (!this._weekdaysParse) {
  2372. this._weekdaysParse = [];
  2373. this._minWeekdaysParse = [];
  2374. this._shortWeekdaysParse = [];
  2375. this._fullWeekdaysParse = [];
  2376. }
  2377. for (i = 0; i < 7; i++) {
  2378. // make the regex if we don't have it already
  2379. mom = createUTC([2000, 1]).day(i);
  2380. if (strict && !this._fullWeekdaysParse[i]) {
  2381. this._fullWeekdaysParse[i] = new RegExp(
  2382. '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$',
  2383. 'i'
  2384. );
  2385. this._shortWeekdaysParse[i] = new RegExp(
  2386. '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$',
  2387. 'i'
  2388. );
  2389. this._minWeekdaysParse[i] = new RegExp(
  2390. '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$',
  2391. 'i'
  2392. );
  2393. }
  2394. if (!this._weekdaysParse[i]) {
  2395. regex =
  2396. '^' +
  2397. this.weekdays(mom, '') +
  2398. '|^' +
  2399. this.weekdaysShort(mom, '') +
  2400. '|^' +
  2401. this.weekdaysMin(mom, '');
  2402. this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
  2403. }
  2404. // test the regex
  2405. if (
  2406. strict &&
  2407. format === 'dddd' &&
  2408. this._fullWeekdaysParse[i].test(weekdayName)
  2409. ) {
  2410. return i;
  2411. } else if (
  2412. strict &&
  2413. format === 'ddd' &&
  2414. this._shortWeekdaysParse[i].test(weekdayName)
  2415. ) {
  2416. return i;
  2417. } else if (
  2418. strict &&
  2419. format === 'dd' &&
  2420. this._minWeekdaysParse[i].test(weekdayName)
  2421. ) {
  2422. return i;
  2423. } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
  2424. return i;
  2425. }
  2426. }
  2427. }
  2428. // MOMENTS
  2429. function getSetDayOfWeek(input) {
  2430. if (!this.isValid()) {
  2431. return input != null ? this : NaN;
  2432. }
  2433. var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
  2434. if (input != null) {
  2435. input = parseWeekday(input, this.localeData());
  2436. return this.add(input - day, 'd');
  2437. } else {
  2438. return day;
  2439. }
  2440. }
  2441. function getSetLocaleDayOfWeek(input) {
  2442. if (!this.isValid()) {
  2443. return input != null ? this : NaN;
  2444. }
  2445. var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  2446. return input == null ? weekday : this.add(input - weekday, 'd');
  2447. }
  2448. function getSetISODayOfWeek(input) {
  2449. if (!this.isValid()) {
  2450. return input != null ? this : NaN;
  2451. }
  2452. // behaves the same as moment#day except
  2453. // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
  2454. // as a setter, sunday should belong to the previous week.
  2455. if (input != null) {
  2456. var weekday = parseIsoWeekday(input, this.localeData());
  2457. return this.day(this.day() % 7 ? weekday : weekday - 7);
  2458. } else {
  2459. return this.day() || 7;
  2460. }
  2461. }
  2462. function weekdaysRegex(isStrict) {
  2463. if (this._weekdaysParseExact) {
  2464. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2465. computeWeekdaysParse.call(this);
  2466. }
  2467. if (isStrict) {
  2468. return this._weekdaysStrictRegex;
  2469. } else {
  2470. return this._weekdaysRegex;
  2471. }
  2472. } else {
  2473. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2474. this._weekdaysRegex = defaultWeekdaysRegex;
  2475. }
  2476. return this._weekdaysStrictRegex && isStrict
  2477. ? this._weekdaysStrictRegex
  2478. : this._weekdaysRegex;
  2479. }
  2480. }
  2481. function weekdaysShortRegex(isStrict) {
  2482. if (this._weekdaysParseExact) {
  2483. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2484. computeWeekdaysParse.call(this);
  2485. }
  2486. if (isStrict) {
  2487. return this._weekdaysShortStrictRegex;
  2488. } else {
  2489. return this._weekdaysShortRegex;
  2490. }
  2491. } else {
  2492. if (!hasOwnProp(this, '_weekdaysShortRegex')) {
  2493. this._weekdaysShortRegex = defaultWeekdaysShortRegex;
  2494. }
  2495. return this._weekdaysShortStrictRegex && isStrict
  2496. ? this._weekdaysShortStrictRegex
  2497. : this._weekdaysShortRegex;
  2498. }
  2499. }
  2500. function weekdaysMinRegex(isStrict) {
  2501. if (this._weekdaysParseExact) {
  2502. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2503. computeWeekdaysParse.call(this);
  2504. }
  2505. if (isStrict) {
  2506. return this._weekdaysMinStrictRegex;
  2507. } else {
  2508. return this._weekdaysMinRegex;
  2509. }
  2510. } else {
  2511. if (!hasOwnProp(this, '_weekdaysMinRegex')) {
  2512. this._weekdaysMinRegex = defaultWeekdaysMinRegex;
  2513. }
  2514. return this._weekdaysMinStrictRegex && isStrict
  2515. ? this._weekdaysMinStrictRegex
  2516. : this._weekdaysMinRegex;
  2517. }
  2518. }
  2519. function computeWeekdaysParse() {
  2520. function cmpLenRev(a, b) {
  2521. return b.length - a.length;
  2522. }
  2523. var minPieces = [],
  2524. shortPieces = [],
  2525. longPieces = [],
  2526. mixedPieces = [],
  2527. i,
  2528. mom,
  2529. minp,
  2530. shortp,
  2531. longp;
  2532. for (i = 0; i < 7; i++) {
  2533. // make the regex if we don't have it already
  2534. mom = createUTC([2000, 1]).day(i);
  2535. minp = regexEscape(this.weekdaysMin(mom, ''));
  2536. shortp = regexEscape(this.weekdaysShort(mom, ''));
  2537. longp = regexEscape(this.weekdays(mom, ''));
  2538. minPieces.push(minp);
  2539. shortPieces.push(shortp);
  2540. longPieces.push(longp);
  2541. mixedPieces.push(minp);
  2542. mixedPieces.push(shortp);
  2543. mixedPieces.push(longp);
  2544. }
  2545. // Sorting makes sure if one weekday (or abbr) is a prefix of another it
  2546. // will match the longer piece.
  2547. minPieces.sort(cmpLenRev);
  2548. shortPieces.sort(cmpLenRev);
  2549. longPieces.sort(cmpLenRev);
  2550. mixedPieces.sort(cmpLenRev);
  2551. this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  2552. this._weekdaysShortRegex = this._weekdaysRegex;
  2553. this._weekdaysMinRegex = this._weekdaysRegex;
  2554. this._weekdaysStrictRegex = new RegExp(
  2555. '^(' + longPieces.join('|') + ')',
  2556. 'i'
  2557. );
  2558. this._weekdaysShortStrictRegex = new RegExp(
  2559. '^(' + shortPieces.join('|') + ')',
  2560. 'i'
  2561. );
  2562. this._weekdaysMinStrictRegex = new RegExp(
  2563. '^(' + minPieces.join('|') + ')',
  2564. 'i'
  2565. );
  2566. }
  2567. // FORMATTING
  2568. function hFormat() {
  2569. return this.hours() % 12 || 12;
  2570. }
  2571. function kFormat() {
  2572. return this.hours() || 24;
  2573. }
  2574. addFormatToken('H', ['HH', 2], 0, 'hour');
  2575. addFormatToken('h', ['hh', 2], 0, hFormat);
  2576. addFormatToken('k', ['kk', 2], 0, kFormat);
  2577. addFormatToken('hmm', 0, 0, function () {
  2578. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
  2579. });
  2580. addFormatToken('hmmss', 0, 0, function () {
  2581. return (
  2582. '' +
  2583. hFormat.apply(this) +
  2584. zeroFill(this.minutes(), 2) +
  2585. zeroFill(this.seconds(), 2)
  2586. );
  2587. });
  2588. addFormatToken('Hmm', 0, 0, function () {
  2589. return '' + this.hours() + zeroFill(this.minutes(), 2);
  2590. });
  2591. addFormatToken('Hmmss', 0, 0, function () {
  2592. return (
  2593. '' +
  2594. this.hours() +
  2595. zeroFill(this.minutes(), 2) +
  2596. zeroFill(this.seconds(), 2)
  2597. );
  2598. });
  2599. function meridiem(token, lowercase) {
  2600. addFormatToken(token, 0, 0, function () {
  2601. return this.localeData().meridiem(
  2602. this.hours(),
  2603. this.minutes(),
  2604. lowercase
  2605. );
  2606. });
  2607. }
  2608. meridiem('a', true);
  2609. meridiem('A', false);
  2610. // ALIASES
  2611. addUnitAlias('hour', 'h');
  2612. // PRIORITY
  2613. addUnitPriority('hour', 13);
  2614. // PARSING
  2615. function matchMeridiem(isStrict, locale) {
  2616. return locale._meridiemParse;
  2617. }
  2618. addRegexToken('a', matchMeridiem);
  2619. addRegexToken('A', matchMeridiem);
  2620. addRegexToken('H', match1to2);
  2621. addRegexToken('h', match1to2);
  2622. addRegexToken('k', match1to2);
  2623. addRegexToken('HH', match1to2, match2);
  2624. addRegexToken('hh', match1to2, match2);
  2625. addRegexToken('kk', match1to2, match2);
  2626. addRegexToken('hmm', match3to4);
  2627. addRegexToken('hmmss', match5to6);
  2628. addRegexToken('Hmm', match3to4);
  2629. addRegexToken('Hmmss', match5to6);
  2630. addParseToken(['H', 'HH'], HOUR);
  2631. addParseToken(['k', 'kk'], function (input, array, config) {
  2632. var kInput = toInt(input);
  2633. array[HOUR] = kInput === 24 ? 0 : kInput;
  2634. });
  2635. addParseToken(['a', 'A'], function (input, array, config) {
  2636. config._isPm = config._locale.isPM(input);
  2637. config._meridiem = input;
  2638. });
  2639. addParseToken(['h', 'hh'], function (input, array, config) {
  2640. array[HOUR] = toInt(input);
  2641. getParsingFlags(config).bigHour = true;
  2642. });
  2643. addParseToken('hmm', function (input, array, config) {
  2644. var pos = input.length - 2;
  2645. array[HOUR] = toInt(input.substr(0, pos));
  2646. array[MINUTE] = toInt(input.substr(pos));
  2647. getParsingFlags(config).bigHour = true;
  2648. });
  2649. addParseToken('hmmss', function (input, array, config) {
  2650. var pos1 = input.length - 4,
  2651. pos2 = input.length - 2;
  2652. array[HOUR] = toInt(input.substr(0, pos1));
  2653. array[MINUTE] = toInt(input.substr(pos1, 2));
  2654. array[SECOND] = toInt(input.substr(pos2));
  2655. getParsingFlags(config).bigHour = true;
  2656. });
  2657. addParseToken('Hmm', function (input, array, config) {
  2658. var pos = input.length - 2;
  2659. array[HOUR] = toInt(input.substr(0, pos));
  2660. array[MINUTE] = toInt(input.substr(pos));
  2661. });
  2662. addParseToken('Hmmss', function (input, array, config) {
  2663. var pos1 = input.length - 4,
  2664. pos2 = input.length - 2;
  2665. array[HOUR] = toInt(input.substr(0, pos1));
  2666. array[MINUTE] = toInt(input.substr(pos1, 2));
  2667. array[SECOND] = toInt(input.substr(pos2));
  2668. });
  2669. // LOCALES
  2670. function localeIsPM(input) {
  2671. // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
  2672. // Using charAt should be more compatible.
  2673. return (input + '').toLowerCase().charAt(0) === 'p';
  2674. }
  2675. var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i,
  2676. // Setting the hour should keep the time, because the user explicitly
  2677. // specified which hour they want. So trying to maintain the same hour (in
  2678. // a new timezone) makes sense. Adding/subtracting hours does not follow
  2679. // this rule.
  2680. getSetHour = makeGetSet('Hours', true);
  2681. function localeMeridiem(hours, minutes, isLower) {
  2682. if (hours > 11) {
  2683. return isLower ? 'pm' : 'PM';
  2684. } else {
  2685. return isLower ? 'am' : 'AM';
  2686. }
  2687. }
  2688. var baseConfig = {
  2689. calendar: defaultCalendar,
  2690. longDateFormat: defaultLongDateFormat,
  2691. invalidDate: defaultInvalidDate,
  2692. ordinal: defaultOrdinal,
  2693. dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
  2694. relativeTime: defaultRelativeTime,
  2695. months: defaultLocaleMonths,
  2696. monthsShort: defaultLocaleMonthsShort,
  2697. week: defaultLocaleWeek,
  2698. weekdays: defaultLocaleWeekdays,
  2699. weekdaysMin: defaultLocaleWeekdaysMin,
  2700. weekdaysShort: defaultLocaleWeekdaysShort,
  2701. meridiemParse: defaultLocaleMeridiemParse,
  2702. };
  2703. // internal storage for locale config files
  2704. var locales = {},
  2705. localeFamilies = {},
  2706. globalLocale;
  2707. function commonPrefix(arr1, arr2) {
  2708. var i,
  2709. minl = Math.min(arr1.length, arr2.length);
  2710. for (i = 0; i < minl; i += 1) {
  2711. if (arr1[i] !== arr2[i]) {
  2712. return i;
  2713. }
  2714. }
  2715. return minl;
  2716. }
  2717. function normalizeLocale(key) {
  2718. return key ? key.toLowerCase().replace('_', '-') : key;
  2719. }
  2720. // pick the locale from the array
  2721. // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
  2722. // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
  2723. function chooseLocale(names) {
  2724. var i = 0,
  2725. j,
  2726. next,
  2727. locale,
  2728. split;
  2729. while (i < names.length) {
  2730. split = normalizeLocale(names[i]).split('-');
  2731. j = split.length;
  2732. next = normalizeLocale(names[i + 1]);
  2733. next = next ? next.split('-') : null;
  2734. while (j > 0) {
  2735. locale = loadLocale(split.slice(0, j).join('-'));
  2736. if (locale) {
  2737. return locale;
  2738. }
  2739. if (
  2740. next &&
  2741. next.length >= j &&
  2742. commonPrefix(split, next) >= j - 1
  2743. ) {
  2744. //the next array item is better than a shallower substring of this one
  2745. break;
  2746. }
  2747. j--;
  2748. }
  2749. i++;
  2750. }
  2751. return globalLocale;
  2752. }
  2753. function isLocaleNameSane(name) {
  2754. // Prevent names that look like filesystem paths, i.e contain '/' or '\'
  2755. return name.match('^[^/\\\\]*$') != null;
  2756. }
  2757. function loadLocale(name) {
  2758. var oldLocale = null,
  2759. aliasedRequire;
  2760. // TODO: Find a better way to register and load all the locales in Node
  2761. if (
  2762. locales[name] === undefined &&
  2763. typeof module !== 'undefined' &&
  2764. module &&
  2765. module.exports &&
  2766. isLocaleNameSane(name)
  2767. ) {
  2768. try {
  2769. oldLocale = globalLocale._abbr;
  2770. aliasedRequire = require;
  2771. aliasedRequire('./locale/' + name);
  2772. getSetGlobalLocale(oldLocale);
  2773. } catch (e) {
  2774. // mark as not found to avoid repeating expensive file require call causing high CPU
  2775. // when trying to find en-US, en_US, en-us for every format call
  2776. locales[name] = null; // null means not found
  2777. }
  2778. }
  2779. return locales[name];
  2780. }
  2781. // This function will load locale and then set the global locale. If
  2782. // no arguments are passed in, it will simply return the current global
  2783. // locale key.
  2784. function getSetGlobalLocale(key, values) {
  2785. var data;
  2786. if (key) {
  2787. if (isUndefined(values)) {
  2788. data = getLocale(key);
  2789. } else {
  2790. data = defineLocale(key, values);
  2791. }
  2792. if (data) {
  2793. // moment.duration._locale = moment._locale = data;
  2794. globalLocale = data;
  2795. } else {
  2796. if (typeof console !== 'undefined' && console.warn) {
  2797. //warn user if arguments are passed but the locale could not be set
  2798. console.warn(
  2799. 'Locale ' + key + ' not found. Did you forget to load it?'
  2800. );
  2801. }
  2802. }
  2803. }
  2804. return globalLocale._abbr;
  2805. }
  2806. function defineLocale(name, config) {
  2807. if (config !== null) {
  2808. var locale,
  2809. parentConfig = baseConfig;
  2810. config.abbr = name;
  2811. if (locales[name] != null) {
  2812. deprecateSimple(
  2813. 'defineLocaleOverride',
  2814. 'use moment.updateLocale(localeName, config) to change ' +
  2815. 'an existing locale. moment.defineLocale(localeName, ' +
  2816. 'config) should only be used for creating a new locale ' +
  2817. 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'
  2818. );
  2819. parentConfig = locales[name]._config;
  2820. } else if (config.parentLocale != null) {
  2821. if (locales[config.parentLocale] != null) {
  2822. parentConfig = locales[config.parentLocale]._config;
  2823. } else {
  2824. locale = loadLocale(config.parentLocale);
  2825. if (locale != null) {
  2826. parentConfig = locale._config;
  2827. } else {
  2828. if (!localeFamilies[config.parentLocale]) {
  2829. localeFamilies[config.parentLocale] = [];
  2830. }
  2831. localeFamilies[config.parentLocale].push({
  2832. name: name,
  2833. config: config,
  2834. });
  2835. return null;
  2836. }
  2837. }
  2838. }
  2839. locales[name] = new Locale(mergeConfigs(parentConfig, config));
  2840. if (localeFamilies[name]) {
  2841. localeFamilies[name].forEach(function (x) {
  2842. defineLocale(x.name, x.config);
  2843. });
  2844. }
  2845. // backwards compat for now: also set the locale
  2846. // make sure we set the locale AFTER all child locales have been
  2847. // created, so we won't end up with the child locale set.
  2848. getSetGlobalLocale(name);
  2849. return locales[name];
  2850. } else {
  2851. // useful for testing
  2852. delete locales[name];
  2853. return null;
  2854. }
  2855. }
  2856. function updateLocale(name, config) {
  2857. if (config != null) {
  2858. var locale,
  2859. tmpLocale,
  2860. parentConfig = baseConfig;
  2861. if (locales[name] != null && locales[name].parentLocale != null) {
  2862. // Update existing child locale in-place to avoid memory-leaks
  2863. locales[name].set(mergeConfigs(locales[name]._config, config));
  2864. } else {
  2865. // MERGE
  2866. tmpLocale = loadLocale(name);
  2867. if (tmpLocale != null) {
  2868. parentConfig = tmpLocale._config;
  2869. }
  2870. config = mergeConfigs(parentConfig, config);
  2871. if (tmpLocale == null) {
  2872. // updateLocale is called for creating a new locale
  2873. // Set abbr so it will have a name (getters return
  2874. // undefined otherwise).
  2875. config.abbr = name;
  2876. }
  2877. locale = new Locale(config);
  2878. locale.parentLocale = locales[name];
  2879. locales[name] = locale;
  2880. }
  2881. // backwards compat for now: also set the locale
  2882. getSetGlobalLocale(name);
  2883. } else {
  2884. // pass null for config to unupdate, useful for tests
  2885. if (locales[name] != null) {
  2886. if (locales[name].parentLocale != null) {
  2887. locales[name] = locales[name].parentLocale;
  2888. if (name === getSetGlobalLocale()) {
  2889. getSetGlobalLocale(name);
  2890. }
  2891. } else if (locales[name] != null) {
  2892. delete locales[name];
  2893. }
  2894. }
  2895. }
  2896. return locales[name];
  2897. }
  2898. // returns locale data
  2899. function getLocale(key) {
  2900. var locale;
  2901. if (key && key._locale && key._locale._abbr) {
  2902. key = key._locale._abbr;
  2903. }
  2904. if (!key) {
  2905. return globalLocale;
  2906. }
  2907. if (!isArray(key)) {
  2908. //short-circuit everything else
  2909. locale = loadLocale(key);
  2910. if (locale) {
  2911. return locale;
  2912. }
  2913. key = [key];
  2914. }
  2915. return chooseLocale(key);
  2916. }
  2917. function listLocales() {
  2918. return keys(locales);
  2919. }
  2920. function checkOverflow(m) {
  2921. var overflow,
  2922. a = m._a;
  2923. if (a && getParsingFlags(m).overflow === -2) {
  2924. overflow =
  2925. a[MONTH] < 0 || a[MONTH] > 11
  2926. ? MONTH
  2927. : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
  2928. ? DATE
  2929. : a[HOUR] < 0 ||
  2930. a[HOUR] > 24 ||
  2931. (a[HOUR] === 24 &&
  2932. (a[MINUTE] !== 0 ||
  2933. a[SECOND] !== 0 ||
  2934. a[MILLISECOND] !== 0))
  2935. ? HOUR
  2936. : a[MINUTE] < 0 || a[MINUTE] > 59
  2937. ? MINUTE
  2938. : a[SECOND] < 0 || a[SECOND] > 59
  2939. ? SECOND
  2940. : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
  2941. ? MILLISECOND
  2942. : -1;
  2943. if (
  2944. getParsingFlags(m)._overflowDayOfYear &&
  2945. (overflow < YEAR || overflow > DATE)
  2946. ) {
  2947. overflow = DATE;
  2948. }
  2949. if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
  2950. overflow = WEEK;
  2951. }
  2952. if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
  2953. overflow = WEEKDAY;
  2954. }
  2955. getParsingFlags(m).overflow = overflow;
  2956. }
  2957. return m;
  2958. }
  2959. // iso 8601 regex
  2960. // 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)
  2961. var extendedIsoRegex =
  2962. /^\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)?)?$/,
  2963. basicIsoRegex =
  2964. /^\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)?)?$/,
  2965. tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
  2966. isoDates = [
  2967. ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
  2968. ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
  2969. ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
  2970. ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
  2971. ['YYYY-DDD', /\d{4}-\d{3}/],
  2972. ['YYYY-MM', /\d{4}-\d\d/, false],
  2973. ['YYYYYYMMDD', /[+-]\d{10}/],
  2974. ['YYYYMMDD', /\d{8}/],
  2975. ['GGGG[W]WWE', /\d{4}W\d{3}/],
  2976. ['GGGG[W]WW', /\d{4}W\d{2}/, false],
  2977. ['YYYYDDD', /\d{7}/],
  2978. ['YYYYMM', /\d{6}/, false],
  2979. ['YYYY', /\d{4}/, false],
  2980. ],
  2981. // iso time formats and regexes
  2982. isoTimes = [
  2983. ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
  2984. ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
  2985. ['HH:mm:ss', /\d\d:\d\d:\d\d/],
  2986. ['HH:mm', /\d\d:\d\d/],
  2987. ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
  2988. ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
  2989. ['HHmmss', /\d\d\d\d\d\d/],
  2990. ['HHmm', /\d\d\d\d/],
  2991. ['HH', /\d\d/],
  2992. ],
  2993. aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
  2994. // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
  2995. rfc2822 =
  2996. /^(?:(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}))$/,
  2997. obsOffsets = {
  2998. UT: 0,
  2999. GMT: 0,
  3000. EDT: -4 * 60,
  3001. EST: -5 * 60,
  3002. CDT: -5 * 60,
  3003. CST: -6 * 60,
  3004. MDT: -6 * 60,
  3005. MST: -7 * 60,
  3006. PDT: -7 * 60,
  3007. PST: -8 * 60,
  3008. };
  3009. // date from iso format
  3010. function configFromISO(config) {
  3011. var i,
  3012. l,
  3013. string = config._i,
  3014. match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
  3015. allowTime,
  3016. dateFormat,
  3017. timeFormat,
  3018. tzFormat,
  3019. isoDatesLen = isoDates.length,
  3020. isoTimesLen = isoTimes.length;
  3021. if (match) {
  3022. getParsingFlags(config).iso = true;
  3023. for (i = 0, l = isoDatesLen; i < l; i++) {
  3024. if (isoDates[i][1].exec(match[1])) {
  3025. dateFormat = isoDates[i][0];
  3026. allowTime = isoDates[i][2] !== false;
  3027. break;
  3028. }
  3029. }
  3030. if (dateFormat == null) {
  3031. config._isValid = false;
  3032. return;
  3033. }
  3034. if (match[3]) {
  3035. for (i = 0, l = isoTimesLen; i < l; i++) {
  3036. if (isoTimes[i][1].exec(match[3])) {
  3037. // match[2] should be 'T' or space
  3038. timeFormat = (match[2] || ' ') + isoTimes[i][0];
  3039. break;
  3040. }
  3041. }
  3042. if (timeFormat == null) {
  3043. config._isValid = false;
  3044. return;
  3045. }
  3046. }
  3047. if (!allowTime && timeFormat != null) {
  3048. config._isValid = false;
  3049. return;
  3050. }
  3051. if (match[4]) {
  3052. if (tzRegex.exec(match[4])) {
  3053. tzFormat = 'Z';
  3054. } else {
  3055. config._isValid = false;
  3056. return;
  3057. }
  3058. }
  3059. config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
  3060. configFromStringAndFormat(config);
  3061. } else {
  3062. config._isValid = false;
  3063. }
  3064. }
  3065. function extractFromRFC2822Strings(
  3066. yearStr,
  3067. monthStr,
  3068. dayStr,
  3069. hourStr,
  3070. minuteStr,
  3071. secondStr
  3072. ) {
  3073. var result = [
  3074. untruncateYear(yearStr),
  3075. defaultLocaleMonthsShort.indexOf(monthStr),
  3076. parseInt(dayStr, 10),
  3077. parseInt(hourStr, 10),
  3078. parseInt(minuteStr, 10),
  3079. ];
  3080. if (secondStr) {
  3081. result.push(parseInt(secondStr, 10));
  3082. }
  3083. return result;
  3084. }
  3085. function untruncateYear(yearStr) {
  3086. var year = parseInt(yearStr, 10);
  3087. if (year <= 49) {
  3088. return 2000 + year;
  3089. } else if (year <= 999) {
  3090. return 1900 + year;
  3091. }
  3092. return year;
  3093. }
  3094. function preprocessRFC2822(s) {
  3095. // Remove comments and folding whitespace and replace multiple-spaces with a single space
  3096. return s
  3097. .replace(/\([^)]*\)|[\n\t]/g, ' ')
  3098. .replace(/(\s\s+)/g, ' ')
  3099. .replace(/^\s\s*/, '')
  3100. .replace(/\s\s*$/, '');
  3101. }
  3102. function checkWeekday(weekdayStr, parsedInput, config) {
  3103. if (weekdayStr) {
  3104. // TODO: Replace the vanilla JS Date object with an independent day-of-week check.
  3105. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
  3106. weekdayActual = new Date(
  3107. parsedInput[0],
  3108. parsedInput[1],
  3109. parsedInput[2]
  3110. ).getDay();
  3111. if (weekdayProvided !== weekdayActual) {
  3112. getParsingFlags(config).weekdayMismatch = true;
  3113. config._isValid = false;
  3114. return false;
  3115. }
  3116. }
  3117. return true;
  3118. }
  3119. function calculateOffset(obsOffset, militaryOffset, numOffset) {
  3120. if (obsOffset) {
  3121. return obsOffsets[obsOffset];
  3122. } else if (militaryOffset) {
  3123. // the only allowed military tz is Z
  3124. return 0;
  3125. } else {
  3126. var hm = parseInt(numOffset, 10),
  3127. m = hm % 100,
  3128. h = (hm - m) / 100;
  3129. return h * 60 + m;
  3130. }
  3131. }
  3132. // date and time from ref 2822 format
  3133. function configFromRFC2822(config) {
  3134. var match = rfc2822.exec(preprocessRFC2822(config._i)),
  3135. parsedArray;
  3136. if (match) {
  3137. parsedArray = extractFromRFC2822Strings(
  3138. match[4],
  3139. match[3],
  3140. match[2],
  3141. match[5],
  3142. match[6],
  3143. match[7]
  3144. );
  3145. if (!checkWeekday(match[1], parsedArray, config)) {
  3146. return;
  3147. }
  3148. config._a = parsedArray;
  3149. config._tzm = calculateOffset(match[8], match[9], match[10]);
  3150. config._d = createUTCDate.apply(null, config._a);
  3151. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  3152. getParsingFlags(config).rfc2822 = true;
  3153. } else {
  3154. config._isValid = false;
  3155. }
  3156. }
  3157. // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict
  3158. function configFromString(config) {
  3159. var matched = aspNetJsonRegex.exec(config._i);
  3160. if (matched !== null) {
  3161. config._d = new Date(+matched[1]);
  3162. return;
  3163. }
  3164. configFromISO(config);
  3165. if (config._isValid === false) {
  3166. delete config._isValid;
  3167. } else {
  3168. return;
  3169. }
  3170. configFromRFC2822(config);
  3171. if (config._isValid === false) {
  3172. delete config._isValid;
  3173. } else {
  3174. return;
  3175. }
  3176. if (config._strict) {
  3177. config._isValid = false;
  3178. } else {
  3179. // Final attempt, use Input Fallback
  3180. hooks.createFromInputFallback(config);
  3181. }
  3182. }
  3183. hooks.createFromInputFallback = deprecate(
  3184. 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
  3185. 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
  3186. 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',
  3187. function (config) {
  3188. config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
  3189. }
  3190. );
  3191. // Pick the first defined of two or three arguments.
  3192. function defaults(a, b, c) {
  3193. if (a != null) {
  3194. return a;
  3195. }
  3196. if (b != null) {
  3197. return b;
  3198. }
  3199. return c;
  3200. }
  3201. function currentDateArray(config) {
  3202. // hooks is actually the exported moment object
  3203. var nowValue = new Date(hooks.now());
  3204. if (config._useUTC) {
  3205. return [
  3206. nowValue.getUTCFullYear(),
  3207. nowValue.getUTCMonth(),
  3208. nowValue.getUTCDate(),
  3209. ];
  3210. }
  3211. return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
  3212. }
  3213. // convert an array to a date.
  3214. // the array should mirror the parameters below
  3215. // note: all values past the year are optional and will default to the lowest possible value.
  3216. // [year, month, day , hour, minute, second, millisecond]
  3217. function configFromArray(config) {
  3218. var i,
  3219. date,
  3220. input = [],
  3221. currentDate,
  3222. expectedWeekday,
  3223. yearToUse;
  3224. if (config._d) {
  3225. return;
  3226. }
  3227. currentDate = currentDateArray(config);
  3228. //compute day of the year from weeks and weekdays
  3229. if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
  3230. dayOfYearFromWeekInfo(config);
  3231. }
  3232. //if the day of the year is set, figure out what it is
  3233. if (config._dayOfYear != null) {
  3234. yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
  3235. if (
  3236. config._dayOfYear > daysInYear(yearToUse) ||
  3237. config._dayOfYear === 0
  3238. ) {
  3239. getParsingFlags(config)._overflowDayOfYear = true;
  3240. }
  3241. date = createUTCDate(yearToUse, 0, config._dayOfYear);
  3242. config._a[MONTH] = date.getUTCMonth();
  3243. config._a[DATE] = date.getUTCDate();
  3244. }
  3245. // Default to current date.
  3246. // * if no year, month, day of month are given, default to today
  3247. // * if day of month is given, default month and year
  3248. // * if month is given, default only year
  3249. // * if year is given, don't default anything
  3250. for (i = 0; i < 3 && config._a[i] == null; ++i) {
  3251. config._a[i] = input[i] = currentDate[i];
  3252. }
  3253. // Zero out whatever was not defaulted, including time
  3254. for (; i < 7; i++) {
  3255. config._a[i] = input[i] =
  3256. config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];
  3257. }
  3258. // Check for 24:00:00.000
  3259. if (
  3260. config._a[HOUR] === 24 &&
  3261. config._a[MINUTE] === 0 &&
  3262. config._a[SECOND] === 0 &&
  3263. config._a[MILLISECOND] === 0
  3264. ) {
  3265. config._nextDay = true;
  3266. config._a[HOUR] = 0;
  3267. }
  3268. config._d = (config._useUTC ? createUTCDate : createDate).apply(
  3269. null,
  3270. input
  3271. );
  3272. expectedWeekday = config._useUTC
  3273. ? config._d.getUTCDay()
  3274. : config._d.getDay();
  3275. // Apply timezone offset from input. The actual utcOffset can be changed
  3276. // with parseZone.
  3277. if (config._tzm != null) {
  3278. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  3279. }
  3280. if (config._nextDay) {
  3281. config._a[HOUR] = 24;
  3282. }
  3283. // check for mismatching day of week
  3284. if (
  3285. config._w &&
  3286. typeof config._w.d !== 'undefined' &&
  3287. config._w.d !== expectedWeekday
  3288. ) {
  3289. getParsingFlags(config).weekdayMismatch = true;
  3290. }
  3291. }
  3292. function dayOfYearFromWeekInfo(config) {
  3293. var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
  3294. w = config._w;
  3295. if (w.GG != null || w.W != null || w.E != null) {
  3296. dow = 1;
  3297. doy = 4;
  3298. // TODO: We need to take the current isoWeekYear, but that depends on
  3299. // how we interpret now (local, utc, fixed offset). So create
  3300. // a now version of current config (take local/utc/offset flags, and
  3301. // create now).
  3302. weekYear = defaults(
  3303. w.GG,
  3304. config._a[YEAR],
  3305. weekOfYear(createLocal(), 1, 4).year
  3306. );
  3307. week = defaults(w.W, 1);
  3308. weekday = defaults(w.E, 1);
  3309. if (weekday < 1 || weekday > 7) {
  3310. weekdayOverflow = true;
  3311. }
  3312. } else {
  3313. dow = config._locale._week.dow;
  3314. doy = config._locale._week.doy;
  3315. curWeek = weekOfYear(createLocal(), dow, doy);
  3316. weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
  3317. // Default to current week.
  3318. week = defaults(w.w, curWeek.week);
  3319. if (w.d != null) {
  3320. // weekday -- low day numbers are considered next week
  3321. weekday = w.d;
  3322. if (weekday < 0 || weekday > 6) {
  3323. weekdayOverflow = true;
  3324. }
  3325. } else if (w.e != null) {
  3326. // local weekday -- counting starts from beginning of week
  3327. weekday = w.e + dow;
  3328. if (w.e < 0 || w.e > 6) {
  3329. weekdayOverflow = true;
  3330. }
  3331. } else {
  3332. // default to beginning of week
  3333. weekday = dow;
  3334. }
  3335. }
  3336. if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
  3337. getParsingFlags(config)._overflowWeeks = true;
  3338. } else if (weekdayOverflow != null) {
  3339. getParsingFlags(config)._overflowWeekday = true;
  3340. } else {
  3341. temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
  3342. config._a[YEAR] = temp.year;
  3343. config._dayOfYear = temp.dayOfYear;
  3344. }
  3345. }
  3346. // constant that refers to the ISO standard
  3347. hooks.ISO_8601 = function () {};
  3348. // constant that refers to the RFC 2822 form
  3349. hooks.RFC_2822 = function () {};
  3350. // date from string and format string
  3351. function configFromStringAndFormat(config) {
  3352. // TODO: Move this to another part of the creation flow to prevent circular deps
  3353. if (config._f === hooks.ISO_8601) {
  3354. configFromISO(config);
  3355. return;
  3356. }
  3357. if (config._f === hooks.RFC_2822) {
  3358. configFromRFC2822(config);
  3359. return;
  3360. }
  3361. config._a = [];
  3362. getParsingFlags(config).empty = true;
  3363. // This array is used to make a Date, either with `new Date` or `Date.UTC`
  3364. var string = '' + config._i,
  3365. i,
  3366. parsedInput,
  3367. tokens,
  3368. token,
  3369. skipped,
  3370. stringLength = string.length,
  3371. totalParsedInputLength = 0,
  3372. era,
  3373. tokenLen;
  3374. tokens =
  3375. expandFormat(config._f, config._locale).match(formattingTokens) || [];
  3376. tokenLen = tokens.length;
  3377. for (i = 0; i < tokenLen; i++) {
  3378. token = tokens[i];
  3379. parsedInput = (string.match(getParseRegexForToken(token, config)) ||
  3380. [])[0];
  3381. if (parsedInput) {
  3382. skipped = string.substr(0, string.indexOf(parsedInput));
  3383. if (skipped.length > 0) {
  3384. getParsingFlags(config).unusedInput.push(skipped);
  3385. }
  3386. string = string.slice(
  3387. string.indexOf(parsedInput) + parsedInput.length
  3388. );
  3389. totalParsedInputLength += parsedInput.length;
  3390. }
  3391. // don't parse if it's not a known token
  3392. if (formatTokenFunctions[token]) {
  3393. if (parsedInput) {
  3394. getParsingFlags(config).empty = false;
  3395. } else {
  3396. getParsingFlags(config).unusedTokens.push(token);
  3397. }
  3398. addTimeToArrayFromToken(token, parsedInput, config);
  3399. } else if (config._strict && !parsedInput) {
  3400. getParsingFlags(config).unusedTokens.push(token);
  3401. }
  3402. }
  3403. // add remaining unparsed input length to the string
  3404. getParsingFlags(config).charsLeftOver =
  3405. stringLength - totalParsedInputLength;
  3406. if (string.length > 0) {
  3407. getParsingFlags(config).unusedInput.push(string);
  3408. }
  3409. // clear _12h flag if hour is <= 12
  3410. if (
  3411. config._a[HOUR] <= 12 &&
  3412. getParsingFlags(config).bigHour === true &&
  3413. config._a[HOUR] > 0
  3414. ) {
  3415. getParsingFlags(config).bigHour = undefined;
  3416. }
  3417. getParsingFlags(config).parsedDateParts = config._a.slice(0);
  3418. getParsingFlags(config).meridiem = config._meridiem;
  3419. // handle meridiem
  3420. config._a[HOUR] = meridiemFixWrap(
  3421. config._locale,
  3422. config._a[HOUR],
  3423. config._meridiem
  3424. );
  3425. // handle era
  3426. era = getParsingFlags(config).era;
  3427. if (era !== null) {
  3428. config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);
  3429. }
  3430. configFromArray(config);
  3431. checkOverflow(config);
  3432. }
  3433. function meridiemFixWrap(locale, hour, meridiem) {
  3434. var isPm;
  3435. if (meridiem == null) {
  3436. // nothing to do
  3437. return hour;
  3438. }
  3439. if (locale.meridiemHour != null) {
  3440. return locale.meridiemHour(hour, meridiem);
  3441. } else if (locale.isPM != null) {
  3442. // Fallback
  3443. isPm = locale.isPM(meridiem);
  3444. if (isPm && hour < 12) {
  3445. hour += 12;
  3446. }
  3447. if (!isPm && hour === 12) {
  3448. hour = 0;
  3449. }
  3450. return hour;
  3451. } else {
  3452. // this is not supposed to happen
  3453. return hour;
  3454. }
  3455. }
  3456. // date from string and array of format strings
  3457. function configFromStringAndArray(config) {
  3458. var tempConfig,
  3459. bestMoment,
  3460. scoreToBeat,
  3461. i,
  3462. currentScore,
  3463. validFormatFound,
  3464. bestFormatIsValid = false,
  3465. configfLen = config._f.length;
  3466. if (configfLen === 0) {
  3467. getParsingFlags(config).invalidFormat = true;
  3468. config._d = new Date(NaN);
  3469. return;
  3470. }
  3471. for (i = 0; i < configfLen; i++) {
  3472. currentScore = 0;
  3473. validFormatFound = false;
  3474. tempConfig = copyConfig({}, config);
  3475. if (config._useUTC != null) {
  3476. tempConfig._useUTC = config._useUTC;
  3477. }
  3478. tempConfig._f = config._f[i];
  3479. configFromStringAndFormat(tempConfig);
  3480. if (isValid(tempConfig)) {
  3481. validFormatFound = true;
  3482. }
  3483. // if there is any input that was not parsed add a penalty for that format
  3484. currentScore += getParsingFlags(tempConfig).charsLeftOver;
  3485. //or tokens
  3486. currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
  3487. getParsingFlags(tempConfig).score = currentScore;
  3488. if (!bestFormatIsValid) {
  3489. if (
  3490. scoreToBeat == null ||
  3491. currentScore < scoreToBeat ||
  3492. validFormatFound
  3493. ) {
  3494. scoreToBeat = currentScore;
  3495. bestMoment = tempConfig;
  3496. if (validFormatFound) {
  3497. bestFormatIsValid = true;
  3498. }
  3499. }
  3500. } else {
  3501. if (currentScore < scoreToBeat) {
  3502. scoreToBeat = currentScore;
  3503. bestMoment = tempConfig;
  3504. }
  3505. }
  3506. }
  3507. extend(config, bestMoment || tempConfig);
  3508. }
  3509. function configFromObject(config) {
  3510. if (config._d) {
  3511. return;
  3512. }
  3513. var i = normalizeObjectUnits(config._i),
  3514. dayOrDate = i.day === undefined ? i.date : i.day;
  3515. config._a = map(
  3516. [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],
  3517. function (obj) {
  3518. return obj && parseInt(obj, 10);
  3519. }
  3520. );
  3521. configFromArray(config);
  3522. }
  3523. function createFromConfig(config) {
  3524. var res = new Moment(checkOverflow(prepareConfig(config)));
  3525. if (res._nextDay) {
  3526. // Adding is smart enough around DST
  3527. res.add(1, 'd');
  3528. res._nextDay = undefined;
  3529. }
  3530. return res;
  3531. }
  3532. function prepareConfig(config) {
  3533. var input = config._i,
  3534. format = config._f;
  3535. config._locale = config._locale || getLocale(config._l);
  3536. if (input === null || (format === undefined && input === '')) {
  3537. return createInvalid({ nullInput: true });
  3538. }
  3539. if (typeof input === 'string') {
  3540. config._i = input = config._locale.preparse(input);
  3541. }
  3542. if (isMoment(input)) {
  3543. return new Moment(checkOverflow(input));
  3544. } else if (isDate(input)) {
  3545. config._d = input;
  3546. } else if (isArray(format)) {
  3547. configFromStringAndArray(config);
  3548. } else if (format) {
  3549. configFromStringAndFormat(config);
  3550. } else {
  3551. configFromInput(config);
  3552. }
  3553. if (!isValid(config)) {
  3554. config._d = null;
  3555. }
  3556. return config;
  3557. }
  3558. function configFromInput(config) {
  3559. var input = config._i;
  3560. if (isUndefined(input)) {
  3561. config._d = new Date(hooks.now());
  3562. } else if (isDate(input)) {
  3563. config._d = new Date(input.valueOf());
  3564. } else if (typeof input === 'string') {
  3565. configFromString(config);
  3566. } else if (isArray(input)) {
  3567. config._a = map(input.slice(0), function (obj) {
  3568. return parseInt(obj, 10);
  3569. });
  3570. configFromArray(config);
  3571. } else if (isObject(input)) {
  3572. configFromObject(config);
  3573. } else if (isNumber(input)) {
  3574. // from milliseconds
  3575. config._d = new Date(input);
  3576. } else {
  3577. hooks.createFromInputFallback(config);
  3578. }
  3579. }
  3580. function createLocalOrUTC(input, format, locale, strict, isUTC) {
  3581. var c = {};
  3582. if (format === true || format === false) {
  3583. strict = format;
  3584. format = undefined;
  3585. }
  3586. if (locale === true || locale === false) {
  3587. strict = locale;
  3588. locale = undefined;
  3589. }
  3590. if (
  3591. (isObject(input) && isObjectEmpty(input)) ||
  3592. (isArray(input) && input.length === 0)
  3593. ) {
  3594. input = undefined;
  3595. }
  3596. // object construction must be done this way.
  3597. // https://github.com/moment/moment/issues/1423
  3598. c._isAMomentObject = true;
  3599. c._useUTC = c._isUTC = isUTC;
  3600. c._l = locale;
  3601. c._i = input;
  3602. c._f = format;
  3603. c._strict = strict;
  3604. return createFromConfig(c);
  3605. }
  3606. function createLocal(input, format, locale, strict) {
  3607. return createLocalOrUTC(input, format, locale, strict, false);
  3608. }
  3609. var prototypeMin = deprecate(
  3610. 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
  3611. function () {
  3612. var other = createLocal.apply(null, arguments);
  3613. if (this.isValid() && other.isValid()) {
  3614. return other < this ? this : other;
  3615. } else {
  3616. return createInvalid();
  3617. }
  3618. }
  3619. ),
  3620. prototypeMax = deprecate(
  3621. 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
  3622. function () {
  3623. var other = createLocal.apply(null, arguments);
  3624. if (this.isValid() && other.isValid()) {
  3625. return other > this ? this : other;
  3626. } else {
  3627. return createInvalid();
  3628. }
  3629. }
  3630. );
  3631. // Pick a moment m from moments so that m[fn](other) is true for all
  3632. // other. This relies on the function fn to be transitive.
  3633. //
  3634. // moments should either be an array of moment objects or an array, whose
  3635. // first element is an array of moment objects.
  3636. function pickBy(fn, moments) {
  3637. var res, i;
  3638. if (moments.length === 1 && isArray(moments[0])) {
  3639. moments = moments[0];
  3640. }
  3641. if (!moments.length) {
  3642. return createLocal();
  3643. }
  3644. res = moments[0];
  3645. for (i = 1; i < moments.length; ++i) {
  3646. if (!moments[i].isValid() || moments[i][fn](res)) {
  3647. res = moments[i];
  3648. }
  3649. }
  3650. return res;
  3651. }
  3652. // TODO: Use [].sort instead?
  3653. function min() {
  3654. var args = [].slice.call(arguments, 0);
  3655. return pickBy('isBefore', args);
  3656. }
  3657. function max() {
  3658. var args = [].slice.call(arguments, 0);
  3659. return pickBy('isAfter', args);
  3660. }
  3661. var now = function () {
  3662. return Date.now ? Date.now() : +new Date();
  3663. };
  3664. var ordering = [
  3665. 'year',
  3666. 'quarter',
  3667. 'month',
  3668. 'week',
  3669. 'day',
  3670. 'hour',
  3671. 'minute',
  3672. 'second',
  3673. 'millisecond',
  3674. ];
  3675. function isDurationValid(m) {
  3676. var key,
  3677. unitHasDecimal = false,
  3678. i,
  3679. orderLen = ordering.length;
  3680. for (key in m) {
  3681. if (
  3682. hasOwnProp(m, key) &&
  3683. !(
  3684. indexOf.call(ordering, key) !== -1 &&
  3685. (m[key] == null || !isNaN(m[key]))
  3686. )
  3687. ) {
  3688. return false;
  3689. }
  3690. }
  3691. for (i = 0; i < orderLen; ++i) {
  3692. if (m[ordering[i]]) {
  3693. if (unitHasDecimal) {
  3694. return false; // only allow non-integers for smallest unit
  3695. }
  3696. if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
  3697. unitHasDecimal = true;
  3698. }
  3699. }
  3700. }
  3701. return true;
  3702. }
  3703. function isValid$1() {
  3704. return this._isValid;
  3705. }
  3706. function createInvalid$1() {
  3707. return createDuration(NaN);
  3708. }
  3709. function Duration(duration) {
  3710. var normalizedInput = normalizeObjectUnits(duration),
  3711. years = normalizedInput.year || 0,
  3712. quarters = normalizedInput.quarter || 0,
  3713. months = normalizedInput.month || 0,
  3714. weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
  3715. days = normalizedInput.day || 0,
  3716. hours = normalizedInput.hour || 0,
  3717. minutes = normalizedInput.minute || 0,
  3718. seconds = normalizedInput.second || 0,
  3719. milliseconds = normalizedInput.millisecond || 0;
  3720. this._isValid = isDurationValid(normalizedInput);
  3721. // representation for dateAddRemove
  3722. this._milliseconds =
  3723. +milliseconds +
  3724. seconds * 1e3 + // 1000
  3725. minutes * 6e4 + // 1000 * 60
  3726. hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
  3727. // Because of dateAddRemove treats 24 hours as different from a
  3728. // day when working around DST, we need to store them separately
  3729. this._days = +days + weeks * 7;
  3730. // It is impossible to translate months into days without knowing
  3731. // which months you are are talking about, so we have to store
  3732. // it separately.
  3733. this._months = +months + quarters * 3 + years * 12;
  3734. this._data = {};
  3735. this._locale = getLocale();
  3736. this._bubble();
  3737. }
  3738. function isDuration(obj) {
  3739. return obj instanceof Duration;
  3740. }
  3741. function absRound(number) {
  3742. if (number < 0) {
  3743. return Math.round(-1 * number) * -1;
  3744. } else {
  3745. return Math.round(number);
  3746. }
  3747. }
  3748. // compare two arrays, return the number of differences
  3749. function compareArrays(array1, array2, dontConvert) {
  3750. var len = Math.min(array1.length, array2.length),
  3751. lengthDiff = Math.abs(array1.length - array2.length),
  3752. diffs = 0,
  3753. i;
  3754. for (i = 0; i < len; i++) {
  3755. if (
  3756. (dontConvert && array1[i] !== array2[i]) ||
  3757. (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))
  3758. ) {
  3759. diffs++;
  3760. }
  3761. }
  3762. return diffs + lengthDiff;
  3763. }
  3764. // FORMATTING
  3765. function offset(token, separator) {
  3766. addFormatToken(token, 0, 0, function () {
  3767. var offset = this.utcOffset(),
  3768. sign = '+';
  3769. if (offset < 0) {
  3770. offset = -offset;
  3771. sign = '-';
  3772. }
  3773. return (
  3774. sign +
  3775. zeroFill(~~(offset / 60), 2) +
  3776. separator +
  3777. zeroFill(~~offset % 60, 2)
  3778. );
  3779. });
  3780. }
  3781. offset('Z', ':');
  3782. offset('ZZ', '');
  3783. // PARSING
  3784. addRegexToken('Z', matchShortOffset);
  3785. addRegexToken('ZZ', matchShortOffset);
  3786. addParseToken(['Z', 'ZZ'], function (input, array, config) {
  3787. config._useUTC = true;
  3788. config._tzm = offsetFromString(matchShortOffset, input);
  3789. });
  3790. // HELPERS
  3791. // timezone chunker
  3792. // '+10:00' > ['10', '00']
  3793. // '-1530' > ['-15', '30']
  3794. var chunkOffset = /([\+\-]|\d\d)/gi;
  3795. function offsetFromString(matcher, string) {
  3796. var matches = (string || '').match(matcher),
  3797. chunk,
  3798. parts,
  3799. minutes;
  3800. if (matches === null) {
  3801. return null;
  3802. }
  3803. chunk = matches[matches.length - 1] || [];
  3804. parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
  3805. minutes = +(parts[1] * 60) + toInt(parts[2]);
  3806. return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
  3807. }
  3808. // Return a moment from input, that is local/utc/zone equivalent to model.
  3809. function cloneWithOffset(input, model) {
  3810. var res, diff;
  3811. if (model._isUTC) {
  3812. res = model.clone();
  3813. diff =
  3814. (isMoment(input) || isDate(input)
  3815. ? input.valueOf()
  3816. : createLocal(input).valueOf()) - res.valueOf();
  3817. // Use low-level api, because this fn is low-level api.
  3818. res._d.setTime(res._d.valueOf() + diff);
  3819. hooks.updateOffset(res, false);
  3820. return res;
  3821. } else {
  3822. return createLocal(input).local();
  3823. }
  3824. }
  3825. function getDateOffset(m) {
  3826. // On Firefox.24 Date#getTimezoneOffset returns a floating point.
  3827. // https://github.com/moment/moment/pull/1871
  3828. return -Math.round(m._d.getTimezoneOffset());
  3829. }
  3830. // HOOKS
  3831. // This function will be called whenever a moment is mutated.
  3832. // It is intended to keep the offset in sync with the timezone.
  3833. hooks.updateOffset = function () {};
  3834. // MOMENTS
  3835. // keepLocalTime = true means only change the timezone, without
  3836. // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
  3837. // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
  3838. // +0200, so we adjust the time as needed, to be valid.
  3839. //
  3840. // Keeping the time actually adds/subtracts (one hour)
  3841. // from the actual represented time. That is why we call updateOffset
  3842. // a second time. In case it wants us to change the offset again
  3843. // _changeInProgress == true case, then we have to adjust, because
  3844. // there is no such time in the given timezone.
  3845. function getSetOffset(input, keepLocalTime, keepMinutes) {
  3846. var offset = this._offset || 0,
  3847. localAdjust;
  3848. if (!this.isValid()) {
  3849. return input != null ? this : NaN;
  3850. }
  3851. if (input != null) {
  3852. if (typeof input === 'string') {
  3853. input = offsetFromString(matchShortOffset, input);
  3854. if (input === null) {
  3855. return this;
  3856. }
  3857. } else if (Math.abs(input) < 16 && !keepMinutes) {
  3858. input = input * 60;
  3859. }
  3860. if (!this._isUTC && keepLocalTime) {
  3861. localAdjust = getDateOffset(this);
  3862. }
  3863. this._offset = input;
  3864. this._isUTC = true;
  3865. if (localAdjust != null) {
  3866. this.add(localAdjust, 'm');
  3867. }
  3868. if (offset !== input) {
  3869. if (!keepLocalTime || this._changeInProgress) {
  3870. addSubtract(
  3871. this,
  3872. createDuration(input - offset, 'm'),
  3873. 1,
  3874. false
  3875. );
  3876. } else if (!this._changeInProgress) {
  3877. this._changeInProgress = true;
  3878. hooks.updateOffset(this, true);
  3879. this._changeInProgress = null;
  3880. }
  3881. }
  3882. return this;
  3883. } else {
  3884. return this._isUTC ? offset : getDateOffset(this);
  3885. }
  3886. }
  3887. function getSetZone(input, keepLocalTime) {
  3888. if (input != null) {
  3889. if (typeof input !== 'string') {
  3890. input = -input;
  3891. }
  3892. this.utcOffset(input, keepLocalTime);
  3893. return this;
  3894. } else {
  3895. return -this.utcOffset();
  3896. }
  3897. }
  3898. function setOffsetToUTC(keepLocalTime) {
  3899. return this.utcOffset(0, keepLocalTime);
  3900. }
  3901. function setOffsetToLocal(keepLocalTime) {
  3902. if (this._isUTC) {
  3903. this.utcOffset(0, keepLocalTime);
  3904. this._isUTC = false;
  3905. if (keepLocalTime) {
  3906. this.subtract(getDateOffset(this), 'm');
  3907. }
  3908. }
  3909. return this;
  3910. }
  3911. function setOffsetToParsedOffset() {
  3912. if (this._tzm != null) {
  3913. this.utcOffset(this._tzm, false, true);
  3914. } else if (typeof this._i === 'string') {
  3915. var tZone = offsetFromString(matchOffset, this._i);
  3916. if (tZone != null) {
  3917. this.utcOffset(tZone);
  3918. } else {
  3919. this.utcOffset(0, true);
  3920. }
  3921. }
  3922. return this;
  3923. }
  3924. function hasAlignedHourOffset(input) {
  3925. if (!this.isValid()) {
  3926. return false;
  3927. }
  3928. input = input ? createLocal(input).utcOffset() : 0;
  3929. return (this.utcOffset() - input) % 60 === 0;
  3930. }
  3931. function isDaylightSavingTime() {
  3932. return (
  3933. this.utcOffset() > this.clone().month(0).utcOffset() ||
  3934. this.utcOffset() > this.clone().month(5).utcOffset()
  3935. );
  3936. }
  3937. function isDaylightSavingTimeShifted() {
  3938. if (!isUndefined(this._isDSTShifted)) {
  3939. return this._isDSTShifted;
  3940. }
  3941. var c = {},
  3942. other;
  3943. copyConfig(c, this);
  3944. c = prepareConfig(c);
  3945. if (c._a) {
  3946. other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
  3947. this._isDSTShifted =
  3948. this.isValid() && compareArrays(c._a, other.toArray()) > 0;
  3949. } else {
  3950. this._isDSTShifted = false;
  3951. }
  3952. return this._isDSTShifted;
  3953. }
  3954. function isLocal() {
  3955. return this.isValid() ? !this._isUTC : false;
  3956. }
  3957. function isUtcOffset() {
  3958. return this.isValid() ? this._isUTC : false;
  3959. }
  3960. function isUtc() {
  3961. return this.isValid() ? this._isUTC && this._offset === 0 : false;
  3962. }
  3963. // ASP.NET json date format regex
  3964. var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,
  3965. // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
  3966. // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
  3967. // and further modified to allow for strings containing both week and day
  3968. isoRegex =
  3969. /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
  3970. function createDuration(input, key) {
  3971. var duration = input,
  3972. // matching against regexp is expensive, do it on demand
  3973. match = null,
  3974. sign,
  3975. ret,
  3976. diffRes;
  3977. if (isDuration(input)) {
  3978. duration = {
  3979. ms: input._milliseconds,
  3980. d: input._days,
  3981. M: input._months,
  3982. };
  3983. } else if (isNumber(input) || !isNaN(+input)) {
  3984. duration = {};
  3985. if (key) {
  3986. duration[key] = +input;
  3987. } else {
  3988. duration.milliseconds = +input;
  3989. }
  3990. } else if ((match = aspNetRegex.exec(input))) {
  3991. sign = match[1] === '-' ? -1 : 1;
  3992. duration = {
  3993. y: 0,
  3994. d: toInt(match[DATE]) * sign,
  3995. h: toInt(match[HOUR]) * sign,
  3996. m: toInt(match[MINUTE]) * sign,
  3997. s: toInt(match[SECOND]) * sign,
  3998. ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match
  3999. };
  4000. } else if ((match = isoRegex.exec(input))) {
  4001. sign = match[1] === '-' ? -1 : 1;
  4002. duration = {
  4003. y: parseIso(match[2], sign),
  4004. M: parseIso(match[3], sign),
  4005. w: parseIso(match[4], sign),
  4006. d: parseIso(match[5], sign),
  4007. h: parseIso(match[6], sign),
  4008. m: parseIso(match[7], sign),
  4009. s: parseIso(match[8], sign),
  4010. };
  4011. } else if (duration == null) {
  4012. // checks for null or undefined
  4013. duration = {};
  4014. } else if (
  4015. typeof duration === 'object' &&
  4016. ('from' in duration || 'to' in duration)
  4017. ) {
  4018. diffRes = momentsDifference(
  4019. createLocal(duration.from),
  4020. createLocal(duration.to)
  4021. );
  4022. duration = {};
  4023. duration.ms = diffRes.milliseconds;
  4024. duration.M = diffRes.months;
  4025. }
  4026. ret = new Duration(duration);
  4027. if (isDuration(input) && hasOwnProp(input, '_locale')) {
  4028. ret._locale = input._locale;
  4029. }
  4030. if (isDuration(input) && hasOwnProp(input, '_isValid')) {
  4031. ret._isValid = input._isValid;
  4032. }
  4033. return ret;
  4034. }
  4035. createDuration.fn = Duration.prototype;
  4036. createDuration.invalid = createInvalid$1;
  4037. function parseIso(inp, sign) {
  4038. // We'd normally use ~~inp for this, but unfortunately it also
  4039. // converts floats to ints.
  4040. // inp may be undefined, so careful calling replace on it.
  4041. var res = inp && parseFloat(inp.replace(',', '.'));
  4042. // apply sign while we're at it
  4043. return (isNaN(res) ? 0 : res) * sign;
  4044. }
  4045. function positiveMomentsDifference(base, other) {
  4046. var res = {};
  4047. res.months =
  4048. other.month() - base.month() + (other.year() - base.year()) * 12;
  4049. if (base.clone().add(res.months, 'M').isAfter(other)) {
  4050. --res.months;
  4051. }
  4052. res.milliseconds = +other - +base.clone().add(res.months, 'M');
  4053. return res;
  4054. }
  4055. function momentsDifference(base, other) {
  4056. var res;
  4057. if (!(base.isValid() && other.isValid())) {
  4058. return { milliseconds: 0, months: 0 };
  4059. }
  4060. other = cloneWithOffset(other, base);
  4061. if (base.isBefore(other)) {
  4062. res = positiveMomentsDifference(base, other);
  4063. } else {
  4064. res = positiveMomentsDifference(other, base);
  4065. res.milliseconds = -res.milliseconds;
  4066. res.months = -res.months;
  4067. }
  4068. return res;
  4069. }
  4070. // TODO: remove 'name' arg after deprecation is removed
  4071. function createAdder(direction, name) {
  4072. return function (val, period) {
  4073. var dur, tmp;
  4074. //invert the arguments, but complain about it
  4075. if (period !== null && !isNaN(+period)) {
  4076. deprecateSimple(
  4077. name,
  4078. 'moment().' +
  4079. name +
  4080. '(period, number) is deprecated. Please use moment().' +
  4081. name +
  4082. '(number, period). ' +
  4083. 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'
  4084. );
  4085. tmp = val;
  4086. val = period;
  4087. period = tmp;
  4088. }
  4089. dur = createDuration(val, period);
  4090. addSubtract(this, dur, direction);
  4091. return this;
  4092. };
  4093. }
  4094. function addSubtract(mom, duration, isAdding, updateOffset) {
  4095. var milliseconds = duration._milliseconds,
  4096. days = absRound(duration._days),
  4097. months = absRound(duration._months);
  4098. if (!mom.isValid()) {
  4099. // No op
  4100. return;
  4101. }
  4102. updateOffset = updateOffset == null ? true : updateOffset;
  4103. if (months) {
  4104. setMonth(mom, get(mom, 'Month') + months * isAdding);
  4105. }
  4106. if (days) {
  4107. set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
  4108. }
  4109. if (milliseconds) {
  4110. mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
  4111. }
  4112. if (updateOffset) {
  4113. hooks.updateOffset(mom, days || months);
  4114. }
  4115. }
  4116. var add = createAdder(1, 'add'),
  4117. subtract = createAdder(-1, 'subtract');
  4118. function isString(input) {
  4119. return typeof input === 'string' || input instanceof String;
  4120. }
  4121. // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined
  4122. function isMomentInput(input) {
  4123. return (
  4124. isMoment(input) ||
  4125. isDate(input) ||
  4126. isString(input) ||
  4127. isNumber(input) ||
  4128. isNumberOrStringArray(input) ||
  4129. isMomentInputObject(input) ||
  4130. input === null ||
  4131. input === undefined
  4132. );
  4133. }
  4134. function isMomentInputObject(input) {
  4135. var objectTest = isObject(input) && !isObjectEmpty(input),
  4136. propertyTest = false,
  4137. properties = [
  4138. 'years',
  4139. 'year',
  4140. 'y',
  4141. 'months',
  4142. 'month',
  4143. 'M',
  4144. 'days',
  4145. 'day',
  4146. 'd',
  4147. 'dates',
  4148. 'date',
  4149. 'D',
  4150. 'hours',
  4151. 'hour',
  4152. 'h',
  4153. 'minutes',
  4154. 'minute',
  4155. 'm',
  4156. 'seconds',
  4157. 'second',
  4158. 's',
  4159. 'milliseconds',
  4160. 'millisecond',
  4161. 'ms',
  4162. ],
  4163. i,
  4164. property,
  4165. propertyLen = properties.length;
  4166. for (i = 0; i < propertyLen; i += 1) {
  4167. property = properties[i];
  4168. propertyTest = propertyTest || hasOwnProp(input, property);
  4169. }
  4170. return objectTest && propertyTest;
  4171. }
  4172. function isNumberOrStringArray(input) {
  4173. var arrayTest = isArray(input),
  4174. dataTypeTest = false;
  4175. if (arrayTest) {
  4176. dataTypeTest =
  4177. input.filter(function (item) {
  4178. return !isNumber(item) && isString(input);
  4179. }).length === 0;
  4180. }
  4181. return arrayTest && dataTypeTest;
  4182. }
  4183. function isCalendarSpec(input) {
  4184. var objectTest = isObject(input) && !isObjectEmpty(input),
  4185. propertyTest = false,
  4186. properties = [
  4187. 'sameDay',
  4188. 'nextDay',
  4189. 'lastDay',
  4190. 'nextWeek',
  4191. 'lastWeek',
  4192. 'sameElse',
  4193. ],
  4194. i,
  4195. property;
  4196. for (i = 0; i < properties.length; i += 1) {
  4197. property = properties[i];
  4198. propertyTest = propertyTest || hasOwnProp(input, property);
  4199. }
  4200. return objectTest && propertyTest;
  4201. }
  4202. function getCalendarFormat(myMoment, now) {
  4203. var diff = myMoment.diff(now, 'days', true);
  4204. return diff < -6
  4205. ? 'sameElse'
  4206. : diff < -1
  4207. ? 'lastWeek'
  4208. : diff < 0
  4209. ? 'lastDay'
  4210. : diff < 1
  4211. ? 'sameDay'
  4212. : diff < 2
  4213. ? 'nextDay'
  4214. : diff < 7
  4215. ? 'nextWeek'
  4216. : 'sameElse';
  4217. }
  4218. function calendar$1(time, formats) {
  4219. // Support for single parameter, formats only overload to the calendar function
  4220. if (arguments.length === 1) {
  4221. if (!arguments[0]) {
  4222. time = undefined;
  4223. formats = undefined;
  4224. } else if (isMomentInput(arguments[0])) {
  4225. time = arguments[0];
  4226. formats = undefined;
  4227. } else if (isCalendarSpec(arguments[0])) {
  4228. formats = arguments[0];
  4229. time = undefined;
  4230. }
  4231. }
  4232. // We want to compare the start of today, vs this.
  4233. // Getting start-of-today depends on whether we're local/utc/offset or not.
  4234. var now = time || createLocal(),
  4235. sod = cloneWithOffset(now, this).startOf('day'),
  4236. format = hooks.calendarFormat(this, sod) || 'sameElse',
  4237. output =
  4238. formats &&
  4239. (isFunction(formats[format])
  4240. ? formats[format].call(this, now)
  4241. : formats[format]);
  4242. return this.format(
  4243. output || this.localeData().calendar(format, this, createLocal(now))
  4244. );
  4245. }
  4246. function clone() {
  4247. return new Moment(this);
  4248. }
  4249. function isAfter(input, units) {
  4250. var localInput = isMoment(input) ? input : createLocal(input);
  4251. if (!(this.isValid() && localInput.isValid())) {
  4252. return false;
  4253. }
  4254. units = normalizeUnits(units) || 'millisecond';
  4255. if (units === 'millisecond') {
  4256. return this.valueOf() > localInput.valueOf();
  4257. } else {
  4258. return localInput.valueOf() < this.clone().startOf(units).valueOf();
  4259. }
  4260. }
  4261. function isBefore(input, units) {
  4262. var localInput = isMoment(input) ? input : createLocal(input);
  4263. if (!(this.isValid() && localInput.isValid())) {
  4264. return false;
  4265. }
  4266. units = normalizeUnits(units) || 'millisecond';
  4267. if (units === 'millisecond') {
  4268. return this.valueOf() < localInput.valueOf();
  4269. } else {
  4270. return this.clone().endOf(units).valueOf() < localInput.valueOf();
  4271. }
  4272. }
  4273. function isBetween(from, to, units, inclusivity) {
  4274. var localFrom = isMoment(from) ? from : createLocal(from),
  4275. localTo = isMoment(to) ? to : createLocal(to);
  4276. if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
  4277. return false;
  4278. }
  4279. inclusivity = inclusivity || '()';
  4280. return (
  4281. (inclusivity[0] === '('
  4282. ? this.isAfter(localFrom, units)
  4283. : !this.isBefore(localFrom, units)) &&
  4284. (inclusivity[1] === ')'
  4285. ? this.isBefore(localTo, units)
  4286. : !this.isAfter(localTo, units))
  4287. );
  4288. }
  4289. function isSame(input, units) {
  4290. var localInput = isMoment(input) ? input : createLocal(input),
  4291. inputMs;
  4292. if (!(this.isValid() && localInput.isValid())) {
  4293. return false;
  4294. }
  4295. units = normalizeUnits(units) || 'millisecond';
  4296. if (units === 'millisecond') {
  4297. return this.valueOf() === localInput.valueOf();
  4298. } else {
  4299. inputMs = localInput.valueOf();
  4300. return (
  4301. this.clone().startOf(units).valueOf() <= inputMs &&
  4302. inputMs <= this.clone().endOf(units).valueOf()
  4303. );
  4304. }
  4305. }
  4306. function isSameOrAfter(input, units) {
  4307. return this.isSame(input, units) || this.isAfter(input, units);
  4308. }
  4309. function isSameOrBefore(input, units) {
  4310. return this.isSame(input, units) || this.isBefore(input, units);
  4311. }
  4312. function diff(input, units, asFloat) {
  4313. var that, zoneDelta, output;
  4314. if (!this.isValid()) {
  4315. return NaN;
  4316. }
  4317. that = cloneWithOffset(input, this);
  4318. if (!that.isValid()) {
  4319. return NaN;
  4320. }
  4321. zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  4322. units = normalizeUnits(units);
  4323. switch (units) {
  4324. case 'year':
  4325. output = monthDiff(this, that) / 12;
  4326. break;
  4327. case 'month':
  4328. output = monthDiff(this, that);
  4329. break;
  4330. case 'quarter':
  4331. output = monthDiff(this, that) / 3;
  4332. break;
  4333. case 'second':
  4334. output = (this - that) / 1e3;
  4335. break; // 1000
  4336. case 'minute':
  4337. output = (this - that) / 6e4;
  4338. break; // 1000 * 60
  4339. case 'hour':
  4340. output = (this - that) / 36e5;
  4341. break; // 1000 * 60 * 60
  4342. case 'day':
  4343. output = (this - that - zoneDelta) / 864e5;
  4344. break; // 1000 * 60 * 60 * 24, negate dst
  4345. case 'week':
  4346. output = (this - that - zoneDelta) / 6048e5;
  4347. break; // 1000 * 60 * 60 * 24 * 7, negate dst
  4348. default:
  4349. output = this - that;
  4350. }
  4351. return asFloat ? output : absFloor(output);
  4352. }
  4353. function monthDiff(a, b) {
  4354. if (a.date() < b.date()) {
  4355. // end-of-month calculations work correct when the start month has more
  4356. // days than the end month.
  4357. return -monthDiff(b, a);
  4358. }
  4359. // difference in months
  4360. var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
  4361. // b is in (anchor - 1 month, anchor + 1 month)
  4362. anchor = a.clone().add(wholeMonthDiff, 'months'),
  4363. anchor2,
  4364. adjust;
  4365. if (b - anchor < 0) {
  4366. anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
  4367. // linear across the month
  4368. adjust = (b - anchor) / (anchor - anchor2);
  4369. } else {
  4370. anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
  4371. // linear across the month
  4372. adjust = (b - anchor) / (anchor2 - anchor);
  4373. }
  4374. //check for negative zero, return zero if negative zero
  4375. return -(wholeMonthDiff + adjust) || 0;
  4376. }
  4377. hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
  4378. hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
  4379. function toString() {
  4380. return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
  4381. }
  4382. function toISOString(keepOffset) {
  4383. if (!this.isValid()) {
  4384. return null;
  4385. }
  4386. var utc = keepOffset !== true,
  4387. m = utc ? this.clone().utc() : this;
  4388. if (m.year() < 0 || m.year() > 9999) {
  4389. return formatMoment(
  4390. m,
  4391. utc
  4392. ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'
  4393. : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'
  4394. );
  4395. }
  4396. if (isFunction(Date.prototype.toISOString)) {
  4397. // native implementation is ~50x faster, use it when we can
  4398. if (utc) {
  4399. return this.toDate().toISOString();
  4400. } else {
  4401. return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)
  4402. .toISOString()
  4403. .replace('Z', formatMoment(m, 'Z'));
  4404. }
  4405. }
  4406. return formatMoment(
  4407. m,
  4408. utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'
  4409. );
  4410. }
  4411. /**
  4412. * Return a human readable representation of a moment that can
  4413. * also be evaluated to get a new moment which is the same
  4414. *
  4415. * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
  4416. */
  4417. function inspect() {
  4418. if (!this.isValid()) {
  4419. return 'moment.invalid(/* ' + this._i + ' */)';
  4420. }
  4421. var func = 'moment',
  4422. zone = '',
  4423. prefix,
  4424. year,
  4425. datetime,
  4426. suffix;
  4427. if (!this.isLocal()) {
  4428. func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
  4429. zone = 'Z';
  4430. }
  4431. prefix = '[' + func + '("]';
  4432. year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';
  4433. datetime = '-MM-DD[T]HH:mm:ss.SSS';
  4434. suffix = zone + '[")]';
  4435. return this.format(prefix + year + datetime + suffix);
  4436. }
  4437. function format(inputString) {
  4438. if (!inputString) {
  4439. inputString = this.isUtc()
  4440. ? hooks.defaultFormatUtc
  4441. : hooks.defaultFormat;
  4442. }
  4443. var output = formatMoment(this, inputString);
  4444. return this.localeData().postformat(output);
  4445. }
  4446. function from(time, withoutSuffix) {
  4447. if (
  4448. this.isValid() &&
  4449. ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
  4450. ) {
  4451. return createDuration({ to: this, from: time })
  4452. .locale(this.locale())
  4453. .humanize(!withoutSuffix);
  4454. } else {
  4455. return this.localeData().invalidDate();
  4456. }
  4457. }
  4458. function fromNow(withoutSuffix) {
  4459. return this.from(createLocal(), withoutSuffix);
  4460. }
  4461. function to(time, withoutSuffix) {
  4462. if (
  4463. this.isValid() &&
  4464. ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
  4465. ) {
  4466. return createDuration({ from: this, to: time })
  4467. .locale(this.locale())
  4468. .humanize(!withoutSuffix);
  4469. } else {
  4470. return this.localeData().invalidDate();
  4471. }
  4472. }
  4473. function toNow(withoutSuffix) {
  4474. return this.to(createLocal(), withoutSuffix);
  4475. }
  4476. // If passed a locale key, it will set the locale for this
  4477. // instance. Otherwise, it will return the locale configuration
  4478. // variables for this instance.
  4479. function locale(key) {
  4480. var newLocaleData;
  4481. if (key === undefined) {
  4482. return this._locale._abbr;
  4483. } else {
  4484. newLocaleData = getLocale(key);
  4485. if (newLocaleData != null) {
  4486. this._locale = newLocaleData;
  4487. }
  4488. return this;
  4489. }
  4490. }
  4491. var lang = deprecate(
  4492. 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
  4493. function (key) {
  4494. if (key === undefined) {
  4495. return this.localeData();
  4496. } else {
  4497. return this.locale(key);
  4498. }
  4499. }
  4500. );
  4501. function localeData() {
  4502. return this._locale;
  4503. }
  4504. var MS_PER_SECOND = 1000,
  4505. MS_PER_MINUTE = 60 * MS_PER_SECOND,
  4506. MS_PER_HOUR = 60 * MS_PER_MINUTE,
  4507. MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
  4508. // actual modulo - handles negative numbers (for dates before 1970):
  4509. function mod$1(dividend, divisor) {
  4510. return ((dividend % divisor) + divisor) % divisor;
  4511. }
  4512. function localStartOfDate(y, m, d) {
  4513. // the date constructor remaps years 0-99 to 1900-1999
  4514. if (y < 100 && y >= 0) {
  4515. // preserve leap years using a full 400 year cycle, then reset
  4516. return new Date(y + 400, m, d) - MS_PER_400_YEARS;
  4517. } else {
  4518. return new Date(y, m, d).valueOf();
  4519. }
  4520. }
  4521. function utcStartOfDate(y, m, d) {
  4522. // Date.UTC remaps years 0-99 to 1900-1999
  4523. if (y < 100 && y >= 0) {
  4524. // preserve leap years using a full 400 year cycle, then reset
  4525. return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
  4526. } else {
  4527. return Date.UTC(y, m, d);
  4528. }
  4529. }
  4530. function startOf(units) {
  4531. var time, startOfDate;
  4532. units = normalizeUnits(units);
  4533. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  4534. return this;
  4535. }
  4536. startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  4537. switch (units) {
  4538. case 'year':
  4539. time = startOfDate(this.year(), 0, 1);
  4540. break;
  4541. case 'quarter':
  4542. time = startOfDate(
  4543. this.year(),
  4544. this.month() - (this.month() % 3),
  4545. 1
  4546. );
  4547. break;
  4548. case 'month':
  4549. time = startOfDate(this.year(), this.month(), 1);
  4550. break;
  4551. case 'week':
  4552. time = startOfDate(
  4553. this.year(),
  4554. this.month(),
  4555. this.date() - this.weekday()
  4556. );
  4557. break;
  4558. case 'isoWeek':
  4559. time = startOfDate(
  4560. this.year(),
  4561. this.month(),
  4562. this.date() - (this.isoWeekday() - 1)
  4563. );
  4564. break;
  4565. case 'day':
  4566. case 'date':
  4567. time = startOfDate(this.year(), this.month(), this.date());
  4568. break;
  4569. case 'hour':
  4570. time = this._d.valueOf();
  4571. time -= mod$1(
  4572. time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
  4573. MS_PER_HOUR
  4574. );
  4575. break;
  4576. case 'minute':
  4577. time = this._d.valueOf();
  4578. time -= mod$1(time, MS_PER_MINUTE);
  4579. break;
  4580. case 'second':
  4581. time = this._d.valueOf();
  4582. time -= mod$1(time, MS_PER_SECOND);
  4583. break;
  4584. }
  4585. this._d.setTime(time);
  4586. hooks.updateOffset(this, true);
  4587. return this;
  4588. }
  4589. function endOf(units) {
  4590. var time, startOfDate;
  4591. units = normalizeUnits(units);
  4592. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  4593. return this;
  4594. }
  4595. startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  4596. switch (units) {
  4597. case 'year':
  4598. time = startOfDate(this.year() + 1, 0, 1) - 1;
  4599. break;
  4600. case 'quarter':
  4601. time =
  4602. startOfDate(
  4603. this.year(),
  4604. this.month() - (this.month() % 3) + 3,
  4605. 1
  4606. ) - 1;
  4607. break;
  4608. case 'month':
  4609. time = startOfDate(this.year(), this.month() + 1, 1) - 1;
  4610. break;
  4611. case 'week':
  4612. time =
  4613. startOfDate(
  4614. this.year(),
  4615. this.month(),
  4616. this.date() - this.weekday() + 7
  4617. ) - 1;
  4618. break;
  4619. case 'isoWeek':
  4620. time =
  4621. startOfDate(
  4622. this.year(),
  4623. this.month(),
  4624. this.date() - (this.isoWeekday() - 1) + 7
  4625. ) - 1;
  4626. break;
  4627. case 'day':
  4628. case 'date':
  4629. time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
  4630. break;
  4631. case 'hour':
  4632. time = this._d.valueOf();
  4633. time +=
  4634. MS_PER_HOUR -
  4635. mod$1(
  4636. time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
  4637. MS_PER_HOUR
  4638. ) -
  4639. 1;
  4640. break;
  4641. case 'minute':
  4642. time = this._d.valueOf();
  4643. time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
  4644. break;
  4645. case 'second':
  4646. time = this._d.valueOf();
  4647. time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
  4648. break;
  4649. }
  4650. this._d.setTime(time);
  4651. hooks.updateOffset(this, true);
  4652. return this;
  4653. }
  4654. function valueOf() {
  4655. return this._d.valueOf() - (this._offset || 0) * 60000;
  4656. }
  4657. function unix() {
  4658. return Math.floor(this.valueOf() / 1000);
  4659. }
  4660. function toDate() {
  4661. return new Date(this.valueOf());
  4662. }
  4663. function toArray() {
  4664. var m = this;
  4665. return [
  4666. m.year(),
  4667. m.month(),
  4668. m.date(),
  4669. m.hour(),
  4670. m.minute(),
  4671. m.second(),
  4672. m.millisecond(),
  4673. ];
  4674. }
  4675. function toObject() {
  4676. var m = this;
  4677. return {
  4678. years: m.year(),
  4679. months: m.month(),
  4680. date: m.date(),
  4681. hours: m.hours(),
  4682. minutes: m.minutes(),
  4683. seconds: m.seconds(),
  4684. milliseconds: m.milliseconds(),
  4685. };
  4686. }
  4687. function toJSON() {
  4688. // new Date(NaN).toJSON() === null
  4689. return this.isValid() ? this.toISOString() : null;
  4690. }
  4691. function isValid$2() {
  4692. return isValid(this);
  4693. }
  4694. function parsingFlags() {
  4695. return extend({}, getParsingFlags(this));
  4696. }
  4697. function invalidAt() {
  4698. return getParsingFlags(this).overflow;
  4699. }
  4700. function creationData() {
  4701. return {
  4702. input: this._i,
  4703. format: this._f,
  4704. locale: this._locale,
  4705. isUTC: this._isUTC,
  4706. strict: this._strict,
  4707. };
  4708. }
  4709. addFormatToken('N', 0, 0, 'eraAbbr');
  4710. addFormatToken('NN', 0, 0, 'eraAbbr');
  4711. addFormatToken('NNN', 0, 0, 'eraAbbr');
  4712. addFormatToken('NNNN', 0, 0, 'eraName');
  4713. addFormatToken('NNNNN', 0, 0, 'eraNarrow');
  4714. addFormatToken('y', ['y', 1], 'yo', 'eraYear');
  4715. addFormatToken('y', ['yy', 2], 0, 'eraYear');
  4716. addFormatToken('y', ['yyy', 3], 0, 'eraYear');
  4717. addFormatToken('y', ['yyyy', 4], 0, 'eraYear');
  4718. addRegexToken('N', matchEraAbbr);
  4719. addRegexToken('NN', matchEraAbbr);
  4720. addRegexToken('NNN', matchEraAbbr);
  4721. addRegexToken('NNNN', matchEraName);
  4722. addRegexToken('NNNNN', matchEraNarrow);
  4723. addParseToken(
  4724. ['N', 'NN', 'NNN', 'NNNN', 'NNNNN'],
  4725. function (input, array, config, token) {
  4726. var era = config._locale.erasParse(input, token, config._strict);
  4727. if (era) {
  4728. getParsingFlags(config).era = era;
  4729. } else {
  4730. getParsingFlags(config).invalidEra = input;
  4731. }
  4732. }
  4733. );
  4734. addRegexToken('y', matchUnsigned);
  4735. addRegexToken('yy', matchUnsigned);
  4736. addRegexToken('yyy', matchUnsigned);
  4737. addRegexToken('yyyy', matchUnsigned);
  4738. addRegexToken('yo', matchEraYearOrdinal);
  4739. addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);
  4740. addParseToken(['yo'], function (input, array, config, token) {
  4741. var match;
  4742. if (config._locale._eraYearOrdinalRegex) {
  4743. match = input.match(config._locale._eraYearOrdinalRegex);
  4744. }
  4745. if (config._locale.eraYearOrdinalParse) {
  4746. array[YEAR] = config._locale.eraYearOrdinalParse(input, match);
  4747. } else {
  4748. array[YEAR] = parseInt(input, 10);
  4749. }
  4750. });
  4751. function localeEras(m, format) {
  4752. var i,
  4753. l,
  4754. date,
  4755. eras = this._eras || getLocale('en')._eras;
  4756. for (i = 0, l = eras.length; i < l; ++i) {
  4757. switch (typeof eras[i].since) {
  4758. case 'string':
  4759. // truncate time
  4760. date = hooks(eras[i].since).startOf('day');
  4761. eras[i].since = date.valueOf();
  4762. break;
  4763. }
  4764. switch (typeof eras[i].until) {
  4765. case 'undefined':
  4766. eras[i].until = +Infinity;
  4767. break;
  4768. case 'string':
  4769. // truncate time
  4770. date = hooks(eras[i].until).startOf('day').valueOf();
  4771. eras[i].until = date.valueOf();
  4772. break;
  4773. }
  4774. }
  4775. return eras;
  4776. }
  4777. function localeErasParse(eraName, format, strict) {
  4778. var i,
  4779. l,
  4780. eras = this.eras(),
  4781. name,
  4782. abbr,
  4783. narrow;
  4784. eraName = eraName.toUpperCase();
  4785. for (i = 0, l = eras.length; i < l; ++i) {
  4786. name = eras[i].name.toUpperCase();
  4787. abbr = eras[i].abbr.toUpperCase();
  4788. narrow = eras[i].narrow.toUpperCase();
  4789. if (strict) {
  4790. switch (format) {
  4791. case 'N':
  4792. case 'NN':
  4793. case 'NNN':
  4794. if (abbr === eraName) {
  4795. return eras[i];
  4796. }
  4797. break;
  4798. case 'NNNN':
  4799. if (name === eraName) {
  4800. return eras[i];
  4801. }
  4802. break;
  4803. case 'NNNNN':
  4804. if (narrow === eraName) {
  4805. return eras[i];
  4806. }
  4807. break;
  4808. }
  4809. } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
  4810. return eras[i];
  4811. }
  4812. }
  4813. }
  4814. function localeErasConvertYear(era, year) {
  4815. var dir = era.since <= era.until ? +1 : -1;
  4816. if (year === undefined) {
  4817. return hooks(era.since).year();
  4818. } else {
  4819. return hooks(era.since).year() + (year - era.offset) * dir;
  4820. }
  4821. }
  4822. function getEraName() {
  4823. var i,
  4824. l,
  4825. val,
  4826. eras = this.localeData().eras();
  4827. for (i = 0, l = eras.length; i < l; ++i) {
  4828. // truncate time
  4829. val = this.clone().startOf('day').valueOf();
  4830. if (eras[i].since <= val && val <= eras[i].until) {
  4831. return eras[i].name;
  4832. }
  4833. if (eras[i].until <= val && val <= eras[i].since) {
  4834. return eras[i].name;
  4835. }
  4836. }
  4837. return '';
  4838. }
  4839. function getEraNarrow() {
  4840. var i,
  4841. l,
  4842. val,
  4843. eras = this.localeData().eras();
  4844. for (i = 0, l = eras.length; i < l; ++i) {
  4845. // truncate time
  4846. val = this.clone().startOf('day').valueOf();
  4847. if (eras[i].since <= val && val <= eras[i].until) {
  4848. return eras[i].narrow;
  4849. }
  4850. if (eras[i].until <= val && val <= eras[i].since) {
  4851. return eras[i].narrow;
  4852. }
  4853. }
  4854. return '';
  4855. }
  4856. function getEraAbbr() {
  4857. var i,
  4858. l,
  4859. val,
  4860. eras = this.localeData().eras();
  4861. for (i = 0, l = eras.length; i < l; ++i) {
  4862. // truncate time
  4863. val = this.clone().startOf('day').valueOf();
  4864. if (eras[i].since <= val && val <= eras[i].until) {
  4865. return eras[i].abbr;
  4866. }
  4867. if (eras[i].until <= val && val <= eras[i].since) {
  4868. return eras[i].abbr;
  4869. }
  4870. }
  4871. return '';
  4872. }
  4873. function getEraYear() {
  4874. var i,
  4875. l,
  4876. dir,
  4877. val,
  4878. eras = this.localeData().eras();
  4879. for (i = 0, l = eras.length; i < l; ++i) {
  4880. dir = eras[i].since <= eras[i].until ? +1 : -1;
  4881. // truncate time
  4882. val = this.clone().startOf('day').valueOf();
  4883. if (
  4884. (eras[i].since <= val && val <= eras[i].until) ||
  4885. (eras[i].until <= val && val <= eras[i].since)
  4886. ) {
  4887. return (
  4888. (this.year() - hooks(eras[i].since).year()) * dir +
  4889. eras[i].offset
  4890. );
  4891. }
  4892. }
  4893. return this.year();
  4894. }
  4895. function erasNameRegex(isStrict) {
  4896. if (!hasOwnProp(this, '_erasNameRegex')) {
  4897. computeErasParse.call(this);
  4898. }
  4899. return isStrict ? this._erasNameRegex : this._erasRegex;
  4900. }
  4901. function erasAbbrRegex(isStrict) {
  4902. if (!hasOwnProp(this, '_erasAbbrRegex')) {
  4903. computeErasParse.call(this);
  4904. }
  4905. return isStrict ? this._erasAbbrRegex : this._erasRegex;
  4906. }
  4907. function erasNarrowRegex(isStrict) {
  4908. if (!hasOwnProp(this, '_erasNarrowRegex')) {
  4909. computeErasParse.call(this);
  4910. }
  4911. return isStrict ? this._erasNarrowRegex : this._erasRegex;
  4912. }
  4913. function matchEraAbbr(isStrict, locale) {
  4914. return locale.erasAbbrRegex(isStrict);
  4915. }
  4916. function matchEraName(isStrict, locale) {
  4917. return locale.erasNameRegex(isStrict);
  4918. }
  4919. function matchEraNarrow(isStrict, locale) {
  4920. return locale.erasNarrowRegex(isStrict);
  4921. }
  4922. function matchEraYearOrdinal(isStrict, locale) {
  4923. return locale._eraYearOrdinalRegex || matchUnsigned;
  4924. }
  4925. function computeErasParse() {
  4926. var abbrPieces = [],
  4927. namePieces = [],
  4928. narrowPieces = [],
  4929. mixedPieces = [],
  4930. i,
  4931. l,
  4932. eras = this.eras();
  4933. for (i = 0, l = eras.length; i < l; ++i) {
  4934. namePieces.push(regexEscape(eras[i].name));
  4935. abbrPieces.push(regexEscape(eras[i].abbr));
  4936. narrowPieces.push(regexEscape(eras[i].narrow));
  4937. mixedPieces.push(regexEscape(eras[i].name));
  4938. mixedPieces.push(regexEscape(eras[i].abbr));
  4939. mixedPieces.push(regexEscape(eras[i].narrow));
  4940. }
  4941. this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  4942. this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');
  4943. this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');
  4944. this._erasNarrowRegex = new RegExp(
  4945. '^(' + narrowPieces.join('|') + ')',
  4946. 'i'
  4947. );
  4948. }
  4949. // FORMATTING
  4950. addFormatToken(0, ['gg', 2], 0, function () {
  4951. return this.weekYear() % 100;
  4952. });
  4953. addFormatToken(0, ['GG', 2], 0, function () {
  4954. return this.isoWeekYear() % 100;
  4955. });
  4956. function addWeekYearFormatToken(token, getter) {
  4957. addFormatToken(0, [token, token.length], 0, getter);
  4958. }
  4959. addWeekYearFormatToken('gggg', 'weekYear');
  4960. addWeekYearFormatToken('ggggg', 'weekYear');
  4961. addWeekYearFormatToken('GGGG', 'isoWeekYear');
  4962. addWeekYearFormatToken('GGGGG', 'isoWeekYear');
  4963. // ALIASES
  4964. addUnitAlias('weekYear', 'gg');
  4965. addUnitAlias('isoWeekYear', 'GG');
  4966. // PRIORITY
  4967. addUnitPriority('weekYear', 1);
  4968. addUnitPriority('isoWeekYear', 1);
  4969. // PARSING
  4970. addRegexToken('G', matchSigned);
  4971. addRegexToken('g', matchSigned);
  4972. addRegexToken('GG', match1to2, match2);
  4973. addRegexToken('gg', match1to2, match2);
  4974. addRegexToken('GGGG', match1to4, match4);
  4975. addRegexToken('gggg', match1to4, match4);
  4976. addRegexToken('GGGGG', match1to6, match6);
  4977. addRegexToken('ggggg', match1to6, match6);
  4978. addWeekParseToken(
  4979. ['gggg', 'ggggg', 'GGGG', 'GGGGG'],
  4980. function (input, week, config, token) {
  4981. week[token.substr(0, 2)] = toInt(input);
  4982. }
  4983. );
  4984. addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
  4985. week[token] = hooks.parseTwoDigitYear(input);
  4986. });
  4987. // MOMENTS
  4988. function getSetWeekYear(input) {
  4989. return getSetWeekYearHelper.call(
  4990. this,
  4991. input,
  4992. this.week(),
  4993. this.weekday(),
  4994. this.localeData()._week.dow,
  4995. this.localeData()._week.doy
  4996. );
  4997. }
  4998. function getSetISOWeekYear(input) {
  4999. return getSetWeekYearHelper.call(
  5000. this,
  5001. input,
  5002. this.isoWeek(),
  5003. this.isoWeekday(),
  5004. 1,
  5005. 4
  5006. );
  5007. }
  5008. function getISOWeeksInYear() {
  5009. return weeksInYear(this.year(), 1, 4);
  5010. }
  5011. function getISOWeeksInISOWeekYear() {
  5012. return weeksInYear(this.isoWeekYear(), 1, 4);
  5013. }
  5014. function getWeeksInYear() {
  5015. var weekInfo = this.localeData()._week;
  5016. return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
  5017. }
  5018. function getWeeksInWeekYear() {
  5019. var weekInfo = this.localeData()._week;
  5020. return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
  5021. }
  5022. function getSetWeekYearHelper(input, week, weekday, dow, doy) {
  5023. var weeksTarget;
  5024. if (input == null) {
  5025. return weekOfYear(this, dow, doy).year;
  5026. } else {
  5027. weeksTarget = weeksInYear(input, dow, doy);
  5028. if (week > weeksTarget) {
  5029. week = weeksTarget;
  5030. }
  5031. return setWeekAll.call(this, input, week, weekday, dow, doy);
  5032. }
  5033. }
  5034. function setWeekAll(weekYear, week, weekday, dow, doy) {
  5035. var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
  5036. date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  5037. this.year(date.getUTCFullYear());
  5038. this.month(date.getUTCMonth());
  5039. this.date(date.getUTCDate());
  5040. return this;
  5041. }
  5042. // FORMATTING
  5043. addFormatToken('Q', 0, 'Qo', 'quarter');
  5044. // ALIASES
  5045. addUnitAlias('quarter', 'Q');
  5046. // PRIORITY
  5047. addUnitPriority('quarter', 7);
  5048. // PARSING
  5049. addRegexToken('Q', match1);
  5050. addParseToken('Q', function (input, array) {
  5051. array[MONTH] = (toInt(input) - 1) * 3;
  5052. });
  5053. // MOMENTS
  5054. function getSetQuarter(input) {
  5055. return input == null
  5056. ? Math.ceil((this.month() + 1) / 3)
  5057. : this.month((input - 1) * 3 + (this.month() % 3));
  5058. }
  5059. // FORMATTING
  5060. addFormatToken('D', ['DD', 2], 'Do', 'date');
  5061. // ALIASES
  5062. addUnitAlias('date', 'D');
  5063. // PRIORITY
  5064. addUnitPriority('date', 9);
  5065. // PARSING
  5066. addRegexToken('D', match1to2);
  5067. addRegexToken('DD', match1to2, match2);
  5068. addRegexToken('Do', function (isStrict, locale) {
  5069. // TODO: Remove "ordinalParse" fallback in next major release.
  5070. return isStrict
  5071. ? locale._dayOfMonthOrdinalParse || locale._ordinalParse
  5072. : locale._dayOfMonthOrdinalParseLenient;
  5073. });
  5074. addParseToken(['D', 'DD'], DATE);
  5075. addParseToken('Do', function (input, array) {
  5076. array[DATE] = toInt(input.match(match1to2)[0]);
  5077. });
  5078. // MOMENTS
  5079. var getSetDayOfMonth = makeGetSet('Date', true);
  5080. // FORMATTING
  5081. addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
  5082. // ALIASES
  5083. addUnitAlias('dayOfYear', 'DDD');
  5084. // PRIORITY
  5085. addUnitPriority('dayOfYear', 4);
  5086. // PARSING
  5087. addRegexToken('DDD', match1to3);
  5088. addRegexToken('DDDD', match3);
  5089. addParseToken(['DDD', 'DDDD'], function (input, array, config) {
  5090. config._dayOfYear = toInt(input);
  5091. });
  5092. // HELPERS
  5093. // MOMENTS
  5094. function getSetDayOfYear(input) {
  5095. var dayOfYear =
  5096. Math.round(
  5097. (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5
  5098. ) + 1;
  5099. return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
  5100. }
  5101. // FORMATTING
  5102. addFormatToken('m', ['mm', 2], 0, 'minute');
  5103. // ALIASES
  5104. addUnitAlias('minute', 'm');
  5105. // PRIORITY
  5106. addUnitPriority('minute', 14);
  5107. // PARSING
  5108. addRegexToken('m', match1to2);
  5109. addRegexToken('mm', match1to2, match2);
  5110. addParseToken(['m', 'mm'], MINUTE);
  5111. // MOMENTS
  5112. var getSetMinute = makeGetSet('Minutes', false);
  5113. // FORMATTING
  5114. addFormatToken('s', ['ss', 2], 0, 'second');
  5115. // ALIASES
  5116. addUnitAlias('second', 's');
  5117. // PRIORITY
  5118. addUnitPriority('second', 15);
  5119. // PARSING
  5120. addRegexToken('s', match1to2);
  5121. addRegexToken('ss', match1to2, match2);
  5122. addParseToken(['s', 'ss'], SECOND);
  5123. // MOMENTS
  5124. var getSetSecond = makeGetSet('Seconds', false);
  5125. // FORMATTING
  5126. addFormatToken('S', 0, 0, function () {
  5127. return ~~(this.millisecond() / 100);
  5128. });
  5129. addFormatToken(0, ['SS', 2], 0, function () {
  5130. return ~~(this.millisecond() / 10);
  5131. });
  5132. addFormatToken(0, ['SSS', 3], 0, 'millisecond');
  5133. addFormatToken(0, ['SSSS', 4], 0, function () {
  5134. return this.millisecond() * 10;
  5135. });
  5136. addFormatToken(0, ['SSSSS', 5], 0, function () {
  5137. return this.millisecond() * 100;
  5138. });
  5139. addFormatToken(0, ['SSSSSS', 6], 0, function () {
  5140. return this.millisecond() * 1000;
  5141. });
  5142. addFormatToken(0, ['SSSSSSS', 7], 0, function () {
  5143. return this.millisecond() * 10000;
  5144. });
  5145. addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
  5146. return this.millisecond() * 100000;
  5147. });
  5148. addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
  5149. return this.millisecond() * 1000000;
  5150. });
  5151. // ALIASES
  5152. addUnitAlias('millisecond', 'ms');
  5153. // PRIORITY
  5154. addUnitPriority('millisecond', 16);
  5155. // PARSING
  5156. addRegexToken('S', match1to3, match1);
  5157. addRegexToken('SS', match1to3, match2);
  5158. addRegexToken('SSS', match1to3, match3);
  5159. var token, getSetMillisecond;
  5160. for (token = 'SSSS'; token.length <= 9; token += 'S') {
  5161. addRegexToken(token, matchUnsigned);
  5162. }
  5163. function parseMs(input, array) {
  5164. array[MILLISECOND] = toInt(('0.' + input) * 1000);
  5165. }
  5166. for (token = 'S'; token.length <= 9; token += 'S') {
  5167. addParseToken(token, parseMs);
  5168. }
  5169. getSetMillisecond = makeGetSet('Milliseconds', false);
  5170. // FORMATTING
  5171. addFormatToken('z', 0, 0, 'zoneAbbr');
  5172. addFormatToken('zz', 0, 0, 'zoneName');
  5173. // MOMENTS
  5174. function getZoneAbbr() {
  5175. return this._isUTC ? 'UTC' : '';
  5176. }
  5177. function getZoneName() {
  5178. return this._isUTC ? 'Coordinated Universal Time' : '';
  5179. }
  5180. var proto = Moment.prototype;
  5181. proto.add = add;
  5182. proto.calendar = calendar$1;
  5183. proto.clone = clone;
  5184. proto.diff = diff;
  5185. proto.endOf = endOf;
  5186. proto.format = format;
  5187. proto.from = from;
  5188. proto.fromNow = fromNow;
  5189. proto.to = to;
  5190. proto.toNow = toNow;
  5191. proto.get = stringGet;
  5192. proto.invalidAt = invalidAt;
  5193. proto.isAfter = isAfter;
  5194. proto.isBefore = isBefore;
  5195. proto.isBetween = isBetween;
  5196. proto.isSame = isSame;
  5197. proto.isSameOrAfter = isSameOrAfter;
  5198. proto.isSameOrBefore = isSameOrBefore;
  5199. proto.isValid = isValid$2;
  5200. proto.lang = lang;
  5201. proto.locale = locale;
  5202. proto.localeData = localeData;
  5203. proto.max = prototypeMax;
  5204. proto.min = prototypeMin;
  5205. proto.parsingFlags = parsingFlags;
  5206. proto.set = stringSet;
  5207. proto.startOf = startOf;
  5208. proto.subtract = subtract;
  5209. proto.toArray = toArray;
  5210. proto.toObject = toObject;
  5211. proto.toDate = toDate;
  5212. proto.toISOString = toISOString;
  5213. proto.inspect = inspect;
  5214. if (typeof Symbol !== 'undefined' && Symbol.for != null) {
  5215. proto[Symbol.for('nodejs.util.inspect.custom')] = function () {
  5216. return 'Moment<' + this.format() + '>';
  5217. };
  5218. }
  5219. proto.toJSON = toJSON;
  5220. proto.toString = toString;
  5221. proto.unix = unix;
  5222. proto.valueOf = valueOf;
  5223. proto.creationData = creationData;
  5224. proto.eraName = getEraName;
  5225. proto.eraNarrow = getEraNarrow;
  5226. proto.eraAbbr = getEraAbbr;
  5227. proto.eraYear = getEraYear;
  5228. proto.year = getSetYear;
  5229. proto.isLeapYear = getIsLeapYear;
  5230. proto.weekYear = getSetWeekYear;
  5231. proto.isoWeekYear = getSetISOWeekYear;
  5232. proto.quarter = proto.quarters = getSetQuarter;
  5233. proto.month = getSetMonth;
  5234. proto.daysInMonth = getDaysInMonth;
  5235. proto.week = proto.weeks = getSetWeek;
  5236. proto.isoWeek = proto.isoWeeks = getSetISOWeek;
  5237. proto.weeksInYear = getWeeksInYear;
  5238. proto.weeksInWeekYear = getWeeksInWeekYear;
  5239. proto.isoWeeksInYear = getISOWeeksInYear;
  5240. proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
  5241. proto.date = getSetDayOfMonth;
  5242. proto.day = proto.days = getSetDayOfWeek;
  5243. proto.weekday = getSetLocaleDayOfWeek;
  5244. proto.isoWeekday = getSetISODayOfWeek;
  5245. proto.dayOfYear = getSetDayOfYear;
  5246. proto.hour = proto.hours = getSetHour;
  5247. proto.minute = proto.minutes = getSetMinute;
  5248. proto.second = proto.seconds = getSetSecond;
  5249. proto.millisecond = proto.milliseconds = getSetMillisecond;
  5250. proto.utcOffset = getSetOffset;
  5251. proto.utc = setOffsetToUTC;
  5252. proto.local = setOffsetToLocal;
  5253. proto.parseZone = setOffsetToParsedOffset;
  5254. proto.hasAlignedHourOffset = hasAlignedHourOffset;
  5255. proto.isDST = isDaylightSavingTime;
  5256. proto.isLocal = isLocal;
  5257. proto.isUtcOffset = isUtcOffset;
  5258. proto.isUtc = isUtc;
  5259. proto.isUTC = isUtc;
  5260. proto.zoneAbbr = getZoneAbbr;
  5261. proto.zoneName = getZoneName;
  5262. proto.dates = deprecate(
  5263. 'dates accessor is deprecated. Use date instead.',
  5264. getSetDayOfMonth
  5265. );
  5266. proto.months = deprecate(
  5267. 'months accessor is deprecated. Use month instead',
  5268. getSetMonth
  5269. );
  5270. proto.years = deprecate(
  5271. 'years accessor is deprecated. Use year instead',
  5272. getSetYear
  5273. );
  5274. proto.zone = deprecate(
  5275. 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',
  5276. getSetZone
  5277. );
  5278. proto.isDSTShifted = deprecate(
  5279. 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',
  5280. isDaylightSavingTimeShifted
  5281. );
  5282. function createUnix(input) {
  5283. return createLocal(input * 1000);
  5284. }
  5285. function createInZone() {
  5286. return createLocal.apply(null, arguments).parseZone();
  5287. }
  5288. function preParsePostFormat(string) {
  5289. return string;
  5290. }
  5291. var proto$1 = Locale.prototype;
  5292. proto$1.calendar = calendar;
  5293. proto$1.longDateFormat = longDateFormat;
  5294. proto$1.invalidDate = invalidDate;
  5295. proto$1.ordinal = ordinal;
  5296. proto$1.preparse = preParsePostFormat;
  5297. proto$1.postformat = preParsePostFormat;
  5298. proto$1.relativeTime = relativeTime;
  5299. proto$1.pastFuture = pastFuture;
  5300. proto$1.set = set;
  5301. proto$1.eras = localeEras;
  5302. proto$1.erasParse = localeErasParse;
  5303. proto$1.erasConvertYear = localeErasConvertYear;
  5304. proto$1.erasAbbrRegex = erasAbbrRegex;
  5305. proto$1.erasNameRegex = erasNameRegex;
  5306. proto$1.erasNarrowRegex = erasNarrowRegex;
  5307. proto$1.months = localeMonths;
  5308. proto$1.monthsShort = localeMonthsShort;
  5309. proto$1.monthsParse = localeMonthsParse;
  5310. proto$1.monthsRegex = monthsRegex;
  5311. proto$1.monthsShortRegex = monthsShortRegex;
  5312. proto$1.week = localeWeek;
  5313. proto$1.firstDayOfYear = localeFirstDayOfYear;
  5314. proto$1.firstDayOfWeek = localeFirstDayOfWeek;
  5315. proto$1.weekdays = localeWeekdays;
  5316. proto$1.weekdaysMin = localeWeekdaysMin;
  5317. proto$1.weekdaysShort = localeWeekdaysShort;
  5318. proto$1.weekdaysParse = localeWeekdaysParse;
  5319. proto$1.weekdaysRegex = weekdaysRegex;
  5320. proto$1.weekdaysShortRegex = weekdaysShortRegex;
  5321. proto$1.weekdaysMinRegex = weekdaysMinRegex;
  5322. proto$1.isPM = localeIsPM;
  5323. proto$1.meridiem = localeMeridiem;
  5324. function get$1(format, index, field, setter) {
  5325. var locale = getLocale(),
  5326. utc = createUTC().set(setter, index);
  5327. return locale[field](utc, format);
  5328. }
  5329. function listMonthsImpl(format, index, field) {
  5330. if (isNumber(format)) {
  5331. index = format;
  5332. format = undefined;
  5333. }
  5334. format = format || '';
  5335. if (index != null) {
  5336. return get$1(format, index, field, 'month');
  5337. }
  5338. var i,
  5339. out = [];
  5340. for (i = 0; i < 12; i++) {
  5341. out[i] = get$1(format, i, field, 'month');
  5342. }
  5343. return out;
  5344. }
  5345. // ()
  5346. // (5)
  5347. // (fmt, 5)
  5348. // (fmt)
  5349. // (true)
  5350. // (true, 5)
  5351. // (true, fmt, 5)
  5352. // (true, fmt)
  5353. function listWeekdaysImpl(localeSorted, format, index, field) {
  5354. if (typeof localeSorted === 'boolean') {
  5355. if (isNumber(format)) {
  5356. index = format;
  5357. format = undefined;
  5358. }
  5359. format = format || '';
  5360. } else {
  5361. format = localeSorted;
  5362. index = format;
  5363. localeSorted = false;
  5364. if (isNumber(format)) {
  5365. index = format;
  5366. format = undefined;
  5367. }
  5368. format = format || '';
  5369. }
  5370. var locale = getLocale(),
  5371. shift = localeSorted ? locale._week.dow : 0,
  5372. i,
  5373. out = [];
  5374. if (index != null) {
  5375. return get$1(format, (index + shift) % 7, field, 'day');
  5376. }
  5377. for (i = 0; i < 7; i++) {
  5378. out[i] = get$1(format, (i + shift) % 7, field, 'day');
  5379. }
  5380. return out;
  5381. }
  5382. function listMonths(format, index) {
  5383. return listMonthsImpl(format, index, 'months');
  5384. }
  5385. function listMonthsShort(format, index) {
  5386. return listMonthsImpl(format, index, 'monthsShort');
  5387. }
  5388. function listWeekdays(localeSorted, format, index) {
  5389. return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
  5390. }
  5391. function listWeekdaysShort(localeSorted, format, index) {
  5392. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
  5393. }
  5394. function listWeekdaysMin(localeSorted, format, index) {
  5395. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
  5396. }
  5397. getSetGlobalLocale('en', {
  5398. eras: [
  5399. {
  5400. since: '0001-01-01',
  5401. until: +Infinity,
  5402. offset: 1,
  5403. name: 'Anno Domini',
  5404. narrow: 'AD',
  5405. abbr: 'AD',
  5406. },
  5407. {
  5408. since: '0000-12-31',
  5409. until: -Infinity,
  5410. offset: 1,
  5411. name: 'Before Christ',
  5412. narrow: 'BC',
  5413. abbr: 'BC',
  5414. },
  5415. ],
  5416. dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  5417. ordinal: function (number) {
  5418. var b = number % 10,
  5419. output =
  5420. toInt((number % 100) / 10) === 1
  5421. ? 'th'
  5422. : b === 1
  5423. ? 'st'
  5424. : b === 2
  5425. ? 'nd'
  5426. : b === 3
  5427. ? 'rd'
  5428. : 'th';
  5429. return number + output;
  5430. },
  5431. });
  5432. // Side effect imports
  5433. hooks.lang = deprecate(
  5434. 'moment.lang is deprecated. Use moment.locale instead.',
  5435. getSetGlobalLocale
  5436. );
  5437. hooks.langData = deprecate(
  5438. 'moment.langData is deprecated. Use moment.localeData instead.',
  5439. getLocale
  5440. );
  5441. var mathAbs = Math.abs;
  5442. function abs() {
  5443. var data = this._data;
  5444. this._milliseconds = mathAbs(this._milliseconds);
  5445. this._days = mathAbs(this._days);
  5446. this._months = mathAbs(this._months);
  5447. data.milliseconds = mathAbs(data.milliseconds);
  5448. data.seconds = mathAbs(data.seconds);
  5449. data.minutes = mathAbs(data.minutes);
  5450. data.hours = mathAbs(data.hours);
  5451. data.months = mathAbs(data.months);
  5452. data.years = mathAbs(data.years);
  5453. return this;
  5454. }
  5455. function addSubtract$1(duration, input, value, direction) {
  5456. var other = createDuration(input, value);
  5457. duration._milliseconds += direction * other._milliseconds;
  5458. duration._days += direction * other._days;
  5459. duration._months += direction * other._months;
  5460. return duration._bubble();
  5461. }
  5462. // supports only 2.0-style add(1, 's') or add(duration)
  5463. function add$1(input, value) {
  5464. return addSubtract$1(this, input, value, 1);
  5465. }
  5466. // supports only 2.0-style subtract(1, 's') or subtract(duration)
  5467. function subtract$1(input, value) {
  5468. return addSubtract$1(this, input, value, -1);
  5469. }
  5470. function absCeil(number) {
  5471. if (number < 0) {
  5472. return Math.floor(number);
  5473. } else {
  5474. return Math.ceil(number);
  5475. }
  5476. }
  5477. function bubble() {
  5478. var milliseconds = this._milliseconds,
  5479. days = this._days,
  5480. months = this._months,
  5481. data = this._data,
  5482. seconds,
  5483. minutes,
  5484. hours,
  5485. years,
  5486. monthsFromDays;
  5487. // if we have a mix of positive and negative values, bubble down first
  5488. // check: https://github.com/moment/moment/issues/2166
  5489. if (
  5490. !(
  5491. (milliseconds >= 0 && days >= 0 && months >= 0) ||
  5492. (milliseconds <= 0 && days <= 0 && months <= 0)
  5493. )
  5494. ) {
  5495. milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
  5496. days = 0;
  5497. months = 0;
  5498. }
  5499. // The following code bubbles up values, see the tests for
  5500. // examples of what that means.
  5501. data.milliseconds = milliseconds % 1000;
  5502. seconds = absFloor(milliseconds / 1000);
  5503. data.seconds = seconds % 60;
  5504. minutes = absFloor(seconds / 60);
  5505. data.minutes = minutes % 60;
  5506. hours = absFloor(minutes / 60);
  5507. data.hours = hours % 24;
  5508. days += absFloor(hours / 24);
  5509. // convert days to months
  5510. monthsFromDays = absFloor(daysToMonths(days));
  5511. months += monthsFromDays;
  5512. days -= absCeil(monthsToDays(monthsFromDays));
  5513. // 12 months -> 1 year
  5514. years = absFloor(months / 12);
  5515. months %= 12;
  5516. data.days = days;
  5517. data.months = months;
  5518. data.years = years;
  5519. return this;
  5520. }
  5521. function daysToMonths(days) {
  5522. // 400 years have 146097 days (taking into account leap year rules)
  5523. // 400 years have 12 months === 4800
  5524. return (days * 4800) / 146097;
  5525. }
  5526. function monthsToDays(months) {
  5527. // the reverse of daysToMonths
  5528. return (months * 146097) / 4800;
  5529. }
  5530. function as(units) {
  5531. if (!this.isValid()) {
  5532. return NaN;
  5533. }
  5534. var days,
  5535. months,
  5536. milliseconds = this._milliseconds;
  5537. units = normalizeUnits(units);
  5538. if (units === 'month' || units === 'quarter' || units === 'year') {
  5539. days = this._days + milliseconds / 864e5;
  5540. months = this._months + daysToMonths(days);
  5541. switch (units) {
  5542. case 'month':
  5543. return months;
  5544. case 'quarter':
  5545. return months / 3;
  5546. case 'year':
  5547. return months / 12;
  5548. }
  5549. } else {
  5550. // handle milliseconds separately because of floating point math errors (issue #1867)
  5551. days = this._days + Math.round(monthsToDays(this._months));
  5552. switch (units) {
  5553. case 'week':
  5554. return days / 7 + milliseconds / 6048e5;
  5555. case 'day':
  5556. return days + milliseconds / 864e5;
  5557. case 'hour':
  5558. return days * 24 + milliseconds / 36e5;
  5559. case 'minute':
  5560. return days * 1440 + milliseconds / 6e4;
  5561. case 'second':
  5562. return days * 86400 + milliseconds / 1000;
  5563. // Math.floor prevents floating point math errors here
  5564. case 'millisecond':
  5565. return Math.floor(days * 864e5) + milliseconds;
  5566. default:
  5567. throw new Error('Unknown unit ' + units);
  5568. }
  5569. }
  5570. }
  5571. // TODO: Use this.as('ms')?
  5572. function valueOf$1() {
  5573. if (!this.isValid()) {
  5574. return NaN;
  5575. }
  5576. return (
  5577. this._milliseconds +
  5578. this._days * 864e5 +
  5579. (this._months % 12) * 2592e6 +
  5580. toInt(this._months / 12) * 31536e6
  5581. );
  5582. }
  5583. function makeAs(alias) {
  5584. return function () {
  5585. return this.as(alias);
  5586. };
  5587. }
  5588. var asMilliseconds = makeAs('ms'),
  5589. asSeconds = makeAs('s'),
  5590. asMinutes = makeAs('m'),
  5591. asHours = makeAs('h'),
  5592. asDays = makeAs('d'),
  5593. asWeeks = makeAs('w'),
  5594. asMonths = makeAs('M'),
  5595. asQuarters = makeAs('Q'),
  5596. asYears = makeAs('y');
  5597. function clone$1() {
  5598. return createDuration(this);
  5599. }
  5600. function get$2(units) {
  5601. units = normalizeUnits(units);
  5602. return this.isValid() ? this[units + 's']() : NaN;
  5603. }
  5604. function makeGetter(name) {
  5605. return function () {
  5606. return this.isValid() ? this._data[name] : NaN;
  5607. };
  5608. }
  5609. var milliseconds = makeGetter('milliseconds'),
  5610. seconds = makeGetter('seconds'),
  5611. minutes = makeGetter('minutes'),
  5612. hours = makeGetter('hours'),
  5613. days = makeGetter('days'),
  5614. months = makeGetter('months'),
  5615. years = makeGetter('years');
  5616. function weeks() {
  5617. return absFloor(this.days() / 7);
  5618. }
  5619. var round = Math.round,
  5620. thresholds = {
  5621. ss: 44, // a few seconds to seconds
  5622. s: 45, // seconds to minute
  5623. m: 45, // minutes to hour
  5624. h: 22, // hours to day
  5625. d: 26, // days to month/week
  5626. w: null, // weeks to month
  5627. M: 11, // months to year
  5628. };
  5629. // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
  5630. function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
  5631. return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
  5632. }
  5633. function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {
  5634. var duration = createDuration(posNegDuration).abs(),
  5635. seconds = round(duration.as('s')),
  5636. minutes = round(duration.as('m')),
  5637. hours = round(duration.as('h')),
  5638. days = round(duration.as('d')),
  5639. months = round(duration.as('M')),
  5640. weeks = round(duration.as('w')),
  5641. years = round(duration.as('y')),
  5642. a =
  5643. (seconds <= thresholds.ss && ['s', seconds]) ||
  5644. (seconds < thresholds.s && ['ss', seconds]) ||
  5645. (minutes <= 1 && ['m']) ||
  5646. (minutes < thresholds.m && ['mm', minutes]) ||
  5647. (hours <= 1 && ['h']) ||
  5648. (hours < thresholds.h && ['hh', hours]) ||
  5649. (days <= 1 && ['d']) ||
  5650. (days < thresholds.d && ['dd', days]);
  5651. if (thresholds.w != null) {
  5652. a =
  5653. a ||
  5654. (weeks <= 1 && ['w']) ||
  5655. (weeks < thresholds.w && ['ww', weeks]);
  5656. }
  5657. a = a ||
  5658. (months <= 1 && ['M']) ||
  5659. (months < thresholds.M && ['MM', months]) ||
  5660. (years <= 1 && ['y']) || ['yy', years];
  5661. a[2] = withoutSuffix;
  5662. a[3] = +posNegDuration > 0;
  5663. a[4] = locale;
  5664. return substituteTimeAgo.apply(null, a);
  5665. }
  5666. // This function allows you to set the rounding function for relative time strings
  5667. function getSetRelativeTimeRounding(roundingFunction) {
  5668. if (roundingFunction === undefined) {
  5669. return round;
  5670. }
  5671. if (typeof roundingFunction === 'function') {
  5672. round = roundingFunction;
  5673. return true;
  5674. }
  5675. return false;
  5676. }
  5677. // This function allows you to set a threshold for relative time strings
  5678. function getSetRelativeTimeThreshold(threshold, limit) {
  5679. if (thresholds[threshold] === undefined) {
  5680. return false;
  5681. }
  5682. if (limit === undefined) {
  5683. return thresholds[threshold];
  5684. }
  5685. thresholds[threshold] = limit;
  5686. if (threshold === 's') {
  5687. thresholds.ss = limit - 1;
  5688. }
  5689. return true;
  5690. }
  5691. function humanize(argWithSuffix, argThresholds) {
  5692. if (!this.isValid()) {
  5693. return this.localeData().invalidDate();
  5694. }
  5695. var withSuffix = false,
  5696. th = thresholds,
  5697. locale,
  5698. output;
  5699. if (typeof argWithSuffix === 'object') {
  5700. argThresholds = argWithSuffix;
  5701. argWithSuffix = false;
  5702. }
  5703. if (typeof argWithSuffix === 'boolean') {
  5704. withSuffix = argWithSuffix;
  5705. }
  5706. if (typeof argThresholds === 'object') {
  5707. th = Object.assign({}, thresholds, argThresholds);
  5708. if (argThresholds.s != null && argThresholds.ss == null) {
  5709. th.ss = argThresholds.s - 1;
  5710. }
  5711. }
  5712. locale = this.localeData();
  5713. output = relativeTime$1(this, !withSuffix, th, locale);
  5714. if (withSuffix) {
  5715. output = locale.pastFuture(+this, output);
  5716. }
  5717. return locale.postformat(output);
  5718. }
  5719. var abs$1 = Math.abs;
  5720. function sign(x) {
  5721. return (x > 0) - (x < 0) || +x;
  5722. }
  5723. function toISOString$1() {
  5724. // for ISO strings we do not use the normal bubbling rules:
  5725. // * milliseconds bubble up until they become hours
  5726. // * days do not bubble at all
  5727. // * months bubble up until they become years
  5728. // This is because there is no context-free conversion between hours and days
  5729. // (think of clock changes)
  5730. // and also not between days and months (28-31 days per month)
  5731. if (!this.isValid()) {
  5732. return this.localeData().invalidDate();
  5733. }
  5734. var seconds = abs$1(this._milliseconds) / 1000,
  5735. days = abs$1(this._days),
  5736. months = abs$1(this._months),
  5737. minutes,
  5738. hours,
  5739. years,
  5740. s,
  5741. total = this.asSeconds(),
  5742. totalSign,
  5743. ymSign,
  5744. daysSign,
  5745. hmsSign;
  5746. if (!total) {
  5747. // this is the same as C#'s (Noda) and python (isodate)...
  5748. // but not other JS (goog.date)
  5749. return 'P0D';
  5750. }
  5751. // 3600 seconds -> 60 minutes -> 1 hour
  5752. minutes = absFloor(seconds / 60);
  5753. hours = absFloor(minutes / 60);
  5754. seconds %= 60;
  5755. minutes %= 60;
  5756. // 12 months -> 1 year
  5757. years = absFloor(months / 12);
  5758. months %= 12;
  5759. // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
  5760. s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
  5761. totalSign = total < 0 ? '-' : '';
  5762. ymSign = sign(this._months) !== sign(total) ? '-' : '';
  5763. daysSign = sign(this._days) !== sign(total) ? '-' : '';
  5764. hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
  5765. return (
  5766. totalSign +
  5767. 'P' +
  5768. (years ? ymSign + years + 'Y' : '') +
  5769. (months ? ymSign + months + 'M' : '') +
  5770. (days ? daysSign + days + 'D' : '') +
  5771. (hours || minutes || seconds ? 'T' : '') +
  5772. (hours ? hmsSign + hours + 'H' : '') +
  5773. (minutes ? hmsSign + minutes + 'M' : '') +
  5774. (seconds ? hmsSign + s + 'S' : '')
  5775. );
  5776. }
  5777. var proto$2 = Duration.prototype;
  5778. proto$2.isValid = isValid$1;
  5779. proto$2.abs = abs;
  5780. proto$2.add = add$1;
  5781. proto$2.subtract = subtract$1;
  5782. proto$2.as = as;
  5783. proto$2.asMilliseconds = asMilliseconds;
  5784. proto$2.asSeconds = asSeconds;
  5785. proto$2.asMinutes = asMinutes;
  5786. proto$2.asHours = asHours;
  5787. proto$2.asDays = asDays;
  5788. proto$2.asWeeks = asWeeks;
  5789. proto$2.asMonths = asMonths;
  5790. proto$2.asQuarters = asQuarters;
  5791. proto$2.asYears = asYears;
  5792. proto$2.valueOf = valueOf$1;
  5793. proto$2._bubble = bubble;
  5794. proto$2.clone = clone$1;
  5795. proto$2.get = get$2;
  5796. proto$2.milliseconds = milliseconds;
  5797. proto$2.seconds = seconds;
  5798. proto$2.minutes = minutes;
  5799. proto$2.hours = hours;
  5800. proto$2.days = days;
  5801. proto$2.weeks = weeks;
  5802. proto$2.months = months;
  5803. proto$2.years = years;
  5804. proto$2.humanize = humanize;
  5805. proto$2.toISOString = toISOString$1;
  5806. proto$2.toString = toISOString$1;
  5807. proto$2.toJSON = toISOString$1;
  5808. proto$2.locale = locale;
  5809. proto$2.localeData = localeData;
  5810. proto$2.toIsoString = deprecate(
  5811. 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',
  5812. toISOString$1
  5813. );
  5814. proto$2.lang = lang;
  5815. // FORMATTING
  5816. addFormatToken('X', 0, 0, 'unix');
  5817. addFormatToken('x', 0, 0, 'valueOf');
  5818. // PARSING
  5819. addRegexToken('x', matchSigned);
  5820. addRegexToken('X', matchTimestamp);
  5821. addParseToken('X', function (input, array, config) {
  5822. config._d = new Date(parseFloat(input) * 1000);
  5823. });
  5824. addParseToken('x', function (input, array, config) {
  5825. config._d = new Date(toInt(input));
  5826. });
  5827. //! moment.js
  5828. hooks.version = '2.29.3';
  5829. setHookCallback(createLocal);
  5830. hooks.fn = proto;
  5831. hooks.min = min;
  5832. hooks.max = max;
  5833. hooks.now = now;
  5834. hooks.utc = createUTC;
  5835. hooks.unix = createUnix;
  5836. hooks.months = listMonths;
  5837. hooks.isDate = isDate;
  5838. hooks.locale = getSetGlobalLocale;
  5839. hooks.invalid = createInvalid;
  5840. hooks.duration = createDuration;
  5841. hooks.isMoment = isMoment;
  5842. hooks.weekdays = listWeekdays;
  5843. hooks.parseZone = createInZone;
  5844. hooks.localeData = getLocale;
  5845. hooks.isDuration = isDuration;
  5846. hooks.monthsShort = listMonthsShort;
  5847. hooks.weekdaysMin = listWeekdaysMin;
  5848. hooks.defineLocale = defineLocale;
  5849. hooks.updateLocale = updateLocale;
  5850. hooks.locales = listLocales;
  5851. hooks.weekdaysShort = listWeekdaysShort;
  5852. hooks.normalizeUnits = normalizeUnits;
  5853. hooks.relativeTimeRounding = getSetRelativeTimeRounding;
  5854. hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
  5855. hooks.calendarFormat = getCalendarFormat;
  5856. hooks.prototype = proto;
  5857. // currently HTML5 input type only supports 24-hour formats
  5858. hooks.HTML5_FMT = {
  5859. DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
  5860. DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
  5861. DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
  5862. DATE: 'YYYY-MM-DD', // <input type="date" />
  5863. TIME: 'HH:mm', // <input type="time" />
  5864. TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
  5865. TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
  5866. WEEK: 'GGGG-[W]WW', // <input type="week" />
  5867. MONTH: 'YYYY-MM', // <input type="month" />
  5868. };
  5869. return hooks;
  5870. })));
  5871. define('moment', ['moment/moment'], function (main) { return main; });
  5872. define('frontend',['fast', 'template', 'moment'], function (Fast, Template, Moment) {
  5873. var Frontend = {
  5874. api: Fast.api,
  5875. init: function () {
  5876. var si = {};
  5877. //发送验证码
  5878. $(document).on("click", ".btn-captcha", function (e) {
  5879. var type = $(this).data("type") ? $(this).data("type") : 'mobile';
  5880. var btn = this;
  5881. Frontend.api.sendcaptcha = function (btn, type, data, callback) {
  5882. $(btn).addClass("disabled", true).text("发送中...");
  5883. Frontend.api.ajax({url: $(btn).data("url"), data: data}, function (data, ret) {
  5884. clearInterval(si[type]);
  5885. var seconds = 60;
  5886. si[type] = setInterval(function () {
  5887. seconds--;
  5888. if (seconds <= 0) {
  5889. clearInterval(si);
  5890. $(btn).removeClass("disabled").text("发送验证码");
  5891. } else {
  5892. $(btn).addClass("disabled").text(seconds + "秒后可再次发送");
  5893. }
  5894. }, 1000);
  5895. if (typeof callback == 'function') {
  5896. callback.call(this, data, ret);
  5897. }
  5898. }, function () {
  5899. $(btn).removeClass("disabled").text('发送验证码');
  5900. });
  5901. };
  5902. if (['mobile', 'email'].indexOf(type) > -1) {
  5903. var element = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : $("input[name='" + type + "']", $(this).closest("form"));
  5904. var text = type === 'email' ? '邮箱' : '手机号码';
  5905. if (element.val() === "") {
  5906. Layer.msg(text + "不能为空!");
  5907. element.focus();
  5908. return false;
  5909. } else if (type === 'mobile' && !element.val().match(/^1[3-9]\d{9}$/)) {
  5910. Layer.msg("请输入正确的" + text + "!");
  5911. element.focus();
  5912. return false;
  5913. } else if (type === 'email' && !element.val().match(/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/)) {
  5914. Layer.msg("请输入正确的" + text + "!");
  5915. element.focus();
  5916. return false;
  5917. }
  5918. element.isValid(function (v) {
  5919. if (v) {
  5920. var data = {event: $(btn).data("event")};
  5921. data[type] = element.val();
  5922. Frontend.api.sendcaptcha(btn, type, data);
  5923. } else {
  5924. Layer.msg("请确认已经输入了正确的" + text + "!");
  5925. }
  5926. });
  5927. } else {
  5928. var data = {event: $(btn).data("event")};
  5929. Frontend.api.sendcaptcha(btn, type, data, function (data, ret) {
  5930. Layer.open({title: false, area: ["400px", "430px"], content: "<img src='" + data.image + "' width='400' height='400' /><div class='text-center panel-title'>扫一扫关注公众号获取验证码</div>", type: 1});
  5931. });
  5932. }
  5933. return false;
  5934. });
  5935. //tooltip和popover
  5936. if (!('ontouchstart' in document.documentElement)) {
  5937. $('body').tooltip({selector: '[data-toggle="tooltip"]'});
  5938. }
  5939. $('body').popover({selector: '[data-toggle="popover"]'});
  5940. // 手机端左右滑动切换菜单栏
  5941. if ('ontouchstart' in document.documentElement) {
  5942. var startX, startY, moveEndX, moveEndY, relativeX, relativeY, element;
  5943. element = $('body', document);
  5944. element.on("touchstart", function (e) {
  5945. startX = e.originalEvent.changedTouches[0].pageX;
  5946. startY = e.originalEvent.changedTouches[0].pageY;
  5947. });
  5948. element.on("touchend", function (e) {
  5949. moveEndX = e.originalEvent.changedTouches[0].pageX;
  5950. moveEndY = e.originalEvent.changedTouches[0].pageY;
  5951. relativeX = moveEndX - startX;
  5952. relativeY = moveEndY - startY;
  5953. // 判断标准
  5954. //右滑
  5955. if (relativeX > 45) {
  5956. if ((Math.abs(relativeX) - Math.abs(relativeY)) > 50) {
  5957. element.addClass("sidebar-open");
  5958. }
  5959. }
  5960. //左滑
  5961. else if (relativeX < -45) {
  5962. if ((Math.abs(relativeX) - Math.abs(relativeY)) > 50) {
  5963. element.removeClass("sidebar-open");
  5964. }
  5965. }
  5966. });
  5967. }
  5968. $(document).on("click", ".sidebar-toggle", function () {
  5969. $("body").toggleClass("sidebar-open");
  5970. });
  5971. }
  5972. };
  5973. Frontend.api = $.extend(Fast.api, Frontend.api);
  5974. //将Template渲染至全局,以便于在子框架中调用
  5975. window.Template = Template;
  5976. //将Moment渲染至全局,以便于在子框架中调用
  5977. window.Moment = Moment;
  5978. //将Frontend渲染至全局,以便于在子框架中调用
  5979. window.Frontend = Frontend;
  5980. Frontend.init();
  5981. return Frontend;
  5982. });
  5983. define('frontend-init',['frontend'], function (Frontend) {
  5984. });
  5985. //! moment.js locale configuration
  5986. //! locale : Chinese (China) [zh-cn]
  5987. //! author : suupic : https://github.com/suupic
  5988. //! author : Zeno Zeng : https://github.com/zenozeng
  5989. //! author : uu109 : https://github.com/uu109
  5990. ;(function (global, factory) {
  5991. typeof exports === 'object' && typeof module !== 'undefined'
  5992. && typeof require === 'function' ? factory(require('../moment')) :
  5993. typeof define === 'function' && define.amd ? define('moment/locale/zh-cn',['../moment'], factory) :
  5994. factory(global.moment)
  5995. }(this, (function (moment) { 'use strict';
  5996. //! moment.js locale configuration
  5997. var zhCn = moment.defineLocale('zh-cn', {
  5998. months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split(
  5999. '_'
  6000. ),
  6001. monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
  6002. '_'
  6003. ),
  6004. weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  6005. weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  6006. weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
  6007. longDateFormat: {
  6008. LT: 'HH:mm',
  6009. LTS: 'HH:mm:ss',
  6010. L: 'YYYY/MM/DD',
  6011. LL: 'YYYY年M月D日',
  6012. LLL: 'YYYY年M月D日Ah点mm分',
  6013. LLLL: 'YYYY年M月D日ddddAh点mm分',
  6014. l: 'YYYY/M/D',
  6015. ll: 'YYYY年M月D日',
  6016. lll: 'YYYY年M月D日 HH:mm',
  6017. llll: 'YYYY年M月D日dddd HH:mm',
  6018. },
  6019. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  6020. meridiemHour: function (hour, meridiem) {
  6021. if (hour === 12) {
  6022. hour = 0;
  6023. }
  6024. if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
  6025. return hour;
  6026. } else if (meridiem === '下午' || meridiem === '晚上') {
  6027. return hour + 12;
  6028. } else {
  6029. // '中午'
  6030. return hour >= 11 ? hour : hour + 12;
  6031. }
  6032. },
  6033. meridiem: function (hour, minute, isLower) {
  6034. var hm = hour * 100 + minute;
  6035. if (hm < 600) {
  6036. return '凌晨';
  6037. } else if (hm < 900) {
  6038. return '早上';
  6039. } else if (hm < 1130) {
  6040. return '上午';
  6041. } else if (hm < 1230) {
  6042. return '中午';
  6043. } else if (hm < 1800) {
  6044. return '下午';
  6045. } else {
  6046. return '晚上';
  6047. }
  6048. },
  6049. calendar: {
  6050. sameDay: '[今天]LT',
  6051. nextDay: '[明天]LT',
  6052. nextWeek: function (now) {
  6053. if (now.week() !== this.week()) {
  6054. return '[下]dddLT';
  6055. } else {
  6056. return '[本]dddLT';
  6057. }
  6058. },
  6059. lastDay: '[昨天]LT',
  6060. lastWeek: function (now) {
  6061. if (this.week() !== now.week()) {
  6062. return '[上]dddLT';
  6063. } else {
  6064. return '[本]dddLT';
  6065. }
  6066. },
  6067. sameElse: 'L',
  6068. },
  6069. dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
  6070. ordinal: function (number, period) {
  6071. switch (period) {
  6072. case 'd':
  6073. case 'D':
  6074. case 'DDD':
  6075. return number + '日';
  6076. case 'M':
  6077. return number + '月';
  6078. case 'w':
  6079. case 'W':
  6080. return number + '周';
  6081. default:
  6082. return number;
  6083. }
  6084. },
  6085. relativeTime: {
  6086. future: '%s后',
  6087. past: '%s前',
  6088. s: '几秒',
  6089. ss: '%d 秒',
  6090. m: '1 分钟',
  6091. mm: '%d 分钟',
  6092. h: '1 小时',
  6093. hh: '%d 小时',
  6094. d: '1 天',
  6095. dd: '%d 天',
  6096. w: '1 周',
  6097. ww: '%d 周',
  6098. M: '1 个月',
  6099. MM: '%d 个月',
  6100. y: '1 年',
  6101. yy: '%d 年',
  6102. },
  6103. week: {
  6104. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  6105. dow: 1, // Monday is the first day of the week.
  6106. doy: 4, // The week that contains Jan 4th is the first week of the year.
  6107. },
  6108. });
  6109. return zhCn;
  6110. })));
  6111. (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);
  6112. define("bootstrap-table", ["bootstrap"], (function (global) {
  6113. return function () {
  6114. var ret, fn;
  6115. return ret || global.$.fn.bootstrapTable;
  6116. };
  6117. }(this)));
  6118. /**
  6119. * Bootstrap Table Chinese translation
  6120. * Author: Zhixin Wen<wenzhixin2010@gmail.com>
  6121. */
  6122. (function ($) {
  6123. 'use strict';
  6124. $.fn.bootstrapTable.locales['zh-CN'] = {
  6125. formatLoadingMessage: function () {
  6126. return '正在努力地加载数据中,请稍候……';
  6127. },
  6128. formatRecordsPerPage: function (pageNumber) {
  6129. return '每页显示 ' + pageNumber + ' 条记录';
  6130. },
  6131. formatShowingRows: function (pageFrom, pageTo, totalRows) {
  6132. return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
  6133. },
  6134. formatSearch: function () {
  6135. return '搜索';
  6136. },
  6137. formatNoMatches: function () {
  6138. return '没有找到匹配的记录';
  6139. },
  6140. formatPaginationSwitch: function () {
  6141. return '隐藏/显示分页';
  6142. },
  6143. formatRefresh: function () {
  6144. return '刷新';
  6145. },
  6146. formatToggle: function () {
  6147. return '切换';
  6148. },
  6149. formatColumns: function () {
  6150. return '列';
  6151. },
  6152. formatExport: function () {
  6153. return '导出数据';
  6154. },
  6155. formatClearFilters: function () {
  6156. return '清空过滤';
  6157. }
  6158. };
  6159. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
  6160. })(jQuery);
  6161. define("bootstrap-table-lang", ["bootstrap-table"], (function (global) {
  6162. return function () {
  6163. var ret, fn;
  6164. return ret || global.$.fn.bootstrapTable.defaults;
  6165. };
  6166. }(this)));
  6167. /*
  6168. tableExport.jquery.plugin
  6169. Version 1.10.26
  6170. Copyright (c) 2015-2021 hhurz, https://github.com/hhurz/tableExport.jquery.plugin
  6171. Based on https://github.com/kayalshri/tableExport.jquery.plugin
  6172. Licensed under the MIT License
  6173. */
  6174. 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)};
  6175. $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})}};
  6176. $jscomp.polyfill("Array.prototype.find",function(d){return d?d:function(d,y){return $jscomp.findInternal(this,d,y).v}},"es6","es3");
  6177. (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})}
  6178. 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&&
  6179. "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&&
  6180. "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&&
  6181. (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&&
  6182. 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+=
  6183. 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,
  6184. 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,
  6185. 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&&
  6186. (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]);
  6187. (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")&&
  6188. (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)+
  6189. 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=
  6190. 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)}}
  6191. 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;
  6192. 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";
  6193. 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+=
  6194. 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&&""!==
  6195. 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,
  6196. "")});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:
  6197. "")+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))&&
  6198. (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=
  6199. 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=
  6200. 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,
  6201. 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/
  6202. 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,
  6203. "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();
  6204. 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,")?
  6205. 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"===
  6206. 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)+
  6207. "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",
  6208. 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",
  6209. 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",
  6210. 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,
  6211. 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,
  6212. 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&&
  6213. (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&&
  6214. "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+=
  6215. "\\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,
  6216. 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++});
  6217. 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"),
  6218. "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=
  6219. "";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,
  6220. 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=
  6221. 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;
  6222. 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=
  6223. 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'+
  6224. 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);
  6225. 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>'+
  6226. (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';
  6227. 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"===
  6228. 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,
  6229. 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&&
  6230. (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:"")+'")'});
  6231. 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:
  6232. 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+
  6233. 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:'+
  6234. 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,
  6235. 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+
  6236. 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)"!==
  6237. 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" '+
  6238. 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+=
  6239. "</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;}";
  6240. 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),
  6241. 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,
  6242. 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,
  6243. 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})});
  6244. "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=
  6245. "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,
  6246. 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=
  6247. 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=
  6248. 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&&
  6249. !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&&
  6250. (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*
  6251. 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))}});
  6252. "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&&
  6253. (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&&
  6254. !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=
  6255. 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,
  6256. 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),
  6257. 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();
  6258. return this}})(jQuery);
  6259. define("tableexport", ["jquery"], (function (global) {
  6260. return function () {
  6261. var ret, fn;
  6262. return ret || global.$.fn.extend;
  6263. };
  6264. }(this)));
  6265. !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);
  6266. define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (global) {
  6267. return function () {
  6268. var ret, fn;
  6269. return ret || global.$.fn.bootstrapTable.defaults;
  6270. };
  6271. }(this)));
  6272. (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});
  6273. define('upload',['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined, Dropzone, Template) {
  6274. var Upload = {
  6275. list: {},
  6276. options: {},
  6277. config: {
  6278. container: document.body,
  6279. classname: '.plupload:not([initialized]),.faupload:not([initialized])',
  6280. 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>',
  6281. },
  6282. events: {
  6283. //初始化
  6284. onInit: function () {
  6285. },
  6286. //上传成功的回调
  6287. onUploadSuccess: function (up, ret, file) {
  6288. var button = up.element;
  6289. var onUploadSuccess = up.options.onUploadSuccess;
  6290. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  6291. //上传成功后回调
  6292. if (button) {
  6293. //如果有文本框则填充
  6294. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  6295. if (input_id) {
  6296. var urlArr = [];
  6297. var inputObj = $("#" + input_id);
  6298. if ($(button).data("multiple") && inputObj.val() !== "") {
  6299. urlArr.push(inputObj.val());
  6300. }
  6301. var url = Config.upload.fullmode ? Fast.api.cdnurl(data.url) : data.url;
  6302. urlArr.push(url);
  6303. inputObj.val(urlArr.join(",")).trigger("change").trigger("validate");
  6304. }
  6305. //如果有回调函数
  6306. var onDomUploadSuccess = $(button).data("upload-success");
  6307. if (onDomUploadSuccess) {
  6308. if (typeof onDomUploadSuccess !== 'function' && typeof Upload.api.custom[onDomUploadSuccess] === 'function') {
  6309. onDomUploadSuccess = Upload.api.custom[onDomUploadSuccess];
  6310. }
  6311. if (typeof onDomUploadSuccess === 'function') {
  6312. var result = onDomUploadSuccess.call(button, data, ret);
  6313. if (result === false)
  6314. return;
  6315. }
  6316. }
  6317. }
  6318. if (typeof onUploadSuccess === 'function') {
  6319. var result = onUploadSuccess.call(button, data, ret);
  6320. if (result === false)
  6321. return;
  6322. }
  6323. },
  6324. //上传错误的回调
  6325. onUploadError: function (up, ret, file) {
  6326. var button = up.element;
  6327. var onUploadError = up.options.onUploadError;
  6328. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  6329. if (button) {
  6330. var onDomUploadError = $(button).data("upload-error");
  6331. if (onDomUploadError) {
  6332. if (typeof onDomUploadError !== 'function' && typeof Upload.api.custom[onDomUploadError] === 'function') {
  6333. onDomUploadError = Upload.api.custom[onDomUploadError];
  6334. }
  6335. if (typeof onDomUploadError === 'function') {
  6336. var result = onDomUploadError.call(button, data, ret);
  6337. if (result === false)
  6338. return;
  6339. }
  6340. }
  6341. }
  6342. if (typeof onUploadError === 'function') {
  6343. var result = onUploadError.call(button, data, ret);
  6344. if (result === false) {
  6345. return;
  6346. }
  6347. }
  6348. Toastr.error(ret.msg.toString().replace(/(<([^>]+)>)/gi, "") + "(code:" + ret.code + ")");
  6349. },
  6350. //服务器响应数据后
  6351. onUploadResponse: function (response, up, file) {
  6352. try {
  6353. var ret = typeof response === 'object' ? response : JSON.parse(response);
  6354. if (!ret.hasOwnProperty('code')) {
  6355. $.extend(ret, {code: -2, msg: response, data: null});
  6356. }
  6357. } catch (e) {
  6358. var ret = {code: -1, msg: e.message, data: null};
  6359. }
  6360. return ret;
  6361. },
  6362. //上传全部结束后
  6363. onUploadComplete: function (up, files) {
  6364. var button = up.element;
  6365. var onUploadComplete = up.options.onUploadComplete;
  6366. if (button) {
  6367. var onDomUploadComplete = $(button).data("upload-complete");
  6368. if (onDomUploadComplete) {
  6369. if (typeof onDomUploadComplete !== 'function' && typeof Upload.api.custom[onDomUploadComplete] === 'function') {
  6370. onDomUploadComplete = Upload.api.custom[onDomUploadComplete];
  6371. }
  6372. if (typeof onDomUploadComplete === 'function') {
  6373. var result = onDomUploadComplete.call(button, files);
  6374. if (result === false)
  6375. return;
  6376. }
  6377. }
  6378. }
  6379. if (typeof onUploadComplete === 'function') {
  6380. var result = onUploadComplete.call(button, files);
  6381. if (result === false) {
  6382. return;
  6383. }
  6384. }
  6385. }
  6386. },
  6387. api: {
  6388. //上传接口
  6389. upload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6390. element = typeof element === 'undefined' ? Upload.config.classname : element;
  6391. $(element, Upload.config.container).each(function () {
  6392. if ($(this).attr("initialized")) {
  6393. return true;
  6394. }
  6395. $(this).attr("initialized", true);
  6396. var that = this;
  6397. var id = $(this).prop("id") || $(this).prop("name") || Dropzone.uuidv4();
  6398. var url = $(this).data("url");
  6399. var maxsize = $(this).data("maxsize");
  6400. var maxcount = $(this).data("maxcount");
  6401. var mimetype = $(this).data("mimetype");
  6402. var multipart = $(this).data("multipart");
  6403. var multiple = $(this).data("multiple");
  6404. //填充ID
  6405. var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
  6406. //预览ID
  6407. var preview_id = $(that).data("preview-id") ? $(that).data("preview-id") : "";
  6408. //上传URL
  6409. url = url ? url : Config.upload.uploadurl;
  6410. url = Fast.api.fixurl(url);
  6411. var chunking = false, chunkSize = Config.upload.chunksize || 2097152, timeout = Config.upload.timeout || 600000;
  6412. //最大可上传文件大小
  6413. maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize;
  6414. //文件类型
  6415. mimetype = typeof mimetype !== "undefined" ? mimetype : Config.upload.mimetype;
  6416. //请求的表单参数
  6417. multipart = typeof multipart !== "undefined" ? multipart : Config.upload.multipart;
  6418. //是否支持批量上传
  6419. multiple = typeof multiple !== "undefined" ? multiple : Config.upload.multiple;
  6420. //后缀特殊处理
  6421. mimetype = mimetype.split(",").map(function (k) {
  6422. return k.indexOf("/") > -1 ? k : (!k || k === "*" || k.charAt(0) === "." ? k : "." + k);
  6423. }).join(",");
  6424. mimetype = mimetype === '*' ? null : mimetype;
  6425. //最大文件限制转换成mb
  6426. var maxFilesize = (function (maxsize) {
  6427. var matches = maxsize.toString().match(/^([0-9\.]+)(\w+)$/);
  6428. var size = matches ? parseFloat(matches[1]) : parseFloat(maxsize),
  6429. unit = matches ? matches[2].toLowerCase() : 'b';
  6430. var unitDict = {'b': 0, 'k': 1, 'kb': 1, 'm': 2, 'mb': 2, 'gb': 3, 'g': 3, 'tb': 4, 't': 4};
  6431. var y = typeof unitDict[unit] !== 'undefined' ? unitDict[unit] : 0;
  6432. var bytes = size * Math.pow(1024, y);
  6433. return bytes / Math.pow(1024, 2);
  6434. }(maxsize));
  6435. var options = $(this).data() || {};
  6436. options = $.extend(true, {}, options, $(this).data("upload-options") || {});
  6437. delete options.success;
  6438. delete options.url;
  6439. multipart = $.isArray(multipart) ? {} : multipart;
  6440. var params = $(this).data("params") || {};
  6441. var category = typeof params.category !== 'undefined' ? params.category : ($(this).data("category") || '');
  6442. if (category) {
  6443. // multipart.category = category;
  6444. }
  6445. Upload.list[id] = new Dropzone(this, $.extend({
  6446. url: url,
  6447. params: function (files, xhr, chunk) {
  6448. var params = multipart;
  6449. if (chunk) {
  6450. return $.extend({}, params, {
  6451. filesize: chunk.file.size,
  6452. filename: chunk.file.name,
  6453. chunkid: chunk.file.upload.uuid,
  6454. chunkindex: chunk.index,
  6455. chunkcount: chunk.file.upload.totalChunkCount,
  6456. chunksize: this.options.chunkSize,
  6457. chunkfilesize: chunk.dataBlock.data.size,
  6458. width: chunk.file.width || 0,
  6459. height: chunk.file.height || 0,
  6460. type: chunk.file.type,
  6461. });
  6462. }
  6463. return params;
  6464. },
  6465. chunking: chunking,
  6466. chunkSize: chunkSize,
  6467. maxFilesize: maxFilesize,
  6468. acceptedFiles: mimetype,
  6469. maxFiles: (maxcount && parseInt(maxcount) > 1 ? maxcount : (multiple ? null : 1)),
  6470. timeout: timeout,
  6471. parallelUploads: 1,
  6472. previewsContainer: false,
  6473. dictDefaultMessage: __("Drop files here to upload"),
  6474. dictFallbackMessage: __("Your browser does not support drag'n'drop file uploads"),
  6475. dictFallbackText: __("Please use the fallback form below to upload your files like in the olden days"),
  6476. dictFileTooBig: __("File is too big (%sMiB), Max filesize: %sMiB", "{{filesize}}", "{{maxFilesize}}"),
  6477. dictInvalidFileType: __("You can't upload files of this type"),
  6478. dictResponseError: __("Server responded with %s code.", "{{statusCode}}"),
  6479. dictCancelUpload: __("Cancel upload"),
  6480. dictUploadCanceled: __("Upload canceled"),
  6481. dictCancelUploadConfirmation: __("Are you sure you want to cancel this upload?"),
  6482. dictRemoveFile: __("Remove file"),
  6483. dictMaxFilesExceeded: __("You can only upload a maximum of %s files", "{{maxFiles}}"),
  6484. init: function () {
  6485. Upload.events.onInit.call(this);
  6486. //必须添加dz-message,否则点击icon无法唤起上传窗口
  6487. $(">i", this.element).addClass("dz-message");
  6488. this.options.elementHtml = $(this.element).html();
  6489. },
  6490. sending: function (file, xhr, formData) {
  6491. if (typeof file.category !== 'undefined') {
  6492. formData.append('category', file.category);
  6493. }
  6494. },
  6495. addedfile: function (file) {
  6496. var params = $(this.element).data("params") || {};
  6497. var category = typeof params.category !== 'undefined' ? params.category : ($(this.element).data("category") || '');
  6498. file.category = typeof category === 'function' ? category.call(this, file) : category;
  6499. },
  6500. addedfiles: function (files) {
  6501. if (this.options.maxFiles && (!this.options.maxFiles || this.options.maxFiles > 1) && this.options.inputId) {
  6502. var inputObj = $("#" + this.options.inputId);
  6503. if (inputObj.length > 0) {
  6504. var value = $.trim(inputObj.val());
  6505. var nums = value === '' ? 0 : value.split(/\,/).length;
  6506. var remain = this.options.maxFiles - nums;
  6507. if (remain === 0 || files.length > remain) {
  6508. files = Array.prototype.slice.call(files, remain);
  6509. for (var i = 0; i < files.length; i++) {
  6510. this.removeFile(files[i]);
  6511. }
  6512. Toastr.error(__("You can only upload a maximum of %s files", this.options.maxFiles));
  6513. }
  6514. }
  6515. }
  6516. },
  6517. success: function (file, response) {
  6518. var ret = Upload.events.onUploadResponse(response, this, file);
  6519. file.ret = ret;
  6520. if (ret.code === 1) {
  6521. Upload.events.onUploadSuccess(this, ret, file);
  6522. } else {
  6523. Upload.events.onUploadError(this, ret, file);
  6524. }
  6525. },
  6526. error: function (file, response, xhr) {
  6527. var responseObj = $("<div>" + (xhr && typeof xhr.responseText !== 'undefined' ? xhr.responseText : response) + "</div>");
  6528. responseObj.find("style, title, script").remove();
  6529. var msg = responseObj.text() || __('Network error');
  6530. var ret = {code: 0, data: null, msg: msg};
  6531. Upload.events.onUploadError(this, ret, file);
  6532. },
  6533. uploadprogress: function (file, progress, bytesSent) {
  6534. if (file.upload.chunked) {
  6535. $(this.element).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + Math.floor((file.upload.bytesSent / file.size) * 100) + "%");
  6536. }
  6537. },
  6538. totaluploadprogress: function (progress, bytesSent) {
  6539. if (this.getActiveFiles().length > 0 && !this.options.chunking) {
  6540. $(this.element).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + Math.floor(progress) + "%");
  6541. }
  6542. },
  6543. queuecomplete: function () {
  6544. Upload.events.onUploadComplete(this, this.files);
  6545. this.removeAllFiles(true);
  6546. $(this.element).prop("disabled", false).html(this.options.elementHtml);
  6547. },
  6548. chunkSuccess: function (chunk, file, response) {
  6549. },
  6550. chunksUploaded: function (file, done) {
  6551. var that = this;
  6552. Fast.api.ajax({
  6553. url: this.options.url,
  6554. data: $.extend({}, multipart, {
  6555. action: 'merge',
  6556. filesize: file.size,
  6557. filename: file.name,
  6558. chunkid: file.upload.uuid,
  6559. chunkcount: file.upload.totalChunkCount,
  6560. })
  6561. }, function (data, ret) {
  6562. done(JSON.stringify(ret));
  6563. return false;
  6564. }, function (data, ret) {
  6565. file.accepted = false;
  6566. that._errorProcessing([file], ret.msg);
  6567. });
  6568. },
  6569. onUploadSuccess: onUploadSuccess,
  6570. onUploadError: onUploadError,
  6571. onUploadComplete: onUploadComplete,
  6572. }, Upload.options, options));
  6573. //拖动排序
  6574. if (preview_id && multiple) {
  6575. require(['dragsort'], function () {
  6576. $("#" + preview_id).dragsort({
  6577. dragSelector: "li a:not(.btn-trash)",
  6578. dragEnd: function () {
  6579. $("#" + preview_id).trigger("fa.preview.change");
  6580. },
  6581. placeHolderTemplate: '<li class="col-xs-3"></li>'
  6582. });
  6583. });
  6584. }
  6585. //刷新隐藏textarea的值
  6586. var refresh = function (name) {
  6587. var data = {};
  6588. var textarea = $("textarea[name='" + name + "']");
  6589. var container = textarea.prev("ul");
  6590. $.each($("input,select,textarea", container).serializeArray(), function (i, j) {
  6591. var reg = /\[?(\w+)\]?\[(\w+)\]$/g;
  6592. var match = reg.exec(j.name);
  6593. if (!match)
  6594. return true;
  6595. if (!isNaN(match[2])) {
  6596. data[i] = j.value;
  6597. } else {
  6598. match[1] = "x" + parseInt(match[1]);
  6599. if (typeof data[match[1]] === 'undefined') {
  6600. data[match[1]] = {};
  6601. }
  6602. data[match[1]][match[2]] = j.value;
  6603. }
  6604. });
  6605. var result = [];
  6606. $.each(data, function (i, j) {
  6607. result.push(j);
  6608. });
  6609. textarea.val(JSON.stringify(result));
  6610. };
  6611. if (preview_id && input_id) {
  6612. $(document.body).on("keyup change", "#" + input_id, function (e) {
  6613. var inputStr = $("#" + input_id).val();
  6614. var inputArr = inputStr.split(/\,/);
  6615. $("#" + preview_id).empty();
  6616. var tpl = $("#" + preview_id).data("template") ? $("#" + preview_id).data("template") : "";
  6617. var extend = $("#" + preview_id).next().is("textarea") ? $("#" + preview_id).next("textarea").val() : "{}";
  6618. var json = {};
  6619. try {
  6620. json = JSON.parse(extend);
  6621. } catch (e) {
  6622. }
  6623. $.each(inputArr, function (i, j) {
  6624. if (!j) {
  6625. return true;
  6626. }
  6627. var suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(j);
  6628. suffix = suffix ? suffix[1] : 'file';
  6629. j = Config.upload.fullmode ? Fast.api.cdnurl(j) : j;
  6630. var value = (json && typeof json[i] !== 'undefined' ? json[i] : null);
  6631. var data = {url: j, fullurl: Fast.api.cdnurl(j), data: $(that).data(), key: i, index: i, value: value, row: value, suffix: suffix};
  6632. var html = tpl ? Template(tpl, data) : Template.render(Upload.config.previewtpl, data);
  6633. $("#" + preview_id).append(html);
  6634. });
  6635. refresh($("#" + preview_id).data("name"));
  6636. });
  6637. $("#" + input_id).trigger("change");
  6638. }
  6639. if (preview_id) {
  6640. //监听文本框改变事件
  6641. $("#" + preview_id).on('change keyup', "input,textarea,select", function () {
  6642. refresh($(this).closest("ul").data("name"));
  6643. });
  6644. // 监听事件
  6645. $(document.body).on("fa.preview.change", "#" + preview_id, function () {
  6646. var urlArr = [];
  6647. $("#" + preview_id + " [data-url]").each(function (i, j) {
  6648. urlArr.push($(this).data("url"));
  6649. });
  6650. if (input_id) {
  6651. $("#" + input_id).val(urlArr.join(","));
  6652. }
  6653. refresh($("#" + preview_id).data("name"));
  6654. });
  6655. // 移除按钮事件
  6656. $(document.body).on("click", "#" + preview_id + " .btn-trash", function () {
  6657. $(this).closest("li").remove();
  6658. $("#" + preview_id).trigger("fa.preview.change");
  6659. });
  6660. }
  6661. if (input_id) {
  6662. //粘贴上传、拖拽上传
  6663. $("body").on('paste drop', "#" + input_id, function (event) {
  6664. var originEvent = event.originalEvent;
  6665. var button = $(".plupload[data-input-id='" + $(this).attr("id") + "'],.faupload[data-input-id='" + $(this).attr("id") + "']");
  6666. if (event.type === 'paste' && originEvent.clipboardData && originEvent.clipboardData.items) {
  6667. var items = originEvent.clipboardData.items;
  6668. if ((items.length === 1 && items[0].type.indexOf("text") > -1) || (items.length === 2 && items[1].type.indexOf("text") > -1)) {
  6669. } else {
  6670. Upload.list[button.attr("id")].paste(originEvent);
  6671. return false;
  6672. }
  6673. }
  6674. if (event.type === 'drop' && originEvent.dataTransfer && originEvent.dataTransfer.files) {
  6675. Upload.list[button.attr("id")].drop(originEvent);
  6676. return false;
  6677. }
  6678. });
  6679. }
  6680. });
  6681. },
  6682. /**
  6683. * @deprecated Use upload instead.
  6684. */
  6685. plupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6686. return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete);
  6687. },
  6688. /**
  6689. * @deprecated Use upload instead.
  6690. */
  6691. faupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6692. return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete);
  6693. },
  6694. // AJAX异步上传
  6695. send: function (file, onUploadSuccess, onUploadError, onUploadComplete) {
  6696. var index = Layer.msg(__('Uploading'), {offset: 't', time: 0});
  6697. var id = "dropzone-" + Dropzone.uuidv4();
  6698. $('<button type="button" id="' + id + '" class="btn btn-danger hidden faupload" />').appendTo("body");
  6699. $("#" + id).data("upload-complete", function (files) {
  6700. Layer.close(index);
  6701. Upload.list[id].removeAllFiles(true);
  6702. });
  6703. Upload.api.upload("#" + id, onUploadSuccess, onUploadError, onUploadComplete);
  6704. setTimeout(function () {
  6705. Upload.list[id].addFile(file);
  6706. }, 1);
  6707. },
  6708. custom: {
  6709. //自定义上传完成回调
  6710. afteruploadcallback: function (response) {
  6711. console.log(this, response);
  6712. alert("Custom Callback,Response URL:" + response.url);
  6713. },
  6714. }
  6715. }
  6716. }
  6717. ;
  6718. return Upload;
  6719. });
  6720. /*! nice-validator 1.1.5
  6721. * (c) 2012-2020 Jony Zhang <niceue@live.com>, MIT Licensed
  6722. * https://github.com/niceue/nice-validator
  6723. */
  6724. ;(function(factory) {
  6725. typeof module === 'object' && module.exports ? module.exports = factory( require( 'jquery' ) ) :
  6726. typeof define === 'function' && define.amd ? define('validator',['jquery'], factory) :
  6727. factory(jQuery);
  6728. }(function($, undefined) {
  6729. 'use strict';
  6730. var NS = 'validator',
  6731. CLS_NS = '.' + NS,
  6732. CLS_NS_RULE = '.rule',
  6733. CLS_NS_FIELD = '.field',
  6734. CLS_NS_FORM = '.form',
  6735. CLS_WRAPPER = 'nice-' + NS,
  6736. CLS_MSG_BOX = 'msg-box',
  6737. ARIA_INVALID = 'aria-invalid',
  6738. DATA_RULE = 'data-rule',
  6739. DATA_MSG = 'data-msg',
  6740. DATA_TIP = 'data-tip',
  6741. DATA_OK = 'data-ok',
  6742. DATA_TIMELY = 'data-timely',
  6743. DATA_TARGET = 'data-target',
  6744. DATA_DISPLAY = 'data-display',
  6745. DATA_MUST = 'data-must',
  6746. NOVALIDATE = 'novalidate',
  6747. INPUT_SELECTOR = ':verifiable',
  6748. rRules = /(&)?(!)?\b(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?\s*(;|\|)?/g,
  6749. rRule = /(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?/,
  6750. rDisplay = /(?:([^:;\(\[]*):)?(.*)/,
  6751. rDoubleBytes = /[^\x00-\xff]/g,
  6752. rPos = /top|right|bottom|left/,
  6753. rAjaxType = /(?:(cors|jsonp):)?(?:(post|get):)?(.+)/i,
  6754. rUnsafe = /[<>'"`\\]|&#x?\d+[A-F]?;?|%3[A-F]/gmi,
  6755. noop = $.noop,
  6756. proxy = $.proxy,
  6757. trim = $.trim,
  6758. isFunction = $.isFunction,
  6759. isString = function(s) {
  6760. return typeof s === 'string';
  6761. },
  6762. isObject = function(o) {
  6763. return o && Object.prototype.toString.call(o) === '[object Object]';
  6764. },
  6765. isIE = document.documentMode || +(navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1),
  6766. attr = function(el, key, value) {
  6767. if (!el || !el.tagName) return null;
  6768. if (value !== undefined) {
  6769. if (value === null) el.removeAttribute(key);
  6770. else el.setAttribute(key, '' + value);
  6771. } else {
  6772. return el.getAttribute(key);
  6773. }
  6774. },
  6775. novalidateonce,
  6776. preinitialized = {},
  6777. defaults = {
  6778. debug: 0,
  6779. theme: 'default',
  6780. ignore: '',
  6781. focusInvalid: true,
  6782. focusCleanup: false,
  6783. stopOnError: false,
  6784. beforeSubmit: null,
  6785. valid: null,
  6786. invalid: null,
  6787. validation: null,
  6788. formClass: 'n-default',
  6789. validClass: 'n-valid',
  6790. invalidClass: 'n-invalid',
  6791. bindClassTo: null
  6792. },
  6793. fieldDefaults = {
  6794. timely: 1,
  6795. display: null,
  6796. target: null,
  6797. ignoreBlank: false,
  6798. showOk: true,
  6799. // Translate ajax response to validation result
  6800. dataFilter: function (data) {
  6801. if ( isString(data) || ( isObject(data) && ('error' in data || 'ok' in data) ) ) {
  6802. return data;
  6803. }
  6804. },
  6805. msgMaker: function(opt) {
  6806. var html;
  6807. html = '<span role="alert" class="msg-wrap n-'+ opt.type + '">' + opt.arrow;
  6808. if (opt.result) {
  6809. $.each(opt.result, function(i, obj){
  6810. html += '<span class="n-'+ obj.type +'">' + opt.icon + '<span class="n-msg">' + obj.msg + '</span></span>';
  6811. });
  6812. } else {
  6813. html += opt.icon + '<span class="n-msg">' + opt.msg + '</span>';
  6814. }
  6815. html += '</span>';
  6816. return html;
  6817. },
  6818. msgWrapper: 'span',
  6819. msgArrow: '',
  6820. msgIcon: '<span class="n-icon"></span>',
  6821. msgClass: 'n-right',
  6822. msgStyle: '',
  6823. msgShow: null,
  6824. msgHide: null
  6825. },
  6826. themes = {};
  6827. /** jQuery Plugin
  6828. * @param {Object} options
  6829. debug {Boolean} 0 Whether to enable debug mode
  6830. timely {Number} 1 Whether to enable timely validation
  6831. theme {String} 'default' Theme name
  6832. stopOnError {Boolean} false Whether to stop validate when found an error input
  6833. focusCleanup {Boolean} false Whether to clean up the field message when focus the field
  6834. focusInvalid {Boolean} true Whether to focus the field that is invalid
  6835. ignoreBlank {Boolean} false When the field has no value, whether to ignore validation
  6836. ignore {jqSelector} '' Ignored fields (Using jQuery selector)
  6837. beforeSubmit {Function} Do something before submit form
  6838. dataFilter {Function} Convert ajax results
  6839. valid {Function} Triggered when the form is valid
  6840. invalid {Function} Triggered when the form is invalid
  6841. validClass {String} 'n-valid' Add this class name to a valid field
  6842. invalidClass {String} 'n-invalid' Add this class name to a invalid field
  6843. bindClassTo {jqSelector} ':verifiable' Which element should the className binding to
  6844. display {Function} Callback function to get dynamic display
  6845. target {Function} Callback function to get dynamic target
  6846. msgShow {Function} Trigger this callback when show message
  6847. msgHide {Function} Trigger this callback when hide message
  6848. msgWrapper {String} 'span' Message wrapper tag name
  6849. msgMaker {Function} Callback function to make message HTML
  6850. msgArrow {String} Message arrow template
  6851. msgIcon {String} Message icon template
  6852. msgStyle {String} Custom message css style
  6853. msgClass {String} Additional added to the message class names
  6854. formClass {String} Additional added to the form class names
  6855. messages {Object} Custom messages for the current instance
  6856. rules {Object} Custom rules for the current instance
  6857. fields {Object} Field validation configuration
  6858. {String} key name|#id
  6859. {String|Object} value Rule string or an object which can pass more arguments
  6860. fields[key][rule] {String} Rule string
  6861. fields[key][display] {String|Function}
  6862. fields[key][tip] {String} Custom tip message
  6863. fields[key][ok] {String} Custom success message
  6864. fields[key][msg] {Object} Custom error message
  6865. fields[key][msgStyle] {String} Custom message style
  6866. fields[key][msgClass] {String} A className which added to message placeholder element
  6867. fields[key][msgWrapper] {String} Tag name of the message placeholder element
  6868. fields[key][msgMaker] {Function} A function to custom message HTML
  6869. fields[key][dataFilter] {Function} A function to convert ajax results
  6870. fields[key][valid] {Function} A function triggered when field is valid
  6871. fields[key][invalid] {Function} A function triggered when field is invalid
  6872. fields[key][must] {Boolean} If set true, we always check the field even has remote checking
  6873. fields[key][timely] {Boolean} Whether to enable timely validation
  6874. fields[key][target] {jqSelector} Define placement of a message
  6875. */
  6876. $.fn.validator = function(options) {
  6877. var that = this,
  6878. args = arguments;
  6879. if (that.is(INPUT_SELECTOR)) return that;
  6880. if (!that.is('form')) that = this.find('form');
  6881. if (!that.length) that = this;
  6882. that.each(function() {
  6883. var instance = $(this).data(NS);
  6884. if (instance) {
  6885. if ( isString(options) ) {
  6886. if ( options.charAt(0) === '_' ) return;
  6887. instance[options].apply(instance, [].slice.call(args, 1));
  6888. }
  6889. else if (options) {
  6890. instance._reset(true);
  6891. instance._init(this, options);
  6892. }
  6893. } else {
  6894. new Validator(this, options);
  6895. }
  6896. });
  6897. return this;
  6898. };
  6899. // Validate a field, or an area
  6900. $.fn.isValid = function(callback, hideMsg) {
  6901. var me = _getInstance(this[0]),
  6902. hasCallback = isFunction(callback),
  6903. ret, opt;
  6904. if (!me) return true;
  6905. if (!hasCallback && hideMsg === undefined) hideMsg = callback;
  6906. me.checkOnly = !!hideMsg;
  6907. opt = me.options;
  6908. ret = me._multiValidate(
  6909. this.is(INPUT_SELECTOR) ? this : this.find(INPUT_SELECTOR),
  6910. function(isValid){
  6911. if (!isValid && opt.focusInvalid && !me.checkOnly) {
  6912. // navigate to the error element
  6913. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  6914. }
  6915. if (hasCallback) {
  6916. if (callback.length) {
  6917. callback(isValid);
  6918. } else if (isValid) {
  6919. callback();
  6920. }
  6921. }
  6922. me.checkOnly = false;
  6923. }
  6924. );
  6925. // If you pass a callback, we maintain the jQuery object chain
  6926. return hasCallback ? this : ret;
  6927. };
  6928. $.extend($.expr.pseudos || $.expr[':'], {
  6929. // A faster selector than ":input:not(:submit,:button,:reset,:image,:disabled,[contenteditable])"
  6930. verifiable: function(elem) {
  6931. var name = elem.nodeName.toLowerCase();
  6932. return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
  6933. name === 'select' ||
  6934. name === 'textarea' ||
  6935. elem.contentEditable === 'true'
  6936. ) && !elem.disabled;
  6937. },
  6938. // any value, but not only whitespace
  6939. filled: function(elem) {
  6940. return !!trim($(elem).val());
  6941. }
  6942. });
  6943. /**
  6944. * Creates a new Validator
  6945. *
  6946. * @class
  6947. * @param {Element} element - form element
  6948. * @param {Object} options - options for validator
  6949. */
  6950. function Validator(element, options) {
  6951. var me = this;
  6952. if ( !(me instanceof Validator) ) {
  6953. return new Validator(element, options);
  6954. }
  6955. if (Validator.pending) {
  6956. $(window).on('validatorready', init);
  6957. } else {
  6958. init();
  6959. }
  6960. function init() {
  6961. me.$el = $(element);
  6962. if (me.$el.length) {
  6963. me._init(me.$el[0], options);
  6964. }
  6965. else if (isString(element)) {
  6966. preinitialized[element] = options;
  6967. }
  6968. }
  6969. }
  6970. Validator.prototype = {
  6971. _init: function(element, options) {
  6972. var me = this,
  6973. opt, themeOpt, dataOpt;
  6974. // Initialization options
  6975. if ( isFunction(options) ) {
  6976. options = {
  6977. valid: options
  6978. };
  6979. }
  6980. options = me._opt = options || {};
  6981. dataOpt = attr(element, 'data-'+ NS +'-option');
  6982. dataOpt = me._dataOpt = dataOpt && dataOpt.charAt(0) === '{' ? (new Function('return ' + dataOpt))() : {};
  6983. themeOpt = me._themeOpt = themes[ options.theme || dataOpt.theme || defaults.theme ];
  6984. opt = me.options = $.extend({}, defaults, fieldDefaults, themeOpt, me.options, options, dataOpt);
  6985. me.rules = new Rules(opt.rules, true);
  6986. me.messages = new Messages(opt.messages, true);
  6987. me.Field = _createFieldFactory(me);
  6988. me.elements = me.elements || {};
  6989. me.deferred = {};
  6990. me.errors = {};
  6991. me.fields = {};
  6992. // Initialization fields
  6993. me._initFields(opt.fields);
  6994. // Initialization events and make a cache
  6995. if ( !me.$el.data(NS) ) {
  6996. me.$el.data(NS, me).addClass(CLS_WRAPPER +' '+ opt.formClass)
  6997. .on('form-submit-validate', function(e, a, $form, opts, veto) {
  6998. me.vetoed = veto.veto = !me.isValid;
  6999. me.ajaxFormOptions = opts;
  7000. })
  7001. .on('submit'+ CLS_NS +' validate'+ CLS_NS, proxy(me, '_submit'))
  7002. .on('reset'+ CLS_NS, proxy(me, '_reset'))
  7003. .on('showmsg'+ CLS_NS, proxy(me, '_showmsg'))
  7004. .on('hidemsg'+ CLS_NS, proxy(me, '_hidemsg'))
  7005. .on('focusin'+ CLS_NS + ' click'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusin'))
  7006. .on('focusout'+ CLS_NS +' validate'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusout'))
  7007. .on('keyup'+ CLS_NS +' input'+ CLS_NS + ' compositionstart compositionend', INPUT_SELECTOR, proxy(me, '_focusout'))
  7008. .on('click'+ CLS_NS, ':radio,:checkbox', 'click', proxy(me, '_focusout'))
  7009. .on('change'+ CLS_NS, 'select,input[type="file"]', 'change', proxy(me, '_focusout'));
  7010. // cache the novalidate attribute value
  7011. me._NOVALIDATE = attr(element, NOVALIDATE);
  7012. // Initialization is complete, stop off default HTML5 form validation
  7013. // If use "jQuery.attr('novalidate')" in IE7 will complain: "SCRIPT3: Member not found."
  7014. attr(element, NOVALIDATE, NOVALIDATE);
  7015. }
  7016. // Display all messages in target container
  7017. if ( isString(opt.target) ) {
  7018. me.$el.find(opt.target).addClass('msg-container');
  7019. }
  7020. },
  7021. // Guess whether the form use ajax submit
  7022. _guessAjax: function(form) {
  7023. var me = this;
  7024. if ( !(me.isAjaxSubmit = !!me.options.valid) ) {
  7025. // if there is a "valid.form" event
  7026. var events = ($._data || $.data)(form, 'events');
  7027. me.isAjaxSubmit = issetEvent(events, 'valid', 'form') || issetEvent(events, 'submit', 'form-plugin');
  7028. }
  7029. function issetEvent(events, name, namespace) {
  7030. return !!(
  7031. events && events[name]
  7032. && $.map(events[name], function(e){
  7033. return ~e.namespace.indexOf(namespace) ? 1 : null;
  7034. }).length )
  7035. }
  7036. },
  7037. _initFields: function(fields) {
  7038. var me = this, k, arr, i,
  7039. clear = fields === null;
  7040. // Processing field information
  7041. if (clear) fields = me.fields;
  7042. if ( isObject(fields) ) {
  7043. for (k in fields) {
  7044. if (~k.indexOf(',')) {
  7045. arr = k.split(',');
  7046. i = arr.length;
  7047. while (i--) {
  7048. initField(trim(arr[i]), fields[k]);
  7049. }
  7050. } else {
  7051. initField(k, fields[k]);
  7052. }
  7053. }
  7054. }
  7055. // Parsing DOM rules
  7056. me.$el.find(INPUT_SELECTOR).each(function() {
  7057. me._parse(this);
  7058. });
  7059. function initField(k, v) {
  7060. // delete a field from settings
  7061. if ( v === null || clear ) {
  7062. var el = me.elements[k];
  7063. if (el) me._resetElement(el, true);
  7064. delete me.fields[k];
  7065. } else {
  7066. me.fields[k] = new me.Field(k, isString(v) ? {rule: v} : v, me.fields[k]);
  7067. }
  7068. }
  7069. },
  7070. // Parsing a field
  7071. _parse: function(el) {
  7072. var me = this,
  7073. field,
  7074. key = el.name,
  7075. display,
  7076. timely,
  7077. dataRule = attr(el, DATA_RULE);
  7078. dataRule && attr(el, DATA_RULE, null);
  7079. // If the field has passed the key as id mode, or it doesn't has a name
  7080. if ( el.id && (
  7081. ('#' + el.id in me.fields) ||
  7082. !key ||
  7083. // If dataRule and element are diffrent from old's, we use ID mode.
  7084. (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
  7085. )
  7086. ) {
  7087. key = '#' + el.id;
  7088. }
  7089. // Generate id
  7090. if (!key) {
  7091. key = '#' + (el.id = 'N' + String(Math.random()).slice(-12));
  7092. }
  7093. field = me.getField(key, true);
  7094. // The priority of passing parameter by DOM is higher than by JS.
  7095. field.rule = dataRule || field.rule;
  7096. if (display = attr(el, DATA_DISPLAY)) {
  7097. field.display = display;
  7098. }
  7099. if (field.rule) {
  7100. if ( attr(el, DATA_MUST) !== null || /\b(?:match|checked)\b/.test(field.rule) ) {
  7101. field.must = true;
  7102. }
  7103. if ( /\brequired\b/.test(field.rule) ) {
  7104. field.required = true;
  7105. }
  7106. if (timely = attr(el, DATA_TIMELY)) {
  7107. field.timely = +timely;
  7108. } else if (field.timely > 3) {
  7109. attr(el, DATA_TIMELY, field.timely);
  7110. }
  7111. me._parseRule(field);
  7112. field.old = {};
  7113. }
  7114. if ( isString(field.target) ) {
  7115. attr(el, DATA_TARGET, field.target);
  7116. }
  7117. if ( isString(field.tip) ) {
  7118. attr(el, DATA_TIP, field.tip);
  7119. }
  7120. return me.fields[key] = field;
  7121. },
  7122. // Parsing field rules
  7123. _parseRule: function(field) {
  7124. var arr = rDisplay.exec(field.rule);
  7125. if (!arr) return;
  7126. // current rule index
  7127. field._i = 0;
  7128. if (arr[1]) {
  7129. field.display = arr[1];
  7130. }
  7131. if (arr[2]) {
  7132. field._rules = [];
  7133. arr[2].replace(rRules, function(){
  7134. var args = arguments;
  7135. args[4] = args[4] || args[5];
  7136. field._rules.push({
  7137. and: args[1] === '&',
  7138. not: args[2] === '!',
  7139. or: args[6] === '|',
  7140. method: args[3],
  7141. params: args[4] ? $.map( args[4].split(', '), trim ) : undefined
  7142. });
  7143. });
  7144. }
  7145. },
  7146. // Verify a zone
  7147. _multiValidate: function($inputs, doneCallback){
  7148. var me = this,
  7149. opt = me.options;
  7150. me.hasError = false;
  7151. if (opt.ignore) {
  7152. $inputs = $inputs.not(opt.ignore);
  7153. }
  7154. $inputs.each(function() {
  7155. me._validate(this);
  7156. if (me.hasError && opt.stopOnError) {
  7157. // stop the validation
  7158. return false;
  7159. }
  7160. });
  7161. // Need to wait for all fields validation complete, especially asynchronous validation
  7162. if (doneCallback) {
  7163. me.validating = true;
  7164. $.when.apply(
  7165. null,
  7166. $.map(me.deferred, function(v){return v;})
  7167. ).done(function(){
  7168. doneCallback.call(me, !me.hasError);
  7169. me.validating = false;
  7170. });
  7171. }
  7172. // If the form does not contain asynchronous validation, the return value is correct.
  7173. // Otherwise, you should detect form validation result through "doneCallback".
  7174. return !$.isEmptyObject(me.deferred) ? undefined : !me.hasError;
  7175. },
  7176. // Validate the whole form
  7177. _submit: function(e) {
  7178. var me = this,
  7179. opt = me.options,
  7180. form = e.target,
  7181. canSubmit = e.type === 'submit' && form.tagName === 'FORM' && !e.isDefaultPrevented();
  7182. e.preventDefault();
  7183. if (
  7184. novalidateonce && ~(novalidateonce = false) ||
  7185. // Prevent duplicate submission
  7186. me.submiting ||
  7187. // Receive the "validate" event only from the form.
  7188. e.type === 'validate' && me.$el[0] !== form ||
  7189. // trigger the beforeSubmit callback.
  7190. isFunction(opt.beforeSubmit) && opt.beforeSubmit.call(me, form) === false
  7191. ) {
  7192. return;
  7193. }
  7194. if (me.isAjaxSubmit === undefined) {
  7195. me._guessAjax(form);
  7196. }
  7197. me._debug('log', '\n<<< event: ' + e.type);
  7198. me._reset();
  7199. me.submiting = true;
  7200. me._multiValidate(
  7201. me.$el.find(INPUT_SELECTOR),
  7202. function(isValid){
  7203. var ret = (isValid || opt.debug === 2) ? 'valid' : 'invalid',
  7204. errors;
  7205. if (!isValid) {
  7206. if (opt.focusInvalid) {
  7207. // navigate to the error element
  7208. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  7209. }
  7210. errors = $.map(me.errors, function(err){return err;});
  7211. }
  7212. // releasing submit
  7213. me.submiting = false;
  7214. me.isValid = isValid;
  7215. // trigger callback and event
  7216. isFunction(opt[ret]) && opt[ret].call(me, form, errors);
  7217. me.$el.trigger(ret + CLS_NS_FORM, [form, errors]);
  7218. me._debug('log', '>>> ' + ret);
  7219. if (!isValid) return;
  7220. // For jquery.form plugin
  7221. if (me.vetoed) {
  7222. $(form).ajaxSubmit(me.ajaxFormOptions);
  7223. }
  7224. else if (canSubmit && !me.isAjaxSubmit) {
  7225. document.createElement('form').submit.call(form);
  7226. }
  7227. }
  7228. );
  7229. },
  7230. _reset: function(e) {
  7231. var me = this;
  7232. me.errors = {};
  7233. if (e) {
  7234. me.reseting = true;
  7235. me.$el.find(INPUT_SELECTOR).each( function(){
  7236. me._resetElement(this);
  7237. });
  7238. delete me.reseting;
  7239. }
  7240. },
  7241. _resetElement: function(el, all) {
  7242. this._setClass(el, null);
  7243. this.hideMsg(el);
  7244. },
  7245. // Handle events: "focusin/click"
  7246. _focusin: function(e) {
  7247. var me = this,
  7248. opt = me.options,
  7249. el = e.target,
  7250. timely,
  7251. msg;
  7252. if ( me.validating || ( e.type==='click' && document.activeElement === el ) ) {
  7253. return;
  7254. }
  7255. if (opt.focusCleanup) {
  7256. if ( attr(el, ARIA_INVALID) === 'true' ) {
  7257. me._setClass(el, null);
  7258. me.hideMsg(el);
  7259. }
  7260. }
  7261. msg = attr(el, DATA_TIP);
  7262. if (msg) {
  7263. me.showMsg(el, {
  7264. type: 'tip',
  7265. msg: msg
  7266. });
  7267. } else {
  7268. if (attr(el, DATA_RULE)) {
  7269. me._parse(el);
  7270. }
  7271. if (timely = attr(el, DATA_TIMELY)) {
  7272. if ( timely === 8 || timely === 9 ) {
  7273. me._focusout(e);
  7274. }
  7275. }
  7276. }
  7277. },
  7278. // Handle events: "focusout/validate/keyup/click/change/input/compositionstart/compositionend"
  7279. _focusout: function(e) {
  7280. var me = this,
  7281. opt = me.options,
  7282. el = e.target,
  7283. etype = e.type,
  7284. etype0,
  7285. focusin = etype === 'focusin',
  7286. special = etype === 'validate',
  7287. elem,
  7288. field,
  7289. old,
  7290. value,
  7291. timestamp,
  7292. key, specialKey,
  7293. timely,
  7294. timer = 0;
  7295. if (etype === 'compositionstart') {
  7296. me.pauseValidate = true;
  7297. }
  7298. if (etype === 'compositionend') {
  7299. me.pauseValidate = false;
  7300. }
  7301. if (me.pauseValidate) {
  7302. return;
  7303. }
  7304. // For checkbox and radio
  7305. elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
  7306. // Get field
  7307. if (!(field = me.getField(elem)) || !field.rule) {
  7308. return;
  7309. }
  7310. // Cache event type
  7311. etype0 = field._e;
  7312. field._e = etype;
  7313. timely = field.timely;
  7314. if (!special) {
  7315. if (!timely || (_checkable(el) && etype !== 'click')) {
  7316. return;
  7317. }
  7318. value = field.getValue();
  7319. // not validate field unless fill a value
  7320. if ( field.ignoreBlank && !value && !focusin ) {
  7321. me.hideMsg(el);
  7322. return;
  7323. }
  7324. if ( etype === 'focusout' ) {
  7325. if (etype0 === 'change') {
  7326. return;
  7327. }
  7328. if ( timely === 2 || timely === 8 ) {
  7329. old = field.old;
  7330. if (value && old) {
  7331. if (field.isValid && !old.showOk) {
  7332. me.hideMsg(el);
  7333. } else {
  7334. me._makeMsg(el, field, old);
  7335. }
  7336. } else {
  7337. return;
  7338. }
  7339. }
  7340. }
  7341. else {
  7342. if ( timely < 2 && !e.data ) {
  7343. return;
  7344. }
  7345. // mark timestamp to reduce the frequency of the received event
  7346. timestamp = +new Date();
  7347. if ( timestamp - (el._ts || 0) < 100 ) {
  7348. return;
  7349. }
  7350. el._ts = timestamp;
  7351. // handle keyup
  7352. if ( etype === 'keyup' ) {
  7353. if (etype0 === 'input') {
  7354. return;
  7355. }
  7356. key = e.keyCode;
  7357. specialKey = {
  7358. 8: 1, // Backspace
  7359. 9: 1, // Tab
  7360. 16: 1, // Shift
  7361. 32: 1, // Space
  7362. 46: 1 // Delete
  7363. };
  7364. // only gets focus, no validation
  7365. if ( key === 9 && !value ) {
  7366. return;
  7367. }
  7368. // do not validate, if triggered by these keys
  7369. if ( key < 48 && !specialKey[key] ) {
  7370. return;
  7371. }
  7372. }
  7373. if ( !focusin ) {
  7374. // keyboard events, reducing the frequency of validation
  7375. timer = timely <100 ? (etype === 'click' || el.tagName === 'SELECT') ? 0 : 400 : timely;
  7376. }
  7377. }
  7378. }
  7379. // if the current field is ignored
  7380. if ( opt.ignore && $(el).is(opt.ignore) ) {
  7381. return;
  7382. }
  7383. clearTimeout(field._t);
  7384. if (timer) {
  7385. field._t = setTimeout(function() {
  7386. me._validate(el, field);
  7387. }, timer);
  7388. } else {
  7389. if (special) field.old = {};
  7390. me._validate(el, field);
  7391. }
  7392. },
  7393. _setClass: function(el, isValid) {
  7394. var $el = $(el), opt = this.options;
  7395. if (opt.bindClassTo) {
  7396. $el = $el.closest(opt.bindClassTo);
  7397. }
  7398. $el.removeClass( opt.invalidClass + ' ' + opt.validClass );
  7399. if (isValid !== null) {
  7400. $el.addClass( isValid ? opt.validClass : opt.invalidClass );
  7401. }
  7402. },
  7403. _showmsg: function(e, type, msg) {
  7404. var me = this,
  7405. el = e.target;
  7406. if ( me.$el.is(el) ) {
  7407. if (isObject(type)) {
  7408. me.showMsg(type)
  7409. }
  7410. else if ( type === 'tip' ) {
  7411. me.$el.find(INPUT_SELECTOR +'['+ DATA_TIP +']', el).each(function(){
  7412. me.showMsg(this, {type: type, msg: msg});
  7413. });
  7414. }
  7415. }
  7416. else {
  7417. me.showMsg(el, {type: type, msg: msg});
  7418. }
  7419. },
  7420. _hidemsg: function(e) {
  7421. var $el = $(e.target);
  7422. if ( $el.is(INPUT_SELECTOR) ) {
  7423. this.hideMsg($el);
  7424. }
  7425. },
  7426. // Validated a field
  7427. _validatedField: function(el, field, ret) {
  7428. var me = this,
  7429. opt = me.options,
  7430. isValid = field.isValid = ret.isValid = !!ret.isValid,
  7431. callback = isValid ? 'valid' : 'invalid';
  7432. ret.key = field.key;
  7433. ret.ruleName = field._r;
  7434. ret.id = el.id;
  7435. ret.value = field.value;
  7436. me.elements[field.key] = ret.element = el;
  7437. me.isValid = me.$el[0].isValid = isValid ? me.isFormValid() : isValid;
  7438. if (isValid) {
  7439. ret.type = 'ok';
  7440. } else {
  7441. if (me.submiting) {
  7442. me.errors[field.key] = ret.msg;
  7443. }
  7444. me.hasError = true;
  7445. }
  7446. // cache result
  7447. field.old = ret;
  7448. // trigger callback
  7449. isFunction(field[callback]) && field[callback].call(me, el, ret);
  7450. isFunction(opt.validation) && opt.validation.call(me, el, ret);
  7451. // trigger event
  7452. $(el).attr( ARIA_INVALID, isValid ? null : true )
  7453. .trigger( callback + CLS_NS_FIELD, [ret, me] );
  7454. me.$el.triggerHandler('validation', [ret, me]);
  7455. if (me.checkOnly) return;
  7456. // set className
  7457. me._setClass(el, ret.skip || ret.type === 'tip' ? null : isValid);
  7458. me._makeMsg.apply(me, arguments);
  7459. },
  7460. _makeMsg: function(el, field, ret) {
  7461. // show or hide the message
  7462. if (field.msgMaker) {
  7463. ret = $.extend({}, ret);
  7464. if (field._e === 'focusin') {
  7465. ret.type = 'tip';
  7466. }
  7467. this[ ret.showOk || ret.msg || ret.type === 'tip' ? 'showMsg' : 'hideMsg' ](el, ret, field);
  7468. }
  7469. },
  7470. // Validated a rule
  7471. _validatedRule: function(el, field, ret, msgOpt) {
  7472. field = field || me.getField(el);
  7473. msgOpt = msgOpt || {};
  7474. var me = this,
  7475. msg,
  7476. rule,
  7477. method = field._r,
  7478. timely = field.timely,
  7479. special = timely === 9 || timely === 8,
  7480. transfer,
  7481. temp,
  7482. isValid = false;
  7483. // use null to break validation from a field
  7484. if (ret === null) {
  7485. me._validatedField(el, field, {isValid: true, skip: true});
  7486. field._i = 0;
  7487. return;
  7488. }
  7489. else if (ret === undefined) {
  7490. transfer = true;
  7491. }
  7492. else if (ret === true || ret === '') {
  7493. isValid = true;
  7494. }
  7495. else if (isString(ret)) {
  7496. msg = ret;
  7497. }
  7498. else if (isObject(ret)) {
  7499. if (ret.error) {
  7500. msg = ret.error;
  7501. } else {
  7502. msg = ret.ok;
  7503. isValid = true;
  7504. }
  7505. }
  7506. else {
  7507. isValid = !!ret
  7508. }
  7509. rule = field._rules[field._i];
  7510. if (rule.not) {
  7511. msg = undefined;
  7512. isValid = method === 'required' || !isValid;
  7513. }
  7514. if (rule.or) {
  7515. if (isValid) {
  7516. while ( field._i < field._rules.length && field._rules[field._i].or ) {
  7517. field._i++;
  7518. }
  7519. } else {
  7520. transfer = true;
  7521. }
  7522. }
  7523. else if (rule.and) {
  7524. if (!field.isValid) transfer = true;
  7525. }
  7526. if (transfer) {
  7527. isValid = true;
  7528. }
  7529. // message analysis, and throw rule level event
  7530. else {
  7531. if (isValid) {
  7532. if (field.showOk !== false) {
  7533. temp = attr(el, DATA_OK);
  7534. msg = temp === null ? isString(field.ok) ? field.ok : msg : temp;
  7535. if (!isString(msg) && isString(field.showOk)) {
  7536. msg = field.showOk;
  7537. }
  7538. if (isString(msg)) {
  7539. msgOpt.showOk = isValid;
  7540. }
  7541. }
  7542. }
  7543. if (!isValid || special) {
  7544. /* rule message priority:
  7545. 1. custom DOM message
  7546. 2. custom field message;
  7547. 3. global defined message;
  7548. 4. rule returned message;
  7549. 5. default message;
  7550. */
  7551. msg = (_getDataMsg(el, field, msg || rule.msg || me.messages[method]) || me.messages.fallback).replace(/\{0\|?([^\}]*)\}/, function(m, defaultDisplay){
  7552. return me._getDisplay(el, field.display) || defaultDisplay || me.messages[0];
  7553. });
  7554. }
  7555. if (!isValid) field.isValid = isValid;
  7556. msgOpt.msg = msg;
  7557. $(el).trigger( (isValid ? 'valid' : 'invalid') + CLS_NS_RULE, [method, msg]);
  7558. }
  7559. if (special && (!transfer || rule.and)) {
  7560. if (!isValid && !field._m) field._m = msg;
  7561. field._v = field._v || [];
  7562. field._v.push({
  7563. type: isValid ? !transfer ? 'ok' : 'tip' : 'error',
  7564. msg: msg || rule.msg
  7565. });
  7566. }
  7567. me._debug('log', ' ' + field._i + ': ' + method + ' => ' + (isValid || msg));
  7568. // the current rule has passed, continue to validate
  7569. if ( (isValid || special) && field._i < field._rules.length - 1) {
  7570. field._i++;
  7571. me._checkRule(el, field);
  7572. }
  7573. // field was invalid, or all fields was valid
  7574. else {
  7575. field._i = 0;
  7576. if (special) {
  7577. msgOpt.isValid = field.isValid;
  7578. msgOpt.result = field._v;
  7579. msgOpt.msg = field._m || '';
  7580. if (!field.value && (field._e === 'focusin')) {
  7581. msgOpt.type = 'tip';
  7582. }
  7583. } else {
  7584. msgOpt.isValid = isValid;
  7585. }
  7586. me._validatedField(el, field, msgOpt);
  7587. delete field._m;
  7588. delete field._v;
  7589. }
  7590. },
  7591. // Verify a rule form a field
  7592. _checkRule: function(el, field) {
  7593. var me = this,
  7594. ret,
  7595. fn,
  7596. old,
  7597. key = field.key,
  7598. rule = field._rules[field._i],
  7599. method = rule.method,
  7600. params = rule.params;
  7601. // request has been sent, wait it
  7602. if (me.submiting && me.deferred[key]) {
  7603. return;
  7604. }
  7605. old = field.old;
  7606. field._r = method;
  7607. if (old && !field.must && !rule.must && rule.result !== undefined &&
  7608. old.ruleName === method && old.id === el.id &&
  7609. field.value && old.value === field.value )
  7610. {
  7611. // get result from cache
  7612. ret = rule.result;
  7613. }
  7614. else {
  7615. // get result from current rule
  7616. fn = _getDataRule(el, method) || me.rules[method] || noop;
  7617. ret = fn.call(field, el, params, field);
  7618. if (fn.msg) rule.msg = fn.msg;
  7619. }
  7620. // asynchronous validation
  7621. if (isObject(ret) && isFunction(ret.then)) {
  7622. me.deferred[key] = ret;
  7623. // whether the field valid is unknown
  7624. field.isValid = undefined;
  7625. // show loading message
  7626. !me.checkOnly && me.showMsg(el, {
  7627. type: 'loading',
  7628. msg: me.messages.loading
  7629. }, field);
  7630. // waiting to parse the response data
  7631. ret.then(
  7632. function(d, textStatus, jqXHR) {
  7633. var data = trim(jqXHR.responseText),
  7634. result,
  7635. dataFilter = field.dataFilter;
  7636. // detect if data is json or jsonp format
  7637. if (/jsonp?/.test(this.dataType)) {
  7638. data = d;
  7639. } else if (data.charAt(0) === '{') {
  7640. data = $.parseJSON(data);
  7641. }
  7642. // filter data
  7643. result = dataFilter.call(this, data, field);
  7644. if (result === undefined) result = dataFilter.call(this, data.data, field);
  7645. rule.data = this.data;
  7646. rule.result = field.old ? result : undefined;
  7647. me._validatedRule(el, field, result);
  7648. },
  7649. function(jqXHR, textStatus){
  7650. me._validatedRule(el, field, me.messages[textStatus] || textStatus);
  7651. }
  7652. ).always(function(){
  7653. delete me.deferred[key];
  7654. });
  7655. }
  7656. // other result
  7657. else {
  7658. me._validatedRule(el, field, ret);
  7659. }
  7660. },
  7661. // Processing the validation
  7662. _validate: function(el, field) {
  7663. var me = this;
  7664. // doesn't validate the element that has "disabled" or "novalidate" attribute
  7665. if ( el.disabled || attr(el, NOVALIDATE) !== null ) {
  7666. return;
  7667. }
  7668. field = field || me.getField(el);
  7669. if (!field) return;
  7670. if (!field._rules) me._parse(el);
  7671. if (!field._rules) return;
  7672. me._debug('info', field.key);
  7673. field.isValid = true;
  7674. field.element = el;
  7675. // Cache the value
  7676. field.value = field.getValue();
  7677. // if the field is not required, and that has a blank value
  7678. if (!field.required && !field.must && !field.value) {
  7679. if (!_checkable(el)) {
  7680. me._validatedField(el, field, {isValid: true});
  7681. return true;
  7682. }
  7683. }
  7684. me._checkRule(el, field);
  7685. return field.isValid;
  7686. },
  7687. _debug: function(type, messages) {
  7688. if (window.console && this.options.debug) {
  7689. console[type](messages);
  7690. }
  7691. },
  7692. /**
  7693. * Detecting whether the value of an element that matches a rule
  7694. *
  7695. * @method test
  7696. * @param {Element} el - input element
  7697. * @param {String} rule - rule name
  7698. */
  7699. test: function(el, rule) {
  7700. var me = this,
  7701. ret,
  7702. parts = rRule.exec(rule),
  7703. field,
  7704. method,
  7705. params;
  7706. if (parts) {
  7707. method = parts[1];
  7708. if (method in me.rules) {
  7709. params = parts[2] || parts[3];
  7710. params = params ? params.split(', ') : undefined;
  7711. field = me.getField(el, true);
  7712. field._r = method;
  7713. field.value = field.getValue();
  7714. ret = me.rules[method].call(field, el, params);
  7715. }
  7716. }
  7717. return ret === true || ret === undefined || ret === null;
  7718. },
  7719. _getDisplay: function(el, str) {
  7720. return !isString(str) ? isFunction(str) ? str.call(this, el) : '' : str;
  7721. },
  7722. _getMsgOpt: function(obj, field) {
  7723. var opt = field ? field : this.options;
  7724. return $.extend({
  7725. type: 'error',
  7726. pos: _getPos(opt.msgClass),
  7727. target: opt.target,
  7728. wrapper: opt.msgWrapper,
  7729. style: opt.msgStyle,
  7730. cls: opt.msgClass,
  7731. arrow: opt.msgArrow,
  7732. icon: opt.msgIcon
  7733. }, isString(obj) ? {msg: obj} : obj);
  7734. },
  7735. _getMsgDOM: function(el, msgOpt) {
  7736. var $el = $(el), $msgbox, datafor, tgt, container;
  7737. if ( $el.is(INPUT_SELECTOR) ) {
  7738. tgt = msgOpt.target || attr(el, DATA_TARGET);
  7739. if (tgt) {
  7740. tgt = !isFunction(tgt) ? tgt.charAt(0) === '#' ? $(tgt) : this.$el.find(tgt) : tgt.call(this, el);
  7741. if (tgt.length) {
  7742. if ( tgt.is(INPUT_SELECTOR) ) {
  7743. $el = tgt
  7744. el = tgt.get(0);
  7745. } else if ( tgt.hasClass(CLS_MSG_BOX) ) {
  7746. $msgbox = tgt;
  7747. } else {
  7748. container = tgt;
  7749. }
  7750. }
  7751. }
  7752. if (!$msgbox) {
  7753. datafor = (!_checkable(el) || !el.name) && el.id ? el.id : el.name;
  7754. $msgbox = (container || this.$el).find(msgOpt.wrapper + '.' + CLS_MSG_BOX + '[for="' + datafor + '"]');
  7755. }
  7756. } else {
  7757. $msgbox = $el;
  7758. }
  7759. // Create new message box
  7760. if (!msgOpt.hide && !$msgbox.length) {
  7761. $msgbox = $('<'+ msgOpt.wrapper + '>').attr({
  7762. 'class': CLS_MSG_BOX + (msgOpt.cls ? ' ' + msgOpt.cls : ''),
  7763. 'style': msgOpt.style || undefined,
  7764. 'for': datafor
  7765. });
  7766. if (container) {
  7767. $msgbox.appendTo(container);
  7768. } else {
  7769. if ( _checkable(el) ) {
  7770. var $parent = $el.parent();
  7771. $msgbox.appendTo( $parent.is('label') ? $parent.parent() : $parent );
  7772. } else {
  7773. $msgbox[!msgOpt.pos || msgOpt.pos === 'right' ? 'insertAfter' : 'insertBefore']($el);
  7774. }
  7775. }
  7776. }
  7777. return $msgbox;
  7778. },
  7779. /**
  7780. * Show validation message
  7781. *
  7782. * @method showMsg
  7783. * @param {Element} el - input element
  7784. * @param {Object} msgOpt
  7785. */
  7786. showMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  7787. if (!el) return;
  7788. var me = this,
  7789. opt = me.options,
  7790. msgShow,
  7791. msgMaker,
  7792. temp,
  7793. $msgbox;
  7794. if (isObject(el) && !el.jquery && !msgOpt) {
  7795. $.each(el, function(key, msg) {
  7796. var el = me.elements[key] || me.$el.find(_key2selector(key))[0];
  7797. me.showMsg(el, msg);
  7798. });
  7799. return;
  7800. }
  7801. if ($(el).is(INPUT_SELECTOR)) {
  7802. field = field || me.getField(el);
  7803. }
  7804. if (!(msgMaker = (field || opt).msgMaker)) {
  7805. return;
  7806. }
  7807. msgOpt = me._getMsgOpt(msgOpt, field);
  7808. el = (el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]') : $(el)).get(0);
  7809. // ok or tip
  7810. if (!msgOpt.msg && msgOpt.type !== 'error') {
  7811. temp = attr(el, 'data-' + msgOpt.type);
  7812. if (temp !== null) msgOpt.msg = temp;
  7813. }
  7814. if ( !isString(msgOpt.msg) ) {
  7815. return;
  7816. }
  7817. $msgbox = me._getMsgDOM(el, msgOpt);
  7818. !rPos.test($msgbox[0].className) && $msgbox.addClass(msgOpt.cls);
  7819. if ( isIE === 6 && msgOpt.pos === 'bottom' ) {
  7820. $msgbox[0].style.marginTop = $(el).outerHeight() + 'px';
  7821. }
  7822. $msgbox.html( msgMaker.call(me, msgOpt) )[0].style.display = '';
  7823. if (isFunction(msgShow = field && field.msgShow || opt.msgShow)) {
  7824. msgShow.call(me, $msgbox, msgOpt.type);
  7825. }
  7826. },
  7827. /**
  7828. * Hide validation message
  7829. *
  7830. * @method hideMsg
  7831. * @param {Element} el - input element
  7832. * @param {Object} msgOpt optional
  7833. */
  7834. hideMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  7835. var me = this,
  7836. opt = me.options,
  7837. msgHide,
  7838. $msgbox;
  7839. el = $(el).get(0);
  7840. if ($(el).is(INPUT_SELECTOR)) {
  7841. field = field || me.getField(el);
  7842. if (field) {
  7843. if (field.isValid || me.reseting) attr(el, ARIA_INVALID, null);
  7844. }
  7845. }
  7846. msgOpt = me._getMsgOpt(msgOpt, field);
  7847. msgOpt.hide = true;
  7848. $msgbox = me._getMsgDOM(el, msgOpt);
  7849. if (!$msgbox.length) return;
  7850. if ( isFunction(msgHide = field && field.msgHide || opt.msgHide) ) {
  7851. msgHide.call(me, $msgbox, msgOpt.type);
  7852. } else {
  7853. $msgbox[0].style.display = 'none';
  7854. $msgbox[0].innerHTML = '';
  7855. }
  7856. },
  7857. /**
  7858. * Get field information
  7859. *
  7860. * @method getField
  7861. * @param {Element} - input element
  7862. * @return {Object} field
  7863. */
  7864. getField: function(el, must) {
  7865. var me = this,
  7866. key,
  7867. field;
  7868. if (isString(el)) {
  7869. key = el;
  7870. el = undefined;
  7871. } else {
  7872. if (attr(el, DATA_RULE)) {
  7873. return me._parse(el);
  7874. }
  7875. if (el.id && '#' + el.id in me.fields || !el.name) {
  7876. key = '#' + el.id;
  7877. } else {
  7878. key = el.name;
  7879. }
  7880. }
  7881. if ( (field = me.fields[key]) || must && (field = new me.Field(key)) ) {
  7882. field.element = el;
  7883. }
  7884. return field;
  7885. },
  7886. /**
  7887. * Config a field
  7888. *
  7889. * @method: setField
  7890. * @param {String} key
  7891. * @param {Object} obj
  7892. */
  7893. setField: function(key, obj) {
  7894. var fields = {};
  7895. if (!key) return;
  7896. // update this field
  7897. if (isString(key)) {
  7898. fields[key] = obj;
  7899. }
  7900. // update fields
  7901. else {
  7902. fields = key;
  7903. }
  7904. this._initFields(fields);
  7905. },
  7906. /**
  7907. * Detecting whether the form is valid
  7908. *
  7909. * @method isFormValid
  7910. * @return {Boolean}
  7911. */
  7912. isFormValid: function() {
  7913. var fields = this.fields, k, field;
  7914. for (k in fields) {
  7915. field = fields[k];
  7916. if (!field._rules || !field.required && !field.must && !field.value) continue;
  7917. if (!field.isValid) return false;
  7918. }
  7919. return true;
  7920. },
  7921. /**
  7922. * Prevent submission form
  7923. *
  7924. * @method holdSubmit
  7925. * @param {Boolean} hold - If set to false, will release the hold
  7926. */
  7927. holdSubmit: function(hold) {
  7928. this.submiting = hold === undefined || hold;
  7929. },
  7930. /**
  7931. * Clean validation messages
  7932. *
  7933. * @method cleanUp
  7934. */
  7935. cleanUp: function() {
  7936. this._reset(1);
  7937. },
  7938. /**
  7939. * Destroy the validation
  7940. *
  7941. * @method destroy
  7942. */
  7943. destroy: function() {
  7944. this._reset(1);
  7945. this.$el.off(CLS_NS).removeData(NS);
  7946. attr(this.$el[0], NOVALIDATE, this._NOVALIDATE);
  7947. }
  7948. };
  7949. /**
  7950. * Create Field Factory
  7951. *
  7952. * @class
  7953. * @param {Object} context
  7954. * @return {Function} Factory
  7955. */
  7956. function _createFieldFactory(context) {
  7957. function FieldFactory() {
  7958. var options = this.options;
  7959. for (var i in options) {
  7960. if (i in fieldDefaults) this[i] = options[i];
  7961. }
  7962. $.extend(this, {
  7963. _valHook: function() {
  7964. return this.element.contentEditable === 'true' ? 'text' : 'val';
  7965. },
  7966. getValue: function() {
  7967. var elem = this.element;
  7968. if (elem.type === 'number' && elem.validity && elem.validity.badInput) {
  7969. return 'NaN';
  7970. }
  7971. return $(elem)[this._valHook()]();
  7972. },
  7973. setValue: function(value) {
  7974. $(this.element)[this._valHook()](this.value = value);
  7975. },
  7976. // Get a range of validation messages
  7977. getRangeMsg: function(value, params, suffix) {
  7978. if (!params) return;
  7979. var me = this,
  7980. msg = me.messages[me._r] || '',
  7981. result,
  7982. p = params[0].split('~'),
  7983. e = params[1] === 'false',
  7984. a = p[0],
  7985. b = p[1],
  7986. c = 'rg',
  7987. args = [''],
  7988. isNumber = trim(value) && +value === +value;
  7989. function compare(large, small) {
  7990. return !e ? large >= small : large > small;
  7991. }
  7992. if (p.length === 2) {
  7993. if (a && b) {
  7994. if (isNumber && compare(value, +a) && compare(+b, value)) {
  7995. result = true;
  7996. }
  7997. args = args.concat(p);
  7998. c = e ? 'gtlt' : 'rg';
  7999. }
  8000. else if (a && !b) {
  8001. if (isNumber && compare(value, +a)) {
  8002. result = true;
  8003. }
  8004. args.push(a);
  8005. c = e ? 'gt' : 'gte';
  8006. }
  8007. else if (!a && b) {
  8008. if (isNumber && compare(+b, value)) {
  8009. result = true;
  8010. }
  8011. args.push(b);
  8012. c = e ? 'lt' : 'lte';
  8013. }
  8014. }
  8015. else {
  8016. if (value === +a) {
  8017. result = true;
  8018. }
  8019. args.push(a);
  8020. c = 'eq';
  8021. }
  8022. if (msg) {
  8023. if (suffix && msg[c + suffix]) {
  8024. c += suffix;
  8025. }
  8026. args[0] = msg[c];
  8027. }
  8028. return result || me._rules && ( me._rules[me._i].msg = me.renderMsg.apply(null, args) );
  8029. },
  8030. // Render message template
  8031. renderMsg: function() {
  8032. var args = arguments,
  8033. tpl = args[0],
  8034. i = args.length;
  8035. if (!tpl) return;
  8036. while (--i) {
  8037. tpl = tpl.replace('{' + i + '}', args[i]);
  8038. }
  8039. return tpl;
  8040. }
  8041. });
  8042. }
  8043. function Field(key, obj, oldField) {
  8044. this.key = key;
  8045. this.validator = context;
  8046. $.extend(this, oldField, obj);
  8047. }
  8048. FieldFactory.prototype = context;
  8049. Field.prototype = new FieldFactory();
  8050. return Field;
  8051. }
  8052. /**
  8053. * Create Rules
  8054. *
  8055. * @class
  8056. * @param {Object} obj rules
  8057. * @param {Object} context context
  8058. */
  8059. function Rules(obj, context) {
  8060. if (!isObject(obj)) return;
  8061. var k, that = context ? context === true ? this : context : Rules.prototype;
  8062. for (k in obj) {
  8063. if (_checkRuleName(k)) {
  8064. that[k] = _getRule(obj[k]);
  8065. }
  8066. }
  8067. }
  8068. /**
  8069. * Create Messages
  8070. *
  8071. * @class
  8072. * @param {Object} obj rules
  8073. * @param {Object} context context
  8074. */
  8075. function Messages(obj, context) {
  8076. if (!isObject(obj)) return;
  8077. var k, that = context ? context === true ? this : context : Messages.prototype;
  8078. for (k in obj) {
  8079. that[k] = obj[k];
  8080. }
  8081. }
  8082. // Rule converted factory
  8083. function _getRule(fn) {
  8084. switch ($.type(fn)) {
  8085. case 'function':
  8086. return fn;
  8087. case 'array':
  8088. var f = function() {
  8089. return fn[0].test(this.value) || fn[1] || false;
  8090. };
  8091. f.msg = fn[1];
  8092. return f;
  8093. case 'regexp':
  8094. return function() {
  8095. return fn.test(this.value);
  8096. };
  8097. }
  8098. }
  8099. // Get instance by an element
  8100. function _getInstance(el) {
  8101. var wrap, k, options;
  8102. if (!el || !el.tagName) return;
  8103. switch (el.tagName) {
  8104. case 'INPUT':
  8105. case 'SELECT':
  8106. case 'TEXTAREA':
  8107. case 'BUTTON':
  8108. case 'FIELDSET':
  8109. wrap = el.form || $(el).closest('.' + CLS_WRAPPER);
  8110. break;
  8111. case 'FORM':
  8112. wrap = el;
  8113. break;
  8114. default:
  8115. wrap = $(el).closest('.' + CLS_WRAPPER);
  8116. }
  8117. for (k in preinitialized) {
  8118. if ($(wrap).is(k)) {
  8119. options = preinitialized[k];
  8120. break;
  8121. }
  8122. }
  8123. return $(wrap).data(NS) || $(wrap)[NS](options).data(NS);
  8124. }
  8125. // Get custom rules on the node
  8126. function _getDataRule(el, method) {
  8127. var fn = trim(attr(el, DATA_RULE + '-' + method));
  8128. if ( fn && (fn = new Function('return ' + fn)()) ) {
  8129. return _getRule(fn);
  8130. }
  8131. }
  8132. // Get custom messages on the node
  8133. function _getDataMsg(el, field, m) {
  8134. var msg = field.msg,
  8135. item = field._r;
  8136. if ( isObject(msg) ) msg = msg[item];
  8137. if ( !isString(msg) ) {
  8138. msg = attr(el, DATA_MSG + '-' + item) || attr(el, DATA_MSG) || ( m ? isString(m) ? m : m[item] : '');
  8139. }
  8140. return msg;
  8141. }
  8142. // Get message position
  8143. function _getPos(str) {
  8144. var pos;
  8145. if (str) pos = rPos.exec(str);
  8146. return pos && pos[0];
  8147. }
  8148. // Check whether the element is checkbox or radio
  8149. function _checkable(el) {
  8150. return el.tagName === 'INPUT' && el.type === 'checkbox' || el.type === 'radio';
  8151. }
  8152. // Parse date string to timestamp
  8153. function _parseDate(str) {
  8154. return Date.parse(str.replace(/\.|\-/g, '/'));
  8155. }
  8156. // Rule name only allows alphanumeric characters and underscores
  8157. function _checkRuleName(name) {
  8158. return /^\w+$/.test(name);
  8159. }
  8160. // Translate field key to jQuery selector.
  8161. function _key2selector(key) {
  8162. var isID = key.charAt(0) === '#';
  8163. key = key.replace(/([:.{(|)}/\[\]])/g, '\\$1');
  8164. return isID ? key : '[name="'+ key +'"]:first';
  8165. }
  8166. // Fixed a issue cause by refresh page in IE.
  8167. $(window).on('beforeunload', function(){
  8168. this.focus();
  8169. });
  8170. $(document)
  8171. .on('click', ':submit', function(){
  8172. var input = this, attrNode;
  8173. if (!input.form) return;
  8174. // Shim for "formnovalidate"
  8175. attrNode = input.getAttributeNode('formnovalidate');
  8176. if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
  8177. novalidateonce = true;
  8178. }
  8179. })
  8180. // Automatic initializing form validation
  8181. .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
  8182. if ( attr(this, NOVALIDATE) !== null ) return;
  8183. var $form = $(this), me;
  8184. if ( !$form.data(NS) && (me = _getInstance(this)) ) {
  8185. if ( !$.isEmptyObject(me.fields) ) {
  8186. // Execute event handler
  8187. if (e.type === 'focusin') {
  8188. me._focusin(e);
  8189. } else {
  8190. me._submit(e);
  8191. }
  8192. } else {
  8193. attr(this, NOVALIDATE, NOVALIDATE);
  8194. $form.off(CLS_NS).removeData(NS);
  8195. }
  8196. }
  8197. });
  8198. new Messages({
  8199. fallback: 'This field is not valid.',
  8200. loading: 'Validating...'
  8201. });
  8202. // Built-in rules (global)
  8203. new Rules({
  8204. /**
  8205. * required
  8206. *
  8207. * @example:
  8208. required
  8209. required(jqSelector)
  8210. required(anotherRule)
  8211. required(not, -1)
  8212. required(from, .contact)
  8213. */
  8214. required: function(element, params) {
  8215. var me = this,
  8216. val = trim(me.value),
  8217. isValid = true;
  8218. if (params) {
  8219. if ( params.length === 1 ) {
  8220. if ( !_checkRuleName(params[0]) ) {
  8221. if (!val && !$(params[0], me.$el).length ) {
  8222. return null;
  8223. }
  8224. }
  8225. else if ( me.rules[params[0]] ) {
  8226. if ( !val && !me.test(element, params[0]) ) {
  8227. return null;
  8228. }
  8229. me._r = 'required'
  8230. }
  8231. }
  8232. else if ( params[0] === 'not' ) {
  8233. $.each(params.slice(1), function() {
  8234. return (isValid = val !== trim(this));
  8235. });
  8236. }
  8237. else if ( params[0] === 'from' ) {
  8238. var $elements = me.$el.find(params[1]),
  8239. VALIDATED = '_validated_',
  8240. ret;
  8241. isValid = $elements.filter(function(){
  8242. var field = me.getField(this);
  8243. return field && !!trim(field.getValue());
  8244. }).length >= (params[2] || 1);
  8245. if (isValid) {
  8246. if (!val) ret = null;
  8247. } else {
  8248. ret = _getDataMsg($elements[0], me) || false;
  8249. }
  8250. if ( !$(element).data(VALIDATED) ) {
  8251. $elements.data(VALIDATED, 1).each(function(){
  8252. if (element !== this) {
  8253. me._validate(this);
  8254. }
  8255. }).removeData(VALIDATED);
  8256. }
  8257. return ret;
  8258. }
  8259. }
  8260. return isValid && !!val;
  8261. },
  8262. /**
  8263. * integer
  8264. *
  8265. * @example:
  8266. integer
  8267. integer[+]
  8268. integer[+0]
  8269. integer[-]
  8270. integer[-0]
  8271. */
  8272. integer: function(element, params) {
  8273. var re, z = '0|',
  8274. p = '[1-9]\\d*',
  8275. key = params ? params[0] : '*';
  8276. switch (key) {
  8277. case '+':
  8278. re = p;
  8279. break;
  8280. case '-':
  8281. re = '-' + p;
  8282. break;
  8283. case '+0':
  8284. re = z + p;
  8285. break;
  8286. case '-0':
  8287. re = z + '-' + p;
  8288. break;
  8289. default:
  8290. re = z + '-?' + p;
  8291. }
  8292. re = '^(?:' + re + ')$';
  8293. return new RegExp(re).test(this.value) || (this.messages.integer && this.messages.integer[key]);
  8294. },
  8295. /**
  8296. * match another field
  8297. *
  8298. * @example:
  8299. match[password] Match the password field (two values ​​must be the same)
  8300. match[eq, password] Ditto
  8301. match[neq, count] The value must be not equal to the value of the count field
  8302. match[lt, count] The value must be less than the value of the count field
  8303. match[lte, count] The value must be less than or equal to the value of the count field
  8304. match[gt, count] The value must be greater than the value of the count field
  8305. match[gte, count] The value must be greater than or equal to the value of the count field
  8306. match[gte, startDate, date]
  8307. match[gte, startTime, time]
  8308. **/
  8309. match: function(element, params) {
  8310. if (!params) return;
  8311. var me = this,
  8312. isValid = true,
  8313. a, b,
  8314. key, msg, type = 'eq', parser,
  8315. selector2, elem2, field2;
  8316. if (params.length === 1) {
  8317. key = params[0];
  8318. } else {
  8319. type = params[0];
  8320. key = params[1];
  8321. }
  8322. selector2 = _key2selector(key);
  8323. elem2 = me.$el.find(selector2)[0];
  8324. // If the compared field is not exist
  8325. if (!elem2) return;
  8326. field2 = me.getField(elem2);
  8327. a = me.value;
  8328. b = field2.getValue();
  8329. if (!me._match) {
  8330. me.$el.on('valid'+CLS_NS_FIELD+CLS_NS, selector2, function(){
  8331. $(element).trigger('validate');
  8332. });
  8333. me._match = field2._match = 1;
  8334. }
  8335. // If both fields are blank
  8336. if (!me.required && a === '' && b === '') {
  8337. return null;
  8338. }
  8339. parser = params[2];
  8340. if (parser) {
  8341. if (/^date(time)?$/i.test(parser)) {
  8342. a = _parseDate(a);
  8343. b = _parseDate(b);
  8344. } else if (parser === 'time') {
  8345. a = +a.replace(/:/g, '');
  8346. b = +b.replace(/:/g, '');
  8347. }
  8348. }
  8349. // If the compared field is incorrect, we only ensure that this field is correct.
  8350. if (type !== 'eq' && !isNaN(+a) && isNaN(+b)) {
  8351. return true;
  8352. }
  8353. switch (type) {
  8354. case 'lt':
  8355. isValid = +a < +b; break;
  8356. case 'lte':
  8357. isValid = +a <= +b; break;
  8358. case 'gte':
  8359. isValid = +a >= +b; break;
  8360. case 'gt':
  8361. isValid = +a > +b; break;
  8362. case 'neq':
  8363. isValid = a !== b; break;
  8364. default:
  8365. isValid = a === b;
  8366. }
  8367. return isValid || (
  8368. isObject(me.messages.match)
  8369. && me.messages.match[type].replace( '{1}', me._getDisplay( elem2, field2.display || key ) )
  8370. );
  8371. },
  8372. /**
  8373. * range numbers
  8374. *
  8375. * @example:
  8376. range[0~99] Number 0-99
  8377. range[0~] Number greater than or equal to 0
  8378. range[~100] Number less than or equal to 100
  8379. **/
  8380. range: function(element, params) {
  8381. return this.getRangeMsg(this.value, params);
  8382. },
  8383. /**
  8384. * how many checkbox or radio inputs that checked
  8385. *
  8386. * @example:
  8387. checked; no empty, same to required
  8388. checked[1~3] 1-3 items
  8389. checked[1~] greater than 1 item
  8390. checked[~3] less than 3 items
  8391. checked[3] 3 items
  8392. **/
  8393. checked: function(element, params) {
  8394. if ( !_checkable(element) ) return;
  8395. var me = this,
  8396. elem, count;
  8397. if (element.name) {
  8398. count = me.$el.find('input[name="' + element.name + '"]').filter(function() {
  8399. var el = this;
  8400. if (!elem && _checkable(el)) elem = el;
  8401. return !el.disabled && el.checked;
  8402. }).length;
  8403. } else {
  8404. elem = element;
  8405. count = elem.checked;
  8406. }
  8407. if (params) {
  8408. return me.getRangeMsg(count, params);
  8409. } else {
  8410. return !!count || _getDataMsg(elem, me, '') || me.messages.required || false;
  8411. }
  8412. },
  8413. /**
  8414. * length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
  8415. *
  8416. * @example:
  8417. length[6~16] 6-16 characters
  8418. length[6~] Greater than 6 characters
  8419. length[~16] Less than 16 characters
  8420. length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
  8421. **/
  8422. length: function(element, params) {
  8423. var value = this.value,
  8424. len = (params[1] === 'true' ? value.replace(rDoubleBytes, 'xx') : value).length;
  8425. return this.getRangeMsg(len, params, (params[1] ? '_2' : ''));
  8426. },
  8427. /**
  8428. * remote validation
  8429. *
  8430. * @description
  8431. * remote([get:]url [, name1, [name2 ...]]);
  8432. * Adaptation three kinds of results (Front for the successful, followed by a failure):
  8433. 1. text:
  8434. '' 'Error Message'
  8435. 2. json:
  8436. {"ok": ""} {"error": "Error Message"}
  8437. 3. json wrapper:
  8438. {"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
  8439. * @example
  8440. The simplest: remote(path/to/server);
  8441. With parameters: remote(path/to/server, name1, name2, ...);
  8442. By GET: remote(get:path/to/server, name1, name2, ...);
  8443. Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
  8444. Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)
  8445. CORS remote(cors:path/to/server)
  8446. JSONP remote(jsonp:path/to/server)
  8447. */
  8448. remote: function(element, params) {
  8449. if (!params) return;
  8450. var me = this,
  8451. arr = rAjaxType.exec(params[0]),
  8452. rule = me._rules[me._i],
  8453. data = {},
  8454. queryString = '',
  8455. url = arr[3],
  8456. type = arr[2] || 'POST', // GET / POST
  8457. rType = (arr[1]||'').toLowerCase(), // CORS / JSONP
  8458. dataType;
  8459. rule.must = true;
  8460. data[element.name] = me.value;
  8461. // There are extra fields
  8462. if (params[1]) {
  8463. $.map(params.slice(1), function(name) {
  8464. var arr, key;
  8465. if (~name.indexOf('=')) {
  8466. queryString += '&' + name;
  8467. } else {
  8468. arr = name.split(':');
  8469. name = trim(arr[0]);
  8470. key = trim(arr[1]) || name;
  8471. data[ name ] = me.$el.find( _key2selector(key) ).val();
  8472. }
  8473. });
  8474. }
  8475. data = $.param(data) + queryString;
  8476. if (!me.must && rule.data && rule.data === data) {
  8477. return rule.result;
  8478. }
  8479. // Cross-domain request, force jsonp dataType
  8480. if (rType !== 'cors' && /^https?:/.test(url) && !~url.indexOf(location.host)) {
  8481. dataType = 'jsonp';
  8482. }
  8483. // Asynchronous validation need return jqXHR objects
  8484. return $.ajax({
  8485. url: url,
  8486. type: type,
  8487. data: data,
  8488. dataType: dataType
  8489. });
  8490. },
  8491. /**
  8492. * filter characters, direct filtration without prompting error (support custom regular expressions)
  8493. *
  8494. * @example
  8495. * filter filtering unsafe characters
  8496. * filter(regexp) filtering the "regexp" matched characters
  8497. */
  8498. filter: function(element, params) {
  8499. var value = this.value,
  8500. temp = value.replace( params ? (new RegExp('[' + params[0] + ']', 'gm')) : rUnsafe, '' );
  8501. if (temp !== value) this.setValue(temp);
  8502. }
  8503. });
  8504. /**
  8505. * Config global options
  8506. *
  8507. * @static config
  8508. * @param {Object} options
  8509. */
  8510. Validator.config = function(key, value) {
  8511. if (isObject(key)) {
  8512. $.each(key, _config);
  8513. }
  8514. else if (isString(key)) {
  8515. _config(key, value);
  8516. }
  8517. function _config(k, o) {
  8518. if (k === 'rules') {
  8519. new Rules(o);
  8520. }
  8521. else if (k === 'messages') {
  8522. new Messages(o);
  8523. }
  8524. else if (k in fieldDefaults) {
  8525. fieldDefaults[k] = o;
  8526. }
  8527. else {
  8528. defaults[k] = o;
  8529. }
  8530. }
  8531. };
  8532. /**
  8533. * Config themes
  8534. *
  8535. * @static setTheme
  8536. * @param {String|Object} name
  8537. * @param {Object} obj
  8538. * @example
  8539. .setTheme( themeName, themeOptions )
  8540. .setTheme( multiThemes )
  8541. */
  8542. Validator.setTheme = function(name, obj) {
  8543. if ( isObject(name) ) {
  8544. $.extend(true, themes, name);
  8545. }
  8546. else if ( isString(name) && isObject(obj) ) {
  8547. themes[name] = $.extend(themes[name], obj);
  8548. }
  8549. };
  8550. /**
  8551. * Resource loader
  8552. *
  8553. * @static load
  8554. * @param {String} str
  8555. * @example
  8556. .load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css
  8557. .load('local=zh-CN&css=') // load: local/zh-CN.js
  8558. .load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css
  8559. .load('local') // dito
  8560. */
  8561. Validator.load = function(str) {
  8562. if (!str) return;
  8563. var doc = document,
  8564. params = {},
  8565. node = doc.scripts[0],
  8566. dir, el, ONLOAD;
  8567. str.replace(/([^?=&]+)=([^&#]*)/g, function(m, key, value){
  8568. params[key] = value;
  8569. });
  8570. dir = params.dir || Validator.dir;
  8571. if (!Validator.css && params.css !== '') {
  8572. el = doc.createElement('link');
  8573. el.rel = 'stylesheet';
  8574. el.href = Validator.css = dir + 'jquery.validator.css';
  8575. node.parentNode.insertBefore(el, node);
  8576. }
  8577. if (!Validator.local && ~str.indexOf('local') && params.local !== '') {
  8578. Validator.local = (params.local || doc.documentElement.lang || 'en').replace('_','-');
  8579. Validator.pending = 1;
  8580. el = doc.createElement('script');
  8581. el.src = dir + 'local/' + Validator.local + '.js';
  8582. ONLOAD = 'onload' in el ? 'onload' : 'onreadystatechange';
  8583. el[ONLOAD] = function() {
  8584. if (!el.readyState || /loaded|complete/.test(el.readyState)) {
  8585. el = el[ONLOAD] = null;
  8586. delete Validator.pending;
  8587. $(window).triggerHandler('validatorready');
  8588. }
  8589. };
  8590. node.parentNode.insertBefore(el, node);
  8591. }
  8592. };
  8593. // Auto loading resources
  8594. (function(){
  8595. var scripts = document.scripts,
  8596. i = scripts.length, node, arr,
  8597. re = /(.*validator(?:\.min)?.js)(\?.*(?:local|css|dir)(?:=[\w\-]*)?)?/;
  8598. while (i-- && !arr) {
  8599. node = scripts[i];
  8600. arr = (node.hasAttribute ? node.src : node.getAttribute('src',4)||'').match(re);
  8601. }
  8602. if (!arr) return;
  8603. Validator.dir = arr[1].split('/').slice(0, -1).join('/')+'/';
  8604. Validator.load(arr[2]);
  8605. })();
  8606. return $[NS] = Validator;
  8607. }));
  8608. /*********************************
  8609. * Themes, rules, and i18n support
  8610. * Locale: Chinese; 中文
  8611. *********************************/
  8612. (function(factory) {
  8613. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  8614. typeof define === 'function' && define.amd ? define('validator-lang',['jquery'], factory) :
  8615. factory(jQuery);
  8616. }(function($) {
  8617. /* Global configuration
  8618. */
  8619. $.validator.config({
  8620. //stopOnError: true,
  8621. //focusCleanup: true,
  8622. //theme: 'yellow_right',
  8623. //timely: 2,
  8624. // Custom rules
  8625. rules: {
  8626. digits: [/^\d+$/, "请填写数字"]
  8627. ,letters: [/^[a-z]+$/i, "请填写字母"]
  8628. ,date: [/^\d{4}-\d{2}-\d{2}$/, "请填写有效的日期,格式:yyyy-mm-dd"]
  8629. ,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请填写有效的时间,00:00到23:59之间"]
  8630. ,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "请填写有效的邮箱"]
  8631. ,url: [/^(https?|s?ftp):\/\/\S+$/i, "请填写有效的网址"]
  8632. ,qq: [/^[1-9]\d{4,}$/, "请填写有效的QQ号"]
  8633. ,IDcard: [/^\d{6}(19|2\d)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)?$/, "请填写正确的身份证号码"]
  8634. ,tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "请填写有效的电话号码"]
  8635. ,mobile: [/^1[3-9]\d{9}$/, "请填写有效的手机号"]
  8636. ,zipcode: [/^\d{6}$/, "请检查邮政编码格式"]
  8637. ,chinese: [/^[\u0391-\uFFE5]+$/, "请填写中文字符"]
  8638. ,username: [/^\w{3,12}$/, "请填写3-12位数字、字母、下划线"]
  8639. ,password: [/^[\S]{6,16}$/, "请填写6-16位字符,不能包含空格"]
  8640. ,accept: function (element, params){
  8641. if (!params) return true;
  8642. var ext = params[0],
  8643. value = $(element).val();
  8644. return (ext === '*') ||
  8645. (new RegExp(".(?:" + ext + ")$", "i")).test(value) ||
  8646. this.renderMsg("只接受{1}后缀的文件", ext.replace(/\|/g, ','));
  8647. }
  8648. },
  8649. // Default error messages
  8650. messages: {
  8651. 0: "此处",
  8652. fallback: "{0}格式不正确",
  8653. loading: "正在验证...",
  8654. error: "网络异常",
  8655. timeout: "请求超时",
  8656. required: "{0}不能为空",
  8657. remote: "{0}已被使用",
  8658. integer: {
  8659. '*': "请填写整数",
  8660. '+': "请填写正整数",
  8661. '+0': "请填写正整数或0",
  8662. '-': "请填写负整数",
  8663. '-0': "请填写负整数或0"
  8664. },
  8665. match: {
  8666. eq: "{0}与{1}不一致",
  8667. neq: "{0}与{1}不能相同",
  8668. lt: "{0}必须小于{1}",
  8669. gt: "{0}必须大于{1}",
  8670. lte: "{0}不能大于{1}",
  8671. gte: "{0}不能小于{1}"
  8672. },
  8673. range: {
  8674. rg: "请填写{1}到{2}的数",
  8675. gte: "请填写不小于{1}的数",
  8676. lte: "请填写最大{1}的数",
  8677. gtlt: "请填写{1}到{2}之间的数",
  8678. gt: "请填写大于{1}的数",
  8679. lt: "请填写小于{1}的数"
  8680. },
  8681. checked: {
  8682. eq: "请选择{1}项",
  8683. rg: "请选择{1}到{2}项",
  8684. gte: "请至少选择{1}项",
  8685. lte: "请最多选择{1}项"
  8686. },
  8687. length: {
  8688. eq: "请填写{1}个字符",
  8689. rg: "请填写{1}到{2}个字符",
  8690. gte: "请至少填写{1}个字符",
  8691. lte: "请最多填写{1}个字符",
  8692. eq_2: "",
  8693. rg_2: "",
  8694. gte_2: "",
  8695. lte_2: ""
  8696. }
  8697. }
  8698. });
  8699. /* Themes
  8700. */
  8701. var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
  8702. $.validator.setTheme({
  8703. 'simple_right': {
  8704. formClass: 'n-simple',
  8705. msgClass: 'n-right'
  8706. },
  8707. 'simple_bottom': {
  8708. formClass: 'n-simple',
  8709. msgClass: 'n-bottom'
  8710. },
  8711. 'yellow_top': {
  8712. formClass: 'n-yellow',
  8713. msgClass: 'n-top',
  8714. msgArrow: TPL_ARROW
  8715. },
  8716. 'yellow_right': {
  8717. formClass: 'n-yellow',
  8718. msgClass: 'n-right',
  8719. msgArrow: TPL_ARROW
  8720. },
  8721. 'yellow_right_effect': {
  8722. formClass: 'n-yellow',
  8723. msgClass: 'n-right',
  8724. msgArrow: TPL_ARROW,
  8725. msgShow: function($msgbox, type){
  8726. var $el = $msgbox.children();
  8727. if ($el.is(':animated')) return;
  8728. if (type === 'error') {
  8729. $el.css({left: '20px', opacity: 0})
  8730. .delay(100).show().stop()
  8731. .animate({left: '-4px', opacity: 1}, 150)
  8732. .animate({left: '3px'}, 80)
  8733. .animate({left: 0}, 80);
  8734. } else {
  8735. $el.css({left: 0, opacity: 1}).fadeIn(200);
  8736. }
  8737. },
  8738. msgHide: function($msgbox, type){
  8739. var $el = $msgbox.children();
  8740. $el.stop().delay(100).show()
  8741. .animate({left: '20px', opacity: 0}, 300, function(){
  8742. $msgbox.hide();
  8743. });
  8744. }
  8745. }
  8746. });
  8747. }));
  8748. define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], function ($, undefined, Upload, Validator, undefined) {
  8749. var Form = {
  8750. config: {
  8751. 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>'
  8752. },
  8753. events: {
  8754. validator: function (form, success, error, submit) {
  8755. if (!form.is("form"))
  8756. return;
  8757. //绑定表单事件
  8758. form.validator($.extend({
  8759. rules: {
  8760. username: [/^\w{3,30}$/, __('Username must be 3 to 30 characters')],
  8761. password: [/^[\S]{6,30}$/, __('Password must be 6 to 30 characters')]
  8762. },
  8763. validClass: 'has-success',
  8764. invalidClass: 'has-error',
  8765. bindClassTo: '.form-group',
  8766. formClass: 'n-default n-bootstrap',
  8767. msgClass: 'n-right',
  8768. stopOnError: true,
  8769. display: function (elem) {
  8770. return $(elem).closest('.form-group').find(".control-label").text().replace(/\:/, '');
  8771. },
  8772. dataFilter: function (data) {
  8773. if (data.code === 1) {
  8774. return data.msg ? {"ok": data.msg} : '';
  8775. } else {
  8776. return data.msg;
  8777. }
  8778. },
  8779. target: function (input) {
  8780. var target = $(input).data("target");
  8781. if (target && $(target).length > 0) {
  8782. return $(target);
  8783. }
  8784. var $formitem = $(input).closest('.form-group'),
  8785. $msgbox = $formitem.find('span.msg-box');
  8786. if (!$msgbox.length) {
  8787. return [];
  8788. }
  8789. return $msgbox;
  8790. },
  8791. valid: function (ret) {
  8792. var that = this, submitBtn = $(".layer-footer [type=submit]", form);
  8793. that.holdSubmit(true);
  8794. submitBtn.addClass("disabled");
  8795. //验证通过提交表单
  8796. var submitResult = Form.api.submit($(ret), function (data, ret) {
  8797. that.holdSubmit(false);
  8798. submitBtn.removeClass("disabled");
  8799. if (false === $(this).triggerHandler("success.form", [data, ret])) {
  8800. return false;
  8801. }
  8802. if (typeof success === 'function') {
  8803. if (false === success.call($(this), data, ret)) {
  8804. return false;
  8805. }
  8806. }
  8807. //提示及关闭当前窗口
  8808. var msg = ret.hasOwnProperty("msg") && ret.msg !== "" ? ret.msg : __('Operation completed');
  8809. parent.Toastr.success(msg);
  8810. parent.$(".btn-refresh").trigger("click");
  8811. var index = parent.Layer.getFrameIndex(window.name);
  8812. parent.Layer.close(index);
  8813. return false;
  8814. }, function (data, ret) {
  8815. that.holdSubmit(false);
  8816. if (false === $(this).triggerHandler("error.form", [data, ret])) {
  8817. return false;
  8818. }
  8819. submitBtn.removeClass("disabled");
  8820. if (typeof error === 'function') {
  8821. if (false === error.call($(this), data, ret)) {
  8822. return false;
  8823. }
  8824. }
  8825. }, submit);
  8826. //如果提交失败则释放锁定
  8827. if (!submitResult) {
  8828. that.holdSubmit(false);
  8829. submitBtn.removeClass("disabled");
  8830. }
  8831. return false;
  8832. }
  8833. }, form.data("validator-options") || {}));
  8834. //移除提交按钮的disabled类
  8835. $(".layer-footer [type=submit],.fixed-footer [type=submit],.normal-footer [type=submit]", form).removeClass("disabled");
  8836. //自定义关闭按钮事件
  8837. form.on("click", ".layer-close", function () {
  8838. var index = parent.Layer.getFrameIndex(window.name);
  8839. parent.Layer.close(index);
  8840. return false;
  8841. });
  8842. },
  8843. selectpicker: function (form) {
  8844. //绑定select元素事件
  8845. if ($(".selectpicker", form).length > 0) {
  8846. require(['bootstrap-select', 'bootstrap-select-lang'], function () {
  8847. $('.selectpicker', form).selectpicker();
  8848. $(form).on("reset", function () {
  8849. setTimeout(function () {
  8850. $('.selectpicker').selectpicker('refresh').trigger("change");
  8851. }, 1);
  8852. });
  8853. });
  8854. }
  8855. },
  8856. selectpage: function (form) {
  8857. //绑定selectpage元素事件
  8858. if ($(".selectpage", form).length > 0) {
  8859. require(['selectpage'], function () {
  8860. $('.selectpage', form).selectPage({
  8861. eAjaxSuccess: function (data) {
  8862. data.list = typeof data.rows !== 'undefined' ? data.rows : (typeof data.list !== 'undefined' ? data.list : []);
  8863. data.totalRow = typeof data.total !== 'undefined' ? data.total : (typeof data.totalRow !== 'undefined' ? data.totalRow : data.list.length);
  8864. return data;
  8865. }
  8866. });
  8867. });
  8868. //给隐藏的元素添加上validate验证触发事件
  8869. $(document).on("change", ".sp_hidden", function () {
  8870. $(this).trigger("validate");
  8871. });
  8872. $(document).on("change", ".sp_input", function () {
  8873. $(this).closest(".sp_container").find(".sp_hidden").trigger("change");
  8874. });
  8875. $(form).on("reset", function () {
  8876. setTimeout(function () {
  8877. $('.selectpage', form).selectPageClear();
  8878. }, 1);
  8879. });
  8880. }
  8881. },
  8882. cxselect: function (form) {
  8883. //绑定cxselect元素事件
  8884. if ($("[data-toggle='cxselect']", form).length > 0) {
  8885. require(['cxselect'], function () {
  8886. $.cxSelect.defaults.jsonName = 'name';
  8887. $.cxSelect.defaults.jsonValue = 'value';
  8888. $.cxSelect.defaults.jsonSpace = 'data';
  8889. $("[data-toggle='cxselect']", form).cxSelect();
  8890. });
  8891. }
  8892. },
  8893. citypicker: function (form) {
  8894. //绑定城市远程插件
  8895. if ($("[data-toggle='city-picker']", form).length > 0) {
  8896. require(['citypicker'], function () {
  8897. $(form).on("reset", function () {
  8898. setTimeout(function () {
  8899. $("[data-toggle='city-picker']").citypicker('refresh');
  8900. }, 1);
  8901. });
  8902. });
  8903. }
  8904. },
  8905. datetimepicker: function (form) {
  8906. //绑定日期时间元素事件
  8907. if ($(".datetimepicker", form).length > 0) {
  8908. require(['bootstrap-datetimepicker'], function () {
  8909. var options = {
  8910. format: 'YYYY-MM-DD HH:mm:ss',
  8911. icons: {
  8912. time: 'fa fa-clock-o',
  8913. date: 'fa fa-calendar',
  8914. up: 'fa fa-chevron-up',
  8915. down: 'fa fa-chevron-down',
  8916. previous: 'fa fa-chevron-left',
  8917. next: 'fa fa-chevron-right',
  8918. today: 'fa fa-history',
  8919. clear: 'fa fa-trash',
  8920. close: 'fa fa-remove'
  8921. },
  8922. showTodayButton: true,
  8923. showClose: true
  8924. };
  8925. $('.datetimepicker', form).parent().css('position', 'relative');
  8926. $('.datetimepicker', form).datetimepicker(options).on('dp.change', function (e) {
  8927. $(this, document).trigger("changed");
  8928. });
  8929. });
  8930. }
  8931. },
  8932. daterangepicker: function (form) {
  8933. //绑定日期时间元素事件
  8934. if ($(".datetimerange", form).length > 0) {
  8935. require(['bootstrap-daterangepicker'], function () {
  8936. var ranges = {};
  8937. ranges[__('Today')] = [Moment().startOf('day'), Moment().endOf('day')];
  8938. ranges[__('Yesterday')] = [Moment().subtract(1, 'days').startOf('day'), Moment().subtract(1, 'days').endOf('day')];
  8939. ranges[__('Last 7 Days')] = [Moment().subtract(6, 'days').startOf('day'), Moment().endOf('day')];
  8940. ranges[__('Last 30 Days')] = [Moment().subtract(29, 'days').startOf('day'), Moment().endOf('day')];
  8941. ranges[__('This Month')] = [Moment().startOf('month'), Moment().endOf('month')];
  8942. ranges[__('Last Month')] = [Moment().subtract(1, 'month').startOf('month'), Moment().subtract(1, 'month').endOf('month')];
  8943. var options = {
  8944. timePicker: false,
  8945. autoUpdateInput: false,
  8946. timePickerSeconds: true,
  8947. timePicker24Hour: true,
  8948. autoApply: true,
  8949. locale: {
  8950. format: 'YYYY-MM-DD HH:mm:ss',
  8951. customRangeLabel: __("Custom Range"),
  8952. applyLabel: __("Apply"),
  8953. cancelLabel: __("Clear"),
  8954. },
  8955. ranges: ranges,
  8956. };
  8957. var origincallback = function (start, end) {
  8958. $(this.element).val(start.format(this.locale.format) + " - " + end.format(this.locale.format));
  8959. $(this.element).trigger('blur');
  8960. };
  8961. $(".datetimerange", form).each(function () {
  8962. var callback = typeof $(this).data('callback') == 'function' ? $(this).data('callback') : origincallback;
  8963. $(this).on('apply.daterangepicker', function (ev, picker) {
  8964. callback.call(picker, picker.startDate, picker.endDate);
  8965. });
  8966. $(this).on('cancel.daterangepicker', function (ev, picker) {
  8967. $(this).val('').trigger('blur');
  8968. });
  8969. $(this).daterangepicker($.extend(true, options, $(this).data() || {}, $(this).data("daterangepicker-options") || {}));
  8970. });
  8971. });
  8972. }
  8973. },
  8974. /**
  8975. * 绑定上传事件
  8976. * @param form
  8977. * @deprecated Use faupload instead.
  8978. */
  8979. plupload: function (form) {
  8980. Form.events.faupload(form);
  8981. },
  8982. /**
  8983. * 绑定上传事件
  8984. * @param form
  8985. */
  8986. faupload: function (form) {
  8987. //绑定上传元素事件
  8988. if ($(".plupload,.faupload", form).length > 0) {
  8989. Upload.api.upload($(".plupload,.faupload", form));
  8990. }
  8991. },
  8992. faselect: function (form) {
  8993. //绑定fachoose选择附件事件
  8994. if ($(".faselect,.fachoose", form).length > 0) {
  8995. $(".faselect,.fachoose", form).off('click').on('click', function () {
  8996. var that = this;
  8997. var multiple = $(this).data("multiple") ? $(this).data("multiple") : false;
  8998. var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : '';
  8999. var admin_id = $(this).data("admin-id") ? $(this).data("admin-id") : '';
  9000. var user_id = $(this).data("user-id") ? $(this).data("user-id") : '';
  9001. mimetype = mimetype.replace(/\/\*/ig, '/');
  9002. var url = $(this).data("url") ? $(this).data("url") : (typeof Backend !== 'undefined' ? "general/attachment/select" : "user/attachment");
  9003. parent.Fast.api.open(url + "?element_id=" + $(this).attr("id") + "&multiple=" + multiple + "&mimetype=" + mimetype + "&admin_id=" + admin_id + "&user_id=" + user_id, __('Choose'), {
  9004. callback: function (data) {
  9005. var button = $("#" + $(that).attr("id"));
  9006. var maxcount = $(button).data("maxcount");
  9007. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  9008. maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
  9009. if (input_id && data.multiple) {
  9010. var urlArr = [];
  9011. var inputObj = $("#" + input_id);
  9012. var value = $.trim(inputObj.val());
  9013. if (value !== "") {
  9014. urlArr.push(inputObj.val());
  9015. }
  9016. var nums = value === '' ? 0 : value.split(/\,/).length;
  9017. var files = data.url !== "" ? data.url.split(/\,/) : [];
  9018. $.each(files, function (i, j) {
  9019. var url = Config.upload.fullmode ? Fast.api.cdnurl(j) : j;
  9020. urlArr.push(url);
  9021. });
  9022. if (maxcount > 0) {
  9023. var remains = maxcount - nums;
  9024. if (files.length > remains) {
  9025. Toastr.error(__('You can choose up to %d file%s', remains));
  9026. return false;
  9027. }
  9028. }
  9029. var result = urlArr.join(",");
  9030. inputObj.val(result).trigger("change").trigger("validate");
  9031. } else {
  9032. var url = Config.upload.fullmode ? Fast.api.cdnurl(data.url) : data.url;
  9033. $("#" + input_id).val(url).trigger("change").trigger("validate");
  9034. }
  9035. }
  9036. });
  9037. return false;
  9038. });
  9039. }
  9040. },
  9041. fieldlist: function (form) {
  9042. //绑定fieldlist
  9043. if ($(".fieldlist", form).length > 0) {
  9044. require(['dragsort', 'template'], function (undefined, Template) {
  9045. //刷新隐藏textarea的值
  9046. var refresh = function (container) {
  9047. var data = {};
  9048. var name = container.data("name");
  9049. var textarea = $("textarea[name='" + name + "']", form);
  9050. var template = container.data("template");
  9051. $.each($("input,select,textarea", container).serializeArray(), function (i, j) {
  9052. var reg = /\[(\w+)\]\[(\w+)\]$/g;
  9053. var match = reg.exec(j.name);
  9054. if (!match)
  9055. return true;
  9056. match[1] = "x" + parseInt(match[1]);
  9057. if (typeof data[match[1]] == 'undefined') {
  9058. data[match[1]] = {};
  9059. }
  9060. data[match[1]][match[2]] = j.value;
  9061. });
  9062. var result = template ? [] : {};
  9063. $.each(data, function (i, j) {
  9064. if (j) {
  9065. if (!template) {
  9066. if (j.key != '') {
  9067. result[j.key] = j.value;
  9068. }
  9069. } else {
  9070. result.push(j);
  9071. }
  9072. }
  9073. });
  9074. textarea.val(JSON.stringify(result));
  9075. };
  9076. //追加一行数据
  9077. var append = function (container, row, initial) {
  9078. var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
  9079. var index = container.data("index");
  9080. var name = container.data("name");
  9081. var template = container.data("template");
  9082. var data = container.data();
  9083. index = index ? parseInt(index) : 0;
  9084. container.data("index", index + 1);
  9085. row = row ? row : {};
  9086. row = typeof row.key === 'undefined' || typeof row.value === 'undefined' ? {key: '', value: row} : row;
  9087. var options = container.data("fieldlist-options") || {};
  9088. var vars = {index: index, name: name, data: data, options: options, key: row.key, value: row.value, row: row.value};
  9089. var html = template ? Template(template, vars) : Template.render(Form.config.fieldlisttpl, vars);
  9090. var obj = $(html);
  9091. if ((options.deleteBtn === false || options.removeBtn === false) && initial)
  9092. obj.find(".btn-remove").remove();
  9093. if (options.dragsortBtn === false && initial)
  9094. obj.find(".btn-dragsort").remove();
  9095. if ((options.readonlyKey === true || options.disableKey === true) && initial) {
  9096. obj.find("input[name$='[key]']").prop("readonly", true);
  9097. }
  9098. obj.attr("fieldlist-item", true);
  9099. obj.insertAfter($(tagName + "[fieldlist-item]", container).length > 0 ? $(tagName + "[fieldlist-item]:last", container) : $(tagName + ":first", container));
  9100. if ($(".btn-append,.append", container).length > 0) {
  9101. //兼容旧版本事件
  9102. $(".btn-append,.append", container).trigger("fa.event.appendfieldlist", obj);
  9103. } else {
  9104. //新版本事件
  9105. container.trigger("fa.event.appendfieldlist", obj);
  9106. }
  9107. return obj;
  9108. };
  9109. var fieldlist = $(".fieldlist", form);
  9110. //监听文本框改变事件
  9111. $(document).on('change keyup changed', ".fieldlist input,.fieldlist textarea,.fieldlist select", function () {
  9112. var container = $(this).closest(".fieldlist");
  9113. refresh(container);
  9114. });
  9115. //追加控制(点击按钮)
  9116. fieldlist.on("click", ".btn-append,.append", function (e, row) {
  9117. var container = $(this).closest(".fieldlist");
  9118. append(container, row);
  9119. // refresh(container);
  9120. });
  9121. //移除控制(点击按钮)
  9122. fieldlist.on("click", ".btn-remove", function () {
  9123. var container = $(this).closest(".fieldlist");
  9124. var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
  9125. $(this).closest(tagName).remove();
  9126. refresh(container);
  9127. });
  9128. //追加控制(通过事件)
  9129. fieldlist.on("fa.event.appendtofieldlist", function (e, row) {
  9130. var container = $(this);
  9131. append(container, row);
  9132. refresh(container);
  9133. });
  9134. //根据textarea内容重新渲染
  9135. fieldlist.on("fa.event.refreshfieldlist", function () {
  9136. var container = $(this);
  9137. var textarea = $("textarea[name='" + container.data("name") + "']", form);
  9138. //先清空已有的数据
  9139. $("[fieldlist-item]", container).remove();
  9140. var json = {};
  9141. try {
  9142. json = JSON.parse(textarea.val());
  9143. } catch (e) {
  9144. }
  9145. $.each(json, function (i, j) {
  9146. append(container, {key: i, value: j}, true);
  9147. });
  9148. });
  9149. //拖拽排序
  9150. fieldlist.each(function () {
  9151. var container = $(this);
  9152. var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
  9153. container.dragsort({
  9154. itemSelector: tagName,
  9155. dragSelector: ".btn-dragsort",
  9156. dragEnd: function () {
  9157. refresh(container);
  9158. },
  9159. placeHolderTemplate: $("<" + tagName + "/>")
  9160. });
  9161. if (typeof container.data("options") === 'object' && container.data("options").appendBtn === false) {
  9162. $(".btn-append,.append", container).hide();
  9163. }
  9164. $("textarea[name='" + container.data("name") + "']", form).on("fa.event.refreshfieldlist", function () {
  9165. //兼容旧版本事件
  9166. $(this).closest(".fieldlist").trigger("fa.event.refreshfieldlist");
  9167. });
  9168. });
  9169. fieldlist.trigger("fa.event.refreshfieldlist");
  9170. });
  9171. }
  9172. },
  9173. switcher: function (form) {
  9174. form.on("click", "[data-toggle='switcher']", function () {
  9175. if ($(this).hasClass("disabled")) {
  9176. return false;
  9177. }
  9178. var switcher = $.proxy(function () {
  9179. var input = $(this).prev("input");
  9180. input = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : input;
  9181. if (input.length > 0) {
  9182. var yes = $(this).data("yes");
  9183. var no = $(this).data("no");
  9184. if (input.val() == yes) {
  9185. input.val(no);
  9186. $("i", this).addClass("fa-flip-horizontal text-gray");
  9187. } else {
  9188. input.val(yes);
  9189. $("i", this).removeClass("fa-flip-horizontal text-gray");
  9190. }
  9191. input.trigger('change');
  9192. }
  9193. }, this);
  9194. if (typeof $(this).data("confirm") !== 'undefined') {
  9195. Layer.confirm($(this).data("confirm"), function (index) {
  9196. switcher();
  9197. Layer.close(index);
  9198. });
  9199. } else {
  9200. switcher();
  9201. }
  9202. return false;
  9203. });
  9204. },
  9205. bindevent: function (form) {
  9206. },
  9207. slider: function (form) {
  9208. if ($(".slider", form).length > 0) {
  9209. require(['bootstrap-slider'], function () {
  9210. $('.slider').removeClass('hidden').css('width', function (index, value) {
  9211. return $(this).parents('.form-control').width();
  9212. }).slider().on('slide', function (ev) {
  9213. var data = $(this).data();
  9214. if (typeof data.unit !== 'undefined') {
  9215. $(this).parents('.form-control').siblings('.value').text(ev.value + data.unit);
  9216. }
  9217. });
  9218. });
  9219. }
  9220. },
  9221. tagsinput: function (form) {
  9222. if ($("[data-role='tagsinput']", form).length > 0) {
  9223. require(['tagsinput', 'autocomplete'], function () {
  9224. $("[data-role='tagsinput']").tagsinput();
  9225. });
  9226. }
  9227. },
  9228. autocomplete: function (form) {
  9229. if ($("[data-role='autocomplete']", form).length > 0) {
  9230. require(['autocomplete'], function () {
  9231. $("[data-role='autocomplete']").autocomplete();
  9232. });
  9233. }
  9234. },
  9235. favisible: function (form) {
  9236. if ($("[data-favisible]", form).length == 0) {
  9237. return;
  9238. }
  9239. var checkCondition = function (condition) {
  9240. var conditionArr = condition.split(/&&/);
  9241. var success = 0;
  9242. var baseregex = /^([a-z0-9\_]+)([>|<|=|\!]=?)(.*)$/i, strregex = /^('|")(.*)('|")$/, regregex = /^regex:(.*)$/;
  9243. // @formatter:off
  9244. var operator_result = {
  9245. '>': function(a, b) { return a > b; },
  9246. '>=': function(a, b) { return a >= b; },
  9247. '<': function(a, b) { return a < b; },
  9248. '<=': function(a, b) { return a <= b; },
  9249. '==': function(a, b) { return a == b; },
  9250. '!=': function(a, b) { return a != b; },
  9251. 'in': function(a, b) { return b.split(/\,/).indexOf(a) > -1; },
  9252. 'regex': function(a, b) {
  9253. var regParts = b.match(/^\/(.*?)\/([gim]*)$/);
  9254. var regexp = regParts ? new RegExp(regParts[1], regParts[2]) : new RegExp(b);
  9255. return regexp.test(a);
  9256. }
  9257. };
  9258. // @formatter:on
  9259. var dataArr = form.serializeArray(), dataObj = {}, fieldName, fieldValue;
  9260. $(dataArr).each(function (i, field) {
  9261. fieldName = field.name;
  9262. fieldValue = field.value;
  9263. fieldName = fieldName.substr(-2) === '[]' ? fieldName.substr(0, fieldName.length - 2) : fieldName;
  9264. dataObj[fieldName] = typeof dataObj[fieldName] !== 'undefined' ? [dataObj[fieldName], fieldValue].join(',') : fieldValue;
  9265. });
  9266. $.each(conditionArr, function (i, item) {
  9267. var basematches = baseregex.exec(item);
  9268. if (basematches) {
  9269. var name = basematches[1], operator = basematches[2], value = basematches[3].toString();
  9270. if (operator === '=') {
  9271. var strmatches = strregex.exec(value);
  9272. operator = strmatches ? '==' : 'in';
  9273. value = strmatches ? strmatches[2] : value;
  9274. }
  9275. var regmatches = regregex.exec(value);
  9276. if (regmatches) {
  9277. operator = 'regex';
  9278. value = regmatches[1];
  9279. }
  9280. var chkname = "row[" + name + "]";
  9281. if (typeof dataObj[chkname] === 'undefined') {
  9282. return false;
  9283. }
  9284. var objvalue = dataObj[chkname];
  9285. if ($.isArray(objvalue)) {
  9286. objvalue = dataObj[chkname].join(",");
  9287. }
  9288. if (['>', '>=', '<', '<='].indexOf(operator) > -1) {
  9289. objvalue = parseFloat(objvalue);
  9290. value = parseFloat(value);
  9291. }
  9292. var result = operator_result[operator](objvalue, value);
  9293. success += (result ? 1 : 0);
  9294. }
  9295. });
  9296. return success === conditionArr.length;
  9297. };
  9298. form.on("keyup change click configchange", "input,select", function () {
  9299. $("[data-favisible][data-favisible!='']", form).each(function () {
  9300. var visible = $(this).data("favisible");
  9301. var groupArr = visible.split(/\|\|/);
  9302. var success = 0;
  9303. $.each(groupArr, function (i, j) {
  9304. if (checkCondition(j)) {
  9305. success++;
  9306. }
  9307. });
  9308. if (success > 0) {
  9309. $(this).removeClass("hidden");
  9310. } else {
  9311. $(this).addClass("hidden");
  9312. }
  9313. });
  9314. });
  9315. //追加上忽略元素
  9316. setTimeout(function () {
  9317. form.data('validator').options.ignore += ((form.data('validator').options.ignore ? ',' : '') + '[data-favisible] :hidden,[data-favisible]:hidden');
  9318. }, 0);
  9319. $("input,select", form).trigger("configchange");
  9320. }
  9321. },
  9322. api: {
  9323. submit: function (form, success, error, submit) {
  9324. if (form.length === 0) {
  9325. Toastr.error("表单未初始化完成,无法提交");
  9326. return false;
  9327. }
  9328. if (typeof submit === 'function') {
  9329. if (false === submit.call(form, success, error)) {
  9330. return false;
  9331. }
  9332. }
  9333. var type = form.attr("method") ? form.attr("method").toUpperCase() : 'GET';
  9334. type = type && (type === 'GET' || type === 'POST') ? type : 'GET';
  9335. url = form.attr("action");
  9336. url = url ? url : location.href;
  9337. //修复当存在多选项元素时提交的BUG
  9338. var params = {};
  9339. var multipleList = $("[name$='[]']", form);
  9340. if (multipleList.length > 0) {
  9341. var postFields = form.serializeArray().map(function (obj) {
  9342. return $(obj).prop("name");
  9343. });
  9344. $.each(multipleList, function (i, j) {
  9345. if (postFields.indexOf($(this).prop("name")) < 0) {
  9346. params[$(this).prop("name")] = '';
  9347. }
  9348. });
  9349. }
  9350. //调用Ajax请求方法
  9351. Fast.api.ajax({
  9352. type: type,
  9353. url: url,
  9354. data: form.serialize() + (Object.keys(params).length > 0 ? '&' + $.param(params) : ''),
  9355. dataType: 'json',
  9356. complete: function (xhr) {
  9357. var token = xhr.getResponseHeader('__token__');
  9358. if (token) {
  9359. $("input[name='__token__']").val(token);
  9360. }
  9361. }
  9362. }, function (data, ret) {
  9363. $('.form-group', form).removeClass('has-feedback has-success has-error');
  9364. if (data && typeof data === 'object') {
  9365. //刷新客户端token
  9366. if (typeof data.token !== 'undefined') {
  9367. $("input[name='__token__']").val(data.token);
  9368. }
  9369. //调用客户端事件
  9370. if (typeof data.callback !== 'undefined' && typeof data.callback === 'function') {
  9371. data.callback.call(form, data);
  9372. }
  9373. }
  9374. if (typeof success === 'function') {
  9375. if (false === success.call(form, data, ret)) {
  9376. return false;
  9377. }
  9378. }
  9379. }, function (data, ret) {
  9380. if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
  9381. $("input[name='__token__']").val(data.token);
  9382. }
  9383. if (typeof error === 'function') {
  9384. if (false === error.call(form, data, ret)) {
  9385. return false;
  9386. }
  9387. }
  9388. });
  9389. return true;
  9390. },
  9391. bindevent: function (form, success, error, submit) {
  9392. form = typeof form === 'object' ? form : $(form);
  9393. var events = Form.events;
  9394. events.bindevent(form);
  9395. events.validator(form, success, error, submit);
  9396. events.selectpicker(form);
  9397. events.daterangepicker(form);
  9398. events.selectpage(form);
  9399. events.cxselect(form);
  9400. events.citypicker(form);
  9401. events.datetimepicker(form);
  9402. events.faupload(form);
  9403. events.faselect(form);
  9404. events.fieldlist(form);
  9405. events.slider(form);
  9406. events.switcher(form);
  9407. events.tagsinput(form);
  9408. events.autocomplete(form);
  9409. events.favisible(form);
  9410. },
  9411. custom: {}
  9412. },
  9413. };
  9414. return Form;
  9415. });
  9416. /**
  9417. * FastAdmin通用搜索
  9418. *
  9419. * @author: pppscn <35696959@qq.com>
  9420. * @update 2017-05-07 <https://gitee.com/pp/fastadmin>
  9421. *
  9422. * @author: Karson <karson@fastadmin.net>
  9423. * @update 2018-04-05 <https://gitee.com/karson/fastadmin>
  9424. */
  9425. !function ($) {
  9426. 'use strict';
  9427. var ColumnsForSearch = [];
  9428. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  9429. var initCommonSearch = function (pColumns, that) {
  9430. var vFormCommon = createFormCommon(pColumns, that);
  9431. var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden");
  9432. vModal += vFormCommon;
  9433. vModal += "</div>";
  9434. that.$container.prepend($(vModal));
  9435. that.$commonsearch = $(".commonsearch-table", that.$container);
  9436. var form = $("form.form-commonsearch", that.$commonsearch);
  9437. require(['form'], function (Form) {
  9438. Form.api.bindevent(form);
  9439. form.validator("destroy");
  9440. });
  9441. // 表单提交
  9442. form.on("submit", function (event) {
  9443. event.preventDefault();
  9444. that.onCommonSearch();
  9445. return false;
  9446. });
  9447. // 重置搜索
  9448. form.on("click", "button[type=reset]", function (event) {
  9449. form[0].reset();
  9450. setTimeout(function () {
  9451. that.onCommonSearch();
  9452. }, 0);
  9453. });
  9454. };
  9455. var createFormCommon = function (pColumns, that) {
  9456. // 如果有使用模板则直接返回模板的内容
  9457. if (that.options.searchFormTemplate) {
  9458. return Template(that.options.searchFormTemplate, {columns: pColumns, table: that});
  9459. }
  9460. var htmlForm = [];
  9461. htmlForm.push(sprintf('<form class="form-horizontal form-commonsearch" novalidate method="post" action="%s" >', that.options.actionForm));
  9462. htmlForm.push('<fieldset>');
  9463. if (that.options.titleForm.length > 0)
  9464. htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
  9465. htmlForm.push('<div class="row">');
  9466. for (var i in pColumns) {
  9467. var vObjCol = pColumns[i];
  9468. if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
  9469. var query = Fast.api.query(vObjCol.field);
  9470. var operate = Fast.api.query(vObjCol.field + "-operate");
  9471. var renderDefault = that.options.renderDefault && (typeof vObjCol.renderDefault == 'undefined' || vObjCol.renderDefault);
  9472. vObjCol.defaultValue = renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue);
  9473. vObjCol.operate = renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate);
  9474. ColumnsForSearch.push(vObjCol);
  9475. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  9476. htmlForm.push(sprintf('<label for="%s" class="control-label col-xs-4">%s</label>', vObjCol.field, vObjCol.title));
  9477. htmlForm.push('<div class="col-xs-8">');
  9478. vObjCol.operate = vObjCol.operate ? vObjCol.operate.toUpperCase() : '=';
  9479. 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));
  9480. var addClass = typeof vObjCol.addClass === 'undefined' ? (typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass) : 'form-control ' + vObjCol.addClass;
  9481. var extend = typeof vObjCol.extend === 'undefined' ? '' : vObjCol.extend;
  9482. var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style);
  9483. extend = typeof vObjCol.data !== 'undefined' && extend == '' ? vObjCol.data : extend;
  9484. extend = typeof vObjCol.autocomplete !== 'undefined' ? extend + ' autocomplete="' + (vObjCol.autocomplete === false || vObjCol.autocomplete === 'off' ? 'off' : 'on') + '"' : extend;
  9485. if (vObjCol.searchList) {
  9486. if (typeof vObjCol.searchList === 'function') {
  9487. htmlForm.push(vObjCol.searchList.call(this, vObjCol));
  9488. } else {
  9489. var optionList = [sprintf('<option value="">%s</option>', that.options.formatCommonChoose())];
  9490. if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') {
  9491. (function (vObjCol, that) {
  9492. $.when(vObjCol.searchList).done(function (ret) {
  9493. var searchList = [];
  9494. if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) {
  9495. searchList = ret.data.searchlist;
  9496. } else if (ret.constructor === Array || ret.constructor === Object) {
  9497. searchList = ret;
  9498. }
  9499. var optionList = createOptionList(searchList, vObjCol, that);
  9500. $("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).html(optionList.join('')).trigger("change");
  9501. });
  9502. })(vObjCol, that);
  9503. } else {
  9504. optionList = createOptionList(vObjCol.searchList, vObjCol, that);
  9505. }
  9506. htmlForm.push(sprintf('<select class="%s" name="%s" %s %s>%s</select>', addClass, vObjCol.field, style, extend, optionList.join('')));
  9507. }
  9508. } else {
  9509. var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder;
  9510. var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type;
  9511. var defaultValue = typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue;
  9512. if (/BETWEEN$/.test(vObjCol.operate)) {
  9513. var defaultValueArr = defaultValue.toString().match(/\|/) ? defaultValue.split('|') : ['', ''];
  9514. var placeholderArr = placeholder.toString().match(/\|/) ? placeholder.split('|') : [placeholder, placeholder];
  9515. htmlForm.push('<div class="row row-between">');
  9516. 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));
  9517. 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));
  9518. htmlForm.push('</div>');
  9519. } else {
  9520. 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));
  9521. }
  9522. }
  9523. htmlForm.push('</div>');
  9524. htmlForm.push('</div>');
  9525. }
  9526. }
  9527. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  9528. htmlForm.push(createFormBtn(that).join(''));
  9529. htmlForm.push('</div>');
  9530. htmlForm.push('</div>');
  9531. htmlForm.push('</fieldset>');
  9532. htmlForm.push('</form>');
  9533. return htmlForm.join('');
  9534. };
  9535. var createFormBtn = function (that) {
  9536. var htmlBtn = [];
  9537. var searchSubmit = that.options.formatCommonSubmitButton();
  9538. var searchReset = that.options.formatCommonResetButton();
  9539. htmlBtn.push('<div class="col-sm-8 col-xs-offset-4">');
  9540. htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" formnovalidate>%s</button> ', searchSubmit));
  9541. htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
  9542. htmlBtn.push('</div>');
  9543. return htmlBtn;
  9544. };
  9545. var createOptionList = function (searchList, vObjCol, that) {
  9546. var isArray = searchList.constructor === Array;
  9547. var optionList = [];
  9548. optionList.push(sprintf('<option value="">%s</option>', that.options.formatCommonChoose()));
  9549. $.each(searchList, function (key, value) {
  9550. if (value.constructor === Object) {
  9551. key = value.id;
  9552. value = value.name;
  9553. } else {
  9554. key = isArray ? value : key;
  9555. }
  9556. optionList.push(sprintf("<option value='" + key + "' %s>" + value + "</option>", key == vObjCol.defaultValue ? 'selected' : ''));
  9557. });
  9558. return optionList;
  9559. };
  9560. var isSearchAvailble = function (that) {
  9561. //只支持服务端搜索
  9562. if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) {
  9563. return false;
  9564. }
  9565. return true;
  9566. };
  9567. var getSearchQuery = function (that, removeempty) {
  9568. var op = {};
  9569. var filter = {};
  9570. var value = '';
  9571. $("form.form-commonsearch .operate", that.$commonsearch).each(function (i) {
  9572. var name = $(this).data("name");
  9573. var sym = $(this).is("select") ? $("option:selected", this).val() : $(this).val().toUpperCase();
  9574. var obj = $("[name='" + name + "']", that.$commonsearch);
  9575. if (obj.length == 0)
  9576. return true;
  9577. var vObjCol = ColumnsForSearch[i];
  9578. var process = !that.options.searchFormTemplate && vObjCol && typeof vObjCol.process == 'function' ? vObjCol.process : null;
  9579. if (obj.length > 1) {
  9580. if (/BETWEEN$/.test(sym)) {
  9581. var value_begin = $.trim($("[name='" + name + "']:first", that.$commonsearch).val()),
  9582. value_end = $.trim($("[name='" + name + "']:last", that.$commonsearch).val());
  9583. if (value_begin.length || value_end.length) {
  9584. if (process) {
  9585. value_begin = process(value_begin, 'begin');
  9586. value_end = process(value_end, 'end');
  9587. }
  9588. value = value_begin + ',' + value_end;
  9589. } else {
  9590. value = '';
  9591. }
  9592. //如果是时间筛选,将operate置为RANGE
  9593. if ($("[name='" + name + "']:first", that.$commonsearch).hasClass("datetimepicker")) {
  9594. sym = 'RANGE';
  9595. }
  9596. } else {
  9597. value = $("[name='" + name + "']:checked", that.$commonsearch).val();
  9598. value = process ? process(value) : value;
  9599. }
  9600. } else {
  9601. value = process ? process(obj.val()) : obj.val();
  9602. }
  9603. if (removeempty && (value == '' || value == null || ($.isArray(value) && value.length == 0)) && !sym.match(/null/i)) {
  9604. return true;
  9605. }
  9606. op[name] = sym;
  9607. filter[name] = value;
  9608. });
  9609. return {op: op, filter: filter};
  9610. };
  9611. var getQueryParams = function (params, searchQuery, removeempty) {
  9612. params.filter = typeof params.filter === 'Object' ? params.filter : (params.filter ? JSON.parse(params.filter) : {});
  9613. params.op = typeof params.op === 'Object' ? params.op : (params.op ? JSON.parse(params.op) : {});
  9614. params.filter = $.extend({}, params.filter, searchQuery.filter);
  9615. params.op = $.extend({}, params.op, searchQuery.op);
  9616. //移除empty的值
  9617. if (removeempty) {
  9618. $.each(params.filter, function (i, j) {
  9619. if ((j == '' || j == null || ($.isArray(j) && j.length == 0)) && !params.op[i].match(/null/i)) {
  9620. delete params.filter[i];
  9621. delete params.op[i];
  9622. }
  9623. });
  9624. }
  9625. params.filter = JSON.stringify(params.filter);
  9626. params.op = JSON.stringify(params.op);
  9627. return params;
  9628. };
  9629. $.extend($.fn.bootstrapTable.defaults, {
  9630. commonSearch: false,
  9631. titleForm: "Common search",
  9632. actionForm: "",
  9633. searchFormTemplate: "",
  9634. searchFormVisible: true,
  9635. searchClass: 'searchit',
  9636. showSearch: true,
  9637. renderDefault: true,
  9638. onCommonSearch: function (field, text) {
  9639. return false;
  9640. },
  9641. onPostCommonSearch: function (table) {
  9642. return false;
  9643. }
  9644. });
  9645. $.extend($.fn.bootstrapTable.defaults.icons, {
  9646. commonSearchIcon: 'glyphicon-search'
  9647. });
  9648. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  9649. 'common-search.bs.table': 'onCommonSearch',
  9650. 'post-common-search.bs.table': 'onPostCommonSearch'
  9651. });
  9652. $.extend($.fn.bootstrapTable.locales[$.fn.bootstrapTable.defaults.locale], {
  9653. formatCommonSearch: function () {
  9654. return "Common search";
  9655. },
  9656. formatCommonSubmitButton: function () {
  9657. return "Submit";
  9658. },
  9659. formatCommonResetButton: function () {
  9660. return "Reset";
  9661. },
  9662. formatCommonCloseButton: function () {
  9663. return "Close";
  9664. },
  9665. formatCommonChoose: function () {
  9666. return "Choose";
  9667. }
  9668. });
  9669. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  9670. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9671. _initHeader = BootstrapTable.prototype.initHeader,
  9672. _initToolbar = BootstrapTable.prototype.initToolbar,
  9673. _load = BootstrapTable.prototype.load,
  9674. _initSearch = BootstrapTable.prototype.initSearch;
  9675. BootstrapTable.prototype.initHeader = function () {
  9676. _initHeader.apply(this, Array.prototype.slice.apply(arguments));
  9677. this.$header.find('th[data-field]').each(function (i) {
  9678. var column = $(this).data();
  9679. if (typeof column['width'] !== 'undefined' && column['width'].toString().indexOf("%") === -1) {
  9680. $(".th-inner", this).outerWidth(column['width']);
  9681. $(this).css("max-width", column['width']);
  9682. }
  9683. });
  9684. this.options.stateField = this.header.stateField;
  9685. };
  9686. BootstrapTable.prototype.initToolbar = function () {
  9687. _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
  9688. if (!isSearchAvailble(this)) {
  9689. return;
  9690. }
  9691. var that = this,
  9692. html = [];
  9693. if (that.options.showSearch) {
  9694. html.push(sprintf('<div class="columns-%s pull-%s" style="margin-top:10px;margin-bottom:10px;">', this.options.buttonsAlign, this.options.buttonsAlign));
  9695. 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()));
  9696. html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.commonSearchIcon))
  9697. html.push('</button></div>');
  9698. }
  9699. if (that.$toolbar.find(".pull-right").length > 0) {
  9700. $(html.join('')).insertBefore(that.$toolbar.find(".pull-right:first"));
  9701. } else {
  9702. that.$toolbar.append(html.join(''));
  9703. }
  9704. initCommonSearch(that.columns, that);
  9705. that.$toolbar.find('button[name="commonSearch"]')
  9706. .off('click').on('click', function () {
  9707. that.$commonsearch.toggleClass("hidden");
  9708. return;
  9709. });
  9710. that.$container.on("click", "." + that.options.searchClass, function () {
  9711. var value = $(this).data("value");
  9712. var field = $(this).data("field");
  9713. var ul = that.$container.closest(".panel-intro").find("ul[data-field='" + field + "']");
  9714. if (ul.length > 0) {
  9715. $('li a[data-value="' + value + '"][data-toggle="tab"]', ul).trigger('click');
  9716. return;
  9717. }
  9718. var obj = $("form [name='" + field + "']", that.$commonsearch);
  9719. if (obj.length > 0) {
  9720. if (obj.is("select")) {
  9721. $("option[value='" + value + "']", obj).prop("selected", true);
  9722. } else if (obj.length > 1) {
  9723. $("form [name='" + field + "'][value='" + value + "']", that.$commonsearch).prop("checked", true);
  9724. } else {
  9725. obj.val(value + "");
  9726. }
  9727. obj.trigger("change");
  9728. $("form", that.$commonsearch).trigger("submit");
  9729. }
  9730. });
  9731. var queryParams = that.options.queryParams;
  9732. //匹配默认搜索值
  9733. this.options.queryParams = function (params) {
  9734. return queryParams(getQueryParams(params, getSearchQuery(that, true)));
  9735. };
  9736. this.trigger('post-common-search', that);
  9737. };
  9738. BootstrapTable.prototype.onCommonSearch = function () {
  9739. var searchQuery = getSearchQuery(this);
  9740. this.trigger('common-search', this, searchQuery);
  9741. this.options.pageNumber = 1;
  9742. //this.options.pageSize = $.fn.bootstrapTable.defaults.pageSize;
  9743. this.refresh({});
  9744. };
  9745. BootstrapTable.prototype.load = function (data) {
  9746. _load.apply(this, Array.prototype.slice.apply(arguments));
  9747. if (!isSearchAvailble(this)) {
  9748. return;
  9749. }
  9750. };
  9751. BootstrapTable.prototype.initSearch = function () {
  9752. _initSearch.apply(this, Array.prototype.slice.apply(arguments));
  9753. if (!isSearchAvailble(this)) {
  9754. return;
  9755. }
  9756. var that = this;
  9757. var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
  9758. this.data = fp ? $.grep(this.data, function (item, i) {
  9759. for (var key in fp) {
  9760. var fval = fp[key].toLowerCase();
  9761. var value = item[key];
  9762. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
  9763. that.header.formatters[$.inArray(key, that.header.fields)],
  9764. [value, item, i], value);
  9765. if (!($.inArray(key, that.header.fields) !== -1 &&
  9766. (typeof value === 'string' || typeof value === 'number') &&
  9767. (value + '').toLowerCase().indexOf(fval) !== -1)) {
  9768. return false;
  9769. }
  9770. }
  9771. return true;
  9772. }) : this.data;
  9773. };
  9774. }(jQuery);
  9775. define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) {
  9776. return function () {
  9777. var ret, fn;
  9778. return ret || global.$.fn.bootstrapTable.defaults;
  9779. };
  9780. }(this)));
  9781. /**
  9782. * 将BootstrapTable的行使用自定义的模板来渲染
  9783. *
  9784. * @author: karson
  9785. * @version: v0.0.1
  9786. *
  9787. * @update 2017-06-24 <http://github.com/karsonzhang/fastadmin>
  9788. */
  9789. !function ($) {
  9790. 'use strict';
  9791. $.extend($.fn.bootstrapTable.defaults, {
  9792. //是否启用模板渲染
  9793. templateView: false,
  9794. //数据格式化的模板ID或格式函数
  9795. templateFormatter: "itemtpl",
  9796. //添加的父类的class
  9797. templateParentClass: "row row-flex",
  9798. //向table添加的class
  9799. templateTableClass: "table-template",
  9800. });
  9801. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9802. _initContainer = BootstrapTable.prototype.initContainer,
  9803. _initBody = BootstrapTable.prototype.initBody,
  9804. _initRow = BootstrapTable.prototype.initRow;
  9805. BootstrapTable.prototype.initContainer = function () {
  9806. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  9807. var that = this;
  9808. if (!that.options.templateView) {
  9809. return;
  9810. }
  9811. that.options.cardView = true;
  9812. };
  9813. BootstrapTable.prototype.initBody = function () {
  9814. var that = this;
  9815. $.extend(that.options, {
  9816. showHeader: !that.options.templateView ? $.fn.bootstrapTable.defaults.showHeader : false,
  9817. showFooter: !that.options.templateView ? $.fn.bootstrapTable.defaults.showFooter : false,
  9818. });
  9819. $(that.$el).toggleClass(that.options.templateTableClass, that.options.templateView);
  9820. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  9821. if (!that.options.templateView) {
  9822. return;
  9823. } else {
  9824. //由于Bootstrap是基于Table的,添加一个父类容器
  9825. $("> *:not(.no-records-found)", that.$body).wrapAll($("<div />").addClass(that.options.templateParentClass));
  9826. }
  9827. };
  9828. BootstrapTable.prototype.initRow = function (item, i, data, parentDom) {
  9829. var that = this;
  9830. //如果未启用则使用原生的initRow方法
  9831. if (!that.options.templateView) {
  9832. return _initRow.apply(that, Array.prototype.slice.apply(arguments));
  9833. }
  9834. var $content = '';
  9835. if (typeof that.options.templateFormatter === 'function') {
  9836. $content = that.options.templateFormatter.call(that, item, i, data);
  9837. } else {
  9838. var Template = require('template');
  9839. $content = Template(that.options.templateFormatter, {item: item, i: i, data: data});
  9840. }
  9841. return $content;
  9842. };
  9843. }(jQuery);
  9844. define("bootstrap-table-template", ["bootstrap-table","template"], (function (global) {
  9845. return function () {
  9846. var ret, fn;
  9847. return ret || global.$.fn.bootstrapTable.defaults;
  9848. };
  9849. }(this)));
  9850. /**
  9851. * @author Jay <jwang@dizsoft.com>
  9852. */
  9853. (function ($) {
  9854. 'use strict';
  9855. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  9856. $.extend($.fn.bootstrapTable.defaults, {
  9857. showJumpto: false,
  9858. exportOptions: {}
  9859. });
  9860. $.extend($.fn.bootstrapTable.locales, {
  9861. formatJumpto: function () {
  9862. return 'GO';
  9863. }
  9864. });
  9865. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  9866. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9867. _initPagination = BootstrapTable.prototype.initPagination;
  9868. BootstrapTable.prototype.initPagination = function () {
  9869. this.showToolbar = this.options.showExport;
  9870. _initPagination.apply(this, Array.prototype.slice.apply(arguments));
  9871. if (this.options.showJumpto) {
  9872. var that = this,
  9873. $pageGroup = this.$pagination.find('ul.pagination'),
  9874. $jumpto = $pageGroup.find('li.jumpto');
  9875. if (!$jumpto.length) {
  9876. $jumpto = $([
  9877. '<li class="jumpto">',
  9878. '<input type="text" class="form-control">',
  9879. '<button class="btn' +
  9880. sprintf(' btn-%s', this.options.buttonsClass) +
  9881. sprintf(' btn-%s', this.options.iconSize) +
  9882. '" title="' + this.options.formatJumpto() + '" ' +
  9883. ' type="button">'+this.options.formatJumpto(),
  9884. '</button>',
  9885. '</li>'].join('')).appendTo($pageGroup);
  9886. $jumpto.find('button').click(function () {
  9887. that.selectPage(parseInt($jumpto.find('input').val()));
  9888. });
  9889. }
  9890. }
  9891. };
  9892. })(jQuery);
  9893. define("bootstrap-table-jumpto", ["bootstrap-table"], (function (global) {
  9894. return function () {
  9895. var ret, fn;
  9896. return ret || global.$.fn.bootstrapTable.defaults;
  9897. };
  9898. }(this)));
  9899. (function ($) {
  9900. 'use strict';
  9901. // Reasonable defaults
  9902. var PIXEL_STEP = 10;
  9903. var LINE_HEIGHT = 40;
  9904. var PAGE_HEIGHT = 800;
  9905. function normalizeWheel(event) {
  9906. var sX = 0; // spinX
  9907. var sY = 0; // spinY
  9908. var pX = 0; // pixelX
  9909. var pY = 0; // pixelY
  9910. // Legacy
  9911. if ('detail' in event) {
  9912. sY = event.detail;
  9913. }
  9914. if ('wheelDelta' in event) {
  9915. sY = -event.wheelDelta / 120;
  9916. }
  9917. if ('wheelDeltaY' in event) {
  9918. sY = -event.wheelDeltaY / 120;
  9919. }
  9920. if ('wheelDeltaX' in event) {
  9921. sX = -event.wheelDeltaX / 120;
  9922. }
  9923. // side scrolling on FF with DOMMouseScroll
  9924. if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {
  9925. sX = sY;
  9926. sY = 0;
  9927. }
  9928. pX = sX * PIXEL_STEP;
  9929. pY = sY * PIXEL_STEP;
  9930. if ('deltaY' in event) {
  9931. pY = event.deltaY;
  9932. }
  9933. if ('deltaX' in event) {
  9934. pX = event.deltaX;
  9935. }
  9936. if ((pX || pY) && event.deltaMode) {
  9937. if (event.deltaMode === 1) {
  9938. // delta in LINE units
  9939. pX *= LINE_HEIGHT;
  9940. pY *= LINE_HEIGHT;
  9941. } else {
  9942. // delta in PAGE units
  9943. pX *= PAGE_HEIGHT;
  9944. pY *= PAGE_HEIGHT;
  9945. }
  9946. }
  9947. // Fall-back if spin cannot be determined
  9948. if (pX && !sX) {
  9949. sX = pX < 1 ? -1 : 1;
  9950. }
  9951. if (pY && !sY) {
  9952. sY = pY < 1 ? -1 : 1;
  9953. }
  9954. return {
  9955. spinX: sX,
  9956. spinY: sY,
  9957. pixelX: pX,
  9958. pixelY: pY
  9959. };
  9960. }
  9961. var cachedWidth = null;
  9962. var getScrollBarWidth = function getScrollBarWidth() {
  9963. if (cachedWidth === null) {
  9964. var inner = $('<p/>').addClass('fixed-table-scroll-inner'),
  9965. outer = $('<div/>').addClass('fixed-table-scroll-outer'),
  9966. w1 = void 0,
  9967. w2 = void 0;
  9968. outer.append(inner);
  9969. $('body').append(outer);
  9970. w1 = inner[0].offsetWidth;
  9971. outer.css('overflow', 'scroll');
  9972. w2 = inner[0].offsetWidth;
  9973. if (w1 === w2) {
  9974. w2 = outer[0].clientWidth;
  9975. }
  9976. outer.remove();
  9977. cachedWidth = w1 - w2;
  9978. }
  9979. return cachedWidth;
  9980. };
  9981. //获取原本表格体的滑块宽度
  9982. var getTableBodyScrollBarWidth = function getTableBodyScrollBarWidth(tableBody) {
  9983. return tableBody[0].scrollHeight > tableBody[0].clientHeight ? 15 : 0;
  9984. };
  9985. $.extend($.fn.bootstrapTable.defaults, {
  9986. fixedColumns: false,
  9987. fixedNumber: 0,
  9988. fixedRightNumber: 0
  9989. });
  9990. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9991. _initBody = BootstrapTable.prototype.initBody,
  9992. _initContainer = BootstrapTable.prototype.initContainer,
  9993. _trigger = BootstrapTable.prototype.trigger,
  9994. _hideLoading = BootstrapTable.prototype.hideLoading,
  9995. _updateSelected = BootstrapTable.prototype.updateSelected;
  9996. BootstrapTable.prototype.fixedColumnsSupported = function () {
  9997. var that = this;
  9998. return that.options.fixedColumns && !that.options.detailView && !that.options.cardView;
  9999. };
  10000. BootstrapTable.prototype.initFixedContainer = function () {
  10001. if (!this.fixedColumnsSupported()) {
  10002. return;
  10003. }
  10004. if (this.options.fixedNumber) {
  10005. this.$tableContainer.find('.fixed-columns').size() == 0 && this.$tableContainer.append('<div class="fixed-columns"></div>');
  10006. this.$fixedColumns = this.$tableContainer.find('.fixed-columns');
  10007. }
  10008. if (this.options.fixedRightNumber) {
  10009. this.$tableContainer.find('.fixed-columns-right').size() == 0 && this.$tableContainer.append('<div class="fixed-columns-right"></div>');
  10010. this.$fixedColumnsRight = this.$tableContainer.find('.fixed-columns-right');
  10011. }
  10012. };
  10013. BootstrapTable.prototype.initContainer = function () {
  10014. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  10015. this.initFixedContainer();
  10016. };
  10017. BootstrapTable.prototype.initBody = function () {
  10018. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  10019. if (!this.fixedColumnsSupported()) {
  10020. return;
  10021. }
  10022. if (this.options.showHeader && this.options.height) {
  10023. return;
  10024. }
  10025. this.initFixedColumnsBody();
  10026. this.initFixedColumnsEvents();
  10027. };
  10028. BootstrapTable.prototype.trigger = function () {
  10029. var that = this;
  10030. _trigger.apply(this, Array.prototype.slice.apply(arguments));
  10031. if (arguments[0] === 'pre-body') {
  10032. //如果上来就是cardView 设置表格高度为auto
  10033. if (this.options.cardView) {
  10034. this.$tableBody.css("height", "auto");
  10035. }
  10036. }
  10037. //监听cardView 显示/隐藏fixed部分
  10038. if (arguments[0] === 'toggle') {
  10039. if (arguments[1]) {
  10040. this.$tableBody.css("height", "auto");
  10041. this.$fixedColumns && this.$fixedColumns.hide();
  10042. this.$fixedColumnsRight && this.$fixedColumnsRight.hide();
  10043. } else {
  10044. this.$tableBody.css("height", "100%");
  10045. this.$fixedColumns && this.$fixedColumns.show();
  10046. this.$fixedColumnsRight && this.$fixedColumnsRight.show();
  10047. this.$fixedHeaderRight && this.$fixedHeaderRight.scrollLeft(this.$tableBody.find('table').width());
  10048. this.$fixedBodyRight && this.$fixedBodyRight.scrollLeft(this.$tableBody.find('table').width());
  10049. }
  10050. }
  10051. if (!that.fixedColumnsSupported()) {
  10052. return;
  10053. }
  10054. if (arguments[0] === 'post-header') {
  10055. this.initFixedColumnsHeader();
  10056. } else if (arguments[0] === 'scroll-body') {
  10057. if (this.needFixedColumns && this.options.fixedNumber) {
  10058. this.$fixedBody && this.$fixedBody.scrollTop(this.$tableBody.scrollTop());
  10059. }
  10060. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10061. this.$fixedBodyRight && this.$fixedBodyRight.scrollTop(this.$tableBody.scrollTop());
  10062. }
  10063. } else if (arguments[0] === 'load-success') {
  10064. this.hideLoading();
  10065. }
  10066. };
  10067. BootstrapTable.prototype.updateSelected = function () {
  10068. var that = this;
  10069. _updateSelected.apply(this, Array.prototype.slice.apply(arguments));
  10070. if (!this.fixedColumnsSupported()) {
  10071. return;
  10072. }
  10073. this.$tableBody.find('tr').each(function (i, el) {
  10074. var $el = $(el);
  10075. var index = $el.data('index');
  10076. var classes = $el.attr('class');
  10077. var inputSelector = '[name="' + that.options.selectItemName + '"]';
  10078. var $input = $el.find(inputSelector);
  10079. if (typeof index === 'undefined') {
  10080. return;
  10081. }
  10082. var updateFixedBody = function updateFixedBody($fixedHeader, $fixedBody) {
  10083. var $tr = $fixedBody.find('tr[data-index="' + index + '"]');
  10084. $tr.attr('class', classes);
  10085. if ($input.length) {
  10086. $tr.find(inputSelector).prop('checked', $input.prop('checked'));
  10087. }
  10088. if (that.$selectAll.length) {
  10089. $fixedHeader.add($fixedBody).find('[name="btSelectAll"]').prop('checked', that.$selectAll.prop('checked'));
  10090. }
  10091. };
  10092. if (that.$fixedBody && that.options.fixedNumber) {
  10093. updateFixedBody(that.$fixedHeader, that.$fixedBody);
  10094. }
  10095. if (that.$fixedBodyRight && that.options.fixedRightNumber) {
  10096. updateFixedBody(that.$fixedHeaderRight, that.$fixedBodyRight);
  10097. }
  10098. });
  10099. };
  10100. BootstrapTable.prototype.hideLoading = function () {
  10101. _hideLoading.apply(this, Array.prototype.slice.apply(arguments));
  10102. if (this.needFixedColumns && this.options.fixedNumber) {
  10103. this.$fixedColumns.find('.fixed-table-loading').hide();
  10104. }
  10105. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10106. this.$fixedColumnsRight.find('.fixed-table-loading').hide();
  10107. }
  10108. };
  10109. BootstrapTable.prototype.initFixedColumnsHeader = function () {
  10110. var that = this;
  10111. if (this.options.height) {
  10112. this.needFixedColumns = this.$tableHeader.outerWidth(true) < this.$tableHeader.find('table').outerWidth(true);
  10113. } else {
  10114. this.needFixedColumns = this.$tableBody.outerWidth(true) < this.$tableBody.find('table').outerWidth(true);
  10115. }
  10116. var initFixedHeader = function initFixedHeader($fixedColumns, isRight) {
  10117. $fixedColumns.find('.fixed-table-header').remove();
  10118. $fixedColumns.append(that.$tableHeader.clone(true));
  10119. $fixedColumns.find('.fixed-table-header').css('margin-right', "");
  10120. $fixedColumns.css({
  10121. width: that.getFixedColumnsWidth(isRight)
  10122. });
  10123. return $fixedColumns.find('.fixed-table-header');
  10124. };
  10125. if (this.needFixedColumns && this.options.fixedNumber) {
  10126. this.$fixedHeader = initFixedHeader(this.$fixedColumns);
  10127. this.$fixedHeader.css('margin-right', '');
  10128. } else if (this.$fixedColumns) {
  10129. this.$fixedColumns.html('').css('width', '');
  10130. }
  10131. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10132. this.$fixedHeaderRight = initFixedHeader(this.$fixedColumnsRight, true);
  10133. this.$fixedHeaderRight.scrollLeft(this.$fixedHeaderRight.find('table').width());
  10134. } else if (this.$fixedColumnsRight) {
  10135. this.$fixedColumnsRight.html('').css('width', '');
  10136. }
  10137. this.initFixedColumnsBody();
  10138. this.initFixedColumnsEvents();
  10139. };
  10140. BootstrapTable.prototype.initFixedColumnsBody = function () {
  10141. var that = this;
  10142. var initFixedBody = function initFixedBody($fixedColumns, $fixedHeader) {
  10143. $fixedColumns.find('.fixed-table-body').remove();
  10144. $fixedColumns.append(that.$tableBody.clone(true));
  10145. var $fixedBody = $fixedColumns.find('.fixed-table-body');
  10146. var tableBody = that.$tableBody.get(0);
  10147. var scrollHeight = tableBody.scrollWidth > tableBody.clientWidth ? getScrollBarWidth() : 0;
  10148. var paginationHeight = $(".fixed-table-pagination").height();
  10149. if (typeof that.options.height !== 'undefined') paginationHeight = 0;
  10150. var height = that.$tableContainer.outerHeight(true) - scrollHeight - paginationHeight + 1;
  10151. $fixedColumns.css({
  10152. height: height,
  10153. "min-height": "calc(100% - " + (paginationHeight + scrollHeight) + "px)"
  10154. });
  10155. $fixedBody.css({
  10156. height: height - $fixedHeader.height(),
  10157. "min-height": "calc(100% - " + $fixedHeader.height() + "px)",
  10158. overflow: "hidden"
  10159. });
  10160. return $fixedBody;
  10161. };
  10162. if (this.needFixedColumns && this.options.fixedNumber) {
  10163. this.$fixedBody = initFixedBody(this.$fixedColumns, this.$fixedHeader);
  10164. }
  10165. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10166. this.$fixedBodyRight = initFixedBody(this.$fixedColumnsRight, this.$fixedHeaderRight);
  10167. this.$fixedBodyRight.scrollLeft(this.$fixedBodyRight.find('table').width());
  10168. this.$fixedBodyRight.css('overflow-y', 'hidden');
  10169. }
  10170. };
  10171. BootstrapTable.prototype.getFixedColumnsWidth = function (isRight) {
  10172. var visibleFields = this.getVisibleFields();
  10173. var width = 0;
  10174. var fixedNumber = this.options.fixedNumber;
  10175. var marginRight = 0;
  10176. if (isRight) {
  10177. visibleFields = visibleFields.reverse();
  10178. fixedNumber = this.options.fixedRightNumber;
  10179. //右侧固定列距离
  10180. this.$fixedColumnsRight.css('right', getTableBodyScrollBarWidth(this.$tableBody));
  10181. }
  10182. for (var i = 0; i < fixedNumber; i++) {
  10183. width += this.$header.find('th[data-field="' + visibleFields[i] + '"]').outerWidth();
  10184. }
  10185. return width + 1;
  10186. };
  10187. BootstrapTable.prototype.initFixedColumnsEvents = function () {
  10188. var that = this;
  10189. var toggleHover = function toggleHover(e, toggle) {
  10190. var tr = 'tr[data-index="' + $(e.currentTarget).data('index') + '"]';
  10191. var $trs = that.$tableBody.find(tr);
  10192. if (that.$fixedBody) {
  10193. $trs = $trs.add(that.$fixedBody.find(tr));
  10194. }
  10195. if (that.$fixedBodyRight) {
  10196. $trs = $trs.add(that.$fixedBodyRight.find(tr));
  10197. }
  10198. $trs.css('background-color', toggle ? $(e.currentTarget).css('background-color') : '');
  10199. };
  10200. this.$tableBody.find('tr').hover(function (e) {
  10201. toggleHover(e, true);
  10202. }, function (e) {
  10203. toggleHover(e, false);
  10204. });
  10205. var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
  10206. var mousewheel = isFirefox ? 'DOMMouseScroll' : 'mousewheel';
  10207. var updateScroll = function updateScroll(e, fixedBody) {
  10208. var normalized = normalizeWheel(e);
  10209. var deltaY = Math.ceil(normalized.pixelY);
  10210. var top = that.$tableBody.scrollTop() + deltaY;
  10211. if (deltaY < 0 && top > 0 || deltaY > 0 && top < fixedBody.scrollHeight - fixedBody.clientHeight) {
  10212. e.preventDefault();
  10213. }
  10214. that.$tableBody.scrollTop(top);
  10215. if (that.$fixedBody) {
  10216. that.$fixedBody.scrollTop(top);
  10217. }
  10218. if (that.$fixedBodyRight) {
  10219. that.$fixedBodyRight.scrollTop(top);
  10220. }
  10221. };
  10222. if (this.needFixedColumns && this.options.fixedNumber) {
  10223. this.$fixedBody.find('tr').hover(function (e) {
  10224. toggleHover(e, true);
  10225. }, function (e) {
  10226. toggleHover(e, false);
  10227. });
  10228. this.$fixedBody[0].addEventListener(mousewheel, function (e) {
  10229. //给鼠标滑轮绑定事件
  10230. updateScroll(e, that.$fixedBody[0]);
  10231. });
  10232. //给固定表格的checkbox绑定事件
  10233. this.$fixedBody.find('input[name="' + this.options.selectItemName + '"]').off("click").on('click', function (e) {
  10234. e.stopImmediatePropagation();
  10235. var index = $(e.target).data("index");
  10236. $(that.$selectItem[index]).trigger("click");
  10237. });
  10238. //绑定TD点击事件
  10239. this.$fixedBody.find('> table > tbody > tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
  10240. var index = $(this).closest("tr[data-index]").data("index");
  10241. $(that.$selectItem[index]).closest("tr[data-index]").find(">td:eq(" + $(this).index() + ")").trigger("click");
  10242. });
  10243. }
  10244. //给原本表格绑定scroll事件
  10245. $('div.fixed-table-body').off('scroll'); //给所有的body解绑 scroll
  10246. this.$tableBody.off('scroll').on('scroll', function (e) {
  10247. that.$tableHeader.scrollLeft(0);
  10248. if (that.$tableBody.scrollLeft() > 0) {
  10249. that.$tableHeader.scrollLeft(that.$tableBody.scrollLeft());
  10250. if (that.options.showFooter && !that.options.cardView) {
  10251. that.$tableFooter.scrollLeft(that.$tableBody.scrollLeft());
  10252. }
  10253. }
  10254. var top = that.$tableBody.scrollTop();
  10255. if (that.$fixedBody) {
  10256. that.$fixedBody.scrollTop(top);
  10257. }
  10258. if (that.$fixedBodyRight) {
  10259. that.$fixedBodyRight.scrollTop(top);
  10260. }
  10261. });
  10262. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10263. this.$fixedBodyRight.find('tr').hover(function (e) {
  10264. toggleHover(e, true);
  10265. }, function (e) {
  10266. toggleHover(e, false);
  10267. });
  10268. this.$fixedBodyRight[0].addEventListener(mousewheel, function (e) {
  10269. //给鼠标滑轮绑定事件
  10270. updateScroll(e, that.$fixedBodyRight[0]);
  10271. });
  10272. //给固定表格的checkbox绑定事件
  10273. this.$fixedBodyRight.find('input[name="' + this.options.selectItemName + '"]').off("click").on('click', function (e) {
  10274. e.stopImmediatePropagation();
  10275. var index = $(e.target).data("index");
  10276. $(that.$selectItem[index]).trigger("click");
  10277. });
  10278. //绑定TD点击事件
  10279. this.$fixedBodyRight.find('> table > tbody > tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
  10280. var index = $(this).closest("tr[data-index]").data("index");
  10281. $(that.$selectItem[index]).closest("tr[data-index]").find(">td:eq(" + $(this).index() + ")").trigger("click");
  10282. });
  10283. }
  10284. if (this.options.filterControl) {
  10285. $(this.$fixedColumns).off('keyup change').on('keyup change', function (e) {
  10286. var $target = $(e.target);
  10287. var value = $target.val();
  10288. var field = $target.parents('th').data('field');
  10289. var $coreTh = that.$header.find('th[data-field="' + field + '"]');
  10290. if ($target.is('input')) {
  10291. $coreTh.find('input').val(value);
  10292. } else if ($target.is('select')) {
  10293. var $select = $coreTh.find('select');
  10294. $select.find('option[selected]').removeAttr('selected');
  10295. $select.find('option[value="' + value + '"]').attr('selected', true);
  10296. }
  10297. that.triggerSearch();
  10298. });
  10299. }
  10300. };
  10301. })(jQuery);
  10302. define("bootstrap-table-fixed-columns", ["bootstrap-table"], (function (global) {
  10303. return function () {
  10304. var ret, fn;
  10305. return ret || global.$.fn.bootstrapTable.defaults;
  10306. };
  10307. }(this)));
  10308. 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) {
  10309. var Table = {
  10310. list: {},
  10311. // Bootstrap-table 基础配置
  10312. defaults: {
  10313. url: '',
  10314. sidePagination: 'server',
  10315. method: 'get', //请求方法
  10316. toolbar: ".toolbar", //工具栏
  10317. search: true, //是否启用快速搜索
  10318. cache: false,
  10319. commonSearch: true, //是否启用通用搜索
  10320. searchFormVisible: false, //是否始终显示搜索表单
  10321. titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
  10322. idTable: 'commonTable',
  10323. showExport: true,
  10324. exportDataType: "auto",
  10325. exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
  10326. exportOptions: {
  10327. fileName: 'export_' + Moment().format("YYYY-MM-DD"),
  10328. preventInjection: false,
  10329. mso: {
  10330. onMsoNumberFormat: function (cell, row, col) {
  10331. return !isNaN($(cell).text()) ? '\\@' : '';
  10332. },
  10333. },
  10334. ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列
  10335. },
  10336. pageSize: Config.pagesize || localStorage.getItem("pagesize") || 10,
  10337. pageList: [10, 15, 20, 25, 50, 'All'],
  10338. pagination: true,
  10339. clickToSelect: true, //是否启用点击选中
  10340. dblClickToEdit: true, //是否启用双击编辑
  10341. singleSelect: false, //是否启用单选
  10342. showRefresh: false,
  10343. showJumpto: true,
  10344. locale: Config.language == 'zh-cn' ? 'zh-CN' : 'en-US',
  10345. showToggle: true,
  10346. showColumns: true,
  10347. pk: 'id',
  10348. sortName: 'id',
  10349. sortOrder: 'desc',
  10350. paginationFirstText: __("First"),
  10351. paginationPreText: __("Previous"),
  10352. paginationNextText: __("Next"),
  10353. paginationLastText: __("Last"),
  10354. cardView: false, //卡片视图
  10355. iosCardView: true, //ios卡片视图
  10356. checkOnInit: true, //是否在初始化时判断
  10357. escape: true, //是否对内容进行转义
  10358. fixDropdownPosition: true, //是否修复下拉的定位
  10359. selectedIds: [],
  10360. selectedData: [],
  10361. extend: {
  10362. index_url: '',
  10363. add_url: '',
  10364. edit_url: '',
  10365. del_url: '',
  10366. import_url: '',
  10367. multi_url: '',
  10368. dragsort_url: 'ajax/weigh',
  10369. }
  10370. },
  10371. // Bootstrap-table 列配置
  10372. columnDefaults: {
  10373. align: 'center',
  10374. valign: 'middle',
  10375. },
  10376. config: {
  10377. checkboxtd: 'tbody>tr>td.bs-checkbox',
  10378. toolbar: '.toolbar',
  10379. refreshbtn: '.btn-refresh',
  10380. addbtn: '.btn-add',
  10381. editbtn: '.btn-edit',
  10382. delbtn: '.btn-del',
  10383. importbtn: '.btn-import',
  10384. multibtn: '.btn-multi',
  10385. disabledbtn: '.btn-disabled',
  10386. editonebtn: '.btn-editone',
  10387. restoreonebtn: '.btn-restoreone',
  10388. destroyonebtn: '.btn-destroyone',
  10389. restoreallbtn: '.btn-restoreall',
  10390. destroyallbtn: '.btn-destroyall',
  10391. dragsortfield: 'weigh',
  10392. },
  10393. button: {
  10394. edit: {
  10395. name: 'edit',
  10396. icon: 'fa fa-pencil',
  10397. title: __('Edit'),
  10398. extend: 'data-toggle="tooltip"',
  10399. classname: 'btn btn-xs btn-success btn-editone'
  10400. },
  10401. del: {
  10402. name: 'del',
  10403. icon: 'fa fa-trash',
  10404. title: __('Del'),
  10405. extend: 'data-toggle="tooltip"',
  10406. classname: 'btn btn-xs btn-danger btn-delone'
  10407. },
  10408. dragsort: {
  10409. name: 'dragsort',
  10410. icon: 'fa fa-arrows',
  10411. title: __('Drag to sort'),
  10412. extend: 'data-toggle="tooltip"',
  10413. classname: 'btn btn-xs btn-primary btn-dragsort'
  10414. }
  10415. },
  10416. api: {
  10417. init: function (defaults, columnDefaults, locales) {
  10418. defaults = defaults ? defaults : {};
  10419. columnDefaults = columnDefaults ? columnDefaults : {};
  10420. locales = locales ? locales : {};
  10421. $.fn.bootstrapTable.Constructor.prototype.getSelectItem = function () {
  10422. return this.$selectItem;
  10423. };
  10424. var _onPageListChange = $.fn.bootstrapTable.Constructor.prototype.onPageListChange;
  10425. $.fn.bootstrapTable.Constructor.prototype.onPageListChange = function () {
  10426. _onPageListChange.apply(this, Array.prototype.slice.apply(arguments));
  10427. localStorage.setItem('pagesize', this.options.pageSize);
  10428. return false;
  10429. };
  10430. // 写入bootstrap-table默认配置
  10431. $.extend(true, $.fn.bootstrapTable.defaults, Table.defaults, defaults);
  10432. // 写入bootstrap-table column配置
  10433. $.extend($.fn.bootstrapTable.columnDefaults, Table.columnDefaults, columnDefaults);
  10434. // 写入bootstrap-table locale配置
  10435. $.extend($.fn.bootstrapTable.locales[Table.defaults.locale], {
  10436. formatCommonSearch: function () {
  10437. return __('Common search');
  10438. },
  10439. formatCommonSubmitButton: function () {
  10440. return __('Submit');
  10441. },
  10442. formatCommonResetButton: function () {
  10443. return __('Reset');
  10444. },
  10445. formatCommonCloseButton: function () {
  10446. return __('Close');
  10447. },
  10448. formatCommonChoose: function () {
  10449. return __('Choose');
  10450. },
  10451. formatJumpto: function () {
  10452. return __('Go');
  10453. }
  10454. }, locales);
  10455. // 如果是iOS设备则判断是否启用卡片视图
  10456. if ($.fn.bootstrapTable.defaults.iosCardView && navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
  10457. Table.defaults.cardView = true;
  10458. $.fn.bootstrapTable.defaults.cardView = true;
  10459. }
  10460. if (typeof defaults.exportTypes != 'undefined') {
  10461. $.fn.bootstrapTable.defaults.exportTypes = defaults.exportTypes;
  10462. }
  10463. },
  10464. // 绑定事件
  10465. bindevent: function (table) {
  10466. //Bootstrap-table的父元素,包含table,toolbar,pagnation
  10467. var parenttable = table.closest('.bootstrap-table');
  10468. //Bootstrap-table配置
  10469. var options = table.bootstrapTable('getOptions');
  10470. //Bootstrap操作区
  10471. var toolbar = $(options.toolbar, parenttable);
  10472. //跨页提示按钮
  10473. var tipsBtn = $(".btn-selected-tips", parenttable);
  10474. if (tipsBtn.length === 0) {
  10475. 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);
  10476. }
  10477. //点击提示按钮
  10478. tipsBtn.off("click").on("click", function (e) {
  10479. table.trigger("uncheckbox");
  10480. table.bootstrapTable("refresh");
  10481. });
  10482. //当刷新表格时
  10483. table.on('uncheckbox', function (status, res, e) {
  10484. options.selectedIds = [];
  10485. options.selectedData = [];
  10486. tipsBtn.tooltip('hide');
  10487. tipsBtn.addClass('hide');
  10488. });
  10489. //表格加载出错时
  10490. table.on('load-error.bs.table', function (status, res, e) {
  10491. if (e.status === 0) {
  10492. return;
  10493. }
  10494. Toastr.error(__('Unknown data format'));
  10495. });
  10496. //当加载数据成功时
  10497. table.on('load-success.bs.table', function (e, data) {
  10498. if (typeof data.rows === 'undefined' && typeof data.code != 'undefined') {
  10499. Toastr.error(data.msg);
  10500. }
  10501. });
  10502. //当刷新表格时
  10503. table.on('refresh.bs.table', function (e, settings, data) {
  10504. $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
  10505. });
  10506. //当执行搜索时
  10507. table.on('search.bs.table common-search.bs.table', function (e, settings, data) {
  10508. table.trigger("uncheckbox");
  10509. });
  10510. if (options.dblClickToEdit) {
  10511. //当双击单元格时
  10512. table.on('dbl-click-row.bs.table', function (e, row, element, field) {
  10513. $(Table.config.editonebtn, element).trigger("click");
  10514. });
  10515. }
  10516. //渲染内容前
  10517. table.on('pre-body.bs.table', function (e, data) {
  10518. if (options.maintainSelected) {
  10519. $.each(data, function (i, row) {
  10520. row[options.stateField] = $.inArray(row[options.pk], options.selectedIds) > -1;
  10521. });
  10522. }
  10523. });
  10524. //当内容渲染完成后
  10525. table.on('post-body.bs.table', function (e, data) {
  10526. $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
  10527. if ($(Table.config.checkboxtd + ":first", table).find("input[type='checkbox'][data-index]").length > 0) {
  10528. // 拖拽选择,需要重新绑定事件
  10529. require(['drag', 'drop'], function () {
  10530. var checkboxtd = $(Table.config.checkboxtd, table);
  10531. checkboxtd.drag("start", function (ev, dd) {
  10532. return $('<div class="selection" />').css('opacity', .65).appendTo(document.body);
  10533. }).drag(function (ev, dd) {
  10534. $(dd.proxy).css({
  10535. top: Math.min(ev.pageY, dd.startY),
  10536. left: Math.min(ev.pageX, dd.startX),
  10537. height: Math.abs(ev.pageY - dd.startY),
  10538. width: Math.abs(ev.pageX - dd.startX)
  10539. });
  10540. }).drag("end", function (ev, dd) {
  10541. $(dd.proxy).remove();
  10542. });
  10543. checkboxtd.drop("start", function () {
  10544. Table.api.toggleattr(this);
  10545. }).drop(function () {
  10546. // Table.api.toggleattr(this);
  10547. }).drop("end", function (e) {
  10548. var that = this;
  10549. setTimeout(function () {
  10550. if (e.type === 'mousemove') {
  10551. Table.api.toggleattr(that);
  10552. }
  10553. }, 0);
  10554. });
  10555. $.drop({
  10556. multi: true
  10557. });
  10558. });
  10559. }
  10560. });
  10561. var exportDataType = options.exportDataType;
  10562. // 处理选中筛选框后按钮的状态统一变更
  10563. table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table post-body.bs.table', function (e) {
  10564. var allIds = [];
  10565. $.each(table.bootstrapTable("getData"), function (i, item) {
  10566. allIds.push(typeof item[options.pk] != 'undefined' ? item[options.pk] : '');
  10567. });
  10568. var selectedIds = Table.api.selectedids(table, true),
  10569. selectedData = Table.api.selecteddata(table, true);
  10570. //开启分页checkbox分页记忆
  10571. if (options.maintainSelected) {
  10572. options.selectedIds = options.selectedIds.filter(function (element, index, self) {
  10573. return $.inArray(element, allIds) === -1;
  10574. }).concat(selectedIds);
  10575. options.selectedData = options.selectedData.filter(function (element, index, self) {
  10576. return $.inArray(element[options.pk], allIds) === -1;
  10577. }).concat(selectedData);
  10578. if (options.selectedIds.length > selectedIds.length) {
  10579. $("b", tipsBtn).text(options.selectedIds.length);
  10580. tipsBtn.removeClass('hide');
  10581. } else {
  10582. tipsBtn.addClass('hide');
  10583. }
  10584. } else {
  10585. options.selectedIds = selectedIds;
  10586. options.selectedData = selectedData;
  10587. }
  10588. //如果导出类型为auto时则自动判断
  10589. if (exportDataType === 'auto') {
  10590. options.exportDataType = selectedIds.length > 0 ? 'selected' : 'all';
  10591. }
  10592. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !options.selectedIds.length);
  10593. });
  10594. // 绑定TAB事件
  10595. $('.panel-heading [data-field] a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) {
  10596. var field = $(this).closest("[data-field]").data("field");
  10597. var value = $(this).data("value");
  10598. var object = $("[name='" + field + "']", table.closest(".bootstrap-table").find(".commonsearch-table"));
  10599. if (object.prop('tagName') == "SELECT") {
  10600. $("option[value='" + value + "']", object).prop("selected", true);
  10601. } else {
  10602. object.val(value);
  10603. }
  10604. table.trigger("uncheckbox");
  10605. table.bootstrapTable('refresh', {pageNumber: 1});
  10606. return false;
  10607. });
  10608. // 修复重置事件
  10609. $("form", table.closest(".bootstrap-table").find(".commonsearch-table")).on('reset', function () {
  10610. setTimeout(function () {
  10611. // $('.panel-heading [data-field] li.active a[data-toggle="tab"]').trigger('shown.bs.tab');
  10612. }, 0);
  10613. $('.panel-heading [data-field] li', table.closest(".panel-intro")).removeClass('active');
  10614. $('.panel-heading [data-field] li:first', table.closest(".panel-intro")).addClass('active');
  10615. });
  10616. // 刷新按钮事件
  10617. toolbar.on('click', Table.config.refreshbtn, function () {
  10618. table.bootstrapTable('refresh');
  10619. });
  10620. // 添加按钮事件
  10621. toolbar.on('click', Table.config.addbtn, function () {
  10622. var ids = Table.api.selectedids(table);
  10623. var url = options.extend.add_url;
  10624. if (url.indexOf("{ids}") !== -1) {
  10625. url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
  10626. }
  10627. Fast.api.open(url, $(this).data("original-title") || $(this).attr("title") || __('Add'), $(this).data() || {});
  10628. });
  10629. // 导入按钮事件
  10630. if ($(Table.config.importbtn, toolbar).length > 0) {
  10631. require(['upload'], function (Upload) {
  10632. Upload.api.upload($(Table.config.importbtn, toolbar), function (data, ret) {
  10633. Fast.api.ajax({
  10634. url: options.extend.import_url,
  10635. data: {file: data.url},
  10636. }, function (data, ret) {
  10637. table.trigger("uncheckbox");
  10638. table.bootstrapTable('refresh');
  10639. });
  10640. });
  10641. });
  10642. }
  10643. // 批量编辑按钮事件
  10644. toolbar.on('click', Table.config.editbtn, function () {
  10645. var that = this;
  10646. var ids = Table.api.selectedids(table);
  10647. if (ids.length > 10) {
  10648. return;
  10649. }
  10650. var title = $(that).data('title') || $(that).attr("title") || __('Edit');
  10651. var data = $(that).data() || {};
  10652. delete data.title;
  10653. //循环弹出多个编辑框
  10654. $.each(Table.api.selecteddata(table), function (index, row) {
  10655. var url = options.extend.edit_url;
  10656. row = $.extend({}, row ? row : {}, {ids: row[options.pk]});
  10657. url = Table.api.replaceurl(url, row, table);
  10658. Fast.api.open(url, typeof title === 'function' ? title.call(table, row) : title, data);
  10659. });
  10660. });
  10661. //清空回收站
  10662. $(document).on('click', Table.config.destroyallbtn, function () {
  10663. var that = this;
  10664. Layer.confirm(__('Are you sure you want to truncate?'), function () {
  10665. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10666. Fast.api.ajax(url, function () {
  10667. Layer.closeAll();
  10668. table.trigger("uncheckbox");
  10669. table.bootstrapTable('refresh');
  10670. }, function () {
  10671. Layer.closeAll();
  10672. });
  10673. });
  10674. return false;
  10675. });
  10676. //全部还原
  10677. $(document).on('click', Table.config.restoreallbtn, function () {
  10678. var that = this;
  10679. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10680. Fast.api.ajax(url, function () {
  10681. Layer.closeAll();
  10682. table.trigger("uncheckbox");
  10683. table.bootstrapTable('refresh');
  10684. }, function () {
  10685. Layer.closeAll();
  10686. });
  10687. return false;
  10688. });
  10689. //销毁或删除
  10690. $(document).on('click', Table.config.restoreonebtn + ',' + Table.config.destroyonebtn, function () {
  10691. var that = this;
  10692. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10693. var row = Fast.api.getrowbyindex(table, $(that).data("row-index"));
  10694. Fast.api.ajax({
  10695. url: url,
  10696. data: {ids: row[options.pk]}
  10697. }, function () {
  10698. table.trigger("uncheckbox");
  10699. table.bootstrapTable('refresh');
  10700. });
  10701. return false;
  10702. });
  10703. // 批量操作按钮事件
  10704. toolbar.on('click', Table.config.multibtn, function () {
  10705. var ids = Table.api.selectedids(table);
  10706. Table.api.multi($(this).data("action"), ids, table, this);
  10707. });
  10708. // 批量删除按钮事件
  10709. toolbar.on('click', Table.config.delbtn, function () {
  10710. var that = this;
  10711. var ids = Table.api.selectedids(table);
  10712. Layer.confirm(
  10713. __('Are you sure you want to delete the %s selected item?', ids.length),
  10714. {icon: 3, title: __('Warning'), offset: 0, shadeClose: true, btn: [__('OK'), __('Cancel')]},
  10715. function (index) {
  10716. Table.api.multi("del", ids, table, that);
  10717. Layer.close(index);
  10718. }
  10719. );
  10720. });
  10721. // 拖拽排序
  10722. require(['dragsort'], function () {
  10723. //绑定拖动排序
  10724. $("tbody", table).dragsort({
  10725. itemSelector: 'tr:visible',
  10726. dragSelector: "a.btn-dragsort",
  10727. dragEnd: function (a, b) {
  10728. var element = $("a.btn-dragsort", this);
  10729. var data = table.bootstrapTable('getData');
  10730. var current = data[parseInt($(this).data("index"))];
  10731. var options = table.bootstrapTable('getOptions');
  10732. //改变的值和改变的ID集合
  10733. var ids = $.map($("tbody tr:visible", table), function (tr) {
  10734. return data[parseInt($(tr).data("index"))][options.pk];
  10735. });
  10736. var changeid = current[options.pk];
  10737. var pid = typeof current.pid != 'undefined' ? current.pid : '';
  10738. var params = {
  10739. url: table.bootstrapTable('getOptions').extend.dragsort_url,
  10740. data: {
  10741. ids: ids.join(','),
  10742. changeid: changeid,
  10743. pid: pid,
  10744. field: Table.config.dragsortfield,
  10745. orderway: options.sortOrder,
  10746. table: options.extend.table,
  10747. pk: options.pk
  10748. }
  10749. };
  10750. Fast.api.ajax(params, function (data, ret) {
  10751. var success = $(element).data("success") || $.noop;
  10752. if (typeof success === 'function') {
  10753. if (false === success.call(element, data, ret)) {
  10754. return false;
  10755. }
  10756. }
  10757. table.bootstrapTable('refresh');
  10758. }, function (data, ret) {
  10759. var error = $(element).data("error") || $.noop;
  10760. if (typeof error === 'function') {
  10761. if (false === error.call(element, data, ret)) {
  10762. return false;
  10763. }
  10764. }
  10765. table.bootstrapTable('refresh');
  10766. });
  10767. },
  10768. placeHolderTemplate: ""
  10769. });
  10770. });
  10771. table.on("click", "input[data-id][name='checkbox']", function (e) {
  10772. var ids = $(this).data("id");
  10773. table.bootstrapTable($(this).prop("checked") ? 'checkBy' : 'uncheckBy', {field: options.pk, values: [ids]});
  10774. });
  10775. table.on("click", "[data-id].btn-change", function (e) {
  10776. e.preventDefault();
  10777. var changer = $.proxy(function () {
  10778. Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this);
  10779. }, this);
  10780. if (typeof $(this).data("confirm") !== 'undefined') {
  10781. Layer.confirm($(this).data("confirm"), function (index) {
  10782. changer();
  10783. Layer.close(index);
  10784. });
  10785. } else {
  10786. changer();
  10787. }
  10788. });
  10789. table.on("click", "[data-id].btn-edit", function (e) {
  10790. e.preventDefault();
  10791. var ids = $(this).data("id");
  10792. var row = Table.api.getrowbyid(table, ids);
  10793. row.ids = ids;
  10794. var url = Table.api.replaceurl(options.extend.edit_url, row, table);
  10795. Fast.api.open(url, $(this).data("original-title") || $(this).attr("title") || __('Edit'), $(this).data() || {});
  10796. });
  10797. table.on("click", "[data-id].btn-del", function (e) {
  10798. e.preventDefault();
  10799. var id = $(this).data("id");
  10800. var that = this;
  10801. Layer.confirm(
  10802. __('Are you sure you want to delete this item?'),
  10803. {icon: 3, title: __('Warning'), shadeClose: true, btn: [__('OK'), __('Cancel')]},
  10804. function (index) {
  10805. Table.api.multi("del", id, table, that);
  10806. Layer.close(index);
  10807. }
  10808. );
  10809. });
  10810. //修复dropdown定位溢出的情况
  10811. if (options.fixDropdownPosition) {
  10812. var tableBody = table.closest(".fixed-table-body");
  10813. table.on('show.bs.dropdown fa.event.refreshdropdown', ".btn-group", function (e) {
  10814. var dropdownMenu = $(".dropdown-menu", this);
  10815. var btnGroup = $(this);
  10816. var isPullRight = dropdownMenu.hasClass("pull-right") || dropdownMenu.hasClass("dropdown-menu-right");
  10817. var left, top, position;
  10818. if (true || dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
  10819. position = 'fixed';
  10820. top = btnGroup.offset().top - $(window).scrollTop() + btnGroup.outerHeight();
  10821. if ((top + dropdownMenu.outerHeight()) > $(window).height()) {
  10822. top = btnGroup.offset().top - dropdownMenu.outerHeight() - 5;
  10823. }
  10824. left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
  10825. }
  10826. if (left || top) {
  10827. dropdownMenu.css({
  10828. position: position, left: left, top: top, right: 'inherit'
  10829. });
  10830. }
  10831. });
  10832. var checkdropdown = function () {
  10833. if ($(".btn-group.open", table).length > 0 && $(".btn-group.open .dropdown-menu", table).css("position") == 'fixed') {
  10834. $(".btn-group.open", table).trigger("fa.event.refreshdropdown");
  10835. }
  10836. };
  10837. $(window).on("scroll", function () {
  10838. checkdropdown();
  10839. });
  10840. tableBody.on("scroll", function () {
  10841. checkdropdown();
  10842. });
  10843. }
  10844. var id = table.attr("id");
  10845. Table.list[id] = table;
  10846. return table;
  10847. },
  10848. // 批量操作请求
  10849. multi: function (action, ids, table, element) {
  10850. var options = table.bootstrapTable('getOptions');
  10851. var data = element ? $(element).data() : {};
  10852. ids = ($.isArray(ids) ? ids.join(",") : ids);
  10853. var url = typeof data.url !== "undefined" ? data.url : (action == "del" ? options.extend.del_url : options.extend.multi_url);
  10854. var params = typeof data.params !== "undefined" ? (typeof data.params == 'object' ? $.param(data.params) : data.params) : '';
  10855. options = {url: url, data: {action: action, ids: ids, params: params}};
  10856. Fast.api.ajax(options, function (data, ret) {
  10857. table.trigger("uncheckbox");
  10858. var success = $(element).data("success") || $.noop;
  10859. if (typeof success === 'function') {
  10860. if (false === success.call(element, data, ret)) {
  10861. return false;
  10862. }
  10863. }
  10864. table.bootstrapTable('refresh');
  10865. }, function (data, ret) {
  10866. var error = $(element).data("error") || $.noop;
  10867. if (typeof error === 'function') {
  10868. if (false === error.call(element, data, ret)) {
  10869. return false;
  10870. }
  10871. }
  10872. });
  10873. },
  10874. // 单元格元素事件
  10875. events: {
  10876. operate: {
  10877. 'click .btn-editone': function (e, value, row, index) {
  10878. e.stopPropagation();
  10879. e.preventDefault();
  10880. var table = $(this).closest('table');
  10881. var options = table.bootstrapTable('getOptions');
  10882. var ids = row[options.pk];
  10883. row = $.extend({}, row ? row : {}, {ids: ids});
  10884. var url = options.extend.edit_url;
  10885. Fast.api.open(Table.api.replaceurl(url, row, table), $(this).data("original-title") || $(this).attr("title") || __('Edit'), $(this).data() || {});
  10886. },
  10887. 'click .btn-delone': function (e, value, row, index) {
  10888. e.stopPropagation();
  10889. e.preventDefault();
  10890. var that = this;
  10891. var top = $(that).offset().top - $(window).scrollTop();
  10892. var left = $(that).offset().left - $(window).scrollLeft() - 260;
  10893. if (top + 154 > $(window).height()) {
  10894. top = top - 154;
  10895. }
  10896. if ($(window).width() < 480) {
  10897. top = left = undefined;
  10898. }
  10899. Layer.confirm(
  10900. __('Are you sure you want to delete this item?'),
  10901. {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true, btn: [__('OK'), __('Cancel')]},
  10902. function (index) {
  10903. var table = $(that).closest('table');
  10904. var options = table.bootstrapTable('getOptions');
  10905. Table.api.multi("del", row[options.pk], table, that);
  10906. Layer.close(index);
  10907. }
  10908. );
  10909. }
  10910. },//单元格图片预览
  10911. image: {
  10912. 'click .img-center': function (e, value, row, index) {
  10913. var data = [];
  10914. value = value === null ? '' : value.toString();
  10915. var arr = value != '' ? value.split(",") : [];
  10916. var url;
  10917. $.each(arr, function (index, value) {
  10918. url = Fast.api.cdnurl(value);
  10919. data.push({
  10920. src: url,
  10921. thumb: url.match(/^(\/|data:image\\)/) ? url : url + Config.upload.thumbstyle
  10922. });
  10923. });
  10924. Layer.photos({
  10925. photos: {
  10926. "start": $(this).parent().index(),
  10927. "data": data
  10928. },
  10929. anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
  10930. });
  10931. },
  10932. }
  10933. },
  10934. // 单元格数据格式化
  10935. formatter: {
  10936. icon: function (value, row, index) {
  10937. value = value === null ? '' : value.toString();
  10938. value = value.indexOf(" ") > -1 ? value : "fa fa-" + value;
  10939. //渲染fontawesome图标
  10940. return '<i class="' + value + '"></i> ' + value;
  10941. },
  10942. image: function (value, row, index) {
  10943. value = value == null || value.length === 0 ? '' : value.toString();
  10944. value = value ? value : '/assets/img/blank.gif';
  10945. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  10946. var url = Fast.api.cdnurl(value, true);
  10947. url = url.match(/^(\/|data:image\\)/) ? url : url + Config.upload.thumbstyle;
  10948. return '<a href="javascript:"><img class="' + classname + '" src="' + url + '" /></a>';
  10949. },
  10950. images: function (value, row, index) {
  10951. value = value == null || value.length === 0 ? '' : value.toString();
  10952. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  10953. var arr = value != '' ? value.split(',') : [];
  10954. var html = [];
  10955. var url;
  10956. $.each(arr, function (i, value) {
  10957. value = value ? value : '/assets/img/blank.gif';
  10958. url = Fast.api.cdnurl(value, true);
  10959. url = url.match(/^(\/|data:image\\)/) ? url : url + Config.upload.thumbstyle;
  10960. html.push('<a href="javascript:"><img class="' + classname + '" src="' + url + '" /></a>');
  10961. });
  10962. return html.join(' ');
  10963. },
  10964. file: function (value, row, index) {
  10965. value = value == null || value.length === 0 ? '' : value.toString();
  10966. value = Fast.api.cdnurl(value, true);
  10967. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  10968. var suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(value);
  10969. suffix = suffix ? suffix[1] : 'file';
  10970. var url = Fast.api.fixurl("ajax/icon?suffix=" + suffix);
  10971. return '<a href="' + value + '" target="_blank"><img src="' + url + '" class="' + classname + '"></a>';
  10972. },
  10973. files: function (value, row, index) {
  10974. value = value == null || value.length === 0 ? '' : value.toString();
  10975. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  10976. var arr = value != '' ? value.split(',') : [];
  10977. var html = [];
  10978. var suffix, url;
  10979. $.each(arr, function (i, value) {
  10980. value = Fast.api.cdnurl(value, true);
  10981. suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(value);
  10982. suffix = suffix ? suffix[1] : 'file';
  10983. url = Fast.api.fixurl("ajax/icon?suffix=" + suffix);
  10984. html.push('<a href="' + value + '" target="_blank"><img src="' + url + '" class="' + classname + '"></a>');
  10985. });
  10986. return html.join(' ');
  10987. },
  10988. content: function (value, row, index) {
  10989. var width = this.width != undefined ? (this.width.match(/^\d+$/) ? this.width + "px" : this.width) : "250px";
  10990. return "<div style='white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:" + width + ";'>" + value + "</div>";
  10991. },
  10992. status: function (value, row, index) {
  10993. var custom = {normal: 'success', hidden: 'gray', deleted: 'danger', locked: 'info'};
  10994. if (typeof this.custom !== 'undefined') {
  10995. custom = $.extend(custom, this.custom);
  10996. }
  10997. this.custom = custom;
  10998. this.icon = 'fa fa-circle';
  10999. return Table.api.formatter.normal.call(this, value, row, index);
  11000. },
  11001. normal: function (value, row, index) {
  11002. var colorArr = ["primary", "success", "danger", "warning", "info", "gray", "red", "yellow", "aqua", "blue", "navy", "teal", "olive", "lime", "fuchsia", "purple", "maroon"];
  11003. var custom = {};
  11004. if (typeof this.custom !== 'undefined') {
  11005. custom = $.extend(custom, this.custom);
  11006. }
  11007. value = value == null || value.length === 0 ? '' : value.toString();
  11008. var keys = typeof this.searchList === 'object' ? Object.keys(this.searchList) : [];
  11009. var index = keys.indexOf(value);
  11010. var color = value && typeof custom[value] !== 'undefined' ? custom[value] : null;
  11011. var display = index > -1 ? this.searchList[value] : null;
  11012. var icon = typeof this.icon !== 'undefined' ? this.icon : null;
  11013. if (!color) {
  11014. color = index > -1 && typeof colorArr[index] !== 'undefined' ? colorArr[index] : 'primary';
  11015. }
  11016. if (!display) {
  11017. display = __(value.charAt(0).toUpperCase() + value.slice(1));
  11018. }
  11019. var html = '<span class="text-' + color + '">' + (icon ? '<i class="' + icon + '"></i> ' : '') + display + '</span>';
  11020. if (this.operate != false) {
  11021. html = '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + this.field + '" data-value="' + value + '">' + html + '</a>';
  11022. }
  11023. return html;
  11024. },
  11025. toggle: function (value, row, index) {
  11026. var table = this.table;
  11027. var options = table ? table.bootstrapTable('getOptions') : {};
  11028. var pk = options.pk || "id";
  11029. var color = typeof this.color !== 'undefined' ? this.color : 'success';
  11030. var yes = typeof this.yes !== 'undefined' ? this.yes : 1;
  11031. var no = typeof this.no !== 'undefined' ? this.no : 0;
  11032. var url = typeof this.url !== 'undefined' ? this.url : '';
  11033. var confirm = '';
  11034. var disable = false;
  11035. if (typeof this.confirm !== "undefined") {
  11036. confirm = typeof this.confirm === "function" ? this.confirm.call(this, value, row, index) : this.confirm;
  11037. }
  11038. if (typeof this.disable !== "undefined") {
  11039. disable = typeof this.disable === "function" ? this.disable.call(this, value, row, index) : this.disable;
  11040. }
  11041. return "<a href='javascript:;' data-toggle='tooltip' title='" + __('Click to toggle') + "' class='btn-change " + (disable ? 'btn disabled no-padding' : '') + "' data-index='" + index + "' data-id='"
  11042. + 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>";
  11043. },
  11044. url: function (value, row, index) {
  11045. value = value == null || value.length === 0 ? '' : value.toString();
  11046. 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>';
  11047. },
  11048. search: function (value, row, index) {
  11049. var field = this.field;
  11050. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  11051. value = row[this.customField];
  11052. field = this.customField;
  11053. }
  11054. return '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', value) + '" data-field="' + field + '" data-value="' + value + '">' + value + '</a>';
  11055. },
  11056. addtabs: function (value, row, index) {
  11057. var url = Table.api.replaceurl(this.url || '', row, this.table);
  11058. var title = this.atitle ? this.atitle : __("Search %s", value);
  11059. return '<a href="' + Fast.api.fixurl(url) + '" class="addtabsit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  11060. },
  11061. dialog: function (value, row, index) {
  11062. var url = Table.api.replaceurl(this.url || '', row, this.table);
  11063. var title = this.atitle ? this.atitle : __("View %s", value);
  11064. return '<a href="' + Fast.api.fixurl(url) + '" class="dialogit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  11065. },
  11066. flag: function (value, row, index) {
  11067. var that = this;
  11068. value = value == null || value.length === 0 ? '' : value.toString();
  11069. var colorArr = {index: 'success', hot: 'warning', recommend: 'danger', 'new': 'info'};
  11070. //如果字段列有定义custom
  11071. if (typeof this.custom !== 'undefined') {
  11072. colorArr = $.extend(colorArr, this.custom);
  11073. }
  11074. var field = this.field;
  11075. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  11076. value = row[this.customField];
  11077. field = this.customField;
  11078. }
  11079. if (typeof that.searchList === 'object' && typeof that.custom === 'undefined') {
  11080. var i = 0;
  11081. var searchValues = Object.values(colorArr);
  11082. $.each(that.searchList, function (key, val) {
  11083. if (typeof colorArr[key] == 'undefined') {
  11084. colorArr[key] = searchValues[i];
  11085. i = typeof searchValues[i + 1] === 'undefined' ? 0 : i + 1;
  11086. }
  11087. });
  11088. }
  11089. //渲染Flag
  11090. var html = [];
  11091. var arr = value != '' ? value.split(',') : [];
  11092. var color, display, label;
  11093. $.each(arr, function (i, value) {
  11094. value = value == null || value.length === 0 ? '' : value.toString();
  11095. if (value == '')
  11096. return true;
  11097. color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  11098. display = typeof that.searchList !== 'undefined' && typeof that.searchList[value] !== 'undefined' ? that.searchList[value] : __(value.charAt(0).toUpperCase() + value.slice(1));
  11099. label = '<span class="label label-' + color + '">' + display + '</span>';
  11100. if (that.operate) {
  11101. html.push('<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + field + '" data-value="' + value + '">' + label + '</a>');
  11102. } else {
  11103. html.push(label);
  11104. }
  11105. });
  11106. return html.join(' ');
  11107. },
  11108. label: function (value, row, index) {
  11109. return Table.api.formatter.flag.call(this, value, row, index);
  11110. },
  11111. datetime: function (value, row, index) {
  11112. var datetimeFormat = typeof this.datetimeFormat === 'undefined' ? 'YYYY-MM-DD HH:mm:ss' : this.datetimeFormat;
  11113. if (isNaN(value)) {
  11114. return value ? Moment(value).format(datetimeFormat) : __('None');
  11115. } else {
  11116. return value ? Moment(parseInt(value) * 1000).format(datetimeFormat) : __('None');
  11117. }
  11118. },
  11119. operate: function (value, row, index) {
  11120. var table = this.table;
  11121. // 操作配置
  11122. var options = table ? table.bootstrapTable('getOptions') : {};
  11123. // 默认按钮组
  11124. var buttons = $.extend([], this.buttons || []);
  11125. // 所有按钮名称
  11126. var names = [];
  11127. buttons.forEach(function (item) {
  11128. names.push(item.name);
  11129. });
  11130. if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
  11131. buttons.push(Table.button.dragsort);
  11132. }
  11133. if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
  11134. Table.button.edit.url = options.extend.edit_url;
  11135. buttons.push(Table.button.edit);
  11136. }
  11137. if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
  11138. buttons.push(Table.button.del);
  11139. }
  11140. return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
  11141. }
  11142. ,
  11143. buttons: function (value, row, index) {
  11144. // 默认按钮组
  11145. var buttons = $.extend([], this.buttons || []);
  11146. return Table.api.buttonlink(this, buttons, value, row, index, 'buttons');
  11147. }
  11148. },
  11149. buttonlink: function (column, buttons, value, row, index, type) {
  11150. var table = column.table;
  11151. column.clickToSelect = false;
  11152. type = typeof type === 'undefined' ? 'buttons' : type;
  11153. var options = table ? table.bootstrapTable('getOptions') : {};
  11154. var html = [];
  11155. var hidden, visible, disable, url, classname, icon, text, title, refresh, confirm, extend,
  11156. dropdown, link;
  11157. var fieldIndex = column.fieldIndex;
  11158. var dropdowns = {};
  11159. $.each(buttons, function (i, j) {
  11160. if (type === 'operate') {
  11161. if (j.name === 'dragsort' && typeof row[Table.config.dragsortfield] === 'undefined') {
  11162. return true;
  11163. }
  11164. if (['add', 'edit', 'del', 'multi', 'dragsort'].indexOf(j.name) > -1 && !options.extend[j.name + "_url"]) {
  11165. return true;
  11166. }
  11167. }
  11168. var attr = table.data(type + "-" + j.name);
  11169. if (typeof attr === 'undefined' || attr) {
  11170. hidden = typeof j.hidden === 'function' ? j.hidden.call(table, row, j) : (typeof j.hidden !== 'undefined' ? j.hidden : false);
  11171. if (hidden) {
  11172. return true;
  11173. }
  11174. visible = typeof j.visible === 'function' ? j.visible.call(table, row, j) : (typeof j.visible !== 'undefined' ? j.visible : true);
  11175. if (!visible) {
  11176. return true;
  11177. }
  11178. dropdown = j.dropdown ? j.dropdown : '';
  11179. url = j.url ? j.url : '';
  11180. url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
  11181. classname = j.classname ? j.classname : (dropdown ? 'btn-' + name + 'one' : 'btn-primary btn-' + name + 'one');
  11182. icon = j.icon ? j.icon : '';
  11183. text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : '';
  11184. title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text;
  11185. refresh = j.refresh ? 'data-refresh="' + j.refresh + '"' : '';
  11186. confirm = typeof j.confirm === 'function' ? j.confirm.call(table, row, j) : (typeof j.confirm !== 'undefined' ? j.confirm : false);
  11187. confirm = confirm ? 'data-confirm="' + confirm + '"' : '';
  11188. extend = j.extend ? j.extend : '';
  11189. disable = typeof j.disable === 'function' ? j.disable.call(table, row, j) : (typeof j.disable !== 'undefined' ? j.disable : false);
  11190. if (disable) {
  11191. classname = classname + ' disabled';
  11192. }
  11193. 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>';
  11194. if (dropdown) {
  11195. if (typeof dropdowns[dropdown] == 'undefined') {
  11196. dropdowns[dropdown] = [];
  11197. }
  11198. dropdowns[dropdown].push(link);
  11199. } else {
  11200. html.push(link);
  11201. }
  11202. }
  11203. });
  11204. if (!$.isEmptyObject(dropdowns)) {
  11205. var dropdownHtml = [];
  11206. $.each(dropdowns, function (i, j) {
  11207. 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>');
  11208. });
  11209. html.unshift(dropdownHtml);
  11210. }
  11211. return html.join(' ');
  11212. },
  11213. //替换URL中的数据
  11214. replaceurl: function (url, row, table) {
  11215. var options = table ? table.bootstrapTable('getOptions') : null;
  11216. var ids = options ? row[options.pk] : 0;
  11217. row.ids = ids ? ids : (typeof row.ids !== 'undefined' ? row.ids : 0);
  11218. url = url == null || url.length === 0 ? '' : url.toString();
  11219. //自动添加ids参数
  11220. url = !url.match(/\{ids\}/i) ? url + (url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + '{ids}' : url;
  11221. url = url.replace(/\{(.*?)\}/gi, function (matched) {
  11222. matched = matched.substring(1, matched.length - 1);
  11223. if (matched.indexOf(".") !== -1) {
  11224. var temp = row;
  11225. var arr = matched.split(/\./);
  11226. for (var i = 0; i < arr.length; i++) {
  11227. if (typeof temp[arr[i]] !== 'undefined') {
  11228. temp = temp[arr[i]];
  11229. }
  11230. }
  11231. return typeof temp === 'object' ? '' : temp;
  11232. }
  11233. return row[matched];
  11234. });
  11235. return url;
  11236. },
  11237. // 获取选中的条目ID集合
  11238. selectedids: function (table, current) {
  11239. var options = table.bootstrapTable('getOptions');
  11240. //如果有设置翻页记忆模式
  11241. if (!current && options.maintainSelected) {
  11242. return options.selectedIds;
  11243. }
  11244. return $.map(table.bootstrapTable('getSelections'), function (row) {
  11245. return row[options.pk];
  11246. });
  11247. },
  11248. //获取选中的数据
  11249. selecteddata: function (table, current) {
  11250. var options = table.bootstrapTable('getOptions');
  11251. //如果有设置翻页记忆模式
  11252. if (!current && options.maintainSelected) {
  11253. return options.selectedData;
  11254. }
  11255. return table.bootstrapTable('getSelections');
  11256. },
  11257. // 切换复选框状态
  11258. toggleattr: function (table) {
  11259. $("input[type='checkbox']", table).trigger('click');
  11260. },
  11261. // 根据行索引获取行数据
  11262. getrowdata: function (table, index) {
  11263. index = parseInt(index);
  11264. var data = table.bootstrapTable('getData');
  11265. return typeof data[index] !== 'undefined' ? data[index] : null;
  11266. },
  11267. // 根据行索引获取行数据
  11268. getrowbyindex: function (table, index) {
  11269. return Table.api.getrowdata(table, index);
  11270. },
  11271. // 根据主键ID获取行数据
  11272. getrowbyid: function (table, id) {
  11273. var row = {};
  11274. var options = table.bootstrapTable("getOptions");
  11275. $.each(Table.api.selecteddata(table), function (i, j) {
  11276. if (j[options.pk] == id) {
  11277. row = j;
  11278. return false;
  11279. }
  11280. });
  11281. return row;
  11282. }
  11283. },
  11284. };
  11285. return Table;
  11286. });
  11287. // jQuery List DragSort v0.5.2
  11288. // Website: http://dragsort.codeplex.com/
  11289. // License: http://dragsort.codeplex.com/license
  11290. (function($) {
  11291. $.fn.dragsort = function(options) {
  11292. if (options == "destroy") {
  11293. $(this.selector).trigger("dragsort-uninit");
  11294. return;
  11295. }
  11296. var opts = $.extend({}, $.fn.dragsort.defaults, options);
  11297. var lists = [];
  11298. var list = null, lastPos = null;
  11299. this.each(function(i, cont) {
  11300. //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
  11301. if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody"))
  11302. cont = $(cont).children().get(0);
  11303. var newList = {
  11304. draggedItem: null,
  11305. placeHolderItem: null,
  11306. pos: null,
  11307. offset: null,
  11308. offsetLimit: null,
  11309. scroll: null,
  11310. container: cont,
  11311. init: function() {
  11312. //set options to default values if not set
  11313. opts.tagName = opts.tagName == "" ? ($(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase()) : opts.tagName;
  11314. if (opts.itemSelector == "")
  11315. opts.itemSelector = opts.tagName;
  11316. if (opts.dragSelector == "")
  11317. opts.dragSelector = opts.tagName;
  11318. if (opts.placeHolderTemplate == "")
  11319. opts.placeHolderTemplate = "<" + opts.tagName + ">&nbsp;</" + opts.tagName + ">";
  11320. //listidx allows reference back to correct list variable instance
  11321. $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit);
  11322. this.styleDragHandlers(true);
  11323. },
  11324. uninit: function() {
  11325. var list = lists[$(this).attr("data-listidx")];
  11326. $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit");
  11327. list.styleDragHandlers(false);
  11328. },
  11329. getItems: function() {
  11330. return $(this.container).children(opts.itemSelector);
  11331. },
  11332. styleDragHandlers: function(cursor) {
  11333. this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : "");
  11334. },
  11335. grabItem: function(e) {
  11336. var list = lists[$(this).attr("data-listidx")];
  11337. var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0);
  11338. var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0;
  11339. //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return
  11340. if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem)
  11341. return;
  11342. //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,
  11343. //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude
  11344. //e.preventDefault();
  11345. //change cursor to move while dragging
  11346. var dragHandle = e.target;
  11347. while (!$(dragHandle).is(opts.dragSelector)) {
  11348. if (dragHandle == this) return;
  11349. dragHandle = dragHandle.parentNode;
  11350. }
  11351. $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor"));
  11352. $(dragHandle).css("cursor", "move");
  11353. //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work
  11354. var listElem = this;
  11355. var trigger = function() {
  11356. list.dragStart.call(listElem, e);
  11357. $(list.container).unbind("mousemove", trigger);
  11358. };
  11359. $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); });
  11360. },
  11361. dragStart: function(e) {
  11362. if (list != null && list.draggedItem != null)
  11363. list.dropItem();
  11364. list = lists[$(this).attr("data-listidx")];
  11365. list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName)
  11366. //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
  11367. list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem));
  11368. //calculate mouse offset relative to draggedItem
  11369. var mt = parseInt(list.draggedItem.css("marginTop"));
  11370. var ml = parseInt(list.draggedItem.css("marginLeft"));
  11371. list.offset = list.draggedItem.offset();
  11372. list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1;
  11373. list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1;
  11374. //calculate box the dragged item can't be dragged outside of
  11375. if (!opts.dragBetween) {
  11376. 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();
  11377. list.offsetLimit = $(list.container).offset();
  11378. list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth();
  11379. list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
  11380. }
  11381. //create placeholder item
  11382. var h = list.draggedItem.height();
  11383. var w = list.draggedItem.width();
  11384. if (opts.tagName == "tr") {
  11385. list.draggedItem.children().each(function() { $(this).width($(this).width()); });
  11386. list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true);
  11387. list.draggedItem.after(list.placeHolderItem);
  11388. //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html("&nbsp;"); });
  11389. list.placeHolderItem.children().each(function() { $(this).html("&nbsp;"); });
  11390. } else {
  11391. list.draggedItem.after(opts.placeHolderTemplate);
  11392. list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true);
  11393. }
  11394. if (opts.tagName == "td") {
  11395. var listTable = list.draggedItem.closest("table").get(0);
  11396. $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").appendTo("body").children().append(list.draggedItem);
  11397. }
  11398. //style draggedItem while dragging
  11399. var orig = list.draggedItem.attr("style");
  11400. list.draggedItem.attr("data-origstyle", orig ? orig : "");
  11401. list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w });
  11402. //auto-scroll setup
  11403. list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() };
  11404. list.scroll.scrollY = window.setInterval(function() {
  11405. if (opts.scrollContainer != window) {
  11406. $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY);
  11407. return;
  11408. }
  11409. var t = $(opts.scrollContainer).scrollTop();
  11410. if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) {
  11411. $(opts.scrollContainer).scrollTop(t + list.scroll.moveY);
  11412. list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1);
  11413. }
  11414. }, 10);
  11415. list.scroll.scrollX = window.setInterval(function() {
  11416. if (opts.scrollContainer != window) {
  11417. $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX);
  11418. return;
  11419. }
  11420. var l = $(opts.scrollContainer).scrollLeft();
  11421. if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) {
  11422. $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX);
  11423. list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1);
  11424. }
  11425. }, 10);
  11426. //misc
  11427. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  11428. list.setPos(e.pageX, e.pageY);
  11429. $(document).bind("mousemove", list.swapItems);
  11430. $(document).bind("mouseup", list.dropItem);
  11431. if (opts.scrollContainer != window)
  11432. $(window).bind("wheel", list.wheel);
  11433. },
  11434. //set position of draggedItem
  11435. setPos: function(x, y) {
  11436. //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner
  11437. var top = y - this.offset.top;
  11438. var left = x - this.offset.left;
  11439. //limit top, left to within box draggedItem can't be dragged outside of
  11440. if (!opts.dragBetween) {
  11441. top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
  11442. left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
  11443. }
  11444. //adjust top & left calculations to parent offset
  11445. var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin
  11446. if (parent != null) {
  11447. top -= parent.top;
  11448. left -= parent.left;
  11449. }
  11450. //set x or y auto-scroll amount
  11451. if (opts.scrollContainer == window) {
  11452. y -= $(window).scrollTop();
  11453. x -= $(window).scrollLeft();
  11454. y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5);
  11455. x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5);
  11456. } else {
  11457. var cont = $(opts.scrollContainer);
  11458. var offset = cont.offset();
  11459. y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top);
  11460. x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left);
  11461. }
  11462. list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x);
  11463. list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y);
  11464. //move draggedItem to new mouse cursor location
  11465. this.draggedItem.css({ top: top, left: left });
  11466. },
  11467. //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over
  11468. wheel: function(e) {
  11469. if (list && opts.scrollContainer != window) {
  11470. var cont = $(opts.scrollContainer);
  11471. var offset = cont.offset();
  11472. e = e.originalEvent;
  11473. if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) {
  11474. var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY;
  11475. cont.scrollTop(cont.scrollTop() + deltaY);
  11476. e.preventDefault();
  11477. }
  11478. }
  11479. },
  11480. //build a table recording all the positions of the moveable list items
  11481. buildPositionTable: function() {
  11482. var pos = [];
  11483. this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) {
  11484. var loc = $(this).offset();
  11485. loc.right = loc.left + $(this).outerWidth();
  11486. loc.bottom = loc.top + $(this).outerHeight();
  11487. loc.elm = this;
  11488. pos[i] = loc;
  11489. });
  11490. this.pos = pos;
  11491. },
  11492. dropItem: function() {
  11493. if (list.draggedItem == null)
  11494. return;
  11495. //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower
  11496. //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower)
  11497. var orig = list.draggedItem.attr("data-origstyle");
  11498. list.draggedItem.attr("style", orig);
  11499. if (orig == "")
  11500. list.draggedItem.removeAttr("style");
  11501. list.draggedItem.removeAttr("data-origstyle");
  11502. list.styleDragHandlers(true);
  11503. list.placeHolderItem.before(list.draggedItem);
  11504. list.placeHolderItem.remove();
  11505. $("[data-droptarget], .dragSortItem").remove();
  11506. window.clearInterval(list.scroll.scrollY);
  11507. window.clearInterval(list.scroll.scrollX);
  11508. //if position changed call dragEnd
  11509. if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem))
  11510. if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order
  11511. var pos = list.draggedItem.attr("data-origpos").split('-');
  11512. var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]);
  11513. if (nextItem.size() > 0)
  11514. nextItem.before(list.draggedItem);
  11515. else if (pos[1] == 0) //was the only item in list
  11516. $(lists[pos[0]].container).prepend(list.draggedItem);
  11517. else //was the last item in list
  11518. $(lists[pos[0]].container).append(list.draggedItem);
  11519. }
  11520. list.draggedItem.removeAttr("data-origpos");
  11521. list.draggedItem = null;
  11522. $(document).unbind("mousemove", list.swapItems);
  11523. $(document).unbind("mouseup", list.dropItem);
  11524. if (opts.scrollContainer != window)
  11525. $(window).unbind("wheel", list.wheel);
  11526. return false;
  11527. },
  11528. //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of
  11529. swapItems: function(e) {
  11530. if (list.draggedItem == null)
  11531. return false;
  11532. //move draggedItem to mouse location
  11533. list.setPos(e.pageX, e.pageY);
  11534. //retrieve list and item position mouse cursor is over
  11535. var ei = list.findPos(e.pageX, e.pageY);
  11536. var nlist = list;
  11537. for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) {
  11538. ei = lists[i].findPos(e.pageX, e.pageY);
  11539. nlist = lists[i];
  11540. }
  11541. //if not over another moveable list item return
  11542. if (ei == -1)
  11543. return false;
  11544. //save fixed items locations
  11545. var children = function() { return $(nlist.container).children().not(nlist.draggedItem); };
  11546. var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); });
  11547. //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after
  11548. if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left)
  11549. $(nlist.pos[ei].elm).before(list.placeHolderItem);
  11550. else
  11551. $(nlist.pos[ei].elm).after(list.placeHolderItem);
  11552. //restore fixed items location
  11553. fixed.each(function() {
  11554. var elm = children().eq(this.idx).get(0);
  11555. if (this != elm && children().index(this) < this.idx)
  11556. $(this).insertAfter(elm);
  11557. else if (this != elm)
  11558. $(this).insertBefore(elm);
  11559. });
  11560. //misc
  11561. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  11562. lastPos = list.draggedItem.offset();
  11563. return false;
  11564. },
  11565. //returns the index of the list item the mouse is over
  11566. findPos: function(x, y) {
  11567. for (var i = 0; i < this.pos.length; i++) {
  11568. if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y)
  11569. return i;
  11570. }
  11571. return -1;
  11572. },
  11573. //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position
  11574. createDropTargets: function() {
  11575. if (!opts.dragBetween)
  11576. return;
  11577. $(lists).each(function() {
  11578. var ph = $(this.container).find("[data-placeholder]");
  11579. var dt = $(this.container).find("[data-droptarget]");
  11580. if (ph.size() > 0 && dt.size() > 0)
  11581. dt.remove();
  11582. else if (ph.size() == 0 && dt.size() == 0) {
  11583. if (opts.tagName == "td")
  11584. $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container);
  11585. else
  11586. //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8)
  11587. $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true));
  11588. list.placeHolderItem.attr("data-placeholder", true);
  11589. }
  11590. });
  11591. }
  11592. };
  11593. newList.init();
  11594. lists.push(newList);
  11595. });
  11596. return this;
  11597. };
  11598. $.fn.dragsort.defaults = {
  11599. tagName:"",
  11600. itemSelector: "",
  11601. dragSelector: "",
  11602. dragSelectorExclude: "input, textarea",
  11603. dragEnd: function() { },
  11604. dragBetween: false,
  11605. placeHolderTemplate: "",
  11606. scrollContainer: window,
  11607. scrollSpeed: 5
  11608. };
  11609. })(jQuery);
  11610. define("dragsort", function(){});
  11611. /*!
  11612. * jquery.event.drag - v 2.2
  11613. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  11614. * Open Source MIT License - http://threedubmedia.com/code/license
  11615. */
  11616. ;(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);
  11617. define("drag", function(){});
  11618. /*!
  11619. * jquery.event.drop - v 2.2
  11620. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  11621. * Open Source MIT License - http://threedubmedia.com/code/license
  11622. */
  11623. ;(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);
  11624. define("drop", function(){});
  11625. /**
  11626. * @summary SelectPage
  11627. * @desc Simple and powerful selection plugin
  11628. * @file selectpage.js
  11629. * @version 2.20
  11630. * @author TerryZeng
  11631. * @contact https://terryz.github.io/
  11632. * @license MIT License
  11633. *
  11634. */
  11635. ;(function ($) {
  11636. "use strict";
  11637. /**
  11638. * Default options
  11639. */
  11640. var defaults = {
  11641. /**
  11642. * Data source
  11643. * @type {string|Object}
  11644. *
  11645. * string:server side request url address
  11646. * Object:JSON array,format:[{a:1,b:2,c:3},{...}]
  11647. */
  11648. data: undefined,
  11649. /**
  11650. * Language ('cn', 'en')
  11651. * @type string
  11652. * @default 'cn'
  11653. */
  11654. lang: 'cn',
  11655. /**
  11656. * Multiple select mode(tags)
  11657. * @type boolean
  11658. * @default false
  11659. */
  11660. multiple: false,
  11661. /**
  11662. * pagination or not
  11663. * @type boolean
  11664. * @default true
  11665. */
  11666. pagination: true,
  11667. /**
  11668. * Show up menu button
  11669. * @type boolean
  11670. * @default true
  11671. */
  11672. dropButton: true,
  11673. /**
  11674. * Result list visible size in pagination bar close
  11675. * @type number
  11676. * @default 10
  11677. */
  11678. listSize: 10,
  11679. /**
  11680. * Show control bar in multiple select mode
  11681. * @type boolean
  11682. * @default true
  11683. */
  11684. multipleControlbar: true,
  11685. /**
  11686. * Max selected item limited in multiple select mode
  11687. * @type number
  11688. * @default 0(unlimited)
  11689. */
  11690. maxSelectLimit: 0,
  11691. /**
  11692. * Select result item to close list, work on multiple select mode
  11693. * @type boolean
  11694. * @default false
  11695. */
  11696. selectToCloseList: false,
  11697. /**
  11698. * Init selected item key, the result will match to option.keyField option
  11699. * @type string
  11700. */
  11701. initRecord: undefined,
  11702. /**
  11703. * The table parameter in server side mode
  11704. * @type string
  11705. */
  11706. dbTable: 'tbl',
  11707. /**
  11708. * The value field, the value will fill to hidden element
  11709. * @type string
  11710. * @default 'id'
  11711. */
  11712. keyField: 'id',
  11713. /**
  11714. * The show text field, the text will show to input element or tags(multiple mode)
  11715. * @type string
  11716. * @default 'name'
  11717. */
  11718. showField: 'name',
  11719. /**
  11720. * Actually used to search field
  11721. * @type string
  11722. */
  11723. searchField: undefined,
  11724. /**
  11725. * Search type ('AND' or 'OR')
  11726. * @type string
  11727. * @default 'AND'
  11728. */
  11729. andOr: 'OR',
  11730. /**
  11731. * Used to separate search content
  11732. * @see SelectPage.prototype.suggest()
  11733. */
  11734. separator: ',',
  11735. /**
  11736. * Result sort type
  11737. * @type array|boolean - if not set, will default used showField field
  11738. * @example
  11739. * orderBy : ['id desc']
  11740. */
  11741. orderBy: undefined,
  11742. /**
  11743. * Page size
  11744. * @type number
  11745. * @default 10
  11746. */
  11747. pageSize: 10,
  11748. /**
  11749. * Server side request parameters
  11750. * @type function
  11751. * @return object
  11752. * @example params : function(){return {'name':'aa','sex':1};}
  11753. */
  11754. params: undefined,
  11755. /**
  11756. * Custom result list item show text
  11757. * @type function
  11758. * @param data {object} row data
  11759. * @return string
  11760. */
  11761. formatItem: undefined,
  11762. /**
  11763. * Have some highlight item and lost focus, auto select the highlight item
  11764. * @type boolean
  11765. * @default false
  11766. */
  11767. autoFillResult: false,
  11768. /**
  11769. * Auto select first item in show up result list or search result
  11770. * depend on `autoFillResult` option set to true
  11771. * @type boolean
  11772. * @default false
  11773. */
  11774. autoSelectFirst: false,
  11775. /**
  11776. * Whether clear input element text when enter some keywords to search and no result return
  11777. * @type boolean
  11778. * @default true
  11779. */
  11780. noResultClean: true,
  11781. /**
  11782. * Select only mode
  11783. * @type boolean
  11784. */
  11785. selectOnly: false,
  11786. /**
  11787. * Input to search delay time, work on ajax data source
  11788. * @type number
  11789. * @default 0.5
  11790. */
  11791. inputDelay: 0.5,
  11792. /**
  11793. * -----------------------------------------Callback--------------------------------------------
  11794. */
  11795. /**
  11796. * Result list item selected callback
  11797. * @type function
  11798. * @param object - selected item json data
  11799. * @param self - plugin object
  11800. */
  11801. eSelect: undefined,
  11802. /**
  11803. * Before result list show up callback, you can do anything prepared
  11804. * @param self - plugin object
  11805. */
  11806. eOpen: undefined,
  11807. /**
  11808. * Server side return data convert callback
  11809. * @type function
  11810. * @param data {object} server side return data
  11811. * @param self {object} plugin object
  11812. * @return {object} return data format:
  11813. * @example
  11814. * {
  11815. * list : [{name:'aa',sex:1},{name:'bb',sex:1}...],
  11816. * totalRow : 100
  11817. * }
  11818. */
  11819. eAjaxSuccess: undefined,
  11820. /**
  11821. * Close selected item tag callback (multiple mode)
  11822. * @type function
  11823. * @param removeCount {number} remove item count
  11824. * @param self {object} plugin object
  11825. */
  11826. eTagRemove: undefined,
  11827. /**
  11828. * Clear selected item callback(single select mode)
  11829. * @type function
  11830. * @param self {object} plugin object
  11831. */
  11832. eClear: undefined
  11833. };
  11834. /**
  11835. * SelectPage class definition
  11836. * @constructor
  11837. * @param {Object} input - input element
  11838. * @param {Object} option
  11839. */
  11840. var SelectPage = function (input, option) {
  11841. //特殊字段处理
  11842. $.each({data: 'source', keyField: 'primaryKey', showField: 'field', pageSize: 'perPage'}, function (i, j) {
  11843. if (typeof option[j] !== 'undefined') {
  11844. option[i] = option[j];
  11845. delete option[j];
  11846. }
  11847. });
  11848. this.setOption(option);
  11849. this.setLanguage();
  11850. this.setCssClass();
  11851. this.setProp();
  11852. this.setElem(input);
  11853. this.setButtonAttrDefault();
  11854. this.setInitRecord();
  11855. this.eDropdownButton();
  11856. this.eInput();
  11857. this.eWhole();
  11858. };
  11859. /**
  11860. * Plugin version number
  11861. */
  11862. SelectPage.version = '2.19';
  11863. /**
  11864. * Plugin object cache key
  11865. */
  11866. SelectPage.dataKey = 'selectPageObject';
  11867. /**
  11868. * Options set
  11869. * @param {Object} option
  11870. */
  11871. SelectPage.prototype.setOption = function (option) {
  11872. //use showField to default
  11873. option.searchField = option.searchField || option.showField;
  11874. option.andOr = option.andOr.toUpperCase();
  11875. if (option.andOr !== 'AND' && option.andOr !== 'OR') option.andOr = 'AND';
  11876. //support multiple field set
  11877. var arr = ['searchField'];
  11878. for (var i = 0; i < arr.length; i++) {
  11879. option[arr[i]] = this.strToArray(option[arr[i]]);
  11880. }
  11881. //set default order field
  11882. option.orderBy = option.orderBy || option.showField;
  11883. //set multiple order field
  11884. //example: [ ['id', 'ASC'], ['name', 'DESC'] ]
  11885. if (option.orderBy !== false) option.orderBy = this.setOrderbyOption(option.orderBy, option.showField);
  11886. //close auto fill result and auto select first in multiple mode and select item not close list
  11887. if (option.multiple && !option.selectToCloseList) {
  11888. option.autoFillResult = false;
  11889. option.autoSelectFirst = false;
  11890. }
  11891. //show all item when pagination bar close, limited 200
  11892. if (!option.pagination) option.pageSize = 200;
  11893. if ($.type(option.listSize) !== 'number' || option.listSize < 0) option.listSize = 10;
  11894. if (typeof option.formatItem === 'string') {
  11895. var _formatItem = option.formatItem;
  11896. option.formatItem = function (row) {
  11897. if (typeof Template === 'function' && _formatItem.match(/\#([a-zA-Z0-9_\-]+)$/)) {
  11898. return Template(_formatItem.substring(1), row);
  11899. } else {
  11900. return _formatItem.replace(/\{(.*?)\}/gi, function (matched) {
  11901. matched = matched.substring(1, matched.length - 1);
  11902. return typeof row[matched] !== 'undefined' ? row[matched] : '';
  11903. });
  11904. }
  11905. };
  11906. }
  11907. this.option = option;
  11908. };
  11909. /**
  11910. * String convert to array
  11911. * @param str {string}
  11912. * @return {Array}
  11913. */
  11914. SelectPage.prototype.strToArray = function (str) {
  11915. return str ? str.replace(/[\s ]+/g, '').split(',') : '';
  11916. };
  11917. /**
  11918. * Set order field
  11919. * @param {Array} arg_order
  11920. * @param {string} arg_field - default sort field
  11921. * @return {Array}
  11922. */
  11923. SelectPage.prototype.setOrderbyOption = function (arg_order, arg_field) {
  11924. var arr = [], orders = [];
  11925. if (typeof arg_order === 'object') {
  11926. for (var i = 0; i < arg_order.length; i++) {
  11927. orders = $.trim(arg_order[i]).split(' ');
  11928. if (orders.length)
  11929. arr.push((orders.length === 2) ? orders.concat() : [orders[0], 'ASC']);
  11930. }
  11931. } else {
  11932. orders = $.trim(arg_order).split(' ');
  11933. arr[0] = (orders.length === 2) ? orders.concat() : (orders[0].toUpperCase().match(/^(ASC|DESC)$/i)) ? [arg_field, orders[0].toUpperCase()] : [orders[0], 'ASC'];
  11934. }
  11935. return arr;
  11936. };
  11937. /**
  11938. * i18n
  11939. */
  11940. SelectPage.prototype.setLanguage = function () {
  11941. var message, p = this.option;
  11942. switch (p.lang) {
  11943. // English
  11944. case 'en':
  11945. message = {
  11946. add_btn: 'Add button',
  11947. add_title: 'add a box',
  11948. del_btn: 'Del button',
  11949. del_title: 'delete a box',
  11950. next: 'Next',
  11951. next_title: 'Next' + p.pageSize + ' (Right key)',
  11952. prev: 'Prev',
  11953. prev_title: 'Prev' + p.pageSize + ' (Left key)',
  11954. first_title: 'First (Shift + Left key)',
  11955. last_title: 'Last (Shift + Right key)',
  11956. get_all_btn: 'Get All (Down key)',
  11957. get_all_alt: '(button)',
  11958. close_btn: 'Close (Tab key)',
  11959. close_alt: '(button)',
  11960. loading: 'loading...',
  11961. loading_alt: '(loading)',
  11962. page_info: 'page_num of page_count',
  11963. select_ng: 'Attention : Please choose from among the list.',
  11964. select_ok: 'OK : Correctly selected.',
  11965. not_found: 'not found',
  11966. ajax_error: 'An error occurred while connecting to server.',
  11967. clear: 'Clear content',
  11968. select_all: 'Select current page',
  11969. unselect_all: 'Clear current page',
  11970. clear_all: 'Clear all selected',
  11971. max_selected: 'You can only select up to max_selected_limit items'
  11972. };
  11973. break;
  11974. // 中文
  11975. case 'cn':
  11976. default:
  11977. message = {
  11978. add_btn: '添加按钮',
  11979. add_title: '添加区域',
  11980. del_btn: '删除按钮',
  11981. del_title: '删除区域',
  11982. next: '下一页',
  11983. next_title: '下' + p.pageSize + ' (→)',
  11984. prev: '上一页',
  11985. prev_title: '上' + p.pageSize + ' (←)',
  11986. first_title: '首页 (Shift + ←)',
  11987. last_title: '尾页 (Shift + →)',
  11988. get_all_btn: '获得全部 (↓)',
  11989. get_all_alt: '(按钮)',
  11990. close_btn: '关闭 (Tab键)',
  11991. close_alt: '(按钮)',
  11992. loading: '读取中...',
  11993. loading_alt: '(读取中)',
  11994. page_info: '第 page_num 页(共page_count页)',
  11995. select_ng: '请注意:请从列表中选择.',
  11996. select_ok: 'OK : 已经选择.',
  11997. not_found: '无查询结果',
  11998. ajax_error: '连接到服务器时发生错误!',
  11999. clear: '清除内容',
  12000. select_all: '选择当前页项目',
  12001. unselect_all: '取消选择当前页项目',
  12002. clear_all: '清除全部已选择项目',
  12003. max_selected: '最多只能选择 max_selected_limit 个项目'
  12004. };
  12005. break;
  12006. }
  12007. this.message = message;
  12008. };
  12009. /**
  12010. * Css classname defined
  12011. */
  12012. SelectPage.prototype.setCssClass = function () {
  12013. var css_class = {
  12014. container: 'sp_container',
  12015. container_open: 'sp_container_open',
  12016. re_area: 'sp_result_area',
  12017. result_open: 'sp_result_area_open',
  12018. control_box: 'sp_control_box',
  12019. //multiple select mode
  12020. element_box: 'sp_element_box',
  12021. navi: 'sp_navi',
  12022. //result list
  12023. results: 'sp_results',
  12024. re_off: 'sp_results_off',
  12025. select: 'sp_over',
  12026. select_ok: 'sp_select_ok',
  12027. select_ng: 'sp_select_ng',
  12028. selected: 'sp_selected',
  12029. input_off: 'sp_input_off',
  12030. message_box: 'sp_message_box',
  12031. disabled: 'sp_disabled',
  12032. button: 'sp_button',
  12033. caret_open: 'sp_caret_open',
  12034. btn_on: 'sp_btn_on',
  12035. btn_out: 'sp_btn_out',
  12036. input: 'sp_input',
  12037. clear_btn: 'sp_clear_btn',
  12038. align_right: 'sp_align_right'
  12039. };
  12040. this.css_class = css_class;
  12041. };
  12042. /**
  12043. * Plugin inner properties
  12044. */
  12045. SelectPage.prototype.setProp = function () {
  12046. this.prop = {
  12047. //input disabled status
  12048. disabled: false,
  12049. current_page: 1,
  12050. //total page
  12051. max_page: 1,
  12052. //ajax data loading status
  12053. is_loading: false,
  12054. xhr: false,
  12055. key_paging: false,
  12056. key_select: false,
  12057. //last selected item value
  12058. prev_value: '',
  12059. //last selected item text
  12060. selected_text: '',
  12061. last_input_time: undefined,
  12062. init_set: false
  12063. };
  12064. this.template = {
  12065. tag: {
  12066. content: '<li class="selected_tag" itemvalue="#item_value#">#item_text#<span class="tag_close"><i class="spfont sp-close"></i></span></li>',
  12067. textKey: '#item_text#',
  12068. valueKey: '#item_value#'
  12069. },
  12070. page: {
  12071. current: 'page_num',
  12072. total: 'page_count'
  12073. },
  12074. msg: {
  12075. maxSelectLimit: 'max_selected_limit'
  12076. }
  12077. };
  12078. };
  12079. /**
  12080. * Get the actual width/height of invisible DOM elements with jQuery.
  12081. * Source code come from dreamerslab/jquery.actual
  12082. * @param element
  12083. * @param method
  12084. * @returns {*}
  12085. */
  12086. SelectPage.prototype.elementRealSize = function (element, method) {
  12087. var defaults = {
  12088. absolute: false,
  12089. clone: false,
  12090. includeMargin: false,
  12091. display: 'block'
  12092. };
  12093. var configs = defaults, $target = element.eq(0), fix, restore, tmp = [], style = '', $hidden;
  12094. fix = function () {
  12095. // get all hidden parents
  12096. $hidden = $target.parents().addBack().filter(':hidden');
  12097. style += 'visibility: hidden !important; display: ' + configs.display + ' !important; ';
  12098. if (configs.absolute === true) style += 'position: absolute !important;';
  12099. // save the origin style props
  12100. // set the hidden el css to be got the actual value later
  12101. $hidden.each(function () {
  12102. // Save original style. If no style was set, attr() returns undefined
  12103. var $this = $(this), thisStyle = $this.attr('style');
  12104. tmp.push(thisStyle);
  12105. // Retain as much of the original style as possible, if there is one
  12106. $this.attr('style', thisStyle ? thisStyle + ';' + style : style);
  12107. });
  12108. };
  12109. restore = function () {
  12110. // restore origin style values
  12111. $hidden.each(function (i) {
  12112. var $this = $(this), _tmp = tmp[i];
  12113. if (_tmp === undefined) $this.removeAttr('style');
  12114. else $this.attr('style', _tmp);
  12115. });
  12116. };
  12117. fix();
  12118. // get the actual value with user specific methed
  12119. // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc
  12120. // configs.includeMargin only works for 'outerWidth' and 'outerHeight'
  12121. var actual = /(outer)/.test(method) ?
  12122. $target[method](configs.includeMargin) :
  12123. $target[method]();
  12124. restore();
  12125. // IMPORTANT, this plugin only return the value of the first element
  12126. return actual;
  12127. };
  12128. /**
  12129. * Dom building
  12130. * @param {Object} combo_input - original input element
  12131. */
  12132. SelectPage.prototype.setElem = function (combo_input) {
  12133. // 1. build Dom object
  12134. var elem = {}, p = this.option, css = this.css_class, msg = this.message, input = $(combo_input);
  12135. var cssWidth = input.css("width");
  12136. var orgWidth = input.outerWidth();
  12137. if (cssWidth.indexOf("%") > -1 || input.parent().size() > 0 && input.parent().width() == orgWidth) {
  12138. orgWidth = "100%";
  12139. } else {
  12140. // fix input width in hidden situation
  12141. if (orgWidth <= 0) orgWidth = this.elementRealSize(input, 'outerWidth');
  12142. if (orgWidth < 150) orgWidth = 150;
  12143. }
  12144. elem.combo_input = input.attr({'autocomplete': 'off'}).addClass(css.input).wrap('<div>');
  12145. if (p.selectOnly) elem.combo_input.prop('readonly', true);
  12146. elem.container = elem.combo_input.parent().addClass(css.container);
  12147. if (elem.combo_input.prop('disabled')) {
  12148. if (p.multiple) elem.container.addClass(css.disabled);
  12149. else elem.combo_input.addClass(css.input_off);
  12150. }
  12151. // set outer box width
  12152. elem.container.width(orgWidth);
  12153. elem.button = $('<div>').addClass(css.button);
  12154. //drop down button
  12155. elem.dropdown = $('<span class="sp_caret"></span>');
  12156. //clear button 'X' in single mode
  12157. elem.clear_btn = $('<div>').html($('<i>').addClass('spfont sp-close')).addClass(css.clear_btn).attr('title', msg.clear);
  12158. if (!p.dropButton) elem.clear_btn.addClass(css.align_right);
  12159. //main box in multiple mode
  12160. elem.element_box = $('<ul>').addClass(css.element_box);
  12161. if (p.multiple && p.multipleControlbar)
  12162. elem.control = $('<div>').addClass(css.control_box);
  12163. //result list box
  12164. elem.result_area = $('<div>').addClass(css.re_area);
  12165. //pagination bar
  12166. if (p.pagination) elem.navi = $('<div>').addClass('sp_pagination').append('<ul>');
  12167. elem.results = $('<ul>').addClass(css.results);
  12168. var namePrefix = '_text',
  12169. input_id = elem.combo_input.attr('id') || elem.combo_input.attr('name'),
  12170. input_name = elem.combo_input.attr('name') || 'selectPage',
  12171. hidden_name = input_name,
  12172. hidden_id = input_id;
  12173. //switch the id and name attributes of input/hidden element
  12174. elem.hidden = $('<input type="hidden" class="sp_hidden" />').attr({
  12175. name: hidden_name,
  12176. id: hidden_id
  12177. }).val('');
  12178. elem.combo_input.attr({
  12179. name: typeof input.data('name') !== 'undefined' ? input.data('name') : input_name + namePrefix,
  12180. id: input_id + namePrefix
  12181. });
  12182. elem.hidden.attr("data-rule", elem.combo_input.data("rule") || '');
  12183. elem.combo_input.attr("novalidate", "novalidate");
  12184. // 2. DOM element put
  12185. elem.container.append(elem.hidden);
  12186. if (p.dropButton) {
  12187. elem.container.append(elem.button)
  12188. elem.button.append(elem.dropdown);
  12189. }
  12190. $(document.body).append(elem.result_area);
  12191. elem.result_area.append(elem.results);
  12192. if (p.pagination) elem.result_area.append(elem.navi);
  12193. //Multiple select mode
  12194. if (p.multiple) {
  12195. if (p.multipleControlbar) {
  12196. elem.control.append('<button type="button" class="btn btn-default sp_clear_all" ><i class="spfont sp-clear"></i></button>');
  12197. elem.control.append('<button type="button" class="btn btn-default sp_unselect_all" ><i class="spfont sp-unselect-all"></i></button>');
  12198. elem.control.append('<button type="button" class="btn btn-default sp_select_all" ><i class="spfont sp-select-all"></i></button>');
  12199. elem.control_text = $('<p>');
  12200. elem.control.append(elem.control_text);
  12201. elem.result_area.prepend(elem.control);
  12202. }
  12203. elem.container.addClass('sp_container_combo');
  12204. elem.combo_input.addClass('sp_combo_input').before(elem.element_box);
  12205. var li = $('<li>').addClass('input_box');
  12206. li.append(elem.combo_input);
  12207. elem.element_box.append(li);
  12208. if (elem.combo_input.attr('placeholder')) elem.combo_input.attr('placeholder_bak', elem.combo_input.attr('placeholder'));
  12209. }
  12210. this.elem = elem;
  12211. };
  12212. /**
  12213. * Drop down button set to default
  12214. */
  12215. SelectPage.prototype.setButtonAttrDefault = function () {
  12216. /*
  12217. if (this.option.selectOnly) {
  12218. if ($(this.elem.combo_input).val() !== '') {
  12219. if ($(this.elem.hidden).val() !== '') {
  12220. //选择条件
  12221. $(this.elem.combo_input).attr('title', this.message.select_ok).removeClass(this.css_class.select_ng).addClass(this.css_class.select_ok);
  12222. } else {
  12223. //输入方式
  12224. $(this.elem.combo_input).attr('title', this.message.select_ng).removeClass(this.css_class.select_ok).addClass(this.css_class.select_ng);
  12225. }
  12226. } else {
  12227. $(this.elem.hidden).val('');
  12228. $(this.elem.combo_input).removeAttr('title').removeClass(this.css_class.select_ng);
  12229. }
  12230. }
  12231. */
  12232. //this.elem.button.attr('title', this.message.get_all_btn);
  12233. if (this.option.dropButton)
  12234. this.elem.button.attr('title', this.message.close_btn);
  12235. };
  12236. /**
  12237. * Set item need selected after init
  12238. * set selected item ways:
  12239. * <input value="key">
  12240. * <input data-init="key">
  12241. */
  12242. SelectPage.prototype.setInitRecord = function (refresh) {
  12243. var self = this, p = self.option, el = self.elem, key = '';
  12244. if ($.type(el.combo_input.data('init')) != 'undefined')
  12245. p.initRecord = String(el.combo_input.data('init'));
  12246. //data-init and value attribute can be init plugin selected item
  12247. //but, if set data-init and value attribute in the same time, plugin will choose data-init attribute first
  12248. if (!refresh && !p.initRecord && el.combo_input.val())
  12249. p.initRecord = el.combo_input.val();
  12250. el.combo_input.val('');
  12251. if (!refresh) el.hidden.val(p.initRecord);
  12252. key = refresh && el.hidden.val() ? el.hidden.val() : p.initRecord;
  12253. if (key) {
  12254. if (typeof p.data === 'object') {
  12255. var data = new Array();
  12256. var keyarr = key.split(',');
  12257. $.each(keyarr, function (index, row) {
  12258. for (var i = 0; i < p.data.length; i++) {
  12259. if (p.data[i][p.keyField] == row) {
  12260. data.push(p.data[i]);
  12261. break;
  12262. }
  12263. }
  12264. });
  12265. if (!p.multiple && data.length > 1) data = [data[0]];
  12266. self.afterInit(self, data);
  12267. } else {//ajax data source mode to init selected item
  12268. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  12269. var _orgParams = {
  12270. searchTable: p.dbTable,
  12271. searchKey: p.keyField,
  12272. searchValue: key,
  12273. orderBy: p.orderBy,
  12274. showField: p.showField,
  12275. keyField: p.keyField,
  12276. keyValue: key,
  12277. searchField: p.searchField
  12278. };
  12279. if (_paramsFunc) {
  12280. var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
  12281. if (result && $.isPlainObject(result)) {
  12282. _params = $.extend({}, _orgParams, result);
  12283. } else {
  12284. _params = _orgParams;
  12285. }
  12286. } else {
  12287. _params = _orgParams;
  12288. }
  12289. $.ajax({
  12290. dataType: 'json',
  12291. type: 'POST',
  12292. url: p.data,
  12293. data: _params,
  12294. success: function (json) {
  12295. var d = null;
  12296. if (p.eAjaxSuccess && $.isFunction(p.eAjaxSuccess))
  12297. d = p.eAjaxSuccess(json);
  12298. self.afterInit(self, d.list);
  12299. },
  12300. error: function (jqXHR, textStatus, errorThrown) {
  12301. self.ajaxErrorNotify(self, errorThrown);
  12302. }
  12303. });
  12304. }
  12305. }
  12306. };
  12307. /**
  12308. * Selected item set to plugin
  12309. * @param {Object} self
  12310. * @param {Object} data - selected item data
  12311. */
  12312. SelectPage.prototype.afterInit = function (self, data) {
  12313. if (!data || ($.isArray(data) && data.length === 0)) return;
  12314. if (!$.isArray(data)) data = [data];
  12315. var p = self.option, css = self.css_class;
  12316. self.data = data;
  12317. if (p.multiple) {
  12318. self.prop.init_set = true;
  12319. self.clearAll(self);
  12320. $.each(data, function (i, row) {
  12321. var value = row[p.keyField];
  12322. var text = row[p.showField];
  12323. var item = {text: text, value: value};
  12324. if (!self.isAlreadySelected(self, item)) self.addNewTag(self, row, item);
  12325. });
  12326. self.tagValuesSet(self);
  12327. self.inputResize(self);
  12328. self.elem.hidden.blur();
  12329. self.prop.init_set = false;
  12330. } else {
  12331. var row = data[0];
  12332. var value = row[p.keyField];
  12333. var text = row[p.showField];
  12334. self.elem.combo_input.val(text);
  12335. self.elem.hidden.val(value);
  12336. self.prop.prev_value = text;
  12337. self.prop.selected_text = text;
  12338. if (p.selectOnly) {
  12339. self.elem.combo_input.attr('title', self.message.select_ok).removeClass(css.select_ng).addClass(css.select_ok);
  12340. }
  12341. self.putClearButton();
  12342. }
  12343. };
  12344. /**
  12345. * Drop down button event bind
  12346. */
  12347. SelectPage.prototype.eDropdownButton = function () {
  12348. var self = this;
  12349. if (self.option.dropButton) {
  12350. self.elem.button.mouseup(function (ev) {
  12351. ev.stopPropagation();
  12352. if (self.elem.result_area.is(':hidden') && !self.elem.combo_input.prop('disabled')) {
  12353. self.elem.combo_input.focus();
  12354. } else self.hideResults(self);
  12355. });
  12356. }
  12357. };
  12358. /**
  12359. * Events bind
  12360. */
  12361. SelectPage.prototype.eInput = function () {
  12362. var self = this, p = self.option, el = self.elem, msg = self.message;
  12363. var showList = function () {
  12364. self.prop.page_move = false;
  12365. self.suggest(self);
  12366. self.setCssFocusedInput(self);
  12367. };
  12368. el.combo_input.keyup(function (e) {
  12369. self.processKey(self, e);
  12370. }).keydown(function (e) {
  12371. self.processControl(self, e);
  12372. }).focus(function (e) {
  12373. //When focus on input, show the result list
  12374. if (el.result_area.is(':hidden')) {
  12375. e.stopPropagation();
  12376. self.prop.first_show = true;
  12377. showList();
  12378. }
  12379. });
  12380. el.container.on('click.SelectPage', 'div.' + self.css_class.clear_btn, function (e) {
  12381. e.stopPropagation();
  12382. if (!self.disabled(self)) {
  12383. self.clearAll(self, true);
  12384. self.elem.hidden.change();
  12385. if (p.eClear && $.isFunction(p.eClear)) p.eClear(self);
  12386. }
  12387. });
  12388. el.result_area.on('mousedown.SelectPage', function (e) {
  12389. e.stopPropagation();
  12390. });
  12391. if (p.multiple) {
  12392. if (p.multipleControlbar) {
  12393. //Select all item of current page
  12394. el.control.find('.sp_select_all').on('click.SelectPage', function (e) {
  12395. self.selectAllLine(self);
  12396. }).hover(function () {
  12397. el.control_text.html(msg.select_all);
  12398. }, function () {
  12399. el.control_text.html('');
  12400. });
  12401. //Cancel select all item of current page
  12402. el.control.find('.sp_unselect_all').on('click.SelectPage', function (e) {
  12403. self.unSelectAllLine(self);
  12404. }).hover(function () {
  12405. el.control_text.html(msg.unselect_all);
  12406. }, function () {
  12407. el.control_text.html('');
  12408. });
  12409. //Clear all selected item
  12410. el.control.find('.sp_clear_all').on('click.SelectPage', function (e) {
  12411. self.clearAll(self, true);
  12412. }).hover(function () {
  12413. el.control_text.html(msg.clear_all);
  12414. }, function () {
  12415. el.control_text.html('');
  12416. });
  12417. }
  12418. el.element_box.on('click.SelectPage', function (e) {
  12419. var srcEl = e.target || e.srcElement;
  12420. if ($(srcEl).is('ul')) el.combo_input.focus();
  12421. });
  12422. //Tag close
  12423. el.element_box.on('click.SelectPage', 'span.tag_close', function () {
  12424. var li = $(this).closest('li'), data = li.data('dataObj');
  12425. self.removeTag(self, li);
  12426. showList();
  12427. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove([data]);
  12428. });
  12429. self.inputResize(self);
  12430. }
  12431. };
  12432. /**
  12433. * Out of plugin area click event handler
  12434. */
  12435. SelectPage.prototype.eWhole = function () {
  12436. var self = this, css = self.css_class;
  12437. var cleanContent = function (obj) {
  12438. obj.elem.combo_input.val('');
  12439. if (!obj.option.multiple) obj.elem.hidden.val('');
  12440. obj.prop.selected_text = '';
  12441. };
  12442. //Out of plugin area
  12443. $(document.body).off('mousedown.selectPage').on('mousedown.selectPage', function (e) {
  12444. var ele = e.target || e.srcElement;
  12445. var sp = $(ele).closest('div.' + css.container);
  12446. //Open status result list
  12447. $('div.' + css.container + '.' + css.container_open).each(function () {
  12448. if (this == sp[0]) return;
  12449. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey);
  12450. if (!d.elem.combo_input.val() && d.elem.hidden.val() && !d.option.multiple) {
  12451. d.prop.current_page = 1;//reset page to 1
  12452. cleanContent(d);
  12453. d.hideResults(d);
  12454. return true;
  12455. }
  12456. if (d.elem.results.find('li').not('.' + css.message_box).length) {
  12457. if (d.option.autoFillResult) {
  12458. //have selected item, then hide result list
  12459. if (d.elem.hidden.val()) d.hideResults(d);
  12460. else if (d.elem.results.find('li.sp_over').length) {
  12461. //no one selected and have highlight item, select the highlight item
  12462. d.selectCurrentLine(d, true);
  12463. } else if (d.option.autoSelectFirst) {
  12464. //no one selected, no one highlight, select the first item
  12465. d.nextLine(d);
  12466. d.selectCurrentLine(d, true);
  12467. } else d.hideResults(d);
  12468. } else d.hideResults(d);
  12469. } else {
  12470. //when no one item match, clear search keywords
  12471. if (d.option.noResultClean) cleanContent(d);
  12472. else {
  12473. if (!d.option.multiple) d.elem.hidden.val('');
  12474. }
  12475. d.hideResults(d);
  12476. }
  12477. });
  12478. });
  12479. };
  12480. /**
  12481. * Result list event bind
  12482. */
  12483. SelectPage.prototype.eResultList = function () {
  12484. var self = this, css = this.css_class;
  12485. self.elem.results.children('li').hover(function () {
  12486. if (self.prop.key_select) {
  12487. self.prop.key_select = false;
  12488. return;
  12489. }
  12490. if (!$(this).hasClass(css.selected) && !$(this).hasClass(css.message_box)) {
  12491. $(this).addClass(css.select);
  12492. self.setCssFocusedResults(self);
  12493. }
  12494. }, function () {
  12495. $(this).removeClass(css.select);
  12496. }).click(function (e) {
  12497. if (self.prop.key_select) {
  12498. self.prop.key_select = false;
  12499. return;
  12500. }
  12501. e.preventDefault();
  12502. e.stopPropagation();
  12503. if (!$(this).hasClass(css.selected)) self.selectCurrentLine(self, false);
  12504. });
  12505. };
  12506. /**
  12507. * Reposition result list when list beyond the visible area
  12508. */
  12509. SelectPage.prototype.eScroll = function () {
  12510. var self = this, css = this.css_class;
  12511. $(window).on('scroll.SelectPage', function (e) {
  12512. $('div.' + css.container + '.' + css.container_open).each(function () {
  12513. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey),
  12514. offset = d.elem.result_area.offset(),
  12515. screenScrollTop = $(window).scrollTop(),
  12516. docHeight = $(document).height(),
  12517. viewHeight = $(window).height(),
  12518. listHeight = d.elem.result_area.outerHeight(),
  12519. listBottom = offset.top + listHeight,
  12520. hasOverflow = docHeight > viewHeight,
  12521. down = d.elem.result_area.hasClass('shadowDown');
  12522. if (hasOverflow) {
  12523. if (down) {//open down
  12524. if (listBottom > (viewHeight + screenScrollTop)) d.calcResultsSize(d);
  12525. } else {//open up
  12526. if (offset.top < screenScrollTop) d.calcResultsSize(d);
  12527. }
  12528. }
  12529. });
  12530. });
  12531. };
  12532. /**
  12533. * Page bar button event bind
  12534. */
  12535. SelectPage.prototype.ePaging = function () {
  12536. var self = this;
  12537. if (!self.option.pagination) return;
  12538. self.elem.navi.find('li.csFirstPage').off('click').on('click', function (ev) {
  12539. //$(self.elem.combo_input).focus();
  12540. ev.preventDefault();
  12541. self.firstPage(self);
  12542. });
  12543. self.elem.navi.find('li.csPreviousPage').off('click').on('click', function (ev) {
  12544. //$(self.elem.combo_input).focus();
  12545. ev.preventDefault();
  12546. self.prevPage(self);
  12547. });
  12548. self.elem.navi.find('li.csNextPage').off('click').on('click', function (ev) {
  12549. //$(self.elem.combo_input).focus();
  12550. ev.preventDefault();
  12551. self.nextPage(self);
  12552. });
  12553. self.elem.navi.find('li.csLastPage').off('click').on('click', function (ev) {
  12554. //$(self.elem.combo_input).focus();
  12555. ev.preventDefault();
  12556. self.lastPage(self);
  12557. });
  12558. };
  12559. /**
  12560. * Ajax request fail
  12561. * @param {Object} self
  12562. * @param {string} errorThrown
  12563. */
  12564. SelectPage.prototype.ajaxErrorNotify = function (self, errorThrown) {
  12565. self.showMessage(self.message.ajax_error);
  12566. };
  12567. /**
  12568. * Message box
  12569. * @param {Object} self
  12570. * @param msg {string} the text need to show
  12571. */
  12572. SelectPage.prototype.showMessage = function (self, msg) {
  12573. if (!msg) return;
  12574. var msgLi = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' + msg + '</li>';
  12575. self.elem.results.empty().append(msgLi).show();
  12576. self.calcResultsSize(self);
  12577. self.setOpenStatus(self, true);
  12578. self.elem.control.hide();
  12579. if (self.option.pagination) self.elem.navi.hide();
  12580. };
  12581. /**
  12582. * @desc Scroll
  12583. * @param {Object} self
  12584. * @param {boolean} enforce
  12585. */
  12586. SelectPage.prototype.scrollWindow = function (self, enforce) {
  12587. var current_result = self.getCurrentLine(self),
  12588. target_top = (current_result && !enforce) ? current_result.offset().top : self.elem.container.offset().top,
  12589. target_size;
  12590. self.prop.size_li = self.elem.results.children('li:first').outerHeight();
  12591. target_size = self.prop.size_li;
  12592. var gap, client_height = $(window).height(),
  12593. scroll_top = $(window).scrollTop(),
  12594. scroll_bottom = scroll_top + client_height - target_size;
  12595. if (current_result.length) {
  12596. if (target_top < scroll_top || target_size > client_height) {
  12597. //scroll to top
  12598. gap = target_top - scroll_top;
  12599. } else if (target_top > scroll_bottom) {
  12600. //scroll down
  12601. gap = target_top - scroll_bottom;
  12602. } else return; //do not scroll
  12603. } else if (target_top < scroll_top) gap = target_top - scroll_top;
  12604. window.scrollBy(0, gap);
  12605. };
  12606. /**
  12607. * change css class by status
  12608. * @param self
  12609. * @param status {boolean} true: open, false: close
  12610. */
  12611. SelectPage.prototype.setOpenStatus = function (self, status) {
  12612. var el = self.elem, css = self.css_class;
  12613. if (status) {
  12614. el.container.addClass(css.container_open);
  12615. el.result_area.addClass(css.result_open);
  12616. } else {
  12617. el.container.removeClass(css.container_open);
  12618. el.result_area.removeClass(css.result_open);
  12619. }
  12620. };
  12621. /**
  12622. * input element in focus css class set
  12623. * @param {Object} self
  12624. */
  12625. SelectPage.prototype.setCssFocusedInput = function (self) {
  12626. //$(self.elem.results).addClass(self.css_class.re_off);
  12627. //$(self.elem.combo_input).removeClass(self.css_class.input_off);
  12628. };
  12629. /**
  12630. * set result list get focus and input element lost focus
  12631. * @param {Object} self
  12632. */
  12633. SelectPage.prototype.setCssFocusedResults = function (self) {
  12634. //$(self.elem.results).removeClass(self.css_class.re_off);
  12635. //$(self.elem.combo_input).addClass(self.css_class.input_off);
  12636. };
  12637. /**
  12638. * Quick search input keywords listener
  12639. * @param {Object} self
  12640. */
  12641. SelectPage.prototype.checkValue = function (self) {
  12642. var now_value = self.elem.combo_input.val();
  12643. if (now_value != self.prop.prev_value) {
  12644. self.prop.prev_value = now_value;
  12645. self.prop.first_show = false;
  12646. if (self.option.selectOnly) self.setButtonAttrDefault();
  12647. if (!self.option.multiple && !now_value) {
  12648. self.elem.combo_input.val('');
  12649. self.elem.hidden.val('');
  12650. self.elem.clear_btn.remove();
  12651. }
  12652. self.suggest(self);
  12653. }
  12654. };
  12655. /**
  12656. * Input handle(regular input)
  12657. * @param {Object} self
  12658. * @param {Object} e - event object
  12659. */
  12660. SelectPage.prototype.processKey = function (self, e) {
  12661. if ($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9, 13]) === -1) {
  12662. if (e.keyCode != 16) self.setCssFocusedInput(self); // except Shift(16)
  12663. self.inputResize(self);
  12664. if ($.type(self.option.data) === 'string') {
  12665. self.prop.last_input_time = e.timeStamp;
  12666. setTimeout(function () {
  12667. if ((e.timeStamp - self.prop.last_input_time) === 0)
  12668. self.checkValue(self);
  12669. }, self.option.inputDelay * 1000);
  12670. } else {
  12671. self.checkValue(self);
  12672. }
  12673. }
  12674. }
  12675. /**
  12676. * Input handle(control key)
  12677. * @param {Object} self
  12678. * @param {Object} e - event object
  12679. */
  12680. SelectPage.prototype.processControl = function (self, e) {
  12681. if (($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9]) > -1 && self.elem.result_area.is(':visible')) ||
  12682. ($.inArray(e.keyCode, [13, 9]) > -1 && self.getCurrentLine(self))) {
  12683. e.preventDefault();
  12684. e.stopPropagation();
  12685. e.cancelBubble = true;
  12686. e.returnValue = false;
  12687. switch (e.keyCode) {
  12688. case 37:// left
  12689. if (e.shiftKey) self.firstPage(self);
  12690. else self.prevPage(self);
  12691. break;
  12692. case 38:// up
  12693. self.prop.key_select = true;
  12694. self.prevLine(self);
  12695. break;
  12696. case 39:// right
  12697. if (e.shiftKey) self.lastPage(self);
  12698. else self.nextPage(self);
  12699. break;
  12700. case 40:// down
  12701. if (self.elem.results.children('li').length) {
  12702. self.prop.key_select = true;
  12703. self.nextLine(self);
  12704. } else self.suggest(self);
  12705. break;
  12706. case 9:// tab
  12707. self.prop.key_paging = true;
  12708. self.selectCurrentLine(self, true);
  12709. //self.hideResults(self);
  12710. break;
  12711. case 13:// return
  12712. self.selectCurrentLine(self, true);
  12713. break;
  12714. case 27:// escape
  12715. self.prop.key_paging = true;
  12716. self.hideResults(self);
  12717. break;
  12718. }
  12719. }
  12720. };
  12721. /**
  12722. * Abort Ajax request
  12723. * @param {Object} self
  12724. */
  12725. SelectPage.prototype.abortAjax = function (self) {
  12726. if (self.prop.xhr) {
  12727. self.prop.xhr.abort();
  12728. self.prop.xhr = false;
  12729. }
  12730. };
  12731. /**
  12732. * Suggest result of search keywords
  12733. * @param {Object} self
  12734. */
  12735. SelectPage.prototype.suggest = function (self) {
  12736. var q_word, val = $.trim(self.elem.combo_input.val());
  12737. if (self.option.multiple) q_word = val;
  12738. else {
  12739. if (val && val === self.prop.selected_text) q_word = '';
  12740. else q_word = val;
  12741. }
  12742. q_word = q_word.split(self.option.separator);
  12743. //Before show up result list callback
  12744. if (self.option.eOpen && $.isFunction(self.option.eOpen))
  12745. self.option.eOpen.call(self);
  12746. self.abortAjax(self);
  12747. //self.setLoading(self);
  12748. var which_page_num = self.prop.current_page || 1;
  12749. if (typeof self.option.data == 'object') self.searchForJson(self, q_word, which_page_num);
  12750. else self.searchForDb(self, q_word, which_page_num);
  12751. };
  12752. /**
  12753. * Loading
  12754. * @param {Object} self
  12755. */
  12756. SelectPage.prototype.setLoading = function (self) {
  12757. if (self.elem.results.html() === '') {
  12758. //self.calcResultsSize(self);
  12759. self.setOpenStatus(self, true);
  12760. }
  12761. };
  12762. /**
  12763. * Search for ajax
  12764. * @param {Object} self
  12765. * @param {Array} q_word - query keyword
  12766. * @param {number} which_page_num - target page number
  12767. */
  12768. SelectPage.prototype.searchForDb = function (self, q_word, which_page_num) {
  12769. var p = self.option;
  12770. if (!p.eAjaxSuccess || !$.isFunction(p.eAjaxSuccess)) self.hideResults(self);
  12771. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  12772. //when have new query keyword, then reset page number to 1.
  12773. if (q_word.length && q_word[0] && q_word.join(self.option.separator) !== self.prop.prev_value) which_page_num = 1;
  12774. var _orgParams = {
  12775. q_word: q_word,
  12776. pageNumber: which_page_num,
  12777. pageSize: p.pageSize,
  12778. andOr: p.andOr,
  12779. orderBy: p.orderBy,
  12780. searchTable: p.dbTable,
  12781. showField: self.option.showField,
  12782. keyField: self.option.keyField,
  12783. searchField: self.option.searchField
  12784. };
  12785. if (p.orderBy !== false) _orgParams.orderBy = p.orderBy;
  12786. // 这个应该是历史遗留了,没仔细追逻辑,先留着。
  12787. _orgParams[searchKey] = q_word[0];
  12788. if (_paramsFunc) {
  12789. var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
  12790. if (result && $.isPlainObject(result)) {
  12791. _params = $.extend({}, _orgParams, result);
  12792. } else {
  12793. _params = _orgParams;
  12794. }
  12795. } else {
  12796. _params = _orgParams;
  12797. }
  12798. self.prop.xhr = $.ajax({
  12799. dataType: 'json',
  12800. url: p.data,
  12801. type: 'POST',
  12802. data: _params,
  12803. success: function (returnData) {
  12804. if (!returnData || !$.isPlainObject(returnData)) {
  12805. self.hideResults(self);
  12806. self.ajaxErrorNotify(self, errorThrown);
  12807. return;
  12808. }
  12809. var data = {}, json = {};
  12810. try {
  12811. data = p.eAjaxSuccess(returnData);
  12812. json.originalResult = data.list;
  12813. json.cnt_whole = data.totalRow;
  12814. } catch (e) {
  12815. self.showMessage(self, self.message.ajax_error);
  12816. return;
  12817. }
  12818. if (self.elem.navi) {
  12819. $(self.elem.navi).toggleClass("hide", json.cnt_whole <= json.originalResult.length);
  12820. }
  12821. json.candidate = [];
  12822. json.keyField = [];
  12823. if (typeof json.originalResult != 'object') {
  12824. self.prop.xhr = null;
  12825. self.notFoundSearch(self);
  12826. return;
  12827. }
  12828. json.cnt_page = json.originalResult.length;
  12829. for (var i = 0; i < json.cnt_page; i++) {
  12830. for (var key in json.originalResult[i]) {
  12831. if (key == p.keyField) {
  12832. json.keyField.push(json.originalResult[i][key]);
  12833. }
  12834. if (key == p.showField) {
  12835. json.candidate.push(json.originalResult[i][key]);
  12836. }
  12837. }
  12838. }
  12839. self.prepareResults(self, json, q_word, which_page_num);
  12840. },
  12841. error: function (jqXHR, textStatus, errorThrown) {
  12842. if (textStatus != 'abort') {
  12843. self.hideResults(self);
  12844. self.ajaxErrorNotify(self, errorThrown);
  12845. }
  12846. },
  12847. complete: function () {
  12848. self.prop.xhr = null;
  12849. }
  12850. });
  12851. };
  12852. /**
  12853. * Search for json data source
  12854. * @param {Object} self
  12855. * @param {Array} q_word
  12856. * @param {number} which_page_num
  12857. */
  12858. SelectPage.prototype.searchForJson = function (self, q_word, which_page_num) {
  12859. var p = self.option, matched = [], esc_q = [], sorted = [], json = {}, i = 0, arr_reg = [];
  12860. //query keyword filter
  12861. do {
  12862. //'/\W/g'正则代表全部不是字母,数字,下划线,汉字的字符
  12863. //将非法字符进行转义
  12864. esc_q[i] = q_word[i].replace(/\W/g, '\\$&').toString();
  12865. arr_reg[i] = new RegExp(esc_q[i], 'gi');
  12866. i++;
  12867. } while (i < q_word.length);
  12868. // SELECT * FROM data WHERE field LIKE q_word;
  12869. for (var i = 0; i < p.data.length; i++) {
  12870. var flag = false, row = p.data[i], itemText;
  12871. for (var j = 0; j < arr_reg.length; j++) {
  12872. itemText = row[p.searchField];
  12873. if (p.formatItem && $.isFunction(p.formatItem))
  12874. itemText = p.formatItem(row);
  12875. if (itemText.match(arr_reg[j])) {
  12876. flag = true;
  12877. if (p.andOr == 'OR') break;
  12878. } else {
  12879. flag = false;
  12880. if (p.andOr == 'AND') break;
  12881. }
  12882. }
  12883. if (flag) matched.push(row);
  12884. }
  12885. // (CASE WHEN ...) then く order some column
  12886. if (p.orderBy === false) sorted = matched.concat();
  12887. else {
  12888. var reg1 = new RegExp('^' + esc_q[0] + '$', 'gi'),
  12889. reg2 = new RegExp('^' + esc_q[0], 'gi'),
  12890. matched1 = [], matched2 = [], matched3 = [];
  12891. for (var i = 0; i < matched.length; i++) {
  12892. var orderField = p.orderBy[0][0];
  12893. var orderValue = String(matched[i][orderField]);
  12894. if (orderValue.match(reg1)) {
  12895. matched1.push(matched[i]);
  12896. } else if (orderValue.match(reg2)) {
  12897. matched2.push(matched[i]);
  12898. } else {
  12899. matched3.push(matched[i]);
  12900. }
  12901. }
  12902. if (p.orderBy[0][1].match(/^asc$/i)) {
  12903. matched1 = self.sortAsc(self, matched1);
  12904. matched2 = self.sortAsc(self, matched2);
  12905. matched3 = self.sortAsc(self, matched3);
  12906. } else {
  12907. matched1 = self.sortDesc(self, matched1);
  12908. matched2 = self.sortDesc(self, matched2);
  12909. matched3 = self.sortDesc(self, matched3);
  12910. }
  12911. sorted = sorted.concat(matched1).concat(matched2).concat(matched3);
  12912. }
  12913. /*
  12914. if (sorted.length === undefined || sorted.length === 0 ) {
  12915. self.notFoundSearch(self);
  12916. return;
  12917. }
  12918. */
  12919. json.cnt_whole = sorted.length;
  12920. //page_move used to distinguish between init plugin or page moving
  12921. if (!self.prop.page_move) {
  12922. //only single mode can be used page number relocation
  12923. if (!p.multiple) {
  12924. //get selected item belong page number
  12925. var currentValue = self.elem.hidden.val();
  12926. if ($.type(currentValue) !== 'undefined' && $.trim(currentValue) !== '') {
  12927. var index = 0;
  12928. $.each(sorted, function (i, row) {
  12929. if (row[p.keyField] == currentValue) {
  12930. index = i + 1;
  12931. return false;
  12932. }
  12933. });
  12934. which_page_num = Math.ceil(index / p.pageSize);
  12935. if (which_page_num < 1) which_page_num = 1;
  12936. self.prop.current_page = which_page_num;
  12937. }
  12938. }
  12939. } else {
  12940. //set page number to 1 when result number less then page size
  12941. if (sorted.length <= ((which_page_num - 1) * p.pageSize)) {
  12942. which_page_num = 1;
  12943. self.prop.current_page = 1;
  12944. }
  12945. }
  12946. //LIMIT xx OFFSET xx
  12947. var start = (which_page_num - 1) * p.pageSize, end = start + p.pageSize;
  12948. //save original data
  12949. json.originalResult = [];
  12950. //after data filter handle
  12951. for (var i = start; i < end; i++) {
  12952. if (sorted[i] === undefined) break;
  12953. json.originalResult.push(sorted[i]);
  12954. for (var key in sorted[i]) {
  12955. if (key == p.keyField) {
  12956. if (json.keyField === undefined) json.keyField = [];
  12957. json.keyField.push(sorted[i][key]);
  12958. }
  12959. if (key == p.showField) {
  12960. if (json.candidate === undefined) json.candidate = [];
  12961. json.candidate.push(sorted[i][key]);
  12962. }
  12963. }
  12964. }
  12965. if (json.candidate === undefined) json.candidate = [];
  12966. json.cnt_page = json.candidate.length;
  12967. self.prepareResults(self, json, q_word, which_page_num);
  12968. };
  12969. /**
  12970. * Set order asc
  12971. * @param {Object} self
  12972. * @param {Array} arr - result array
  12973. */
  12974. SelectPage.prototype.sortAsc = function (self, arr) {
  12975. arr.sort(function (a, b) {
  12976. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  12977. return $.type(valA) === 'number' ? valA - valB : String(valA).localeCompare(String(valB));
  12978. });
  12979. return arr;
  12980. };
  12981. /**
  12982. * Set order desc
  12983. * @param {Object} self
  12984. * @param {Array} arr - result array
  12985. */
  12986. SelectPage.prototype.sortDesc = function (self, arr) {
  12987. arr.sort(function (a, b) {
  12988. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  12989. return $.type(valA) === 'number' ? valB - valA : String(valB).localeCompare(String(valA));
  12990. });
  12991. return arr;
  12992. };
  12993. /**
  12994. * Not result found handle
  12995. * @param {Object} self
  12996. */
  12997. SelectPage.prototype.notFoundSearch = function (self) {
  12998. self.elem.results.empty();
  12999. self.calcResultsSize(self);
  13000. self.setOpenStatus(self, true);
  13001. self.setCssFocusedInput(self);
  13002. };
  13003. /**
  13004. * Prepare data to show
  13005. * @param {Object} self
  13006. * @param {Object} json - data result
  13007. * @param {Array} q_word - query keyword
  13008. * @param {number} which_page_num - target page number
  13009. */
  13010. SelectPage.prototype.prepareResults = function (self, json, q_word, which_page_num) {
  13011. self.data = json.originalResult;
  13012. if (self.option.pagination) self.setNavi(self, json.cnt_whole, json.cnt_page, which_page_num);
  13013. if (!json.keyField) json.keyField = false;
  13014. if (self.option.selectOnly && json.candidate.length === 1 && json.candidate[0] == q_word[0]) {
  13015. self.elem.hidden.val(json.keyField[0]);
  13016. this.setButtonAttrDefault();
  13017. }
  13018. var is_query = false;
  13019. if (q_word && q_word.length && q_word[0]) is_query = true;
  13020. self.displayResults(self, json, is_query);
  13021. };
  13022. /**
  13023. * Build page bar
  13024. * @param {Object} self
  13025. * @param {number} cnt_whole - total record count
  13026. * @param {number} cnt_page
  13027. * @param {number} page_num - current page number
  13028. */
  13029. SelectPage.prototype.setNavi = function (self, cnt_whole, cnt_page, page_num) {
  13030. var msg = self.message;
  13031. /**
  13032. * build pagination bar
  13033. */
  13034. var buildPageNav = function (self, pagebar, page_num, last_page) {
  13035. var updatePageInfo = function () {
  13036. var pageInfo = msg.page_info;
  13037. return pageInfo.replace(self.template.page.current, page_num).replace(self.template.page.total, last_page);
  13038. };
  13039. if (pagebar.find('li').length === 0) {
  13040. pagebar.hide().empty();
  13041. var iconFist = 'spfont sp-first',
  13042. iconPrev = 'spfont sp-previous',
  13043. iconNext = 'spfont sp-next',
  13044. iconLast = 'spfont sp-last';
  13045. pagebar.append('<li class="csFirstPage" title="' + msg.first_title + '" ><a href="javascript:void(0);"> <i class="' + iconFist + '"></i> </a></li>');
  13046. pagebar.append('<li class="csPreviousPage" title="' + msg.prev_title + '" ><a href="javascript:void(0);"><i class="' + iconPrev + '"></i></a></li>');
  13047. //pagination information
  13048. pagebar.append('<li class="pageInfoBox"><a href="javascript:void(0);"> ' + updatePageInfo() + ' </a></li>');
  13049. pagebar.append('<li class="csNextPage" title="' + msg.next_title + '" ><a href="javascript:void(0);"><i class="' + iconNext + '"></i></a></li>');
  13050. pagebar.append('<li class="csLastPage" title="' + msg.last_title + '" ><a href="javascript:void(0);"> <i class="' + iconLast + '"></i> </a></li>');
  13051. pagebar.show();
  13052. } else {
  13053. pagebar.find('li.pageInfoBox a').html(updatePageInfo());
  13054. }
  13055. };
  13056. var pagebar = self.elem.navi.find('ul'),
  13057. last_page = Math.ceil(cnt_whole / self.option.pageSize); //calculate total page
  13058. if (last_page === 0) page_num = 0;
  13059. else {
  13060. if (last_page < page_num) page_num = last_page;
  13061. else if (page_num === 0) page_num = 1;
  13062. }
  13063. self.prop.current_page = page_num;//update current page number
  13064. self.prop.max_page = last_page;//update page count
  13065. buildPageNav(self, pagebar, page_num, last_page);
  13066. //update paging status
  13067. var dClass = 'disabled',
  13068. first = pagebar.find('li.csFirstPage'),
  13069. previous = pagebar.find('li.csPreviousPage'),
  13070. next = pagebar.find('li.csNextPage'),
  13071. last = pagebar.find('li.csLastPage');
  13072. //first and previous
  13073. if (page_num === 1 || page_num === 0) {
  13074. if (!first.hasClass(dClass)) first.addClass(dClass);
  13075. if (!previous.hasClass(dClass)) previous.addClass(dClass);
  13076. } else {
  13077. if (first.hasClass(dClass)) first.removeClass(dClass);
  13078. if (previous.hasClass(dClass)) previous.removeClass(dClass);
  13079. }
  13080. //next and last
  13081. if (page_num === last_page || last_page === 0) {
  13082. if (!next.hasClass(dClass)) next.addClass(dClass);
  13083. if (!last.hasClass(dClass)) last.addClass(dClass);
  13084. } else {
  13085. if (next.hasClass(dClass)) next.removeClass(dClass);
  13086. if (last.hasClass(dClass)) last.removeClass(dClass);
  13087. }
  13088. if (last_page > 1) self.ePaging(); //pagination event bind
  13089. };
  13090. /**
  13091. * Render result list
  13092. * @param {Object} self
  13093. * @param {Object} json - result data
  13094. * @param {boolean} is_query - used to different from search to open and just click to open
  13095. */
  13096. SelectPage.prototype.displayResults = function (self, json, is_query) {
  13097. var p = self.option, el = self.elem;
  13098. el.results.hide().empty();
  13099. if (p.multiple && $.type(p.maxSelectLimit) === 'number' && p.maxSelectLimit > 0) {
  13100. var selectedSize = el.element_box.find('li.selected_tag').length;
  13101. if (selectedSize > 0 && selectedSize >= p.maxSelectLimit) {
  13102. var msg = self.message.max_selected;
  13103. self.showMessage(self, msg.replace(self.template.msg.maxSelectLimit, p.maxSelectLimit));
  13104. return;
  13105. }
  13106. }
  13107. if (json.candidate.length) {
  13108. var arr_candidate = json.candidate,
  13109. arr_primary_key = json.keyField,
  13110. keystr = el.hidden.val(),
  13111. keyArr = keystr ? keystr.split(',') : new Array(),
  13112. itemText = '';
  13113. for (var i = 0; i < arr_candidate.length; i++) {
  13114. if (p.formatItem && $.isFunction(p.formatItem)) {
  13115. try {
  13116. itemText = p.formatItem(json.originalResult[i]);
  13117. } catch (e) {
  13118. console.error('formatItem内容格式化函数内容设置不正确!');
  13119. itemText = arr_candidate[i];
  13120. }
  13121. } else itemText = arr_candidate[i];
  13122. var list = $('<li>').html(itemText).attr({
  13123. pkey: arr_primary_key[i],
  13124. index: i
  13125. });
  13126. if (!p.formatItem) list.attr('title', itemText);
  13127. //Set selected item highlight
  13128. if ($.inArray(arr_primary_key[i].toString(), keyArr) !== -1) {
  13129. list.addClass(self.css_class.selected);
  13130. }
  13131. //cache item data
  13132. list.data('dataObj', json.originalResult[i]);
  13133. el.results.append(list);
  13134. }
  13135. } else {
  13136. var li = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' +
  13137. self.message.not_found + '</li>';
  13138. el.results.append(li);
  13139. }
  13140. el.results.show();
  13141. if (p.multiple && p.multipleControlbar) el.control.show();
  13142. if (p.pagination) el.navi.show();
  13143. self.calcResultsSize(self);
  13144. self.setOpenStatus(self, true);
  13145. //Result item event bind
  13146. self.eResultList();
  13147. //scrolling listen
  13148. self.eScroll();
  13149. //auto highlight first item in search, have result and set autoSelectFirst to true situation
  13150. if (is_query && json.candidate.length && p.autoSelectFirst) self.nextLine(self);
  13151. };
  13152. /**
  13153. * Calculate result list size and position
  13154. * @param {Object} self
  13155. */
  13156. SelectPage.prototype.calcResultsSize = function (self) {
  13157. var p = self.option, el = self.elem;
  13158. var rePosition = function () {
  13159. if (el.container.css('position') === 'static') {
  13160. // position: static
  13161. var offset = el.combo_input.offset();
  13162. el.result_area.css({
  13163. top: offset.top + el.combo_input.outerHeight() + 'px',
  13164. left: offset.left + 'px'
  13165. });
  13166. } else {
  13167. if (!p.pagination) {
  13168. var itemHeight = el.results.find('li:first').outerHeight(true),
  13169. listHeight = itemHeight * p.listSize;
  13170. el.results.css({
  13171. 'max-height': listHeight,
  13172. 'overflow-y': 'auto'
  13173. });
  13174. }
  13175. //handle result list show up side(left, right, up or down)
  13176. var docWidth = $(document).width(),
  13177. docHeight = $(document).height(), //the document full height
  13178. viewHeight = $(window).height(), //browser visible area height
  13179. offset = el.container.offset(),
  13180. screenScrollTop = $(window).scrollTop(),
  13181. listWidth = el.result_area.outerWidth(),
  13182. //result list height
  13183. listHeight = el.result_area.outerHeight(),
  13184. //default left used input element left
  13185. defaultLeft = offset.left, //p.multiple ? -1 : 0;
  13186. //input element height
  13187. inputHeight = el.container.outerHeight(),
  13188. left = (offset.left + listWidth) > docWidth ?
  13189. defaultLeft - (listWidth - el.container.outerWidth()) :
  13190. defaultLeft,
  13191. //the actual top coordinate of input element(outer div)
  13192. screenTop = offset.top, //$(el.container).scrollTop();//offset.top - screenScrollTop;
  13193. top = 0, dist = 5, //set distance between input element and result list
  13194. //the actual top coordinate of result list
  13195. listBottom = screenTop + inputHeight + listHeight + dist,
  13196. listTop = screenTop + listHeight + dist,
  13197. hasOverflow = docHeight > viewHeight;
  13198. if ((screenTop - screenScrollTop - dist > listHeight) &&
  13199. (hasOverflow && listBottom > (viewHeight + screenScrollTop)) ||
  13200. (!hasOverflow && listBottom > viewHeight && screenTop >= listTop)) {
  13201. //open up
  13202. top = offset.top - listHeight - dist;
  13203. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowUp');
  13204. } else {
  13205. //open down
  13206. top = offset.top + (p.multiple ? el.container.outerHeight() : inputHeight);
  13207. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowDown');
  13208. top += dist;
  13209. }
  13210. return {
  13211. top: top + 'px', left: left + 'px'
  13212. };
  13213. }
  13214. };
  13215. if (el.result_area.is(':visible')) {
  13216. el.result_area.css(rePosition());
  13217. } else {
  13218. var pss = rePosition();
  13219. el.result_area.css(pss).show(1, function () {
  13220. var repss = rePosition();
  13221. if (pss.top !== repss.top || pss.left !== repss.left) el.result_area.css(repss);
  13222. });
  13223. }
  13224. };
  13225. /**
  13226. * hide result list
  13227. * @param {Object} self
  13228. */
  13229. SelectPage.prototype.hideResults = function (self) {
  13230. if (self.prop.key_paging) {
  13231. self.scrollWindow(self, true);
  13232. self.prop.key_paging = false;
  13233. }
  13234. self.setCssFocusedInput(self);
  13235. if (self.option.autoFillResult) {
  13236. //self.selectCurrentLine(self, true);
  13237. }
  13238. self.elem.results.empty();
  13239. self.elem.result_area.hide();
  13240. self.setOpenStatus(self, false);
  13241. //unbind window scroll listen
  13242. $(window).off('scroll.SelectPage');
  13243. self.abortAjax(self);
  13244. self.setButtonAttrDefault();
  13245. };
  13246. /**
  13247. * set plugin to disabled / enabled
  13248. * @param self
  13249. * @param disabled
  13250. */
  13251. SelectPage.prototype.disabled = function (self, disabled) {
  13252. var p = self.option, el = self.elem;
  13253. if ($.type(disabled) === 'undefined') return el.combo_input.prop('disabled');
  13254. if ($.type(disabled) === 'boolean') {
  13255. el.combo_input.prop('disabled', disabled);
  13256. if (disabled) el.container.addClass(self.css_class.disabled);
  13257. else el.container.removeClass(self.css_class.disabled);
  13258. }
  13259. };
  13260. /**
  13261. * Go fist page
  13262. * @param {Object} self
  13263. */
  13264. SelectPage.prototype.firstPage = function (self) {
  13265. if (self.prop.current_page > 1) {
  13266. self.prop.current_page = 1;
  13267. self.prop.page_move = true;
  13268. self.suggest(self);
  13269. }
  13270. };
  13271. /**
  13272. * Go previous page
  13273. * @param {Object} self
  13274. */
  13275. SelectPage.prototype.prevPage = function (self) {
  13276. if (self.prop.current_page > 1) {
  13277. self.prop.current_page--;
  13278. self.prop.page_move = true;
  13279. self.suggest(self);
  13280. }
  13281. };
  13282. /**
  13283. * Go next page
  13284. * @param {Object} self
  13285. */
  13286. SelectPage.prototype.nextPage = function (self) {
  13287. if (self.prop.current_page < self.prop.max_page) {
  13288. self.prop.current_page++;
  13289. self.prop.page_move = true;
  13290. self.suggest(self);
  13291. }
  13292. };
  13293. /**
  13294. * Go last page
  13295. * @param {Object} self
  13296. */
  13297. SelectPage.prototype.lastPage = function (self) {
  13298. if (self.prop.current_page < self.prop.max_page) {
  13299. self.prop.current_page = self.prop.max_page;
  13300. self.prop.page_move = true;
  13301. self.suggest(self);
  13302. }
  13303. };
  13304. /**
  13305. * do something after select/unSelect action
  13306. * @param {Object} self
  13307. * @param {boolean} reOpen
  13308. */
  13309. SelectPage.prototype.afterAction = function (self, reOpen) {
  13310. self.inputResize(self);
  13311. self.elem.combo_input.change();
  13312. self.setCssFocusedInput(self);
  13313. if (self.prop.init_set) return;
  13314. if (self.option.multiple) {
  13315. if (self.option.selectToCloseList) {
  13316. self.hideResults(self);
  13317. self.elem.combo_input.blur();
  13318. }
  13319. if (!self.option.selectToCloseList && reOpen) {
  13320. self.suggest(self);
  13321. self.elem.combo_input.focus();
  13322. }
  13323. } else {
  13324. self.hideResults(self);
  13325. self.elem.combo_input.blur();
  13326. }
  13327. };
  13328. /**
  13329. * Select current list item
  13330. * @param {Object} self
  13331. * @param {boolean} is_enter_key
  13332. */
  13333. SelectPage.prototype.selectCurrentLine = function (self, is_enter_key) {
  13334. self.scrollWindow(self, true);
  13335. var p = self.option, current = self.getCurrentLine(self);
  13336. if (current) {
  13337. var data = current.data('dataObj');
  13338. var text = data[p.showField] || current.text();
  13339. var value = current.attr('pkey');
  13340. if (!p.multiple) {
  13341. self.elem.combo_input.val(text);
  13342. self.elem.hidden.val(value);
  13343. } else {
  13344. //build tags in multiple selection mode
  13345. self.elem.combo_input.val('');
  13346. var item = {text: text, value: value};
  13347. if (!self.isAlreadySelected(self, item)) {
  13348. self.addNewTag(self, data, item);
  13349. self.tagValuesSet(self);
  13350. }
  13351. }
  13352. if (p.selectOnly) self.setButtonAttrDefault();
  13353. //Select item callback
  13354. if (p.eSelect && $.isFunction(p.eSelect)) p.eSelect(data, self);
  13355. self.prop.prev_value = self.elem.combo_input.val();
  13356. self.prop.selected_text = self.elem.combo_input.val();
  13357. self.putClearButton();
  13358. }
  13359. self.afterAction(self, true);
  13360. };
  13361. /**
  13362. * Show clear button when item selected in single selection mode
  13363. */
  13364. SelectPage.prototype.putClearButton = function () {
  13365. if (!this.option.multiple && !this.elem.combo_input.prop('disabled')) this.elem.container.append(this.elem.clear_btn);
  13366. };
  13367. /**
  13368. * Select all list item
  13369. * @param {Object} self
  13370. */
  13371. SelectPage.prototype.selectAllLine = function (self) {
  13372. var p = self.option, jsonarr = new Array();
  13373. self.elem.results.find('li').each(function (i, row) {
  13374. var $row = $(row), data = $row.data('dataObj');
  13375. var text = data[p.showField] || $row.text();
  13376. var value = $row.attr('pkey');
  13377. var item = {text: text, value: value};
  13378. if (!self.isAlreadySelected(self, item)) {
  13379. self.addNewTag(self, data, item);
  13380. self.tagValuesSet(self);
  13381. }
  13382. jsonarr.push(data);
  13383. //limited max selected items
  13384. if ($.type(p.maxSelectLimit) === 'number' &&
  13385. p.maxSelectLimit > 0 &&
  13386. p.maxSelectLimit === self.elem.element_box.find('li.selected_tag').length) {
  13387. return false;
  13388. }
  13389. });
  13390. if (p.eSelect && $.isFunction(p.eSelect)) p.eSelect(jsonarr, self);
  13391. self.afterAction(self, true);
  13392. };
  13393. /**
  13394. * Cancel select all item in current page
  13395. * @param {Object} self
  13396. */
  13397. SelectPage.prototype.unSelectAllLine = function (self) {
  13398. var p = self.option, size = self.elem.results.find('li').length, ds = [];
  13399. self.elem.results.find('li').each(function (i, row) {
  13400. var key = $(row).attr('pkey');
  13401. var tag = self.elem.element_box.find('li.selected_tag[itemvalue="' + key + '"]');
  13402. if (tag.length) ds.push(tag.data('dataObj'));
  13403. self.removeTag(self, tag);
  13404. });
  13405. self.afterAction(self, true);
  13406. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove(ds);
  13407. };
  13408. /**
  13409. * Clear all selected items
  13410. * @param {Object} self
  13411. * @param {boolean} open - open list after clear selected item
  13412. */
  13413. SelectPage.prototype.clearAll = function (self, open) {
  13414. var p = self.option, ds = [];
  13415. if (p.multiple) {
  13416. self.elem.element_box.find('li.selected_tag').each(function (i, row) {
  13417. ds.push($(row).data('dataObj'));
  13418. row.remove();
  13419. });
  13420. self.elem.element_box.find('li.selected_tag').remove();
  13421. }
  13422. self.reset(self);
  13423. self.afterAction(self, open);
  13424. if (p.multiple) {
  13425. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove(ds);
  13426. } else self.elem.clear_btn.remove();
  13427. };
  13428. /**
  13429. * reset
  13430. */
  13431. SelectPage.prototype.reset = function (self) {
  13432. self.elem.combo_input.val('');
  13433. self.elem.hidden.val('');
  13434. self.prop.prev_value = '';
  13435. self.prop.selected_text = '';
  13436. self.prop.current_page = 1;
  13437. };
  13438. /**
  13439. * Get current highlight item
  13440. * @param {Object} self
  13441. */
  13442. SelectPage.prototype.getCurrentLine = function (self) {
  13443. if (self.elem.result_area.is(':hidden')) return false;
  13444. var obj = self.elem.results.find('li.' + self.css_class.select);
  13445. if (obj.length) return obj;
  13446. else return false;
  13447. };
  13448. /**
  13449. * Check the result item is already selected or not
  13450. * @param {Object} self
  13451. * @param {Object} item - item info
  13452. */
  13453. SelectPage.prototype.isAlreadySelected = function (self, item) {
  13454. var isExist = false;
  13455. if (item.value) {
  13456. var keys = self.elem.hidden.val();
  13457. if (keys) {
  13458. var karr = keys.split(',');
  13459. if (karr && karr.length && $.inArray(item.value, karr) != -1) isExist = true;
  13460. }
  13461. }
  13462. return isExist;
  13463. };
  13464. /**
  13465. * Add a new tag in multiple selection mode
  13466. * @param {Object} self
  13467. * @param {object} data - raw row data
  13468. * @param {Object} item
  13469. */
  13470. SelectPage.prototype.addNewTag = function (self, data, item) {
  13471. if (!self.option.multiple || !data || !item) return;
  13472. var tmp = self.template.tag.content, tag;
  13473. tmp = tmp.replace(self.template.tag.textKey, item.text);
  13474. tmp = tmp.replace(self.template.tag.valueKey, item.value);
  13475. tag = $(tmp);
  13476. tag.data('dataObj', data);
  13477. if (self.elem.combo_input.prop('disabled')) tag.find('span.tag_close').hide();
  13478. self.elem.combo_input.closest('li').before(tag);
  13479. };
  13480. /**
  13481. * Remove a tag in multiple selection mode
  13482. * @param {Object} self
  13483. * @param {Object} item
  13484. */
  13485. SelectPage.prototype.removeTag = function (self, item) {
  13486. var key = $(item).attr('itemvalue');
  13487. var keys = self.elem.hidden.val();
  13488. if ($.type(key) != 'undefined' && keys) {
  13489. var keyarr = keys.split(','),
  13490. index = $.inArray(key.toString(), keyarr);
  13491. if (index != -1) {
  13492. keyarr.splice(index, 1);
  13493. self.elem.hidden.val(keyarr.toString()).trigger("change");
  13494. }
  13495. }
  13496. $(item).remove();
  13497. self.inputResize(self);
  13498. };
  13499. /**
  13500. * Selected item value(keyField) put in to hidden element
  13501. * @param {Object} self
  13502. */
  13503. SelectPage.prototype.tagValuesSet = function (self) {
  13504. if (!self.option.multiple) return;
  13505. var tags = self.elem.element_box.find('li.selected_tag');
  13506. if (tags && tags.length) {
  13507. var result = new Array();
  13508. $.each(tags, function (i, li) {
  13509. var v = $(li).attr('itemvalue');
  13510. if ($.type(v) !== 'undefined') result.push(v);
  13511. });
  13512. if (result.length) {
  13513. self.elem.hidden.val(result.join(',')).trigger("change");
  13514. }
  13515. }
  13516. };
  13517. /**
  13518. * auto resize input element width in multiple select mode
  13519. * @param {Object} self
  13520. */
  13521. SelectPage.prototype.inputResize = function (self) {
  13522. if (!self.option.multiple) return;
  13523. var width = '',
  13524. inputLi = self.elem.combo_input.closest('li');
  13525. var setDefaultSize = function (self, inputLi) {
  13526. inputLi.removeClass('full_width');
  13527. var minimumWidth = self.elem.combo_input.val().length + 1,
  13528. width = (minimumWidth * 0.75) + 'em';
  13529. self.elem.combo_input.css('width', width).removeAttr('placeholder');
  13530. };
  13531. if (self.elem.element_box.find('li.selected_tag').length === 0) {
  13532. if (!inputLi.hasClass('full_width')) inputLi.addClass('full_width');
  13533. if (self.elem.combo_input.attr('placeholder_bak')) {
  13534. self.elem.combo_input.attr('placeholder', self.elem.combo_input.attr('placeholder_bak')).removeAttr('style');
  13535. }
  13536. } else setDefaultSize(self, inputLi);
  13537. };
  13538. /**
  13539. * Move to next line
  13540. * @param {Object} self
  13541. */
  13542. SelectPage.prototype.nextLine = function (self) {
  13543. var obj = self.getCurrentLine(self), idx;
  13544. if (!obj) idx = -1;
  13545. else {
  13546. idx = self.elem.results.children('li').index(obj);
  13547. obj.removeClass(self.css_class.select);
  13548. }
  13549. idx++;
  13550. if (idx < self.elem.results.children('li').length) {
  13551. var next = self.elem.results.children('li').eq(idx);
  13552. next.addClass(self.css_class.select);
  13553. self.setCssFocusedResults(self);
  13554. } else self.setCssFocusedInput(self);
  13555. self.scrollWindow(self, false);
  13556. };
  13557. /**
  13558. * Move to previous line
  13559. * @param {Object} self
  13560. */
  13561. SelectPage.prototype.prevLine = function (self) {
  13562. var obj = self.getCurrentLine(self), idx;
  13563. if (!obj) idx = self.elem.results.children('li').length;
  13564. else {
  13565. idx = self.elem.results.children('li').index(obj);
  13566. obj.removeClass(self.css_class.select);
  13567. }
  13568. idx--;
  13569. if (idx > -1) {
  13570. var prev = self.elem.results.children('li').eq(idx);
  13571. prev.addClass(self.css_class.select);
  13572. self.setCssFocusedResults(self);
  13573. } else self.setCssFocusedInput(self);
  13574. self.scrollWindow(self, false);
  13575. };
  13576. /**
  13577. * SelectPage plugin definition
  13578. * @global
  13579. * @param option {Object} init plugin option
  13580. */
  13581. function Plugin(option) {
  13582. return this.each(function () {
  13583. var $this = $(this),
  13584. data = $this.data(SelectPage.dataKey),
  13585. params = $.extend({}, defaults, $this.data(), data && data.option, typeof option === 'object' && option);
  13586. if (!data) $this.data(SelectPage.dataKey, (data = new SelectPage(this, params)));
  13587. });
  13588. }
  13589. /**
  13590. * Get plugin object
  13591. * @param {object} obj
  13592. * @returns
  13593. */
  13594. function getPlugin(obj) {
  13595. return $(obj).closest('div.sp_container').find('input.sp_input');
  13596. }
  13597. /**
  13598. * Clear all selected item
  13599. */
  13600. function ClearSelected() {
  13601. return this.each(function () {
  13602. var $this = getPlugin(this),
  13603. data = $this.data(SelectPage.dataKey);
  13604. if (data) {
  13605. data.prop.init_set = true;
  13606. data.clearAll(data);
  13607. data.prop.init_set = false;
  13608. }
  13609. });
  13610. }
  13611. /**
  13612. * Refresh result list
  13613. * use case:
  13614. * 1.use $(obj).val('xxx') to modify selectpage selected item key
  13615. * 2.refresh selected item show content/tag text
  13616. */
  13617. function SelectedRefresh() {
  13618. return this.each(function () {
  13619. var $this = getPlugin(this),
  13620. data = $this.data(SelectPage.dataKey);
  13621. if (data && data.elem.hidden.val())
  13622. data.setInitRecord(true);
  13623. });
  13624. }
  13625. /**
  13626. * Modify plugin datasource, only work on json datasource mode
  13627. * @param {array} data - new datasource
  13628. * @example
  13629. * [{name:'aa',sex:1},{name:'bb',sex:0},{...}]
  13630. */
  13631. function ModifyDataSource(data) {
  13632. return this.each(function () {
  13633. if (data && $.isArray(data)) {
  13634. var $this = getPlugin(this),
  13635. plugin = $this.data(SelectPage.dataKey);
  13636. if (plugin) {
  13637. plugin.clearAll(plugin);
  13638. plugin.option.data = data;
  13639. }
  13640. }
  13641. });
  13642. }
  13643. /**
  13644. * Get plugin disabled status or Modify plugin disabled status
  13645. * @param disabled {boolean} set disabled status
  13646. */
  13647. function PluginDisabled(disabled) {
  13648. var status = false;
  13649. this.each(function () {
  13650. var $this = getPlugin(this),
  13651. plugin = $this.data(SelectPage.dataKey);
  13652. if (plugin) {
  13653. if ($.type(disabled) !== 'undefined')
  13654. plugin.disabled(plugin, disabled);
  13655. else
  13656. status = plugin.disabled(plugin);
  13657. }
  13658. });
  13659. return status;
  13660. }
  13661. /**
  13662. * Get selected item text
  13663. * @returns {string}
  13664. */
  13665. function GetInputText() {
  13666. var str = '';
  13667. this.each(function () {
  13668. var $this = getPlugin(this), data = $this.data(SelectPage.dataKey);
  13669. if (data) {
  13670. if (data.option.multiple) {
  13671. var tags = [];
  13672. data.elem.element_box.find('li.selected_tag').each(function (i, tag) {
  13673. tags.push($(tag).text());
  13674. });
  13675. str += tags.toString();
  13676. } else {
  13677. str += data.elem.combo_input.val();
  13678. }
  13679. }
  13680. });
  13681. return str;
  13682. }
  13683. var old = $.fn.selectPage;
  13684. $.fn.selectPage = Plugin;
  13685. $.fn.selectPage.Constructor = SelectPage;
  13686. $.fn.selectPageClear = ClearSelected;
  13687. $.fn.selectPageRefresh = SelectedRefresh;
  13688. $.fn.selectPageData = ModifyDataSource;
  13689. $.fn.selectPageDisabled = PluginDisabled;
  13690. $.fn.selectPageText = GetInputText;
  13691. // SelectPage no conflict
  13692. // =================
  13693. $.fn.selectPage.noConflict = function () {
  13694. $.fn.selectPage = old;
  13695. return this;
  13696. };
  13697. })(window.jQuery);
  13698. define("selectpage", function(){});