require-frontend.min.js 883 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959
  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.1 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.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},f=r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},n.icon!==-1&&n.icon!==t||(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:260},n))}},s=function(e){var t=this,n=function(){t.creat()};t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?n():setTimeout(function(){n()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],l.SHADE="layui-layer-shade",l.MOVE="layui-layer-move",s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"&#x4FE1;&#x606F;",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,minStack:!0,focusBtn:0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'<div class="layui-layer-title" style="'+(f?r.title[1]:"")+'">'+(f?r.title[0]:r.title)+"</div>":"";return r.zIndex=s,t([r.shade?'<div class="'+l.SHADE+'" id="'+l.SHADE+a+'" times="'+a+'" style="'+("z-index:"+(s-1)+"; ")+'"></div>':"",'<div class="'+l[0]+(" layui-layer-"+o.type[r.type])+(0!=r.type&&2!=r.type||r.shade?"":" layui-layer-border")+" "+(r.skin||"")+'" id="'+l[0]+a+'" type="'+o.type[r.type]+'" times="'+a+'" showtime="'+r.time+'" conType="'+(e?"object":"string")+'" style="z-index: '+s+"; width:"+r.area[0]+";height:"+r.area[1]+";position:"+(r.fixed?"fixed;":"absolute;")+'">'+(e&&2!=r.type?"":u)+'<div id="'+(r.id||"")+'" class="layui-layer-content'+(0==r.type&&r.icon!==-1?" layui-layer-padding":"")+(3==r.type?" layui-layer-loading"+r.icon:"")+'">'+(0==r.type&&r.icon!==-1?'<i class="layui-layer-ico layui-layer-ico'+r.icon+'"></i>':"")+(1==r.type&&e?"":r.content||"")+'</div><span class="layui-layer-setwin">'+function(){var e=c?'<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>':"";return r.closeBtn&&(e+='<a class="layui-layer-ico '+l[7]+" "+l[7]+(r.title?r.closeBtn:4==r.type?"1":"2")+'" href="javascript:;"></a>'),e}()+"</span>"+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t<i;t++)e+='<a class="'+l[6]+t+'" href="javascript:">'+r.btn[t]+"</a>";return'<div class="'+l[6]+" layui-layer-btn-"+(r.btnAlign||"")+'">'+e+"</div>"}():"")+(r.resize?'<span class="layui-layer-resize"></span>':"")+"</div>"],u,i('<div class="'+l.MOVE+'" id="'+l.MOVE+'"></div>')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"","auto"];t.content='<iframe scrolling="'+(t.content[1]||"auto")+'" allowtransparency="true" id="'+l[4]+a+'" name="'+l[4]+a+'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="'+t.content[0]+'"></iframe>';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'<i class="layui-layer-TipsG"></i>',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i("#"+l.MOVE)[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),e.shadeo=i("#"+l.SHADE+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),e.shadeo.css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():function(){e.offset(),parseInt(o.getStyle(document.getElementById(l.MOVE),"z-index"))||function(){e.layero.css("visibility","hidden"),r.ready(function(){e.offset(),e.layero.css("visibility","visible")})}()}(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;a<c.stX&&(a=c.stX),a>f&&(a=f),o<c.stY&&(o=c.stY),o>u&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;if(t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),"number"==typeof a.focusBtn){var s=n.find("."+l[6]).children("a").eq(a.focusBtn);if(s.size()>0){n.find("."+l[6]).css("position","relative");var f=s.position(),c={width:s.outerWidth(),height:s.outerHeight(),left:f.left,top:f.top,marginTop:s.css("marginTop"),marginLeft:s.css("marginLeft")},u=i("<button class='layui-layer-confirm'></button>").css(c);if(a.resize){var d=a.resizing;a.resizing=function(e){d&&d(e);var t=s.position();u.size()>0&&u.css({left:t.left,top:t.top})}}n.find("."+l[6]).append(u),u.focus().click(function(){return s.trigger("click"),!1}).on("focus blur",function(e){s.toggleClass("focus","focus"===e.type),"blur"===e.type&&u.remove()})}}n.find("."+l[7]).on("click",e),a.shadeClose&&t.shadeo.on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n,t.index);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n,t.index)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n,t.index)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){t=t||{};var a=i("#"+l[0]+e),s=i("#"+l.SHADE+e),f=a.find(l[1]).outerHeight()||0,c=a.attr("minLeft")||181*o.minIndex+"px",u=a.css("position"),d={width:180,height:f,position:"fixed",overflow:"hidden"};o.record(a),o.minLeft[0]&&(c=o.minLeft[0],o.minLeft.shift()),t.minStack&&(d.left=c,d.top=n.height()-f,a.attr("minLeft")||o.minIndex++,a.attr("minLeft",c)),a.attr("position",u),r.style(e,d,!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),s.hide()},r.restore=function(e){var t=i("#"+l[0]+e),n=i("#"+l.SHADE+e),a=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(a[0]),height:parseFloat(a[1]),top:parseFloat(a[2]),left:parseFloat(a[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e),n.show()},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e,t){var n=i("#"+l[0]+e),a=n.attr("type"),s="layer-anim-close";if(n[0]){var f="layui-layer-wrap",c=function(){if(a===o.type[1]&&"object"===n.attr("conType")){n.children(":not(."+l[5]+")").remove();for(var r=n.find("."+f),s=0;s<2;s++)r.unwrap();r.css("display",r.data("display")).removeClass(f)}else{if(a===o.type[2])try{var c=i("#"+l[4]+e)[0];c.contentWindow.document.write(""),c.contentWindow.close(),n.find("."+l[5])[0].removeChild(c)}catch(u){}n[0].innerHTML="",n.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e],"function"==typeof t&&t()};n.data("isOutAnim")&&n.addClass("layer-anim "+s),i("#layui-layer-moves, #"+l.SHADE+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),n.attr("minLeft")&&(o.minIndex--,o.minLeft.push(n.attr("minLeft"))),r.ie&&r.ie<10||!n.data("isOutAnim")?c():setTimeout(function(){c()},200)}},r.closeAll=function(e,t){"function"==typeof e&&(t=e,e=null);var n=i("."+l[0]);i.each(n,function(a){var o=i(this),s=e?o.attr("type")===e:1;s&&r.close(o.attr("times"),a===n.length-1?t:null),s=null}),0===n.length&&"function"==typeof t&&t()};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'<textarea class="layui-layer-input"'+a+"></textarea>":function(){return'<input type="'+(1==e.formType?"password":"text")+'" class="layui-layer-input">'}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(t){s=t.find(".layui-layer-input"),s.val(e.value||"").focus(),"function"==typeof f&&f(t)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("&#x6700;&#x591A;&#x8F93;&#x5165;"+(e.maxlength||500)+"&#x4E2A;&#x5B57;&#x6570;",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a='<span class="'+n+'">'+t[0].title+"</span>";i<e;i++)a+="<span>"+t[i].title+"</span>";return a}(),content:'<ul class="layui-layer-tabmain">'+function(){var e=t.length,i=1,a="";if(e>0)for(a='<li class="layui-layer-tabli '+n+'">'+(t[0].content||"no content")+"</li>";i<e;i++)a+='<li class="layui-layer-tabli">'+(t[i].content||"no content")+"</li>";return a}()+"</ul>",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=!("string"==typeof t.photos||t.photos instanceof i),f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("&#x6CA1;&#x6709;&#x56FE;&#x7247;")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){h();var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0)}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev(!0)}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext(!0)}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),a&&(t.anim=-1),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]<r[1]&&(a[0]=a[0]/r[1],a[1]=a[1]/r[1])}return[a[0]+"px",a[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,anim:5,isOutAnim:!1,skin:"layui-layer-photos"+c("photos"),content:'<div class="layui-layer-phimg"><img src="'+u[d].src+'" alt="'+(u[d].alt||"")+'" layer-pid="'+u[d].pid+'">'+function(){return u.length>1?'<div class="layui-layer-imgsee"><span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span><div class="layui-layer-imgbar" style="display:'+(a?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(u[d].alt||"")+"</a><em>"+s.imgIndex+" / "+u.length+"</em></span></div></div>":""}()+"</div>",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;",{time:3e4,btn:["&#x4E0B;&#x4E00;&#x5F20;","&#x4E0D;&#x770B;&#x4E86;"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define('layer',["jquery"],function(){return o.run(e.jQuery),r}):function(){r.ready(),o.run(e.jQuery)}()}(window);
  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.size() > 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").size() > 0)) {
  770. options.area = [top.$(".tab-pane.active").width() + "px", top.$(".tab-pane.active").height() + "px"];
  771. options.offset = [top.$(".tab-pane.active").scrollTop() + "px", "0px"];
  772. }
  773. return Layer.open(options);
  774. },
  775. //关闭窗口并回传数据
  776. close: function (data) {
  777. var index = parent.Layer.getFrameIndex(window.name);
  778. var callback = parent.$("#layui-layer" + index).data("callback");
  779. //再执行关闭
  780. parent.Layer.close(index);
  781. //再调用回传函数
  782. if (typeof callback === 'function') {
  783. callback.call(undefined, data);
  784. }
  785. },
  786. layerfooter: function (layero, index, that) {
  787. var frame = Layer.getChildFrame('html', index);
  788. var layerfooter = frame.find(".layer-footer");
  789. if (layerfooter.size() > 0) {
  790. $(".layui-layer-footer", layero).remove();
  791. var footer = $("<div />").addClass('layui-layer-btn layui-layer-footer');
  792. footer.html(layerfooter.html());
  793. if ($(".row", footer).size() === 0) {
  794. $(">", footer).wrapAll("<div class='row'></div>");
  795. }
  796. footer.insertAfter(layero.find('.layui-layer-content'));
  797. //绑定事件
  798. footer.on("click", ".btn", function () {
  799. if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
  800. return;
  801. }
  802. var index = footer.find('.btn').index(this);
  803. $(".btn:eq(" + index + ")", layerfooter).trigger("click");
  804. });
  805. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  806. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  807. //重设iframe高度
  808. $("iframe", layero).height(layero.height() - titHeight - btnHeight);
  809. }
  810. //修复iOS下弹出窗口的高度和iOS下iframe无法滚动的BUG
  811. if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
  812. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  813. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  814. $("iframe", layero).parent().css("height", layero.height() - titHeight - btnHeight);
  815. $("iframe", layero).css("height", "100%");
  816. }
  817. },
  818. success: function (options, callback) {
  819. var type = typeof options === 'function';
  820. if (type) {
  821. callback = options;
  822. }
  823. return Layer.msg(__('Operation completed'), $.extend({
  824. offset: 0, icon: 1
  825. }, type ? {} : options), callback);
  826. },
  827. error: function (options, callback) {
  828. var type = typeof options === 'function';
  829. if (type) {
  830. callback = options;
  831. }
  832. return Layer.msg(__('Operation failed'), $.extend({
  833. offset: 0, icon: 2
  834. }, type ? {} : options), callback);
  835. },
  836. msg: function (message, url) {
  837. var callback = typeof url === 'function' ? url : function () {
  838. if (typeof url !== 'undefined' && url) {
  839. location.href = url;
  840. }
  841. };
  842. Layer.msg(message, {
  843. time: 2000
  844. }, callback);
  845. },
  846. toastr: Toastr,
  847. layer: Layer
  848. },
  849. lang: function () {
  850. var args = arguments,
  851. string = args[0],
  852. i = 1;
  853. string = string.toLowerCase();
  854. //string = typeof Lang[string] != 'undefined' ? Lang[string] : string;
  855. if (typeof Lang !== 'undefined' && typeof Lang[string] !== 'undefined') {
  856. if (typeof Lang[string] == 'object')
  857. return Lang[string];
  858. string = Lang[string];
  859. } else if (string.indexOf('.') !== -1 && false) {
  860. var arr = string.split('.');
  861. var current = Lang[arr[0]];
  862. for (var i = 1; i < arr.length; i++) {
  863. current = typeof current[arr[i]] != 'undefined' ? current[arr[i]] : '';
  864. if (typeof current != 'object')
  865. break;
  866. }
  867. if (typeof current == 'object')
  868. return current;
  869. string = current;
  870. } else {
  871. string = args[0];
  872. }
  873. return string.replace(/%((%)|s|d)/g, function (m) {
  874. // m is the matched format, e.g. %s, %d
  875. var val = null;
  876. if (m[2]) {
  877. val = m[2];
  878. } else {
  879. val = args[i];
  880. // A switch statement so that the formatter can be extended. Default is %s
  881. switch (m) {
  882. case '%d':
  883. val = parseFloat(val);
  884. if (isNaN(val)) {
  885. val = 0;
  886. }
  887. break;
  888. }
  889. i++;
  890. }
  891. return val;
  892. });
  893. },
  894. init: function () {
  895. // 对相对地址进行处理
  896. $.ajaxSetup({
  897. beforeSend: function (xhr, setting) {
  898. setting.url = Fast.api.fixurl(setting.url);
  899. }
  900. });
  901. Layer.config({
  902. skin: 'layui-layer-fast'
  903. });
  904. // 绑定ESC关闭窗口事件
  905. $(window).keyup(function (e) {
  906. if (e.keyCode == 27) {
  907. if ($(".layui-layer").size() > 0) {
  908. var index = 0;
  909. $(".layui-layer").each(function () {
  910. index = Math.max(index, parseInt($(this).attr("times")));
  911. });
  912. if (index) {
  913. Layer.close(index);
  914. }
  915. }
  916. }
  917. });
  918. //公共代码
  919. //配置Toastr的参数
  920. Toastr.options = Fast.config.toastr;
  921. }
  922. };
  923. //将Layer暴露到全局中去
  924. window.Layer = Layer;
  925. //将Toastr暴露到全局中去
  926. window.Toastr = Toastr;
  927. //将语言方法暴露到全局中去
  928. window.__ = Fast.lang;
  929. //将Fast渲染至全局
  930. window.Fast = Fast;
  931. //默认初始化执行的代码
  932. Fast.init();
  933. return Fast;
  934. });
  935. /*!art-template - Template Engine | http://aui.github.com/artTemplate/*/
  936. !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}();
  937. //! moment.js
  938. //! version : 2.29.1
  939. //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
  940. //! license : MIT
  941. //! momentjs.com
  942. ;(function (global, factory) {
  943. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  944. typeof define === 'function' && define.amd ? define('moment/moment',factory) :
  945. global.moment = factory()
  946. }(this, (function () { 'use strict';
  947. var hookCallback;
  948. function hooks() {
  949. return hookCallback.apply(null, arguments);
  950. }
  951. // This is done to register the method called with moment()
  952. // without creating circular dependencies.
  953. function setHookCallback(callback) {
  954. hookCallback = callback;
  955. }
  956. function isArray(input) {
  957. return (
  958. input instanceof Array ||
  959. Object.prototype.toString.call(input) === '[object Array]'
  960. );
  961. }
  962. function isObject(input) {
  963. // IE8 will treat undefined and null as object if it wasn't for
  964. // input != null
  965. return (
  966. input != null &&
  967. Object.prototype.toString.call(input) === '[object Object]'
  968. );
  969. }
  970. function hasOwnProp(a, b) {
  971. return Object.prototype.hasOwnProperty.call(a, b);
  972. }
  973. function isObjectEmpty(obj) {
  974. if (Object.getOwnPropertyNames) {
  975. return Object.getOwnPropertyNames(obj).length === 0;
  976. } else {
  977. var k;
  978. for (k in obj) {
  979. if (hasOwnProp(obj, k)) {
  980. return false;
  981. }
  982. }
  983. return true;
  984. }
  985. }
  986. function isUndefined(input) {
  987. return input === void 0;
  988. }
  989. function isNumber(input) {
  990. return (
  991. typeof input === 'number' ||
  992. Object.prototype.toString.call(input) === '[object Number]'
  993. );
  994. }
  995. function isDate(input) {
  996. return (
  997. input instanceof Date ||
  998. Object.prototype.toString.call(input) === '[object Date]'
  999. );
  1000. }
  1001. function map(arr, fn) {
  1002. var res = [],
  1003. i;
  1004. for (i = 0; i < arr.length; ++i) {
  1005. res.push(fn(arr[i], i));
  1006. }
  1007. return res;
  1008. }
  1009. function extend(a, b) {
  1010. for (var i in b) {
  1011. if (hasOwnProp(b, i)) {
  1012. a[i] = b[i];
  1013. }
  1014. }
  1015. if (hasOwnProp(b, 'toString')) {
  1016. a.toString = b.toString;
  1017. }
  1018. if (hasOwnProp(b, 'valueOf')) {
  1019. a.valueOf = b.valueOf;
  1020. }
  1021. return a;
  1022. }
  1023. function createUTC(input, format, locale, strict) {
  1024. return createLocalOrUTC(input, format, locale, strict, true).utc();
  1025. }
  1026. function defaultParsingFlags() {
  1027. // We need to deep clone this object.
  1028. return {
  1029. empty: false,
  1030. unusedTokens: [],
  1031. unusedInput: [],
  1032. overflow: -2,
  1033. charsLeftOver: 0,
  1034. nullInput: false,
  1035. invalidEra: null,
  1036. invalidMonth: null,
  1037. invalidFormat: false,
  1038. userInvalidated: false,
  1039. iso: false,
  1040. parsedDateParts: [],
  1041. era: null,
  1042. meridiem: null,
  1043. rfc2822: false,
  1044. weekdayMismatch: false,
  1045. };
  1046. }
  1047. function getParsingFlags(m) {
  1048. if (m._pf == null) {
  1049. m._pf = defaultParsingFlags();
  1050. }
  1051. return m._pf;
  1052. }
  1053. var some;
  1054. if (Array.prototype.some) {
  1055. some = Array.prototype.some;
  1056. } else {
  1057. some = function (fun) {
  1058. var t = Object(this),
  1059. len = t.length >>> 0,
  1060. i;
  1061. for (i = 0; i < len; i++) {
  1062. if (i in t && fun.call(this, t[i], i, t)) {
  1063. return true;
  1064. }
  1065. }
  1066. return false;
  1067. };
  1068. }
  1069. function isValid(m) {
  1070. if (m._isValid == null) {
  1071. var flags = getParsingFlags(m),
  1072. parsedParts = some.call(flags.parsedDateParts, function (i) {
  1073. return i != null;
  1074. }),
  1075. isNowValid =
  1076. !isNaN(m._d.getTime()) &&
  1077. flags.overflow < 0 &&
  1078. !flags.empty &&
  1079. !flags.invalidEra &&
  1080. !flags.invalidMonth &&
  1081. !flags.invalidWeekday &&
  1082. !flags.weekdayMismatch &&
  1083. !flags.nullInput &&
  1084. !flags.invalidFormat &&
  1085. !flags.userInvalidated &&
  1086. (!flags.meridiem || (flags.meridiem && parsedParts));
  1087. if (m._strict) {
  1088. isNowValid =
  1089. isNowValid &&
  1090. flags.charsLeftOver === 0 &&
  1091. flags.unusedTokens.length === 0 &&
  1092. flags.bigHour === undefined;
  1093. }
  1094. if (Object.isFrozen == null || !Object.isFrozen(m)) {
  1095. m._isValid = isNowValid;
  1096. } else {
  1097. return isNowValid;
  1098. }
  1099. }
  1100. return m._isValid;
  1101. }
  1102. function createInvalid(flags) {
  1103. var m = createUTC(NaN);
  1104. if (flags != null) {
  1105. extend(getParsingFlags(m), flags);
  1106. } else {
  1107. getParsingFlags(m).userInvalidated = true;
  1108. }
  1109. return m;
  1110. }
  1111. // Plugins that add properties should also add the key here (null value),
  1112. // so we can properly clone ourselves.
  1113. var momentProperties = (hooks.momentProperties = []),
  1114. updateInProgress = false;
  1115. function copyConfig(to, from) {
  1116. var i, prop, val;
  1117. if (!isUndefined(from._isAMomentObject)) {
  1118. to._isAMomentObject = from._isAMomentObject;
  1119. }
  1120. if (!isUndefined(from._i)) {
  1121. to._i = from._i;
  1122. }
  1123. if (!isUndefined(from._f)) {
  1124. to._f = from._f;
  1125. }
  1126. if (!isUndefined(from._l)) {
  1127. to._l = from._l;
  1128. }
  1129. if (!isUndefined(from._strict)) {
  1130. to._strict = from._strict;
  1131. }
  1132. if (!isUndefined(from._tzm)) {
  1133. to._tzm = from._tzm;
  1134. }
  1135. if (!isUndefined(from._isUTC)) {
  1136. to._isUTC = from._isUTC;
  1137. }
  1138. if (!isUndefined(from._offset)) {
  1139. to._offset = from._offset;
  1140. }
  1141. if (!isUndefined(from._pf)) {
  1142. to._pf = getParsingFlags(from);
  1143. }
  1144. if (!isUndefined(from._locale)) {
  1145. to._locale = from._locale;
  1146. }
  1147. if (momentProperties.length > 0) {
  1148. for (i = 0; i < momentProperties.length; i++) {
  1149. prop = momentProperties[i];
  1150. val = from[prop];
  1151. if (!isUndefined(val)) {
  1152. to[prop] = val;
  1153. }
  1154. }
  1155. }
  1156. return to;
  1157. }
  1158. // Moment prototype object
  1159. function Moment(config) {
  1160. copyConfig(this, config);
  1161. this._d = new Date(config._d != null ? config._d.getTime() : NaN);
  1162. if (!this.isValid()) {
  1163. this._d = new Date(NaN);
  1164. }
  1165. // Prevent infinite loop in case updateOffset creates new moment
  1166. // objects.
  1167. if (updateInProgress === false) {
  1168. updateInProgress = true;
  1169. hooks.updateOffset(this);
  1170. updateInProgress = false;
  1171. }
  1172. }
  1173. function isMoment(obj) {
  1174. return (
  1175. obj instanceof Moment || (obj != null && obj._isAMomentObject != null)
  1176. );
  1177. }
  1178. function warn(msg) {
  1179. if (
  1180. hooks.suppressDeprecationWarnings === false &&
  1181. typeof console !== 'undefined' &&
  1182. console.warn
  1183. ) {
  1184. console.warn('Deprecation warning: ' + msg);
  1185. }
  1186. }
  1187. function deprecate(msg, fn) {
  1188. var firstTime = true;
  1189. return extend(function () {
  1190. if (hooks.deprecationHandler != null) {
  1191. hooks.deprecationHandler(null, msg);
  1192. }
  1193. if (firstTime) {
  1194. var args = [],
  1195. arg,
  1196. i,
  1197. key;
  1198. for (i = 0; i < arguments.length; i++) {
  1199. arg = '';
  1200. if (typeof arguments[i] === 'object') {
  1201. arg += '\n[' + i + '] ';
  1202. for (key in arguments[0]) {
  1203. if (hasOwnProp(arguments[0], key)) {
  1204. arg += key + ': ' + arguments[0][key] + ', ';
  1205. }
  1206. }
  1207. arg = arg.slice(0, -2); // Remove trailing comma and space
  1208. } else {
  1209. arg = arguments[i];
  1210. }
  1211. args.push(arg);
  1212. }
  1213. warn(
  1214. msg +
  1215. '\nArguments: ' +
  1216. Array.prototype.slice.call(args).join('') +
  1217. '\n' +
  1218. new Error().stack
  1219. );
  1220. firstTime = false;
  1221. }
  1222. return fn.apply(this, arguments);
  1223. }, fn);
  1224. }
  1225. var deprecations = {};
  1226. function deprecateSimple(name, msg) {
  1227. if (hooks.deprecationHandler != null) {
  1228. hooks.deprecationHandler(name, msg);
  1229. }
  1230. if (!deprecations[name]) {
  1231. warn(msg);
  1232. deprecations[name] = true;
  1233. }
  1234. }
  1235. hooks.suppressDeprecationWarnings = false;
  1236. hooks.deprecationHandler = null;
  1237. function isFunction(input) {
  1238. return (
  1239. (typeof Function !== 'undefined' && input instanceof Function) ||
  1240. Object.prototype.toString.call(input) === '[object Function]'
  1241. );
  1242. }
  1243. function set(config) {
  1244. var prop, i;
  1245. for (i in config) {
  1246. if (hasOwnProp(config, i)) {
  1247. prop = config[i];
  1248. if (isFunction(prop)) {
  1249. this[i] = prop;
  1250. } else {
  1251. this['_' + i] = prop;
  1252. }
  1253. }
  1254. }
  1255. this._config = config;
  1256. // Lenient ordinal parsing accepts just a number in addition to
  1257. // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
  1258. // TODO: Remove "ordinalParse" fallback in next major release.
  1259. this._dayOfMonthOrdinalParseLenient = new RegExp(
  1260. (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
  1261. '|' +
  1262. /\d{1,2}/.source
  1263. );
  1264. }
  1265. function mergeConfigs(parentConfig, childConfig) {
  1266. var res = extend({}, parentConfig),
  1267. prop;
  1268. for (prop in childConfig) {
  1269. if (hasOwnProp(childConfig, prop)) {
  1270. if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
  1271. res[prop] = {};
  1272. extend(res[prop], parentConfig[prop]);
  1273. extend(res[prop], childConfig[prop]);
  1274. } else if (childConfig[prop] != null) {
  1275. res[prop] = childConfig[prop];
  1276. } else {
  1277. delete res[prop];
  1278. }
  1279. }
  1280. }
  1281. for (prop in parentConfig) {
  1282. if (
  1283. hasOwnProp(parentConfig, prop) &&
  1284. !hasOwnProp(childConfig, prop) &&
  1285. isObject(parentConfig[prop])
  1286. ) {
  1287. // make sure changes to properties don't modify parent config
  1288. res[prop] = extend({}, res[prop]);
  1289. }
  1290. }
  1291. return res;
  1292. }
  1293. function Locale(config) {
  1294. if (config != null) {
  1295. this.set(config);
  1296. }
  1297. }
  1298. var keys;
  1299. if (Object.keys) {
  1300. keys = Object.keys;
  1301. } else {
  1302. keys = function (obj) {
  1303. var i,
  1304. res = [];
  1305. for (i in obj) {
  1306. if (hasOwnProp(obj, i)) {
  1307. res.push(i);
  1308. }
  1309. }
  1310. return res;
  1311. };
  1312. }
  1313. var defaultCalendar = {
  1314. sameDay: '[Today at] LT',
  1315. nextDay: '[Tomorrow at] LT',
  1316. nextWeek: 'dddd [at] LT',
  1317. lastDay: '[Yesterday at] LT',
  1318. lastWeek: '[Last] dddd [at] LT',
  1319. sameElse: 'L',
  1320. };
  1321. function calendar(key, mom, now) {
  1322. var output = this._calendar[key] || this._calendar['sameElse'];
  1323. return isFunction(output) ? output.call(mom, now) : output;
  1324. }
  1325. function zeroFill(number, targetLength, forceSign) {
  1326. var absNumber = '' + Math.abs(number),
  1327. zerosToFill = targetLength - absNumber.length,
  1328. sign = number >= 0;
  1329. return (
  1330. (sign ? (forceSign ? '+' : '') : '-') +
  1331. Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +
  1332. absNumber
  1333. );
  1334. }
  1335. var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,
  1336. localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
  1337. formatFunctions = {},
  1338. formatTokenFunctions = {};
  1339. // token: 'M'
  1340. // padded: ['MM', 2]
  1341. // ordinal: 'Mo'
  1342. // callback: function () { this.month() + 1 }
  1343. function addFormatToken(token, padded, ordinal, callback) {
  1344. var func = callback;
  1345. if (typeof callback === 'string') {
  1346. func = function () {
  1347. return this[callback]();
  1348. };
  1349. }
  1350. if (token) {
  1351. formatTokenFunctions[token] = func;
  1352. }
  1353. if (padded) {
  1354. formatTokenFunctions[padded[0]] = function () {
  1355. return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
  1356. };
  1357. }
  1358. if (ordinal) {
  1359. formatTokenFunctions[ordinal] = function () {
  1360. return this.localeData().ordinal(
  1361. func.apply(this, arguments),
  1362. token
  1363. );
  1364. };
  1365. }
  1366. }
  1367. function removeFormattingTokens(input) {
  1368. if (input.match(/\[[\s\S]/)) {
  1369. return input.replace(/^\[|\]$/g, '');
  1370. }
  1371. return input.replace(/\\/g, '');
  1372. }
  1373. function makeFormatFunction(format) {
  1374. var array = format.match(formattingTokens),
  1375. i,
  1376. length;
  1377. for (i = 0, length = array.length; i < length; i++) {
  1378. if (formatTokenFunctions[array[i]]) {
  1379. array[i] = formatTokenFunctions[array[i]];
  1380. } else {
  1381. array[i] = removeFormattingTokens(array[i]);
  1382. }
  1383. }
  1384. return function (mom) {
  1385. var output = '',
  1386. i;
  1387. for (i = 0; i < length; i++) {
  1388. output += isFunction(array[i])
  1389. ? array[i].call(mom, format)
  1390. : array[i];
  1391. }
  1392. return output;
  1393. };
  1394. }
  1395. // format date using native date object
  1396. function formatMoment(m, format) {
  1397. if (!m.isValid()) {
  1398. return m.localeData().invalidDate();
  1399. }
  1400. format = expandFormat(format, m.localeData());
  1401. formatFunctions[format] =
  1402. formatFunctions[format] || makeFormatFunction(format);
  1403. return formatFunctions[format](m);
  1404. }
  1405. function expandFormat(format, locale) {
  1406. var i = 5;
  1407. function replaceLongDateFormatTokens(input) {
  1408. return locale.longDateFormat(input) || input;
  1409. }
  1410. localFormattingTokens.lastIndex = 0;
  1411. while (i >= 0 && localFormattingTokens.test(format)) {
  1412. format = format.replace(
  1413. localFormattingTokens,
  1414. replaceLongDateFormatTokens
  1415. );
  1416. localFormattingTokens.lastIndex = 0;
  1417. i -= 1;
  1418. }
  1419. return format;
  1420. }
  1421. var defaultLongDateFormat = {
  1422. LTS: 'h:mm:ss A',
  1423. LT: 'h:mm A',
  1424. L: 'MM/DD/YYYY',
  1425. LL: 'MMMM D, YYYY',
  1426. LLL: 'MMMM D, YYYY h:mm A',
  1427. LLLL: 'dddd, MMMM D, YYYY h:mm A',
  1428. };
  1429. function longDateFormat(key) {
  1430. var format = this._longDateFormat[key],
  1431. formatUpper = this._longDateFormat[key.toUpperCase()];
  1432. if (format || !formatUpper) {
  1433. return format;
  1434. }
  1435. this._longDateFormat[key] = formatUpper
  1436. .match(formattingTokens)
  1437. .map(function (tok) {
  1438. if (
  1439. tok === 'MMMM' ||
  1440. tok === 'MM' ||
  1441. tok === 'DD' ||
  1442. tok === 'dddd'
  1443. ) {
  1444. return tok.slice(1);
  1445. }
  1446. return tok;
  1447. })
  1448. .join('');
  1449. return this._longDateFormat[key];
  1450. }
  1451. var defaultInvalidDate = 'Invalid date';
  1452. function invalidDate() {
  1453. return this._invalidDate;
  1454. }
  1455. var defaultOrdinal = '%d',
  1456. defaultDayOfMonthOrdinalParse = /\d{1,2}/;
  1457. function ordinal(number) {
  1458. return this._ordinal.replace('%d', number);
  1459. }
  1460. var defaultRelativeTime = {
  1461. future: 'in %s',
  1462. past: '%s ago',
  1463. s: 'a few seconds',
  1464. ss: '%d seconds',
  1465. m: 'a minute',
  1466. mm: '%d minutes',
  1467. h: 'an hour',
  1468. hh: '%d hours',
  1469. d: 'a day',
  1470. dd: '%d days',
  1471. w: 'a week',
  1472. ww: '%d weeks',
  1473. M: 'a month',
  1474. MM: '%d months',
  1475. y: 'a year',
  1476. yy: '%d years',
  1477. };
  1478. function relativeTime(number, withoutSuffix, string, isFuture) {
  1479. var output = this._relativeTime[string];
  1480. return isFunction(output)
  1481. ? output(number, withoutSuffix, string, isFuture)
  1482. : output.replace(/%d/i, number);
  1483. }
  1484. function pastFuture(diff, output) {
  1485. var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
  1486. return isFunction(format) ? format(output) : format.replace(/%s/i, output);
  1487. }
  1488. var aliases = {};
  1489. function addUnitAlias(unit, shorthand) {
  1490. var lowerCase = unit.toLowerCase();
  1491. aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
  1492. }
  1493. function normalizeUnits(units) {
  1494. return typeof units === 'string'
  1495. ? aliases[units] || aliases[units.toLowerCase()]
  1496. : undefined;
  1497. }
  1498. function normalizeObjectUnits(inputObject) {
  1499. var normalizedInput = {},
  1500. normalizedProp,
  1501. prop;
  1502. for (prop in inputObject) {
  1503. if (hasOwnProp(inputObject, prop)) {
  1504. normalizedProp = normalizeUnits(prop);
  1505. if (normalizedProp) {
  1506. normalizedInput[normalizedProp] = inputObject[prop];
  1507. }
  1508. }
  1509. }
  1510. return normalizedInput;
  1511. }
  1512. var priorities = {};
  1513. function addUnitPriority(unit, priority) {
  1514. priorities[unit] = priority;
  1515. }
  1516. function getPrioritizedUnits(unitsObj) {
  1517. var units = [],
  1518. u;
  1519. for (u in unitsObj) {
  1520. if (hasOwnProp(unitsObj, u)) {
  1521. units.push({ unit: u, priority: priorities[u] });
  1522. }
  1523. }
  1524. units.sort(function (a, b) {
  1525. return a.priority - b.priority;
  1526. });
  1527. return units;
  1528. }
  1529. function isLeapYear(year) {
  1530. return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
  1531. }
  1532. function absFloor(number) {
  1533. if (number < 0) {
  1534. // -0 -> 0
  1535. return Math.ceil(number) || 0;
  1536. } else {
  1537. return Math.floor(number);
  1538. }
  1539. }
  1540. function toInt(argumentForCoercion) {
  1541. var coercedNumber = +argumentForCoercion,
  1542. value = 0;
  1543. if (coercedNumber !== 0 && isFinite(coercedNumber)) {
  1544. value = absFloor(coercedNumber);
  1545. }
  1546. return value;
  1547. }
  1548. function makeGetSet(unit, keepTime) {
  1549. return function (value) {
  1550. if (value != null) {
  1551. set$1(this, unit, value);
  1552. hooks.updateOffset(this, keepTime);
  1553. return this;
  1554. } else {
  1555. return get(this, unit);
  1556. }
  1557. };
  1558. }
  1559. function get(mom, unit) {
  1560. return mom.isValid()
  1561. ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]()
  1562. : NaN;
  1563. }
  1564. function set$1(mom, unit, value) {
  1565. if (mom.isValid() && !isNaN(value)) {
  1566. if (
  1567. unit === 'FullYear' &&
  1568. isLeapYear(mom.year()) &&
  1569. mom.month() === 1 &&
  1570. mom.date() === 29
  1571. ) {
  1572. value = toInt(value);
  1573. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](
  1574. value,
  1575. mom.month(),
  1576. daysInMonth(value, mom.month())
  1577. );
  1578. } else {
  1579. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
  1580. }
  1581. }
  1582. }
  1583. // MOMENTS
  1584. function stringGet(units) {
  1585. units = normalizeUnits(units);
  1586. if (isFunction(this[units])) {
  1587. return this[units]();
  1588. }
  1589. return this;
  1590. }
  1591. function stringSet(units, value) {
  1592. if (typeof units === 'object') {
  1593. units = normalizeObjectUnits(units);
  1594. var prioritized = getPrioritizedUnits(units),
  1595. i;
  1596. for (i = 0; i < prioritized.length; i++) {
  1597. this[prioritized[i].unit](units[prioritized[i].unit]);
  1598. }
  1599. } else {
  1600. units = normalizeUnits(units);
  1601. if (isFunction(this[units])) {
  1602. return this[units](value);
  1603. }
  1604. }
  1605. return this;
  1606. }
  1607. var match1 = /\d/, // 0 - 9
  1608. match2 = /\d\d/, // 00 - 99
  1609. match3 = /\d{3}/, // 000 - 999
  1610. match4 = /\d{4}/, // 0000 - 9999
  1611. match6 = /[+-]?\d{6}/, // -999999 - 999999
  1612. match1to2 = /\d\d?/, // 0 - 99
  1613. match3to4 = /\d\d\d\d?/, // 999 - 9999
  1614. match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999
  1615. match1to3 = /\d{1,3}/, // 0 - 999
  1616. match1to4 = /\d{1,4}/, // 0 - 9999
  1617. match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999
  1618. matchUnsigned = /\d+/, // 0 - inf
  1619. matchSigned = /[+-]?\d+/, // -inf - inf
  1620. matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
  1621. matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z
  1622. matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
  1623. // any word (or two) characters or numbers including two/three word month in arabic.
  1624. // includes scottish gaelic two word and hyphenated months
  1625. matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,
  1626. regexes;
  1627. regexes = {};
  1628. function addRegexToken(token, regex, strictRegex) {
  1629. regexes[token] = isFunction(regex)
  1630. ? regex
  1631. : function (isStrict, localeData) {
  1632. return isStrict && strictRegex ? strictRegex : regex;
  1633. };
  1634. }
  1635. function getParseRegexForToken(token, config) {
  1636. if (!hasOwnProp(regexes, token)) {
  1637. return new RegExp(unescapeFormat(token));
  1638. }
  1639. return regexes[token](config._strict, config._locale);
  1640. }
  1641. // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
  1642. function unescapeFormat(s) {
  1643. return regexEscape(
  1644. s
  1645. .replace('\\', '')
  1646. .replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (
  1647. matched,
  1648. p1,
  1649. p2,
  1650. p3,
  1651. p4
  1652. ) {
  1653. return p1 || p2 || p3 || p4;
  1654. })
  1655. );
  1656. }
  1657. function regexEscape(s) {
  1658. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  1659. }
  1660. var tokens = {};
  1661. function addParseToken(token, callback) {
  1662. var i,
  1663. func = callback;
  1664. if (typeof token === 'string') {
  1665. token = [token];
  1666. }
  1667. if (isNumber(callback)) {
  1668. func = function (input, array) {
  1669. array[callback] = toInt(input);
  1670. };
  1671. }
  1672. for (i = 0; i < token.length; i++) {
  1673. tokens[token[i]] = func;
  1674. }
  1675. }
  1676. function addWeekParseToken(token, callback) {
  1677. addParseToken(token, function (input, array, config, token) {
  1678. config._w = config._w || {};
  1679. callback(input, config._w, config, token);
  1680. });
  1681. }
  1682. function addTimeToArrayFromToken(token, input, config) {
  1683. if (input != null && hasOwnProp(tokens, token)) {
  1684. tokens[token](input, config._a, config, token);
  1685. }
  1686. }
  1687. var YEAR = 0,
  1688. MONTH = 1,
  1689. DATE = 2,
  1690. HOUR = 3,
  1691. MINUTE = 4,
  1692. SECOND = 5,
  1693. MILLISECOND = 6,
  1694. WEEK = 7,
  1695. WEEKDAY = 8;
  1696. function mod(n, x) {
  1697. return ((n % x) + x) % x;
  1698. }
  1699. var indexOf;
  1700. if (Array.prototype.indexOf) {
  1701. indexOf = Array.prototype.indexOf;
  1702. } else {
  1703. indexOf = function (o) {
  1704. // I know
  1705. var i;
  1706. for (i = 0; i < this.length; ++i) {
  1707. if (this[i] === o) {
  1708. return i;
  1709. }
  1710. }
  1711. return -1;
  1712. };
  1713. }
  1714. function daysInMonth(year, month) {
  1715. if (isNaN(year) || isNaN(month)) {
  1716. return NaN;
  1717. }
  1718. var modMonth = mod(month, 12);
  1719. year += (month - modMonth) / 12;
  1720. return modMonth === 1
  1721. ? isLeapYear(year)
  1722. ? 29
  1723. : 28
  1724. : 31 - ((modMonth % 7) % 2);
  1725. }
  1726. // FORMATTING
  1727. addFormatToken('M', ['MM', 2], 'Mo', function () {
  1728. return this.month() + 1;
  1729. });
  1730. addFormatToken('MMM', 0, 0, function (format) {
  1731. return this.localeData().monthsShort(this, format);
  1732. });
  1733. addFormatToken('MMMM', 0, 0, function (format) {
  1734. return this.localeData().months(this, format);
  1735. });
  1736. // ALIASES
  1737. addUnitAlias('month', 'M');
  1738. // PRIORITY
  1739. addUnitPriority('month', 8);
  1740. // PARSING
  1741. addRegexToken('M', match1to2);
  1742. addRegexToken('MM', match1to2, match2);
  1743. addRegexToken('MMM', function (isStrict, locale) {
  1744. return locale.monthsShortRegex(isStrict);
  1745. });
  1746. addRegexToken('MMMM', function (isStrict, locale) {
  1747. return locale.monthsRegex(isStrict);
  1748. });
  1749. addParseToken(['M', 'MM'], function (input, array) {
  1750. array[MONTH] = toInt(input) - 1;
  1751. });
  1752. addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
  1753. var month = config._locale.monthsParse(input, token, config._strict);
  1754. // if we didn't find a month name, mark the date as invalid.
  1755. if (month != null) {
  1756. array[MONTH] = month;
  1757. } else {
  1758. getParsingFlags(config).invalidMonth = input;
  1759. }
  1760. });
  1761. // LOCALES
  1762. var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
  1763. '_'
  1764. ),
  1765. defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split(
  1766. '_'
  1767. ),
  1768. MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
  1769. defaultMonthsShortRegex = matchWord,
  1770. defaultMonthsRegex = matchWord;
  1771. function localeMonths(m, format) {
  1772. if (!m) {
  1773. return isArray(this._months)
  1774. ? this._months
  1775. : this._months['standalone'];
  1776. }
  1777. return isArray(this._months)
  1778. ? this._months[m.month()]
  1779. : this._months[
  1780. (this._months.isFormat || MONTHS_IN_FORMAT).test(format)
  1781. ? 'format'
  1782. : 'standalone'
  1783. ][m.month()];
  1784. }
  1785. function localeMonthsShort(m, format) {
  1786. if (!m) {
  1787. return isArray(this._monthsShort)
  1788. ? this._monthsShort
  1789. : this._monthsShort['standalone'];
  1790. }
  1791. return isArray(this._monthsShort)
  1792. ? this._monthsShort[m.month()]
  1793. : this._monthsShort[
  1794. MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'
  1795. ][m.month()];
  1796. }
  1797. function handleStrictParse(monthName, format, strict) {
  1798. var i,
  1799. ii,
  1800. mom,
  1801. llc = monthName.toLocaleLowerCase();
  1802. if (!this._monthsParse) {
  1803. // this is not used
  1804. this._monthsParse = [];
  1805. this._longMonthsParse = [];
  1806. this._shortMonthsParse = [];
  1807. for (i = 0; i < 12; ++i) {
  1808. mom = createUTC([2000, i]);
  1809. this._shortMonthsParse[i] = this.monthsShort(
  1810. mom,
  1811. ''
  1812. ).toLocaleLowerCase();
  1813. this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
  1814. }
  1815. }
  1816. if (strict) {
  1817. if (format === 'MMM') {
  1818. ii = indexOf.call(this._shortMonthsParse, llc);
  1819. return ii !== -1 ? ii : null;
  1820. } else {
  1821. ii = indexOf.call(this._longMonthsParse, llc);
  1822. return ii !== -1 ? ii : null;
  1823. }
  1824. } else {
  1825. if (format === 'MMM') {
  1826. ii = indexOf.call(this._shortMonthsParse, llc);
  1827. if (ii !== -1) {
  1828. return ii;
  1829. }
  1830. ii = indexOf.call(this._longMonthsParse, llc);
  1831. return ii !== -1 ? ii : null;
  1832. } else {
  1833. ii = indexOf.call(this._longMonthsParse, llc);
  1834. if (ii !== -1) {
  1835. return ii;
  1836. }
  1837. ii = indexOf.call(this._shortMonthsParse, llc);
  1838. return ii !== -1 ? ii : null;
  1839. }
  1840. }
  1841. }
  1842. function localeMonthsParse(monthName, format, strict) {
  1843. var i, mom, regex;
  1844. if (this._monthsParseExact) {
  1845. return handleStrictParse.call(this, monthName, format, strict);
  1846. }
  1847. if (!this._monthsParse) {
  1848. this._monthsParse = [];
  1849. this._longMonthsParse = [];
  1850. this._shortMonthsParse = [];
  1851. }
  1852. // TODO: add sorting
  1853. // Sorting makes sure if one month (or abbr) is a prefix of another
  1854. // see sorting in computeMonthsParse
  1855. for (i = 0; i < 12; i++) {
  1856. // make the regex if we don't have it already
  1857. mom = createUTC([2000, i]);
  1858. if (strict && !this._longMonthsParse[i]) {
  1859. this._longMonthsParse[i] = new RegExp(
  1860. '^' + this.months(mom, '').replace('.', '') + '$',
  1861. 'i'
  1862. );
  1863. this._shortMonthsParse[i] = new RegExp(
  1864. '^' + this.monthsShort(mom, '').replace('.', '') + '$',
  1865. 'i'
  1866. );
  1867. }
  1868. if (!strict && !this._monthsParse[i]) {
  1869. regex =
  1870. '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
  1871. this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
  1872. }
  1873. // test the regex
  1874. if (
  1875. strict &&
  1876. format === 'MMMM' &&
  1877. this._longMonthsParse[i].test(monthName)
  1878. ) {
  1879. return i;
  1880. } else if (
  1881. strict &&
  1882. format === 'MMM' &&
  1883. this._shortMonthsParse[i].test(monthName)
  1884. ) {
  1885. return i;
  1886. } else if (!strict && this._monthsParse[i].test(monthName)) {
  1887. return i;
  1888. }
  1889. }
  1890. }
  1891. // MOMENTS
  1892. function setMonth(mom, value) {
  1893. var dayOfMonth;
  1894. if (!mom.isValid()) {
  1895. // No op
  1896. return mom;
  1897. }
  1898. if (typeof value === 'string') {
  1899. if (/^\d+$/.test(value)) {
  1900. value = toInt(value);
  1901. } else {
  1902. value = mom.localeData().monthsParse(value);
  1903. // TODO: Another silent failure?
  1904. if (!isNumber(value)) {
  1905. return mom;
  1906. }
  1907. }
  1908. }
  1909. dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
  1910. mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
  1911. return mom;
  1912. }
  1913. function getSetMonth(value) {
  1914. if (value != null) {
  1915. setMonth(this, value);
  1916. hooks.updateOffset(this, true);
  1917. return this;
  1918. } else {
  1919. return get(this, 'Month');
  1920. }
  1921. }
  1922. function getDaysInMonth() {
  1923. return daysInMonth(this.year(), this.month());
  1924. }
  1925. function monthsShortRegex(isStrict) {
  1926. if (this._monthsParseExact) {
  1927. if (!hasOwnProp(this, '_monthsRegex')) {
  1928. computeMonthsParse.call(this);
  1929. }
  1930. if (isStrict) {
  1931. return this._monthsShortStrictRegex;
  1932. } else {
  1933. return this._monthsShortRegex;
  1934. }
  1935. } else {
  1936. if (!hasOwnProp(this, '_monthsShortRegex')) {
  1937. this._monthsShortRegex = defaultMonthsShortRegex;
  1938. }
  1939. return this._monthsShortStrictRegex && isStrict
  1940. ? this._monthsShortStrictRegex
  1941. : this._monthsShortRegex;
  1942. }
  1943. }
  1944. function monthsRegex(isStrict) {
  1945. if (this._monthsParseExact) {
  1946. if (!hasOwnProp(this, '_monthsRegex')) {
  1947. computeMonthsParse.call(this);
  1948. }
  1949. if (isStrict) {
  1950. return this._monthsStrictRegex;
  1951. } else {
  1952. return this._monthsRegex;
  1953. }
  1954. } else {
  1955. if (!hasOwnProp(this, '_monthsRegex')) {
  1956. this._monthsRegex = defaultMonthsRegex;
  1957. }
  1958. return this._monthsStrictRegex && isStrict
  1959. ? this._monthsStrictRegex
  1960. : this._monthsRegex;
  1961. }
  1962. }
  1963. function computeMonthsParse() {
  1964. function cmpLenRev(a, b) {
  1965. return b.length - a.length;
  1966. }
  1967. var shortPieces = [],
  1968. longPieces = [],
  1969. mixedPieces = [],
  1970. i,
  1971. mom;
  1972. for (i = 0; i < 12; i++) {
  1973. // make the regex if we don't have it already
  1974. mom = createUTC([2000, i]);
  1975. shortPieces.push(this.monthsShort(mom, ''));
  1976. longPieces.push(this.months(mom, ''));
  1977. mixedPieces.push(this.months(mom, ''));
  1978. mixedPieces.push(this.monthsShort(mom, ''));
  1979. }
  1980. // Sorting makes sure if one month (or abbr) is a prefix of another it
  1981. // will match the longer piece.
  1982. shortPieces.sort(cmpLenRev);
  1983. longPieces.sort(cmpLenRev);
  1984. mixedPieces.sort(cmpLenRev);
  1985. for (i = 0; i < 12; i++) {
  1986. shortPieces[i] = regexEscape(shortPieces[i]);
  1987. longPieces[i] = regexEscape(longPieces[i]);
  1988. }
  1989. for (i = 0; i < 24; i++) {
  1990. mixedPieces[i] = regexEscape(mixedPieces[i]);
  1991. }
  1992. this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  1993. this._monthsShortRegex = this._monthsRegex;
  1994. this._monthsStrictRegex = new RegExp(
  1995. '^(' + longPieces.join('|') + ')',
  1996. 'i'
  1997. );
  1998. this._monthsShortStrictRegex = new RegExp(
  1999. '^(' + shortPieces.join('|') + ')',
  2000. 'i'
  2001. );
  2002. }
  2003. // FORMATTING
  2004. addFormatToken('Y', 0, 0, function () {
  2005. var y = this.year();
  2006. return y <= 9999 ? zeroFill(y, 4) : '+' + y;
  2007. });
  2008. addFormatToken(0, ['YY', 2], 0, function () {
  2009. return this.year() % 100;
  2010. });
  2011. addFormatToken(0, ['YYYY', 4], 0, 'year');
  2012. addFormatToken(0, ['YYYYY', 5], 0, 'year');
  2013. addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
  2014. // ALIASES
  2015. addUnitAlias('year', 'y');
  2016. // PRIORITIES
  2017. addUnitPriority('year', 1);
  2018. // PARSING
  2019. addRegexToken('Y', matchSigned);
  2020. addRegexToken('YY', match1to2, match2);
  2021. addRegexToken('YYYY', match1to4, match4);
  2022. addRegexToken('YYYYY', match1to6, match6);
  2023. addRegexToken('YYYYYY', match1to6, match6);
  2024. addParseToken(['YYYYY', 'YYYYYY'], YEAR);
  2025. addParseToken('YYYY', function (input, array) {
  2026. array[YEAR] =
  2027. input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
  2028. });
  2029. addParseToken('YY', function (input, array) {
  2030. array[YEAR] = hooks.parseTwoDigitYear(input);
  2031. });
  2032. addParseToken('Y', function (input, array) {
  2033. array[YEAR] = parseInt(input, 10);
  2034. });
  2035. // HELPERS
  2036. function daysInYear(year) {
  2037. return isLeapYear(year) ? 366 : 365;
  2038. }
  2039. // HOOKS
  2040. hooks.parseTwoDigitYear = function (input) {
  2041. return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
  2042. };
  2043. // MOMENTS
  2044. var getSetYear = makeGetSet('FullYear', true);
  2045. function getIsLeapYear() {
  2046. return isLeapYear(this.year());
  2047. }
  2048. function createDate(y, m, d, h, M, s, ms) {
  2049. // can't just apply() to create a date:
  2050. // https://stackoverflow.com/q/181348
  2051. var date;
  2052. // the date constructor remaps years 0-99 to 1900-1999
  2053. if (y < 100 && y >= 0) {
  2054. // preserve leap years using a full 400 year cycle, then reset
  2055. date = new Date(y + 400, m, d, h, M, s, ms);
  2056. if (isFinite(date.getFullYear())) {
  2057. date.setFullYear(y);
  2058. }
  2059. } else {
  2060. date = new Date(y, m, d, h, M, s, ms);
  2061. }
  2062. return date;
  2063. }
  2064. function createUTCDate(y) {
  2065. var date, args;
  2066. // the Date.UTC function remaps years 0-99 to 1900-1999
  2067. if (y < 100 && y >= 0) {
  2068. args = Array.prototype.slice.call(arguments);
  2069. // preserve leap years using a full 400 year cycle, then reset
  2070. args[0] = y + 400;
  2071. date = new Date(Date.UTC.apply(null, args));
  2072. if (isFinite(date.getUTCFullYear())) {
  2073. date.setUTCFullYear(y);
  2074. }
  2075. } else {
  2076. date = new Date(Date.UTC.apply(null, arguments));
  2077. }
  2078. return date;
  2079. }
  2080. // start-of-first-week - start-of-year
  2081. function firstWeekOffset(year, dow, doy) {
  2082. var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
  2083. fwd = 7 + dow - doy,
  2084. // first-week day local weekday -- which local weekday is fwd
  2085. fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  2086. return -fwdlw + fwd - 1;
  2087. }
  2088. // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
  2089. function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  2090. var localWeekday = (7 + weekday - dow) % 7,
  2091. weekOffset = firstWeekOffset(year, dow, doy),
  2092. dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
  2093. resYear,
  2094. resDayOfYear;
  2095. if (dayOfYear <= 0) {
  2096. resYear = year - 1;
  2097. resDayOfYear = daysInYear(resYear) + dayOfYear;
  2098. } else if (dayOfYear > daysInYear(year)) {
  2099. resYear = year + 1;
  2100. resDayOfYear = dayOfYear - daysInYear(year);
  2101. } else {
  2102. resYear = year;
  2103. resDayOfYear = dayOfYear;
  2104. }
  2105. return {
  2106. year: resYear,
  2107. dayOfYear: resDayOfYear,
  2108. };
  2109. }
  2110. function weekOfYear(mom, dow, doy) {
  2111. var weekOffset = firstWeekOffset(mom.year(), dow, doy),
  2112. week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
  2113. resWeek,
  2114. resYear;
  2115. if (week < 1) {
  2116. resYear = mom.year() - 1;
  2117. resWeek = week + weeksInYear(resYear, dow, doy);
  2118. } else if (week > weeksInYear(mom.year(), dow, doy)) {
  2119. resWeek = week - weeksInYear(mom.year(), dow, doy);
  2120. resYear = mom.year() + 1;
  2121. } else {
  2122. resYear = mom.year();
  2123. resWeek = week;
  2124. }
  2125. return {
  2126. week: resWeek,
  2127. year: resYear,
  2128. };
  2129. }
  2130. function weeksInYear(year, dow, doy) {
  2131. var weekOffset = firstWeekOffset(year, dow, doy),
  2132. weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  2133. return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
  2134. }
  2135. // FORMATTING
  2136. addFormatToken('w', ['ww', 2], 'wo', 'week');
  2137. addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
  2138. // ALIASES
  2139. addUnitAlias('week', 'w');
  2140. addUnitAlias('isoWeek', 'W');
  2141. // PRIORITIES
  2142. addUnitPriority('week', 5);
  2143. addUnitPriority('isoWeek', 5);
  2144. // PARSING
  2145. addRegexToken('w', match1to2);
  2146. addRegexToken('ww', match1to2, match2);
  2147. addRegexToken('W', match1to2);
  2148. addRegexToken('WW', match1to2, match2);
  2149. addWeekParseToken(['w', 'ww', 'W', 'WW'], function (
  2150. input,
  2151. week,
  2152. config,
  2153. token
  2154. ) {
  2155. week[token.substr(0, 1)] = toInt(input);
  2156. });
  2157. // HELPERS
  2158. // LOCALES
  2159. function localeWeek(mom) {
  2160. return weekOfYear(mom, this._week.dow, this._week.doy).week;
  2161. }
  2162. var defaultLocaleWeek = {
  2163. dow: 0, // Sunday is the first day of the week.
  2164. doy: 6, // The week that contains Jan 6th is the first week of the year.
  2165. };
  2166. function localeFirstDayOfWeek() {
  2167. return this._week.dow;
  2168. }
  2169. function localeFirstDayOfYear() {
  2170. return this._week.doy;
  2171. }
  2172. // MOMENTS
  2173. function getSetWeek(input) {
  2174. var week = this.localeData().week(this);
  2175. return input == null ? week : this.add((input - week) * 7, 'd');
  2176. }
  2177. function getSetISOWeek(input) {
  2178. var week = weekOfYear(this, 1, 4).week;
  2179. return input == null ? week : this.add((input - week) * 7, 'd');
  2180. }
  2181. // FORMATTING
  2182. addFormatToken('d', 0, 'do', 'day');
  2183. addFormatToken('dd', 0, 0, function (format) {
  2184. return this.localeData().weekdaysMin(this, format);
  2185. });
  2186. addFormatToken('ddd', 0, 0, function (format) {
  2187. return this.localeData().weekdaysShort(this, format);
  2188. });
  2189. addFormatToken('dddd', 0, 0, function (format) {
  2190. return this.localeData().weekdays(this, format);
  2191. });
  2192. addFormatToken('e', 0, 0, 'weekday');
  2193. addFormatToken('E', 0, 0, 'isoWeekday');
  2194. // ALIASES
  2195. addUnitAlias('day', 'd');
  2196. addUnitAlias('weekday', 'e');
  2197. addUnitAlias('isoWeekday', 'E');
  2198. // PRIORITY
  2199. addUnitPriority('day', 11);
  2200. addUnitPriority('weekday', 11);
  2201. addUnitPriority('isoWeekday', 11);
  2202. // PARSING
  2203. addRegexToken('d', match1to2);
  2204. addRegexToken('e', match1to2);
  2205. addRegexToken('E', match1to2);
  2206. addRegexToken('dd', function (isStrict, locale) {
  2207. return locale.weekdaysMinRegex(isStrict);
  2208. });
  2209. addRegexToken('ddd', function (isStrict, locale) {
  2210. return locale.weekdaysShortRegex(isStrict);
  2211. });
  2212. addRegexToken('dddd', function (isStrict, locale) {
  2213. return locale.weekdaysRegex(isStrict);
  2214. });
  2215. addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
  2216. var weekday = config._locale.weekdaysParse(input, token, config._strict);
  2217. // if we didn't get a weekday name, mark the date as invalid
  2218. if (weekday != null) {
  2219. week.d = weekday;
  2220. } else {
  2221. getParsingFlags(config).invalidWeekday = input;
  2222. }
  2223. });
  2224. addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
  2225. week[token] = toInt(input);
  2226. });
  2227. // HELPERS
  2228. function parseWeekday(input, locale) {
  2229. if (typeof input !== 'string') {
  2230. return input;
  2231. }
  2232. if (!isNaN(input)) {
  2233. return parseInt(input, 10);
  2234. }
  2235. input = locale.weekdaysParse(input);
  2236. if (typeof input === 'number') {
  2237. return input;
  2238. }
  2239. return null;
  2240. }
  2241. function parseIsoWeekday(input, locale) {
  2242. if (typeof input === 'string') {
  2243. return locale.weekdaysParse(input) % 7 || 7;
  2244. }
  2245. return isNaN(input) ? null : input;
  2246. }
  2247. // LOCALES
  2248. function shiftWeekdays(ws, n) {
  2249. return ws.slice(n, 7).concat(ws.slice(0, n));
  2250. }
  2251. var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
  2252. '_'
  2253. ),
  2254. defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  2255. defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  2256. defaultWeekdaysRegex = matchWord,
  2257. defaultWeekdaysShortRegex = matchWord,
  2258. defaultWeekdaysMinRegex = matchWord;
  2259. function localeWeekdays(m, format) {
  2260. var weekdays = isArray(this._weekdays)
  2261. ? this._weekdays
  2262. : this._weekdays[
  2263. m && m !== true && this._weekdays.isFormat.test(format)
  2264. ? 'format'
  2265. : 'standalone'
  2266. ];
  2267. return m === true
  2268. ? shiftWeekdays(weekdays, this._week.dow)
  2269. : m
  2270. ? weekdays[m.day()]
  2271. : weekdays;
  2272. }
  2273. function localeWeekdaysShort(m) {
  2274. return m === true
  2275. ? shiftWeekdays(this._weekdaysShort, this._week.dow)
  2276. : m
  2277. ? this._weekdaysShort[m.day()]
  2278. : this._weekdaysShort;
  2279. }
  2280. function localeWeekdaysMin(m) {
  2281. return m === true
  2282. ? shiftWeekdays(this._weekdaysMin, this._week.dow)
  2283. : m
  2284. ? this._weekdaysMin[m.day()]
  2285. : this._weekdaysMin;
  2286. }
  2287. function handleStrictParse$1(weekdayName, format, strict) {
  2288. var i,
  2289. ii,
  2290. mom,
  2291. llc = weekdayName.toLocaleLowerCase();
  2292. if (!this._weekdaysParse) {
  2293. this._weekdaysParse = [];
  2294. this._shortWeekdaysParse = [];
  2295. this._minWeekdaysParse = [];
  2296. for (i = 0; i < 7; ++i) {
  2297. mom = createUTC([2000, 1]).day(i);
  2298. this._minWeekdaysParse[i] = this.weekdaysMin(
  2299. mom,
  2300. ''
  2301. ).toLocaleLowerCase();
  2302. this._shortWeekdaysParse[i] = this.weekdaysShort(
  2303. mom,
  2304. ''
  2305. ).toLocaleLowerCase();
  2306. this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
  2307. }
  2308. }
  2309. if (strict) {
  2310. if (format === 'dddd') {
  2311. ii = indexOf.call(this._weekdaysParse, llc);
  2312. return ii !== -1 ? ii : null;
  2313. } else if (format === 'ddd') {
  2314. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2315. return ii !== -1 ? ii : null;
  2316. } else {
  2317. ii = indexOf.call(this._minWeekdaysParse, llc);
  2318. return ii !== -1 ? ii : null;
  2319. }
  2320. } else {
  2321. if (format === 'dddd') {
  2322. ii = indexOf.call(this._weekdaysParse, llc);
  2323. if (ii !== -1) {
  2324. return ii;
  2325. }
  2326. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2327. if (ii !== -1) {
  2328. return ii;
  2329. }
  2330. ii = indexOf.call(this._minWeekdaysParse, llc);
  2331. return ii !== -1 ? ii : null;
  2332. } else if (format === 'ddd') {
  2333. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2334. if (ii !== -1) {
  2335. return ii;
  2336. }
  2337. ii = indexOf.call(this._weekdaysParse, llc);
  2338. if (ii !== -1) {
  2339. return ii;
  2340. }
  2341. ii = indexOf.call(this._minWeekdaysParse, llc);
  2342. return ii !== -1 ? ii : null;
  2343. } else {
  2344. ii = indexOf.call(this._minWeekdaysParse, llc);
  2345. if (ii !== -1) {
  2346. return ii;
  2347. }
  2348. ii = indexOf.call(this._weekdaysParse, llc);
  2349. if (ii !== -1) {
  2350. return ii;
  2351. }
  2352. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2353. return ii !== -1 ? ii : null;
  2354. }
  2355. }
  2356. }
  2357. function localeWeekdaysParse(weekdayName, format, strict) {
  2358. var i, mom, regex;
  2359. if (this._weekdaysParseExact) {
  2360. return handleStrictParse$1.call(this, weekdayName, format, strict);
  2361. }
  2362. if (!this._weekdaysParse) {
  2363. this._weekdaysParse = [];
  2364. this._minWeekdaysParse = [];
  2365. this._shortWeekdaysParse = [];
  2366. this._fullWeekdaysParse = [];
  2367. }
  2368. for (i = 0; i < 7; i++) {
  2369. // make the regex if we don't have it already
  2370. mom = createUTC([2000, 1]).day(i);
  2371. if (strict && !this._fullWeekdaysParse[i]) {
  2372. this._fullWeekdaysParse[i] = new RegExp(
  2373. '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$',
  2374. 'i'
  2375. );
  2376. this._shortWeekdaysParse[i] = new RegExp(
  2377. '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$',
  2378. 'i'
  2379. );
  2380. this._minWeekdaysParse[i] = new RegExp(
  2381. '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$',
  2382. 'i'
  2383. );
  2384. }
  2385. if (!this._weekdaysParse[i]) {
  2386. regex =
  2387. '^' +
  2388. this.weekdays(mom, '') +
  2389. '|^' +
  2390. this.weekdaysShort(mom, '') +
  2391. '|^' +
  2392. this.weekdaysMin(mom, '');
  2393. this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
  2394. }
  2395. // test the regex
  2396. if (
  2397. strict &&
  2398. format === 'dddd' &&
  2399. this._fullWeekdaysParse[i].test(weekdayName)
  2400. ) {
  2401. return i;
  2402. } else if (
  2403. strict &&
  2404. format === 'ddd' &&
  2405. this._shortWeekdaysParse[i].test(weekdayName)
  2406. ) {
  2407. return i;
  2408. } else if (
  2409. strict &&
  2410. format === 'dd' &&
  2411. this._minWeekdaysParse[i].test(weekdayName)
  2412. ) {
  2413. return i;
  2414. } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
  2415. return i;
  2416. }
  2417. }
  2418. }
  2419. // MOMENTS
  2420. function getSetDayOfWeek(input) {
  2421. if (!this.isValid()) {
  2422. return input != null ? this : NaN;
  2423. }
  2424. var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
  2425. if (input != null) {
  2426. input = parseWeekday(input, this.localeData());
  2427. return this.add(input - day, 'd');
  2428. } else {
  2429. return day;
  2430. }
  2431. }
  2432. function getSetLocaleDayOfWeek(input) {
  2433. if (!this.isValid()) {
  2434. return input != null ? this : NaN;
  2435. }
  2436. var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  2437. return input == null ? weekday : this.add(input - weekday, 'd');
  2438. }
  2439. function getSetISODayOfWeek(input) {
  2440. if (!this.isValid()) {
  2441. return input != null ? this : NaN;
  2442. }
  2443. // behaves the same as moment#day except
  2444. // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
  2445. // as a setter, sunday should belong to the previous week.
  2446. if (input != null) {
  2447. var weekday = parseIsoWeekday(input, this.localeData());
  2448. return this.day(this.day() % 7 ? weekday : weekday - 7);
  2449. } else {
  2450. return this.day() || 7;
  2451. }
  2452. }
  2453. function weekdaysRegex(isStrict) {
  2454. if (this._weekdaysParseExact) {
  2455. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2456. computeWeekdaysParse.call(this);
  2457. }
  2458. if (isStrict) {
  2459. return this._weekdaysStrictRegex;
  2460. } else {
  2461. return this._weekdaysRegex;
  2462. }
  2463. } else {
  2464. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2465. this._weekdaysRegex = defaultWeekdaysRegex;
  2466. }
  2467. return this._weekdaysStrictRegex && isStrict
  2468. ? this._weekdaysStrictRegex
  2469. : this._weekdaysRegex;
  2470. }
  2471. }
  2472. function weekdaysShortRegex(isStrict) {
  2473. if (this._weekdaysParseExact) {
  2474. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2475. computeWeekdaysParse.call(this);
  2476. }
  2477. if (isStrict) {
  2478. return this._weekdaysShortStrictRegex;
  2479. } else {
  2480. return this._weekdaysShortRegex;
  2481. }
  2482. } else {
  2483. if (!hasOwnProp(this, '_weekdaysShortRegex')) {
  2484. this._weekdaysShortRegex = defaultWeekdaysShortRegex;
  2485. }
  2486. return this._weekdaysShortStrictRegex && isStrict
  2487. ? this._weekdaysShortStrictRegex
  2488. : this._weekdaysShortRegex;
  2489. }
  2490. }
  2491. function weekdaysMinRegex(isStrict) {
  2492. if (this._weekdaysParseExact) {
  2493. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2494. computeWeekdaysParse.call(this);
  2495. }
  2496. if (isStrict) {
  2497. return this._weekdaysMinStrictRegex;
  2498. } else {
  2499. return this._weekdaysMinRegex;
  2500. }
  2501. } else {
  2502. if (!hasOwnProp(this, '_weekdaysMinRegex')) {
  2503. this._weekdaysMinRegex = defaultWeekdaysMinRegex;
  2504. }
  2505. return this._weekdaysMinStrictRegex && isStrict
  2506. ? this._weekdaysMinStrictRegex
  2507. : this._weekdaysMinRegex;
  2508. }
  2509. }
  2510. function computeWeekdaysParse() {
  2511. function cmpLenRev(a, b) {
  2512. return b.length - a.length;
  2513. }
  2514. var minPieces = [],
  2515. shortPieces = [],
  2516. longPieces = [],
  2517. mixedPieces = [],
  2518. i,
  2519. mom,
  2520. minp,
  2521. shortp,
  2522. longp;
  2523. for (i = 0; i < 7; i++) {
  2524. // make the regex if we don't have it already
  2525. mom = createUTC([2000, 1]).day(i);
  2526. minp = regexEscape(this.weekdaysMin(mom, ''));
  2527. shortp = regexEscape(this.weekdaysShort(mom, ''));
  2528. longp = regexEscape(this.weekdays(mom, ''));
  2529. minPieces.push(minp);
  2530. shortPieces.push(shortp);
  2531. longPieces.push(longp);
  2532. mixedPieces.push(minp);
  2533. mixedPieces.push(shortp);
  2534. mixedPieces.push(longp);
  2535. }
  2536. // Sorting makes sure if one weekday (or abbr) is a prefix of another it
  2537. // will match the longer piece.
  2538. minPieces.sort(cmpLenRev);
  2539. shortPieces.sort(cmpLenRev);
  2540. longPieces.sort(cmpLenRev);
  2541. mixedPieces.sort(cmpLenRev);
  2542. this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  2543. this._weekdaysShortRegex = this._weekdaysRegex;
  2544. this._weekdaysMinRegex = this._weekdaysRegex;
  2545. this._weekdaysStrictRegex = new RegExp(
  2546. '^(' + longPieces.join('|') + ')',
  2547. 'i'
  2548. );
  2549. this._weekdaysShortStrictRegex = new RegExp(
  2550. '^(' + shortPieces.join('|') + ')',
  2551. 'i'
  2552. );
  2553. this._weekdaysMinStrictRegex = new RegExp(
  2554. '^(' + minPieces.join('|') + ')',
  2555. 'i'
  2556. );
  2557. }
  2558. // FORMATTING
  2559. function hFormat() {
  2560. return this.hours() % 12 || 12;
  2561. }
  2562. function kFormat() {
  2563. return this.hours() || 24;
  2564. }
  2565. addFormatToken('H', ['HH', 2], 0, 'hour');
  2566. addFormatToken('h', ['hh', 2], 0, hFormat);
  2567. addFormatToken('k', ['kk', 2], 0, kFormat);
  2568. addFormatToken('hmm', 0, 0, function () {
  2569. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
  2570. });
  2571. addFormatToken('hmmss', 0, 0, function () {
  2572. return (
  2573. '' +
  2574. hFormat.apply(this) +
  2575. zeroFill(this.minutes(), 2) +
  2576. zeroFill(this.seconds(), 2)
  2577. );
  2578. });
  2579. addFormatToken('Hmm', 0, 0, function () {
  2580. return '' + this.hours() + zeroFill(this.minutes(), 2);
  2581. });
  2582. addFormatToken('Hmmss', 0, 0, function () {
  2583. return (
  2584. '' +
  2585. this.hours() +
  2586. zeroFill(this.minutes(), 2) +
  2587. zeroFill(this.seconds(), 2)
  2588. );
  2589. });
  2590. function meridiem(token, lowercase) {
  2591. addFormatToken(token, 0, 0, function () {
  2592. return this.localeData().meridiem(
  2593. this.hours(),
  2594. this.minutes(),
  2595. lowercase
  2596. );
  2597. });
  2598. }
  2599. meridiem('a', true);
  2600. meridiem('A', false);
  2601. // ALIASES
  2602. addUnitAlias('hour', 'h');
  2603. // PRIORITY
  2604. addUnitPriority('hour', 13);
  2605. // PARSING
  2606. function matchMeridiem(isStrict, locale) {
  2607. return locale._meridiemParse;
  2608. }
  2609. addRegexToken('a', matchMeridiem);
  2610. addRegexToken('A', matchMeridiem);
  2611. addRegexToken('H', match1to2);
  2612. addRegexToken('h', match1to2);
  2613. addRegexToken('k', match1to2);
  2614. addRegexToken('HH', match1to2, match2);
  2615. addRegexToken('hh', match1to2, match2);
  2616. addRegexToken('kk', match1to2, match2);
  2617. addRegexToken('hmm', match3to4);
  2618. addRegexToken('hmmss', match5to6);
  2619. addRegexToken('Hmm', match3to4);
  2620. addRegexToken('Hmmss', match5to6);
  2621. addParseToken(['H', 'HH'], HOUR);
  2622. addParseToken(['k', 'kk'], function (input, array, config) {
  2623. var kInput = toInt(input);
  2624. array[HOUR] = kInput === 24 ? 0 : kInput;
  2625. });
  2626. addParseToken(['a', 'A'], function (input, array, config) {
  2627. config._isPm = config._locale.isPM(input);
  2628. config._meridiem = input;
  2629. });
  2630. addParseToken(['h', 'hh'], function (input, array, config) {
  2631. array[HOUR] = toInt(input);
  2632. getParsingFlags(config).bigHour = true;
  2633. });
  2634. addParseToken('hmm', function (input, array, config) {
  2635. var pos = input.length - 2;
  2636. array[HOUR] = toInt(input.substr(0, pos));
  2637. array[MINUTE] = toInt(input.substr(pos));
  2638. getParsingFlags(config).bigHour = true;
  2639. });
  2640. addParseToken('hmmss', function (input, array, config) {
  2641. var pos1 = input.length - 4,
  2642. pos2 = input.length - 2;
  2643. array[HOUR] = toInt(input.substr(0, pos1));
  2644. array[MINUTE] = toInt(input.substr(pos1, 2));
  2645. array[SECOND] = toInt(input.substr(pos2));
  2646. getParsingFlags(config).bigHour = true;
  2647. });
  2648. addParseToken('Hmm', function (input, array, config) {
  2649. var pos = input.length - 2;
  2650. array[HOUR] = toInt(input.substr(0, pos));
  2651. array[MINUTE] = toInt(input.substr(pos));
  2652. });
  2653. addParseToken('Hmmss', function (input, array, config) {
  2654. var pos1 = input.length - 4,
  2655. pos2 = input.length - 2;
  2656. array[HOUR] = toInt(input.substr(0, pos1));
  2657. array[MINUTE] = toInt(input.substr(pos1, 2));
  2658. array[SECOND] = toInt(input.substr(pos2));
  2659. });
  2660. // LOCALES
  2661. function localeIsPM(input) {
  2662. // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
  2663. // Using charAt should be more compatible.
  2664. return (input + '').toLowerCase().charAt(0) === 'p';
  2665. }
  2666. var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i,
  2667. // Setting the hour should keep the time, because the user explicitly
  2668. // specified which hour they want. So trying to maintain the same hour (in
  2669. // a new timezone) makes sense. Adding/subtracting hours does not follow
  2670. // this rule.
  2671. getSetHour = makeGetSet('Hours', true);
  2672. function localeMeridiem(hours, minutes, isLower) {
  2673. if (hours > 11) {
  2674. return isLower ? 'pm' : 'PM';
  2675. } else {
  2676. return isLower ? 'am' : 'AM';
  2677. }
  2678. }
  2679. var baseConfig = {
  2680. calendar: defaultCalendar,
  2681. longDateFormat: defaultLongDateFormat,
  2682. invalidDate: defaultInvalidDate,
  2683. ordinal: defaultOrdinal,
  2684. dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
  2685. relativeTime: defaultRelativeTime,
  2686. months: defaultLocaleMonths,
  2687. monthsShort: defaultLocaleMonthsShort,
  2688. week: defaultLocaleWeek,
  2689. weekdays: defaultLocaleWeekdays,
  2690. weekdaysMin: defaultLocaleWeekdaysMin,
  2691. weekdaysShort: defaultLocaleWeekdaysShort,
  2692. meridiemParse: defaultLocaleMeridiemParse,
  2693. };
  2694. // internal storage for locale config files
  2695. var locales = {},
  2696. localeFamilies = {},
  2697. globalLocale;
  2698. function commonPrefix(arr1, arr2) {
  2699. var i,
  2700. minl = Math.min(arr1.length, arr2.length);
  2701. for (i = 0; i < minl; i += 1) {
  2702. if (arr1[i] !== arr2[i]) {
  2703. return i;
  2704. }
  2705. }
  2706. return minl;
  2707. }
  2708. function normalizeLocale(key) {
  2709. return key ? key.toLowerCase().replace('_', '-') : key;
  2710. }
  2711. // pick the locale from the array
  2712. // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
  2713. // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
  2714. function chooseLocale(names) {
  2715. var i = 0,
  2716. j,
  2717. next,
  2718. locale,
  2719. split;
  2720. while (i < names.length) {
  2721. split = normalizeLocale(names[i]).split('-');
  2722. j = split.length;
  2723. next = normalizeLocale(names[i + 1]);
  2724. next = next ? next.split('-') : null;
  2725. while (j > 0) {
  2726. locale = loadLocale(split.slice(0, j).join('-'));
  2727. if (locale) {
  2728. return locale;
  2729. }
  2730. if (
  2731. next &&
  2732. next.length >= j &&
  2733. commonPrefix(split, next) >= j - 1
  2734. ) {
  2735. //the next array item is better than a shallower substring of this one
  2736. break;
  2737. }
  2738. j--;
  2739. }
  2740. i++;
  2741. }
  2742. return globalLocale;
  2743. }
  2744. function loadLocale(name) {
  2745. var oldLocale = null,
  2746. aliasedRequire;
  2747. // TODO: Find a better way to register and load all the locales in Node
  2748. if (
  2749. locales[name] === undefined &&
  2750. typeof module !== 'undefined' &&
  2751. module &&
  2752. module.exports
  2753. ) {
  2754. try {
  2755. oldLocale = globalLocale._abbr;
  2756. aliasedRequire = require;
  2757. aliasedRequire('./locale/' + name);
  2758. getSetGlobalLocale(oldLocale);
  2759. } catch (e) {
  2760. // mark as not found to avoid repeating expensive file require call causing high CPU
  2761. // when trying to find en-US, en_US, en-us for every format call
  2762. locales[name] = null; // null means not found
  2763. }
  2764. }
  2765. return locales[name];
  2766. }
  2767. // This function will load locale and then set the global locale. If
  2768. // no arguments are passed in, it will simply return the current global
  2769. // locale key.
  2770. function getSetGlobalLocale(key, values) {
  2771. var data;
  2772. if (key) {
  2773. if (isUndefined(values)) {
  2774. data = getLocale(key);
  2775. } else {
  2776. data = defineLocale(key, values);
  2777. }
  2778. if (data) {
  2779. // moment.duration._locale = moment._locale = data;
  2780. globalLocale = data;
  2781. } else {
  2782. if (typeof console !== 'undefined' && console.warn) {
  2783. //warn user if arguments are passed but the locale could not be set
  2784. console.warn(
  2785. 'Locale ' + key + ' not found. Did you forget to load it?'
  2786. );
  2787. }
  2788. }
  2789. }
  2790. return globalLocale._abbr;
  2791. }
  2792. function defineLocale(name, config) {
  2793. if (config !== null) {
  2794. var locale,
  2795. parentConfig = baseConfig;
  2796. config.abbr = name;
  2797. if (locales[name] != null) {
  2798. deprecateSimple(
  2799. 'defineLocaleOverride',
  2800. 'use moment.updateLocale(localeName, config) to change ' +
  2801. 'an existing locale. moment.defineLocale(localeName, ' +
  2802. 'config) should only be used for creating a new locale ' +
  2803. 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'
  2804. );
  2805. parentConfig = locales[name]._config;
  2806. } else if (config.parentLocale != null) {
  2807. if (locales[config.parentLocale] != null) {
  2808. parentConfig = locales[config.parentLocale]._config;
  2809. } else {
  2810. locale = loadLocale(config.parentLocale);
  2811. if (locale != null) {
  2812. parentConfig = locale._config;
  2813. } else {
  2814. if (!localeFamilies[config.parentLocale]) {
  2815. localeFamilies[config.parentLocale] = [];
  2816. }
  2817. localeFamilies[config.parentLocale].push({
  2818. name: name,
  2819. config: config,
  2820. });
  2821. return null;
  2822. }
  2823. }
  2824. }
  2825. locales[name] = new Locale(mergeConfigs(parentConfig, config));
  2826. if (localeFamilies[name]) {
  2827. localeFamilies[name].forEach(function (x) {
  2828. defineLocale(x.name, x.config);
  2829. });
  2830. }
  2831. // backwards compat for now: also set the locale
  2832. // make sure we set the locale AFTER all child locales have been
  2833. // created, so we won't end up with the child locale set.
  2834. getSetGlobalLocale(name);
  2835. return locales[name];
  2836. } else {
  2837. // useful for testing
  2838. delete locales[name];
  2839. return null;
  2840. }
  2841. }
  2842. function updateLocale(name, config) {
  2843. if (config != null) {
  2844. var locale,
  2845. tmpLocale,
  2846. parentConfig = baseConfig;
  2847. if (locales[name] != null && locales[name].parentLocale != null) {
  2848. // Update existing child locale in-place to avoid memory-leaks
  2849. locales[name].set(mergeConfigs(locales[name]._config, config));
  2850. } else {
  2851. // MERGE
  2852. tmpLocale = loadLocale(name);
  2853. if (tmpLocale != null) {
  2854. parentConfig = tmpLocale._config;
  2855. }
  2856. config = mergeConfigs(parentConfig, config);
  2857. if (tmpLocale == null) {
  2858. // updateLocale is called for creating a new locale
  2859. // Set abbr so it will have a name (getters return
  2860. // undefined otherwise).
  2861. config.abbr = name;
  2862. }
  2863. locale = new Locale(config);
  2864. locale.parentLocale = locales[name];
  2865. locales[name] = locale;
  2866. }
  2867. // backwards compat for now: also set the locale
  2868. getSetGlobalLocale(name);
  2869. } else {
  2870. // pass null for config to unupdate, useful for tests
  2871. if (locales[name] != null) {
  2872. if (locales[name].parentLocale != null) {
  2873. locales[name] = locales[name].parentLocale;
  2874. if (name === getSetGlobalLocale()) {
  2875. getSetGlobalLocale(name);
  2876. }
  2877. } else if (locales[name] != null) {
  2878. delete locales[name];
  2879. }
  2880. }
  2881. }
  2882. return locales[name];
  2883. }
  2884. // returns locale data
  2885. function getLocale(key) {
  2886. var locale;
  2887. if (key && key._locale && key._locale._abbr) {
  2888. key = key._locale._abbr;
  2889. }
  2890. if (!key) {
  2891. return globalLocale;
  2892. }
  2893. if (!isArray(key)) {
  2894. //short-circuit everything else
  2895. locale = loadLocale(key);
  2896. if (locale) {
  2897. return locale;
  2898. }
  2899. key = [key];
  2900. }
  2901. return chooseLocale(key);
  2902. }
  2903. function listLocales() {
  2904. return keys(locales);
  2905. }
  2906. function checkOverflow(m) {
  2907. var overflow,
  2908. a = m._a;
  2909. if (a && getParsingFlags(m).overflow === -2) {
  2910. overflow =
  2911. a[MONTH] < 0 || a[MONTH] > 11
  2912. ? MONTH
  2913. : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
  2914. ? DATE
  2915. : a[HOUR] < 0 ||
  2916. a[HOUR] > 24 ||
  2917. (a[HOUR] === 24 &&
  2918. (a[MINUTE] !== 0 ||
  2919. a[SECOND] !== 0 ||
  2920. a[MILLISECOND] !== 0))
  2921. ? HOUR
  2922. : a[MINUTE] < 0 || a[MINUTE] > 59
  2923. ? MINUTE
  2924. : a[SECOND] < 0 || a[SECOND] > 59
  2925. ? SECOND
  2926. : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
  2927. ? MILLISECOND
  2928. : -1;
  2929. if (
  2930. getParsingFlags(m)._overflowDayOfYear &&
  2931. (overflow < YEAR || overflow > DATE)
  2932. ) {
  2933. overflow = DATE;
  2934. }
  2935. if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
  2936. overflow = WEEK;
  2937. }
  2938. if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
  2939. overflow = WEEKDAY;
  2940. }
  2941. getParsingFlags(m).overflow = overflow;
  2942. }
  2943. return m;
  2944. }
  2945. // iso 8601 regex
  2946. // 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)
  2947. var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
  2948. basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
  2949. tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
  2950. isoDates = [
  2951. ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
  2952. ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
  2953. ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
  2954. ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
  2955. ['YYYY-DDD', /\d{4}-\d{3}/],
  2956. ['YYYY-MM', /\d{4}-\d\d/, false],
  2957. ['YYYYYYMMDD', /[+-]\d{10}/],
  2958. ['YYYYMMDD', /\d{8}/],
  2959. ['GGGG[W]WWE', /\d{4}W\d{3}/],
  2960. ['GGGG[W]WW', /\d{4}W\d{2}/, false],
  2961. ['YYYYDDD', /\d{7}/],
  2962. ['YYYYMM', /\d{6}/, false],
  2963. ['YYYY', /\d{4}/, false],
  2964. ],
  2965. // iso time formats and regexes
  2966. isoTimes = [
  2967. ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
  2968. ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
  2969. ['HH:mm:ss', /\d\d:\d\d:\d\d/],
  2970. ['HH:mm', /\d\d:\d\d/],
  2971. ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
  2972. ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
  2973. ['HHmmss', /\d\d\d\d\d\d/],
  2974. ['HHmm', /\d\d\d\d/],
  2975. ['HH', /\d\d/],
  2976. ],
  2977. aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
  2978. // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
  2979. rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,
  2980. obsOffsets = {
  2981. UT: 0,
  2982. GMT: 0,
  2983. EDT: -4 * 60,
  2984. EST: -5 * 60,
  2985. CDT: -5 * 60,
  2986. CST: -6 * 60,
  2987. MDT: -6 * 60,
  2988. MST: -7 * 60,
  2989. PDT: -7 * 60,
  2990. PST: -8 * 60,
  2991. };
  2992. // date from iso format
  2993. function configFromISO(config) {
  2994. var i,
  2995. l,
  2996. string = config._i,
  2997. match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
  2998. allowTime,
  2999. dateFormat,
  3000. timeFormat,
  3001. tzFormat;
  3002. if (match) {
  3003. getParsingFlags(config).iso = true;
  3004. for (i = 0, l = isoDates.length; i < l; i++) {
  3005. if (isoDates[i][1].exec(match[1])) {
  3006. dateFormat = isoDates[i][0];
  3007. allowTime = isoDates[i][2] !== false;
  3008. break;
  3009. }
  3010. }
  3011. if (dateFormat == null) {
  3012. config._isValid = false;
  3013. return;
  3014. }
  3015. if (match[3]) {
  3016. for (i = 0, l = isoTimes.length; i < l; i++) {
  3017. if (isoTimes[i][1].exec(match[3])) {
  3018. // match[2] should be 'T' or space
  3019. timeFormat = (match[2] || ' ') + isoTimes[i][0];
  3020. break;
  3021. }
  3022. }
  3023. if (timeFormat == null) {
  3024. config._isValid = false;
  3025. return;
  3026. }
  3027. }
  3028. if (!allowTime && timeFormat != null) {
  3029. config._isValid = false;
  3030. return;
  3031. }
  3032. if (match[4]) {
  3033. if (tzRegex.exec(match[4])) {
  3034. tzFormat = 'Z';
  3035. } else {
  3036. config._isValid = false;
  3037. return;
  3038. }
  3039. }
  3040. config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
  3041. configFromStringAndFormat(config);
  3042. } else {
  3043. config._isValid = false;
  3044. }
  3045. }
  3046. function extractFromRFC2822Strings(
  3047. yearStr,
  3048. monthStr,
  3049. dayStr,
  3050. hourStr,
  3051. minuteStr,
  3052. secondStr
  3053. ) {
  3054. var result = [
  3055. untruncateYear(yearStr),
  3056. defaultLocaleMonthsShort.indexOf(monthStr),
  3057. parseInt(dayStr, 10),
  3058. parseInt(hourStr, 10),
  3059. parseInt(minuteStr, 10),
  3060. ];
  3061. if (secondStr) {
  3062. result.push(parseInt(secondStr, 10));
  3063. }
  3064. return result;
  3065. }
  3066. function untruncateYear(yearStr) {
  3067. var year = parseInt(yearStr, 10);
  3068. if (year <= 49) {
  3069. return 2000 + year;
  3070. } else if (year <= 999) {
  3071. return 1900 + year;
  3072. }
  3073. return year;
  3074. }
  3075. function preprocessRFC2822(s) {
  3076. // Remove comments and folding whitespace and replace multiple-spaces with a single space
  3077. return s
  3078. .replace(/\([^)]*\)|[\n\t]/g, ' ')
  3079. .replace(/(\s\s+)/g, ' ')
  3080. .replace(/^\s\s*/, '')
  3081. .replace(/\s\s*$/, '');
  3082. }
  3083. function checkWeekday(weekdayStr, parsedInput, config) {
  3084. if (weekdayStr) {
  3085. // TODO: Replace the vanilla JS Date object with an independent day-of-week check.
  3086. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
  3087. weekdayActual = new Date(
  3088. parsedInput[0],
  3089. parsedInput[1],
  3090. parsedInput[2]
  3091. ).getDay();
  3092. if (weekdayProvided !== weekdayActual) {
  3093. getParsingFlags(config).weekdayMismatch = true;
  3094. config._isValid = false;
  3095. return false;
  3096. }
  3097. }
  3098. return true;
  3099. }
  3100. function calculateOffset(obsOffset, militaryOffset, numOffset) {
  3101. if (obsOffset) {
  3102. return obsOffsets[obsOffset];
  3103. } else if (militaryOffset) {
  3104. // the only allowed military tz is Z
  3105. return 0;
  3106. } else {
  3107. var hm = parseInt(numOffset, 10),
  3108. m = hm % 100,
  3109. h = (hm - m) / 100;
  3110. return h * 60 + m;
  3111. }
  3112. }
  3113. // date and time from ref 2822 format
  3114. function configFromRFC2822(config) {
  3115. var match = rfc2822.exec(preprocessRFC2822(config._i)),
  3116. parsedArray;
  3117. if (match) {
  3118. parsedArray = extractFromRFC2822Strings(
  3119. match[4],
  3120. match[3],
  3121. match[2],
  3122. match[5],
  3123. match[6],
  3124. match[7]
  3125. );
  3126. if (!checkWeekday(match[1], parsedArray, config)) {
  3127. return;
  3128. }
  3129. config._a = parsedArray;
  3130. config._tzm = calculateOffset(match[8], match[9], match[10]);
  3131. config._d = createUTCDate.apply(null, config._a);
  3132. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  3133. getParsingFlags(config).rfc2822 = true;
  3134. } else {
  3135. config._isValid = false;
  3136. }
  3137. }
  3138. // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict
  3139. function configFromString(config) {
  3140. var matched = aspNetJsonRegex.exec(config._i);
  3141. if (matched !== null) {
  3142. config._d = new Date(+matched[1]);
  3143. return;
  3144. }
  3145. configFromISO(config);
  3146. if (config._isValid === false) {
  3147. delete config._isValid;
  3148. } else {
  3149. return;
  3150. }
  3151. configFromRFC2822(config);
  3152. if (config._isValid === false) {
  3153. delete config._isValid;
  3154. } else {
  3155. return;
  3156. }
  3157. if (config._strict) {
  3158. config._isValid = false;
  3159. } else {
  3160. // Final attempt, use Input Fallback
  3161. hooks.createFromInputFallback(config);
  3162. }
  3163. }
  3164. hooks.createFromInputFallback = deprecate(
  3165. 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
  3166. 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
  3167. 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',
  3168. function (config) {
  3169. config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
  3170. }
  3171. );
  3172. // Pick the first defined of two or three arguments.
  3173. function defaults(a, b, c) {
  3174. if (a != null) {
  3175. return a;
  3176. }
  3177. if (b != null) {
  3178. return b;
  3179. }
  3180. return c;
  3181. }
  3182. function currentDateArray(config) {
  3183. // hooks is actually the exported moment object
  3184. var nowValue = new Date(hooks.now());
  3185. if (config._useUTC) {
  3186. return [
  3187. nowValue.getUTCFullYear(),
  3188. nowValue.getUTCMonth(),
  3189. nowValue.getUTCDate(),
  3190. ];
  3191. }
  3192. return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
  3193. }
  3194. // convert an array to a date.
  3195. // the array should mirror the parameters below
  3196. // note: all values past the year are optional and will default to the lowest possible value.
  3197. // [year, month, day , hour, minute, second, millisecond]
  3198. function configFromArray(config) {
  3199. var i,
  3200. date,
  3201. input = [],
  3202. currentDate,
  3203. expectedWeekday,
  3204. yearToUse;
  3205. if (config._d) {
  3206. return;
  3207. }
  3208. currentDate = currentDateArray(config);
  3209. //compute day of the year from weeks and weekdays
  3210. if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
  3211. dayOfYearFromWeekInfo(config);
  3212. }
  3213. //if the day of the year is set, figure out what it is
  3214. if (config._dayOfYear != null) {
  3215. yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
  3216. if (
  3217. config._dayOfYear > daysInYear(yearToUse) ||
  3218. config._dayOfYear === 0
  3219. ) {
  3220. getParsingFlags(config)._overflowDayOfYear = true;
  3221. }
  3222. date = createUTCDate(yearToUse, 0, config._dayOfYear);
  3223. config._a[MONTH] = date.getUTCMonth();
  3224. config._a[DATE] = date.getUTCDate();
  3225. }
  3226. // Default to current date.
  3227. // * if no year, month, day of month are given, default to today
  3228. // * if day of month is given, default month and year
  3229. // * if month is given, default only year
  3230. // * if year is given, don't default anything
  3231. for (i = 0; i < 3 && config._a[i] == null; ++i) {
  3232. config._a[i] = input[i] = currentDate[i];
  3233. }
  3234. // Zero out whatever was not defaulted, including time
  3235. for (; i < 7; i++) {
  3236. config._a[i] = input[i] =
  3237. config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];
  3238. }
  3239. // Check for 24:00:00.000
  3240. if (
  3241. config._a[HOUR] === 24 &&
  3242. config._a[MINUTE] === 0 &&
  3243. config._a[SECOND] === 0 &&
  3244. config._a[MILLISECOND] === 0
  3245. ) {
  3246. config._nextDay = true;
  3247. config._a[HOUR] = 0;
  3248. }
  3249. config._d = (config._useUTC ? createUTCDate : createDate).apply(
  3250. null,
  3251. input
  3252. );
  3253. expectedWeekday = config._useUTC
  3254. ? config._d.getUTCDay()
  3255. : config._d.getDay();
  3256. // Apply timezone offset from input. The actual utcOffset can be changed
  3257. // with parseZone.
  3258. if (config._tzm != null) {
  3259. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  3260. }
  3261. if (config._nextDay) {
  3262. config._a[HOUR] = 24;
  3263. }
  3264. // check for mismatching day of week
  3265. if (
  3266. config._w &&
  3267. typeof config._w.d !== 'undefined' &&
  3268. config._w.d !== expectedWeekday
  3269. ) {
  3270. getParsingFlags(config).weekdayMismatch = true;
  3271. }
  3272. }
  3273. function dayOfYearFromWeekInfo(config) {
  3274. var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
  3275. w = config._w;
  3276. if (w.GG != null || w.W != null || w.E != null) {
  3277. dow = 1;
  3278. doy = 4;
  3279. // TODO: We need to take the current isoWeekYear, but that depends on
  3280. // how we interpret now (local, utc, fixed offset). So create
  3281. // a now version of current config (take local/utc/offset flags, and
  3282. // create now).
  3283. weekYear = defaults(
  3284. w.GG,
  3285. config._a[YEAR],
  3286. weekOfYear(createLocal(), 1, 4).year
  3287. );
  3288. week = defaults(w.W, 1);
  3289. weekday = defaults(w.E, 1);
  3290. if (weekday < 1 || weekday > 7) {
  3291. weekdayOverflow = true;
  3292. }
  3293. } else {
  3294. dow = config._locale._week.dow;
  3295. doy = config._locale._week.doy;
  3296. curWeek = weekOfYear(createLocal(), dow, doy);
  3297. weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
  3298. // Default to current week.
  3299. week = defaults(w.w, curWeek.week);
  3300. if (w.d != null) {
  3301. // weekday -- low day numbers are considered next week
  3302. weekday = w.d;
  3303. if (weekday < 0 || weekday > 6) {
  3304. weekdayOverflow = true;
  3305. }
  3306. } else if (w.e != null) {
  3307. // local weekday -- counting starts from beginning of week
  3308. weekday = w.e + dow;
  3309. if (w.e < 0 || w.e > 6) {
  3310. weekdayOverflow = true;
  3311. }
  3312. } else {
  3313. // default to beginning of week
  3314. weekday = dow;
  3315. }
  3316. }
  3317. if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
  3318. getParsingFlags(config)._overflowWeeks = true;
  3319. } else if (weekdayOverflow != null) {
  3320. getParsingFlags(config)._overflowWeekday = true;
  3321. } else {
  3322. temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
  3323. config._a[YEAR] = temp.year;
  3324. config._dayOfYear = temp.dayOfYear;
  3325. }
  3326. }
  3327. // constant that refers to the ISO standard
  3328. hooks.ISO_8601 = function () {};
  3329. // constant that refers to the RFC 2822 form
  3330. hooks.RFC_2822 = function () {};
  3331. // date from string and format string
  3332. function configFromStringAndFormat(config) {
  3333. // TODO: Move this to another part of the creation flow to prevent circular deps
  3334. if (config._f === hooks.ISO_8601) {
  3335. configFromISO(config);
  3336. return;
  3337. }
  3338. if (config._f === hooks.RFC_2822) {
  3339. configFromRFC2822(config);
  3340. return;
  3341. }
  3342. config._a = [];
  3343. getParsingFlags(config).empty = true;
  3344. // This array is used to make a Date, either with `new Date` or `Date.UTC`
  3345. var string = '' + config._i,
  3346. i,
  3347. parsedInput,
  3348. tokens,
  3349. token,
  3350. skipped,
  3351. stringLength = string.length,
  3352. totalParsedInputLength = 0,
  3353. era;
  3354. tokens =
  3355. expandFormat(config._f, config._locale).match(formattingTokens) || [];
  3356. for (i = 0; i < tokens.length; i++) {
  3357. token = tokens[i];
  3358. parsedInput = (string.match(getParseRegexForToken(token, config)) ||
  3359. [])[0];
  3360. if (parsedInput) {
  3361. skipped = string.substr(0, string.indexOf(parsedInput));
  3362. if (skipped.length > 0) {
  3363. getParsingFlags(config).unusedInput.push(skipped);
  3364. }
  3365. string = string.slice(
  3366. string.indexOf(parsedInput) + parsedInput.length
  3367. );
  3368. totalParsedInputLength += parsedInput.length;
  3369. }
  3370. // don't parse if it's not a known token
  3371. if (formatTokenFunctions[token]) {
  3372. if (parsedInput) {
  3373. getParsingFlags(config).empty = false;
  3374. } else {
  3375. getParsingFlags(config).unusedTokens.push(token);
  3376. }
  3377. addTimeToArrayFromToken(token, parsedInput, config);
  3378. } else if (config._strict && !parsedInput) {
  3379. getParsingFlags(config).unusedTokens.push(token);
  3380. }
  3381. }
  3382. // add remaining unparsed input length to the string
  3383. getParsingFlags(config).charsLeftOver =
  3384. stringLength - totalParsedInputLength;
  3385. if (string.length > 0) {
  3386. getParsingFlags(config).unusedInput.push(string);
  3387. }
  3388. // clear _12h flag if hour is <= 12
  3389. if (
  3390. config._a[HOUR] <= 12 &&
  3391. getParsingFlags(config).bigHour === true &&
  3392. config._a[HOUR] > 0
  3393. ) {
  3394. getParsingFlags(config).bigHour = undefined;
  3395. }
  3396. getParsingFlags(config).parsedDateParts = config._a.slice(0);
  3397. getParsingFlags(config).meridiem = config._meridiem;
  3398. // handle meridiem
  3399. config._a[HOUR] = meridiemFixWrap(
  3400. config._locale,
  3401. config._a[HOUR],
  3402. config._meridiem
  3403. );
  3404. // handle era
  3405. era = getParsingFlags(config).era;
  3406. if (era !== null) {
  3407. config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);
  3408. }
  3409. configFromArray(config);
  3410. checkOverflow(config);
  3411. }
  3412. function meridiemFixWrap(locale, hour, meridiem) {
  3413. var isPm;
  3414. if (meridiem == null) {
  3415. // nothing to do
  3416. return hour;
  3417. }
  3418. if (locale.meridiemHour != null) {
  3419. return locale.meridiemHour(hour, meridiem);
  3420. } else if (locale.isPM != null) {
  3421. // Fallback
  3422. isPm = locale.isPM(meridiem);
  3423. if (isPm && hour < 12) {
  3424. hour += 12;
  3425. }
  3426. if (!isPm && hour === 12) {
  3427. hour = 0;
  3428. }
  3429. return hour;
  3430. } else {
  3431. // this is not supposed to happen
  3432. return hour;
  3433. }
  3434. }
  3435. // date from string and array of format strings
  3436. function configFromStringAndArray(config) {
  3437. var tempConfig,
  3438. bestMoment,
  3439. scoreToBeat,
  3440. i,
  3441. currentScore,
  3442. validFormatFound,
  3443. bestFormatIsValid = false;
  3444. if (config._f.length === 0) {
  3445. getParsingFlags(config).invalidFormat = true;
  3446. config._d = new Date(NaN);
  3447. return;
  3448. }
  3449. for (i = 0; i < config._f.length; i++) {
  3450. currentScore = 0;
  3451. validFormatFound = false;
  3452. tempConfig = copyConfig({}, config);
  3453. if (config._useUTC != null) {
  3454. tempConfig._useUTC = config._useUTC;
  3455. }
  3456. tempConfig._f = config._f[i];
  3457. configFromStringAndFormat(tempConfig);
  3458. if (isValid(tempConfig)) {
  3459. validFormatFound = true;
  3460. }
  3461. // if there is any input that was not parsed add a penalty for that format
  3462. currentScore += getParsingFlags(tempConfig).charsLeftOver;
  3463. //or tokens
  3464. currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
  3465. getParsingFlags(tempConfig).score = currentScore;
  3466. if (!bestFormatIsValid) {
  3467. if (
  3468. scoreToBeat == null ||
  3469. currentScore < scoreToBeat ||
  3470. validFormatFound
  3471. ) {
  3472. scoreToBeat = currentScore;
  3473. bestMoment = tempConfig;
  3474. if (validFormatFound) {
  3475. bestFormatIsValid = true;
  3476. }
  3477. }
  3478. } else {
  3479. if (currentScore < scoreToBeat) {
  3480. scoreToBeat = currentScore;
  3481. bestMoment = tempConfig;
  3482. }
  3483. }
  3484. }
  3485. extend(config, bestMoment || tempConfig);
  3486. }
  3487. function configFromObject(config) {
  3488. if (config._d) {
  3489. return;
  3490. }
  3491. var i = normalizeObjectUnits(config._i),
  3492. dayOrDate = i.day === undefined ? i.date : i.day;
  3493. config._a = map(
  3494. [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],
  3495. function (obj) {
  3496. return obj && parseInt(obj, 10);
  3497. }
  3498. );
  3499. configFromArray(config);
  3500. }
  3501. function createFromConfig(config) {
  3502. var res = new Moment(checkOverflow(prepareConfig(config)));
  3503. if (res._nextDay) {
  3504. // Adding is smart enough around DST
  3505. res.add(1, 'd');
  3506. res._nextDay = undefined;
  3507. }
  3508. return res;
  3509. }
  3510. function prepareConfig(config) {
  3511. var input = config._i,
  3512. format = config._f;
  3513. config._locale = config._locale || getLocale(config._l);
  3514. if (input === null || (format === undefined && input === '')) {
  3515. return createInvalid({ nullInput: true });
  3516. }
  3517. if (typeof input === 'string') {
  3518. config._i = input = config._locale.preparse(input);
  3519. }
  3520. if (isMoment(input)) {
  3521. return new Moment(checkOverflow(input));
  3522. } else if (isDate(input)) {
  3523. config._d = input;
  3524. } else if (isArray(format)) {
  3525. configFromStringAndArray(config);
  3526. } else if (format) {
  3527. configFromStringAndFormat(config);
  3528. } else {
  3529. configFromInput(config);
  3530. }
  3531. if (!isValid(config)) {
  3532. config._d = null;
  3533. }
  3534. return config;
  3535. }
  3536. function configFromInput(config) {
  3537. var input = config._i;
  3538. if (isUndefined(input)) {
  3539. config._d = new Date(hooks.now());
  3540. } else if (isDate(input)) {
  3541. config._d = new Date(input.valueOf());
  3542. } else if (typeof input === 'string') {
  3543. configFromString(config);
  3544. } else if (isArray(input)) {
  3545. config._a = map(input.slice(0), function (obj) {
  3546. return parseInt(obj, 10);
  3547. });
  3548. configFromArray(config);
  3549. } else if (isObject(input)) {
  3550. configFromObject(config);
  3551. } else if (isNumber(input)) {
  3552. // from milliseconds
  3553. config._d = new Date(input);
  3554. } else {
  3555. hooks.createFromInputFallback(config);
  3556. }
  3557. }
  3558. function createLocalOrUTC(input, format, locale, strict, isUTC) {
  3559. var c = {};
  3560. if (format === true || format === false) {
  3561. strict = format;
  3562. format = undefined;
  3563. }
  3564. if (locale === true || locale === false) {
  3565. strict = locale;
  3566. locale = undefined;
  3567. }
  3568. if (
  3569. (isObject(input) && isObjectEmpty(input)) ||
  3570. (isArray(input) && input.length === 0)
  3571. ) {
  3572. input = undefined;
  3573. }
  3574. // object construction must be done this way.
  3575. // https://github.com/moment/moment/issues/1423
  3576. c._isAMomentObject = true;
  3577. c._useUTC = c._isUTC = isUTC;
  3578. c._l = locale;
  3579. c._i = input;
  3580. c._f = format;
  3581. c._strict = strict;
  3582. return createFromConfig(c);
  3583. }
  3584. function createLocal(input, format, locale, strict) {
  3585. return createLocalOrUTC(input, format, locale, strict, false);
  3586. }
  3587. var prototypeMin = deprecate(
  3588. 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
  3589. function () {
  3590. var other = createLocal.apply(null, arguments);
  3591. if (this.isValid() && other.isValid()) {
  3592. return other < this ? this : other;
  3593. } else {
  3594. return createInvalid();
  3595. }
  3596. }
  3597. ),
  3598. prototypeMax = deprecate(
  3599. 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
  3600. function () {
  3601. var other = createLocal.apply(null, arguments);
  3602. if (this.isValid() && other.isValid()) {
  3603. return other > this ? this : other;
  3604. } else {
  3605. return createInvalid();
  3606. }
  3607. }
  3608. );
  3609. // Pick a moment m from moments so that m[fn](other) is true for all
  3610. // other. This relies on the function fn to be transitive.
  3611. //
  3612. // moments should either be an array of moment objects or an array, whose
  3613. // first element is an array of moment objects.
  3614. function pickBy(fn, moments) {
  3615. var res, i;
  3616. if (moments.length === 1 && isArray(moments[0])) {
  3617. moments = moments[0];
  3618. }
  3619. if (!moments.length) {
  3620. return createLocal();
  3621. }
  3622. res = moments[0];
  3623. for (i = 1; i < moments.length; ++i) {
  3624. if (!moments[i].isValid() || moments[i][fn](res)) {
  3625. res = moments[i];
  3626. }
  3627. }
  3628. return res;
  3629. }
  3630. // TODO: Use [].sort instead?
  3631. function min() {
  3632. var args = [].slice.call(arguments, 0);
  3633. return pickBy('isBefore', args);
  3634. }
  3635. function max() {
  3636. var args = [].slice.call(arguments, 0);
  3637. return pickBy('isAfter', args);
  3638. }
  3639. var now = function () {
  3640. return Date.now ? Date.now() : +new Date();
  3641. };
  3642. var ordering = [
  3643. 'year',
  3644. 'quarter',
  3645. 'month',
  3646. 'week',
  3647. 'day',
  3648. 'hour',
  3649. 'minute',
  3650. 'second',
  3651. 'millisecond',
  3652. ];
  3653. function isDurationValid(m) {
  3654. var key,
  3655. unitHasDecimal = false,
  3656. i;
  3657. for (key in m) {
  3658. if (
  3659. hasOwnProp(m, key) &&
  3660. !(
  3661. indexOf.call(ordering, key) !== -1 &&
  3662. (m[key] == null || !isNaN(m[key]))
  3663. )
  3664. ) {
  3665. return false;
  3666. }
  3667. }
  3668. for (i = 0; i < ordering.length; ++i) {
  3669. if (m[ordering[i]]) {
  3670. if (unitHasDecimal) {
  3671. return false; // only allow non-integers for smallest unit
  3672. }
  3673. if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
  3674. unitHasDecimal = true;
  3675. }
  3676. }
  3677. }
  3678. return true;
  3679. }
  3680. function isValid$1() {
  3681. return this._isValid;
  3682. }
  3683. function createInvalid$1() {
  3684. return createDuration(NaN);
  3685. }
  3686. function Duration(duration) {
  3687. var normalizedInput = normalizeObjectUnits(duration),
  3688. years = normalizedInput.year || 0,
  3689. quarters = normalizedInput.quarter || 0,
  3690. months = normalizedInput.month || 0,
  3691. weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
  3692. days = normalizedInput.day || 0,
  3693. hours = normalizedInput.hour || 0,
  3694. minutes = normalizedInput.minute || 0,
  3695. seconds = normalizedInput.second || 0,
  3696. milliseconds = normalizedInput.millisecond || 0;
  3697. this._isValid = isDurationValid(normalizedInput);
  3698. // representation for dateAddRemove
  3699. this._milliseconds =
  3700. +milliseconds +
  3701. seconds * 1e3 + // 1000
  3702. minutes * 6e4 + // 1000 * 60
  3703. hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
  3704. // Because of dateAddRemove treats 24 hours as different from a
  3705. // day when working around DST, we need to store them separately
  3706. this._days = +days + weeks * 7;
  3707. // It is impossible to translate months into days without knowing
  3708. // which months you are are talking about, so we have to store
  3709. // it separately.
  3710. this._months = +months + quarters * 3 + years * 12;
  3711. this._data = {};
  3712. this._locale = getLocale();
  3713. this._bubble();
  3714. }
  3715. function isDuration(obj) {
  3716. return obj instanceof Duration;
  3717. }
  3718. function absRound(number) {
  3719. if (number < 0) {
  3720. return Math.round(-1 * number) * -1;
  3721. } else {
  3722. return Math.round(number);
  3723. }
  3724. }
  3725. // compare two arrays, return the number of differences
  3726. function compareArrays(array1, array2, dontConvert) {
  3727. var len = Math.min(array1.length, array2.length),
  3728. lengthDiff = Math.abs(array1.length - array2.length),
  3729. diffs = 0,
  3730. i;
  3731. for (i = 0; i < len; i++) {
  3732. if (
  3733. (dontConvert && array1[i] !== array2[i]) ||
  3734. (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))
  3735. ) {
  3736. diffs++;
  3737. }
  3738. }
  3739. return diffs + lengthDiff;
  3740. }
  3741. // FORMATTING
  3742. function offset(token, separator) {
  3743. addFormatToken(token, 0, 0, function () {
  3744. var offset = this.utcOffset(),
  3745. sign = '+';
  3746. if (offset < 0) {
  3747. offset = -offset;
  3748. sign = '-';
  3749. }
  3750. return (
  3751. sign +
  3752. zeroFill(~~(offset / 60), 2) +
  3753. separator +
  3754. zeroFill(~~offset % 60, 2)
  3755. );
  3756. });
  3757. }
  3758. offset('Z', ':');
  3759. offset('ZZ', '');
  3760. // PARSING
  3761. addRegexToken('Z', matchShortOffset);
  3762. addRegexToken('ZZ', matchShortOffset);
  3763. addParseToken(['Z', 'ZZ'], function (input, array, config) {
  3764. config._useUTC = true;
  3765. config._tzm = offsetFromString(matchShortOffset, input);
  3766. });
  3767. // HELPERS
  3768. // timezone chunker
  3769. // '+10:00' > ['10', '00']
  3770. // '-1530' > ['-15', '30']
  3771. var chunkOffset = /([\+\-]|\d\d)/gi;
  3772. function offsetFromString(matcher, string) {
  3773. var matches = (string || '').match(matcher),
  3774. chunk,
  3775. parts,
  3776. minutes;
  3777. if (matches === null) {
  3778. return null;
  3779. }
  3780. chunk = matches[matches.length - 1] || [];
  3781. parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
  3782. minutes = +(parts[1] * 60) + toInt(parts[2]);
  3783. return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
  3784. }
  3785. // Return a moment from input, that is local/utc/zone equivalent to model.
  3786. function cloneWithOffset(input, model) {
  3787. var res, diff;
  3788. if (model._isUTC) {
  3789. res = model.clone();
  3790. diff =
  3791. (isMoment(input) || isDate(input)
  3792. ? input.valueOf()
  3793. : createLocal(input).valueOf()) - res.valueOf();
  3794. // Use low-level api, because this fn is low-level api.
  3795. res._d.setTime(res._d.valueOf() + diff);
  3796. hooks.updateOffset(res, false);
  3797. return res;
  3798. } else {
  3799. return createLocal(input).local();
  3800. }
  3801. }
  3802. function getDateOffset(m) {
  3803. // On Firefox.24 Date#getTimezoneOffset returns a floating point.
  3804. // https://github.com/moment/moment/pull/1871
  3805. return -Math.round(m._d.getTimezoneOffset());
  3806. }
  3807. // HOOKS
  3808. // This function will be called whenever a moment is mutated.
  3809. // It is intended to keep the offset in sync with the timezone.
  3810. hooks.updateOffset = function () {};
  3811. // MOMENTS
  3812. // keepLocalTime = true means only change the timezone, without
  3813. // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
  3814. // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
  3815. // +0200, so we adjust the time as needed, to be valid.
  3816. //
  3817. // Keeping the time actually adds/subtracts (one hour)
  3818. // from the actual represented time. That is why we call updateOffset
  3819. // a second time. In case it wants us to change the offset again
  3820. // _changeInProgress == true case, then we have to adjust, because
  3821. // there is no such time in the given timezone.
  3822. function getSetOffset(input, keepLocalTime, keepMinutes) {
  3823. var offset = this._offset || 0,
  3824. localAdjust;
  3825. if (!this.isValid()) {
  3826. return input != null ? this : NaN;
  3827. }
  3828. if (input != null) {
  3829. if (typeof input === 'string') {
  3830. input = offsetFromString(matchShortOffset, input);
  3831. if (input === null) {
  3832. return this;
  3833. }
  3834. } else if (Math.abs(input) < 16 && !keepMinutes) {
  3835. input = input * 60;
  3836. }
  3837. if (!this._isUTC && keepLocalTime) {
  3838. localAdjust = getDateOffset(this);
  3839. }
  3840. this._offset = input;
  3841. this._isUTC = true;
  3842. if (localAdjust != null) {
  3843. this.add(localAdjust, 'm');
  3844. }
  3845. if (offset !== input) {
  3846. if (!keepLocalTime || this._changeInProgress) {
  3847. addSubtract(
  3848. this,
  3849. createDuration(input - offset, 'm'),
  3850. 1,
  3851. false
  3852. );
  3853. } else if (!this._changeInProgress) {
  3854. this._changeInProgress = true;
  3855. hooks.updateOffset(this, true);
  3856. this._changeInProgress = null;
  3857. }
  3858. }
  3859. return this;
  3860. } else {
  3861. return this._isUTC ? offset : getDateOffset(this);
  3862. }
  3863. }
  3864. function getSetZone(input, keepLocalTime) {
  3865. if (input != null) {
  3866. if (typeof input !== 'string') {
  3867. input = -input;
  3868. }
  3869. this.utcOffset(input, keepLocalTime);
  3870. return this;
  3871. } else {
  3872. return -this.utcOffset();
  3873. }
  3874. }
  3875. function setOffsetToUTC(keepLocalTime) {
  3876. return this.utcOffset(0, keepLocalTime);
  3877. }
  3878. function setOffsetToLocal(keepLocalTime) {
  3879. if (this._isUTC) {
  3880. this.utcOffset(0, keepLocalTime);
  3881. this._isUTC = false;
  3882. if (keepLocalTime) {
  3883. this.subtract(getDateOffset(this), 'm');
  3884. }
  3885. }
  3886. return this;
  3887. }
  3888. function setOffsetToParsedOffset() {
  3889. if (this._tzm != null) {
  3890. this.utcOffset(this._tzm, false, true);
  3891. } else if (typeof this._i === 'string') {
  3892. var tZone = offsetFromString(matchOffset, this._i);
  3893. if (tZone != null) {
  3894. this.utcOffset(tZone);
  3895. } else {
  3896. this.utcOffset(0, true);
  3897. }
  3898. }
  3899. return this;
  3900. }
  3901. function hasAlignedHourOffset(input) {
  3902. if (!this.isValid()) {
  3903. return false;
  3904. }
  3905. input = input ? createLocal(input).utcOffset() : 0;
  3906. return (this.utcOffset() - input) % 60 === 0;
  3907. }
  3908. function isDaylightSavingTime() {
  3909. return (
  3910. this.utcOffset() > this.clone().month(0).utcOffset() ||
  3911. this.utcOffset() > this.clone().month(5).utcOffset()
  3912. );
  3913. }
  3914. function isDaylightSavingTimeShifted() {
  3915. if (!isUndefined(this._isDSTShifted)) {
  3916. return this._isDSTShifted;
  3917. }
  3918. var c = {},
  3919. other;
  3920. copyConfig(c, this);
  3921. c = prepareConfig(c);
  3922. if (c._a) {
  3923. other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
  3924. this._isDSTShifted =
  3925. this.isValid() && compareArrays(c._a, other.toArray()) > 0;
  3926. } else {
  3927. this._isDSTShifted = false;
  3928. }
  3929. return this._isDSTShifted;
  3930. }
  3931. function isLocal() {
  3932. return this.isValid() ? !this._isUTC : false;
  3933. }
  3934. function isUtcOffset() {
  3935. return this.isValid() ? this._isUTC : false;
  3936. }
  3937. function isUtc() {
  3938. return this.isValid() ? this._isUTC && this._offset === 0 : false;
  3939. }
  3940. // ASP.NET json date format regex
  3941. var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,
  3942. // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
  3943. // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
  3944. // and further modified to allow for strings containing both week and day
  3945. isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
  3946. function createDuration(input, key) {
  3947. var duration = input,
  3948. // matching against regexp is expensive, do it on demand
  3949. match = null,
  3950. sign,
  3951. ret,
  3952. diffRes;
  3953. if (isDuration(input)) {
  3954. duration = {
  3955. ms: input._milliseconds,
  3956. d: input._days,
  3957. M: input._months,
  3958. };
  3959. } else if (isNumber(input) || !isNaN(+input)) {
  3960. duration = {};
  3961. if (key) {
  3962. duration[key] = +input;
  3963. } else {
  3964. duration.milliseconds = +input;
  3965. }
  3966. } else if ((match = aspNetRegex.exec(input))) {
  3967. sign = match[1] === '-' ? -1 : 1;
  3968. duration = {
  3969. y: 0,
  3970. d: toInt(match[DATE]) * sign,
  3971. h: toInt(match[HOUR]) * sign,
  3972. m: toInt(match[MINUTE]) * sign,
  3973. s: toInt(match[SECOND]) * sign,
  3974. ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match
  3975. };
  3976. } else if ((match = isoRegex.exec(input))) {
  3977. sign = match[1] === '-' ? -1 : 1;
  3978. duration = {
  3979. y: parseIso(match[2], sign),
  3980. M: parseIso(match[3], sign),
  3981. w: parseIso(match[4], sign),
  3982. d: parseIso(match[5], sign),
  3983. h: parseIso(match[6], sign),
  3984. m: parseIso(match[7], sign),
  3985. s: parseIso(match[8], sign),
  3986. };
  3987. } else if (duration == null) {
  3988. // checks for null or undefined
  3989. duration = {};
  3990. } else if (
  3991. typeof duration === 'object' &&
  3992. ('from' in duration || 'to' in duration)
  3993. ) {
  3994. diffRes = momentsDifference(
  3995. createLocal(duration.from),
  3996. createLocal(duration.to)
  3997. );
  3998. duration = {};
  3999. duration.ms = diffRes.milliseconds;
  4000. duration.M = diffRes.months;
  4001. }
  4002. ret = new Duration(duration);
  4003. if (isDuration(input) && hasOwnProp(input, '_locale')) {
  4004. ret._locale = input._locale;
  4005. }
  4006. if (isDuration(input) && hasOwnProp(input, '_isValid')) {
  4007. ret._isValid = input._isValid;
  4008. }
  4009. return ret;
  4010. }
  4011. createDuration.fn = Duration.prototype;
  4012. createDuration.invalid = createInvalid$1;
  4013. function parseIso(inp, sign) {
  4014. // We'd normally use ~~inp for this, but unfortunately it also
  4015. // converts floats to ints.
  4016. // inp may be undefined, so careful calling replace on it.
  4017. var res = inp && parseFloat(inp.replace(',', '.'));
  4018. // apply sign while we're at it
  4019. return (isNaN(res) ? 0 : res) * sign;
  4020. }
  4021. function positiveMomentsDifference(base, other) {
  4022. var res = {};
  4023. res.months =
  4024. other.month() - base.month() + (other.year() - base.year()) * 12;
  4025. if (base.clone().add(res.months, 'M').isAfter(other)) {
  4026. --res.months;
  4027. }
  4028. res.milliseconds = +other - +base.clone().add(res.months, 'M');
  4029. return res;
  4030. }
  4031. function momentsDifference(base, other) {
  4032. var res;
  4033. if (!(base.isValid() && other.isValid())) {
  4034. return { milliseconds: 0, months: 0 };
  4035. }
  4036. other = cloneWithOffset(other, base);
  4037. if (base.isBefore(other)) {
  4038. res = positiveMomentsDifference(base, other);
  4039. } else {
  4040. res = positiveMomentsDifference(other, base);
  4041. res.milliseconds = -res.milliseconds;
  4042. res.months = -res.months;
  4043. }
  4044. return res;
  4045. }
  4046. // TODO: remove 'name' arg after deprecation is removed
  4047. function createAdder(direction, name) {
  4048. return function (val, period) {
  4049. var dur, tmp;
  4050. //invert the arguments, but complain about it
  4051. if (period !== null && !isNaN(+period)) {
  4052. deprecateSimple(
  4053. name,
  4054. 'moment().' +
  4055. name +
  4056. '(period, number) is deprecated. Please use moment().' +
  4057. name +
  4058. '(number, period). ' +
  4059. 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'
  4060. );
  4061. tmp = val;
  4062. val = period;
  4063. period = tmp;
  4064. }
  4065. dur = createDuration(val, period);
  4066. addSubtract(this, dur, direction);
  4067. return this;
  4068. };
  4069. }
  4070. function addSubtract(mom, duration, isAdding, updateOffset) {
  4071. var milliseconds = duration._milliseconds,
  4072. days = absRound(duration._days),
  4073. months = absRound(duration._months);
  4074. if (!mom.isValid()) {
  4075. // No op
  4076. return;
  4077. }
  4078. updateOffset = updateOffset == null ? true : updateOffset;
  4079. if (months) {
  4080. setMonth(mom, get(mom, 'Month') + months * isAdding);
  4081. }
  4082. if (days) {
  4083. set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
  4084. }
  4085. if (milliseconds) {
  4086. mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
  4087. }
  4088. if (updateOffset) {
  4089. hooks.updateOffset(mom, days || months);
  4090. }
  4091. }
  4092. var add = createAdder(1, 'add'),
  4093. subtract = createAdder(-1, 'subtract');
  4094. function isString(input) {
  4095. return typeof input === 'string' || input instanceof String;
  4096. }
  4097. // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined
  4098. function isMomentInput(input) {
  4099. return (
  4100. isMoment(input) ||
  4101. isDate(input) ||
  4102. isString(input) ||
  4103. isNumber(input) ||
  4104. isNumberOrStringArray(input) ||
  4105. isMomentInputObject(input) ||
  4106. input === null ||
  4107. input === undefined
  4108. );
  4109. }
  4110. function isMomentInputObject(input) {
  4111. var objectTest = isObject(input) && !isObjectEmpty(input),
  4112. propertyTest = false,
  4113. properties = [
  4114. 'years',
  4115. 'year',
  4116. 'y',
  4117. 'months',
  4118. 'month',
  4119. 'M',
  4120. 'days',
  4121. 'day',
  4122. 'd',
  4123. 'dates',
  4124. 'date',
  4125. 'D',
  4126. 'hours',
  4127. 'hour',
  4128. 'h',
  4129. 'minutes',
  4130. 'minute',
  4131. 'm',
  4132. 'seconds',
  4133. 'second',
  4134. 's',
  4135. 'milliseconds',
  4136. 'millisecond',
  4137. 'ms',
  4138. ],
  4139. i,
  4140. property;
  4141. for (i = 0; i < properties.length; i += 1) {
  4142. property = properties[i];
  4143. propertyTest = propertyTest || hasOwnProp(input, property);
  4144. }
  4145. return objectTest && propertyTest;
  4146. }
  4147. function isNumberOrStringArray(input) {
  4148. var arrayTest = isArray(input),
  4149. dataTypeTest = false;
  4150. if (arrayTest) {
  4151. dataTypeTest =
  4152. input.filter(function (item) {
  4153. return !isNumber(item) && isString(input);
  4154. }).length === 0;
  4155. }
  4156. return arrayTest && dataTypeTest;
  4157. }
  4158. function isCalendarSpec(input) {
  4159. var objectTest = isObject(input) && !isObjectEmpty(input),
  4160. propertyTest = false,
  4161. properties = [
  4162. 'sameDay',
  4163. 'nextDay',
  4164. 'lastDay',
  4165. 'nextWeek',
  4166. 'lastWeek',
  4167. 'sameElse',
  4168. ],
  4169. i,
  4170. property;
  4171. for (i = 0; i < properties.length; i += 1) {
  4172. property = properties[i];
  4173. propertyTest = propertyTest || hasOwnProp(input, property);
  4174. }
  4175. return objectTest && propertyTest;
  4176. }
  4177. function getCalendarFormat(myMoment, now) {
  4178. var diff = myMoment.diff(now, 'days', true);
  4179. return diff < -6
  4180. ? 'sameElse'
  4181. : diff < -1
  4182. ? 'lastWeek'
  4183. : diff < 0
  4184. ? 'lastDay'
  4185. : diff < 1
  4186. ? 'sameDay'
  4187. : diff < 2
  4188. ? 'nextDay'
  4189. : diff < 7
  4190. ? 'nextWeek'
  4191. : 'sameElse';
  4192. }
  4193. function calendar$1(time, formats) {
  4194. // Support for single parameter, formats only overload to the calendar function
  4195. if (arguments.length === 1) {
  4196. if (!arguments[0]) {
  4197. time = undefined;
  4198. formats = undefined;
  4199. } else if (isMomentInput(arguments[0])) {
  4200. time = arguments[0];
  4201. formats = undefined;
  4202. } else if (isCalendarSpec(arguments[0])) {
  4203. formats = arguments[0];
  4204. time = undefined;
  4205. }
  4206. }
  4207. // We want to compare the start of today, vs this.
  4208. // Getting start-of-today depends on whether we're local/utc/offset or not.
  4209. var now = time || createLocal(),
  4210. sod = cloneWithOffset(now, this).startOf('day'),
  4211. format = hooks.calendarFormat(this, sod) || 'sameElse',
  4212. output =
  4213. formats &&
  4214. (isFunction(formats[format])
  4215. ? formats[format].call(this, now)
  4216. : formats[format]);
  4217. return this.format(
  4218. output || this.localeData().calendar(format, this, createLocal(now))
  4219. );
  4220. }
  4221. function clone() {
  4222. return new Moment(this);
  4223. }
  4224. function isAfter(input, units) {
  4225. var localInput = isMoment(input) ? input : createLocal(input);
  4226. if (!(this.isValid() && localInput.isValid())) {
  4227. return false;
  4228. }
  4229. units = normalizeUnits(units) || 'millisecond';
  4230. if (units === 'millisecond') {
  4231. return this.valueOf() > localInput.valueOf();
  4232. } else {
  4233. return localInput.valueOf() < this.clone().startOf(units).valueOf();
  4234. }
  4235. }
  4236. function isBefore(input, units) {
  4237. var localInput = isMoment(input) ? input : createLocal(input);
  4238. if (!(this.isValid() && localInput.isValid())) {
  4239. return false;
  4240. }
  4241. units = normalizeUnits(units) || 'millisecond';
  4242. if (units === 'millisecond') {
  4243. return this.valueOf() < localInput.valueOf();
  4244. } else {
  4245. return this.clone().endOf(units).valueOf() < localInput.valueOf();
  4246. }
  4247. }
  4248. function isBetween(from, to, units, inclusivity) {
  4249. var localFrom = isMoment(from) ? from : createLocal(from),
  4250. localTo = isMoment(to) ? to : createLocal(to);
  4251. if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
  4252. return false;
  4253. }
  4254. inclusivity = inclusivity || '()';
  4255. return (
  4256. (inclusivity[0] === '('
  4257. ? this.isAfter(localFrom, units)
  4258. : !this.isBefore(localFrom, units)) &&
  4259. (inclusivity[1] === ')'
  4260. ? this.isBefore(localTo, units)
  4261. : !this.isAfter(localTo, units))
  4262. );
  4263. }
  4264. function isSame(input, units) {
  4265. var localInput = isMoment(input) ? input : createLocal(input),
  4266. inputMs;
  4267. if (!(this.isValid() && localInput.isValid())) {
  4268. return false;
  4269. }
  4270. units = normalizeUnits(units) || 'millisecond';
  4271. if (units === 'millisecond') {
  4272. return this.valueOf() === localInput.valueOf();
  4273. } else {
  4274. inputMs = localInput.valueOf();
  4275. return (
  4276. this.clone().startOf(units).valueOf() <= inputMs &&
  4277. inputMs <= this.clone().endOf(units).valueOf()
  4278. );
  4279. }
  4280. }
  4281. function isSameOrAfter(input, units) {
  4282. return this.isSame(input, units) || this.isAfter(input, units);
  4283. }
  4284. function isSameOrBefore(input, units) {
  4285. return this.isSame(input, units) || this.isBefore(input, units);
  4286. }
  4287. function diff(input, units, asFloat) {
  4288. var that, zoneDelta, output;
  4289. if (!this.isValid()) {
  4290. return NaN;
  4291. }
  4292. that = cloneWithOffset(input, this);
  4293. if (!that.isValid()) {
  4294. return NaN;
  4295. }
  4296. zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  4297. units = normalizeUnits(units);
  4298. switch (units) {
  4299. case 'year':
  4300. output = monthDiff(this, that) / 12;
  4301. break;
  4302. case 'month':
  4303. output = monthDiff(this, that);
  4304. break;
  4305. case 'quarter':
  4306. output = monthDiff(this, that) / 3;
  4307. break;
  4308. case 'second':
  4309. output = (this - that) / 1e3;
  4310. break; // 1000
  4311. case 'minute':
  4312. output = (this - that) / 6e4;
  4313. break; // 1000 * 60
  4314. case 'hour':
  4315. output = (this - that) / 36e5;
  4316. break; // 1000 * 60 * 60
  4317. case 'day':
  4318. output = (this - that - zoneDelta) / 864e5;
  4319. break; // 1000 * 60 * 60 * 24, negate dst
  4320. case 'week':
  4321. output = (this - that - zoneDelta) / 6048e5;
  4322. break; // 1000 * 60 * 60 * 24 * 7, negate dst
  4323. default:
  4324. output = this - that;
  4325. }
  4326. return asFloat ? output : absFloor(output);
  4327. }
  4328. function monthDiff(a, b) {
  4329. if (a.date() < b.date()) {
  4330. // end-of-month calculations work correct when the start month has more
  4331. // days than the end month.
  4332. return -monthDiff(b, a);
  4333. }
  4334. // difference in months
  4335. var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
  4336. // b is in (anchor - 1 month, anchor + 1 month)
  4337. anchor = a.clone().add(wholeMonthDiff, 'months'),
  4338. anchor2,
  4339. adjust;
  4340. if (b - anchor < 0) {
  4341. anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
  4342. // linear across the month
  4343. adjust = (b - anchor) / (anchor - anchor2);
  4344. } else {
  4345. anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
  4346. // linear across the month
  4347. adjust = (b - anchor) / (anchor2 - anchor);
  4348. }
  4349. //check for negative zero, return zero if negative zero
  4350. return -(wholeMonthDiff + adjust) || 0;
  4351. }
  4352. hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
  4353. hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
  4354. function toString() {
  4355. return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
  4356. }
  4357. function toISOString(keepOffset) {
  4358. if (!this.isValid()) {
  4359. return null;
  4360. }
  4361. var utc = keepOffset !== true,
  4362. m = utc ? this.clone().utc() : this;
  4363. if (m.year() < 0 || m.year() > 9999) {
  4364. return formatMoment(
  4365. m,
  4366. utc
  4367. ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'
  4368. : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'
  4369. );
  4370. }
  4371. if (isFunction(Date.prototype.toISOString)) {
  4372. // native implementation is ~50x faster, use it when we can
  4373. if (utc) {
  4374. return this.toDate().toISOString();
  4375. } else {
  4376. return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)
  4377. .toISOString()
  4378. .replace('Z', formatMoment(m, 'Z'));
  4379. }
  4380. }
  4381. return formatMoment(
  4382. m,
  4383. utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'
  4384. );
  4385. }
  4386. /**
  4387. * Return a human readable representation of a moment that can
  4388. * also be evaluated to get a new moment which is the same
  4389. *
  4390. * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
  4391. */
  4392. function inspect() {
  4393. if (!this.isValid()) {
  4394. return 'moment.invalid(/* ' + this._i + ' */)';
  4395. }
  4396. var func = 'moment',
  4397. zone = '',
  4398. prefix,
  4399. year,
  4400. datetime,
  4401. suffix;
  4402. if (!this.isLocal()) {
  4403. func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
  4404. zone = 'Z';
  4405. }
  4406. prefix = '[' + func + '("]';
  4407. year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';
  4408. datetime = '-MM-DD[T]HH:mm:ss.SSS';
  4409. suffix = zone + '[")]';
  4410. return this.format(prefix + year + datetime + suffix);
  4411. }
  4412. function format(inputString) {
  4413. if (!inputString) {
  4414. inputString = this.isUtc()
  4415. ? hooks.defaultFormatUtc
  4416. : hooks.defaultFormat;
  4417. }
  4418. var output = formatMoment(this, inputString);
  4419. return this.localeData().postformat(output);
  4420. }
  4421. function from(time, withoutSuffix) {
  4422. if (
  4423. this.isValid() &&
  4424. ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
  4425. ) {
  4426. return createDuration({ to: this, from: time })
  4427. .locale(this.locale())
  4428. .humanize(!withoutSuffix);
  4429. } else {
  4430. return this.localeData().invalidDate();
  4431. }
  4432. }
  4433. function fromNow(withoutSuffix) {
  4434. return this.from(createLocal(), withoutSuffix);
  4435. }
  4436. function to(time, withoutSuffix) {
  4437. if (
  4438. this.isValid() &&
  4439. ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
  4440. ) {
  4441. return createDuration({ from: this, to: time })
  4442. .locale(this.locale())
  4443. .humanize(!withoutSuffix);
  4444. } else {
  4445. return this.localeData().invalidDate();
  4446. }
  4447. }
  4448. function toNow(withoutSuffix) {
  4449. return this.to(createLocal(), withoutSuffix);
  4450. }
  4451. // If passed a locale key, it will set the locale for this
  4452. // instance. Otherwise, it will return the locale configuration
  4453. // variables for this instance.
  4454. function locale(key) {
  4455. var newLocaleData;
  4456. if (key === undefined) {
  4457. return this._locale._abbr;
  4458. } else {
  4459. newLocaleData = getLocale(key);
  4460. if (newLocaleData != null) {
  4461. this._locale = newLocaleData;
  4462. }
  4463. return this;
  4464. }
  4465. }
  4466. var lang = deprecate(
  4467. 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
  4468. function (key) {
  4469. if (key === undefined) {
  4470. return this.localeData();
  4471. } else {
  4472. return this.locale(key);
  4473. }
  4474. }
  4475. );
  4476. function localeData() {
  4477. return this._locale;
  4478. }
  4479. var MS_PER_SECOND = 1000,
  4480. MS_PER_MINUTE = 60 * MS_PER_SECOND,
  4481. MS_PER_HOUR = 60 * MS_PER_MINUTE,
  4482. MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
  4483. // actual modulo - handles negative numbers (for dates before 1970):
  4484. function mod$1(dividend, divisor) {
  4485. return ((dividend % divisor) + divisor) % divisor;
  4486. }
  4487. function localStartOfDate(y, m, d) {
  4488. // the date constructor remaps years 0-99 to 1900-1999
  4489. if (y < 100 && y >= 0) {
  4490. // preserve leap years using a full 400 year cycle, then reset
  4491. return new Date(y + 400, m, d) - MS_PER_400_YEARS;
  4492. } else {
  4493. return new Date(y, m, d).valueOf();
  4494. }
  4495. }
  4496. function utcStartOfDate(y, m, d) {
  4497. // Date.UTC remaps years 0-99 to 1900-1999
  4498. if (y < 100 && y >= 0) {
  4499. // preserve leap years using a full 400 year cycle, then reset
  4500. return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
  4501. } else {
  4502. return Date.UTC(y, m, d);
  4503. }
  4504. }
  4505. function startOf(units) {
  4506. var time, startOfDate;
  4507. units = normalizeUnits(units);
  4508. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  4509. return this;
  4510. }
  4511. startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  4512. switch (units) {
  4513. case 'year':
  4514. time = startOfDate(this.year(), 0, 1);
  4515. break;
  4516. case 'quarter':
  4517. time = startOfDate(
  4518. this.year(),
  4519. this.month() - (this.month() % 3),
  4520. 1
  4521. );
  4522. break;
  4523. case 'month':
  4524. time = startOfDate(this.year(), this.month(), 1);
  4525. break;
  4526. case 'week':
  4527. time = startOfDate(
  4528. this.year(),
  4529. this.month(),
  4530. this.date() - this.weekday()
  4531. );
  4532. break;
  4533. case 'isoWeek':
  4534. time = startOfDate(
  4535. this.year(),
  4536. this.month(),
  4537. this.date() - (this.isoWeekday() - 1)
  4538. );
  4539. break;
  4540. case 'day':
  4541. case 'date':
  4542. time = startOfDate(this.year(), this.month(), this.date());
  4543. break;
  4544. case 'hour':
  4545. time = this._d.valueOf();
  4546. time -= mod$1(
  4547. time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
  4548. MS_PER_HOUR
  4549. );
  4550. break;
  4551. case 'minute':
  4552. time = this._d.valueOf();
  4553. time -= mod$1(time, MS_PER_MINUTE);
  4554. break;
  4555. case 'second':
  4556. time = this._d.valueOf();
  4557. time -= mod$1(time, MS_PER_SECOND);
  4558. break;
  4559. }
  4560. this._d.setTime(time);
  4561. hooks.updateOffset(this, true);
  4562. return this;
  4563. }
  4564. function endOf(units) {
  4565. var time, startOfDate;
  4566. units = normalizeUnits(units);
  4567. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  4568. return this;
  4569. }
  4570. startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  4571. switch (units) {
  4572. case 'year':
  4573. time = startOfDate(this.year() + 1, 0, 1) - 1;
  4574. break;
  4575. case 'quarter':
  4576. time =
  4577. startOfDate(
  4578. this.year(),
  4579. this.month() - (this.month() % 3) + 3,
  4580. 1
  4581. ) - 1;
  4582. break;
  4583. case 'month':
  4584. time = startOfDate(this.year(), this.month() + 1, 1) - 1;
  4585. break;
  4586. case 'week':
  4587. time =
  4588. startOfDate(
  4589. this.year(),
  4590. this.month(),
  4591. this.date() - this.weekday() + 7
  4592. ) - 1;
  4593. break;
  4594. case 'isoWeek':
  4595. time =
  4596. startOfDate(
  4597. this.year(),
  4598. this.month(),
  4599. this.date() - (this.isoWeekday() - 1) + 7
  4600. ) - 1;
  4601. break;
  4602. case 'day':
  4603. case 'date':
  4604. time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
  4605. break;
  4606. case 'hour':
  4607. time = this._d.valueOf();
  4608. time +=
  4609. MS_PER_HOUR -
  4610. mod$1(
  4611. time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
  4612. MS_PER_HOUR
  4613. ) -
  4614. 1;
  4615. break;
  4616. case 'minute':
  4617. time = this._d.valueOf();
  4618. time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
  4619. break;
  4620. case 'second':
  4621. time = this._d.valueOf();
  4622. time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
  4623. break;
  4624. }
  4625. this._d.setTime(time);
  4626. hooks.updateOffset(this, true);
  4627. return this;
  4628. }
  4629. function valueOf() {
  4630. return this._d.valueOf() - (this._offset || 0) * 60000;
  4631. }
  4632. function unix() {
  4633. return Math.floor(this.valueOf() / 1000);
  4634. }
  4635. function toDate() {
  4636. return new Date(this.valueOf());
  4637. }
  4638. function toArray() {
  4639. var m = this;
  4640. return [
  4641. m.year(),
  4642. m.month(),
  4643. m.date(),
  4644. m.hour(),
  4645. m.minute(),
  4646. m.second(),
  4647. m.millisecond(),
  4648. ];
  4649. }
  4650. function toObject() {
  4651. var m = this;
  4652. return {
  4653. years: m.year(),
  4654. months: m.month(),
  4655. date: m.date(),
  4656. hours: m.hours(),
  4657. minutes: m.minutes(),
  4658. seconds: m.seconds(),
  4659. milliseconds: m.milliseconds(),
  4660. };
  4661. }
  4662. function toJSON() {
  4663. // new Date(NaN).toJSON() === null
  4664. return this.isValid() ? this.toISOString() : null;
  4665. }
  4666. function isValid$2() {
  4667. return isValid(this);
  4668. }
  4669. function parsingFlags() {
  4670. return extend({}, getParsingFlags(this));
  4671. }
  4672. function invalidAt() {
  4673. return getParsingFlags(this).overflow;
  4674. }
  4675. function creationData() {
  4676. return {
  4677. input: this._i,
  4678. format: this._f,
  4679. locale: this._locale,
  4680. isUTC: this._isUTC,
  4681. strict: this._strict,
  4682. };
  4683. }
  4684. addFormatToken('N', 0, 0, 'eraAbbr');
  4685. addFormatToken('NN', 0, 0, 'eraAbbr');
  4686. addFormatToken('NNN', 0, 0, 'eraAbbr');
  4687. addFormatToken('NNNN', 0, 0, 'eraName');
  4688. addFormatToken('NNNNN', 0, 0, 'eraNarrow');
  4689. addFormatToken('y', ['y', 1], 'yo', 'eraYear');
  4690. addFormatToken('y', ['yy', 2], 0, 'eraYear');
  4691. addFormatToken('y', ['yyy', 3], 0, 'eraYear');
  4692. addFormatToken('y', ['yyyy', 4], 0, 'eraYear');
  4693. addRegexToken('N', matchEraAbbr);
  4694. addRegexToken('NN', matchEraAbbr);
  4695. addRegexToken('NNN', matchEraAbbr);
  4696. addRegexToken('NNNN', matchEraName);
  4697. addRegexToken('NNNNN', matchEraNarrow);
  4698. addParseToken(['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function (
  4699. input,
  4700. array,
  4701. config,
  4702. token
  4703. ) {
  4704. var era = config._locale.erasParse(input, token, config._strict);
  4705. if (era) {
  4706. getParsingFlags(config).era = era;
  4707. } else {
  4708. getParsingFlags(config).invalidEra = input;
  4709. }
  4710. });
  4711. addRegexToken('y', matchUnsigned);
  4712. addRegexToken('yy', matchUnsigned);
  4713. addRegexToken('yyy', matchUnsigned);
  4714. addRegexToken('yyyy', matchUnsigned);
  4715. addRegexToken('yo', matchEraYearOrdinal);
  4716. addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);
  4717. addParseToken(['yo'], function (input, array, config, token) {
  4718. var match;
  4719. if (config._locale._eraYearOrdinalRegex) {
  4720. match = input.match(config._locale._eraYearOrdinalRegex);
  4721. }
  4722. if (config._locale.eraYearOrdinalParse) {
  4723. array[YEAR] = config._locale.eraYearOrdinalParse(input, match);
  4724. } else {
  4725. array[YEAR] = parseInt(input, 10);
  4726. }
  4727. });
  4728. function localeEras(m, format) {
  4729. var i,
  4730. l,
  4731. date,
  4732. eras = this._eras || getLocale('en')._eras;
  4733. for (i = 0, l = eras.length; i < l; ++i) {
  4734. switch (typeof eras[i].since) {
  4735. case 'string':
  4736. // truncate time
  4737. date = hooks(eras[i].since).startOf('day');
  4738. eras[i].since = date.valueOf();
  4739. break;
  4740. }
  4741. switch (typeof eras[i].until) {
  4742. case 'undefined':
  4743. eras[i].until = +Infinity;
  4744. break;
  4745. case 'string':
  4746. // truncate time
  4747. date = hooks(eras[i].until).startOf('day').valueOf();
  4748. eras[i].until = date.valueOf();
  4749. break;
  4750. }
  4751. }
  4752. return eras;
  4753. }
  4754. function localeErasParse(eraName, format, strict) {
  4755. var i,
  4756. l,
  4757. eras = this.eras(),
  4758. name,
  4759. abbr,
  4760. narrow;
  4761. eraName = eraName.toUpperCase();
  4762. for (i = 0, l = eras.length; i < l; ++i) {
  4763. name = eras[i].name.toUpperCase();
  4764. abbr = eras[i].abbr.toUpperCase();
  4765. narrow = eras[i].narrow.toUpperCase();
  4766. if (strict) {
  4767. switch (format) {
  4768. case 'N':
  4769. case 'NN':
  4770. case 'NNN':
  4771. if (abbr === eraName) {
  4772. return eras[i];
  4773. }
  4774. break;
  4775. case 'NNNN':
  4776. if (name === eraName) {
  4777. return eras[i];
  4778. }
  4779. break;
  4780. case 'NNNNN':
  4781. if (narrow === eraName) {
  4782. return eras[i];
  4783. }
  4784. break;
  4785. }
  4786. } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
  4787. return eras[i];
  4788. }
  4789. }
  4790. }
  4791. function localeErasConvertYear(era, year) {
  4792. var dir = era.since <= era.until ? +1 : -1;
  4793. if (year === undefined) {
  4794. return hooks(era.since).year();
  4795. } else {
  4796. return hooks(era.since).year() + (year - era.offset) * dir;
  4797. }
  4798. }
  4799. function getEraName() {
  4800. var i,
  4801. l,
  4802. val,
  4803. eras = this.localeData().eras();
  4804. for (i = 0, l = eras.length; i < l; ++i) {
  4805. // truncate time
  4806. val = this.clone().startOf('day').valueOf();
  4807. if (eras[i].since <= val && val <= eras[i].until) {
  4808. return eras[i].name;
  4809. }
  4810. if (eras[i].until <= val && val <= eras[i].since) {
  4811. return eras[i].name;
  4812. }
  4813. }
  4814. return '';
  4815. }
  4816. function getEraNarrow() {
  4817. var i,
  4818. l,
  4819. val,
  4820. eras = this.localeData().eras();
  4821. for (i = 0, l = eras.length; i < l; ++i) {
  4822. // truncate time
  4823. val = this.clone().startOf('day').valueOf();
  4824. if (eras[i].since <= val && val <= eras[i].until) {
  4825. return eras[i].narrow;
  4826. }
  4827. if (eras[i].until <= val && val <= eras[i].since) {
  4828. return eras[i].narrow;
  4829. }
  4830. }
  4831. return '';
  4832. }
  4833. function getEraAbbr() {
  4834. var i,
  4835. l,
  4836. val,
  4837. eras = this.localeData().eras();
  4838. for (i = 0, l = eras.length; i < l; ++i) {
  4839. // truncate time
  4840. val = this.clone().startOf('day').valueOf();
  4841. if (eras[i].since <= val && val <= eras[i].until) {
  4842. return eras[i].abbr;
  4843. }
  4844. if (eras[i].until <= val && val <= eras[i].since) {
  4845. return eras[i].abbr;
  4846. }
  4847. }
  4848. return '';
  4849. }
  4850. function getEraYear() {
  4851. var i,
  4852. l,
  4853. dir,
  4854. val,
  4855. eras = this.localeData().eras();
  4856. for (i = 0, l = eras.length; i < l; ++i) {
  4857. dir = eras[i].since <= eras[i].until ? +1 : -1;
  4858. // truncate time
  4859. val = this.clone().startOf('day').valueOf();
  4860. if (
  4861. (eras[i].since <= val && val <= eras[i].until) ||
  4862. (eras[i].until <= val && val <= eras[i].since)
  4863. ) {
  4864. return (
  4865. (this.year() - hooks(eras[i].since).year()) * dir +
  4866. eras[i].offset
  4867. );
  4868. }
  4869. }
  4870. return this.year();
  4871. }
  4872. function erasNameRegex(isStrict) {
  4873. if (!hasOwnProp(this, '_erasNameRegex')) {
  4874. computeErasParse.call(this);
  4875. }
  4876. return isStrict ? this._erasNameRegex : this._erasRegex;
  4877. }
  4878. function erasAbbrRegex(isStrict) {
  4879. if (!hasOwnProp(this, '_erasAbbrRegex')) {
  4880. computeErasParse.call(this);
  4881. }
  4882. return isStrict ? this._erasAbbrRegex : this._erasRegex;
  4883. }
  4884. function erasNarrowRegex(isStrict) {
  4885. if (!hasOwnProp(this, '_erasNarrowRegex')) {
  4886. computeErasParse.call(this);
  4887. }
  4888. return isStrict ? this._erasNarrowRegex : this._erasRegex;
  4889. }
  4890. function matchEraAbbr(isStrict, locale) {
  4891. return locale.erasAbbrRegex(isStrict);
  4892. }
  4893. function matchEraName(isStrict, locale) {
  4894. return locale.erasNameRegex(isStrict);
  4895. }
  4896. function matchEraNarrow(isStrict, locale) {
  4897. return locale.erasNarrowRegex(isStrict);
  4898. }
  4899. function matchEraYearOrdinal(isStrict, locale) {
  4900. return locale._eraYearOrdinalRegex || matchUnsigned;
  4901. }
  4902. function computeErasParse() {
  4903. var abbrPieces = [],
  4904. namePieces = [],
  4905. narrowPieces = [],
  4906. mixedPieces = [],
  4907. i,
  4908. l,
  4909. eras = this.eras();
  4910. for (i = 0, l = eras.length; i < l; ++i) {
  4911. namePieces.push(regexEscape(eras[i].name));
  4912. abbrPieces.push(regexEscape(eras[i].abbr));
  4913. narrowPieces.push(regexEscape(eras[i].narrow));
  4914. mixedPieces.push(regexEscape(eras[i].name));
  4915. mixedPieces.push(regexEscape(eras[i].abbr));
  4916. mixedPieces.push(regexEscape(eras[i].narrow));
  4917. }
  4918. this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  4919. this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');
  4920. this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');
  4921. this._erasNarrowRegex = new RegExp(
  4922. '^(' + narrowPieces.join('|') + ')',
  4923. 'i'
  4924. );
  4925. }
  4926. // FORMATTING
  4927. addFormatToken(0, ['gg', 2], 0, function () {
  4928. return this.weekYear() % 100;
  4929. });
  4930. addFormatToken(0, ['GG', 2], 0, function () {
  4931. return this.isoWeekYear() % 100;
  4932. });
  4933. function addWeekYearFormatToken(token, getter) {
  4934. addFormatToken(0, [token, token.length], 0, getter);
  4935. }
  4936. addWeekYearFormatToken('gggg', 'weekYear');
  4937. addWeekYearFormatToken('ggggg', 'weekYear');
  4938. addWeekYearFormatToken('GGGG', 'isoWeekYear');
  4939. addWeekYearFormatToken('GGGGG', 'isoWeekYear');
  4940. // ALIASES
  4941. addUnitAlias('weekYear', 'gg');
  4942. addUnitAlias('isoWeekYear', 'GG');
  4943. // PRIORITY
  4944. addUnitPriority('weekYear', 1);
  4945. addUnitPriority('isoWeekYear', 1);
  4946. // PARSING
  4947. addRegexToken('G', matchSigned);
  4948. addRegexToken('g', matchSigned);
  4949. addRegexToken('GG', match1to2, match2);
  4950. addRegexToken('gg', match1to2, match2);
  4951. addRegexToken('GGGG', match1to4, match4);
  4952. addRegexToken('gggg', match1to4, match4);
  4953. addRegexToken('GGGGG', match1to6, match6);
  4954. addRegexToken('ggggg', match1to6, match6);
  4955. addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (
  4956. input,
  4957. week,
  4958. config,
  4959. token
  4960. ) {
  4961. week[token.substr(0, 2)] = toInt(input);
  4962. });
  4963. addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
  4964. week[token] = hooks.parseTwoDigitYear(input);
  4965. });
  4966. // MOMENTS
  4967. function getSetWeekYear(input) {
  4968. return getSetWeekYearHelper.call(
  4969. this,
  4970. input,
  4971. this.week(),
  4972. this.weekday(),
  4973. this.localeData()._week.dow,
  4974. this.localeData()._week.doy
  4975. );
  4976. }
  4977. function getSetISOWeekYear(input) {
  4978. return getSetWeekYearHelper.call(
  4979. this,
  4980. input,
  4981. this.isoWeek(),
  4982. this.isoWeekday(),
  4983. 1,
  4984. 4
  4985. );
  4986. }
  4987. function getISOWeeksInYear() {
  4988. return weeksInYear(this.year(), 1, 4);
  4989. }
  4990. function getISOWeeksInISOWeekYear() {
  4991. return weeksInYear(this.isoWeekYear(), 1, 4);
  4992. }
  4993. function getWeeksInYear() {
  4994. var weekInfo = this.localeData()._week;
  4995. return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
  4996. }
  4997. function getWeeksInWeekYear() {
  4998. var weekInfo = this.localeData()._week;
  4999. return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
  5000. }
  5001. function getSetWeekYearHelper(input, week, weekday, dow, doy) {
  5002. var weeksTarget;
  5003. if (input == null) {
  5004. return weekOfYear(this, dow, doy).year;
  5005. } else {
  5006. weeksTarget = weeksInYear(input, dow, doy);
  5007. if (week > weeksTarget) {
  5008. week = weeksTarget;
  5009. }
  5010. return setWeekAll.call(this, input, week, weekday, dow, doy);
  5011. }
  5012. }
  5013. function setWeekAll(weekYear, week, weekday, dow, doy) {
  5014. var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
  5015. date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  5016. this.year(date.getUTCFullYear());
  5017. this.month(date.getUTCMonth());
  5018. this.date(date.getUTCDate());
  5019. return this;
  5020. }
  5021. // FORMATTING
  5022. addFormatToken('Q', 0, 'Qo', 'quarter');
  5023. // ALIASES
  5024. addUnitAlias('quarter', 'Q');
  5025. // PRIORITY
  5026. addUnitPriority('quarter', 7);
  5027. // PARSING
  5028. addRegexToken('Q', match1);
  5029. addParseToken('Q', function (input, array) {
  5030. array[MONTH] = (toInt(input) - 1) * 3;
  5031. });
  5032. // MOMENTS
  5033. function getSetQuarter(input) {
  5034. return input == null
  5035. ? Math.ceil((this.month() + 1) / 3)
  5036. : this.month((input - 1) * 3 + (this.month() % 3));
  5037. }
  5038. // FORMATTING
  5039. addFormatToken('D', ['DD', 2], 'Do', 'date');
  5040. // ALIASES
  5041. addUnitAlias('date', 'D');
  5042. // PRIORITY
  5043. addUnitPriority('date', 9);
  5044. // PARSING
  5045. addRegexToken('D', match1to2);
  5046. addRegexToken('DD', match1to2, match2);
  5047. addRegexToken('Do', function (isStrict, locale) {
  5048. // TODO: Remove "ordinalParse" fallback in next major release.
  5049. return isStrict
  5050. ? locale._dayOfMonthOrdinalParse || locale._ordinalParse
  5051. : locale._dayOfMonthOrdinalParseLenient;
  5052. });
  5053. addParseToken(['D', 'DD'], DATE);
  5054. addParseToken('Do', function (input, array) {
  5055. array[DATE] = toInt(input.match(match1to2)[0]);
  5056. });
  5057. // MOMENTS
  5058. var getSetDayOfMonth = makeGetSet('Date', true);
  5059. // FORMATTING
  5060. addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
  5061. // ALIASES
  5062. addUnitAlias('dayOfYear', 'DDD');
  5063. // PRIORITY
  5064. addUnitPriority('dayOfYear', 4);
  5065. // PARSING
  5066. addRegexToken('DDD', match1to3);
  5067. addRegexToken('DDDD', match3);
  5068. addParseToken(['DDD', 'DDDD'], function (input, array, config) {
  5069. config._dayOfYear = toInt(input);
  5070. });
  5071. // HELPERS
  5072. // MOMENTS
  5073. function getSetDayOfYear(input) {
  5074. var dayOfYear =
  5075. Math.round(
  5076. (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5
  5077. ) + 1;
  5078. return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
  5079. }
  5080. // FORMATTING
  5081. addFormatToken('m', ['mm', 2], 0, 'minute');
  5082. // ALIASES
  5083. addUnitAlias('minute', 'm');
  5084. // PRIORITY
  5085. addUnitPriority('minute', 14);
  5086. // PARSING
  5087. addRegexToken('m', match1to2);
  5088. addRegexToken('mm', match1to2, match2);
  5089. addParseToken(['m', 'mm'], MINUTE);
  5090. // MOMENTS
  5091. var getSetMinute = makeGetSet('Minutes', false);
  5092. // FORMATTING
  5093. addFormatToken('s', ['ss', 2], 0, 'second');
  5094. // ALIASES
  5095. addUnitAlias('second', 's');
  5096. // PRIORITY
  5097. addUnitPriority('second', 15);
  5098. // PARSING
  5099. addRegexToken('s', match1to2);
  5100. addRegexToken('ss', match1to2, match2);
  5101. addParseToken(['s', 'ss'], SECOND);
  5102. // MOMENTS
  5103. var getSetSecond = makeGetSet('Seconds', false);
  5104. // FORMATTING
  5105. addFormatToken('S', 0, 0, function () {
  5106. return ~~(this.millisecond() / 100);
  5107. });
  5108. addFormatToken(0, ['SS', 2], 0, function () {
  5109. return ~~(this.millisecond() / 10);
  5110. });
  5111. addFormatToken(0, ['SSS', 3], 0, 'millisecond');
  5112. addFormatToken(0, ['SSSS', 4], 0, function () {
  5113. return this.millisecond() * 10;
  5114. });
  5115. addFormatToken(0, ['SSSSS', 5], 0, function () {
  5116. return this.millisecond() * 100;
  5117. });
  5118. addFormatToken(0, ['SSSSSS', 6], 0, function () {
  5119. return this.millisecond() * 1000;
  5120. });
  5121. addFormatToken(0, ['SSSSSSS', 7], 0, function () {
  5122. return this.millisecond() * 10000;
  5123. });
  5124. addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
  5125. return this.millisecond() * 100000;
  5126. });
  5127. addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
  5128. return this.millisecond() * 1000000;
  5129. });
  5130. // ALIASES
  5131. addUnitAlias('millisecond', 'ms');
  5132. // PRIORITY
  5133. addUnitPriority('millisecond', 16);
  5134. // PARSING
  5135. addRegexToken('S', match1to3, match1);
  5136. addRegexToken('SS', match1to3, match2);
  5137. addRegexToken('SSS', match1to3, match3);
  5138. var token, getSetMillisecond;
  5139. for (token = 'SSSS'; token.length <= 9; token += 'S') {
  5140. addRegexToken(token, matchUnsigned);
  5141. }
  5142. function parseMs(input, array) {
  5143. array[MILLISECOND] = toInt(('0.' + input) * 1000);
  5144. }
  5145. for (token = 'S'; token.length <= 9; token += 'S') {
  5146. addParseToken(token, parseMs);
  5147. }
  5148. getSetMillisecond = makeGetSet('Milliseconds', false);
  5149. // FORMATTING
  5150. addFormatToken('z', 0, 0, 'zoneAbbr');
  5151. addFormatToken('zz', 0, 0, 'zoneName');
  5152. // MOMENTS
  5153. function getZoneAbbr() {
  5154. return this._isUTC ? 'UTC' : '';
  5155. }
  5156. function getZoneName() {
  5157. return this._isUTC ? 'Coordinated Universal Time' : '';
  5158. }
  5159. var proto = Moment.prototype;
  5160. proto.add = add;
  5161. proto.calendar = calendar$1;
  5162. proto.clone = clone;
  5163. proto.diff = diff;
  5164. proto.endOf = endOf;
  5165. proto.format = format;
  5166. proto.from = from;
  5167. proto.fromNow = fromNow;
  5168. proto.to = to;
  5169. proto.toNow = toNow;
  5170. proto.get = stringGet;
  5171. proto.invalidAt = invalidAt;
  5172. proto.isAfter = isAfter;
  5173. proto.isBefore = isBefore;
  5174. proto.isBetween = isBetween;
  5175. proto.isSame = isSame;
  5176. proto.isSameOrAfter = isSameOrAfter;
  5177. proto.isSameOrBefore = isSameOrBefore;
  5178. proto.isValid = isValid$2;
  5179. proto.lang = lang;
  5180. proto.locale = locale;
  5181. proto.localeData = localeData;
  5182. proto.max = prototypeMax;
  5183. proto.min = prototypeMin;
  5184. proto.parsingFlags = parsingFlags;
  5185. proto.set = stringSet;
  5186. proto.startOf = startOf;
  5187. proto.subtract = subtract;
  5188. proto.toArray = toArray;
  5189. proto.toObject = toObject;
  5190. proto.toDate = toDate;
  5191. proto.toISOString = toISOString;
  5192. proto.inspect = inspect;
  5193. if (typeof Symbol !== 'undefined' && Symbol.for != null) {
  5194. proto[Symbol.for('nodejs.util.inspect.custom')] = function () {
  5195. return 'Moment<' + this.format() + '>';
  5196. };
  5197. }
  5198. proto.toJSON = toJSON;
  5199. proto.toString = toString;
  5200. proto.unix = unix;
  5201. proto.valueOf = valueOf;
  5202. proto.creationData = creationData;
  5203. proto.eraName = getEraName;
  5204. proto.eraNarrow = getEraNarrow;
  5205. proto.eraAbbr = getEraAbbr;
  5206. proto.eraYear = getEraYear;
  5207. proto.year = getSetYear;
  5208. proto.isLeapYear = getIsLeapYear;
  5209. proto.weekYear = getSetWeekYear;
  5210. proto.isoWeekYear = getSetISOWeekYear;
  5211. proto.quarter = proto.quarters = getSetQuarter;
  5212. proto.month = getSetMonth;
  5213. proto.daysInMonth = getDaysInMonth;
  5214. proto.week = proto.weeks = getSetWeek;
  5215. proto.isoWeek = proto.isoWeeks = getSetISOWeek;
  5216. proto.weeksInYear = getWeeksInYear;
  5217. proto.weeksInWeekYear = getWeeksInWeekYear;
  5218. proto.isoWeeksInYear = getISOWeeksInYear;
  5219. proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
  5220. proto.date = getSetDayOfMonth;
  5221. proto.day = proto.days = getSetDayOfWeek;
  5222. proto.weekday = getSetLocaleDayOfWeek;
  5223. proto.isoWeekday = getSetISODayOfWeek;
  5224. proto.dayOfYear = getSetDayOfYear;
  5225. proto.hour = proto.hours = getSetHour;
  5226. proto.minute = proto.minutes = getSetMinute;
  5227. proto.second = proto.seconds = getSetSecond;
  5228. proto.millisecond = proto.milliseconds = getSetMillisecond;
  5229. proto.utcOffset = getSetOffset;
  5230. proto.utc = setOffsetToUTC;
  5231. proto.local = setOffsetToLocal;
  5232. proto.parseZone = setOffsetToParsedOffset;
  5233. proto.hasAlignedHourOffset = hasAlignedHourOffset;
  5234. proto.isDST = isDaylightSavingTime;
  5235. proto.isLocal = isLocal;
  5236. proto.isUtcOffset = isUtcOffset;
  5237. proto.isUtc = isUtc;
  5238. proto.isUTC = isUtc;
  5239. proto.zoneAbbr = getZoneAbbr;
  5240. proto.zoneName = getZoneName;
  5241. proto.dates = deprecate(
  5242. 'dates accessor is deprecated. Use date instead.',
  5243. getSetDayOfMonth
  5244. );
  5245. proto.months = deprecate(
  5246. 'months accessor is deprecated. Use month instead',
  5247. getSetMonth
  5248. );
  5249. proto.years = deprecate(
  5250. 'years accessor is deprecated. Use year instead',
  5251. getSetYear
  5252. );
  5253. proto.zone = deprecate(
  5254. 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',
  5255. getSetZone
  5256. );
  5257. proto.isDSTShifted = deprecate(
  5258. 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',
  5259. isDaylightSavingTimeShifted
  5260. );
  5261. function createUnix(input) {
  5262. return createLocal(input * 1000);
  5263. }
  5264. function createInZone() {
  5265. return createLocal.apply(null, arguments).parseZone();
  5266. }
  5267. function preParsePostFormat(string) {
  5268. return string;
  5269. }
  5270. var proto$1 = Locale.prototype;
  5271. proto$1.calendar = calendar;
  5272. proto$1.longDateFormat = longDateFormat;
  5273. proto$1.invalidDate = invalidDate;
  5274. proto$1.ordinal = ordinal;
  5275. proto$1.preparse = preParsePostFormat;
  5276. proto$1.postformat = preParsePostFormat;
  5277. proto$1.relativeTime = relativeTime;
  5278. proto$1.pastFuture = pastFuture;
  5279. proto$1.set = set;
  5280. proto$1.eras = localeEras;
  5281. proto$1.erasParse = localeErasParse;
  5282. proto$1.erasConvertYear = localeErasConvertYear;
  5283. proto$1.erasAbbrRegex = erasAbbrRegex;
  5284. proto$1.erasNameRegex = erasNameRegex;
  5285. proto$1.erasNarrowRegex = erasNarrowRegex;
  5286. proto$1.months = localeMonths;
  5287. proto$1.monthsShort = localeMonthsShort;
  5288. proto$1.monthsParse = localeMonthsParse;
  5289. proto$1.monthsRegex = monthsRegex;
  5290. proto$1.monthsShortRegex = monthsShortRegex;
  5291. proto$1.week = localeWeek;
  5292. proto$1.firstDayOfYear = localeFirstDayOfYear;
  5293. proto$1.firstDayOfWeek = localeFirstDayOfWeek;
  5294. proto$1.weekdays = localeWeekdays;
  5295. proto$1.weekdaysMin = localeWeekdaysMin;
  5296. proto$1.weekdaysShort = localeWeekdaysShort;
  5297. proto$1.weekdaysParse = localeWeekdaysParse;
  5298. proto$1.weekdaysRegex = weekdaysRegex;
  5299. proto$1.weekdaysShortRegex = weekdaysShortRegex;
  5300. proto$1.weekdaysMinRegex = weekdaysMinRegex;
  5301. proto$1.isPM = localeIsPM;
  5302. proto$1.meridiem = localeMeridiem;
  5303. function get$1(format, index, field, setter) {
  5304. var locale = getLocale(),
  5305. utc = createUTC().set(setter, index);
  5306. return locale[field](utc, format);
  5307. }
  5308. function listMonthsImpl(format, index, field) {
  5309. if (isNumber(format)) {
  5310. index = format;
  5311. format = undefined;
  5312. }
  5313. format = format || '';
  5314. if (index != null) {
  5315. return get$1(format, index, field, 'month');
  5316. }
  5317. var i,
  5318. out = [];
  5319. for (i = 0; i < 12; i++) {
  5320. out[i] = get$1(format, i, field, 'month');
  5321. }
  5322. return out;
  5323. }
  5324. // ()
  5325. // (5)
  5326. // (fmt, 5)
  5327. // (fmt)
  5328. // (true)
  5329. // (true, 5)
  5330. // (true, fmt, 5)
  5331. // (true, fmt)
  5332. function listWeekdaysImpl(localeSorted, format, index, field) {
  5333. if (typeof localeSorted === 'boolean') {
  5334. if (isNumber(format)) {
  5335. index = format;
  5336. format = undefined;
  5337. }
  5338. format = format || '';
  5339. } else {
  5340. format = localeSorted;
  5341. index = format;
  5342. localeSorted = false;
  5343. if (isNumber(format)) {
  5344. index = format;
  5345. format = undefined;
  5346. }
  5347. format = format || '';
  5348. }
  5349. var locale = getLocale(),
  5350. shift = localeSorted ? locale._week.dow : 0,
  5351. i,
  5352. out = [];
  5353. if (index != null) {
  5354. return get$1(format, (index + shift) % 7, field, 'day');
  5355. }
  5356. for (i = 0; i < 7; i++) {
  5357. out[i] = get$1(format, (i + shift) % 7, field, 'day');
  5358. }
  5359. return out;
  5360. }
  5361. function listMonths(format, index) {
  5362. return listMonthsImpl(format, index, 'months');
  5363. }
  5364. function listMonthsShort(format, index) {
  5365. return listMonthsImpl(format, index, 'monthsShort');
  5366. }
  5367. function listWeekdays(localeSorted, format, index) {
  5368. return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
  5369. }
  5370. function listWeekdaysShort(localeSorted, format, index) {
  5371. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
  5372. }
  5373. function listWeekdaysMin(localeSorted, format, index) {
  5374. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
  5375. }
  5376. getSetGlobalLocale('en', {
  5377. eras: [
  5378. {
  5379. since: '0001-01-01',
  5380. until: +Infinity,
  5381. offset: 1,
  5382. name: 'Anno Domini',
  5383. narrow: 'AD',
  5384. abbr: 'AD',
  5385. },
  5386. {
  5387. since: '0000-12-31',
  5388. until: -Infinity,
  5389. offset: 1,
  5390. name: 'Before Christ',
  5391. narrow: 'BC',
  5392. abbr: 'BC',
  5393. },
  5394. ],
  5395. dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  5396. ordinal: function (number) {
  5397. var b = number % 10,
  5398. output =
  5399. toInt((number % 100) / 10) === 1
  5400. ? 'th'
  5401. : b === 1
  5402. ? 'st'
  5403. : b === 2
  5404. ? 'nd'
  5405. : b === 3
  5406. ? 'rd'
  5407. : 'th';
  5408. return number + output;
  5409. },
  5410. });
  5411. // Side effect imports
  5412. hooks.lang = deprecate(
  5413. 'moment.lang is deprecated. Use moment.locale instead.',
  5414. getSetGlobalLocale
  5415. );
  5416. hooks.langData = deprecate(
  5417. 'moment.langData is deprecated. Use moment.localeData instead.',
  5418. getLocale
  5419. );
  5420. var mathAbs = Math.abs;
  5421. function abs() {
  5422. var data = this._data;
  5423. this._milliseconds = mathAbs(this._milliseconds);
  5424. this._days = mathAbs(this._days);
  5425. this._months = mathAbs(this._months);
  5426. data.milliseconds = mathAbs(data.milliseconds);
  5427. data.seconds = mathAbs(data.seconds);
  5428. data.minutes = mathAbs(data.minutes);
  5429. data.hours = mathAbs(data.hours);
  5430. data.months = mathAbs(data.months);
  5431. data.years = mathAbs(data.years);
  5432. return this;
  5433. }
  5434. function addSubtract$1(duration, input, value, direction) {
  5435. var other = createDuration(input, value);
  5436. duration._milliseconds += direction * other._milliseconds;
  5437. duration._days += direction * other._days;
  5438. duration._months += direction * other._months;
  5439. return duration._bubble();
  5440. }
  5441. // supports only 2.0-style add(1, 's') or add(duration)
  5442. function add$1(input, value) {
  5443. return addSubtract$1(this, input, value, 1);
  5444. }
  5445. // supports only 2.0-style subtract(1, 's') or subtract(duration)
  5446. function subtract$1(input, value) {
  5447. return addSubtract$1(this, input, value, -1);
  5448. }
  5449. function absCeil(number) {
  5450. if (number < 0) {
  5451. return Math.floor(number);
  5452. } else {
  5453. return Math.ceil(number);
  5454. }
  5455. }
  5456. function bubble() {
  5457. var milliseconds = this._milliseconds,
  5458. days = this._days,
  5459. months = this._months,
  5460. data = this._data,
  5461. seconds,
  5462. minutes,
  5463. hours,
  5464. years,
  5465. monthsFromDays;
  5466. // if we have a mix of positive and negative values, bubble down first
  5467. // check: https://github.com/moment/moment/issues/2166
  5468. if (
  5469. !(
  5470. (milliseconds >= 0 && days >= 0 && months >= 0) ||
  5471. (milliseconds <= 0 && days <= 0 && months <= 0)
  5472. )
  5473. ) {
  5474. milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
  5475. days = 0;
  5476. months = 0;
  5477. }
  5478. // The following code bubbles up values, see the tests for
  5479. // examples of what that means.
  5480. data.milliseconds = milliseconds % 1000;
  5481. seconds = absFloor(milliseconds / 1000);
  5482. data.seconds = seconds % 60;
  5483. minutes = absFloor(seconds / 60);
  5484. data.minutes = minutes % 60;
  5485. hours = absFloor(minutes / 60);
  5486. data.hours = hours % 24;
  5487. days += absFloor(hours / 24);
  5488. // convert days to months
  5489. monthsFromDays = absFloor(daysToMonths(days));
  5490. months += monthsFromDays;
  5491. days -= absCeil(monthsToDays(monthsFromDays));
  5492. // 12 months -> 1 year
  5493. years = absFloor(months / 12);
  5494. months %= 12;
  5495. data.days = days;
  5496. data.months = months;
  5497. data.years = years;
  5498. return this;
  5499. }
  5500. function daysToMonths(days) {
  5501. // 400 years have 146097 days (taking into account leap year rules)
  5502. // 400 years have 12 months === 4800
  5503. return (days * 4800) / 146097;
  5504. }
  5505. function monthsToDays(months) {
  5506. // the reverse of daysToMonths
  5507. return (months * 146097) / 4800;
  5508. }
  5509. function as(units) {
  5510. if (!this.isValid()) {
  5511. return NaN;
  5512. }
  5513. var days,
  5514. months,
  5515. milliseconds = this._milliseconds;
  5516. units = normalizeUnits(units);
  5517. if (units === 'month' || units === 'quarter' || units === 'year') {
  5518. days = this._days + milliseconds / 864e5;
  5519. months = this._months + daysToMonths(days);
  5520. switch (units) {
  5521. case 'month':
  5522. return months;
  5523. case 'quarter':
  5524. return months / 3;
  5525. case 'year':
  5526. return months / 12;
  5527. }
  5528. } else {
  5529. // handle milliseconds separately because of floating point math errors (issue #1867)
  5530. days = this._days + Math.round(monthsToDays(this._months));
  5531. switch (units) {
  5532. case 'week':
  5533. return days / 7 + milliseconds / 6048e5;
  5534. case 'day':
  5535. return days + milliseconds / 864e5;
  5536. case 'hour':
  5537. return days * 24 + milliseconds / 36e5;
  5538. case 'minute':
  5539. return days * 1440 + milliseconds / 6e4;
  5540. case 'second':
  5541. return days * 86400 + milliseconds / 1000;
  5542. // Math.floor prevents floating point math errors here
  5543. case 'millisecond':
  5544. return Math.floor(days * 864e5) + milliseconds;
  5545. default:
  5546. throw new Error('Unknown unit ' + units);
  5547. }
  5548. }
  5549. }
  5550. // TODO: Use this.as('ms')?
  5551. function valueOf$1() {
  5552. if (!this.isValid()) {
  5553. return NaN;
  5554. }
  5555. return (
  5556. this._milliseconds +
  5557. this._days * 864e5 +
  5558. (this._months % 12) * 2592e6 +
  5559. toInt(this._months / 12) * 31536e6
  5560. );
  5561. }
  5562. function makeAs(alias) {
  5563. return function () {
  5564. return this.as(alias);
  5565. };
  5566. }
  5567. var asMilliseconds = makeAs('ms'),
  5568. asSeconds = makeAs('s'),
  5569. asMinutes = makeAs('m'),
  5570. asHours = makeAs('h'),
  5571. asDays = makeAs('d'),
  5572. asWeeks = makeAs('w'),
  5573. asMonths = makeAs('M'),
  5574. asQuarters = makeAs('Q'),
  5575. asYears = makeAs('y');
  5576. function clone$1() {
  5577. return createDuration(this);
  5578. }
  5579. function get$2(units) {
  5580. units = normalizeUnits(units);
  5581. return this.isValid() ? this[units + 's']() : NaN;
  5582. }
  5583. function makeGetter(name) {
  5584. return function () {
  5585. return this.isValid() ? this._data[name] : NaN;
  5586. };
  5587. }
  5588. var milliseconds = makeGetter('milliseconds'),
  5589. seconds = makeGetter('seconds'),
  5590. minutes = makeGetter('minutes'),
  5591. hours = makeGetter('hours'),
  5592. days = makeGetter('days'),
  5593. months = makeGetter('months'),
  5594. years = makeGetter('years');
  5595. function weeks() {
  5596. return absFloor(this.days() / 7);
  5597. }
  5598. var round = Math.round,
  5599. thresholds = {
  5600. ss: 44, // a few seconds to seconds
  5601. s: 45, // seconds to minute
  5602. m: 45, // minutes to hour
  5603. h: 22, // hours to day
  5604. d: 26, // days to month/week
  5605. w: null, // weeks to month
  5606. M: 11, // months to year
  5607. };
  5608. // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
  5609. function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
  5610. return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
  5611. }
  5612. function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {
  5613. var duration = createDuration(posNegDuration).abs(),
  5614. seconds = round(duration.as('s')),
  5615. minutes = round(duration.as('m')),
  5616. hours = round(duration.as('h')),
  5617. days = round(duration.as('d')),
  5618. months = round(duration.as('M')),
  5619. weeks = round(duration.as('w')),
  5620. years = round(duration.as('y')),
  5621. a =
  5622. (seconds <= thresholds.ss && ['s', seconds]) ||
  5623. (seconds < thresholds.s && ['ss', seconds]) ||
  5624. (minutes <= 1 && ['m']) ||
  5625. (minutes < thresholds.m && ['mm', minutes]) ||
  5626. (hours <= 1 && ['h']) ||
  5627. (hours < thresholds.h && ['hh', hours]) ||
  5628. (days <= 1 && ['d']) ||
  5629. (days < thresholds.d && ['dd', days]);
  5630. if (thresholds.w != null) {
  5631. a =
  5632. a ||
  5633. (weeks <= 1 && ['w']) ||
  5634. (weeks < thresholds.w && ['ww', weeks]);
  5635. }
  5636. a = a ||
  5637. (months <= 1 && ['M']) ||
  5638. (months < thresholds.M && ['MM', months]) ||
  5639. (years <= 1 && ['y']) || ['yy', years];
  5640. a[2] = withoutSuffix;
  5641. a[3] = +posNegDuration > 0;
  5642. a[4] = locale;
  5643. return substituteTimeAgo.apply(null, a);
  5644. }
  5645. // This function allows you to set the rounding function for relative time strings
  5646. function getSetRelativeTimeRounding(roundingFunction) {
  5647. if (roundingFunction === undefined) {
  5648. return round;
  5649. }
  5650. if (typeof roundingFunction === 'function') {
  5651. round = roundingFunction;
  5652. return true;
  5653. }
  5654. return false;
  5655. }
  5656. // This function allows you to set a threshold for relative time strings
  5657. function getSetRelativeTimeThreshold(threshold, limit) {
  5658. if (thresholds[threshold] === undefined) {
  5659. return false;
  5660. }
  5661. if (limit === undefined) {
  5662. return thresholds[threshold];
  5663. }
  5664. thresholds[threshold] = limit;
  5665. if (threshold === 's') {
  5666. thresholds.ss = limit - 1;
  5667. }
  5668. return true;
  5669. }
  5670. function humanize(argWithSuffix, argThresholds) {
  5671. if (!this.isValid()) {
  5672. return this.localeData().invalidDate();
  5673. }
  5674. var withSuffix = false,
  5675. th = thresholds,
  5676. locale,
  5677. output;
  5678. if (typeof argWithSuffix === 'object') {
  5679. argThresholds = argWithSuffix;
  5680. argWithSuffix = false;
  5681. }
  5682. if (typeof argWithSuffix === 'boolean') {
  5683. withSuffix = argWithSuffix;
  5684. }
  5685. if (typeof argThresholds === 'object') {
  5686. th = Object.assign({}, thresholds, argThresholds);
  5687. if (argThresholds.s != null && argThresholds.ss == null) {
  5688. th.ss = argThresholds.s - 1;
  5689. }
  5690. }
  5691. locale = this.localeData();
  5692. output = relativeTime$1(this, !withSuffix, th, locale);
  5693. if (withSuffix) {
  5694. output = locale.pastFuture(+this, output);
  5695. }
  5696. return locale.postformat(output);
  5697. }
  5698. var abs$1 = Math.abs;
  5699. function sign(x) {
  5700. return (x > 0) - (x < 0) || +x;
  5701. }
  5702. function toISOString$1() {
  5703. // for ISO strings we do not use the normal bubbling rules:
  5704. // * milliseconds bubble up until they become hours
  5705. // * days do not bubble at all
  5706. // * months bubble up until they become years
  5707. // This is because there is no context-free conversion between hours and days
  5708. // (think of clock changes)
  5709. // and also not between days and months (28-31 days per month)
  5710. if (!this.isValid()) {
  5711. return this.localeData().invalidDate();
  5712. }
  5713. var seconds = abs$1(this._milliseconds) / 1000,
  5714. days = abs$1(this._days),
  5715. months = abs$1(this._months),
  5716. minutes,
  5717. hours,
  5718. years,
  5719. s,
  5720. total = this.asSeconds(),
  5721. totalSign,
  5722. ymSign,
  5723. daysSign,
  5724. hmsSign;
  5725. if (!total) {
  5726. // this is the same as C#'s (Noda) and python (isodate)...
  5727. // but not other JS (goog.date)
  5728. return 'P0D';
  5729. }
  5730. // 3600 seconds -> 60 minutes -> 1 hour
  5731. minutes = absFloor(seconds / 60);
  5732. hours = absFloor(minutes / 60);
  5733. seconds %= 60;
  5734. minutes %= 60;
  5735. // 12 months -> 1 year
  5736. years = absFloor(months / 12);
  5737. months %= 12;
  5738. // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
  5739. s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
  5740. totalSign = total < 0 ? '-' : '';
  5741. ymSign = sign(this._months) !== sign(total) ? '-' : '';
  5742. daysSign = sign(this._days) !== sign(total) ? '-' : '';
  5743. hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
  5744. return (
  5745. totalSign +
  5746. 'P' +
  5747. (years ? ymSign + years + 'Y' : '') +
  5748. (months ? ymSign + months + 'M' : '') +
  5749. (days ? daysSign + days + 'D' : '') +
  5750. (hours || minutes || seconds ? 'T' : '') +
  5751. (hours ? hmsSign + hours + 'H' : '') +
  5752. (minutes ? hmsSign + minutes + 'M' : '') +
  5753. (seconds ? hmsSign + s + 'S' : '')
  5754. );
  5755. }
  5756. var proto$2 = Duration.prototype;
  5757. proto$2.isValid = isValid$1;
  5758. proto$2.abs = abs;
  5759. proto$2.add = add$1;
  5760. proto$2.subtract = subtract$1;
  5761. proto$2.as = as;
  5762. proto$2.asMilliseconds = asMilliseconds;
  5763. proto$2.asSeconds = asSeconds;
  5764. proto$2.asMinutes = asMinutes;
  5765. proto$2.asHours = asHours;
  5766. proto$2.asDays = asDays;
  5767. proto$2.asWeeks = asWeeks;
  5768. proto$2.asMonths = asMonths;
  5769. proto$2.asQuarters = asQuarters;
  5770. proto$2.asYears = asYears;
  5771. proto$2.valueOf = valueOf$1;
  5772. proto$2._bubble = bubble;
  5773. proto$2.clone = clone$1;
  5774. proto$2.get = get$2;
  5775. proto$2.milliseconds = milliseconds;
  5776. proto$2.seconds = seconds;
  5777. proto$2.minutes = minutes;
  5778. proto$2.hours = hours;
  5779. proto$2.days = days;
  5780. proto$2.weeks = weeks;
  5781. proto$2.months = months;
  5782. proto$2.years = years;
  5783. proto$2.humanize = humanize;
  5784. proto$2.toISOString = toISOString$1;
  5785. proto$2.toString = toISOString$1;
  5786. proto$2.toJSON = toISOString$1;
  5787. proto$2.locale = locale;
  5788. proto$2.localeData = localeData;
  5789. proto$2.toIsoString = deprecate(
  5790. 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',
  5791. toISOString$1
  5792. );
  5793. proto$2.lang = lang;
  5794. // FORMATTING
  5795. addFormatToken('X', 0, 0, 'unix');
  5796. addFormatToken('x', 0, 0, 'valueOf');
  5797. // PARSING
  5798. addRegexToken('x', matchSigned);
  5799. addRegexToken('X', matchTimestamp);
  5800. addParseToken('X', function (input, array, config) {
  5801. config._d = new Date(parseFloat(input) * 1000);
  5802. });
  5803. addParseToken('x', function (input, array, config) {
  5804. config._d = new Date(toInt(input));
  5805. });
  5806. //! moment.js
  5807. hooks.version = '2.29.1';
  5808. setHookCallback(createLocal);
  5809. hooks.fn = proto;
  5810. hooks.min = min;
  5811. hooks.max = max;
  5812. hooks.now = now;
  5813. hooks.utc = createUTC;
  5814. hooks.unix = createUnix;
  5815. hooks.months = listMonths;
  5816. hooks.isDate = isDate;
  5817. hooks.locale = getSetGlobalLocale;
  5818. hooks.invalid = createInvalid;
  5819. hooks.duration = createDuration;
  5820. hooks.isMoment = isMoment;
  5821. hooks.weekdays = listWeekdays;
  5822. hooks.parseZone = createInZone;
  5823. hooks.localeData = getLocale;
  5824. hooks.isDuration = isDuration;
  5825. hooks.monthsShort = listMonthsShort;
  5826. hooks.weekdaysMin = listWeekdaysMin;
  5827. hooks.defineLocale = defineLocale;
  5828. hooks.updateLocale = updateLocale;
  5829. hooks.locales = listLocales;
  5830. hooks.weekdaysShort = listWeekdaysShort;
  5831. hooks.normalizeUnits = normalizeUnits;
  5832. hooks.relativeTimeRounding = getSetRelativeTimeRounding;
  5833. hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
  5834. hooks.calendarFormat = getCalendarFormat;
  5835. hooks.prototype = proto;
  5836. // currently HTML5 input type only supports 24-hour formats
  5837. hooks.HTML5_FMT = {
  5838. DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
  5839. DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
  5840. DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
  5841. DATE: 'YYYY-MM-DD', // <input type="date" />
  5842. TIME: 'HH:mm', // <input type="time" />
  5843. TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
  5844. TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
  5845. WEEK: 'GGGG-[W]WW', // <input type="week" />
  5846. MONTH: 'YYYY-MM', // <input type="month" />
  5847. };
  5848. return hooks;
  5849. })));
  5850. define('moment', ['moment/moment'], function (main) { return main; });
  5851. define('frontend',['fast', 'template', 'moment'], function (Fast, Template, Moment) {
  5852. var Frontend = {
  5853. api: Fast.api,
  5854. init: function () {
  5855. var si = {};
  5856. //发送验证码
  5857. $(document).on("click", ".btn-captcha", function (e) {
  5858. var type = $(this).data("type") ? $(this).data("type") : 'mobile';
  5859. var btn = this;
  5860. Frontend.api.sendcaptcha = function (btn, type, data, callback) {
  5861. $(btn).addClass("disabled", true).text("发送中...");
  5862. Frontend.api.ajax({url: $(btn).data("url"), data: data}, function (data, ret) {
  5863. clearInterval(si[type]);
  5864. var seconds = 60;
  5865. si[type] = setInterval(function () {
  5866. seconds--;
  5867. if (seconds <= 0) {
  5868. clearInterval(si);
  5869. $(btn).removeClass("disabled").text("发送验证码");
  5870. } else {
  5871. $(btn).addClass("disabled").text(seconds + "秒后可再次发送");
  5872. }
  5873. }, 1000);
  5874. if (typeof callback == 'function') {
  5875. callback.call(this, data, ret);
  5876. }
  5877. }, function () {
  5878. $(btn).removeClass("disabled").text('发送验证码');
  5879. });
  5880. };
  5881. if (['mobile', 'email'].indexOf(type) > -1) {
  5882. var element = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : $("input[name='" + type + "']", $(this).closest("form"));
  5883. var text = type === 'email' ? '邮箱' : '手机号码';
  5884. if (element.val() === "") {
  5885. Layer.msg(text + "不能为空!");
  5886. element.focus();
  5887. return false;
  5888. } else if (type === 'mobile' && !element.val().match(/^1[3-9]\d{9}$/)) {
  5889. Layer.msg("请输入正确的" + text + "!");
  5890. element.focus();
  5891. return false;
  5892. } else if (type === 'email' && !element.val().match(/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/)) {
  5893. Layer.msg("请输入正确的" + text + "!");
  5894. element.focus();
  5895. return false;
  5896. }
  5897. element.isValid(function (v) {
  5898. if (v) {
  5899. var data = {event: $(btn).data("event")};
  5900. data[type] = element.val();
  5901. Frontend.api.sendcaptcha(btn, type, data);
  5902. } else {
  5903. Layer.msg("请确认已经输入了正确的" + text + "!");
  5904. }
  5905. });
  5906. } else {
  5907. var data = {event: $(btn).data("event")};
  5908. Frontend.api.sendcaptcha(btn, type, data, function (data, ret) {
  5909. 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});
  5910. });
  5911. }
  5912. return false;
  5913. });
  5914. //tooltip和popover
  5915. if (!('ontouchstart' in document.documentElement)) {
  5916. $('body').tooltip({selector: '[data-toggle="tooltip"]'});
  5917. }
  5918. $('body').popover({selector: '[data-toggle="popover"]'});
  5919. // 手机端左右滑动切换菜单栏
  5920. if ('ontouchstart' in document.documentElement) {
  5921. var startX, startY, moveEndX, moveEndY, relativeX, relativeY, element;
  5922. element = $('body', document);
  5923. element.on("touchstart", function (e) {
  5924. startX = e.originalEvent.changedTouches[0].pageX;
  5925. startY = e.originalEvent.changedTouches[0].pageY;
  5926. });
  5927. element.on("touchend", function (e) {
  5928. moveEndX = e.originalEvent.changedTouches[0].pageX;
  5929. moveEndY = e.originalEvent.changedTouches[0].pageY;
  5930. relativeX = moveEndX - startX;
  5931. relativeY = moveEndY - startY;
  5932. // 判断标准
  5933. //右滑
  5934. if (relativeX > 45) {
  5935. if ((Math.abs(relativeX) - Math.abs(relativeY)) > 50) {
  5936. element.addClass("sidebar-open");
  5937. }
  5938. }
  5939. //左滑
  5940. else if (relativeX < -45) {
  5941. if ((Math.abs(relativeX) - Math.abs(relativeY)) > 50) {
  5942. element.removeClass("sidebar-open");
  5943. }
  5944. }
  5945. });
  5946. }
  5947. $(document).on("click", ".sidebar-toggle", function () {
  5948. $("body").toggleClass("sidebar-open");
  5949. });
  5950. }
  5951. };
  5952. Frontend.api = $.extend(Fast.api, Frontend.api);
  5953. //将Template渲染至全局,以便于在子框架中调用
  5954. window.Template = Template;
  5955. //将Moment渲染至全局,以便于在子框架中调用
  5956. window.Moment = Moment;
  5957. //将Frontend渲染至全局,以便于在子框架中调用
  5958. window.Frontend = Frontend;
  5959. Frontend.init();
  5960. return Frontend;
  5961. });
  5962. define('frontend-init',['frontend'], function (Frontend) {
  5963. });
  5964. //! moment.js locale configuration
  5965. //! locale : Chinese (China) [zh-cn]
  5966. //! author : suupic : https://github.com/suupic
  5967. //! author : Zeno Zeng : https://github.com/zenozeng
  5968. //! author : uu109 : https://github.com/uu109
  5969. ;(function (global, factory) {
  5970. typeof exports === 'object' && typeof module !== 'undefined'
  5971. && typeof require === 'function' ? factory(require('../moment')) :
  5972. typeof define === 'function' && define.amd ? define('moment/locale/zh-cn',['../moment'], factory) :
  5973. factory(global.moment)
  5974. }(this, (function (moment) { 'use strict';
  5975. //! moment.js locale configuration
  5976. var zhCn = moment.defineLocale('zh-cn', {
  5977. months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split(
  5978. '_'
  5979. ),
  5980. monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
  5981. '_'
  5982. ),
  5983. weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  5984. weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  5985. weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
  5986. longDateFormat: {
  5987. LT: 'HH:mm',
  5988. LTS: 'HH:mm:ss',
  5989. L: 'YYYY/MM/DD',
  5990. LL: 'YYYY年M月D日',
  5991. LLL: 'YYYY年M月D日Ah点mm分',
  5992. LLLL: 'YYYY年M月D日ddddAh点mm分',
  5993. l: 'YYYY/M/D',
  5994. ll: 'YYYY年M月D日',
  5995. lll: 'YYYY年M月D日 HH:mm',
  5996. llll: 'YYYY年M月D日dddd HH:mm',
  5997. },
  5998. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  5999. meridiemHour: function (hour, meridiem) {
  6000. if (hour === 12) {
  6001. hour = 0;
  6002. }
  6003. if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
  6004. return hour;
  6005. } else if (meridiem === '下午' || meridiem === '晚上') {
  6006. return hour + 12;
  6007. } else {
  6008. // '中午'
  6009. return hour >= 11 ? hour : hour + 12;
  6010. }
  6011. },
  6012. meridiem: function (hour, minute, isLower) {
  6013. var hm = hour * 100 + minute;
  6014. if (hm < 600) {
  6015. return '凌晨';
  6016. } else if (hm < 900) {
  6017. return '早上';
  6018. } else if (hm < 1130) {
  6019. return '上午';
  6020. } else if (hm < 1230) {
  6021. return '中午';
  6022. } else if (hm < 1800) {
  6023. return '下午';
  6024. } else {
  6025. return '晚上';
  6026. }
  6027. },
  6028. calendar: {
  6029. sameDay: '[今天]LT',
  6030. nextDay: '[明天]LT',
  6031. nextWeek: function (now) {
  6032. if (now.week() !== this.week()) {
  6033. return '[下]dddLT';
  6034. } else {
  6035. return '[本]dddLT';
  6036. }
  6037. },
  6038. lastDay: '[昨天]LT',
  6039. lastWeek: function (now) {
  6040. if (this.week() !== now.week()) {
  6041. return '[上]dddLT';
  6042. } else {
  6043. return '[本]dddLT';
  6044. }
  6045. },
  6046. sameElse: 'L',
  6047. },
  6048. dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
  6049. ordinal: function (number, period) {
  6050. switch (period) {
  6051. case 'd':
  6052. case 'D':
  6053. case 'DDD':
  6054. return number + '日';
  6055. case 'M':
  6056. return number + '月';
  6057. case 'w':
  6058. case 'W':
  6059. return number + '周';
  6060. default:
  6061. return number;
  6062. }
  6063. },
  6064. relativeTime: {
  6065. future: '%s后',
  6066. past: '%s前',
  6067. s: '几秒',
  6068. ss: '%d 秒',
  6069. m: '1 分钟',
  6070. mm: '%d 分钟',
  6071. h: '1 小时',
  6072. hh: '%d 小时',
  6073. d: '1 天',
  6074. dd: '%d 天',
  6075. w: '1 周',
  6076. ww: '%d 周',
  6077. M: '1 个月',
  6078. MM: '%d 个月',
  6079. y: '1 年',
  6080. yy: '%d 年',
  6081. },
  6082. week: {
  6083. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  6084. dow: 1, // Monday is the first day of the week.
  6085. doy: 4, // The week that contains Jan 4th is the first week of the year.
  6086. },
  6087. });
  6088. return zhCn;
  6089. })));
  6090. (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);
  6091. define("bootstrap-table", ["bootstrap"], (function (global) {
  6092. return function () {
  6093. var ret, fn;
  6094. return ret || global.$.fn.bootstrapTable;
  6095. };
  6096. }(this)));
  6097. /**
  6098. * Bootstrap Table Chinese translation
  6099. * Author: Zhixin Wen<wenzhixin2010@gmail.com>
  6100. */
  6101. (function ($) {
  6102. 'use strict';
  6103. $.fn.bootstrapTable.locales['zh-CN'] = {
  6104. formatLoadingMessage: function () {
  6105. return '正在努力地加载数据中,请稍候……';
  6106. },
  6107. formatRecordsPerPage: function (pageNumber) {
  6108. return '每页显示 ' + pageNumber + ' 条记录';
  6109. },
  6110. formatShowingRows: function (pageFrom, pageTo, totalRows) {
  6111. return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
  6112. },
  6113. formatSearch: function () {
  6114. return '搜索';
  6115. },
  6116. formatNoMatches: function () {
  6117. return '没有找到匹配的记录';
  6118. },
  6119. formatPaginationSwitch: function () {
  6120. return '隐藏/显示分页';
  6121. },
  6122. formatRefresh: function () {
  6123. return '刷新';
  6124. },
  6125. formatToggle: function () {
  6126. return '切换';
  6127. },
  6128. formatColumns: function () {
  6129. return '列';
  6130. },
  6131. formatExport: function () {
  6132. return '导出数据';
  6133. },
  6134. formatClearFilters: function () {
  6135. return '清空过滤';
  6136. }
  6137. };
  6138. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
  6139. })(jQuery);
  6140. define("bootstrap-table-lang", ["bootstrap-table"], (function (global) {
  6141. return function () {
  6142. var ret, fn;
  6143. return ret || global.$.fn.bootstrapTable.defaults;
  6144. };
  6145. }(this)));
  6146. /*
  6147. tableExport.jquery.plugin
  6148. Version 1.10.22
  6149. Copyright (c) 2015-2021 hhurz, https://github.com/hhurz/tableExport.jquery.plugin
  6150. Based on https://github.com/kayalshri/tableExport.jquery.plugin
  6151. Licensed under the MIT License
  6152. */
  6153. 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)};
  6154. $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})}};
  6155. $jscomp.polyfill("Array.prototype.find",function(d){return d?d:function(d,y){return $jscomp.findInternal(this,d,y).v}},"es6","es3");
  6156. (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})}
  6157. 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&&
  6158. "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&&
  6159. "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&&
  6160. (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&&
  6161. 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+=
  6162. 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,
  6163. 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,
  6164. 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&&
  6165. (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]);
  6166. (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")&&
  6167. (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)+
  6168. 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=
  6169. 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)}}
  6170. 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;
  6171. 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";
  6172. 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+=
  6173. 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&&""!==
  6174. 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,
  6175. "")});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:
  6176. "")+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))&&
  6177. (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=
  6178. 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=
  6179. 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,
  6180. 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/
  6181. 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,
  6182. "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();
  6183. 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,")?
  6184. 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"===
  6185. 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)+
  6186. "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",
  6187. 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",
  6188. 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",
  6189. 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,
  6190. 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,
  6191. 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&&
  6192. (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&&
  6193. "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+=
  6194. "\\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,
  6195. 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++});
  6196. 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"),
  6197. "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=
  6198. "";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,
  6199. 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=
  6200. 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;
  6201. 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=
  6202. 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'+
  6203. 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);
  6204. 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>'+
  6205. (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';
  6206. 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"===
  6207. 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,
  6208. 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&&
  6209. (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:"")+'")'});
  6210. 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:
  6211. 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+
  6212. 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:'+
  6213. 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,
  6214. 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+
  6215. 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)"!==
  6216. 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" '+
  6217. 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+=
  6218. "</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;}";
  6219. 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),
  6220. 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,
  6221. d,f){if("undefined"!==typeof c&&null!==c){var e=J(c),h=T(c);c={text:D(c,d,f)||" "};if(1<e||1<h)c.colSpan=e||1,c.rowSpan=h||1}else c={text:" "};0<=b.indexOf("th")&&(c.style="header");a.push(c)});for(var d=a.length;d<c;d++)a.push("");a.length&&e.push(a);f<a.length&&(f=a.length);p++});return f};r=y(b);for(var f=g(r,"th,td",r.length),h=c.length;h<f;h++)c.push("*");w=C(b);f=g(w,"td",r.length+w.length);for(h=c.length;h<f;h++)c.push("*");U.content.push({table:{headerRows:r.length?r.length:null,widths:c,
  6222. body:e},layout:{layout:"noBorders",hLineStyle:function(a,b){return 0},vLineWidth:function(a,b){return 0},hLineColor:function(b,c){return b<c.table.headerRows?a.pdfmake.docDefinition.styles.header.background:a.pdfmake.docDefinition.styles.alternateRow.fillColor},vLineColor:function(b,c){return b<c.table.headerRows?a.pdfmake.docDefinition.styles.header.background:a.pdfmake.docDefinition.styles.alternateRow.fillColor},fillColor:function(b,c,d){return 0===b%2?a.pdfmake.docDefinition.styles.alternateRow.fillColor:
  6223. null}},pageBreak:U.content.length?"before":void 0})});"undefined"!==typeof pdfMake&&"undefined"!==typeof pdfMake.createPdf&&(pdfMake.fonts={Roboto:{normal:"Roboto-Regular.ttf",bold:"Roboto-Medium.ttf",italics:"Roboto-Italic.ttf",bolditalics:"Roboto-MediumItalic.ttf"}},pdfMake.vfs.hasOwnProperty("Mirza-Regular.ttf")?(U.defaultStyle.font="Mirza",d.extend(!0,pdfMake.fonts,{Mirza:{normal:"Mirza-Regular.ttf",bold:"Mirza-Bold.ttf",italics:"Mirza-Medium.ttf",bolditalics:"Mirza-SemiBold.ttf"}})):pdfMake.vfs.hasOwnProperty("gbsn00lp.ttf")?
  6224. (U.defaultStyle.font="gbsn00lp",d.extend(!0,pdfMake.fonts,{gbsn00lp:{normal:"gbsn00lp.ttf",bold:"gbsn00lp.ttf",italics:"gbsn00lp.ttf",bolditalics:"gbsn00lp.ttf"}})):pdfMake.vfs.hasOwnProperty("ZCOOLXiaoWei-Regular.ttf")&&(U.defaultStyle.font="ZCOOLXiaoWei",d.extend(!0,pdfMake.fonts,{ZCOOLXiaoWei:{normal:"ZCOOLXiaoWei-Regular.ttf",bold:"ZCOOLXiaoWei-Regular.ttf",italics:"ZCOOLXiaoWei-Regular.ttf",bolditalics:"ZCOOLXiaoWei-Regular.ttf"}})),d.extend(!0,pdfMake.fonts,a.pdfmake.fonts),pdfMake.createPdf(U).getBuffer(function(b){N(b,
  6225. 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=
  6226. 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=
  6227. 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&&
  6228. !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&&
  6229. (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*
  6230. 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))}});
  6231. "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&&
  6232. (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&&
  6233. !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=
  6234. 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,
  6235. 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),
  6236. 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();
  6237. return this}})(jQuery);
  6238. define("tableexport", ["jquery"], (function (global) {
  6239. return function () {
  6240. var ret, fn;
  6241. return ret || global.$.fn.extend;
  6242. };
  6243. }(this)));
  6244. !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);
  6245. define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (global) {
  6246. return function () {
  6247. var ret, fn;
  6248. return ret || global.$.fn.bootstrapTable.defaults;
  6249. };
  6250. }(this)));
  6251. (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});
  6252. define('upload',['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined, Dropzone, Template) {
  6253. var Upload = {
  6254. list: {},
  6255. options: {},
  6256. config: {
  6257. container: document.body,
  6258. classname: '.plupload:not([initialized]),.faupload:not([initialized])',
  6259. 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>',
  6260. },
  6261. events: {
  6262. //初始化
  6263. onInit: function () {
  6264. },
  6265. //上传成功的回调
  6266. onUploadSuccess: function (up, ret, file) {
  6267. var button = up.element;
  6268. var onUploadSuccess = up.options.onUploadSuccess;
  6269. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  6270. //上传成功后回调
  6271. if (button) {
  6272. //如果有文本框则填充
  6273. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  6274. if (input_id) {
  6275. var urlArr = [];
  6276. var inputObj = $("#" + input_id);
  6277. if ($(button).data("multiple") && inputObj.val() !== "") {
  6278. urlArr.push(inputObj.val());
  6279. }
  6280. urlArr.push(data.url);
  6281. inputObj.val(urlArr.join(",")).trigger("change").trigger("validate");
  6282. }
  6283. //如果有回调函数
  6284. var onDomUploadSuccess = $(button).data("upload-success");
  6285. if (onDomUploadSuccess) {
  6286. if (typeof onDomUploadSuccess !== 'function' && typeof Upload.api.custom[onDomUploadSuccess] === 'function') {
  6287. onDomUploadSuccess = Upload.api.custom[onDomUploadSuccess];
  6288. }
  6289. if (typeof onDomUploadSuccess === 'function') {
  6290. var result = onDomUploadSuccess.call(button, data, ret);
  6291. if (result === false)
  6292. return;
  6293. }
  6294. }
  6295. }
  6296. if (typeof onUploadSuccess === 'function') {
  6297. var result = onUploadSuccess.call(button, data, ret);
  6298. if (result === false)
  6299. return;
  6300. }
  6301. },
  6302. //上传错误的回调
  6303. onUploadError: function (up, ret, file) {
  6304. var button = up.element;
  6305. var onUploadError = up.options.onUploadError;
  6306. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  6307. if (button) {
  6308. var onDomUploadError = $(button).data("upload-error");
  6309. if (onDomUploadError) {
  6310. if (typeof onDomUploadError !== 'function' && typeof Upload.api.custom[onDomUploadError] === 'function') {
  6311. onDomUploadError = Upload.api.custom[onDomUploadError];
  6312. }
  6313. if (typeof onDomUploadError === 'function') {
  6314. var result = onDomUploadError.call(button, data, ret);
  6315. if (result === false)
  6316. return;
  6317. }
  6318. }
  6319. }
  6320. if (typeof onUploadError === 'function') {
  6321. var result = onUploadError.call(button, data, ret);
  6322. if (result === false) {
  6323. return;
  6324. }
  6325. }
  6326. Toastr.error(ret.msg.toString().replace(/(<([^>]+)>)/gi, "") + "(code:" + ret.code + ")");
  6327. },
  6328. //服务器响应数据后
  6329. onUploadResponse: function (response, up, file) {
  6330. try {
  6331. var ret = typeof response === 'object' ? response : JSON.parse(response);
  6332. if (!ret.hasOwnProperty('code')) {
  6333. $.extend(ret, {code: -2, msg: response, data: null});
  6334. }
  6335. } catch (e) {
  6336. var ret = {code: -1, msg: e.message, data: null};
  6337. }
  6338. return ret;
  6339. },
  6340. //上传全部结束后
  6341. onUploadComplete: function (up, files) {
  6342. var button = up.element;
  6343. var onUploadComplete = up.options.onUploadComplete;
  6344. if (button) {
  6345. var onDomUploadComplete = $(button).data("upload-complete");
  6346. if (onDomUploadComplete) {
  6347. if (typeof onDomUploadComplete !== 'function' && typeof Upload.api.custom[onDomUploadComplete] === 'function') {
  6348. onDomUploadComplete = Upload.api.custom[onDomUploadComplete];
  6349. }
  6350. if (typeof onDomUploadComplete === 'function') {
  6351. var result = onDomUploadComplete.call(button, files);
  6352. if (result === false)
  6353. return;
  6354. }
  6355. }
  6356. }
  6357. if (typeof onUploadComplete === 'function') {
  6358. var result = onUploadComplete.call(button, files);
  6359. if (result === false) {
  6360. return;
  6361. }
  6362. }
  6363. }
  6364. },
  6365. api: {
  6366. //上传接口
  6367. upload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6368. element = typeof element === 'undefined' ? Upload.config.classname : element;
  6369. $(element, Upload.config.container).each(function () {
  6370. if ($(this).attr("initialized")) {
  6371. return true;
  6372. }
  6373. $(this).attr("initialized", true);
  6374. var that = this;
  6375. var id = $(this).prop("id") || $(this).prop("name") || Dropzone.uuidv4();
  6376. var url = $(this).data("url");
  6377. var maxsize = $(this).data("maxsize");
  6378. var maxcount = $(this).data("maxcount");
  6379. var mimetype = $(this).data("mimetype");
  6380. var multipart = $(this).data("multipart");
  6381. var multiple = $(this).data("multiple");
  6382. //填充ID
  6383. var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
  6384. //预览ID
  6385. var preview_id = $(that).data("preview-id") ? $(that).data("preview-id") : "";
  6386. //上传URL
  6387. url = url ? url : Config.upload.uploadurl;
  6388. url = Fast.api.fixurl(url);
  6389. var chunking = false, chunkSize = Config.upload.chunksize || 2097152, timeout = Config.upload.timeout || 600000;
  6390. //最大可上传文件大小
  6391. maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize;
  6392. //文件类型
  6393. mimetype = typeof mimetype !== "undefined" ? mimetype : Config.upload.mimetype;
  6394. //请求的表单参数
  6395. multipart = typeof multipart !== "undefined" ? multipart : Config.upload.multipart;
  6396. //是否支持批量上传
  6397. multiple = typeof multiple !== "undefined" ? multiple : Config.upload.multiple;
  6398. //后缀特殊处理
  6399. mimetype = mimetype.split(",").map(function (k) {
  6400. return k.indexOf("/") > -1 ? k : (!k || k === "*" || k.charAt(0) === "." ? k : "." + k);
  6401. }).join(",");
  6402. mimetype = mimetype === '*' ? null : mimetype;
  6403. //最大文件限制转换成mb
  6404. var maxFilesize = (function (maxsize) {
  6405. var matches = maxsize.toString().match(/^([0-9\.]+)(\w+)$/);
  6406. var size = matches ? parseFloat(matches[1]) : parseFloat(maxsize),
  6407. unit = matches ? matches[2].toLowerCase() : 'b';
  6408. var unitDict = {'b': 0, 'k': 1, 'kb': 1, 'm': 2, 'mb': 2, 'gb': 3, 'g': 3, 'tb': 4, 't': 4};
  6409. var y = typeof unitDict[unit] !== 'undefined' ? unitDict[unit] : 0;
  6410. var bytes = size * Math.pow(1024, y);
  6411. return bytes / Math.pow(1024, 2);
  6412. }(maxsize));
  6413. var options = $(this).data() || {};
  6414. delete options.success;
  6415. delete options.url;
  6416. multipart = $.isArray(multipart) ? {} : multipart;
  6417. Upload.list[id] = new Dropzone(this, $.extend({
  6418. url: url,
  6419. params: function (files, xhr, chunk) {
  6420. var params = multipart;
  6421. if (chunk) {
  6422. return $.extend({}, params, {
  6423. filesize: chunk.file.size,
  6424. filename: chunk.file.name,
  6425. chunkid: chunk.file.upload.uuid,
  6426. chunkindex: chunk.index,
  6427. chunkcount: chunk.file.upload.totalChunkCount,
  6428. chunksize: this.options.chunkSize,
  6429. chunkfilesize: chunk.dataBlock.data.size,
  6430. width: chunk.file.width || 0,
  6431. height: chunk.file.height || 0,
  6432. type: chunk.file.type,
  6433. });
  6434. }
  6435. return params;
  6436. },
  6437. chunking: chunking,
  6438. chunkSize: chunkSize,
  6439. maxFilesize: maxFilesize,
  6440. acceptedFiles: mimetype,
  6441. maxFiles: (maxcount && parseInt(maxcount) > 1 ? maxcount : (multiple ? null : 1)),
  6442. timeout: timeout,
  6443. parallelUploads: 1,
  6444. previewsContainer: false,
  6445. dictDefaultMessage: __("Drop files here to upload"),
  6446. dictFallbackMessage: __("Your browser does not support drag'n'drop file uploads"),
  6447. dictFallbackText: __("Please use the fallback form below to upload your files like in the olden days"),
  6448. dictFileTooBig: __("File is too big (%sMiB), Max filesize: %sMiB", "{{filesize}}", "{{maxFilesize}}"),
  6449. dictInvalidFileType: __("You can't upload files of this type"),
  6450. dictResponseError: __("Server responded with %s code.", "{{statusCode}}"),
  6451. dictCancelUpload: __("Cancel upload"),
  6452. dictUploadCanceled: __("Upload canceled"),
  6453. dictCancelUploadConfirmation: __("Are you sure you want to cancel this upload?"),
  6454. dictRemoveFile: __("Remove file"),
  6455. dictMaxFilesExceeded: __("You can only upload a maximum of %s files", "{{maxFiles}}"),
  6456. init: function () {
  6457. Upload.events.onInit.call(this);
  6458. //必须添加dz-message,否则点击icon无法唤起上传窗口
  6459. $(">i", this.element).addClass("dz-message");
  6460. this.options.elementHtml = $(this.element).html();
  6461. },
  6462. addedfiles: function (files) {
  6463. if (this.options.maxFiles && (!this.options.maxFiles || this.options.maxFiles > 1) && this.options.inputId) {
  6464. var inputObj = $("#" + this.options.inputId);
  6465. if (inputObj.size() > 0) {
  6466. var value = $.trim(inputObj.val());
  6467. var nums = value === '' ? 0 : value.split(/\,/).length;
  6468. var remain = this.options.maxFiles - nums;
  6469. if (remain === 0 || files.length > remain) {
  6470. files = Array.prototype.slice.call(files, remain);
  6471. for (var i = 0; i < files.length; i++) {
  6472. this.removeFile(files[i]);
  6473. }
  6474. Toastr.error(__("You can only upload a maximum of %s files", this.options.maxFiles));
  6475. }
  6476. }
  6477. }
  6478. },
  6479. success: function (file, response) {
  6480. var ret = Upload.events.onUploadResponse(response, this, file);
  6481. file.ret = ret;
  6482. if (ret.code === 1) {
  6483. Upload.events.onUploadSuccess(this, ret, file);
  6484. } else {
  6485. Upload.events.onUploadError(this, ret, file);
  6486. }
  6487. },
  6488. error: function (file, response, xhr) {
  6489. var responseObj = $("<div>" + (xhr && typeof xhr.responseText !== 'undefined' ? xhr.responseText : response) + "</div>");
  6490. responseObj.find("style, title, script").remove();
  6491. var ret = {code: 0, data: null, msg: responseObj.text()};
  6492. Upload.events.onUploadError(this, ret, file);
  6493. },
  6494. uploadprogress: function (file, progress, bytesSent) {
  6495. if (file.upload.chunked) {
  6496. $(this.element).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + Math.floor((file.upload.bytesSent / file.size) * 100) + "%");
  6497. }
  6498. },
  6499. totaluploadprogress: function (progress, bytesSent) {
  6500. if (this.getActiveFiles().length > 0 && !this.options.chunking) {
  6501. $(this.element).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + Math.floor(progress) + "%");
  6502. }
  6503. },
  6504. queuecomplete: function () {
  6505. Upload.events.onUploadComplete(this, this.files);
  6506. this.removeAllFiles(true);
  6507. $(this.element).prop("disabled", false).html(this.options.elementHtml);
  6508. },
  6509. chunkSuccess: function (chunk, file, response) {
  6510. },
  6511. chunksUploaded: function (file, done) {
  6512. var that = this;
  6513. Fast.api.ajax({
  6514. url: this.options.url,
  6515. data: $.extend({}, multipart, {
  6516. action: 'merge',
  6517. filesize: file.size,
  6518. filename: file.name,
  6519. chunkid: file.upload.uuid,
  6520. chunkcount: file.upload.totalChunkCount,
  6521. })
  6522. }, function (data, ret) {
  6523. done(JSON.stringify(ret));
  6524. return false;
  6525. }, function (data, ret) {
  6526. file.accepted = false;
  6527. that._errorProcessing([file], ret.msg);
  6528. });
  6529. },
  6530. onUploadSuccess: onUploadSuccess,
  6531. onUploadError: onUploadError,
  6532. onUploadComplete: onUploadComplete,
  6533. }, Upload.options, options));
  6534. //拖动排序
  6535. if (preview_id && multiple) {
  6536. require(['dragsort'], function () {
  6537. $("#" + preview_id).dragsort({
  6538. dragSelector: "li a:not(.btn-trash)",
  6539. dragEnd: function () {
  6540. $("#" + preview_id).trigger("fa.preview.change");
  6541. },
  6542. placeHolderTemplate: '<li class="col-xs-3"></li>'
  6543. });
  6544. });
  6545. }
  6546. //刷新隐藏textarea的值
  6547. var refresh = function (name) {
  6548. var data = {};
  6549. var textarea = $("textarea[name='" + name + "']");
  6550. var container = textarea.prev("ul");
  6551. $.each($("input,select,textarea", container).serializeArray(), function (i, j) {
  6552. var reg = /\[?(\w+)\]?\[(\w+)\]$/g;
  6553. var match = reg.exec(j.name);
  6554. if (!match)
  6555. return true;
  6556. if (!isNaN(match[2])) {
  6557. data[i] = j.value;
  6558. } else {
  6559. match[1] = "x" + parseInt(match[1]);
  6560. if (typeof data[match[1]] === 'undefined') {
  6561. data[match[1]] = {};
  6562. }
  6563. data[match[1]][match[2]] = j.value;
  6564. }
  6565. });
  6566. var result = [];
  6567. $.each(data, function (i, j) {
  6568. result.push(j);
  6569. });
  6570. textarea.val(JSON.stringify(result));
  6571. };
  6572. if (preview_id && input_id) {
  6573. $(document.body).on("keyup change", "#" + input_id, function (e) {
  6574. var inputStr = $("#" + input_id).val();
  6575. var inputArr = inputStr.split(/\,/);
  6576. $("#" + preview_id).empty();
  6577. var tpl = $("#" + preview_id).data("template") ? $("#" + preview_id).data("template") : "";
  6578. var extend = $("#" + preview_id).next().is("textarea") ? $("#" + preview_id).next("textarea").val() : "{}";
  6579. var json = {};
  6580. try {
  6581. json = JSON.parse(extend);
  6582. } catch (e) {
  6583. }
  6584. $.each(inputArr, function (i, j) {
  6585. if (!j) {
  6586. return true;
  6587. }
  6588. var suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(j);
  6589. suffix = suffix ? suffix[1] : 'file';
  6590. var value = (json && typeof json[i] !== 'undefined' ? json[i] : null);
  6591. var data = {url: j, fullurl: Fast.api.cdnurl(j), data: $(that).data(), key: i, index: i, value: value, row: value, suffix: suffix};
  6592. var html = tpl ? Template(tpl, data) : Template.render(Upload.config.previewtpl, data);
  6593. $("#" + preview_id).append(html);
  6594. });
  6595. refresh($("#" + preview_id).data("name"));
  6596. });
  6597. $("#" + input_id).trigger("change");
  6598. }
  6599. if (preview_id) {
  6600. //监听文本框改变事件
  6601. $("#" + preview_id).on('change keyup', "input,textarea,select", function () {
  6602. refresh($(this).closest("ul").data("name"));
  6603. });
  6604. // 监听事件
  6605. $(document.body).on("fa.preview.change", "#" + preview_id, function () {
  6606. var urlArr = [];
  6607. $("#" + preview_id + " [data-url]").each(function (i, j) {
  6608. urlArr.push($(this).data("url"));
  6609. });
  6610. if (input_id) {
  6611. $("#" + input_id).val(urlArr.join(","));
  6612. }
  6613. refresh($("#" + preview_id).data("name"));
  6614. });
  6615. // 移除按钮事件
  6616. $(document.body).on("click", "#" + preview_id + " .btn-trash", function () {
  6617. $(this).closest("li").remove();
  6618. $("#" + preview_id).trigger("fa.preview.change");
  6619. });
  6620. }
  6621. if (input_id) {
  6622. //粘贴上传、拖拽上传
  6623. $("body").on('paste drop', "#" + input_id, function (event) {
  6624. var originEvent = event.originalEvent;
  6625. var button = $(".plupload[data-input-id='" + $(this).attr("id") + "'],.faupload[data-input-id='" + $(this).attr("id") + "']");
  6626. if (event.type === 'paste' && originEvent.clipboardData && originEvent.clipboardData.items) {
  6627. var items = originEvent.clipboardData.items;
  6628. if ((items.length === 1 && items[0].type.indexOf("text") > -1) || (items.length === 2 && items[1].type.indexOf("text") > -1)) {
  6629. } else {
  6630. Upload.list[button.attr("id")].paste(originEvent);
  6631. return false;
  6632. }
  6633. }
  6634. if (event.type === 'drop' && originEvent.dataTransfer && originEvent.dataTransfer.files) {
  6635. Upload.list[button.attr("id")].drop(originEvent);
  6636. return false;
  6637. }
  6638. });
  6639. }
  6640. });
  6641. },
  6642. /**
  6643. * @deprecated Use upload instead.
  6644. */
  6645. plupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6646. return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete);
  6647. },
  6648. /**
  6649. * @deprecated Use upload instead.
  6650. */
  6651. faupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  6652. return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete);
  6653. },
  6654. // AJAX异步上传
  6655. send: function (file, onUploadSuccess, onUploadError, onUploadComplete) {
  6656. var index = Layer.msg(__('Uploading'), {offset: 't', time: 0});
  6657. var id = "dropzone-" + Dropzone.uuidv4();
  6658. $('<button type="button" id="' + id + '" class="btn btn-danger hidden faupload" />').appendTo("body");
  6659. $("#" + id).data("upload-complete", function (files) {
  6660. Layer.close(index);
  6661. Upload.list[id].removeAllFiles(true);
  6662. });
  6663. Upload.api.upload("#" + id, onUploadSuccess, onUploadError, onUploadComplete);
  6664. setTimeout(function () {
  6665. Upload.list[id].addFile(file);
  6666. }, 1);
  6667. },
  6668. custom: {
  6669. //自定义上传完成回调
  6670. afteruploadcallback: function (response) {
  6671. console.log(this, response);
  6672. alert("Custom Callback,Response URL:" + response.url);
  6673. },
  6674. }
  6675. }
  6676. }
  6677. ;
  6678. return Upload;
  6679. });
  6680. /*! nice-validator 1.1.5
  6681. * (c) 2012-2020 Jony Zhang <niceue@live.com>, MIT Licensed
  6682. * https://github.com/niceue/nice-validator
  6683. */
  6684. ;(function(factory) {
  6685. typeof module === 'object' && module.exports ? module.exports = factory( require( 'jquery' ) ) :
  6686. typeof define === 'function' && define.amd ? define('validator',['jquery'], factory) :
  6687. factory(jQuery);
  6688. }(function($, undefined) {
  6689. 'use strict';
  6690. var NS = 'validator',
  6691. CLS_NS = '.' + NS,
  6692. CLS_NS_RULE = '.rule',
  6693. CLS_NS_FIELD = '.field',
  6694. CLS_NS_FORM = '.form',
  6695. CLS_WRAPPER = 'nice-' + NS,
  6696. CLS_MSG_BOX = 'msg-box',
  6697. ARIA_INVALID = 'aria-invalid',
  6698. DATA_RULE = 'data-rule',
  6699. DATA_MSG = 'data-msg',
  6700. DATA_TIP = 'data-tip',
  6701. DATA_OK = 'data-ok',
  6702. DATA_TIMELY = 'data-timely',
  6703. DATA_TARGET = 'data-target',
  6704. DATA_DISPLAY = 'data-display',
  6705. DATA_MUST = 'data-must',
  6706. NOVALIDATE = 'novalidate',
  6707. INPUT_SELECTOR = ':verifiable',
  6708. rRules = /(&)?(!)?\b(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?\s*(;|\|)?/g,
  6709. rRule = /(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?/,
  6710. rDisplay = /(?:([^:;\(\[]*):)?(.*)/,
  6711. rDoubleBytes = /[^\x00-\xff]/g,
  6712. rPos = /top|right|bottom|left/,
  6713. rAjaxType = /(?:(cors|jsonp):)?(?:(post|get):)?(.+)/i,
  6714. rUnsafe = /[<>'"`\\]|&#x?\d+[A-F]?;?|%3[A-F]/gmi,
  6715. noop = $.noop,
  6716. proxy = $.proxy,
  6717. trim = $.trim,
  6718. isFunction = $.isFunction,
  6719. isString = function(s) {
  6720. return typeof s === 'string';
  6721. },
  6722. isObject = function(o) {
  6723. return o && Object.prototype.toString.call(o) === '[object Object]';
  6724. },
  6725. isIE = document.documentMode || +(navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1),
  6726. attr = function(el, key, value) {
  6727. if (!el || !el.tagName) return null;
  6728. if (value !== undefined) {
  6729. if (value === null) el.removeAttribute(key);
  6730. else el.setAttribute(key, '' + value);
  6731. } else {
  6732. return el.getAttribute(key);
  6733. }
  6734. },
  6735. novalidateonce,
  6736. preinitialized = {},
  6737. defaults = {
  6738. debug: 0,
  6739. theme: 'default',
  6740. ignore: '',
  6741. focusInvalid: true,
  6742. focusCleanup: false,
  6743. stopOnError: false,
  6744. beforeSubmit: null,
  6745. valid: null,
  6746. invalid: null,
  6747. validation: null,
  6748. formClass: 'n-default',
  6749. validClass: 'n-valid',
  6750. invalidClass: 'n-invalid',
  6751. bindClassTo: null
  6752. },
  6753. fieldDefaults = {
  6754. timely: 1,
  6755. display: null,
  6756. target: null,
  6757. ignoreBlank: false,
  6758. showOk: true,
  6759. // Translate ajax response to validation result
  6760. dataFilter: function (data) {
  6761. if ( isString(data) || ( isObject(data) && ('error' in data || 'ok' in data) ) ) {
  6762. return data;
  6763. }
  6764. },
  6765. msgMaker: function(opt) {
  6766. var html;
  6767. html = '<span role="alert" class="msg-wrap n-'+ opt.type + '">' + opt.arrow;
  6768. if (opt.result) {
  6769. $.each(opt.result, function(i, obj){
  6770. html += '<span class="n-'+ obj.type +'">' + opt.icon + '<span class="n-msg">' + obj.msg + '</span></span>';
  6771. });
  6772. } else {
  6773. html += opt.icon + '<span class="n-msg">' + opt.msg + '</span>';
  6774. }
  6775. html += '</span>';
  6776. return html;
  6777. },
  6778. msgWrapper: 'span',
  6779. msgArrow: '',
  6780. msgIcon: '<span class="n-icon"></span>',
  6781. msgClass: 'n-right',
  6782. msgStyle: '',
  6783. msgShow: null,
  6784. msgHide: null
  6785. },
  6786. themes = {};
  6787. /** jQuery Plugin
  6788. * @param {Object} options
  6789. debug {Boolean} 0 Whether to enable debug mode
  6790. timely {Number} 1 Whether to enable timely validation
  6791. theme {String} 'default' Theme name
  6792. stopOnError {Boolean} false Whether to stop validate when found an error input
  6793. focusCleanup {Boolean} false Whether to clean up the field message when focus the field
  6794. focusInvalid {Boolean} true Whether to focus the field that is invalid
  6795. ignoreBlank {Boolean} false When the field has no value, whether to ignore validation
  6796. ignore {jqSelector} '' Ignored fields (Using jQuery selector)
  6797. beforeSubmit {Function} Do something before submit form
  6798. dataFilter {Function} Convert ajax results
  6799. valid {Function} Triggered when the form is valid
  6800. invalid {Function} Triggered when the form is invalid
  6801. validClass {String} 'n-valid' Add this class name to a valid field
  6802. invalidClass {String} 'n-invalid' Add this class name to a invalid field
  6803. bindClassTo {jqSelector} ':verifiable' Which element should the className binding to
  6804. display {Function} Callback function to get dynamic display
  6805. target {Function} Callback function to get dynamic target
  6806. msgShow {Function} Trigger this callback when show message
  6807. msgHide {Function} Trigger this callback when hide message
  6808. msgWrapper {String} 'span' Message wrapper tag name
  6809. msgMaker {Function} Callback function to make message HTML
  6810. msgArrow {String} Message arrow template
  6811. msgIcon {String} Message icon template
  6812. msgStyle {String} Custom message css style
  6813. msgClass {String} Additional added to the message class names
  6814. formClass {String} Additional added to the form class names
  6815. messages {Object} Custom messages for the current instance
  6816. rules {Object} Custom rules for the current instance
  6817. fields {Object} Field validation configuration
  6818. {String} key name|#id
  6819. {String|Object} value Rule string or an object which can pass more arguments
  6820. fields[key][rule] {String} Rule string
  6821. fields[key][display] {String|Function}
  6822. fields[key][tip] {String} Custom tip message
  6823. fields[key][ok] {String} Custom success message
  6824. fields[key][msg] {Object} Custom error message
  6825. fields[key][msgStyle] {String} Custom message style
  6826. fields[key][msgClass] {String} A className which added to message placeholder element
  6827. fields[key][msgWrapper] {String} Tag name of the message placeholder element
  6828. fields[key][msgMaker] {Function} A function to custom message HTML
  6829. fields[key][dataFilter] {Function} A function to convert ajax results
  6830. fields[key][valid] {Function} A function triggered when field is valid
  6831. fields[key][invalid] {Function} A function triggered when field is invalid
  6832. fields[key][must] {Boolean} If set true, we always check the field even has remote checking
  6833. fields[key][timely] {Boolean} Whether to enable timely validation
  6834. fields[key][target] {jqSelector} Define placement of a message
  6835. */
  6836. $.fn.validator = function(options) {
  6837. var that = this,
  6838. args = arguments;
  6839. if (that.is(INPUT_SELECTOR)) return that;
  6840. if (!that.is('form')) that = this.find('form');
  6841. if (!that.length) that = this;
  6842. that.each(function() {
  6843. var instance = $(this).data(NS);
  6844. if (instance) {
  6845. if ( isString(options) ) {
  6846. if ( options.charAt(0) === '_' ) return;
  6847. instance[options].apply(instance, [].slice.call(args, 1));
  6848. }
  6849. else if (options) {
  6850. instance._reset(true);
  6851. instance._init(this, options);
  6852. }
  6853. } else {
  6854. new Validator(this, options);
  6855. }
  6856. });
  6857. return this;
  6858. };
  6859. // Validate a field, or an area
  6860. $.fn.isValid = function(callback, hideMsg) {
  6861. var me = _getInstance(this[0]),
  6862. hasCallback = isFunction(callback),
  6863. ret, opt;
  6864. if (!me) return true;
  6865. if (!hasCallback && hideMsg === undefined) hideMsg = callback;
  6866. me.checkOnly = !!hideMsg;
  6867. opt = me.options;
  6868. ret = me._multiValidate(
  6869. this.is(INPUT_SELECTOR) ? this : this.find(INPUT_SELECTOR),
  6870. function(isValid){
  6871. if (!isValid && opt.focusInvalid && !me.checkOnly) {
  6872. // navigate to the error element
  6873. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  6874. }
  6875. if (hasCallback) {
  6876. if (callback.length) {
  6877. callback(isValid);
  6878. } else if (isValid) {
  6879. callback();
  6880. }
  6881. }
  6882. me.checkOnly = false;
  6883. }
  6884. );
  6885. // If you pass a callback, we maintain the jQuery object chain
  6886. return hasCallback ? this : ret;
  6887. };
  6888. $.extend($.expr.pseudos || $.expr[':'], {
  6889. // A faster selector than ":input:not(:submit,:button,:reset,:image,:disabled,[contenteditable])"
  6890. verifiable: function(elem) {
  6891. var name = elem.nodeName.toLowerCase();
  6892. return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
  6893. name === 'select' ||
  6894. name === 'textarea' ||
  6895. elem.contentEditable === 'true'
  6896. ) && !elem.disabled;
  6897. },
  6898. // any value, but not only whitespace
  6899. filled: function(elem) {
  6900. return !!trim($(elem).val());
  6901. }
  6902. });
  6903. /**
  6904. * Creates a new Validator
  6905. *
  6906. * @class
  6907. * @param {Element} element - form element
  6908. * @param {Object} options - options for validator
  6909. */
  6910. function Validator(element, options) {
  6911. var me = this;
  6912. if ( !(me instanceof Validator) ) {
  6913. return new Validator(element, options);
  6914. }
  6915. if (Validator.pending) {
  6916. $(window).on('validatorready', init);
  6917. } else {
  6918. init();
  6919. }
  6920. function init() {
  6921. me.$el = $(element);
  6922. if (me.$el.length) {
  6923. me._init(me.$el[0], options);
  6924. }
  6925. else if (isString(element)) {
  6926. preinitialized[element] = options;
  6927. }
  6928. }
  6929. }
  6930. Validator.prototype = {
  6931. _init: function(element, options) {
  6932. var me = this,
  6933. opt, themeOpt, dataOpt;
  6934. // Initialization options
  6935. if ( isFunction(options) ) {
  6936. options = {
  6937. valid: options
  6938. };
  6939. }
  6940. options = me._opt = options || {};
  6941. dataOpt = attr(element, 'data-'+ NS +'-option');
  6942. dataOpt = me._dataOpt = dataOpt && dataOpt.charAt(0) === '{' ? (new Function('return ' + dataOpt))() : {};
  6943. themeOpt = me._themeOpt = themes[ options.theme || dataOpt.theme || defaults.theme ];
  6944. opt = me.options = $.extend({}, defaults, fieldDefaults, themeOpt, me.options, options, dataOpt);
  6945. me.rules = new Rules(opt.rules, true);
  6946. me.messages = new Messages(opt.messages, true);
  6947. me.Field = _createFieldFactory(me);
  6948. me.elements = me.elements || {};
  6949. me.deferred = {};
  6950. me.errors = {};
  6951. me.fields = {};
  6952. // Initialization fields
  6953. me._initFields(opt.fields);
  6954. // Initialization events and make a cache
  6955. if ( !me.$el.data(NS) ) {
  6956. me.$el.data(NS, me).addClass(CLS_WRAPPER +' '+ opt.formClass)
  6957. .on('form-submit-validate', function(e, a, $form, opts, veto) {
  6958. me.vetoed = veto.veto = !me.isValid;
  6959. me.ajaxFormOptions = opts;
  6960. })
  6961. .on('submit'+ CLS_NS +' validate'+ CLS_NS, proxy(me, '_submit'))
  6962. .on('reset'+ CLS_NS, proxy(me, '_reset'))
  6963. .on('showmsg'+ CLS_NS, proxy(me, '_showmsg'))
  6964. .on('hidemsg'+ CLS_NS, proxy(me, '_hidemsg'))
  6965. .on('focusin'+ CLS_NS + ' click'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusin'))
  6966. .on('focusout'+ CLS_NS +' validate'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusout'))
  6967. .on('keyup'+ CLS_NS +' input'+ CLS_NS + ' compositionstart compositionend', INPUT_SELECTOR, proxy(me, '_focusout'))
  6968. .on('click'+ CLS_NS, ':radio,:checkbox', 'click', proxy(me, '_focusout'))
  6969. .on('change'+ CLS_NS, 'select,input[type="file"]', 'change', proxy(me, '_focusout'));
  6970. // cache the novalidate attribute value
  6971. me._NOVALIDATE = attr(element, NOVALIDATE);
  6972. // Initialization is complete, stop off default HTML5 form validation
  6973. // If use "jQuery.attr('novalidate')" in IE7 will complain: "SCRIPT3: Member not found."
  6974. attr(element, NOVALIDATE, NOVALIDATE);
  6975. }
  6976. // Display all messages in target container
  6977. if ( isString(opt.target) ) {
  6978. me.$el.find(opt.target).addClass('msg-container');
  6979. }
  6980. },
  6981. // Guess whether the form use ajax submit
  6982. _guessAjax: function(form) {
  6983. var me = this;
  6984. if ( !(me.isAjaxSubmit = !!me.options.valid) ) {
  6985. // if there is a "valid.form" event
  6986. var events = ($._data || $.data)(form, 'events');
  6987. me.isAjaxSubmit = issetEvent(events, 'valid', 'form') || issetEvent(events, 'submit', 'form-plugin');
  6988. }
  6989. function issetEvent(events, name, namespace) {
  6990. return !!(
  6991. events && events[name]
  6992. && $.map(events[name], function(e){
  6993. return ~e.namespace.indexOf(namespace) ? 1 : null;
  6994. }).length )
  6995. }
  6996. },
  6997. _initFields: function(fields) {
  6998. var me = this, k, arr, i,
  6999. clear = fields === null;
  7000. // Processing field information
  7001. if (clear) fields = me.fields;
  7002. if ( isObject(fields) ) {
  7003. for (k in fields) {
  7004. if (~k.indexOf(',')) {
  7005. arr = k.split(',');
  7006. i = arr.length;
  7007. while (i--) {
  7008. initField(trim(arr[i]), fields[k]);
  7009. }
  7010. } else {
  7011. initField(k, fields[k]);
  7012. }
  7013. }
  7014. }
  7015. // Parsing DOM rules
  7016. me.$el.find(INPUT_SELECTOR).each(function() {
  7017. me._parse(this);
  7018. });
  7019. function initField(k, v) {
  7020. // delete a field from settings
  7021. if ( v === null || clear ) {
  7022. var el = me.elements[k];
  7023. if (el) me._resetElement(el, true);
  7024. delete me.fields[k];
  7025. } else {
  7026. me.fields[k] = new me.Field(k, isString(v) ? {rule: v} : v, me.fields[k]);
  7027. }
  7028. }
  7029. },
  7030. // Parsing a field
  7031. _parse: function(el) {
  7032. var me = this,
  7033. field,
  7034. key = el.name,
  7035. display,
  7036. timely,
  7037. dataRule = attr(el, DATA_RULE);
  7038. dataRule && attr(el, DATA_RULE, null);
  7039. // If the field has passed the key as id mode, or it doesn't has a name
  7040. if ( el.id && (
  7041. ('#' + el.id in me.fields) ||
  7042. !key ||
  7043. // If dataRule and element are diffrent from old's, we use ID mode.
  7044. (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
  7045. )
  7046. ) {
  7047. key = '#' + el.id;
  7048. }
  7049. // Generate id
  7050. if (!key) {
  7051. key = '#' + (el.id = 'N' + String(Math.random()).slice(-12));
  7052. }
  7053. field = me.getField(key, true);
  7054. // The priority of passing parameter by DOM is higher than by JS.
  7055. field.rule = dataRule || field.rule;
  7056. if (display = attr(el, DATA_DISPLAY)) {
  7057. field.display = display;
  7058. }
  7059. if (field.rule) {
  7060. if ( attr(el, DATA_MUST) !== null || /\b(?:match|checked)\b/.test(field.rule) ) {
  7061. field.must = true;
  7062. }
  7063. if ( /\brequired\b/.test(field.rule) ) {
  7064. field.required = true;
  7065. }
  7066. if (timely = attr(el, DATA_TIMELY)) {
  7067. field.timely = +timely;
  7068. } else if (field.timely > 3) {
  7069. attr(el, DATA_TIMELY, field.timely);
  7070. }
  7071. me._parseRule(field);
  7072. field.old = {};
  7073. }
  7074. if ( isString(field.target) ) {
  7075. attr(el, DATA_TARGET, field.target);
  7076. }
  7077. if ( isString(field.tip) ) {
  7078. attr(el, DATA_TIP, field.tip);
  7079. }
  7080. return me.fields[key] = field;
  7081. },
  7082. // Parsing field rules
  7083. _parseRule: function(field) {
  7084. var arr = rDisplay.exec(field.rule);
  7085. if (!arr) return;
  7086. // current rule index
  7087. field._i = 0;
  7088. if (arr[1]) {
  7089. field.display = arr[1];
  7090. }
  7091. if (arr[2]) {
  7092. field._rules = [];
  7093. arr[2].replace(rRules, function(){
  7094. var args = arguments;
  7095. args[4] = args[4] || args[5];
  7096. field._rules.push({
  7097. and: args[1] === '&',
  7098. not: args[2] === '!',
  7099. or: args[6] === '|',
  7100. method: args[3],
  7101. params: args[4] ? $.map( args[4].split(', '), trim ) : undefined
  7102. });
  7103. });
  7104. }
  7105. },
  7106. // Verify a zone
  7107. _multiValidate: function($inputs, doneCallback){
  7108. var me = this,
  7109. opt = me.options;
  7110. me.hasError = false;
  7111. if (opt.ignore) {
  7112. $inputs = $inputs.not(opt.ignore);
  7113. }
  7114. $inputs.each(function() {
  7115. me._validate(this);
  7116. if (me.hasError && opt.stopOnError) {
  7117. // stop the validation
  7118. return false;
  7119. }
  7120. });
  7121. // Need to wait for all fields validation complete, especially asynchronous validation
  7122. if (doneCallback) {
  7123. me.validating = true;
  7124. $.when.apply(
  7125. null,
  7126. $.map(me.deferred, function(v){return v;})
  7127. ).done(function(){
  7128. doneCallback.call(me, !me.hasError);
  7129. me.validating = false;
  7130. });
  7131. }
  7132. // If the form does not contain asynchronous validation, the return value is correct.
  7133. // Otherwise, you should detect form validation result through "doneCallback".
  7134. return !$.isEmptyObject(me.deferred) ? undefined : !me.hasError;
  7135. },
  7136. // Validate the whole form
  7137. _submit: function(e) {
  7138. var me = this,
  7139. opt = me.options,
  7140. form = e.target,
  7141. canSubmit = e.type === 'submit' && form.tagName === 'FORM' && !e.isDefaultPrevented();
  7142. e.preventDefault();
  7143. if (
  7144. novalidateonce && ~(novalidateonce = false) ||
  7145. // Prevent duplicate submission
  7146. me.submiting ||
  7147. // Receive the "validate" event only from the form.
  7148. e.type === 'validate' && me.$el[0] !== form ||
  7149. // trigger the beforeSubmit callback.
  7150. isFunction(opt.beforeSubmit) && opt.beforeSubmit.call(me, form) === false
  7151. ) {
  7152. return;
  7153. }
  7154. if (me.isAjaxSubmit === undefined) {
  7155. me._guessAjax(form);
  7156. }
  7157. me._debug('log', '\n<<< event: ' + e.type);
  7158. me._reset();
  7159. me.submiting = true;
  7160. me._multiValidate(
  7161. me.$el.find(INPUT_SELECTOR),
  7162. function(isValid){
  7163. var ret = (isValid || opt.debug === 2) ? 'valid' : 'invalid',
  7164. errors;
  7165. if (!isValid) {
  7166. if (opt.focusInvalid) {
  7167. // navigate to the error element
  7168. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  7169. }
  7170. errors = $.map(me.errors, function(err){return err;});
  7171. }
  7172. // releasing submit
  7173. me.submiting = false;
  7174. me.isValid = isValid;
  7175. // trigger callback and event
  7176. isFunction(opt[ret]) && opt[ret].call(me, form, errors);
  7177. me.$el.trigger(ret + CLS_NS_FORM, [form, errors]);
  7178. me._debug('log', '>>> ' + ret);
  7179. if (!isValid) return;
  7180. // For jquery.form plugin
  7181. if (me.vetoed) {
  7182. $(form).ajaxSubmit(me.ajaxFormOptions);
  7183. }
  7184. else if (canSubmit && !me.isAjaxSubmit) {
  7185. document.createElement('form').submit.call(form);
  7186. }
  7187. }
  7188. );
  7189. },
  7190. _reset: function(e) {
  7191. var me = this;
  7192. me.errors = {};
  7193. if (e) {
  7194. me.reseting = true;
  7195. me.$el.find(INPUT_SELECTOR).each( function(){
  7196. me._resetElement(this);
  7197. });
  7198. delete me.reseting;
  7199. }
  7200. },
  7201. _resetElement: function(el, all) {
  7202. this._setClass(el, null);
  7203. this.hideMsg(el);
  7204. },
  7205. // Handle events: "focusin/click"
  7206. _focusin: function(e) {
  7207. var me = this,
  7208. opt = me.options,
  7209. el = e.target,
  7210. timely,
  7211. msg;
  7212. if ( me.validating || ( e.type==='click' && document.activeElement === el ) ) {
  7213. return;
  7214. }
  7215. if (opt.focusCleanup) {
  7216. if ( attr(el, ARIA_INVALID) === 'true' ) {
  7217. me._setClass(el, null);
  7218. me.hideMsg(el);
  7219. }
  7220. }
  7221. msg = attr(el, DATA_TIP);
  7222. if (msg) {
  7223. me.showMsg(el, {
  7224. type: 'tip',
  7225. msg: msg
  7226. });
  7227. } else {
  7228. if (attr(el, DATA_RULE)) {
  7229. me._parse(el);
  7230. }
  7231. if (timely = attr(el, DATA_TIMELY)) {
  7232. if ( timely === 8 || timely === 9 ) {
  7233. me._focusout(e);
  7234. }
  7235. }
  7236. }
  7237. },
  7238. // Handle events: "focusout/validate/keyup/click/change/input/compositionstart/compositionend"
  7239. _focusout: function(e) {
  7240. var me = this,
  7241. opt = me.options,
  7242. el = e.target,
  7243. etype = e.type,
  7244. etype0,
  7245. focusin = etype === 'focusin',
  7246. special = etype === 'validate',
  7247. elem,
  7248. field,
  7249. old,
  7250. value,
  7251. timestamp,
  7252. key, specialKey,
  7253. timely,
  7254. timer = 0;
  7255. if (etype === 'compositionstart') {
  7256. me.pauseValidate = true;
  7257. }
  7258. if (etype === 'compositionend') {
  7259. me.pauseValidate = false;
  7260. }
  7261. if (me.pauseValidate) {
  7262. return;
  7263. }
  7264. // For checkbox and radio
  7265. elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
  7266. // Get field
  7267. if (!(field = me.getField(elem)) || !field.rule) {
  7268. return;
  7269. }
  7270. // Cache event type
  7271. etype0 = field._e;
  7272. field._e = etype;
  7273. timely = field.timely;
  7274. if (!special) {
  7275. if (!timely || (_checkable(el) && etype !== 'click')) {
  7276. return;
  7277. }
  7278. value = field.getValue();
  7279. // not validate field unless fill a value
  7280. if ( field.ignoreBlank && !value && !focusin ) {
  7281. me.hideMsg(el);
  7282. return;
  7283. }
  7284. if ( etype === 'focusout' ) {
  7285. if (etype0 === 'change') {
  7286. return;
  7287. }
  7288. if ( timely === 2 || timely === 8 ) {
  7289. old = field.old;
  7290. if (value && old) {
  7291. if (field.isValid && !old.showOk) {
  7292. me.hideMsg(el);
  7293. } else {
  7294. me._makeMsg(el, field, old);
  7295. }
  7296. } else {
  7297. return;
  7298. }
  7299. }
  7300. }
  7301. else {
  7302. if ( timely < 2 && !e.data ) {
  7303. return;
  7304. }
  7305. // mark timestamp to reduce the frequency of the received event
  7306. timestamp = +new Date();
  7307. if ( timestamp - (el._ts || 0) < 100 ) {
  7308. return;
  7309. }
  7310. el._ts = timestamp;
  7311. // handle keyup
  7312. if ( etype === 'keyup' ) {
  7313. if (etype0 === 'input') {
  7314. return;
  7315. }
  7316. key = e.keyCode;
  7317. specialKey = {
  7318. 8: 1, // Backspace
  7319. 9: 1, // Tab
  7320. 16: 1, // Shift
  7321. 32: 1, // Space
  7322. 46: 1 // Delete
  7323. };
  7324. // only gets focus, no validation
  7325. if ( key === 9 && !value ) {
  7326. return;
  7327. }
  7328. // do not validate, if triggered by these keys
  7329. if ( key < 48 && !specialKey[key] ) {
  7330. return;
  7331. }
  7332. }
  7333. if ( !focusin ) {
  7334. // keyboard events, reducing the frequency of validation
  7335. timer = timely <100 ? (etype === 'click' || el.tagName === 'SELECT') ? 0 : 400 : timely;
  7336. }
  7337. }
  7338. }
  7339. // if the current field is ignored
  7340. if ( opt.ignore && $(el).is(opt.ignore) ) {
  7341. return;
  7342. }
  7343. clearTimeout(field._t);
  7344. if (timer) {
  7345. field._t = setTimeout(function() {
  7346. me._validate(el, field);
  7347. }, timer);
  7348. } else {
  7349. if (special) field.old = {};
  7350. me._validate(el, field);
  7351. }
  7352. },
  7353. _setClass: function(el, isValid) {
  7354. var $el = $(el), opt = this.options;
  7355. if (opt.bindClassTo) {
  7356. $el = $el.closest(opt.bindClassTo);
  7357. }
  7358. $el.removeClass( opt.invalidClass + ' ' + opt.validClass );
  7359. if (isValid !== null) {
  7360. $el.addClass( isValid ? opt.validClass : opt.invalidClass );
  7361. }
  7362. },
  7363. _showmsg: function(e, type, msg) {
  7364. var me = this,
  7365. el = e.target;
  7366. if ( me.$el.is(el) ) {
  7367. if (isObject(type)) {
  7368. me.showMsg(type)
  7369. }
  7370. else if ( type === 'tip' ) {
  7371. me.$el.find(INPUT_SELECTOR +'['+ DATA_TIP +']', el).each(function(){
  7372. me.showMsg(this, {type: type, msg: msg});
  7373. });
  7374. }
  7375. }
  7376. else {
  7377. me.showMsg(el, {type: type, msg: msg});
  7378. }
  7379. },
  7380. _hidemsg: function(e) {
  7381. var $el = $(e.target);
  7382. if ( $el.is(INPUT_SELECTOR) ) {
  7383. this.hideMsg($el);
  7384. }
  7385. },
  7386. // Validated a field
  7387. _validatedField: function(el, field, ret) {
  7388. var me = this,
  7389. opt = me.options,
  7390. isValid = field.isValid = ret.isValid = !!ret.isValid,
  7391. callback = isValid ? 'valid' : 'invalid';
  7392. ret.key = field.key;
  7393. ret.ruleName = field._r;
  7394. ret.id = el.id;
  7395. ret.value = field.value;
  7396. me.elements[field.key] = ret.element = el;
  7397. me.isValid = me.$el[0].isValid = isValid ? me.isFormValid() : isValid;
  7398. if (isValid) {
  7399. ret.type = 'ok';
  7400. } else {
  7401. if (me.submiting) {
  7402. me.errors[field.key] = ret.msg;
  7403. }
  7404. me.hasError = true;
  7405. }
  7406. // cache result
  7407. field.old = ret;
  7408. // trigger callback
  7409. isFunction(field[callback]) && field[callback].call(me, el, ret);
  7410. isFunction(opt.validation) && opt.validation.call(me, el, ret);
  7411. // trigger event
  7412. $(el).attr( ARIA_INVALID, isValid ? null : true )
  7413. .trigger( callback + CLS_NS_FIELD, [ret, me] );
  7414. me.$el.triggerHandler('validation', [ret, me]);
  7415. if (me.checkOnly) return;
  7416. // set className
  7417. me._setClass(el, ret.skip || ret.type === 'tip' ? null : isValid);
  7418. me._makeMsg.apply(me, arguments);
  7419. },
  7420. _makeMsg: function(el, field, ret) {
  7421. // show or hide the message
  7422. if (field.msgMaker) {
  7423. ret = $.extend({}, ret);
  7424. if (field._e === 'focusin') {
  7425. ret.type = 'tip';
  7426. }
  7427. this[ ret.showOk || ret.msg || ret.type === 'tip' ? 'showMsg' : 'hideMsg' ](el, ret, field);
  7428. }
  7429. },
  7430. // Validated a rule
  7431. _validatedRule: function(el, field, ret, msgOpt) {
  7432. field = field || me.getField(el);
  7433. msgOpt = msgOpt || {};
  7434. var me = this,
  7435. msg,
  7436. rule,
  7437. method = field._r,
  7438. timely = field.timely,
  7439. special = timely === 9 || timely === 8,
  7440. transfer,
  7441. temp,
  7442. isValid = false;
  7443. // use null to break validation from a field
  7444. if (ret === null) {
  7445. me._validatedField(el, field, {isValid: true, skip: true});
  7446. field._i = 0;
  7447. return;
  7448. }
  7449. else if (ret === undefined) {
  7450. transfer = true;
  7451. }
  7452. else if (ret === true || ret === '') {
  7453. isValid = true;
  7454. }
  7455. else if (isString(ret)) {
  7456. msg = ret;
  7457. }
  7458. else if (isObject(ret)) {
  7459. if (ret.error) {
  7460. msg = ret.error;
  7461. } else {
  7462. msg = ret.ok;
  7463. isValid = true;
  7464. }
  7465. }
  7466. else {
  7467. isValid = !!ret
  7468. }
  7469. rule = field._rules[field._i];
  7470. if (rule.not) {
  7471. msg = undefined;
  7472. isValid = method === 'required' || !isValid;
  7473. }
  7474. if (rule.or) {
  7475. if (isValid) {
  7476. while ( field._i < field._rules.length && field._rules[field._i].or ) {
  7477. field._i++;
  7478. }
  7479. } else {
  7480. transfer = true;
  7481. }
  7482. }
  7483. else if (rule.and) {
  7484. if (!field.isValid) transfer = true;
  7485. }
  7486. if (transfer) {
  7487. isValid = true;
  7488. }
  7489. // message analysis, and throw rule level event
  7490. else {
  7491. if (isValid) {
  7492. if (field.showOk !== false) {
  7493. temp = attr(el, DATA_OK);
  7494. msg = temp === null ? isString(field.ok) ? field.ok : msg : temp;
  7495. if (!isString(msg) && isString(field.showOk)) {
  7496. msg = field.showOk;
  7497. }
  7498. if (isString(msg)) {
  7499. msgOpt.showOk = isValid;
  7500. }
  7501. }
  7502. }
  7503. if (!isValid || special) {
  7504. /* rule message priority:
  7505. 1. custom DOM message
  7506. 2. custom field message;
  7507. 3. global defined message;
  7508. 4. rule returned message;
  7509. 5. default message;
  7510. */
  7511. msg = (_getDataMsg(el, field, msg || rule.msg || me.messages[method]) || me.messages.fallback).replace(/\{0\|?([^\}]*)\}/, function(m, defaultDisplay){
  7512. return me._getDisplay(el, field.display) || defaultDisplay || me.messages[0];
  7513. });
  7514. }
  7515. if (!isValid) field.isValid = isValid;
  7516. msgOpt.msg = msg;
  7517. $(el).trigger( (isValid ? 'valid' : 'invalid') + CLS_NS_RULE, [method, msg]);
  7518. }
  7519. if (special && (!transfer || rule.and)) {
  7520. if (!isValid && !field._m) field._m = msg;
  7521. field._v = field._v || [];
  7522. field._v.push({
  7523. type: isValid ? !transfer ? 'ok' : 'tip' : 'error',
  7524. msg: msg || rule.msg
  7525. });
  7526. }
  7527. me._debug('log', ' ' + field._i + ': ' + method + ' => ' + (isValid || msg));
  7528. // the current rule has passed, continue to validate
  7529. if ( (isValid || special) && field._i < field._rules.length - 1) {
  7530. field._i++;
  7531. me._checkRule(el, field);
  7532. }
  7533. // field was invalid, or all fields was valid
  7534. else {
  7535. field._i = 0;
  7536. if (special) {
  7537. msgOpt.isValid = field.isValid;
  7538. msgOpt.result = field._v;
  7539. msgOpt.msg = field._m || '';
  7540. if (!field.value && (field._e === 'focusin')) {
  7541. msgOpt.type = 'tip';
  7542. }
  7543. } else {
  7544. msgOpt.isValid = isValid;
  7545. }
  7546. me._validatedField(el, field, msgOpt);
  7547. delete field._m;
  7548. delete field._v;
  7549. }
  7550. },
  7551. // Verify a rule form a field
  7552. _checkRule: function(el, field) {
  7553. var me = this,
  7554. ret,
  7555. fn,
  7556. old,
  7557. key = field.key,
  7558. rule = field._rules[field._i],
  7559. method = rule.method,
  7560. params = rule.params;
  7561. // request has been sent, wait it
  7562. if (me.submiting && me.deferred[key]) {
  7563. return;
  7564. }
  7565. old = field.old;
  7566. field._r = method;
  7567. if (old && !field.must && !rule.must && rule.result !== undefined &&
  7568. old.ruleName === method && old.id === el.id &&
  7569. field.value && old.value === field.value )
  7570. {
  7571. // get result from cache
  7572. ret = rule.result;
  7573. }
  7574. else {
  7575. // get result from current rule
  7576. fn = _getDataRule(el, method) || me.rules[method] || noop;
  7577. ret = fn.call(field, el, params, field);
  7578. if (fn.msg) rule.msg = fn.msg;
  7579. }
  7580. // asynchronous validation
  7581. if (isObject(ret) && isFunction(ret.then)) {
  7582. me.deferred[key] = ret;
  7583. // whether the field valid is unknown
  7584. field.isValid = undefined;
  7585. // show loading message
  7586. !me.checkOnly && me.showMsg(el, {
  7587. type: 'loading',
  7588. msg: me.messages.loading
  7589. }, field);
  7590. // waiting to parse the response data
  7591. ret.then(
  7592. function(d, textStatus, jqXHR) {
  7593. var data = trim(jqXHR.responseText),
  7594. result,
  7595. dataFilter = field.dataFilter;
  7596. // detect if data is json or jsonp format
  7597. if (/jsonp?/.test(this.dataType)) {
  7598. data = d;
  7599. } else if (data.charAt(0) === '{') {
  7600. data = $.parseJSON(data);
  7601. }
  7602. // filter data
  7603. result = dataFilter.call(this, data, field);
  7604. if (result === undefined) result = dataFilter.call(this, data.data, field);
  7605. rule.data = this.data;
  7606. rule.result = field.old ? result : undefined;
  7607. me._validatedRule(el, field, result);
  7608. },
  7609. function(jqXHR, textStatus){
  7610. me._validatedRule(el, field, me.messages[textStatus] || textStatus);
  7611. }
  7612. ).always(function(){
  7613. delete me.deferred[key];
  7614. });
  7615. }
  7616. // other result
  7617. else {
  7618. me._validatedRule(el, field, ret);
  7619. }
  7620. },
  7621. // Processing the validation
  7622. _validate: function(el, field) {
  7623. var me = this;
  7624. // doesn't validate the element that has "disabled" or "novalidate" attribute
  7625. if ( el.disabled || attr(el, NOVALIDATE) !== null ) {
  7626. return;
  7627. }
  7628. field = field || me.getField(el);
  7629. if (!field) return;
  7630. if (!field._rules) me._parse(el);
  7631. if (!field._rules) return;
  7632. me._debug('info', field.key);
  7633. field.isValid = true;
  7634. field.element = el;
  7635. // Cache the value
  7636. field.value = field.getValue();
  7637. // if the field is not required, and that has a blank value
  7638. if (!field.required && !field.must && !field.value) {
  7639. if (!_checkable(el)) {
  7640. me._validatedField(el, field, {isValid: true});
  7641. return true;
  7642. }
  7643. }
  7644. me._checkRule(el, field);
  7645. return field.isValid;
  7646. },
  7647. _debug: function(type, messages) {
  7648. if (window.console && this.options.debug) {
  7649. console[type](messages);
  7650. }
  7651. },
  7652. /**
  7653. * Detecting whether the value of an element that matches a rule
  7654. *
  7655. * @method test
  7656. * @param {Element} el - input element
  7657. * @param {String} rule - rule name
  7658. */
  7659. test: function(el, rule) {
  7660. var me = this,
  7661. ret,
  7662. parts = rRule.exec(rule),
  7663. field,
  7664. method,
  7665. params;
  7666. if (parts) {
  7667. method = parts[1];
  7668. if (method in me.rules) {
  7669. params = parts[2] || parts[3];
  7670. params = params ? params.split(', ') : undefined;
  7671. field = me.getField(el, true);
  7672. field._r = method;
  7673. field.value = field.getValue();
  7674. ret = me.rules[method].call(field, el, params);
  7675. }
  7676. }
  7677. return ret === true || ret === undefined || ret === null;
  7678. },
  7679. _getDisplay: function(el, str) {
  7680. return !isString(str) ? isFunction(str) ? str.call(this, el) : '' : str;
  7681. },
  7682. _getMsgOpt: function(obj, field) {
  7683. var opt = field ? field : this.options;
  7684. return $.extend({
  7685. type: 'error',
  7686. pos: _getPos(opt.msgClass),
  7687. target: opt.target,
  7688. wrapper: opt.msgWrapper,
  7689. style: opt.msgStyle,
  7690. cls: opt.msgClass,
  7691. arrow: opt.msgArrow,
  7692. icon: opt.msgIcon
  7693. }, isString(obj) ? {msg: obj} : obj);
  7694. },
  7695. _getMsgDOM: function(el, msgOpt) {
  7696. var $el = $(el), $msgbox, datafor, tgt, container;
  7697. if ( $el.is(INPUT_SELECTOR) ) {
  7698. tgt = msgOpt.target || attr(el, DATA_TARGET);
  7699. if (tgt) {
  7700. tgt = !isFunction(tgt) ? tgt.charAt(0) === '#' ? $(tgt) : this.$el.find(tgt) : tgt.call(this, el);
  7701. if (tgt.length) {
  7702. if ( tgt.is(INPUT_SELECTOR) ) {
  7703. $el = tgt
  7704. el = tgt.get(0);
  7705. } else if ( tgt.hasClass(CLS_MSG_BOX) ) {
  7706. $msgbox = tgt;
  7707. } else {
  7708. container = tgt;
  7709. }
  7710. }
  7711. }
  7712. if (!$msgbox) {
  7713. datafor = (!_checkable(el) || !el.name) && el.id ? el.id : el.name;
  7714. $msgbox = (container || this.$el).find(msgOpt.wrapper + '.' + CLS_MSG_BOX + '[for="' + datafor + '"]');
  7715. }
  7716. } else {
  7717. $msgbox = $el;
  7718. }
  7719. // Create new message box
  7720. if (!msgOpt.hide && !$msgbox.length) {
  7721. $msgbox = $('<'+ msgOpt.wrapper + '>').attr({
  7722. 'class': CLS_MSG_BOX + (msgOpt.cls ? ' ' + msgOpt.cls : ''),
  7723. 'style': msgOpt.style || undefined,
  7724. 'for': datafor
  7725. });
  7726. if (container) {
  7727. $msgbox.appendTo(container);
  7728. } else {
  7729. if ( _checkable(el) ) {
  7730. var $parent = $el.parent();
  7731. $msgbox.appendTo( $parent.is('label') ? $parent.parent() : $parent );
  7732. } else {
  7733. $msgbox[!msgOpt.pos || msgOpt.pos === 'right' ? 'insertAfter' : 'insertBefore']($el);
  7734. }
  7735. }
  7736. }
  7737. return $msgbox;
  7738. },
  7739. /**
  7740. * Show validation message
  7741. *
  7742. * @method showMsg
  7743. * @param {Element} el - input element
  7744. * @param {Object} msgOpt
  7745. */
  7746. showMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  7747. if (!el) return;
  7748. var me = this,
  7749. opt = me.options,
  7750. msgShow,
  7751. msgMaker,
  7752. temp,
  7753. $msgbox;
  7754. if (isObject(el) && !el.jquery && !msgOpt) {
  7755. $.each(el, function(key, msg) {
  7756. var el = me.elements[key] || me.$el.find(_key2selector(key))[0];
  7757. me.showMsg(el, msg);
  7758. });
  7759. return;
  7760. }
  7761. if ($(el).is(INPUT_SELECTOR)) {
  7762. field = field || me.getField(el);
  7763. }
  7764. if (!(msgMaker = (field || opt).msgMaker)) {
  7765. return;
  7766. }
  7767. msgOpt = me._getMsgOpt(msgOpt, field);
  7768. el = (el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]') : $(el)).get(0);
  7769. // ok or tip
  7770. if (!msgOpt.msg && msgOpt.type !== 'error') {
  7771. temp = attr(el, 'data-' + msgOpt.type);
  7772. if (temp !== null) msgOpt.msg = temp;
  7773. }
  7774. if ( !isString(msgOpt.msg) ) {
  7775. return;
  7776. }
  7777. $msgbox = me._getMsgDOM(el, msgOpt);
  7778. !rPos.test($msgbox[0].className) && $msgbox.addClass(msgOpt.cls);
  7779. if ( isIE === 6 && msgOpt.pos === 'bottom' ) {
  7780. $msgbox[0].style.marginTop = $(el).outerHeight() + 'px';
  7781. }
  7782. $msgbox.html( msgMaker.call(me, msgOpt) )[0].style.display = '';
  7783. if (isFunction(msgShow = field && field.msgShow || opt.msgShow)) {
  7784. msgShow.call(me, $msgbox, msgOpt.type);
  7785. }
  7786. },
  7787. /**
  7788. * Hide validation message
  7789. *
  7790. * @method hideMsg
  7791. * @param {Element} el - input element
  7792. * @param {Object} msgOpt optional
  7793. */
  7794. hideMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  7795. var me = this,
  7796. opt = me.options,
  7797. msgHide,
  7798. $msgbox;
  7799. el = $(el).get(0);
  7800. if ($(el).is(INPUT_SELECTOR)) {
  7801. field = field || me.getField(el);
  7802. if (field) {
  7803. if (field.isValid || me.reseting) attr(el, ARIA_INVALID, null);
  7804. }
  7805. }
  7806. msgOpt = me._getMsgOpt(msgOpt, field);
  7807. msgOpt.hide = true;
  7808. $msgbox = me._getMsgDOM(el, msgOpt);
  7809. if (!$msgbox.length) return;
  7810. if ( isFunction(msgHide = field && field.msgHide || opt.msgHide) ) {
  7811. msgHide.call(me, $msgbox, msgOpt.type);
  7812. } else {
  7813. $msgbox[0].style.display = 'none';
  7814. $msgbox[0].innerHTML = '';
  7815. }
  7816. },
  7817. /**
  7818. * Get field information
  7819. *
  7820. * @method getField
  7821. * @param {Element} - input element
  7822. * @return {Object} field
  7823. */
  7824. getField: function(el, must) {
  7825. var me = this,
  7826. key,
  7827. field;
  7828. if (isString(el)) {
  7829. key = el;
  7830. el = undefined;
  7831. } else {
  7832. if (attr(el, DATA_RULE)) {
  7833. return me._parse(el);
  7834. }
  7835. if (el.id && '#' + el.id in me.fields || !el.name) {
  7836. key = '#' + el.id;
  7837. } else {
  7838. key = el.name;
  7839. }
  7840. }
  7841. if ( (field = me.fields[key]) || must && (field = new me.Field(key)) ) {
  7842. field.element = el;
  7843. }
  7844. return field;
  7845. },
  7846. /**
  7847. * Config a field
  7848. *
  7849. * @method: setField
  7850. * @param {String} key
  7851. * @param {Object} obj
  7852. */
  7853. setField: function(key, obj) {
  7854. var fields = {};
  7855. if (!key) return;
  7856. // update this field
  7857. if (isString(key)) {
  7858. fields[key] = obj;
  7859. }
  7860. // update fields
  7861. else {
  7862. fields = key;
  7863. }
  7864. this._initFields(fields);
  7865. },
  7866. /**
  7867. * Detecting whether the form is valid
  7868. *
  7869. * @method isFormValid
  7870. * @return {Boolean}
  7871. */
  7872. isFormValid: function() {
  7873. var fields = this.fields, k, field;
  7874. for (k in fields) {
  7875. field = fields[k];
  7876. if (!field._rules || !field.required && !field.must && !field.value) continue;
  7877. if (!field.isValid) return false;
  7878. }
  7879. return true;
  7880. },
  7881. /**
  7882. * Prevent submission form
  7883. *
  7884. * @method holdSubmit
  7885. * @param {Boolean} hold - If set to false, will release the hold
  7886. */
  7887. holdSubmit: function(hold) {
  7888. this.submiting = hold === undefined || hold;
  7889. },
  7890. /**
  7891. * Clean validation messages
  7892. *
  7893. * @method cleanUp
  7894. */
  7895. cleanUp: function() {
  7896. this._reset(1);
  7897. },
  7898. /**
  7899. * Destroy the validation
  7900. *
  7901. * @method destroy
  7902. */
  7903. destroy: function() {
  7904. this._reset(1);
  7905. this.$el.off(CLS_NS).removeData(NS);
  7906. attr(this.$el[0], NOVALIDATE, this._NOVALIDATE);
  7907. }
  7908. };
  7909. /**
  7910. * Create Field Factory
  7911. *
  7912. * @class
  7913. * @param {Object} context
  7914. * @return {Function} Factory
  7915. */
  7916. function _createFieldFactory(context) {
  7917. function FieldFactory() {
  7918. var options = this.options;
  7919. for (var i in options) {
  7920. if (i in fieldDefaults) this[i] = options[i];
  7921. }
  7922. $.extend(this, {
  7923. _valHook: function() {
  7924. return this.element.contentEditable === 'true' ? 'text' : 'val';
  7925. },
  7926. getValue: function() {
  7927. var elem = this.element;
  7928. if (elem.type === 'number' && elem.validity && elem.validity.badInput) {
  7929. return 'NaN';
  7930. }
  7931. return $(elem)[this._valHook()]();
  7932. },
  7933. setValue: function(value) {
  7934. $(this.element)[this._valHook()](this.value = value);
  7935. },
  7936. // Get a range of validation messages
  7937. getRangeMsg: function(value, params, suffix) {
  7938. if (!params) return;
  7939. var me = this,
  7940. msg = me.messages[me._r] || '',
  7941. result,
  7942. p = params[0].split('~'),
  7943. e = params[1] === 'false',
  7944. a = p[0],
  7945. b = p[1],
  7946. c = 'rg',
  7947. args = [''],
  7948. isNumber = trim(value) && +value === +value;
  7949. function compare(large, small) {
  7950. return !e ? large >= small : large > small;
  7951. }
  7952. if (p.length === 2) {
  7953. if (a && b) {
  7954. if (isNumber && compare(value, +a) && compare(+b, value)) {
  7955. result = true;
  7956. }
  7957. args = args.concat(p);
  7958. c = e ? 'gtlt' : 'rg';
  7959. }
  7960. else if (a && !b) {
  7961. if (isNumber && compare(value, +a)) {
  7962. result = true;
  7963. }
  7964. args.push(a);
  7965. c = e ? 'gt' : 'gte';
  7966. }
  7967. else if (!a && b) {
  7968. if (isNumber && compare(+b, value)) {
  7969. result = true;
  7970. }
  7971. args.push(b);
  7972. c = e ? 'lt' : 'lte';
  7973. }
  7974. }
  7975. else {
  7976. if (value === +a) {
  7977. result = true;
  7978. }
  7979. args.push(a);
  7980. c = 'eq';
  7981. }
  7982. if (msg) {
  7983. if (suffix && msg[c + suffix]) {
  7984. c += suffix;
  7985. }
  7986. args[0] = msg[c];
  7987. }
  7988. return result || me._rules && ( me._rules[me._i].msg = me.renderMsg.apply(null, args) );
  7989. },
  7990. // Render message template
  7991. renderMsg: function() {
  7992. var args = arguments,
  7993. tpl = args[0],
  7994. i = args.length;
  7995. if (!tpl) return;
  7996. while (--i) {
  7997. tpl = tpl.replace('{' + i + '}', args[i]);
  7998. }
  7999. return tpl;
  8000. }
  8001. });
  8002. }
  8003. function Field(key, obj, oldField) {
  8004. this.key = key;
  8005. this.validator = context;
  8006. $.extend(this, oldField, obj);
  8007. }
  8008. FieldFactory.prototype = context;
  8009. Field.prototype = new FieldFactory();
  8010. return Field;
  8011. }
  8012. /**
  8013. * Create Rules
  8014. *
  8015. * @class
  8016. * @param {Object} obj rules
  8017. * @param {Object} context context
  8018. */
  8019. function Rules(obj, context) {
  8020. if (!isObject(obj)) return;
  8021. var k, that = context ? context === true ? this : context : Rules.prototype;
  8022. for (k in obj) {
  8023. if (_checkRuleName(k)) {
  8024. that[k] = _getRule(obj[k]);
  8025. }
  8026. }
  8027. }
  8028. /**
  8029. * Create Messages
  8030. *
  8031. * @class
  8032. * @param {Object} obj rules
  8033. * @param {Object} context context
  8034. */
  8035. function Messages(obj, context) {
  8036. if (!isObject(obj)) return;
  8037. var k, that = context ? context === true ? this : context : Messages.prototype;
  8038. for (k in obj) {
  8039. that[k] = obj[k];
  8040. }
  8041. }
  8042. // Rule converted factory
  8043. function _getRule(fn) {
  8044. switch ($.type(fn)) {
  8045. case 'function':
  8046. return fn;
  8047. case 'array':
  8048. var f = function() {
  8049. return fn[0].test(this.value) || fn[1] || false;
  8050. };
  8051. f.msg = fn[1];
  8052. return f;
  8053. case 'regexp':
  8054. return function() {
  8055. return fn.test(this.value);
  8056. };
  8057. }
  8058. }
  8059. // Get instance by an element
  8060. function _getInstance(el) {
  8061. var wrap, k, options;
  8062. if (!el || !el.tagName) return;
  8063. switch (el.tagName) {
  8064. case 'INPUT':
  8065. case 'SELECT':
  8066. case 'TEXTAREA':
  8067. case 'BUTTON':
  8068. case 'FIELDSET':
  8069. wrap = el.form || $(el).closest('.' + CLS_WRAPPER);
  8070. break;
  8071. case 'FORM':
  8072. wrap = el;
  8073. break;
  8074. default:
  8075. wrap = $(el).closest('.' + CLS_WRAPPER);
  8076. }
  8077. for (k in preinitialized) {
  8078. if ($(wrap).is(k)) {
  8079. options = preinitialized[k];
  8080. break;
  8081. }
  8082. }
  8083. return $(wrap).data(NS) || $(wrap)[NS](options).data(NS);
  8084. }
  8085. // Get custom rules on the node
  8086. function _getDataRule(el, method) {
  8087. var fn = trim(attr(el, DATA_RULE + '-' + method));
  8088. if ( fn && (fn = new Function('return ' + fn)()) ) {
  8089. return _getRule(fn);
  8090. }
  8091. }
  8092. // Get custom messages on the node
  8093. function _getDataMsg(el, field, m) {
  8094. var msg = field.msg,
  8095. item = field._r;
  8096. if ( isObject(msg) ) msg = msg[item];
  8097. if ( !isString(msg) ) {
  8098. msg = attr(el, DATA_MSG + '-' + item) || attr(el, DATA_MSG) || ( m ? isString(m) ? m : m[item] : '');
  8099. }
  8100. return msg;
  8101. }
  8102. // Get message position
  8103. function _getPos(str) {
  8104. var pos;
  8105. if (str) pos = rPos.exec(str);
  8106. return pos && pos[0];
  8107. }
  8108. // Check whether the element is checkbox or radio
  8109. function _checkable(el) {
  8110. return el.tagName === 'INPUT' && el.type === 'checkbox' || el.type === 'radio';
  8111. }
  8112. // Parse date string to timestamp
  8113. function _parseDate(str) {
  8114. return Date.parse(str.replace(/\.|\-/g, '/'));
  8115. }
  8116. // Rule name only allows alphanumeric characters and underscores
  8117. function _checkRuleName(name) {
  8118. return /^\w+$/.test(name);
  8119. }
  8120. // Translate field key to jQuery selector.
  8121. function _key2selector(key) {
  8122. var isID = key.charAt(0) === '#';
  8123. key = key.replace(/([:.{(|)}/\[\]])/g, '\\$1');
  8124. return isID ? key : '[name="'+ key +'"]:first';
  8125. }
  8126. // Fixed a issue cause by refresh page in IE.
  8127. $(window).on('beforeunload', function(){
  8128. this.focus();
  8129. });
  8130. $(document)
  8131. .on('click', ':submit', function(){
  8132. var input = this, attrNode;
  8133. if (!input.form) return;
  8134. // Shim for "formnovalidate"
  8135. attrNode = input.getAttributeNode('formnovalidate');
  8136. if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
  8137. novalidateonce = true;
  8138. }
  8139. })
  8140. // Automatic initializing form validation
  8141. .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
  8142. if ( attr(this, NOVALIDATE) !== null ) return;
  8143. var $form = $(this), me;
  8144. if ( !$form.data(NS) && (me = _getInstance(this)) ) {
  8145. if ( !$.isEmptyObject(me.fields) ) {
  8146. // Execute event handler
  8147. if (e.type === 'focusin') {
  8148. me._focusin(e);
  8149. } else {
  8150. me._submit(e);
  8151. }
  8152. } else {
  8153. attr(this, NOVALIDATE, NOVALIDATE);
  8154. $form.off(CLS_NS).removeData(NS);
  8155. }
  8156. }
  8157. });
  8158. new Messages({
  8159. fallback: 'This field is not valid.',
  8160. loading: 'Validating...'
  8161. });
  8162. // Built-in rules (global)
  8163. new Rules({
  8164. /**
  8165. * required
  8166. *
  8167. * @example:
  8168. required
  8169. required(jqSelector)
  8170. required(anotherRule)
  8171. required(not, -1)
  8172. required(from, .contact)
  8173. */
  8174. required: function(element, params) {
  8175. var me = this,
  8176. val = trim(me.value),
  8177. isValid = true;
  8178. if (params) {
  8179. if ( params.length === 1 ) {
  8180. if ( !_checkRuleName(params[0]) ) {
  8181. if (!val && !$(params[0], me.$el).length ) {
  8182. return null;
  8183. }
  8184. }
  8185. else if ( me.rules[params[0]] ) {
  8186. if ( !val && !me.test(element, params[0]) ) {
  8187. return null;
  8188. }
  8189. me._r = 'required'
  8190. }
  8191. }
  8192. else if ( params[0] === 'not' ) {
  8193. $.each(params.slice(1), function() {
  8194. return (isValid = val !== trim(this));
  8195. });
  8196. }
  8197. else if ( params[0] === 'from' ) {
  8198. var $elements = me.$el.find(params[1]),
  8199. VALIDATED = '_validated_',
  8200. ret;
  8201. isValid = $elements.filter(function(){
  8202. var field = me.getField(this);
  8203. return field && !!trim(field.getValue());
  8204. }).length >= (params[2] || 1);
  8205. if (isValid) {
  8206. if (!val) ret = null;
  8207. } else {
  8208. ret = _getDataMsg($elements[0], me) || false;
  8209. }
  8210. if ( !$(element).data(VALIDATED) ) {
  8211. $elements.data(VALIDATED, 1).each(function(){
  8212. if (element !== this) {
  8213. me._validate(this);
  8214. }
  8215. }).removeData(VALIDATED);
  8216. }
  8217. return ret;
  8218. }
  8219. }
  8220. return isValid && !!val;
  8221. },
  8222. /**
  8223. * integer
  8224. *
  8225. * @example:
  8226. integer
  8227. integer[+]
  8228. integer[+0]
  8229. integer[-]
  8230. integer[-0]
  8231. */
  8232. integer: function(element, params) {
  8233. var re, z = '0|',
  8234. p = '[1-9]\\d*',
  8235. key = params ? params[0] : '*';
  8236. switch (key) {
  8237. case '+':
  8238. re = p;
  8239. break;
  8240. case '-':
  8241. re = '-' + p;
  8242. break;
  8243. case '+0':
  8244. re = z + p;
  8245. break;
  8246. case '-0':
  8247. re = z + '-' + p;
  8248. break;
  8249. default:
  8250. re = z + '-?' + p;
  8251. }
  8252. re = '^(?:' + re + ')$';
  8253. return new RegExp(re).test(this.value) || (this.messages.integer && this.messages.integer[key]);
  8254. },
  8255. /**
  8256. * match another field
  8257. *
  8258. * @example:
  8259. match[password] Match the password field (two values ​​must be the same)
  8260. match[eq, password] Ditto
  8261. match[neq, count] The value must be not equal to the value of the count field
  8262. match[lt, count] The value must be less than the value of the count field
  8263. match[lte, count] The value must be less than or equal to the value of the count field
  8264. match[gt, count] The value must be greater than the value of the count field
  8265. match[gte, count] The value must be greater than or equal to the value of the count field
  8266. match[gte, startDate, date]
  8267. match[gte, startTime, time]
  8268. **/
  8269. match: function(element, params) {
  8270. if (!params) return;
  8271. var me = this,
  8272. isValid = true,
  8273. a, b,
  8274. key, msg, type = 'eq', parser,
  8275. selector2, elem2, field2;
  8276. if (params.length === 1) {
  8277. key = params[0];
  8278. } else {
  8279. type = params[0];
  8280. key = params[1];
  8281. }
  8282. selector2 = _key2selector(key);
  8283. elem2 = me.$el.find(selector2)[0];
  8284. // If the compared field is not exist
  8285. if (!elem2) return;
  8286. field2 = me.getField(elem2);
  8287. a = me.value;
  8288. b = field2.getValue();
  8289. if (!me._match) {
  8290. me.$el.on('valid'+CLS_NS_FIELD+CLS_NS, selector2, function(){
  8291. $(element).trigger('validate');
  8292. });
  8293. me._match = field2._match = 1;
  8294. }
  8295. // If both fields are blank
  8296. if (!me.required && a === '' && b === '') {
  8297. return null;
  8298. }
  8299. parser = params[2];
  8300. if (parser) {
  8301. if (/^date(time)?$/i.test(parser)) {
  8302. a = _parseDate(a);
  8303. b = _parseDate(b);
  8304. } else if (parser === 'time') {
  8305. a = +a.replace(/:/g, '');
  8306. b = +b.replace(/:/g, '');
  8307. }
  8308. }
  8309. // If the compared field is incorrect, we only ensure that this field is correct.
  8310. if (type !== 'eq' && !isNaN(+a) && isNaN(+b)) {
  8311. return true;
  8312. }
  8313. switch (type) {
  8314. case 'lt':
  8315. isValid = +a < +b; break;
  8316. case 'lte':
  8317. isValid = +a <= +b; break;
  8318. case 'gte':
  8319. isValid = +a >= +b; break;
  8320. case 'gt':
  8321. isValid = +a > +b; break;
  8322. case 'neq':
  8323. isValid = a !== b; break;
  8324. default:
  8325. isValid = a === b;
  8326. }
  8327. return isValid || (
  8328. isObject(me.messages.match)
  8329. && me.messages.match[type].replace( '{1}', me._getDisplay( elem2, field2.display || key ) )
  8330. );
  8331. },
  8332. /**
  8333. * range numbers
  8334. *
  8335. * @example:
  8336. range[0~99] Number 0-99
  8337. range[0~] Number greater than or equal to 0
  8338. range[~100] Number less than or equal to 100
  8339. **/
  8340. range: function(element, params) {
  8341. return this.getRangeMsg(this.value, params);
  8342. },
  8343. /**
  8344. * how many checkbox or radio inputs that checked
  8345. *
  8346. * @example:
  8347. checked; no empty, same to required
  8348. checked[1~3] 1-3 items
  8349. checked[1~] greater than 1 item
  8350. checked[~3] less than 3 items
  8351. checked[3] 3 items
  8352. **/
  8353. checked: function(element, params) {
  8354. if ( !_checkable(element) ) return;
  8355. var me = this,
  8356. elem, count;
  8357. if (element.name) {
  8358. count = me.$el.find('input[name="' + element.name + '"]').filter(function() {
  8359. var el = this;
  8360. if (!elem && _checkable(el)) elem = el;
  8361. return !el.disabled && el.checked;
  8362. }).length;
  8363. } else {
  8364. elem = element;
  8365. count = elem.checked;
  8366. }
  8367. if (params) {
  8368. return me.getRangeMsg(count, params);
  8369. } else {
  8370. return !!count || _getDataMsg(elem, me, '') || me.messages.required || false;
  8371. }
  8372. },
  8373. /**
  8374. * length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
  8375. *
  8376. * @example:
  8377. length[6~16] 6-16 characters
  8378. length[6~] Greater than 6 characters
  8379. length[~16] Less than 16 characters
  8380. length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
  8381. **/
  8382. length: function(element, params) {
  8383. var value = this.value,
  8384. len = (params[1] === 'true' ? value.replace(rDoubleBytes, 'xx') : value).length;
  8385. return this.getRangeMsg(len, params, (params[1] ? '_2' : ''));
  8386. },
  8387. /**
  8388. * remote validation
  8389. *
  8390. * @description
  8391. * remote([get:]url [, name1, [name2 ...]]);
  8392. * Adaptation three kinds of results (Front for the successful, followed by a failure):
  8393. 1. text:
  8394. '' 'Error Message'
  8395. 2. json:
  8396. {"ok": ""} {"error": "Error Message"}
  8397. 3. json wrapper:
  8398. {"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
  8399. * @example
  8400. The simplest: remote(path/to/server);
  8401. With parameters: remote(path/to/server, name1, name2, ...);
  8402. By GET: remote(get:path/to/server, name1, name2, ...);
  8403. Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
  8404. Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)
  8405. CORS remote(cors:path/to/server)
  8406. JSONP remote(jsonp:path/to/server)
  8407. */
  8408. remote: function(element, params) {
  8409. if (!params) return;
  8410. var me = this,
  8411. arr = rAjaxType.exec(params[0]),
  8412. rule = me._rules[me._i],
  8413. data = {},
  8414. queryString = '',
  8415. url = arr[3],
  8416. type = arr[2] || 'POST', // GET / POST
  8417. rType = (arr[1]||'').toLowerCase(), // CORS / JSONP
  8418. dataType;
  8419. rule.must = true;
  8420. data[element.name] = me.value;
  8421. // There are extra fields
  8422. if (params[1]) {
  8423. $.map(params.slice(1), function(name) {
  8424. var arr, key;
  8425. if (~name.indexOf('=')) {
  8426. queryString += '&' + name;
  8427. } else {
  8428. arr = name.split(':');
  8429. name = trim(arr[0]);
  8430. key = trim(arr[1]) || name;
  8431. data[ name ] = me.$el.find( _key2selector(key) ).val();
  8432. }
  8433. });
  8434. }
  8435. data = $.param(data) + queryString;
  8436. if (!me.must && rule.data && rule.data === data) {
  8437. return rule.result;
  8438. }
  8439. // Cross-domain request, force jsonp dataType
  8440. if (rType !== 'cors' && /^https?:/.test(url) && !~url.indexOf(location.host)) {
  8441. dataType = 'jsonp';
  8442. }
  8443. // Asynchronous validation need return jqXHR objects
  8444. return $.ajax({
  8445. url: url,
  8446. type: type,
  8447. data: data,
  8448. dataType: dataType
  8449. });
  8450. },
  8451. /**
  8452. * filter characters, direct filtration without prompting error (support custom regular expressions)
  8453. *
  8454. * @example
  8455. * filter filtering unsafe characters
  8456. * filter(regexp) filtering the "regexp" matched characters
  8457. */
  8458. filter: function(element, params) {
  8459. var value = this.value,
  8460. temp = value.replace( params ? (new RegExp('[' + params[0] + ']', 'gm')) : rUnsafe, '' );
  8461. if (temp !== value) this.setValue(temp);
  8462. }
  8463. });
  8464. /**
  8465. * Config global options
  8466. *
  8467. * @static config
  8468. * @param {Object} options
  8469. */
  8470. Validator.config = function(key, value) {
  8471. if (isObject(key)) {
  8472. $.each(key, _config);
  8473. }
  8474. else if (isString(key)) {
  8475. _config(key, value);
  8476. }
  8477. function _config(k, o) {
  8478. if (k === 'rules') {
  8479. new Rules(o);
  8480. }
  8481. else if (k === 'messages') {
  8482. new Messages(o);
  8483. }
  8484. else if (k in fieldDefaults) {
  8485. fieldDefaults[k] = o;
  8486. }
  8487. else {
  8488. defaults[k] = o;
  8489. }
  8490. }
  8491. };
  8492. /**
  8493. * Config themes
  8494. *
  8495. * @static setTheme
  8496. * @param {String|Object} name
  8497. * @param {Object} obj
  8498. * @example
  8499. .setTheme( themeName, themeOptions )
  8500. .setTheme( multiThemes )
  8501. */
  8502. Validator.setTheme = function(name, obj) {
  8503. if ( isObject(name) ) {
  8504. $.extend(true, themes, name);
  8505. }
  8506. else if ( isString(name) && isObject(obj) ) {
  8507. themes[name] = $.extend(themes[name], obj);
  8508. }
  8509. };
  8510. /**
  8511. * Resource loader
  8512. *
  8513. * @static load
  8514. * @param {String} str
  8515. * @example
  8516. .load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css
  8517. .load('local=zh-CN&css=') // load: local/zh-CN.js
  8518. .load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css
  8519. .load('local') // dito
  8520. */
  8521. Validator.load = function(str) {
  8522. if (!str) return;
  8523. var doc = document,
  8524. params = {},
  8525. node = doc.scripts[0],
  8526. dir, el, ONLOAD;
  8527. str.replace(/([^?=&]+)=([^&#]*)/g, function(m, key, value){
  8528. params[key] = value;
  8529. });
  8530. dir = params.dir || Validator.dir;
  8531. if (!Validator.css && params.css !== '') {
  8532. el = doc.createElement('link');
  8533. el.rel = 'stylesheet';
  8534. el.href = Validator.css = dir + 'jquery.validator.css';
  8535. node.parentNode.insertBefore(el, node);
  8536. }
  8537. if (!Validator.local && ~str.indexOf('local') && params.local !== '') {
  8538. Validator.local = (params.local || doc.documentElement.lang || 'en').replace('_','-');
  8539. Validator.pending = 1;
  8540. el = doc.createElement('script');
  8541. el.src = dir + 'local/' + Validator.local + '.js';
  8542. ONLOAD = 'onload' in el ? 'onload' : 'onreadystatechange';
  8543. el[ONLOAD] = function() {
  8544. if (!el.readyState || /loaded|complete/.test(el.readyState)) {
  8545. el = el[ONLOAD] = null;
  8546. delete Validator.pending;
  8547. $(window).triggerHandler('validatorready');
  8548. }
  8549. };
  8550. node.parentNode.insertBefore(el, node);
  8551. }
  8552. };
  8553. // Auto loading resources
  8554. (function(){
  8555. var scripts = document.scripts,
  8556. i = scripts.length, node, arr,
  8557. re = /(.*validator(?:\.min)?.js)(\?.*(?:local|css|dir)(?:=[\w\-]*)?)?/;
  8558. while (i-- && !arr) {
  8559. node = scripts[i];
  8560. arr = (node.hasAttribute ? node.src : node.getAttribute('src',4)||'').match(re);
  8561. }
  8562. if (!arr) return;
  8563. Validator.dir = arr[1].split('/').slice(0, -1).join('/')+'/';
  8564. Validator.load(arr[2]);
  8565. })();
  8566. return $[NS] = Validator;
  8567. }));
  8568. /*********************************
  8569. * Themes, rules, and i18n support
  8570. * Locale: Chinese; 中文
  8571. *********************************/
  8572. (function(factory) {
  8573. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  8574. typeof define === 'function' && define.amd ? define('validator-lang',['jquery'], factory) :
  8575. factory(jQuery);
  8576. }(function($) {
  8577. /* Global configuration
  8578. */
  8579. $.validator.config({
  8580. //stopOnError: true,
  8581. //focusCleanup: true,
  8582. //theme: 'yellow_right',
  8583. //timely: 2,
  8584. // Custom rules
  8585. rules: {
  8586. digits: [/^\d+$/, "请填写数字"]
  8587. ,letters: [/^[a-z]+$/i, "请填写字母"]
  8588. ,date: [/^\d{4}-\d{2}-\d{2}$/, "请填写有效的日期,格式:yyyy-mm-dd"]
  8589. ,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请填写有效的时间,00:00到23:59之间"]
  8590. ,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "请填写有效的邮箱"]
  8591. ,url: [/^(https?|s?ftp):\/\/\S+$/i, "请填写有效的网址"]
  8592. ,qq: [/^[1-9]\d{4,}$/, "请填写有效的QQ号"]
  8593. ,IDcard: [/^\d{6}(19|2\d)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)?$/, "请填写正确的身份证号码"]
  8594. ,tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "请填写有效的电话号码"]
  8595. ,mobile: [/^1[3-9]\d{9}$/, "请填写有效的手机号"]
  8596. ,zipcode: [/^\d{6}$/, "请检查邮政编码格式"]
  8597. ,chinese: [/^[\u0391-\uFFE5]+$/, "请填写中文字符"]
  8598. ,username: [/^\w{3,12}$/, "请填写3-12位数字、字母、下划线"]
  8599. ,password: [/^[\S]{6,16}$/, "请填写6-16位字符,不能包含空格"]
  8600. ,accept: function (element, params){
  8601. if (!params) return true;
  8602. var ext = params[0],
  8603. value = $(element).val();
  8604. return (ext === '*') ||
  8605. (new RegExp(".(?:" + ext + ")$", "i")).test(value) ||
  8606. this.renderMsg("只接受{1}后缀的文件", ext.replace(/\|/g, ','));
  8607. }
  8608. },
  8609. // Default error messages
  8610. messages: {
  8611. 0: "此处",
  8612. fallback: "{0}格式不正确",
  8613. loading: "正在验证...",
  8614. error: "网络异常",
  8615. timeout: "请求超时",
  8616. required: "{0}不能为空",
  8617. remote: "{0}已被使用",
  8618. integer: {
  8619. '*': "请填写整数",
  8620. '+': "请填写正整数",
  8621. '+0': "请填写正整数或0",
  8622. '-': "请填写负整数",
  8623. '-0': "请填写负整数或0"
  8624. },
  8625. match: {
  8626. eq: "{0}与{1}不一致",
  8627. neq: "{0}与{1}不能相同",
  8628. lt: "{0}必须小于{1}",
  8629. gt: "{0}必须大于{1}",
  8630. lte: "{0}不能大于{1}",
  8631. gte: "{0}不能小于{1}"
  8632. },
  8633. range: {
  8634. rg: "请填写{1}到{2}的数",
  8635. gte: "请填写不小于{1}的数",
  8636. lte: "请填写最大{1}的数",
  8637. gtlt: "请填写{1}到{2}之间的数",
  8638. gt: "请填写大于{1}的数",
  8639. lt: "请填写小于{1}的数"
  8640. },
  8641. checked: {
  8642. eq: "请选择{1}项",
  8643. rg: "请选择{1}到{2}项",
  8644. gte: "请至少选择{1}项",
  8645. lte: "请最多选择{1}项"
  8646. },
  8647. length: {
  8648. eq: "请填写{1}个字符",
  8649. rg: "请填写{1}到{2}个字符",
  8650. gte: "请至少填写{1}个字符",
  8651. lte: "请最多填写{1}个字符",
  8652. eq_2: "",
  8653. rg_2: "",
  8654. gte_2: "",
  8655. lte_2: ""
  8656. }
  8657. }
  8658. });
  8659. /* Themes
  8660. */
  8661. var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
  8662. $.validator.setTheme({
  8663. 'simple_right': {
  8664. formClass: 'n-simple',
  8665. msgClass: 'n-right'
  8666. },
  8667. 'simple_bottom': {
  8668. formClass: 'n-simple',
  8669. msgClass: 'n-bottom'
  8670. },
  8671. 'yellow_top': {
  8672. formClass: 'n-yellow',
  8673. msgClass: 'n-top',
  8674. msgArrow: TPL_ARROW
  8675. },
  8676. 'yellow_right': {
  8677. formClass: 'n-yellow',
  8678. msgClass: 'n-right',
  8679. msgArrow: TPL_ARROW
  8680. },
  8681. 'yellow_right_effect': {
  8682. formClass: 'n-yellow',
  8683. msgClass: 'n-right',
  8684. msgArrow: TPL_ARROW,
  8685. msgShow: function($msgbox, type){
  8686. var $el = $msgbox.children();
  8687. if ($el.is(':animated')) return;
  8688. if (type === 'error') {
  8689. $el.css({left: '20px', opacity: 0})
  8690. .delay(100).show().stop()
  8691. .animate({left: '-4px', opacity: 1}, 150)
  8692. .animate({left: '3px'}, 80)
  8693. .animate({left: 0}, 80);
  8694. } else {
  8695. $el.css({left: 0, opacity: 1}).fadeIn(200);
  8696. }
  8697. },
  8698. msgHide: function($msgbox, type){
  8699. var $el = $msgbox.children();
  8700. $el.stop().delay(100).show()
  8701. .animate({left: '20px', opacity: 0}, 300, function(){
  8702. $msgbox.hide();
  8703. });
  8704. }
  8705. }
  8706. });
  8707. }));
  8708. define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'], function ($, undefined, Upload, Validator, undefined) {
  8709. var Form = {
  8710. config: {
  8711. fieldlisttpl: '<dd class="form-inline"><input type="text" name="<%=name%>[<%=index%>][key]" class="form-control" value="<%=row.key%>" size="10" /> <input type="text" name="<%=name%>[<%=index%>][value]" class="form-control" value="<%=row.value%>" /> <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span></dd>'
  8712. },
  8713. events: {
  8714. validator: function (form, success, error, submit) {
  8715. if (!form.is("form"))
  8716. return;
  8717. //绑定表单事件
  8718. form.validator($.extend({
  8719. validClass: 'has-success',
  8720. invalidClass: 'has-error',
  8721. bindClassTo: '.form-group',
  8722. formClass: 'n-default n-bootstrap',
  8723. msgClass: 'n-right',
  8724. stopOnError: true,
  8725. display: function (elem) {
  8726. return $(elem).closest('.form-group').find(".control-label").text().replace(/\:/, '');
  8727. },
  8728. dataFilter: function (data) {
  8729. if (data.code === 1) {
  8730. return data.msg ? {"ok": data.msg} : '';
  8731. } else {
  8732. return data.msg;
  8733. }
  8734. },
  8735. target: function (input) {
  8736. var target = $(input).data("target");
  8737. if (target && $(target).size() > 0) {
  8738. return $(target);
  8739. }
  8740. var $formitem = $(input).closest('.form-group'),
  8741. $msgbox = $formitem.find('span.msg-box');
  8742. if (!$msgbox.length) {
  8743. return [];
  8744. }
  8745. return $msgbox;
  8746. },
  8747. valid: function (ret) {
  8748. var that = this, submitBtn = $(".layer-footer [type=submit]", form);
  8749. that.holdSubmit(true);
  8750. submitBtn.addClass("disabled");
  8751. //验证通过提交表单
  8752. var submitResult = Form.api.submit($(ret), function (data, ret) {
  8753. that.holdSubmit(false);
  8754. submitBtn.removeClass("disabled");
  8755. if (false === $(this).triggerHandler("success.form", [data, ret])) {
  8756. return false;
  8757. }
  8758. if (typeof success === 'function') {
  8759. if (false === success.call($(this), data, ret)) {
  8760. return false;
  8761. }
  8762. }
  8763. //提示及关闭当前窗口
  8764. var msg = ret.hasOwnProperty("msg") && ret.msg !== "" ? ret.msg : __('Operation completed');
  8765. parent.Toastr.success(msg);
  8766. parent.$(".btn-refresh").trigger("click");
  8767. var index = parent.Layer.getFrameIndex(window.name);
  8768. parent.Layer.close(index);
  8769. return false;
  8770. }, function (data, ret) {
  8771. that.holdSubmit(false);
  8772. if (false === $(this).triggerHandler("error.form", [data, ret])) {
  8773. return false;
  8774. }
  8775. submitBtn.removeClass("disabled");
  8776. if (typeof error === 'function') {
  8777. if (false === error.call($(this), data, ret)) {
  8778. return false;
  8779. }
  8780. }
  8781. }, submit);
  8782. //如果提交失败则释放锁定
  8783. if (!submitResult) {
  8784. that.holdSubmit(false);
  8785. submitBtn.removeClass("disabled");
  8786. }
  8787. return false;
  8788. }
  8789. }, form.data("validator-options") || {}));
  8790. //移除提交按钮的disabled类
  8791. $(".layer-footer [type=submit],.fixed-footer [type=submit],.normal-footer [type=submit]", form).removeClass("disabled");
  8792. //自定义关闭按钮事件
  8793. form.on("click", ".layer-close", function () {
  8794. var index = parent.Layer.getFrameIndex(window.name);
  8795. parent.Layer.close(index);
  8796. return false;
  8797. });
  8798. },
  8799. selectpicker: function (form) {
  8800. //绑定select元素事件
  8801. if ($(".selectpicker", form).size() > 0) {
  8802. require(['bootstrap-select', 'bootstrap-select-lang'], function () {
  8803. $('.selectpicker', form).selectpicker();
  8804. $(form).on("reset", function () {
  8805. setTimeout(function () {
  8806. $('.selectpicker').selectpicker('refresh').trigger("change");
  8807. }, 1);
  8808. });
  8809. });
  8810. }
  8811. },
  8812. selectpage: function (form) {
  8813. //绑定selectpage元素事件
  8814. if ($(".selectpage", form).size() > 0) {
  8815. require(['selectpage'], function () {
  8816. $('.selectpage', form).selectPage({
  8817. eAjaxSuccess: function (data) {
  8818. data.list = typeof data.rows !== 'undefined' ? data.rows : (typeof data.list !== 'undefined' ? data.list : []);
  8819. data.totalRow = typeof data.total !== 'undefined' ? data.total : (typeof data.totalRow !== 'undefined' ? data.totalRow : data.list.length);
  8820. return data;
  8821. }
  8822. });
  8823. });
  8824. //给隐藏的元素添加上validate验证触发事件
  8825. $(document).on("change", ".sp_hidden", function () {
  8826. $(this).trigger("validate");
  8827. });
  8828. $(document).on("change", ".sp_input", function () {
  8829. $(this).closest(".sp_container").find(".sp_hidden").trigger("change");
  8830. });
  8831. $(form).on("reset", function () {
  8832. setTimeout(function () {
  8833. $('.selectpage', form).selectPageClear();
  8834. }, 1);
  8835. });
  8836. }
  8837. },
  8838. cxselect: function (form) {
  8839. //绑定cxselect元素事件
  8840. if ($("[data-toggle='cxselect']", form).size() > 0) {
  8841. require(['cxselect'], function () {
  8842. $.cxSelect.defaults.jsonName = 'name';
  8843. $.cxSelect.defaults.jsonValue = 'value';
  8844. $.cxSelect.defaults.jsonSpace = 'data';
  8845. $("[data-toggle='cxselect']", form).cxSelect();
  8846. });
  8847. }
  8848. },
  8849. citypicker: function (form) {
  8850. //绑定城市远程插件
  8851. if ($("[data-toggle='city-picker']", form).size() > 0) {
  8852. require(['citypicker'], function () {
  8853. $(form).on("reset", function () {
  8854. setTimeout(function () {
  8855. $("[data-toggle='city-picker']").citypicker('refresh');
  8856. }, 1);
  8857. });
  8858. });
  8859. }
  8860. },
  8861. datetimepicker: function (form) {
  8862. //绑定日期时间元素事件
  8863. if ($(".datetimepicker", form).size() > 0) {
  8864. require(['bootstrap-datetimepicker'], function () {
  8865. var options = {
  8866. format: 'YYYY-MM-DD HH:mm:ss',
  8867. icons: {
  8868. time: 'fa fa-clock-o',
  8869. date: 'fa fa-calendar',
  8870. up: 'fa fa-chevron-up',
  8871. down: 'fa fa-chevron-down',
  8872. previous: 'fa fa-chevron-left',
  8873. next: 'fa fa-chevron-right',
  8874. today: 'fa fa-history',
  8875. clear: 'fa fa-trash',
  8876. close: 'fa fa-remove'
  8877. },
  8878. showTodayButton: true,
  8879. showClose: true
  8880. };
  8881. $('.datetimepicker', form).parent().css('position', 'relative');
  8882. $('.datetimepicker', form).datetimepicker(options).on('dp.change', function (e) {
  8883. $(this, document).trigger("changed");
  8884. });
  8885. });
  8886. }
  8887. },
  8888. daterangepicker: function (form) {
  8889. //绑定日期时间元素事件
  8890. if ($(".datetimerange", form).size() > 0) {
  8891. require(['bootstrap-daterangepicker'], function () {
  8892. var ranges = {};
  8893. ranges[__('Today')] = [Moment().startOf('day'), Moment().endOf('day')];
  8894. ranges[__('Yesterday')] = [Moment().subtract(1, 'days').startOf('day'), Moment().subtract(1, 'days').endOf('day')];
  8895. ranges[__('Last 7 Days')] = [Moment().subtract(6, 'days').startOf('day'), Moment().endOf('day')];
  8896. ranges[__('Last 30 Days')] = [Moment().subtract(29, 'days').startOf('day'), Moment().endOf('day')];
  8897. ranges[__('This Month')] = [Moment().startOf('month'), Moment().endOf('month')];
  8898. ranges[__('Last Month')] = [Moment().subtract(1, 'month').startOf('month'), Moment().subtract(1, 'month').endOf('month')];
  8899. var options = {
  8900. timePicker: false,
  8901. autoUpdateInput: false,
  8902. timePickerSeconds: true,
  8903. timePicker24Hour: true,
  8904. autoApply: true,
  8905. locale: {
  8906. format: 'YYYY-MM-DD HH:mm:ss',
  8907. customRangeLabel: __("Custom Range"),
  8908. applyLabel: __("Apply"),
  8909. cancelLabel: __("Clear"),
  8910. },
  8911. ranges: ranges,
  8912. };
  8913. var origincallback = function (start, end) {
  8914. $(this.element).val(start.format(this.locale.format) + " - " + end.format(this.locale.format));
  8915. $(this.element).trigger('blur');
  8916. };
  8917. $(".datetimerange", form).each(function () {
  8918. var callback = typeof $(this).data('callback') == 'function' ? $(this).data('callback') : origincallback;
  8919. $(this).on('apply.daterangepicker', function (ev, picker) {
  8920. callback.call(picker, picker.startDate, picker.endDate);
  8921. });
  8922. $(this).on('cancel.daterangepicker', function (ev, picker) {
  8923. $(this).val('').trigger('blur');
  8924. });
  8925. $(this).daterangepicker($.extend(true, options, $(this).data()), callback);
  8926. });
  8927. });
  8928. }
  8929. },
  8930. /**
  8931. * 绑定上传事件
  8932. * @param form
  8933. * @deprecated Use faupload instead.
  8934. */
  8935. plupload: function (form) {
  8936. Form.events.faupload(form);
  8937. },
  8938. /**
  8939. * 绑定上传事件
  8940. * @param form
  8941. */
  8942. faupload: function (form) {
  8943. //绑定上传元素事件
  8944. if ($(".plupload,.faupload", form).size() > 0) {
  8945. Upload.api.upload($(".plupload,.faupload", form));
  8946. }
  8947. },
  8948. faselect: function (form) {
  8949. //绑定fachoose选择附件事件
  8950. if ($(".faselect,.fachoose", form).size() > 0) {
  8951. $(".faselect,.fachoose", form).off('click').on('click', function () {
  8952. var that = this;
  8953. var multiple = $(this).data("multiple") ? $(this).data("multiple") : false;
  8954. var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : '';
  8955. var admin_id = $(this).data("admin-id") ? $(this).data("admin-id") : '';
  8956. var user_id = $(this).data("user-id") ? $(this).data("user-id") : '';
  8957. var url = $(this).data("url") ? $(this).data("url") : (typeof Backend !== 'undefined' ? "general/attachment/select" : "user/attachment");
  8958. parent.Fast.api.open(url + "?element_id=" + $(this).attr("id") + "&multiple=" + multiple + "&mimetype=" + mimetype + "&admin_id=" + admin_id + "&user_id=" + user_id, __('Choose'), {
  8959. callback: function (data) {
  8960. var button = $("#" + $(that).attr("id"));
  8961. var maxcount = $(button).data("maxcount");
  8962. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  8963. maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
  8964. if (input_id && data.multiple) {
  8965. var urlArr = [];
  8966. var inputObj = $("#" + input_id);
  8967. var value = $.trim(inputObj.val());
  8968. if (value !== "") {
  8969. urlArr.push(inputObj.val());
  8970. }
  8971. urlArr.push(data.url)
  8972. var result = urlArr.join(",");
  8973. if (maxcount > 0) {
  8974. var nums = value === '' ? 0 : value.split(/\,/).length;
  8975. var files = data.url !== "" ? data.url.split(/\,/) : [];
  8976. var remains = maxcount - nums;
  8977. if (files.length > remains) {
  8978. Toastr.error(__('You can choose up to %d file%s', remains));
  8979. return false;
  8980. }
  8981. }
  8982. inputObj.val(result).trigger("change").trigger("validate");
  8983. } else {
  8984. $("#" + input_id).val(data.url).trigger("change").trigger("validate");
  8985. }
  8986. }
  8987. });
  8988. return false;
  8989. });
  8990. }
  8991. },
  8992. fieldlist: function (form) {
  8993. //绑定fieldlist
  8994. if ($(".fieldlist", form).size() > 0) {
  8995. require(['dragsort', 'template'], function (undefined, Template) {
  8996. //刷新隐藏textarea的值
  8997. var refresh = function (name) {
  8998. var data = {};
  8999. var textarea = $("textarea[name='" + name + "']", form);
  9000. var container = $(".fieldlist[data-name='" + name + "']");
  9001. var template = container.data("template");
  9002. $.each($("input,select,textarea", container).serializeArray(), function (i, j) {
  9003. var reg = /\[(\w+)\]\[(\w+)\]$/g;
  9004. var match = reg.exec(j.name);
  9005. if (!match)
  9006. return true;
  9007. match[1] = "x" + parseInt(match[1]);
  9008. if (typeof data[match[1]] == 'undefined') {
  9009. data[match[1]] = {};
  9010. }
  9011. data[match[1]][match[2]] = j.value;
  9012. });
  9013. var result = template ? [] : {};
  9014. $.each(data, function (i, j) {
  9015. if (j) {
  9016. if (!template) {
  9017. if (j.key != '') {
  9018. result[j.key] = j.value;
  9019. }
  9020. } else {
  9021. result.push(j);
  9022. }
  9023. }
  9024. });
  9025. textarea.val(JSON.stringify(result));
  9026. };
  9027. //监听文本框改变事件
  9028. $(document).on('change keyup changed', ".fieldlist input,.fieldlist textarea,.fieldlist select", function () {
  9029. refresh($(this).closest(".fieldlist").data("name"));
  9030. });
  9031. //追加控制
  9032. $(".fieldlist", form).on("click", ".btn-append,.append", function (e, row) {
  9033. var container = $(this).closest(".fieldlist");
  9034. var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
  9035. var index = container.data("index");
  9036. var name = container.data("name");
  9037. var template = container.data("template");
  9038. var data = container.data();
  9039. index = index ? parseInt(index) : 0;
  9040. container.data("index", index + 1);
  9041. row = row ? row : {};
  9042. var vars = {index: index, name: name, data: data, row: row};
  9043. var html = template ? Template(template, vars) : Template.render(Form.config.fieldlisttpl, vars);
  9044. $(html).attr("fieldlist-item", true).insertBefore($(tagName + ":last", container));
  9045. $(this).trigger("fa.event.appendfieldlist", $(this).closest(tagName).prev());
  9046. });
  9047. //移除控制
  9048. $(".fieldlist", form).on("click", ".btn-remove", function () {
  9049. var container = $(this).closest(".fieldlist");
  9050. var tagName = container.data("tag") || (container.is("table") ? "tr" : "dd");
  9051. $(this).closest(tagName).remove();
  9052. refresh(container.data("name"));
  9053. });
  9054. //渲染数据&拖拽排序
  9055. $(".fieldlist", form).each(function () {
  9056. var container = this;
  9057. var tagName = $(this).data("tag") || ($(this).is("table") ? "tr" : "dd");
  9058. $(this).dragsort({
  9059. itemSelector: tagName,
  9060. dragSelector: ".btn-dragsort",
  9061. dragEnd: function () {
  9062. refresh($(this).closest(".fieldlist").data("name"));
  9063. },
  9064. placeHolderTemplate: $("<" + tagName + "/>")
  9065. });
  9066. var textarea = $("textarea[name='" + $(this).data("name") + "']", form);
  9067. if (textarea.val() == '') {
  9068. return true;
  9069. }
  9070. var template = $(this).data("template");
  9071. textarea.on("fa.event.refreshfieldlist", function () {
  9072. $("[fieldlist-item]", container).remove();
  9073. var json = {};
  9074. try {
  9075. json = JSON.parse($(this).val());
  9076. } catch (e) {
  9077. }
  9078. $.each(json, function (i, j) {
  9079. $(".btn-append,.append", container).trigger('click', template ? j : {
  9080. key: i, value: j
  9081. });
  9082. });
  9083. });
  9084. textarea.trigger("fa.event.refreshfieldlist");
  9085. });
  9086. });
  9087. }
  9088. },
  9089. switcher: function (form) {
  9090. form.on("click", "[data-toggle='switcher']", function () {
  9091. if ($(this).hasClass("disabled")) {
  9092. return false;
  9093. }
  9094. var switcher = $.proxy(function () {
  9095. var input = $(this).prev("input");
  9096. input = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : input;
  9097. if (input.size() > 0) {
  9098. var yes = $(this).data("yes");
  9099. var no = $(this).data("no");
  9100. if (input.val() == yes) {
  9101. input.val(no);
  9102. $("i", this).addClass("fa-flip-horizontal text-gray");
  9103. } else {
  9104. input.val(yes);
  9105. $("i", this).removeClass("fa-flip-horizontal text-gray");
  9106. }
  9107. input.trigger('change');
  9108. }
  9109. }, this);
  9110. if (typeof $(this).data("confirm") !== 'undefined') {
  9111. Layer.confirm($(this).data("confirm"), function (index) {
  9112. switcher();
  9113. Layer.close(index);
  9114. });
  9115. } else {
  9116. switcher();
  9117. }
  9118. return false;
  9119. });
  9120. },
  9121. bindevent: function (form) {
  9122. },
  9123. slider: function (form) {
  9124. if ($(".slider", form).size() > 0) {
  9125. require(['bootstrap-slider'], function () {
  9126. $('.slider').removeClass('hidden').css('width', function (index, value) {
  9127. return $(this).parents('.form-control').width();
  9128. }).slider().on('slide', function (ev) {
  9129. var data = $(this).data();
  9130. if (typeof data.unit !== 'undefined') {
  9131. $(this).parents('.form-control').siblings('.value').text(ev.value + data.unit);
  9132. }
  9133. });
  9134. });
  9135. }
  9136. }
  9137. },
  9138. api: {
  9139. submit: function (form, success, error, submit) {
  9140. if (form.size() === 0) {
  9141. Toastr.error("表单未初始化完成,无法提交");
  9142. return false;
  9143. }
  9144. if (typeof submit === 'function') {
  9145. if (false === submit.call(form, success, error)) {
  9146. return false;
  9147. }
  9148. }
  9149. var type = form.attr("method") ? form.attr("method").toUpperCase() : 'GET';
  9150. type = type && (type === 'GET' || type === 'POST') ? type : 'GET';
  9151. url = form.attr("action");
  9152. url = url ? url : location.href;
  9153. //修复当存在多选项元素时提交的BUG
  9154. var params = {};
  9155. var multipleList = $("[name$='[]']", form);
  9156. if (multipleList.size() > 0) {
  9157. var postFields = form.serializeArray().map(function (obj) {
  9158. return $(obj).prop("name");
  9159. });
  9160. $.each(multipleList, function (i, j) {
  9161. if (postFields.indexOf($(this).prop("name")) < 0) {
  9162. params[$(this).prop("name")] = '';
  9163. }
  9164. });
  9165. }
  9166. //调用Ajax请求方法
  9167. Fast.api.ajax({
  9168. type: type,
  9169. url: url,
  9170. data: form.serialize() + (Object.keys(params).length > 0 ? '&' + $.param(params) : ''),
  9171. dataType: 'json',
  9172. complete: function (xhr) {
  9173. var token = xhr.getResponseHeader('__token__');
  9174. if (token) {
  9175. $("input[name='__token__']").val(token);
  9176. }
  9177. }
  9178. }, function (data, ret) {
  9179. $('.form-group', form).removeClass('has-feedback has-success has-error');
  9180. if (data && typeof data === 'object') {
  9181. //刷新客户端token
  9182. if (typeof data.token !== 'undefined') {
  9183. $("input[name='__token__']").val(data.token);
  9184. }
  9185. //调用客户端事件
  9186. if (typeof data.callback !== 'undefined' && typeof data.callback === 'function') {
  9187. data.callback.call(form, data);
  9188. }
  9189. }
  9190. if (typeof success === 'function') {
  9191. if (false === success.call(form, data, ret)) {
  9192. return false;
  9193. }
  9194. }
  9195. }, function (data, ret) {
  9196. if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
  9197. $("input[name='__token__']").val(data.token);
  9198. }
  9199. if (typeof error === 'function') {
  9200. if (false === error.call(form, data, ret)) {
  9201. return false;
  9202. }
  9203. }
  9204. });
  9205. return true;
  9206. },
  9207. bindevent: function (form, success, error, submit) {
  9208. form = typeof form === 'object' ? form : $(form);
  9209. var events = Form.events;
  9210. events.bindevent(form);
  9211. events.validator(form, success, error, submit);
  9212. events.selectpicker(form);
  9213. events.daterangepicker(form);
  9214. events.selectpage(form);
  9215. events.cxselect(form);
  9216. events.citypicker(form);
  9217. events.datetimepicker(form);
  9218. events.faupload(form);
  9219. events.faselect(form);
  9220. events.fieldlist(form);
  9221. events.slider(form);
  9222. events.switcher(form);
  9223. },
  9224. custom: {}
  9225. },
  9226. };
  9227. return Form;
  9228. });
  9229. /**
  9230. * FastAdmin通用搜索
  9231. *
  9232. * @author: pppscn <35696959@qq.com>
  9233. * @update 2017-05-07 <https://gitee.com/pp/fastadmin>
  9234. *
  9235. * @author: Karson <karsonzhang@163.com>
  9236. * @update 2018-04-05 <https://gitee.com/karson/fastadmin>
  9237. */
  9238. !function ($) {
  9239. 'use strict';
  9240. var ColumnsForSearch = [];
  9241. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  9242. var initCommonSearch = function (pColumns, that) {
  9243. var vFormCommon = createFormCommon(pColumns, that);
  9244. var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden");
  9245. vModal += vFormCommon;
  9246. vModal += "</div>";
  9247. that.$container.prepend($(vModal));
  9248. that.$commonsearch = $(".commonsearch-table", that.$container);
  9249. var form = $("form.form-commonsearch", that.$commonsearch);
  9250. require(['form'], function (Form) {
  9251. Form.api.bindevent(form);
  9252. form.validator("destroy");
  9253. });
  9254. // 表单提交
  9255. form.on("submit", function (event) {
  9256. event.preventDefault();
  9257. that.onCommonSearch();
  9258. return false;
  9259. });
  9260. // 重置搜索
  9261. form.on("click", "button[type=reset]", function (event) {
  9262. form[0].reset();
  9263. setTimeout(function () {
  9264. that.onCommonSearch();
  9265. }, 0);
  9266. });
  9267. };
  9268. var createFormCommon = function (pColumns, that) {
  9269. // 如果有使用模板则直接返回模板的内容
  9270. if (that.options.searchFormTemplate) {
  9271. return Template(that.options.searchFormTemplate, {columns: pColumns, table: that});
  9272. }
  9273. var htmlForm = [];
  9274. htmlForm.push(sprintf('<form class="form-horizontal form-commonsearch" novalidate method="post" action="%s" >', that.options.actionForm));
  9275. htmlForm.push('<fieldset>');
  9276. if (that.options.titleForm.length > 0)
  9277. htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
  9278. htmlForm.push('<div class="row">');
  9279. for (var i in pColumns) {
  9280. var vObjCol = pColumns[i];
  9281. if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
  9282. var query = Fast.api.query(vObjCol.field);
  9283. var operate = Fast.api.query(vObjCol.field + "-operate");
  9284. var renderDefault = that.options.renderDefault && (typeof vObjCol.renderDefault == 'undefined' || vObjCol.renderDefault);
  9285. vObjCol.defaultValue = renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue);
  9286. vObjCol.operate = renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate);
  9287. ColumnsForSearch.push(vObjCol);
  9288. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  9289. htmlForm.push(sprintf('<label for="%s" class="control-label col-xs-4">%s</label>', vObjCol.field, vObjCol.title));
  9290. htmlForm.push('<div class="col-xs-8">');
  9291. vObjCol.operate = vObjCol.operate ? vObjCol.operate.toUpperCase() : '=';
  9292. 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));
  9293. var addClass = typeof vObjCol.addClass === 'undefined' ? (typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass) : 'form-control ' + vObjCol.addClass;
  9294. var extend = typeof vObjCol.extend === 'undefined' ? '' : vObjCol.extend;
  9295. var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style);
  9296. extend = typeof vObjCol.data !== 'undefined' && extend == '' ? vObjCol.data : extend;
  9297. extend = typeof vObjCol.autocomplete !== 'undefined' ? extend + ' autocomplete="' + (vObjCol.autocomplete === false || vObjCol.autocomplete === 'off' ? 'off' : 'on') + '"' : extend;
  9298. if (vObjCol.searchList) {
  9299. if (typeof vObjCol.searchList === 'function') {
  9300. htmlForm.push(vObjCol.searchList.call(this, vObjCol));
  9301. } else {
  9302. var optionList = [sprintf('<option value="">%s</option>', that.options.formatCommonChoose())];
  9303. if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') {
  9304. (function (vObjCol, that) {
  9305. $.when(vObjCol.searchList).done(function (ret) {
  9306. var searchList = [];
  9307. if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) {
  9308. searchList = ret.data.searchlist;
  9309. } else if (ret.constructor === Array || ret.constructor === Object) {
  9310. searchList = ret;
  9311. }
  9312. var optionList = createOptionList(searchList, vObjCol, that);
  9313. $("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).html(optionList.join('')).trigger("change");
  9314. });
  9315. })(vObjCol, that);
  9316. } else {
  9317. optionList = createOptionList(vObjCol.searchList, vObjCol, that);
  9318. }
  9319. htmlForm.push(sprintf('<select class="%s" name="%s" %s %s>%s</select>', addClass, vObjCol.field, style, extend, optionList.join('')));
  9320. }
  9321. } else {
  9322. var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder;
  9323. var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type;
  9324. var defaultValue = typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue;
  9325. if (/BETWEEN$/.test(vObjCol.operate)) {
  9326. var defaultValueArr = defaultValue.toString().match(/\|/) ? defaultValue.split('|') : ['', ''];
  9327. var placeholderArr = placeholder.toString().match(/\|/) ? placeholder.split('|') : [placeholder, placeholder];
  9328. htmlForm.push('<div class="row row-between">');
  9329. 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));
  9330. 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));
  9331. htmlForm.push('</div>');
  9332. } else {
  9333. 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));
  9334. }
  9335. }
  9336. htmlForm.push('</div>');
  9337. htmlForm.push('</div>');
  9338. }
  9339. }
  9340. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  9341. htmlForm.push(createFormBtn(that).join(''));
  9342. htmlForm.push('</div>');
  9343. htmlForm.push('</div>');
  9344. htmlForm.push('</fieldset>');
  9345. htmlForm.push('</form>');
  9346. return htmlForm.join('');
  9347. };
  9348. var createFormBtn = function (that) {
  9349. var htmlBtn = [];
  9350. var searchSubmit = that.options.formatCommonSubmitButton();
  9351. var searchReset = that.options.formatCommonResetButton();
  9352. htmlBtn.push('<div class="col-sm-8 col-xs-offset-4">');
  9353. htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" formnovalidate>%s</button> ', searchSubmit));
  9354. htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
  9355. htmlBtn.push('</div>');
  9356. return htmlBtn;
  9357. };
  9358. var createOptionList = function (searchList, vObjCol, that) {
  9359. var isArray = searchList.constructor === Array;
  9360. var optionList = [];
  9361. optionList.push(sprintf('<option value="">%s</option>', that.options.formatCommonChoose()));
  9362. $.each(searchList, function (key, value) {
  9363. if (value.constructor === Object) {
  9364. key = value.id;
  9365. value = value.name;
  9366. } else {
  9367. key = isArray ? value : key;
  9368. }
  9369. optionList.push(sprintf("<option value='" + key + "' %s>" + value + "</option>", key == vObjCol.defaultValue ? 'selected' : ''));
  9370. });
  9371. return optionList;
  9372. };
  9373. var isSearchAvailble = function (that) {
  9374. //只支持服务端搜索
  9375. if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) {
  9376. return false;
  9377. }
  9378. return true;
  9379. };
  9380. var getSearchQuery = function (that, removeempty) {
  9381. var op = {};
  9382. var filter = {};
  9383. var value = '';
  9384. $("form.form-commonsearch .operate", that.$commonsearch).each(function (i) {
  9385. var name = $(this).data("name");
  9386. var sym = $(this).is("select") ? $("option:selected", this).val() : $(this).val().toUpperCase();
  9387. var obj = $("[name='" + name + "']", that.$commonsearch);
  9388. if (obj.size() == 0)
  9389. return true;
  9390. var vObjCol = ColumnsForSearch[i];
  9391. var process = !that.options.searchFormTemplate && vObjCol && typeof vObjCol.process == 'function' ? vObjCol.process : null;
  9392. if (obj.size() > 1) {
  9393. if (/BETWEEN$/.test(sym)) {
  9394. var value_begin = $.trim($("[name='" + name + "']:first", that.$commonsearch).val()),
  9395. value_end = $.trim($("[name='" + name + "']:last", that.$commonsearch).val());
  9396. if (value_begin.length || value_end.length) {
  9397. if (process) {
  9398. value_begin = process(value_begin, 'begin');
  9399. value_end = process(value_end, 'end');
  9400. }
  9401. value = value_begin + ',' + value_end;
  9402. } else {
  9403. value = '';
  9404. }
  9405. //如果是时间筛选,将operate置为RANGE
  9406. if ($("[name='" + name + "']:first", that.$commonsearch).hasClass("datetimepicker")) {
  9407. sym = 'RANGE';
  9408. }
  9409. } else {
  9410. value = $("[name='" + name + "']:checked", that.$commonsearch).val();
  9411. value = process ? process(value) : value;
  9412. }
  9413. } else {
  9414. value = process ? process(obj.val()) : obj.val();
  9415. }
  9416. if (removeempty && (value == '' || value == null || ($.isArray(value) && value.length == 0)) && !sym.match(/null/i)) {
  9417. return true;
  9418. }
  9419. op[name] = sym;
  9420. filter[name] = value;
  9421. });
  9422. return {op: op, filter: filter};
  9423. };
  9424. var getQueryParams = function (params, searchQuery, removeempty) {
  9425. params.filter = typeof params.filter === 'Object' ? params.filter : (params.filter ? JSON.parse(params.filter) : {});
  9426. params.op = typeof params.op === 'Object' ? params.op : (params.op ? JSON.parse(params.op) : {});
  9427. params.filter = $.extend({}, params.filter, searchQuery.filter);
  9428. params.op = $.extend({}, params.op, searchQuery.op);
  9429. //移除empty的值
  9430. if (removeempty) {
  9431. $.each(params.filter, function (i, j) {
  9432. if ((j == '' || j == null || ($.isArray(j) && j.length == 0)) && !params.op[i].match(/null/i)) {
  9433. delete params.filter[i];
  9434. delete params.op[i];
  9435. }
  9436. });
  9437. }
  9438. params.filter = JSON.stringify(params.filter);
  9439. params.op = JSON.stringify(params.op);
  9440. return params;
  9441. };
  9442. $.extend($.fn.bootstrapTable.defaults, {
  9443. commonSearch: false,
  9444. titleForm: "Common search",
  9445. actionForm: "",
  9446. searchFormTemplate: "",
  9447. searchFormVisible: true,
  9448. searchClass: 'searchit',
  9449. showSearch: true,
  9450. renderDefault: true,
  9451. onCommonSearch: function (field, text) {
  9452. return false;
  9453. },
  9454. onPostCommonSearch: function (table) {
  9455. return false;
  9456. }
  9457. });
  9458. $.extend($.fn.bootstrapTable.defaults.icons, {
  9459. commonSearchIcon: 'glyphicon-search'
  9460. });
  9461. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  9462. 'common-search.bs.table': 'onCommonSearch',
  9463. 'post-common-search.bs.table': 'onPostCommonSearch'
  9464. });
  9465. $.extend($.fn.bootstrapTable.locales[$.fn.bootstrapTable.defaults.locale], {
  9466. formatCommonSearch: function () {
  9467. return "Common search";
  9468. },
  9469. formatCommonSubmitButton: function () {
  9470. return "Submit";
  9471. },
  9472. formatCommonResetButton: function () {
  9473. return "Reset";
  9474. },
  9475. formatCommonCloseButton: function () {
  9476. return "Close";
  9477. },
  9478. formatCommonChoose: function () {
  9479. return "Choose";
  9480. }
  9481. });
  9482. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  9483. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9484. _initHeader = BootstrapTable.prototype.initHeader,
  9485. _initToolbar = BootstrapTable.prototype.initToolbar,
  9486. _load = BootstrapTable.prototype.load,
  9487. _initSearch = BootstrapTable.prototype.initSearch;
  9488. BootstrapTable.prototype.initHeader = function () {
  9489. _initHeader.apply(this, Array.prototype.slice.apply(arguments));
  9490. this.$header.find('th[data-field]').each(function (i) {
  9491. var column = $(this).data();
  9492. if (typeof column['width'] !== 'undefined' && column['width'].toString().indexOf("%") === -1) {
  9493. $(".th-inner", this).outerWidth(column['width']);
  9494. $(this).css("max-width", column['width']);
  9495. }
  9496. });
  9497. this.options.stateField = this.header.stateField;
  9498. };
  9499. BootstrapTable.prototype.initToolbar = function () {
  9500. _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
  9501. if (!isSearchAvailble(this)) {
  9502. return;
  9503. }
  9504. var that = this,
  9505. html = [];
  9506. if (that.options.showSearch) {
  9507. html.push(sprintf('<div class="columns-%s pull-%s" style="margin-top:10px;margin-bottom:10px;">', this.options.buttonsAlign, this.options.buttonsAlign));
  9508. 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()));
  9509. html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.commonSearchIcon))
  9510. html.push('</button></div>');
  9511. }
  9512. if (that.$toolbar.find(".pull-right").size() > 0) {
  9513. $(html.join('')).insertBefore(that.$toolbar.find(".pull-right:first"));
  9514. } else {
  9515. that.$toolbar.append(html.join(''));
  9516. }
  9517. initCommonSearch(that.columns, that);
  9518. that.$toolbar.find('button[name="commonSearch"]')
  9519. .off('click').on('click', function () {
  9520. that.$commonsearch.toggleClass("hidden");
  9521. return;
  9522. });
  9523. that.$container.on("click", "." + that.options.searchClass, function () {
  9524. var value = $(this).data("value");
  9525. var field = $(this).data("field");
  9526. var ul = that.$container.closest(".panel-intro").find("ul[data-field='" + field + "']");
  9527. if (ul.length > 0) {
  9528. $('li a[data-value="' + value + '"][data-toggle="tab"]', ul).trigger('click');
  9529. return;
  9530. }
  9531. var obj = $("form [name='" + field + "']", that.$commonsearch);
  9532. if (obj.size() > 0) {
  9533. if (obj.is("select")) {
  9534. $("option[value='" + value + "']", obj).prop("selected", true);
  9535. } else if (obj.size() > 1) {
  9536. $("form [name='" + field + "'][value='" + value + "']", that.$commonsearch).prop("checked", true);
  9537. } else {
  9538. obj.val(value + "");
  9539. }
  9540. obj.trigger("change");
  9541. $("form", that.$commonsearch).trigger("submit");
  9542. }
  9543. });
  9544. var queryParams = that.options.queryParams;
  9545. //匹配默认搜索值
  9546. this.options.queryParams = function (params) {
  9547. return queryParams(getQueryParams(params, getSearchQuery(that, true)));
  9548. };
  9549. this.trigger('post-common-search', that);
  9550. };
  9551. BootstrapTable.prototype.onCommonSearch = function () {
  9552. var searchQuery = getSearchQuery(this);
  9553. this.trigger('common-search', this, searchQuery);
  9554. this.options.pageNumber = 1;
  9555. //this.options.pageSize = $.fn.bootstrapTable.defaults.pageSize;
  9556. this.refresh({});
  9557. };
  9558. BootstrapTable.prototype.load = function (data) {
  9559. _load.apply(this, Array.prototype.slice.apply(arguments));
  9560. if (!isSearchAvailble(this)) {
  9561. return;
  9562. }
  9563. };
  9564. BootstrapTable.prototype.initSearch = function () {
  9565. _initSearch.apply(this, Array.prototype.slice.apply(arguments));
  9566. if (!isSearchAvailble(this)) {
  9567. return;
  9568. }
  9569. var that = this;
  9570. var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
  9571. this.data = fp ? $.grep(this.data, function (item, i) {
  9572. for (var key in fp) {
  9573. var fval = fp[key].toLowerCase();
  9574. var value = item[key];
  9575. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
  9576. that.header.formatters[$.inArray(key, that.header.fields)],
  9577. [value, item, i], value);
  9578. if (!($.inArray(key, that.header.fields) !== -1 &&
  9579. (typeof value === 'string' || typeof value === 'number') &&
  9580. (value + '').toLowerCase().indexOf(fval) !== -1)) {
  9581. return false;
  9582. }
  9583. }
  9584. return true;
  9585. }) : this.data;
  9586. };
  9587. }(jQuery);
  9588. define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) {
  9589. return function () {
  9590. var ret, fn;
  9591. return ret || global.$.fn.bootstrapTable.defaults;
  9592. };
  9593. }(this)));
  9594. /**
  9595. * 将BootstrapTable的行使用自定义的模板来渲染
  9596. *
  9597. * @author: karson
  9598. * @version: v0.0.1
  9599. *
  9600. * @update 2017-06-24 <http://github.com/karsonzhang/fastadmin>
  9601. */
  9602. !function ($) {
  9603. 'use strict';
  9604. $.extend($.fn.bootstrapTable.defaults, {
  9605. //是否启用模板渲染
  9606. templateView: false,
  9607. //数据格式化的模板ID或格式函数
  9608. templateFormatter: "itemtpl",
  9609. //添加的父类的class
  9610. templateParentClass: "row row-flex",
  9611. //向table添加的class
  9612. templateTableClass: "table-template",
  9613. });
  9614. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9615. _initContainer = BootstrapTable.prototype.initContainer,
  9616. _initBody = BootstrapTable.prototype.initBody,
  9617. _initRow = BootstrapTable.prototype.initRow;
  9618. BootstrapTable.prototype.initContainer = function () {
  9619. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  9620. var that = this;
  9621. if (!that.options.templateView) {
  9622. return;
  9623. }
  9624. that.options.cardView = true;
  9625. };
  9626. BootstrapTable.prototype.initBody = function () {
  9627. var that = this;
  9628. $.extend(that.options, {
  9629. showHeader: !that.options.templateView ? $.fn.bootstrapTable.defaults.showHeader : false,
  9630. showFooter: !that.options.templateView ? $.fn.bootstrapTable.defaults.showFooter : false,
  9631. });
  9632. $(that.$el).toggleClass(that.options.templateTableClass, that.options.templateView);
  9633. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  9634. if (!that.options.templateView) {
  9635. return;
  9636. } else {
  9637. //由于Bootstrap是基于Table的,添加一个父类容器
  9638. $("> *:not(.no-records-found)", that.$body).wrapAll($("<div />").addClass(that.options.templateParentClass));
  9639. }
  9640. };
  9641. BootstrapTable.prototype.initRow = function (item, i, data, parentDom) {
  9642. var that = this;
  9643. //如果未启用则使用原生的initRow方法
  9644. if (!that.options.templateView) {
  9645. return _initRow.apply(that, Array.prototype.slice.apply(arguments));
  9646. }
  9647. var $content = '';
  9648. if (typeof that.options.templateFormatter === 'function') {
  9649. $content = that.options.templateFormatter.call(that, item, i, data);
  9650. } else {
  9651. var Template = require('template');
  9652. $content = Template(that.options.templateFormatter, {item: item, i: i, data: data});
  9653. }
  9654. return $content;
  9655. };
  9656. }(jQuery);
  9657. define("bootstrap-table-template", ["bootstrap-table","template"], (function (global) {
  9658. return function () {
  9659. var ret, fn;
  9660. return ret || global.$.fn.bootstrapTable.defaults;
  9661. };
  9662. }(this)));
  9663. /**
  9664. * @author Jay <jwang@dizsoft.com>
  9665. */
  9666. (function ($) {
  9667. 'use strict';
  9668. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  9669. $.extend($.fn.bootstrapTable.defaults, {
  9670. showJumpto: false,
  9671. exportOptions: {}
  9672. });
  9673. $.extend($.fn.bootstrapTable.locales, {
  9674. formatJumpto: function () {
  9675. return 'GO';
  9676. }
  9677. });
  9678. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  9679. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9680. _initPagination = BootstrapTable.prototype.initPagination;
  9681. BootstrapTable.prototype.initPagination = function () {
  9682. this.showToolbar = this.options.showExport;
  9683. _initPagination.apply(this, Array.prototype.slice.apply(arguments));
  9684. if (this.options.showJumpto) {
  9685. var that = this,
  9686. $pageGroup = this.$pagination.find('ul.pagination'),
  9687. $jumpto = $pageGroup.find('li.jumpto');
  9688. if (!$jumpto.length) {
  9689. $jumpto = $([
  9690. '<li class="jumpto">',
  9691. '<input type="text" class="form-control">',
  9692. '<button class="btn' +
  9693. sprintf(' btn-%s', this.options.buttonsClass) +
  9694. sprintf(' btn-%s', this.options.iconSize) +
  9695. '" title="' + this.options.formatJumpto() + '" ' +
  9696. ' type="button">'+this.options.formatJumpto(),
  9697. '</button>',
  9698. '</li>'].join('')).appendTo($pageGroup);
  9699. $jumpto.find('button').click(function () {
  9700. that.selectPage(parseInt($jumpto.find('input').val()));
  9701. });
  9702. }
  9703. }
  9704. };
  9705. })(jQuery);
  9706. define("bootstrap-table-jumpto", ["bootstrap-table"], (function (global) {
  9707. return function () {
  9708. var ret, fn;
  9709. return ret || global.$.fn.bootstrapTable.defaults;
  9710. };
  9711. }(this)));
  9712. (function ($) {
  9713. 'use strict';
  9714. // Reasonable defaults
  9715. var PIXEL_STEP = 10;
  9716. var LINE_HEIGHT = 40;
  9717. var PAGE_HEIGHT = 800;
  9718. function normalizeWheel(event) {
  9719. var sX = 0; // spinX
  9720. var sY = 0; // spinY
  9721. var pX = 0; // pixelX
  9722. var pY = 0; // pixelY
  9723. // Legacy
  9724. if ('detail' in event) {
  9725. sY = event.detail;
  9726. }
  9727. if ('wheelDelta' in event) {
  9728. sY = -event.wheelDelta / 120;
  9729. }
  9730. if ('wheelDeltaY' in event) {
  9731. sY = -event.wheelDeltaY / 120;
  9732. }
  9733. if ('wheelDeltaX' in event) {
  9734. sX = -event.wheelDeltaX / 120;
  9735. }
  9736. // side scrolling on FF with DOMMouseScroll
  9737. if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {
  9738. sX = sY;
  9739. sY = 0;
  9740. }
  9741. pX = sX * PIXEL_STEP;
  9742. pY = sY * PIXEL_STEP;
  9743. if ('deltaY' in event) {
  9744. pY = event.deltaY;
  9745. }
  9746. if ('deltaX' in event) {
  9747. pX = event.deltaX;
  9748. }
  9749. if ((pX || pY) && event.deltaMode) {
  9750. if (event.deltaMode === 1) {
  9751. // delta in LINE units
  9752. pX *= LINE_HEIGHT;
  9753. pY *= LINE_HEIGHT;
  9754. } else {
  9755. // delta in PAGE units
  9756. pX *= PAGE_HEIGHT;
  9757. pY *= PAGE_HEIGHT;
  9758. }
  9759. }
  9760. // Fall-back if spin cannot be determined
  9761. if (pX && !sX) {
  9762. sX = pX < 1 ? -1 : 1;
  9763. }
  9764. if (pY && !sY) {
  9765. sY = pY < 1 ? -1 : 1;
  9766. }
  9767. return {
  9768. spinX: sX,
  9769. spinY: sY,
  9770. pixelX: pX,
  9771. pixelY: pY
  9772. };
  9773. }
  9774. var cachedWidth = null;
  9775. var getScrollBarWidth = function getScrollBarWidth() {
  9776. if (cachedWidth === null) {
  9777. var inner = $('<p/>').addClass('fixed-table-scroll-inner'),
  9778. outer = $('<div/>').addClass('fixed-table-scroll-outer'),
  9779. w1 = void 0,
  9780. w2 = void 0;
  9781. outer.append(inner);
  9782. $('body').append(outer);
  9783. w1 = inner[0].offsetWidth;
  9784. outer.css('overflow', 'scroll');
  9785. w2 = inner[0].offsetWidth;
  9786. if (w1 === w2) {
  9787. w2 = outer[0].clientWidth;
  9788. }
  9789. outer.remove();
  9790. cachedWidth = w1 - w2;
  9791. }
  9792. return cachedWidth;
  9793. };
  9794. //获取原本表格体的滑块宽度
  9795. var getTableBodyScrollBarWidth = function getTableBodyScrollBarWidth(tableBody) {
  9796. return tableBody[0].scrollHeight > tableBody[0].clientHeight ? 15 : 0;
  9797. };
  9798. $.extend($.fn.bootstrapTable.defaults, {
  9799. fixedColumns: false,
  9800. fixedNumber: 0,
  9801. fixedRightNumber: 0
  9802. });
  9803. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  9804. _initBody = BootstrapTable.prototype.initBody,
  9805. _initContainer = BootstrapTable.prototype.initContainer,
  9806. _trigger = BootstrapTable.prototype.trigger,
  9807. _hideLoading = BootstrapTable.prototype.hideLoading,
  9808. _updateSelected = BootstrapTable.prototype.updateSelected;
  9809. BootstrapTable.prototype.fixedColumnsSupported = function () {
  9810. var that = this;
  9811. return that.options.fixedColumns && !that.options.detailView && !that.options.cardView;
  9812. };
  9813. BootstrapTable.prototype.initFixedContainer = function () {
  9814. if (!this.fixedColumnsSupported()) {
  9815. return;
  9816. }
  9817. if (this.options.fixedNumber) {
  9818. this.$tableContainer.find('.fixed-columns').size() == 0 && this.$tableContainer.append('<div class="fixed-columns"></div>');
  9819. this.$fixedColumns = this.$tableContainer.find('.fixed-columns');
  9820. }
  9821. if (this.options.fixedRightNumber) {
  9822. this.$tableContainer.find('.fixed-columns-right').size() == 0 && this.$tableContainer.append('<div class="fixed-columns-right"></div>');
  9823. this.$fixedColumnsRight = this.$tableContainer.find('.fixed-columns-right');
  9824. }
  9825. };
  9826. BootstrapTable.prototype.initContainer = function () {
  9827. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  9828. this.initFixedContainer();
  9829. };
  9830. BootstrapTable.prototype.initBody = function () {
  9831. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  9832. if (!this.fixedColumnsSupported()) {
  9833. return;
  9834. }
  9835. if (this.options.showHeader && this.options.height) {
  9836. return;
  9837. }
  9838. this.initFixedColumnsBody();
  9839. this.initFixedColumnsEvents();
  9840. };
  9841. BootstrapTable.prototype.trigger = function () {
  9842. var that = this;
  9843. _trigger.apply(this, Array.prototype.slice.apply(arguments));
  9844. if (arguments[0] === 'pre-body') {
  9845. //如果上来就是cardView 设置表格高度为auto
  9846. if (this.options.cardView) {
  9847. this.$tableBody.css("height", "auto");
  9848. }
  9849. }
  9850. //监听cardView 显示/隐藏fixed部分
  9851. if (arguments[0] === 'toggle') {
  9852. if (arguments[1]) {
  9853. this.$tableBody.css("height", "auto");
  9854. this.$fixedColumns && this.$fixedColumns.hide();
  9855. this.$fixedColumnsRight && this.$fixedColumnsRight.hide();
  9856. } else {
  9857. this.$tableBody.css("height", "100%");
  9858. this.$fixedColumns && this.$fixedColumns.show();
  9859. this.$fixedColumnsRight && this.$fixedColumnsRight.show();
  9860. this.$fixedHeaderRight && this.$fixedHeaderRight.scrollLeft(this.$tableBody.find('table').width());
  9861. this.$fixedBodyRight && this.$fixedBodyRight.scrollLeft(this.$tableBody.find('table').width());
  9862. }
  9863. }
  9864. if (!that.fixedColumnsSupported()) {
  9865. return;
  9866. }
  9867. if (arguments[0] === 'post-header') {
  9868. this.initFixedColumnsHeader();
  9869. } else if (arguments[0] === 'scroll-body') {
  9870. if (this.needFixedColumns && this.options.fixedNumber) {
  9871. this.$fixedBody && this.$fixedBody.scrollTop(this.$tableBody.scrollTop());
  9872. }
  9873. if (this.needFixedColumns && this.options.fixedRightNumber) {
  9874. this.$fixedBodyRight && this.$fixedBodyRight.scrollTop(this.$tableBody.scrollTop());
  9875. }
  9876. } else if (arguments[0] === 'load-success') {
  9877. this.hideLoading();
  9878. }
  9879. };
  9880. BootstrapTable.prototype.updateSelected = function () {
  9881. var that = this;
  9882. _updateSelected.apply(this, Array.prototype.slice.apply(arguments));
  9883. if (!this.fixedColumnsSupported()) {
  9884. return;
  9885. }
  9886. this.$tableBody.find('tr').each(function (i, el) {
  9887. var $el = $(el);
  9888. var index = $el.data('index');
  9889. var classes = $el.attr('class');
  9890. var inputSelector = '[name="' + that.options.selectItemName + '"]';
  9891. var $input = $el.find(inputSelector);
  9892. if (typeof index === 'undefined') {
  9893. return;
  9894. }
  9895. var updateFixedBody = function updateFixedBody($fixedHeader, $fixedBody) {
  9896. var $tr = $fixedBody.find('tr[data-index="' + index + '"]');
  9897. $tr.attr('class', classes);
  9898. if ($input.length) {
  9899. $tr.find(inputSelector).prop('checked', $input.prop('checked'));
  9900. }
  9901. if (that.$selectAll.length) {
  9902. $fixedHeader.add($fixedBody).find('[name="btSelectAll"]').prop('checked', that.$selectAll.prop('checked'));
  9903. }
  9904. };
  9905. if (that.$fixedBody && that.options.fixedNumber) {
  9906. updateFixedBody(that.$fixedHeader, that.$fixedBody);
  9907. }
  9908. if (that.$fixedBodyRight && that.options.fixedRightNumber) {
  9909. updateFixedBody(that.$fixedHeaderRight, that.$fixedBodyRight);
  9910. }
  9911. });
  9912. };
  9913. BootstrapTable.prototype.hideLoading = function () {
  9914. _hideLoading.apply(this, Array.prototype.slice.apply(arguments));
  9915. if (this.needFixedColumns && this.options.fixedNumber) {
  9916. this.$fixedColumns.find('.fixed-table-loading').hide();
  9917. }
  9918. if (this.needFixedColumns && this.options.fixedRightNumber) {
  9919. this.$fixedColumnsRight.find('.fixed-table-loading').hide();
  9920. }
  9921. };
  9922. BootstrapTable.prototype.initFixedColumnsHeader = function () {
  9923. var that = this;
  9924. if (this.options.height) {
  9925. this.needFixedColumns = this.$tableHeader.outerWidth(true) < this.$tableHeader.find('table').outerWidth(true);
  9926. } else {
  9927. this.needFixedColumns = this.$tableBody.outerWidth(true) < this.$tableBody.find('table').outerWidth(true);
  9928. }
  9929. var initFixedHeader = function initFixedHeader($fixedColumns, isRight) {
  9930. $fixedColumns.find('.fixed-table-header').remove();
  9931. $fixedColumns.append(that.$tableHeader.clone(true));
  9932. $fixedColumns.find('.fixed-table-header').css('margin-right', "");
  9933. $fixedColumns.css({
  9934. width: that.getFixedColumnsWidth(isRight)
  9935. });
  9936. return $fixedColumns.find('.fixed-table-header');
  9937. };
  9938. if (this.needFixedColumns && this.options.fixedNumber) {
  9939. this.$fixedHeader = initFixedHeader(this.$fixedColumns);
  9940. this.$fixedHeader.css('margin-right', '');
  9941. } else if (this.$fixedColumns) {
  9942. this.$fixedColumns.html('').css('width', '');
  9943. }
  9944. if (this.needFixedColumns && this.options.fixedRightNumber) {
  9945. this.$fixedHeaderRight = initFixedHeader(this.$fixedColumnsRight, true);
  9946. this.$fixedHeaderRight.scrollLeft(this.$fixedHeaderRight.find('table').width());
  9947. } else if (this.$fixedColumnsRight) {
  9948. this.$fixedColumnsRight.html('').css('width', '');
  9949. }
  9950. this.initFixedColumnsBody();
  9951. this.initFixedColumnsEvents();
  9952. };
  9953. BootstrapTable.prototype.initFixedColumnsBody = function () {
  9954. var that = this;
  9955. var initFixedBody = function initFixedBody($fixedColumns, $fixedHeader) {
  9956. $fixedColumns.find('.fixed-table-body').remove();
  9957. $fixedColumns.append(that.$tableBody.clone(true));
  9958. var $fixedBody = $fixedColumns.find('.fixed-table-body');
  9959. var tableBody = that.$tableBody.get(0);
  9960. var scrollHeight = tableBody.scrollWidth > tableBody.clientWidth ? getScrollBarWidth() : 0;
  9961. var paginationHeight = $(".fixed-table-pagination").height();
  9962. if (typeof that.options.height !== 'undefined') paginationHeight = 0;
  9963. var height = that.$tableContainer.outerHeight(true) - scrollHeight - paginationHeight + 1;
  9964. $fixedColumns.css({
  9965. height: height
  9966. });
  9967. $fixedBody.css({
  9968. height: height - $fixedHeader.height()
  9969. });
  9970. return $fixedBody;
  9971. };
  9972. if (this.needFixedColumns && this.options.fixedNumber) {
  9973. this.$fixedBody = initFixedBody(this.$fixedColumns, this.$fixedHeader);
  9974. }
  9975. if (this.needFixedColumns && this.options.fixedRightNumber) {
  9976. this.$fixedBodyRight = initFixedBody(this.$fixedColumnsRight, this.$fixedHeaderRight);
  9977. this.$fixedBodyRight.scrollLeft(this.$fixedBodyRight.find('table').width());
  9978. this.$fixedBodyRight.css('overflow-y', 'hidden');
  9979. }
  9980. };
  9981. BootstrapTable.prototype.getFixedColumnsWidth = function (isRight) {
  9982. var visibleFields = this.getVisibleFields();
  9983. var width = 0;
  9984. var fixedNumber = this.options.fixedNumber;
  9985. var marginRight = 0;
  9986. if (isRight) {
  9987. visibleFields = visibleFields.reverse();
  9988. fixedNumber = this.options.fixedRightNumber;
  9989. //右侧固定列距离
  9990. this.$fixedColumnsRight.css('right', getTableBodyScrollBarWidth(this.$tableBody));
  9991. }
  9992. for (var i = 0; i < fixedNumber; i++) {
  9993. width += this.$header.find('th[data-field="' + visibleFields[i] + '"]').outerWidth();
  9994. }
  9995. return width + 1;
  9996. };
  9997. BootstrapTable.prototype.initFixedColumnsEvents = function () {
  9998. var that = this;
  9999. var toggleHover = function toggleHover(e, toggle) {
  10000. var tr = 'tr[data-index="' + $(e.currentTarget).data('index') + '"]';
  10001. var $trs = that.$tableBody.find(tr);
  10002. if (that.$fixedBody) {
  10003. $trs = $trs.add(that.$fixedBody.find(tr));
  10004. }
  10005. if (that.$fixedBodyRight) {
  10006. $trs = $trs.add(that.$fixedBodyRight.find(tr));
  10007. }
  10008. $trs.css('background-color', toggle ? $(e.currentTarget).css('background-color') : '');
  10009. };
  10010. this.$tableBody.find('tr').hover(function (e) {
  10011. toggleHover(e, true);
  10012. }, function (e) {
  10013. toggleHover(e, false);
  10014. });
  10015. var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
  10016. var mousewheel = isFirefox ? 'DOMMouseScroll' : 'mousewheel';
  10017. var updateScroll = function updateScroll(e, fixedBody) {
  10018. var normalized = normalizeWheel(e);
  10019. var deltaY = Math.ceil(normalized.pixelY);
  10020. var top = that.$tableBody.scrollTop() + deltaY;
  10021. if (deltaY < 0 && top > 0 || deltaY > 0 && top < fixedBody.scrollHeight - fixedBody.clientHeight) {
  10022. e.preventDefault();
  10023. }
  10024. that.$tableBody.scrollTop(top);
  10025. if (that.$fixedBody) {
  10026. that.$fixedBody.scrollTop(top);
  10027. }
  10028. if (that.$fixedBodyRight) {
  10029. that.$fixedBodyRight.scrollTop(top);
  10030. }
  10031. };
  10032. if (this.needFixedColumns && this.options.fixedNumber) {
  10033. this.$fixedBody.find('tr').hover(function (e) {
  10034. toggleHover(e, true);
  10035. }, function (e) {
  10036. toggleHover(e, false);
  10037. });
  10038. this.$fixedBody[0].addEventListener(mousewheel, function (e) {
  10039. //给鼠标滑轮绑定事件
  10040. updateScroll(e, that.$fixedBody[0]);
  10041. });
  10042. //给固定表格的checkbox绑定事件
  10043. this.$fixedBody.find('input[name="' + this.options.selectItemName + '"]').off("click").on('click', function (e) {
  10044. e.stopImmediatePropagation();
  10045. var index = $(e.target).data("index");
  10046. $(that.$selectItem[index]).trigger("click");
  10047. });
  10048. //绑定TD点击事件
  10049. this.$fixedBody.find('> table > tbody > tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
  10050. var index = $(this).closest("tr[data-index]").data("index");
  10051. $(that.$selectItem[index]).closest("tr[data-index]").find(">td:eq(" + $(this).index() + ")").trigger("click");
  10052. });
  10053. }
  10054. //给原本表格绑定scroll事件
  10055. $('div.fixed-table-body').off('scroll'); //给所有的body解绑 scroll
  10056. this.$tableBody.off('scroll').on('scroll', function (e) {
  10057. that.$tableHeader.scrollLeft(0);
  10058. if (that.$tableBody.scrollLeft() > 0) {
  10059. that.$tableHeader.scrollLeft(that.$tableBody.scrollLeft());
  10060. if (that.options.showFooter && !that.options.cardView) {
  10061. that.$tableFooter.scrollLeft(that.$tableBody.scrollLeft());
  10062. }
  10063. }
  10064. var top = that.$tableBody.scrollTop();
  10065. if (that.$fixedBody) {
  10066. that.$fixedBody.scrollTop(top);
  10067. }
  10068. if (that.$fixedBodyRight) {
  10069. that.$fixedBodyRight.scrollTop(top);
  10070. }
  10071. });
  10072. if (this.needFixedColumns && this.options.fixedRightNumber) {
  10073. this.$fixedBodyRight.find('tr').hover(function (e) {
  10074. toggleHover(e, true);
  10075. }, function (e) {
  10076. toggleHover(e, false);
  10077. });
  10078. this.$fixedBodyRight[0].addEventListener(mousewheel, function (e) {
  10079. //给鼠标滑轮绑定事件
  10080. updateScroll(e, that.$fixedBodyRight[0]);
  10081. });
  10082. //给固定表格的checkbox绑定事件
  10083. this.$fixedBodyRight.find('input[name="' + this.options.selectItemName + '"]').off("click").on('click', function (e) {
  10084. e.stopImmediatePropagation();
  10085. var index = $(e.target).data("index");
  10086. $(that.$selectItem[index]).trigger("click");
  10087. });
  10088. //绑定TD点击事件
  10089. this.$fixedBodyRight.find('> table > tbody > tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
  10090. var index = $(this).closest("tr[data-index]").data("index");
  10091. $(that.$selectItem[index]).closest("tr[data-index]").find(">td:eq(" + $(this).index() + ")").trigger("click");
  10092. });
  10093. }
  10094. if (this.options.filterControl) {
  10095. $(this.$fixedColumns).off('keyup change').on('keyup change', function (e) {
  10096. var $target = $(e.target);
  10097. var value = $target.val();
  10098. var field = $target.parents('th').data('field');
  10099. var $coreTh = that.$header.find('th[data-field="' + field + '"]');
  10100. if ($target.is('input')) {
  10101. $coreTh.find('input').val(value);
  10102. } else if ($target.is('select')) {
  10103. var $select = $coreTh.find('select');
  10104. $select.find('option[selected]').removeAttr('selected');
  10105. $select.find('option[value="' + value + '"]').attr('selected', true);
  10106. }
  10107. that.triggerSearch();
  10108. });
  10109. }
  10110. };
  10111. })(jQuery);
  10112. define("bootstrap-table-fixed-columns", ["bootstrap-table"], (function (global) {
  10113. return function () {
  10114. var ret, fn;
  10115. return ret || global.$.fn.bootstrapTable.defaults;
  10116. };
  10117. }(this)));
  10118. 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) {
  10119. var Table = {
  10120. list: {},
  10121. // Bootstrap-table 基础配置
  10122. defaults: {
  10123. url: '',
  10124. sidePagination: 'server',
  10125. method: 'get', //请求方法
  10126. toolbar: ".toolbar", //工具栏
  10127. search: true, //是否启用快速搜索
  10128. cache: false,
  10129. commonSearch: true, //是否启用通用搜索
  10130. searchFormVisible: false, //是否始终显示搜索表单
  10131. titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
  10132. idTable: 'commonTable',
  10133. showExport: true,
  10134. exportDataType: "auto",
  10135. exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
  10136. exportOptions: {
  10137. fileName: 'export_' + Moment().format("YYYY-MM-DD"),
  10138. preventInjection: false,
  10139. mso: {
  10140. onMsoNumberFormat: function (cell, row, col) {
  10141. return !isNaN($(cell).text()) ? '\\@' : '';
  10142. },
  10143. },
  10144. ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列
  10145. },
  10146. pageSize: localStorage.getItem("pagesize") || 10,
  10147. pageList: [10, 15, 20, 25, 50, 'All'],
  10148. pagination: true,
  10149. clickToSelect: true, //是否启用点击选中
  10150. dblClickToEdit: true, //是否启用双击编辑
  10151. singleSelect: false, //是否启用单选
  10152. showRefresh: false,
  10153. showJumpto: true,
  10154. locale: Config.language == 'zh-cn' ? 'zh-CN' : 'en-US',
  10155. showToggle: true,
  10156. showColumns: true,
  10157. pk: 'id',
  10158. sortName: 'id',
  10159. sortOrder: 'desc',
  10160. paginationFirstText: __("First"),
  10161. paginationPreText: __("Previous"),
  10162. paginationNextText: __("Next"),
  10163. paginationLastText: __("Last"),
  10164. cardView: false, //卡片视图
  10165. iosCardView: true, //ios卡片视图
  10166. checkOnInit: true, //是否在初始化时判断
  10167. escape: true, //是否对内容进行转义
  10168. fixDropdownPosition: true, //是否修复下拉的定位
  10169. selectedIds: [],
  10170. selectedData: [],
  10171. extend: {
  10172. index_url: '',
  10173. add_url: '',
  10174. edit_url: '',
  10175. del_url: '',
  10176. import_url: '',
  10177. multi_url: '',
  10178. dragsort_url: 'ajax/weigh',
  10179. }
  10180. },
  10181. // Bootstrap-table 列配置
  10182. columnDefaults: {
  10183. align: 'center',
  10184. valign: 'middle',
  10185. },
  10186. config: {
  10187. checkboxtd: 'tbody>tr>td.bs-checkbox',
  10188. toolbar: '.toolbar',
  10189. refreshbtn: '.btn-refresh',
  10190. addbtn: '.btn-add',
  10191. editbtn: '.btn-edit',
  10192. delbtn: '.btn-del',
  10193. importbtn: '.btn-import',
  10194. multibtn: '.btn-multi',
  10195. disabledbtn: '.btn-disabled',
  10196. editonebtn: '.btn-editone',
  10197. restoreonebtn: '.btn-restoreone',
  10198. destroyonebtn: '.btn-destroyone',
  10199. restoreallbtn: '.btn-restoreall',
  10200. destroyallbtn: '.btn-destroyall',
  10201. dragsortfield: 'weigh',
  10202. },
  10203. button: {
  10204. edit: {
  10205. name: 'edit',
  10206. icon: 'fa fa-pencil',
  10207. title: __('Edit'),
  10208. extend: 'data-toggle="tooltip"',
  10209. classname: 'btn btn-xs btn-success btn-editone'
  10210. },
  10211. del: {
  10212. name: 'del',
  10213. icon: 'fa fa-trash',
  10214. title: __('Del'),
  10215. extend: 'data-toggle="tooltip"',
  10216. classname: 'btn btn-xs btn-danger btn-delone'
  10217. },
  10218. dragsort: {
  10219. name: 'dragsort',
  10220. icon: 'fa fa-arrows',
  10221. title: __('Drag to sort'),
  10222. extend: 'data-toggle="tooltip"',
  10223. classname: 'btn btn-xs btn-primary btn-dragsort'
  10224. }
  10225. },
  10226. api: {
  10227. init: function (defaults, columnDefaults, locales) {
  10228. defaults = defaults ? defaults : {};
  10229. columnDefaults = columnDefaults ? columnDefaults : {};
  10230. locales = locales ? locales : {};
  10231. $.fn.bootstrapTable.Constructor.prototype.getSelectItem = function () {
  10232. return this.$selectItem;
  10233. };
  10234. // 写入bootstrap-table默认配置
  10235. $.extend(true, $.fn.bootstrapTable.defaults, Table.defaults, defaults);
  10236. // 写入bootstrap-table column配置
  10237. $.extend($.fn.bootstrapTable.columnDefaults, Table.columnDefaults, columnDefaults);
  10238. // 写入bootstrap-table locale配置
  10239. $.extend($.fn.bootstrapTable.locales[Table.defaults.locale], {
  10240. formatCommonSearch: function () {
  10241. return __('Common search');
  10242. },
  10243. formatCommonSubmitButton: function () {
  10244. return __('Submit');
  10245. },
  10246. formatCommonResetButton: function () {
  10247. return __('Reset');
  10248. },
  10249. formatCommonCloseButton: function () {
  10250. return __('Close');
  10251. },
  10252. formatCommonChoose: function () {
  10253. return __('Choose');
  10254. },
  10255. formatJumpto: function () {
  10256. return __('Go');
  10257. }
  10258. }, locales);
  10259. // 如果是iOS设备则判断是否启用卡片视图
  10260. if ($.fn.bootstrapTable.defaults.iosCardView && navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
  10261. Table.defaults.cardView = true;
  10262. $.fn.bootstrapTable.defaults.cardView = true;
  10263. }
  10264. if (typeof defaults.exportTypes != 'undefined') {
  10265. $.fn.bootstrapTable.defaults.exportTypes = defaults.exportTypes;
  10266. }
  10267. },
  10268. // 绑定事件
  10269. bindevent: function (table) {
  10270. //Bootstrap-table的父元素,包含table,toolbar,pagnation
  10271. var parenttable = table.closest('.bootstrap-table');
  10272. //Bootstrap-table配置
  10273. var options = table.bootstrapTable('getOptions');
  10274. //Bootstrap操作区
  10275. var toolbar = $(options.toolbar, parenttable);
  10276. //跨页提示按钮
  10277. var tipsBtn = $(".btn-selected-tips", parenttable);
  10278. if (tipsBtn.size() === 0) {
  10279. 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);
  10280. }
  10281. //点击提示按钮
  10282. tipsBtn.off("click").on("click", function (e) {
  10283. table.trigger("uncheckbox");
  10284. table.bootstrapTable("refresh");
  10285. });
  10286. //当刷新表格时
  10287. table.on('uncheckbox', function (status, res, e) {
  10288. options.selectedIds = [];
  10289. options.selectedData = [];
  10290. tipsBtn.tooltip('hide');
  10291. tipsBtn.addClass('hide');
  10292. });
  10293. //表格加载出错时
  10294. table.on('load-error.bs.table', function (status, res, e) {
  10295. if (e.status === 0) {
  10296. return;
  10297. }
  10298. Toastr.error(__('Unknown data format'));
  10299. });
  10300. //当加载数据成功时
  10301. table.on('load-success.bs.table', function (e, data) {
  10302. if (typeof data.rows === 'undefined' && typeof data.code != 'undefined') {
  10303. Toastr.error(data.msg);
  10304. }
  10305. });
  10306. //当刷新表格时
  10307. table.on('refresh.bs.table', function (e, settings, data) {
  10308. $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
  10309. });
  10310. //当表格分页变更时
  10311. table.on('page-change.bs.table', function (e, page, pagesize) {
  10312. if (!isNaN(pagesize)) {
  10313. localStorage.setItem("pagesize", pagesize);
  10314. }
  10315. });
  10316. //当执行搜索时
  10317. table.on('search.bs.table common-search.bs.table', function (e, settings, data) {
  10318. table.trigger("uncheckbox");
  10319. });
  10320. if (options.dblClickToEdit) {
  10321. //当双击单元格时
  10322. table.on('dbl-click-row.bs.table', function (e, row, element, field) {
  10323. $(Table.config.editonebtn, element).trigger("click");
  10324. });
  10325. }
  10326. //渲染内容前
  10327. table.on('pre-body.bs.table', function (e, data) {
  10328. if (options.maintainSelected) {
  10329. $.each(data, function (i, row) {
  10330. row[options.stateField] = $.inArray(row[options.pk], options.selectedIds) > -1;
  10331. });
  10332. }
  10333. });
  10334. //当内容渲染完成后
  10335. table.on('post-body.bs.table', function (e, data) {
  10336. $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
  10337. if ($(Table.config.checkboxtd + ":first", table).find("input[type='checkbox'][data-index]").size() > 0) {
  10338. // 拖拽选择,需要重新绑定事件
  10339. require(['drag', 'drop'], function () {
  10340. var checkboxtd = $(Table.config.checkboxtd, table);
  10341. checkboxtd.drag("start", function (ev, dd) {
  10342. return $('<div class="selection" />').css('opacity', .65).appendTo(document.body);
  10343. }).drag(function (ev, dd) {
  10344. $(dd.proxy).css({
  10345. top: Math.min(ev.pageY, dd.startY),
  10346. left: Math.min(ev.pageX, dd.startX),
  10347. height: Math.abs(ev.pageY - dd.startY),
  10348. width: Math.abs(ev.pageX - dd.startX)
  10349. });
  10350. }).drag("end", function (ev, dd) {
  10351. $(dd.proxy).remove();
  10352. });
  10353. checkboxtd.drop("start", function () {
  10354. Table.api.toggleattr(this);
  10355. }).drop(function () {
  10356. // Table.api.toggleattr(this);
  10357. }).drop("end", function (e) {
  10358. var that = this;
  10359. setTimeout(function () {
  10360. if (e.type === 'mousemove') {
  10361. Table.api.toggleattr(that);
  10362. }
  10363. }, 0);
  10364. });
  10365. $.drop({
  10366. multi: true
  10367. });
  10368. });
  10369. }
  10370. });
  10371. var exportDataType = options.exportDataType;
  10372. // 处理选中筛选框后按钮的状态统一变更
  10373. table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table post-body.bs.table', function (e) {
  10374. var allIds = [];
  10375. $.each(table.bootstrapTable("getData"), function (i, item) {
  10376. allIds.push(typeof item[options.pk] != 'undefined' ? item[options.pk] : '');
  10377. });
  10378. var selectedIds = Table.api.selectedids(table, true),
  10379. selectedData = Table.api.selecteddata(table, true);
  10380. //开启分页checkbox分页记忆
  10381. if (options.maintainSelected) {
  10382. options.selectedIds = options.selectedIds.filter(function (element, index, self) {
  10383. return $.inArray(element, allIds) === -1;
  10384. }).concat(selectedIds);
  10385. options.selectedData = options.selectedData.filter(function (element, index, self) {
  10386. return $.inArray(element[options.pk], allIds) === -1;
  10387. }).concat(selectedData);
  10388. if (options.selectedIds.length > selectedIds.length) {
  10389. $("b", tipsBtn).text(options.selectedIds.length);
  10390. tipsBtn.removeClass('hide');
  10391. } else {
  10392. tipsBtn.addClass('hide');
  10393. }
  10394. } else {
  10395. options.selectedIds = selectedIds;
  10396. options.selectedData = selectedData;
  10397. }
  10398. //如果导出类型为auto时则自动判断
  10399. if (exportDataType === 'auto') {
  10400. options.exportDataType = selectedIds.length > 0 ? 'selected' : 'all';
  10401. }
  10402. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !options.selectedIds.length);
  10403. });
  10404. // 绑定TAB事件
  10405. $('.panel-heading [data-field] a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) {
  10406. var field = $(this).closest("[data-field]").data("field");
  10407. var value = $(this).data("value");
  10408. var object = $("[name='" + field + "']", table.closest(".bootstrap-table").find(".commonsearch-table"));
  10409. if (object.prop('tagName') == "SELECT") {
  10410. $("option[value='" + value + "']", object).prop("selected", true);
  10411. } else {
  10412. object.val(value);
  10413. }
  10414. table.trigger("uncheckbox");
  10415. table.bootstrapTable('refresh', {pageNumber: 1});
  10416. return false;
  10417. });
  10418. // 修复重置事件
  10419. $("form", table.closest(".bootstrap-table").find(".commonsearch-table")).on('reset', function () {
  10420. setTimeout(function () {
  10421. // $('.panel-heading [data-field] li.active a[data-toggle="tab"]').trigger('shown.bs.tab');
  10422. }, 0);
  10423. $('.panel-heading [data-field] li', table.closest(".panel-intro")).removeClass('active');
  10424. $('.panel-heading [data-field] li:first', table.closest(".panel-intro")).addClass('active');
  10425. });
  10426. // 刷新按钮事件
  10427. toolbar.on('click', Table.config.refreshbtn, function () {
  10428. table.bootstrapTable('refresh');
  10429. });
  10430. // 添加按钮事件
  10431. toolbar.on('click', Table.config.addbtn, function () {
  10432. var ids = Table.api.selectedids(table);
  10433. var url = options.extend.add_url;
  10434. if (url.indexOf("{ids}") !== -1) {
  10435. url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
  10436. }
  10437. Fast.api.open(url, $(this).data("original-title") || $(this).attr("title") || __('Add'), $(this).data() || {});
  10438. });
  10439. // 导入按钮事件
  10440. if ($(Table.config.importbtn, toolbar).size() > 0) {
  10441. require(['upload'], function (Upload) {
  10442. Upload.api.upload($(Table.config.importbtn, toolbar), function (data, ret) {
  10443. Fast.api.ajax({
  10444. url: options.extend.import_url,
  10445. data: {file: data.url},
  10446. }, function (data, ret) {
  10447. table.trigger("uncheckbox");
  10448. table.bootstrapTable('refresh');
  10449. });
  10450. });
  10451. });
  10452. }
  10453. // 批量编辑按钮事件
  10454. toolbar.on('click', Table.config.editbtn, function () {
  10455. var that = this;
  10456. var ids = Table.api.selectedids(table);
  10457. if (ids.length > 10) {
  10458. return;
  10459. }
  10460. var title = $(that).data('title') || $(that).attr("title") || __('Edit');
  10461. var data = $(that).data() || {};
  10462. delete data.title;
  10463. //循环弹出多个编辑框
  10464. $.each(Table.api.selecteddata(table), function (index, row) {
  10465. var url = options.extend.edit_url;
  10466. row = $.extend({}, row ? row : {}, {ids: row[options.pk]});
  10467. url = Table.api.replaceurl(url, row, table);
  10468. Fast.api.open(url, typeof title === 'function' ? title.call(table, row) : title, data);
  10469. });
  10470. });
  10471. //清空回收站
  10472. $(document).on('click', Table.config.destroyallbtn, function () {
  10473. var that = this;
  10474. Layer.confirm(__('Are you sure you want to truncate?'), function () {
  10475. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10476. Fast.api.ajax(url, function () {
  10477. Layer.closeAll();
  10478. table.trigger("uncheckbox");
  10479. table.bootstrapTable('refresh');
  10480. }, function () {
  10481. Layer.closeAll();
  10482. });
  10483. });
  10484. return false;
  10485. });
  10486. //全部还原
  10487. $(document).on('click', Table.config.restoreallbtn, function () {
  10488. var that = this;
  10489. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10490. Fast.api.ajax(url, function () {
  10491. Layer.closeAll();
  10492. table.trigger("uncheckbox");
  10493. table.bootstrapTable('refresh');
  10494. }, function () {
  10495. Layer.closeAll();
  10496. });
  10497. return false;
  10498. });
  10499. //销毁或删除
  10500. $(document).on('click', Table.config.restoreonebtn + ',' + Table.config.destroyonebtn, function () {
  10501. var that = this;
  10502. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  10503. var row = Fast.api.getrowbyindex(table, $(that).data("row-index"));
  10504. Fast.api.ajax({
  10505. url: url,
  10506. data: {ids: row[options.pk]}
  10507. }, function () {
  10508. table.trigger("uncheckbox");
  10509. table.bootstrapTable('refresh');
  10510. });
  10511. return false;
  10512. });
  10513. // 批量操作按钮事件
  10514. toolbar.on('click', Table.config.multibtn, function () {
  10515. var ids = Table.api.selectedids(table);
  10516. Table.api.multi($(this).data("action"), ids, table, this);
  10517. });
  10518. // 批量删除按钮事件
  10519. toolbar.on('click', Table.config.delbtn, function () {
  10520. var that = this;
  10521. var ids = Table.api.selectedids(table);
  10522. Layer.confirm(
  10523. __('Are you sure you want to delete the %s selected item?', ids.length),
  10524. {icon: 3, title: __('Warning'), offset: 0, shadeClose: true, btn: [__('OK'), __('Cancel')]},
  10525. function (index) {
  10526. Table.api.multi("del", ids, table, that);
  10527. Layer.close(index);
  10528. }
  10529. );
  10530. });
  10531. // 拖拽排序
  10532. require(['dragsort'], function () {
  10533. //绑定拖动排序
  10534. $("tbody", table).dragsort({
  10535. itemSelector: 'tr:visible',
  10536. dragSelector: "a.btn-dragsort",
  10537. dragEnd: function (a, b) {
  10538. var element = $("a.btn-dragsort", this);
  10539. var data = table.bootstrapTable('getData');
  10540. var current = data[parseInt($(this).data("index"))];
  10541. var options = table.bootstrapTable('getOptions');
  10542. //改变的值和改变的ID集合
  10543. var ids = $.map($("tbody tr:visible", table), function (tr) {
  10544. return data[parseInt($(tr).data("index"))][options.pk];
  10545. });
  10546. var changeid = current[options.pk];
  10547. var pid = typeof current.pid != 'undefined' ? current.pid : '';
  10548. var params = {
  10549. url: table.bootstrapTable('getOptions').extend.dragsort_url,
  10550. data: {
  10551. ids: ids.join(','),
  10552. changeid: changeid,
  10553. pid: pid,
  10554. field: Table.config.dragsortfield,
  10555. orderway: options.sortOrder,
  10556. table: options.extend.table,
  10557. pk: options.pk
  10558. }
  10559. };
  10560. Fast.api.ajax(params, function (data, ret) {
  10561. var success = $(element).data("success") || $.noop;
  10562. if (typeof success === 'function') {
  10563. if (false === success.call(element, data, ret)) {
  10564. return false;
  10565. }
  10566. }
  10567. table.bootstrapTable('refresh');
  10568. }, function (data, ret) {
  10569. var error = $(element).data("error") || $.noop;
  10570. if (typeof error === 'function') {
  10571. if (false === error.call(element, data, ret)) {
  10572. return false;
  10573. }
  10574. }
  10575. table.bootstrapTable('refresh');
  10576. });
  10577. },
  10578. placeHolderTemplate: ""
  10579. });
  10580. });
  10581. table.on("click", "input[data-id][name='checkbox']", function (e) {
  10582. var ids = $(this).data("id");
  10583. table.bootstrapTable($(this).prop("checked") ? 'checkBy' : 'uncheckBy', {field: options.pk, values: [ids]});
  10584. });
  10585. table.on("click", "[data-id].btn-change", function (e) {
  10586. e.preventDefault();
  10587. var changer = $.proxy(function () {
  10588. Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this);
  10589. }, this);
  10590. if (typeof $(this).data("confirm") !== 'undefined') {
  10591. Layer.confirm($(this).data("confirm"), function (index) {
  10592. changer();
  10593. Layer.close(index);
  10594. });
  10595. } else {
  10596. changer();
  10597. }
  10598. });
  10599. table.on("click", "[data-id].btn-edit", function (e) {
  10600. e.preventDefault();
  10601. var ids = $(this).data("id");
  10602. var row = Table.api.getrowbyid(table, ids);
  10603. row.ids = ids;
  10604. var url = Table.api.replaceurl(options.extend.edit_url, row, table);
  10605. Fast.api.open(url, $(this).data("original-title") || $(this).attr("title") || __('Edit'), $(this).data() || {});
  10606. });
  10607. table.on("click", "[data-id].btn-del", function (e) {
  10608. e.preventDefault();
  10609. var id = $(this).data("id");
  10610. var that = this;
  10611. Layer.confirm(
  10612. __('Are you sure you want to delete this item?'),
  10613. {icon: 3, title: __('Warning'), shadeClose: true, btn: [__('OK'), __('Cancel')]},
  10614. function (index) {
  10615. Table.api.multi("del", id, table, that);
  10616. Layer.close(index);
  10617. }
  10618. );
  10619. });
  10620. //修复dropdown定位溢出的情况
  10621. if (options.fixDropdownPosition) {
  10622. var tableBody = table.closest(".fixed-table-body");
  10623. table.on('show.bs.dropdown fa.event.refreshdropdown', ".btn-group", function (e) {
  10624. var dropdownMenu = $(".dropdown-menu", this);
  10625. var btnGroup = $(this);
  10626. var isPullRight = dropdownMenu.hasClass("pull-right") || dropdownMenu.hasClass("dropdown-menu-right");
  10627. var left, top, position;
  10628. if (dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
  10629. position = 'fixed';
  10630. top = btnGroup.offset().top - $(window).scrollTop() + btnGroup.outerHeight();
  10631. left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
  10632. } else {
  10633. if (btnGroup.offset().top + btnGroup.outerHeight() + dropdownMenu.outerHeight() > tableBody.offset().top + tableBody.outerHeight() - 30) {
  10634. position = 'absolute';
  10635. left = isPullRight ? -(dropdownMenu.outerWidth() - btnGroup.outerWidth()) : 0;
  10636. top = -(dropdownMenu.outerHeight() + 3);
  10637. }
  10638. }
  10639. if (left || top) {
  10640. dropdownMenu.css({
  10641. position: position, left: left, top: top, right: 'inherit'
  10642. });
  10643. }
  10644. });
  10645. var checkdropdown = function () {
  10646. if ($(".btn-group.open", table).length > 0 && $(".btn-group.open .dropdown-menu", table).css("position") == 'fixed') {
  10647. $(".btn-group.open", table).trigger("fa.event.refreshdropdown");
  10648. }
  10649. };
  10650. $(window).on("scroll", function () {
  10651. checkdropdown();
  10652. });
  10653. tableBody.on("scroll", function () {
  10654. checkdropdown();
  10655. });
  10656. }
  10657. var id = table.attr("id");
  10658. Table.list[id] = table;
  10659. return table;
  10660. },
  10661. // 批量操作请求
  10662. multi: function (action, ids, table, element) {
  10663. var options = table.bootstrapTable('getOptions');
  10664. var data = element ? $(element).data() : {};
  10665. ids = ($.isArray(ids) ? ids.join(",") : ids);
  10666. var url = typeof data.url !== "undefined" ? data.url : (action == "del" ? options.extend.del_url : options.extend.multi_url);
  10667. var params = typeof data.params !== "undefined" ? (typeof data.params == 'object' ? $.param(data.params) : data.params) : '';
  10668. options = {url: url, data: {action: action, ids: ids, params: params}};
  10669. Fast.api.ajax(options, function (data, ret) {
  10670. table.trigger("uncheckbox");
  10671. var success = $(element).data("success") || $.noop;
  10672. if (typeof success === 'function') {
  10673. if (false === success.call(element, data, ret)) {
  10674. return false;
  10675. }
  10676. }
  10677. table.bootstrapTable('refresh');
  10678. }, function (data, ret) {
  10679. var error = $(element).data("error") || $.noop;
  10680. if (typeof error === 'function') {
  10681. if (false === error.call(element, data, ret)) {
  10682. return false;
  10683. }
  10684. }
  10685. });
  10686. },
  10687. // 单元格元素事件
  10688. events: {
  10689. operate: {
  10690. 'click .btn-editone': function (e, value, row, index) {
  10691. e.stopPropagation();
  10692. e.preventDefault();
  10693. var table = $(this).closest('table');
  10694. var options = table.bootstrapTable('getOptions');
  10695. var ids = row[options.pk];
  10696. row = $.extend({}, row ? row : {}, {ids: ids});
  10697. var url = options.extend.edit_url;
  10698. Fast.api.open(Table.api.replaceurl(url, row, table), $(this).data("original-title") || $(this).attr("title") || __('Edit'), $(this).data() || {});
  10699. },
  10700. 'click .btn-delone': function (e, value, row, index) {
  10701. e.stopPropagation();
  10702. e.preventDefault();
  10703. var that = this;
  10704. var top = $(that).offset().top - $(window).scrollTop();
  10705. var left = $(that).offset().left - $(window).scrollLeft() - 260;
  10706. if (top + 154 > $(window).height()) {
  10707. top = top - 154;
  10708. }
  10709. if ($(window).width() < 480) {
  10710. top = left = undefined;
  10711. }
  10712. Layer.confirm(
  10713. __('Are you sure you want to delete this item?'),
  10714. {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true, btn: [__('OK'), __('Cancel')]},
  10715. function (index) {
  10716. var table = $(that).closest('table');
  10717. var options = table.bootstrapTable('getOptions');
  10718. Table.api.multi("del", row[options.pk], table, that);
  10719. Layer.close(index);
  10720. }
  10721. );
  10722. }
  10723. },//单元格图片预览
  10724. image: {
  10725. 'click .img-center': function (e, value, row, index) {
  10726. var data = [];
  10727. value = value === null ? '' : value.toString();
  10728. var arr = value != '' ? value.split(",") : [];
  10729. $.each(arr, function (index, value) {
  10730. data.push({
  10731. src: Fast.api.cdnurl(value),
  10732. });
  10733. });
  10734. Layer.photos({
  10735. photos: {
  10736. "start": $(this).parent().index(),
  10737. "data": data
  10738. },
  10739. anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
  10740. });
  10741. },
  10742. }
  10743. },
  10744. // 单元格数据格式化
  10745. formatter: {
  10746. icon: function (value, row, index) {
  10747. value = value === null ? '' : value.toString();
  10748. value = value.indexOf(" ") > -1 ? value : "fa fa-" + value;
  10749. //渲染fontawesome图标
  10750. return '<i class="' + value + '"></i> ' + value;
  10751. },
  10752. image: function (value, row, index) {
  10753. value = value == null || value.length === 0 ? '' : value.toString();
  10754. value = value ? value : '/assets/img/blank.gif';
  10755. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  10756. return '<a href="javascript:"><img class="' + classname + '" src="' + Fast.api.cdnurl(value) + '" /></a>';
  10757. },
  10758. images: function (value, row, index) {
  10759. value = value == null || value.length === 0 ? '' : value.toString();
  10760. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  10761. var arr = value != '' ? value.split(',') : [];
  10762. var html = [];
  10763. $.each(arr, function (i, value) {
  10764. value = value ? value : '/assets/img/blank.gif';
  10765. html.push('<a href="javascript:"><img class="' + classname + '" src="' + Fast.api.cdnurl(value) + '" /></a>');
  10766. });
  10767. return html.join(' ');
  10768. },
  10769. content: function (value, row, index) {
  10770. var width = this.width != undefined ? (this.width.match(/^\d+$/) ? this.width + "px" : this.width) : "250px";
  10771. return "<div style='white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:" + width + ";'>" + value + "</div>";
  10772. },
  10773. status: function (value, row, index) {
  10774. var custom = {normal: 'success', hidden: 'gray', deleted: 'danger', locked: 'info'};
  10775. if (typeof this.custom !== 'undefined') {
  10776. custom = $.extend(custom, this.custom);
  10777. }
  10778. this.custom = custom;
  10779. this.icon = 'fa fa-circle';
  10780. return Table.api.formatter.normal.call(this, value, row, index);
  10781. },
  10782. normal: function (value, row, index) {
  10783. var colorArr = ["primary", "success", "danger", "warning", "info", "gray", "red", "yellow", "aqua", "blue", "navy", "teal", "olive", "lime", "fuchsia", "purple", "maroon"];
  10784. var custom = {};
  10785. if (typeof this.custom !== 'undefined') {
  10786. custom = $.extend(custom, this.custom);
  10787. }
  10788. value = value == null || value.length === 0 ? '' : value.toString();
  10789. var keys = typeof this.searchList === 'object' ? Object.keys(this.searchList) : [];
  10790. var index = keys.indexOf(value);
  10791. var color = value && typeof custom[value] !== 'undefined' ? custom[value] : null;
  10792. var display = index > -1 ? this.searchList[value] : null;
  10793. var icon = typeof this.icon !== 'undefined' ? this.icon : null;
  10794. if (!color) {
  10795. color = index > -1 && typeof colorArr[index] !== 'undefined' ? colorArr[index] : 'primary';
  10796. }
  10797. if (!display) {
  10798. display = __(value.charAt(0).toUpperCase() + value.slice(1));
  10799. }
  10800. var html = '<span class="text-' + color + '">' + (icon ? '<i class="' + icon + '"></i> ' : '') + display + '</span>';
  10801. if (this.operate != false) {
  10802. html = '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + this.field + '" data-value="' + value + '">' + html + '</a>';
  10803. }
  10804. return html;
  10805. },
  10806. toggle: function (value, row, index) {
  10807. var table = this.table;
  10808. var options = table ? table.bootstrapTable('getOptions') : {};
  10809. var pk = options.pk || "id";
  10810. var color = typeof this.color !== 'undefined' ? this.color : 'success';
  10811. var yes = typeof this.yes !== 'undefined' ? this.yes : 1;
  10812. var no = typeof this.no !== 'undefined' ? this.no : 0;
  10813. var url = typeof this.url !== 'undefined' ? this.url : '';
  10814. var confirm = '';
  10815. var disable = false;
  10816. if (typeof this.confirm !== "undefined") {
  10817. confirm = typeof this.confirm === "function" ? this.confirm.call(this, value, row, index) : this.confirm;
  10818. }
  10819. if (typeof this.disable !== "undefined") {
  10820. disable = typeof this.disable === "function" ? this.disable.call(this, value, row, index) : this.disable;
  10821. }
  10822. return "<a href='javascript:;' data-toggle='tooltip' title='" + __('Click to toggle') + "' class='btn-change " + (disable ? 'btn disabled no-padding' : '') + "' data-index='" + index + "' data-id='"
  10823. + 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>";
  10824. },
  10825. url: function (value, row, index) {
  10826. value = value == null || value.length === 0 ? '' : value.toString();
  10827. 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>';
  10828. },
  10829. search: function (value, row, index) {
  10830. var field = this.field;
  10831. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  10832. value = row[this.customField];
  10833. field = this.customField;
  10834. }
  10835. return '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', value) + '" data-field="' + field + '" data-value="' + value + '">' + value + '</a>';
  10836. },
  10837. addtabs: function (value, row, index) {
  10838. var url = Table.api.replaceurl(this.url || '', row, this.table);
  10839. var title = this.atitle ? this.atitle : __("Search %s", value);
  10840. return '<a href="' + Fast.api.fixurl(url) + '" class="addtabsit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  10841. },
  10842. dialog: function (value, row, index) {
  10843. var url = Table.api.replaceurl(this.url || '', row, this.table);
  10844. var title = this.atitle ? this.atitle : __("View %s", value);
  10845. return '<a href="' + Fast.api.fixurl(url) + '" class="dialogit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  10846. },
  10847. flag: function (value, row, index) {
  10848. var that = this;
  10849. value = value == null || value.length === 0 ? '' : value.toString();
  10850. var colorArr = {index: 'success', hot: 'warning', recommend: 'danger', 'new': 'info'};
  10851. //如果字段列有定义custom
  10852. if (typeof this.custom !== 'undefined') {
  10853. colorArr = $.extend(colorArr, this.custom);
  10854. }
  10855. var field = this.field;
  10856. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  10857. value = row[this.customField];
  10858. field = this.customField;
  10859. }
  10860. if (typeof that.searchList === 'object' && typeof that.custom === 'undefined') {
  10861. var i = 0;
  10862. var searchValues = Object.values(colorArr);
  10863. $.each(that.searchList, function (key, val) {
  10864. if (typeof colorArr[key] == 'undefined') {
  10865. colorArr[key] = searchValues[i];
  10866. i = typeof searchValues[i + 1] === 'undefined' ? 0 : i + 1;
  10867. }
  10868. });
  10869. }
  10870. //渲染Flag
  10871. var html = [];
  10872. var arr = value != '' ? value.split(',') : [];
  10873. var color, display, label;
  10874. $.each(arr, function (i, value) {
  10875. value = value == null || value.length === 0 ? '' : value.toString();
  10876. if (value == '')
  10877. return true;
  10878. color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  10879. display = typeof that.searchList !== 'undefined' && typeof that.searchList[value] !== 'undefined' ? that.searchList[value] : __(value.charAt(0).toUpperCase() + value.slice(1));
  10880. label = '<span class="label label-' + color + '">' + display + '</span>';
  10881. if (that.operate) {
  10882. html.push('<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + field + '" data-value="' + value + '">' + label + '</a>');
  10883. } else {
  10884. html.push(label);
  10885. }
  10886. });
  10887. return html.join(' ');
  10888. },
  10889. label: function (value, row, index) {
  10890. return Table.api.formatter.flag.call(this, value, row, index);
  10891. },
  10892. datetime: function (value, row, index) {
  10893. var datetimeFormat = typeof this.datetimeFormat === 'undefined' ? 'YYYY-MM-DD HH:mm:ss' : this.datetimeFormat;
  10894. if (isNaN(value)) {
  10895. return value ? Moment(value).format(datetimeFormat) : __('None');
  10896. } else {
  10897. return value ? Moment(parseInt(value) * 1000).format(datetimeFormat) : __('None');
  10898. }
  10899. },
  10900. operate: function (value, row, index) {
  10901. var table = this.table;
  10902. // 操作配置
  10903. var options = table ? table.bootstrapTable('getOptions') : {};
  10904. // 默认按钮组
  10905. var buttons = $.extend([], this.buttons || []);
  10906. // 所有按钮名称
  10907. var names = [];
  10908. buttons.forEach(function (item) {
  10909. names.push(item.name);
  10910. });
  10911. if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
  10912. buttons.push(Table.button.dragsort);
  10913. }
  10914. if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
  10915. Table.button.edit.url = options.extend.edit_url;
  10916. buttons.push(Table.button.edit);
  10917. }
  10918. if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
  10919. buttons.push(Table.button.del);
  10920. }
  10921. return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
  10922. }
  10923. ,
  10924. buttons: function (value, row, index) {
  10925. // 默认按钮组
  10926. var buttons = $.extend([], this.buttons || []);
  10927. return Table.api.buttonlink(this, buttons, value, row, index, 'buttons');
  10928. }
  10929. },
  10930. buttonlink: function (column, buttons, value, row, index, type) {
  10931. var table = column.table;
  10932. column.clickToSelect = false;
  10933. type = typeof type === 'undefined' ? 'buttons' : type;
  10934. var options = table ? table.bootstrapTable('getOptions') : {};
  10935. var html = [];
  10936. var hidden, visible, disable, url, classname, icon, text, title, refresh, confirm, extend,
  10937. dropdown, link;
  10938. var fieldIndex = column.fieldIndex;
  10939. var dropdowns = {};
  10940. $.each(buttons, function (i, j) {
  10941. if (type === 'operate') {
  10942. if (j.name === 'dragsort' && typeof row[Table.config.dragsortfield] === 'undefined') {
  10943. return true;
  10944. }
  10945. if (['add', 'edit', 'del', 'multi', 'dragsort'].indexOf(j.name) > -1 && !options.extend[j.name + "_url"]) {
  10946. return true;
  10947. }
  10948. }
  10949. var attr = table.data(type + "-" + j.name);
  10950. if (typeof attr === 'undefined' || attr) {
  10951. hidden = typeof j.hidden === 'function' ? j.hidden.call(table, row, j) : (typeof j.hidden !== 'undefined' ? j.hidden : false);
  10952. if (hidden) {
  10953. return true;
  10954. }
  10955. visible = typeof j.visible === 'function' ? j.visible.call(table, row, j) : (typeof j.visible !== 'undefined' ? j.visible : true);
  10956. if (!visible) {
  10957. return true;
  10958. }
  10959. dropdown = j.dropdown ? j.dropdown : '';
  10960. url = j.url ? j.url : '';
  10961. url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
  10962. classname = j.classname ? j.classname : 'btn-primary btn-' + name + 'one';
  10963. icon = j.icon ? j.icon : '';
  10964. text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : '';
  10965. title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text;
  10966. refresh = j.refresh ? 'data-refresh="' + j.refresh + '"' : '';
  10967. confirm = typeof j.confirm === 'function' ? j.confirm.call(table, row, j) : (typeof j.confirm !== 'undefined' ? j.confirm : false);
  10968. confirm = confirm ? 'data-confirm="' + confirm + '"' : '';
  10969. extend = j.extend ? j.extend : '';
  10970. disable = typeof j.disable === 'function' ? j.disable.call(table, row, j) : (typeof j.disable !== 'undefined' ? j.disable : false);
  10971. if (disable) {
  10972. classname = classname + ' disabled';
  10973. }
  10974. 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>';
  10975. if (dropdown) {
  10976. if (typeof dropdowns[dropdown] == 'undefined') {
  10977. dropdowns[dropdown] = [];
  10978. }
  10979. dropdowns[dropdown].push(link);
  10980. } else {
  10981. html.push(link);
  10982. }
  10983. }
  10984. });
  10985. if (!$.isEmptyObject(dropdowns)) {
  10986. var dropdownHtml = [];
  10987. $.each(dropdowns, function (i, j) {
  10988. 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>');
  10989. });
  10990. html.unshift(dropdownHtml);
  10991. }
  10992. return html.join(' ');
  10993. },
  10994. //替换URL中的数据
  10995. replaceurl: function (url, row, table) {
  10996. var options = table ? table.bootstrapTable('getOptions') : null;
  10997. var ids = options ? row[options.pk] : 0;
  10998. row.ids = ids ? ids : (typeof row.ids !== 'undefined' ? row.ids : 0);
  10999. url = url == null || url.length === 0 ? '' : url.toString();
  11000. //自动添加ids参数
  11001. url = !url.match(/\{ids\}/i) ? url + (url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + '{ids}' : url;
  11002. url = url.replace(/\{(.*?)\}/gi, function (matched) {
  11003. matched = matched.substring(1, matched.length - 1);
  11004. if (matched.indexOf(".") !== -1) {
  11005. var temp = row;
  11006. var arr = matched.split(/\./);
  11007. for (var i = 0; i < arr.length; i++) {
  11008. if (typeof temp[arr[i]] !== 'undefined') {
  11009. temp = temp[arr[i]];
  11010. }
  11011. }
  11012. return typeof temp === 'object' ? '' : temp;
  11013. }
  11014. return row[matched];
  11015. });
  11016. return url;
  11017. },
  11018. // 获取选中的条目ID集合
  11019. selectedids: function (table, current) {
  11020. var options = table.bootstrapTable('getOptions');
  11021. //如果有设置翻页记忆模式
  11022. if (!current && options.maintainSelected) {
  11023. return options.selectedIds;
  11024. }
  11025. return $.map(table.bootstrapTable('getSelections'), function (row) {
  11026. return row[options.pk];
  11027. });
  11028. },
  11029. //获取选中的数据
  11030. selecteddata: function (table, current) {
  11031. var options = table.bootstrapTable('getOptions');
  11032. //如果有设置翻页记忆模式
  11033. if (!current && options.maintainSelected) {
  11034. return options.selectedData;
  11035. }
  11036. return table.bootstrapTable('getSelections');
  11037. },
  11038. // 切换复选框状态
  11039. toggleattr: function (table) {
  11040. $("input[type='checkbox']", table).trigger('click');
  11041. },
  11042. // 根据行索引获取行数据
  11043. getrowdata: function (table, index) {
  11044. index = parseInt(index);
  11045. var data = table.bootstrapTable('getData');
  11046. return typeof data[index] !== 'undefined' ? data[index] : null;
  11047. },
  11048. // 根据行索引获取行数据
  11049. getrowbyindex: function (table, index) {
  11050. return Table.api.getrowdata(table, index);
  11051. },
  11052. // 根据主键ID获取行数据
  11053. getrowbyid: function (table, id) {
  11054. var row = {};
  11055. var options = table.bootstrapTable("getOptions");
  11056. $.each(Table.api.selecteddata(table), function (i, j) {
  11057. if (j[options.pk] == id) {
  11058. row = j;
  11059. return false;
  11060. }
  11061. });
  11062. return row;
  11063. }
  11064. },
  11065. };
  11066. return Table;
  11067. });
  11068. // jQuery List DragSort v0.5.2
  11069. // Website: http://dragsort.codeplex.com/
  11070. // License: http://dragsort.codeplex.com/license
  11071. (function($) {
  11072. $.fn.dragsort = function(options) {
  11073. if (options == "destroy") {
  11074. $(this.selector).trigger("dragsort-uninit");
  11075. return;
  11076. }
  11077. var opts = $.extend({}, $.fn.dragsort.defaults, options);
  11078. var lists = [];
  11079. var list = null, lastPos = null;
  11080. this.each(function(i, cont) {
  11081. //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
  11082. if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody"))
  11083. cont = $(cont).children().get(0);
  11084. var newList = {
  11085. draggedItem: null,
  11086. placeHolderItem: null,
  11087. pos: null,
  11088. offset: null,
  11089. offsetLimit: null,
  11090. scroll: null,
  11091. container: cont,
  11092. init: function() {
  11093. //set options to default values if not set
  11094. opts.tagName = opts.tagName == "" ? ($(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase()) : opts.tagName;
  11095. if (opts.itemSelector == "")
  11096. opts.itemSelector = opts.tagName;
  11097. if (opts.dragSelector == "")
  11098. opts.dragSelector = opts.tagName;
  11099. if (opts.placeHolderTemplate == "")
  11100. opts.placeHolderTemplate = "<" + opts.tagName + ">&nbsp;</" + opts.tagName + ">";
  11101. //listidx allows reference back to correct list variable instance
  11102. $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit);
  11103. this.styleDragHandlers(true);
  11104. },
  11105. uninit: function() {
  11106. var list = lists[$(this).attr("data-listidx")];
  11107. $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit");
  11108. list.styleDragHandlers(false);
  11109. },
  11110. getItems: function() {
  11111. return $(this.container).children(opts.itemSelector);
  11112. },
  11113. styleDragHandlers: function(cursor) {
  11114. this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : "");
  11115. },
  11116. grabItem: function(e) {
  11117. var list = lists[$(this).attr("data-listidx")];
  11118. var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0);
  11119. var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0;
  11120. //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return
  11121. if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem)
  11122. return;
  11123. //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,
  11124. //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude
  11125. //e.preventDefault();
  11126. //change cursor to move while dragging
  11127. var dragHandle = e.target;
  11128. while (!$(dragHandle).is(opts.dragSelector)) {
  11129. if (dragHandle == this) return;
  11130. dragHandle = dragHandle.parentNode;
  11131. }
  11132. $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor"));
  11133. $(dragHandle).css("cursor", "move");
  11134. //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work
  11135. var listElem = this;
  11136. var trigger = function() {
  11137. list.dragStart.call(listElem, e);
  11138. $(list.container).unbind("mousemove", trigger);
  11139. };
  11140. $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); });
  11141. },
  11142. dragStart: function(e) {
  11143. if (list != null && list.draggedItem != null)
  11144. list.dropItem();
  11145. list = lists[$(this).attr("data-listidx")];
  11146. list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName)
  11147. //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
  11148. list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem));
  11149. //calculate mouse offset relative to draggedItem
  11150. var mt = parseInt(list.draggedItem.css("marginTop"));
  11151. var ml = parseInt(list.draggedItem.css("marginLeft"));
  11152. list.offset = list.draggedItem.offset();
  11153. list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1;
  11154. list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1;
  11155. //calculate box the dragged item can't be dragged outside of
  11156. if (!opts.dragBetween) {
  11157. 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();
  11158. list.offsetLimit = $(list.container).offset();
  11159. list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth();
  11160. list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
  11161. }
  11162. //create placeholder item
  11163. var h = list.draggedItem.height();
  11164. var w = list.draggedItem.width();
  11165. if (opts.tagName == "tr") {
  11166. list.draggedItem.children().each(function() { $(this).width($(this).width()); });
  11167. list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true);
  11168. list.draggedItem.after(list.placeHolderItem);
  11169. //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html("&nbsp;"); });
  11170. list.placeHolderItem.children().each(function() { $(this).html("&nbsp;"); });
  11171. } else {
  11172. list.draggedItem.after(opts.placeHolderTemplate);
  11173. list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true);
  11174. }
  11175. if (opts.tagName == "td") {
  11176. var listTable = list.draggedItem.closest("table").get(0);
  11177. $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").appendTo("body").children().append(list.draggedItem);
  11178. }
  11179. //style draggedItem while dragging
  11180. var orig = list.draggedItem.attr("style");
  11181. list.draggedItem.attr("data-origstyle", orig ? orig : "");
  11182. list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w });
  11183. //auto-scroll setup
  11184. list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() };
  11185. list.scroll.scrollY = window.setInterval(function() {
  11186. if (opts.scrollContainer != window) {
  11187. $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY);
  11188. return;
  11189. }
  11190. var t = $(opts.scrollContainer).scrollTop();
  11191. if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) {
  11192. $(opts.scrollContainer).scrollTop(t + list.scroll.moveY);
  11193. list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1);
  11194. }
  11195. }, 10);
  11196. list.scroll.scrollX = window.setInterval(function() {
  11197. if (opts.scrollContainer != window) {
  11198. $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX);
  11199. return;
  11200. }
  11201. var l = $(opts.scrollContainer).scrollLeft();
  11202. if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) {
  11203. $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX);
  11204. list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1);
  11205. }
  11206. }, 10);
  11207. //misc
  11208. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  11209. list.setPos(e.pageX, e.pageY);
  11210. $(document).bind("mousemove", list.swapItems);
  11211. $(document).bind("mouseup", list.dropItem);
  11212. if (opts.scrollContainer != window)
  11213. $(window).bind("wheel", list.wheel);
  11214. },
  11215. //set position of draggedItem
  11216. setPos: function(x, y) {
  11217. //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner
  11218. var top = y - this.offset.top;
  11219. var left = x - this.offset.left;
  11220. //limit top, left to within box draggedItem can't be dragged outside of
  11221. if (!opts.dragBetween) {
  11222. top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
  11223. left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
  11224. }
  11225. //adjust top & left calculations to parent offset
  11226. var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin
  11227. if (parent != null) {
  11228. top -= parent.top;
  11229. left -= parent.left;
  11230. }
  11231. //set x or y auto-scroll amount
  11232. if (opts.scrollContainer == window) {
  11233. y -= $(window).scrollTop();
  11234. x -= $(window).scrollLeft();
  11235. y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5);
  11236. x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5);
  11237. } else {
  11238. var cont = $(opts.scrollContainer);
  11239. var offset = cont.offset();
  11240. y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top);
  11241. x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left);
  11242. }
  11243. list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x);
  11244. list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y);
  11245. //move draggedItem to new mouse cursor location
  11246. this.draggedItem.css({ top: top, left: left });
  11247. },
  11248. //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over
  11249. wheel: function(e) {
  11250. if (list && opts.scrollContainer != window) {
  11251. var cont = $(opts.scrollContainer);
  11252. var offset = cont.offset();
  11253. e = e.originalEvent;
  11254. if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) {
  11255. var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY;
  11256. cont.scrollTop(cont.scrollTop() + deltaY);
  11257. e.preventDefault();
  11258. }
  11259. }
  11260. },
  11261. //build a table recording all the positions of the moveable list items
  11262. buildPositionTable: function() {
  11263. var pos = [];
  11264. this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) {
  11265. var loc = $(this).offset();
  11266. loc.right = loc.left + $(this).outerWidth();
  11267. loc.bottom = loc.top + $(this).outerHeight();
  11268. loc.elm = this;
  11269. pos[i] = loc;
  11270. });
  11271. this.pos = pos;
  11272. },
  11273. dropItem: function() {
  11274. if (list.draggedItem == null)
  11275. return;
  11276. //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower
  11277. //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower)
  11278. var orig = list.draggedItem.attr("data-origstyle");
  11279. list.draggedItem.attr("style", orig);
  11280. if (orig == "")
  11281. list.draggedItem.removeAttr("style");
  11282. list.draggedItem.removeAttr("data-origstyle");
  11283. list.styleDragHandlers(true);
  11284. list.placeHolderItem.before(list.draggedItem);
  11285. list.placeHolderItem.remove();
  11286. $("[data-droptarget], .dragSortItem").remove();
  11287. window.clearInterval(list.scroll.scrollY);
  11288. window.clearInterval(list.scroll.scrollX);
  11289. //if position changed call dragEnd
  11290. if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem))
  11291. if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order
  11292. var pos = list.draggedItem.attr("data-origpos").split('-');
  11293. var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]);
  11294. if (nextItem.size() > 0)
  11295. nextItem.before(list.draggedItem);
  11296. else if (pos[1] == 0) //was the only item in list
  11297. $(lists[pos[0]].container).prepend(list.draggedItem);
  11298. else //was the last item in list
  11299. $(lists[pos[0]].container).append(list.draggedItem);
  11300. }
  11301. list.draggedItem.removeAttr("data-origpos");
  11302. list.draggedItem = null;
  11303. $(document).unbind("mousemove", list.swapItems);
  11304. $(document).unbind("mouseup", list.dropItem);
  11305. if (opts.scrollContainer != window)
  11306. $(window).unbind("wheel", list.wheel);
  11307. return false;
  11308. },
  11309. //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of
  11310. swapItems: function(e) {
  11311. if (list.draggedItem == null)
  11312. return false;
  11313. //move draggedItem to mouse location
  11314. list.setPos(e.pageX, e.pageY);
  11315. //retrieve list and item position mouse cursor is over
  11316. var ei = list.findPos(e.pageX, e.pageY);
  11317. var nlist = list;
  11318. for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) {
  11319. ei = lists[i].findPos(e.pageX, e.pageY);
  11320. nlist = lists[i];
  11321. }
  11322. //if not over another moveable list item return
  11323. if (ei == -1)
  11324. return false;
  11325. //save fixed items locations
  11326. var children = function() { return $(nlist.container).children().not(nlist.draggedItem); };
  11327. var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); });
  11328. //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after
  11329. if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left)
  11330. $(nlist.pos[ei].elm).before(list.placeHolderItem);
  11331. else
  11332. $(nlist.pos[ei].elm).after(list.placeHolderItem);
  11333. //restore fixed items location
  11334. fixed.each(function() {
  11335. var elm = children().eq(this.idx).get(0);
  11336. if (this != elm && children().index(this) < this.idx)
  11337. $(this).insertAfter(elm);
  11338. else if (this != elm)
  11339. $(this).insertBefore(elm);
  11340. });
  11341. //misc
  11342. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  11343. lastPos = list.draggedItem.offset();
  11344. return false;
  11345. },
  11346. //returns the index of the list item the mouse is over
  11347. findPos: function(x, y) {
  11348. for (var i = 0; i < this.pos.length; i++) {
  11349. if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y)
  11350. return i;
  11351. }
  11352. return -1;
  11353. },
  11354. //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position
  11355. createDropTargets: function() {
  11356. if (!opts.dragBetween)
  11357. return;
  11358. $(lists).each(function() {
  11359. var ph = $(this.container).find("[data-placeholder]");
  11360. var dt = $(this.container).find("[data-droptarget]");
  11361. if (ph.size() > 0 && dt.size() > 0)
  11362. dt.remove();
  11363. else if (ph.size() == 0 && dt.size() == 0) {
  11364. if (opts.tagName == "td")
  11365. $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container);
  11366. else
  11367. //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8)
  11368. $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true));
  11369. list.placeHolderItem.attr("data-placeholder", true);
  11370. }
  11371. });
  11372. }
  11373. };
  11374. newList.init();
  11375. lists.push(newList);
  11376. });
  11377. return this;
  11378. };
  11379. $.fn.dragsort.defaults = {
  11380. tagName:"",
  11381. itemSelector: "",
  11382. dragSelector: "",
  11383. dragSelectorExclude: "input, textarea",
  11384. dragEnd: function() { },
  11385. dragBetween: false,
  11386. placeHolderTemplate: "",
  11387. scrollContainer: window,
  11388. scrollSpeed: 5
  11389. };
  11390. })(jQuery);
  11391. define("dragsort", function(){});
  11392. /*!
  11393. * jquery.event.drag - v 2.2
  11394. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  11395. * Open Source MIT License - http://threedubmedia.com/code/license
  11396. */
  11397. ;(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);
  11398. define("drag", function(){});
  11399. /*!
  11400. * jquery.event.drop - v 2.2
  11401. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  11402. * Open Source MIT License - http://threedubmedia.com/code/license
  11403. */
  11404. ;(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);
  11405. define("drop", function(){});
  11406. /**
  11407. * @summary SelectPage
  11408. * @desc Simple and powerful selection plugin
  11409. * @file selectpage.js
  11410. * @version 2.19
  11411. * @author TerryZeng
  11412. * @contact https://terryz.github.io/
  11413. * @license MIT License
  11414. *
  11415. */
  11416. ;(function ($) {
  11417. "use strict";
  11418. /**
  11419. * Default options
  11420. */
  11421. var defaults = {
  11422. /**
  11423. * Data source
  11424. * @type {string|Object}
  11425. *
  11426. * string:server side request url address
  11427. * Object:JSON array,format:[{a:1,b:2,c:3},{...}]
  11428. */
  11429. data: undefined,
  11430. /**
  11431. * Language ('cn', 'en')
  11432. * @type string
  11433. * @default 'cn'
  11434. */
  11435. lang: 'cn',
  11436. /**
  11437. * Multiple select mode(tags)
  11438. * @type boolean
  11439. * @default false
  11440. */
  11441. multiple: false,
  11442. /**
  11443. * pagination or not
  11444. * @type boolean
  11445. * @default true
  11446. */
  11447. pagination: true,
  11448. /**
  11449. * Show up menu button
  11450. * @type boolean
  11451. * @default true
  11452. */
  11453. dropButton: true,
  11454. /**
  11455. * Result list visible size in pagination bar close
  11456. * @type number
  11457. * @default 10
  11458. */
  11459. listSize: 10,
  11460. /**
  11461. * Show control bar in multiple select mode
  11462. * @type boolean
  11463. * @default true
  11464. */
  11465. multipleControlbar: true,
  11466. /**
  11467. * Max selected item limited in multiple select mode
  11468. * @type number
  11469. * @default 0(unlimited)
  11470. */
  11471. maxSelectLimit: 0,
  11472. /**
  11473. * Select result item to close list, work on multiple select mode
  11474. * @type boolean
  11475. * @default false
  11476. */
  11477. selectToCloseList: false,
  11478. /**
  11479. * Init selected item key, the result will match to option.keyField option
  11480. * @type string
  11481. */
  11482. initRecord: undefined,
  11483. /**
  11484. * The table parameter in server side mode
  11485. * @type string
  11486. */
  11487. dbTable: 'tbl',
  11488. /**
  11489. * The value field, the value will fill to hidden element
  11490. * @type string
  11491. * @default 'id'
  11492. */
  11493. keyField: 'id',
  11494. /**
  11495. * The show text field, the text will show to input element or tags(multiple mode)
  11496. * @type string
  11497. * @default 'name'
  11498. */
  11499. showField: 'name',
  11500. /**
  11501. * Actually used to search field
  11502. * @type string
  11503. */
  11504. searchField: undefined,
  11505. /**
  11506. * Search type ('AND' or 'OR')
  11507. * @type string
  11508. * @default 'AND'
  11509. */
  11510. andOr: 'OR',
  11511. /**
  11512. * Result sort type
  11513. * @type array|boolean - if not set, will default used showField field
  11514. * @example
  11515. * orderBy : ['id desc']
  11516. */
  11517. orderBy: undefined,
  11518. /**
  11519. * Page size
  11520. * @type number
  11521. * @default 10
  11522. */
  11523. pageSize: 10,
  11524. /**
  11525. * Server side request parameters
  11526. * @type function
  11527. * @return object
  11528. * @example params : function(){return {'name':'aa','sex':1};}
  11529. */
  11530. params: undefined,
  11531. /**
  11532. * Custom result list item show text
  11533. * @type function
  11534. * @param data {object} row data
  11535. * @return string
  11536. */
  11537. formatItem: undefined,
  11538. /**
  11539. * Have some highlight item and lost focus, auto select the highlight item
  11540. * @type boolean
  11541. * @default false
  11542. */
  11543. autoFillResult: false,
  11544. /**
  11545. * Auto select first item in show up result list or search result
  11546. * depend on `autoFillResult` option set to true
  11547. * @type boolean
  11548. * @default false
  11549. */
  11550. autoSelectFirst: false,
  11551. /**
  11552. * Whether clear input element text when enter some keywords to search and no result return
  11553. * @type boolean
  11554. * @default true
  11555. */
  11556. noResultClean: true,
  11557. /**
  11558. * Select only mode
  11559. * @type boolean
  11560. */
  11561. selectOnly: false,
  11562. /**
  11563. * Input to search delay time, work on ajax data source
  11564. * @type number
  11565. * @default 0.5
  11566. */
  11567. inputDelay: 0.5,
  11568. /**
  11569. * -----------------------------------------Callback--------------------------------------------
  11570. */
  11571. /**
  11572. * Result list item selected callback
  11573. * @type function
  11574. * @param object - selected item json data
  11575. * @param self - plugin object
  11576. */
  11577. eSelect: undefined,
  11578. /**
  11579. * Before result list show up callback, you can do anything prepared
  11580. * @param self - plugin object
  11581. */
  11582. eOpen: undefined,
  11583. /**
  11584. * Server side return data convert callback
  11585. * @type function
  11586. * @param data {object} server side return data
  11587. * @param self {object} plugin object
  11588. * @return {object} return data format:
  11589. * @example
  11590. * {
  11591. * list : [{name:'aa',sex:1},{name:'bb',sex:1}...],
  11592. * totalRow : 100
  11593. * }
  11594. */
  11595. eAjaxSuccess: undefined,
  11596. /**
  11597. * Close selected item tag callback (multiple mode)
  11598. * @type function
  11599. * @param removeCount {number} remove item count
  11600. * @param self {object} plugin object
  11601. */
  11602. eTagRemove: undefined,
  11603. /**
  11604. * Clear selected item callback(single select mode)
  11605. * @type function
  11606. * @param self {object} plugin object
  11607. */
  11608. eClear: undefined
  11609. };
  11610. /**
  11611. * SelectPage class definition
  11612. * @constructor
  11613. * @param {Object} input - input element
  11614. * @param {Object} option
  11615. */
  11616. var SelectPage = function (input, option) {
  11617. //特殊字段处理
  11618. $.each({data: 'source', keyField: 'primaryKey', showField: 'field', pageSize: 'perPage'}, function (i, j) {
  11619. if (typeof option[j] !== 'undefined') {
  11620. option[i] = option[j];
  11621. delete option[j];
  11622. }
  11623. });
  11624. this.setOption(option);
  11625. this.setLanguage();
  11626. this.setCssClass();
  11627. this.setProp();
  11628. this.setElem(input);
  11629. this.setButtonAttrDefault();
  11630. this.setInitRecord();
  11631. this.eDropdownButton();
  11632. this.eInput();
  11633. this.eWhole();
  11634. };
  11635. /**
  11636. * Plugin version number
  11637. */
  11638. SelectPage.version = '2.19';
  11639. /**
  11640. * Plugin object cache key
  11641. */
  11642. SelectPage.dataKey = 'selectPageObject';
  11643. /**
  11644. * Options set
  11645. * @param {Object} option
  11646. */
  11647. SelectPage.prototype.setOption = function (option) {
  11648. //use showField to default
  11649. option.searchField = option.searchField || option.showField;
  11650. option.andOr = option.andOr.toUpperCase();
  11651. if (option.andOr !== 'AND' && option.andOr !== 'OR') option.andOr = 'AND';
  11652. //support multiple field set
  11653. var arr = ['searchField'];
  11654. for (var i = 0; i < arr.length; i++) {
  11655. option[arr[i]] = this.strToArray(option[arr[i]]);
  11656. }
  11657. //set default order field
  11658. option.orderBy = option.orderBy || option.showField;
  11659. //set multiple order field
  11660. //example: [ ['id', 'ASC'], ['name', 'DESC'] ]
  11661. if (option.orderBy !== false) option.orderBy = this.setOrderbyOption(option.orderBy, option.showField);
  11662. //close auto fill result and auto select first in multiple mode and select item not close list
  11663. if (option.multiple && !option.selectToCloseList) {
  11664. option.autoFillResult = false;
  11665. option.autoSelectFirst = false;
  11666. }
  11667. //show all item when pagination bar close, limited 200
  11668. if (!option.pagination) option.pageSize = 200;
  11669. if ($.type(option.listSize) !== 'number' || option.listSize < 0) option.listSize = 10;
  11670. if (typeof option.formatItem === 'string') {
  11671. var _formatItem = option.formatItem;
  11672. option.formatItem = function (row) {
  11673. if (typeof Template === 'function' && _formatItem.match(/\#([a-zA-Z0-9_\-]+)$/)) {
  11674. return Template(_formatItem.substring(1), row);
  11675. } else {
  11676. return _formatItem.replace(/\{(.*?)\}/gi, function (matched) {
  11677. matched = matched.substring(1, matched.length - 1);
  11678. return typeof row[matched] !== 'undefined' ? row[matched] : '';
  11679. });
  11680. }
  11681. };
  11682. }
  11683. this.option = option;
  11684. };
  11685. /**
  11686. * String convert to array
  11687. * @param str {string}
  11688. * @return {Array}
  11689. */
  11690. SelectPage.prototype.strToArray = function (str) {
  11691. return str ? str.replace(/[\s ]+/g, '').split(',') : '';
  11692. };
  11693. /**
  11694. * Set order field
  11695. * @param {Array} arg_order
  11696. * @param {string} arg_field - default sort field
  11697. * @return {Array}
  11698. */
  11699. SelectPage.prototype.setOrderbyOption = function (arg_order, arg_field) {
  11700. var arr = [], orders = [];
  11701. if (typeof arg_order === 'object') {
  11702. for (var i = 0; i < arg_order.length; i++) {
  11703. orders = $.trim(arg_order[i]).split(' ');
  11704. if (orders.length)
  11705. arr.push((orders.length === 2) ? orders.concat() : [orders[0], 'ASC']);
  11706. }
  11707. } else {
  11708. orders = $.trim(arg_order).split(' ');
  11709. arr[0] = (orders.length === 2) ? orders.concat() : (orders[0].toUpperCase().match(/^(ASC|DESC)$/i)) ? [arg_field, orders[0].toUpperCase()] : [orders[0], 'ASC'];
  11710. }
  11711. return arr;
  11712. };
  11713. /**
  11714. * i18n
  11715. */
  11716. SelectPage.prototype.setLanguage = function () {
  11717. var message, p = this.option;
  11718. switch (p.lang) {
  11719. // English
  11720. case 'en':
  11721. message = {
  11722. add_btn: 'Add button',
  11723. add_title: 'add a box',
  11724. del_btn: 'Del button',
  11725. del_title: 'delete a box',
  11726. next: 'Next',
  11727. next_title: 'Next' + p.pageSize + ' (Right key)',
  11728. prev: 'Prev',
  11729. prev_title: 'Prev' + p.pageSize + ' (Left key)',
  11730. first_title: 'First (Shift + Left key)',
  11731. last_title: 'Last (Shift + Right key)',
  11732. get_all_btn: 'Get All (Down key)',
  11733. get_all_alt: '(button)',
  11734. close_btn: 'Close (Tab key)',
  11735. close_alt: '(button)',
  11736. loading: 'loading...',
  11737. loading_alt: '(loading)',
  11738. page_info: 'page_num of page_count',
  11739. select_ng: 'Attention : Please choose from among the list.',
  11740. select_ok: 'OK : Correctly selected.',
  11741. not_found: 'not found',
  11742. ajax_error: 'An error occurred while connecting to server.',
  11743. clear: 'Clear content',
  11744. select_all: 'Select current page',
  11745. unselect_all: 'Clear current page',
  11746. clear_all: 'Clear all selected',
  11747. max_selected: 'You can only select up to max_selected_limit items'
  11748. };
  11749. break;
  11750. // 中文
  11751. case 'cn':
  11752. default:
  11753. message = {
  11754. add_btn: '添加按钮',
  11755. add_title: '添加区域',
  11756. del_btn: '删除按钮',
  11757. del_title: '删除区域',
  11758. next: '下一页',
  11759. next_title: '下' + p.pageSize + ' (→)',
  11760. prev: '上一页',
  11761. prev_title: '上' + p.pageSize + ' (←)',
  11762. first_title: '首页 (Shift + ←)',
  11763. last_title: '尾页 (Shift + →)',
  11764. get_all_btn: '获得全部 (↓)',
  11765. get_all_alt: '(按钮)',
  11766. close_btn: '关闭 (Tab键)',
  11767. close_alt: '(按钮)',
  11768. loading: '读取中...',
  11769. loading_alt: '(读取中)',
  11770. page_info: '第 page_num 页(共page_count页)',
  11771. select_ng: '请注意:请从列表中选择.',
  11772. select_ok: 'OK : 已经选择.',
  11773. not_found: '无查询结果',
  11774. ajax_error: '连接到服务器时发生错误!',
  11775. clear: '清除内容',
  11776. select_all: '选择当前页项目',
  11777. unselect_all: '取消选择当前页项目',
  11778. clear_all: '清除全部已选择项目',
  11779. max_selected: '最多只能选择 max_selected_limit 个项目'
  11780. };
  11781. break;
  11782. }
  11783. this.message = message;
  11784. };
  11785. /**
  11786. * Css classname defined
  11787. */
  11788. SelectPage.prototype.setCssClass = function () {
  11789. var css_class = {
  11790. container: 'sp_container',
  11791. container_open: 'sp_container_open',
  11792. re_area: 'sp_result_area',
  11793. result_open: 'sp_result_area_open',
  11794. control_box: 'sp_control_box',
  11795. //multiple select mode
  11796. element_box: 'sp_element_box',
  11797. navi: 'sp_navi',
  11798. //result list
  11799. results: 'sp_results',
  11800. re_off: 'sp_results_off',
  11801. select: 'sp_over',
  11802. select_ok: 'sp_select_ok',
  11803. select_ng: 'sp_select_ng',
  11804. selected: 'sp_selected',
  11805. input_off: 'sp_input_off',
  11806. message_box: 'sp_message_box',
  11807. disabled: 'sp_disabled',
  11808. button: 'sp_button',
  11809. caret_open: 'sp_caret_open',
  11810. btn_on: 'sp_btn_on',
  11811. btn_out: 'sp_btn_out',
  11812. input: 'sp_input',
  11813. clear_btn: 'sp_clear_btn',
  11814. align_right: 'sp_align_right'
  11815. };
  11816. this.css_class = css_class;
  11817. };
  11818. /**
  11819. * Plugin inner properties
  11820. */
  11821. SelectPage.prototype.setProp = function () {
  11822. this.prop = {
  11823. //input disabled status
  11824. disabled: false,
  11825. current_page: 1,
  11826. //total page
  11827. max_page: 1,
  11828. //ajax data loading status
  11829. is_loading: false,
  11830. xhr: false,
  11831. key_paging: false,
  11832. key_select: false,
  11833. //last selected item value
  11834. prev_value: '',
  11835. //last selected item text
  11836. selected_text: '',
  11837. last_input_time: undefined,
  11838. init_set: false
  11839. };
  11840. this.template = {
  11841. tag: {
  11842. content: '<li class="selected_tag" itemvalue="#item_value#">#item_text#<span class="tag_close"><i class="spfont sp-close"></i></span></li>',
  11843. textKey: '#item_text#',
  11844. valueKey: '#item_value#'
  11845. },
  11846. page: {
  11847. current: 'page_num',
  11848. total: 'page_count'
  11849. },
  11850. msg: {
  11851. maxSelectLimit: 'max_selected_limit'
  11852. }
  11853. };
  11854. };
  11855. /**
  11856. * Get the actual width/height of invisible DOM elements with jQuery.
  11857. * Source code come from dreamerslab/jquery.actual
  11858. * @param element
  11859. * @param method
  11860. * @returns {*}
  11861. */
  11862. SelectPage.prototype.elementRealSize = function (element, method) {
  11863. var defaults = {
  11864. absolute: false,
  11865. clone: false,
  11866. includeMargin: false,
  11867. display: 'block'
  11868. };
  11869. var configs = defaults, $target = element.eq(0), fix, restore, tmp = [], style = '', $hidden;
  11870. fix = function () {
  11871. // get all hidden parents
  11872. $hidden = $target.parents().addBack().filter(':hidden');
  11873. style += 'visibility: hidden !important; display: ' + configs.display + ' !important; ';
  11874. if (configs.absolute === true) style += 'position: absolute !important;';
  11875. // save the origin style props
  11876. // set the hidden el css to be got the actual value later
  11877. $hidden.each(function () {
  11878. // Save original style. If no style was set, attr() returns undefined
  11879. var $this = $(this), thisStyle = $this.attr('style');
  11880. tmp.push(thisStyle);
  11881. // Retain as much of the original style as possible, if there is one
  11882. $this.attr('style', thisStyle ? thisStyle + ';' + style : style);
  11883. });
  11884. };
  11885. restore = function () {
  11886. // restore origin style values
  11887. $hidden.each(function (i) {
  11888. var $this = $(this), _tmp = tmp[i];
  11889. if (_tmp === undefined) $this.removeAttr('style');
  11890. else $this.attr('style', _tmp);
  11891. });
  11892. };
  11893. fix();
  11894. // get the actual value with user specific methed
  11895. // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc
  11896. // configs.includeMargin only works for 'outerWidth' and 'outerHeight'
  11897. var actual = /(outer)/.test(method) ?
  11898. $target[method](configs.includeMargin) :
  11899. $target[method]();
  11900. restore();
  11901. // IMPORTANT, this plugin only return the value of the first element
  11902. return actual;
  11903. };
  11904. /**
  11905. * Dom building
  11906. * @param {Object} combo_input - original input element
  11907. */
  11908. SelectPage.prototype.setElem = function (combo_input) {
  11909. // 1. build Dom object
  11910. var elem = {}, p = this.option, css = this.css_class, msg = this.message, input = $(combo_input);
  11911. var cssWidth = input.css("width");
  11912. var orgWidth = input.outerWidth();
  11913. if (cssWidth.indexOf("%") > -1 || input.parent().size() > 0 && input.parent().width() == orgWidth) {
  11914. orgWidth = "100%";
  11915. } else {
  11916. // fix input width in hidden situation
  11917. if (orgWidth <= 0) orgWidth = this.elementRealSize(input, 'outerWidth');
  11918. if (orgWidth < 150) orgWidth = 150;
  11919. }
  11920. elem.combo_input = input.attr({'autocomplete': 'off'}).addClass(css.input).wrap('<div>');
  11921. if (p.selectOnly) elem.combo_input.prop('readonly', true);
  11922. elem.container = elem.combo_input.parent().addClass(css.container);
  11923. if (elem.combo_input.prop('disabled')) {
  11924. if (p.multiple) elem.container.addClass(css.disabled);
  11925. else elem.combo_input.addClass(css.input_off);
  11926. }
  11927. // set outer box width
  11928. elem.container.width(orgWidth);
  11929. elem.button = $('<div>').addClass(css.button);
  11930. //drop down button
  11931. elem.dropdown = $('<span class="sp_caret"></span>');
  11932. //clear button 'X' in single mode
  11933. elem.clear_btn = $('<div>').html($('<i>').addClass('spfont sp-close')).addClass(css.clear_btn).attr('title', msg.clear);
  11934. if (!p.dropButton) elem.clear_btn.addClass(css.align_right);
  11935. //main box in multiple mode
  11936. elem.element_box = $('<ul>').addClass(css.element_box);
  11937. if (p.multiple && p.multipleControlbar)
  11938. elem.control = $('<div>').addClass(css.control_box);
  11939. //result list box
  11940. elem.result_area = $('<div>').addClass(css.re_area);
  11941. //pagination bar
  11942. if (p.pagination) elem.navi = $('<div>').addClass('sp_pagination').append('<ul>');
  11943. elem.results = $('<ul>').addClass(css.results);
  11944. var namePrefix = '_text',
  11945. input_id = elem.combo_input.attr('id') || elem.combo_input.attr('name'),
  11946. input_name = elem.combo_input.attr('name') || 'selectPage',
  11947. hidden_name = input_name,
  11948. hidden_id = input_id;
  11949. //switch the id and name attributes of input/hidden element
  11950. elem.hidden = $('<input type="hidden" class="sp_hidden" />').attr({
  11951. name: hidden_name,
  11952. id: hidden_id
  11953. }).val('');
  11954. elem.combo_input.attr({
  11955. name: typeof input.data('name') !== 'undefined' ? input.data('name') : input_name + namePrefix,
  11956. id: input_id + namePrefix
  11957. });
  11958. // 2. DOM element put
  11959. elem.container.append(elem.hidden);
  11960. if (p.dropButton) {
  11961. elem.container.append(elem.button)
  11962. elem.button.append(elem.dropdown);
  11963. }
  11964. $(document.body).append(elem.result_area);
  11965. elem.result_area.append(elem.results);
  11966. if (p.pagination) elem.result_area.append(elem.navi);
  11967. //Multiple select mode
  11968. if (p.multiple) {
  11969. if (p.multipleControlbar) {
  11970. elem.control.append('<button type="button" class="btn btn-default sp_clear_all" ><i class="spfont sp-clear"></i></button>');
  11971. elem.control.append('<button type="button" class="btn btn-default sp_unselect_all" ><i class="spfont sp-unselect-all"></i></button>');
  11972. elem.control.append('<button type="button" class="btn btn-default sp_select_all" ><i class="spfont sp-select-all"></i></button>');
  11973. elem.control_text = $('<p>');
  11974. elem.control.append(elem.control_text);
  11975. elem.result_area.prepend(elem.control);
  11976. }
  11977. elem.container.addClass('sp_container_combo');
  11978. elem.combo_input.addClass('sp_combo_input').before(elem.element_box);
  11979. var li = $('<li>').addClass('input_box');
  11980. li.append(elem.combo_input);
  11981. elem.element_box.append(li);
  11982. if (elem.combo_input.attr('placeholder')) elem.combo_input.attr('placeholder_bak', elem.combo_input.attr('placeholder'));
  11983. }
  11984. this.elem = elem;
  11985. };
  11986. /**
  11987. * Drop down button set to default
  11988. */
  11989. SelectPage.prototype.setButtonAttrDefault = function () {
  11990. /*
  11991. if (this.option.selectOnly) {
  11992. if ($(this.elem.combo_input).val() !== '') {
  11993. if ($(this.elem.hidden).val() !== '') {
  11994. //选择条件
  11995. $(this.elem.combo_input).attr('title', this.message.select_ok).removeClass(this.css_class.select_ng).addClass(this.css_class.select_ok);
  11996. } else {
  11997. //输入方式
  11998. $(this.elem.combo_input).attr('title', this.message.select_ng).removeClass(this.css_class.select_ok).addClass(this.css_class.select_ng);
  11999. }
  12000. } else {
  12001. $(this.elem.hidden).val('');
  12002. $(this.elem.combo_input).removeAttr('title').removeClass(this.css_class.select_ng);
  12003. }
  12004. }
  12005. */
  12006. //this.elem.button.attr('title', this.message.get_all_btn);
  12007. if (this.option.dropButton)
  12008. this.elem.button.attr('title', this.message.close_btn);
  12009. };
  12010. /**
  12011. * Set item need selected after init
  12012. * set selected item ways:
  12013. * <input value="key">
  12014. * <input data-init="key">
  12015. */
  12016. SelectPage.prototype.setInitRecord = function (refresh) {
  12017. var self = this, p = self.option, el = self.elem, key = '';
  12018. if ($.type(el.combo_input.data('init')) != 'undefined')
  12019. p.initRecord = String(el.combo_input.data('init'));
  12020. //data-init and value attribute can be init plugin selected item
  12021. //but, if set data-init and value attribute in the same time, plugin will choose data-init attribute first
  12022. if (!refresh && !p.initRecord && el.combo_input.val())
  12023. p.initRecord = el.combo_input.val();
  12024. el.combo_input.val('');
  12025. if (!refresh) el.hidden.val(p.initRecord);
  12026. key = refresh && el.hidden.val() ? el.hidden.val() : p.initRecord;
  12027. if (key) {
  12028. if (typeof p.data === 'object') {
  12029. var data = new Array();
  12030. var keyarr = key.split(',');
  12031. $.each(keyarr, function (index, row) {
  12032. for (var i = 0; i < p.data.length; i++) {
  12033. if (p.data[i][p.keyField] == row) {
  12034. data.push(p.data[i]);
  12035. break;
  12036. }
  12037. }
  12038. });
  12039. if (!p.multiple && data.length > 1) data = [data[0]];
  12040. self.afterInit(self, data);
  12041. } else {//ajax data source mode to init selected item
  12042. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  12043. var _orgParams = {
  12044. searchTable: p.dbTable,
  12045. searchKey: p.keyField,
  12046. searchValue: key,
  12047. orderBy: p.orderBy,
  12048. showField: p.showField,
  12049. keyField: p.keyField,
  12050. keyValue: key,
  12051. searchField: p.searchField
  12052. };
  12053. if (_paramsFunc) {
  12054. var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
  12055. if (result && $.isPlainObject(result)) {
  12056. _params = $.extend({}, _orgParams, result);
  12057. } else {
  12058. _params = _orgParams;
  12059. }
  12060. } else {
  12061. _params = _orgParams;
  12062. }
  12063. $.ajax({
  12064. dataType: 'json',
  12065. type: 'POST',
  12066. url: p.data,
  12067. data: _params,
  12068. success: function (json) {
  12069. var d = null;
  12070. if (p.eAjaxSuccess && $.isFunction(p.eAjaxSuccess))
  12071. d = p.eAjaxSuccess(json);
  12072. self.afterInit(self, d.list);
  12073. },
  12074. error: function (jqXHR, textStatus, errorThrown) {
  12075. self.ajaxErrorNotify(self, errorThrown);
  12076. }
  12077. });
  12078. }
  12079. }
  12080. };
  12081. /**
  12082. * Selected item set to plugin
  12083. * @param {Object} self
  12084. * @param {Object} data - selected item data
  12085. */
  12086. SelectPage.prototype.afterInit = function (self, data) {
  12087. if (!data || ($.isArray(data) && data.length === 0)) return;
  12088. if (!$.isArray(data)) data = [data];
  12089. var p = self.option, css = self.css_class;
  12090. self.data = data;
  12091. if (p.multiple) {
  12092. self.prop.init_set = true;
  12093. self.clearAll(self);
  12094. $.each(data, function (i, row) {
  12095. var value = row[p.keyField];
  12096. var text = row[p.showField];
  12097. var item = {text: text, value: value};
  12098. if (!self.isAlreadySelected(self, item)) self.addNewTag(self, row, item);
  12099. });
  12100. self.tagValuesSet(self);
  12101. self.inputResize(self);
  12102. self.elem.hidden.blur();
  12103. self.prop.init_set = false;
  12104. } else {
  12105. var row = data[0];
  12106. var value = row[p.keyField];
  12107. var text = row[p.showField];
  12108. self.elem.combo_input.val(text);
  12109. self.elem.hidden.val(value);
  12110. self.prop.prev_value = text;
  12111. self.prop.selected_text = text;
  12112. if (p.selectOnly) {
  12113. self.elem.combo_input.attr('title', self.message.select_ok).removeClass(css.select_ng).addClass(css.select_ok);
  12114. }
  12115. self.putClearButton();
  12116. }
  12117. };
  12118. /**
  12119. * Drop down button event bind
  12120. */
  12121. SelectPage.prototype.eDropdownButton = function () {
  12122. var self = this;
  12123. if (self.option.dropButton) {
  12124. self.elem.button.mouseup(function (ev) {
  12125. ev.stopPropagation();
  12126. if (self.elem.result_area.is(':hidden') && !self.elem.combo_input.prop('disabled')) {
  12127. self.elem.combo_input.focus();
  12128. } else self.hideResults(self);
  12129. });
  12130. }
  12131. };
  12132. /**
  12133. * Events bind
  12134. */
  12135. SelectPage.prototype.eInput = function () {
  12136. var self = this, p = self.option, el = self.elem, msg = self.message;
  12137. var showList = function () {
  12138. self.prop.page_move = false;
  12139. self.suggest(self);
  12140. self.setCssFocusedInput(self);
  12141. };
  12142. el.combo_input.keyup(function (e) {
  12143. self.processKey(self, e);
  12144. }).keydown(function (e) {
  12145. self.processControl(self, e);
  12146. }).focus(function (e) {
  12147. //When focus on input, show the result list
  12148. if (el.result_area.is(':hidden')) {
  12149. e.stopPropagation();
  12150. self.prop.first_show = true;
  12151. showList();
  12152. }
  12153. });
  12154. el.container.on('click.SelectPage', 'div.' + self.css_class.clear_btn, function (e) {
  12155. e.stopPropagation();
  12156. if (!self.disabled(self)) {
  12157. self.clearAll(self, true);
  12158. self.elem.hidden.change();
  12159. if (p.eClear && $.isFunction(p.eClear)) p.eClear(self);
  12160. }
  12161. });
  12162. el.result_area.on('mousedown.SelectPage', function (e) {
  12163. e.stopPropagation();
  12164. });
  12165. if (p.multiple) {
  12166. if (p.multipleControlbar) {
  12167. //Select all item of current page
  12168. el.control.find('.sp_select_all').on('click.SelectPage', function (e) {
  12169. self.selectAllLine(self);
  12170. }).hover(function () {
  12171. el.control_text.html(msg.select_all);
  12172. }, function () {
  12173. el.control_text.html('');
  12174. });
  12175. //Cancel select all item of current page
  12176. el.control.find('.sp_unselect_all').on('click.SelectPage', function (e) {
  12177. self.unSelectAllLine(self);
  12178. }).hover(function () {
  12179. el.control_text.html(msg.unselect_all);
  12180. }, function () {
  12181. el.control_text.html('');
  12182. });
  12183. //Clear all selected item
  12184. el.control.find('.sp_clear_all').on('click.SelectPage', function (e) {
  12185. self.clearAll(self, true);
  12186. }).hover(function () {
  12187. el.control_text.html(msg.clear_all);
  12188. }, function () {
  12189. el.control_text.html('');
  12190. });
  12191. }
  12192. el.element_box.on('click.SelectPage', function (e) {
  12193. var srcEl = e.target || e.srcElement;
  12194. if ($(srcEl).is('ul')) el.combo_input.focus();
  12195. });
  12196. //Tag close
  12197. el.element_box.on('click.SelectPage', 'span.tag_close', function () {
  12198. var li = $(this).closest('li'), data = li.data('dataObj');
  12199. self.removeTag(self, li);
  12200. showList();
  12201. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove([data]);
  12202. });
  12203. self.inputResize(self);
  12204. }
  12205. };
  12206. /**
  12207. * Out of plugin area click event handler
  12208. */
  12209. SelectPage.prototype.eWhole = function () {
  12210. var self = this, css = self.css_class;
  12211. var cleanContent = function (obj) {
  12212. obj.elem.combo_input.val('');
  12213. if (!obj.option.multiple) obj.elem.hidden.val('');
  12214. obj.prop.selected_text = '';
  12215. };
  12216. //Out of plugin area
  12217. $(document.body).off('mousedown.selectPage').on('mousedown.selectPage', function (e) {
  12218. var ele = e.target || e.srcElement;
  12219. var sp = $(ele).closest('div.' + css.container);
  12220. //Open status result list
  12221. $('div.' + css.container + '.' + css.container_open).each(function () {
  12222. if (this == sp[0]) return;
  12223. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey);
  12224. if (!d.elem.combo_input.val() && d.elem.hidden.val() && !d.option.multiple) {
  12225. d.prop.current_page = 1;//reset page to 1
  12226. cleanContent(d);
  12227. d.hideResults(d);
  12228. return true;
  12229. }
  12230. if (d.elem.results.find('li').not('.' + css.message_box).length) {
  12231. if (d.option.autoFillResult) {
  12232. //have selected item, then hide result list
  12233. if (d.elem.hidden.val()) d.hideResults(d);
  12234. else if (d.elem.results.find('li.sp_over').length) {
  12235. //no one selected and have highlight item, select the highlight item
  12236. d.selectCurrentLine(d, true);
  12237. } else if (d.option.autoSelectFirst) {
  12238. //no one selected, no one highlight, select the first item
  12239. d.nextLine(d);
  12240. d.selectCurrentLine(d, true);
  12241. } else d.hideResults(d);
  12242. } else d.hideResults(d);
  12243. } else {
  12244. //when no one item match, clear search keywords
  12245. if (d.option.noResultClean) cleanContent(d);
  12246. else {
  12247. if (!d.option.multiple) d.elem.hidden.val('');
  12248. }
  12249. d.hideResults(d);
  12250. }
  12251. });
  12252. });
  12253. };
  12254. /**
  12255. * Result list event bind
  12256. */
  12257. SelectPage.prototype.eResultList = function () {
  12258. var self = this, css = this.css_class;
  12259. self.elem.results.children('li').hover(function () {
  12260. if (self.prop.key_select) {
  12261. self.prop.key_select = false;
  12262. return;
  12263. }
  12264. if (!$(this).hasClass(css.selected) && !$(this).hasClass(css.message_box)) {
  12265. $(this).addClass(css.select);
  12266. self.setCssFocusedResults(self);
  12267. }
  12268. }, function () {
  12269. $(this).removeClass(css.select);
  12270. }).click(function (e) {
  12271. if (self.prop.key_select) {
  12272. self.prop.key_select = false;
  12273. return;
  12274. }
  12275. e.preventDefault();
  12276. e.stopPropagation();
  12277. if (!$(this).hasClass(css.selected)) self.selectCurrentLine(self, false);
  12278. });
  12279. };
  12280. /**
  12281. * Reposition result list when list beyond the visible area
  12282. */
  12283. SelectPage.prototype.eScroll = function () {
  12284. var self = this, css = this.css_class;
  12285. $(window).on('scroll.SelectPage', function (e) {
  12286. $('div.' + css.container + '.' + css.container_open).each(function () {
  12287. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey),
  12288. offset = d.elem.result_area.offset(),
  12289. screenScrollTop = $(window).scrollTop(),
  12290. docHeight = $(document).height(),
  12291. viewHeight = $(window).height(),
  12292. listHeight = d.elem.result_area.outerHeight(),
  12293. listBottom = offset.top + listHeight,
  12294. hasOverflow = docHeight > viewHeight,
  12295. down = d.elem.result_area.hasClass('shadowDown');
  12296. if (hasOverflow) {
  12297. if (down) {//open down
  12298. if (listBottom > (viewHeight + screenScrollTop)) d.calcResultsSize(d);
  12299. } else {//open up
  12300. if (offset.top < screenScrollTop) d.calcResultsSize(d);
  12301. }
  12302. }
  12303. });
  12304. });
  12305. };
  12306. /**
  12307. * Page bar button event bind
  12308. */
  12309. SelectPage.prototype.ePaging = function () {
  12310. var self = this;
  12311. if (!self.option.pagination) return;
  12312. self.elem.navi.find('li.csFirstPage').off('click').on('click', function (ev) {
  12313. //$(self.elem.combo_input).focus();
  12314. ev.preventDefault();
  12315. self.firstPage(self);
  12316. });
  12317. self.elem.navi.find('li.csPreviousPage').off('click').on('click', function (ev) {
  12318. //$(self.elem.combo_input).focus();
  12319. ev.preventDefault();
  12320. self.prevPage(self);
  12321. });
  12322. self.elem.navi.find('li.csNextPage').off('click').on('click', function (ev) {
  12323. //$(self.elem.combo_input).focus();
  12324. ev.preventDefault();
  12325. self.nextPage(self);
  12326. });
  12327. self.elem.navi.find('li.csLastPage').off('click').on('click', function (ev) {
  12328. //$(self.elem.combo_input).focus();
  12329. ev.preventDefault();
  12330. self.lastPage(self);
  12331. });
  12332. };
  12333. /**
  12334. * Ajax request fail
  12335. * @param {Object} self
  12336. * @param {string} errorThrown
  12337. */
  12338. SelectPage.prototype.ajaxErrorNotify = function (self, errorThrown) {
  12339. self.showMessage(self.message.ajax_error);
  12340. };
  12341. /**
  12342. * Message box
  12343. * @param {Object} self
  12344. * @param msg {string} the text need to show
  12345. */
  12346. SelectPage.prototype.showMessage = function (self, msg) {
  12347. if (!msg) return;
  12348. var msgLi = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' + msg + '</li>';
  12349. self.elem.results.empty().append(msgLi).show();
  12350. self.calcResultsSize(self);
  12351. self.setOpenStatus(self, true);
  12352. self.elem.control.hide();
  12353. if (self.option.pagination) self.elem.navi.hide();
  12354. };
  12355. /**
  12356. * @desc Scroll
  12357. * @param {Object} self
  12358. * @param {boolean} enforce
  12359. */
  12360. SelectPage.prototype.scrollWindow = function (self, enforce) {
  12361. var current_result = self.getCurrentLine(self),
  12362. target_top = (current_result && !enforce) ? current_result.offset().top : self.elem.container.offset().top,
  12363. target_size;
  12364. self.prop.size_li = self.elem.results.children('li:first').outerHeight();
  12365. target_size = self.prop.size_li;
  12366. var gap, client_height = $(window).height(),
  12367. scroll_top = $(window).scrollTop(),
  12368. scroll_bottom = scroll_top + client_height - target_size;
  12369. if (current_result.length) {
  12370. if (target_top < scroll_top || target_size > client_height) {
  12371. //scroll to top
  12372. gap = target_top - scroll_top;
  12373. } else if (target_top > scroll_bottom) {
  12374. //scroll down
  12375. gap = target_top - scroll_bottom;
  12376. } else return; //do not scroll
  12377. } else if (target_top < scroll_top) gap = target_top - scroll_top;
  12378. window.scrollBy(0, gap);
  12379. };
  12380. /**
  12381. * change css class by status
  12382. * @param self
  12383. * @param status {boolean} true: open, false: close
  12384. */
  12385. SelectPage.prototype.setOpenStatus = function (self, status) {
  12386. var el = self.elem, css = self.css_class;
  12387. if (status) {
  12388. el.container.addClass(css.container_open);
  12389. el.result_area.addClass(css.result_open);
  12390. } else {
  12391. el.container.removeClass(css.container_open);
  12392. el.result_area.removeClass(css.result_open);
  12393. }
  12394. };
  12395. /**
  12396. * input element in focus css class set
  12397. * @param {Object} self
  12398. */
  12399. SelectPage.prototype.setCssFocusedInput = function (self) {
  12400. //$(self.elem.results).addClass(self.css_class.re_off);
  12401. //$(self.elem.combo_input).removeClass(self.css_class.input_off);
  12402. };
  12403. /**
  12404. * set result list get focus and input element lost focus
  12405. * @param {Object} self
  12406. */
  12407. SelectPage.prototype.setCssFocusedResults = function (self) {
  12408. //$(self.elem.results).removeClass(self.css_class.re_off);
  12409. //$(self.elem.combo_input).addClass(self.css_class.input_off);
  12410. };
  12411. /**
  12412. * Quick search input keywords listener
  12413. * @param {Object} self
  12414. */
  12415. SelectPage.prototype.checkValue = function (self) {
  12416. var now_value = self.elem.combo_input.val();
  12417. if (now_value != self.prop.prev_value) {
  12418. self.prop.prev_value = now_value;
  12419. self.prop.first_show = false;
  12420. if (self.option.selectOnly) self.setButtonAttrDefault();
  12421. if (!self.option.multiple && !now_value) {
  12422. self.elem.combo_input.val('');
  12423. self.elem.hidden.val('');
  12424. self.elem.clear_btn.remove();
  12425. }
  12426. self.suggest(self);
  12427. }
  12428. };
  12429. /**
  12430. * Input handle(regular input)
  12431. * @param {Object} self
  12432. * @param {Object} e - event object
  12433. */
  12434. SelectPage.prototype.processKey = function (self, e) {
  12435. if ($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9, 13]) === -1) {
  12436. if (e.keyCode != 16) self.setCssFocusedInput(self); // except Shift(16)
  12437. self.inputResize(self);
  12438. if ($.type(self.option.data) === 'string') {
  12439. self.prop.last_input_time = e.timeStamp;
  12440. setTimeout(function () {
  12441. if ((e.timeStamp - self.prop.last_input_time) === 0)
  12442. self.checkValue(self);
  12443. }, self.option.inputDelay * 1000);
  12444. } else {
  12445. self.checkValue(self);
  12446. }
  12447. }
  12448. }
  12449. /**
  12450. * Input handle(control key)
  12451. * @param {Object} self
  12452. * @param {Object} e - event object
  12453. */
  12454. SelectPage.prototype.processControl = function (self, e) {
  12455. if (($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9]) > -1 && self.elem.result_area.is(':visible')) ||
  12456. ($.inArray(e.keyCode, [13, 9]) > -1 && self.getCurrentLine(self))) {
  12457. e.preventDefault();
  12458. e.stopPropagation();
  12459. e.cancelBubble = true;
  12460. e.returnValue = false;
  12461. switch (e.keyCode) {
  12462. case 37:// left
  12463. if (e.shiftKey) self.firstPage(self);
  12464. else self.prevPage(self);
  12465. break;
  12466. case 38:// up
  12467. self.prop.key_select = true;
  12468. self.prevLine(self);
  12469. break;
  12470. case 39:// right
  12471. if (e.shiftKey) self.lastPage(self);
  12472. else self.nextPage(self);
  12473. break;
  12474. case 40:// down
  12475. if (self.elem.results.children('li').length) {
  12476. self.prop.key_select = true;
  12477. self.nextLine(self);
  12478. } else self.suggest(self);
  12479. break;
  12480. case 9:// tab
  12481. self.prop.key_paging = true;
  12482. self.selectCurrentLine(self, true);
  12483. //self.hideResults(self);
  12484. break;
  12485. case 13:// return
  12486. self.selectCurrentLine(self, true);
  12487. break;
  12488. case 27:// escape
  12489. self.prop.key_paging = true;
  12490. self.hideResults(self);
  12491. break;
  12492. }
  12493. }
  12494. };
  12495. /**
  12496. * Abort Ajax request
  12497. * @param {Object} self
  12498. */
  12499. SelectPage.prototype.abortAjax = function (self) {
  12500. if (self.prop.xhr) {
  12501. self.prop.xhr.abort();
  12502. self.prop.xhr = false;
  12503. }
  12504. };
  12505. /**
  12506. * Suggest result of search keywords
  12507. * @param {Object} self
  12508. */
  12509. SelectPage.prototype.suggest = function (self) {
  12510. var q_word, val = $.trim(self.elem.combo_input.val());
  12511. if (self.option.multiple) q_word = val;
  12512. else {
  12513. if (val && val === self.prop.selected_text) q_word = '';
  12514. else q_word = val;
  12515. }
  12516. q_word = q_word.split(/[\s ]+/);
  12517. //Before show up result list callback
  12518. if (self.option.eOpen && $.isFunction(self.option.eOpen))
  12519. self.option.eOpen.call(self);
  12520. self.abortAjax(self);
  12521. //self.setLoading(self);
  12522. var which_page_num = self.prop.current_page || 1;
  12523. if (typeof self.option.data == 'object') self.searchForJson(self, q_word, which_page_num);
  12524. else self.searchForDb(self, q_word, which_page_num);
  12525. };
  12526. /**
  12527. * Loading
  12528. * @param {Object} self
  12529. */
  12530. SelectPage.prototype.setLoading = function (self) {
  12531. if (self.elem.results.html() === '') {
  12532. //self.calcResultsSize(self);
  12533. self.setOpenStatus(self, true);
  12534. }
  12535. };
  12536. /**
  12537. * Search for ajax
  12538. * @param {Object} self
  12539. * @param {Array} q_word - query keyword
  12540. * @param {number} which_page_num - target page number
  12541. */
  12542. SelectPage.prototype.searchForDb = function (self, q_word, which_page_num) {
  12543. var p = self.option;
  12544. if (!p.eAjaxSuccess || !$.isFunction(p.eAjaxSuccess)) self.hideResults(self);
  12545. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  12546. //when have new query keyword, then reset page number to 1.
  12547. if (q_word.length && q_word[0] && q_word[0] !== self.prop.prev_value) which_page_num = 1;
  12548. var _orgParams = {
  12549. q_word: q_word,
  12550. pageNumber: which_page_num,
  12551. pageSize: p.pageSize,
  12552. andOr: p.andOr,
  12553. orderBy: p.orderBy,
  12554. searchTable: p.dbTable,
  12555. showField: self.option.showField,
  12556. keyField: self.option.keyField,
  12557. searchField: self.option.searchField
  12558. };
  12559. if (p.orderBy !== false) _orgParams.orderBy = p.orderBy;
  12560. _orgParams[searchKey] = q_word[0];
  12561. if (_paramsFunc) {
  12562. var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
  12563. if (result && $.isPlainObject(result)) {
  12564. _params = $.extend({}, _orgParams, result);
  12565. } else {
  12566. _params = _orgParams;
  12567. }
  12568. } else {
  12569. _params = _orgParams;
  12570. }
  12571. self.prop.xhr = $.ajax({
  12572. dataType: 'json',
  12573. url: p.data,
  12574. type: 'POST',
  12575. data: _params,
  12576. success: function (returnData) {
  12577. if (!returnData || !$.isPlainObject(returnData)) {
  12578. self.hideResults(self);
  12579. self.ajaxErrorNotify(self, errorThrown);
  12580. return;
  12581. }
  12582. var data = {}, json = {};
  12583. try {
  12584. data = p.eAjaxSuccess(returnData);
  12585. json.originalResult = data.list;
  12586. json.cnt_whole = data.totalRow;
  12587. } catch (e) {
  12588. self.showMessage(self, self.message.ajax_error);
  12589. return;
  12590. }
  12591. if (self.elem.navi) {
  12592. $(self.elem.navi).toggleClass("hide", json.cnt_whole <= json.originalResult.length);
  12593. }
  12594. json.candidate = [];
  12595. json.keyField = [];
  12596. if (typeof json.originalResult != 'object') {
  12597. self.prop.xhr = null;
  12598. self.notFoundSearch(self);
  12599. return;
  12600. }
  12601. json.cnt_page = json.originalResult.length;
  12602. for (var i = 0; i < json.cnt_page; i++) {
  12603. for (var key in json.originalResult[i]) {
  12604. if (key == p.keyField) {
  12605. json.keyField.push(json.originalResult[i][key]);
  12606. }
  12607. if (key == p.showField) {
  12608. json.candidate.push(json.originalResult[i][key]);
  12609. }
  12610. }
  12611. }
  12612. self.prepareResults(self, json, q_word, which_page_num);
  12613. },
  12614. error: function (jqXHR, textStatus, errorThrown) {
  12615. if (textStatus != 'abort') {
  12616. self.hideResults(self);
  12617. self.ajaxErrorNotify(self, errorThrown);
  12618. }
  12619. },
  12620. complete: function () {
  12621. self.prop.xhr = null;
  12622. }
  12623. });
  12624. };
  12625. /**
  12626. * Search for json data source
  12627. * @param {Object} self
  12628. * @param {Array} q_word
  12629. * @param {number} which_page_num
  12630. */
  12631. SelectPage.prototype.searchForJson = function (self, q_word, which_page_num) {
  12632. var p = self.option, matched = [], esc_q = [], sorted = [], json = {}, i = 0, arr_reg = [];
  12633. //query keyword filter
  12634. do {
  12635. //'/\W/g'正则代表全部不是字母,数字,下划线,汉字的字符
  12636. //将非法字符进行转义
  12637. esc_q[i] = q_word[i].replace(/\W/g, '\\$&').toString();
  12638. arr_reg[i] = new RegExp(esc_q[i], 'gi');
  12639. i++;
  12640. } while (i < q_word.length);
  12641. // SELECT * FROM data WHERE field LIKE q_word;
  12642. for (var i = 0; i < p.data.length; i++) {
  12643. var flag = false, row = p.data[i], itemText;
  12644. for (var j = 0; j < arr_reg.length; j++) {
  12645. itemText = row[p.searchField];
  12646. if (p.formatItem && $.isFunction(p.formatItem))
  12647. itemText = p.formatItem(row);
  12648. if (itemText.match(arr_reg[j])) {
  12649. flag = true;
  12650. if (p.andOr == 'OR') break;
  12651. } else {
  12652. flag = false;
  12653. if (p.andOr == 'AND') break;
  12654. }
  12655. }
  12656. if (flag) matched.push(row);
  12657. }
  12658. // (CASE WHEN ...) then く order some column
  12659. if (p.orderBy === false) sorted = matched.concat();
  12660. else {
  12661. var reg1 = new RegExp('^' + esc_q[0] + '$', 'gi'),
  12662. reg2 = new RegExp('^' + esc_q[0], 'gi'),
  12663. matched1 = [], matched2 = [], matched3 = [];
  12664. for (var i = 0; i < matched.length; i++) {
  12665. var orderField = p.orderBy[0][0];
  12666. var orderValue = String(matched[i][orderField]);
  12667. if (orderValue.match(reg1)) {
  12668. matched1.push(matched[i]);
  12669. } else if (orderValue.match(reg2)) {
  12670. matched2.push(matched[i]);
  12671. } else {
  12672. matched3.push(matched[i]);
  12673. }
  12674. }
  12675. if (p.orderBy[0][1].match(/^asc$/i)) {
  12676. matched1 = self.sortAsc(self, matched1);
  12677. matched2 = self.sortAsc(self, matched2);
  12678. matched3 = self.sortAsc(self, matched3);
  12679. } else {
  12680. matched1 = self.sortDesc(self, matched1);
  12681. matched2 = self.sortDesc(self, matched2);
  12682. matched3 = self.sortDesc(self, matched3);
  12683. }
  12684. sorted = sorted.concat(matched1).concat(matched2).concat(matched3);
  12685. }
  12686. /*
  12687. if (sorted.length === undefined || sorted.length === 0 ) {
  12688. self.notFoundSearch(self);
  12689. return;
  12690. }
  12691. */
  12692. json.cnt_whole = sorted.length;
  12693. //page_move used to distinguish between init plugin or page moving
  12694. if (!self.prop.page_move) {
  12695. //only single mode can be used page number relocation
  12696. if (!p.multiple) {
  12697. //get selected item belong page number
  12698. var currentValue = self.elem.hidden.val();
  12699. if ($.type(currentValue) !== 'undefined' && $.trim(currentValue) !== '') {
  12700. var index = 0;
  12701. $.each(sorted, function (i, row) {
  12702. if (row[p.keyField] == currentValue) {
  12703. index = i + 1;
  12704. return false;
  12705. }
  12706. });
  12707. which_page_num = Math.ceil(index / p.pageSize);
  12708. if (which_page_num < 1) which_page_num = 1;
  12709. self.prop.current_page = which_page_num;
  12710. }
  12711. }
  12712. } else {
  12713. //set page number to 1 when result number less then page size
  12714. if (sorted.length <= ((which_page_num - 1) * p.pageSize)) {
  12715. which_page_num = 1;
  12716. self.prop.current_page = 1;
  12717. }
  12718. }
  12719. //LIMIT xx OFFSET xx
  12720. var start = (which_page_num - 1) * p.pageSize, end = start + p.pageSize;
  12721. //save original data
  12722. json.originalResult = [];
  12723. //after data filter handle
  12724. for (var i = start; i < end; i++) {
  12725. if (sorted[i] === undefined) break;
  12726. json.originalResult.push(sorted[i]);
  12727. for (var key in sorted[i]) {
  12728. if (key == p.keyField) {
  12729. if (json.keyField === undefined) json.keyField = [];
  12730. json.keyField.push(sorted[i][key]);
  12731. }
  12732. if (key == p.showField) {
  12733. if (json.candidate === undefined) json.candidate = [];
  12734. json.candidate.push(sorted[i][key]);
  12735. }
  12736. }
  12737. }
  12738. if (json.candidate === undefined) json.candidate = [];
  12739. json.cnt_page = json.candidate.length;
  12740. self.prepareResults(self, json, q_word, which_page_num);
  12741. };
  12742. /**
  12743. * Set order asc
  12744. * @param {Object} self
  12745. * @param {Array} arr - result array
  12746. */
  12747. SelectPage.prototype.sortAsc = function (self, arr) {
  12748. arr.sort(function (a, b) {
  12749. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  12750. return $.type(valA) === 'number' ? valA - valB : String(valA).localeCompare(String(valB));
  12751. });
  12752. return arr;
  12753. };
  12754. /**
  12755. * Set order desc
  12756. * @param {Object} self
  12757. * @param {Array} arr - result array
  12758. */
  12759. SelectPage.prototype.sortDesc = function (self, arr) {
  12760. arr.sort(function (a, b) {
  12761. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  12762. return $.type(valA) === 'number' ? valB - valA : String(valB).localeCompare(String(valA));
  12763. });
  12764. return arr;
  12765. };
  12766. /**
  12767. * Not result found handle
  12768. * @param {Object} self
  12769. */
  12770. SelectPage.prototype.notFoundSearch = function (self) {
  12771. self.elem.results.empty();
  12772. self.calcResultsSize(self);
  12773. self.setOpenStatus(self, true);
  12774. self.setCssFocusedInput(self);
  12775. };
  12776. /**
  12777. * Prepare data to show
  12778. * @param {Object} self
  12779. * @param {Object} json - data result
  12780. * @param {Array} q_word - query keyword
  12781. * @param {number} which_page_num - target page number
  12782. */
  12783. SelectPage.prototype.prepareResults = function (self, json, q_word, which_page_num) {
  12784. self.data = json.originalResult;
  12785. if (self.option.pagination) self.setNavi(self, json.cnt_whole, json.cnt_page, which_page_num);
  12786. if (!json.keyField) json.keyField = false;
  12787. if (self.option.selectOnly && json.candidate.length === 1 && json.candidate[0] == q_word[0]) {
  12788. self.elem.hidden.val(json.keyField[0]);
  12789. this.setButtonAttrDefault();
  12790. }
  12791. var is_query = false;
  12792. if (q_word && q_word.length && q_word[0]) is_query = true;
  12793. self.displayResults(self, json, is_query);
  12794. };
  12795. /**
  12796. * Build page bar
  12797. * @param {Object} self
  12798. * @param {number} cnt_whole - total record count
  12799. * @param {number} cnt_page
  12800. * @param {number} page_num - current page number
  12801. */
  12802. SelectPage.prototype.setNavi = function (self, cnt_whole, cnt_page, page_num) {
  12803. var msg = self.message;
  12804. /**
  12805. * build pagination bar
  12806. */
  12807. var buildPageNav = function (self, pagebar, page_num, last_page) {
  12808. var updatePageInfo = function () {
  12809. var pageInfo = msg.page_info;
  12810. return pageInfo.replace(self.template.page.current, page_num).replace(self.template.page.total, last_page);
  12811. };
  12812. if (pagebar.find('li').length === 0) {
  12813. pagebar.hide().empty();
  12814. var iconFist = 'spfont sp-first',
  12815. iconPrev = 'spfont sp-previous',
  12816. iconNext = 'spfont sp-next',
  12817. iconLast = 'spfont sp-last';
  12818. pagebar.append('<li class="csFirstPage" title="' + msg.first_title + '" ><a href="javascript:void(0);"> <i class="' + iconFist + '"></i> </a></li>');
  12819. pagebar.append('<li class="csPreviousPage" title="' + msg.prev_title + '" ><a href="javascript:void(0);"><i class="' + iconPrev + '"></i></a></li>');
  12820. //pagination information
  12821. pagebar.append('<li class="pageInfoBox"><a href="javascript:void(0);"> ' + updatePageInfo() + ' </a></li>');
  12822. pagebar.append('<li class="csNextPage" title="' + msg.next_title + '" ><a href="javascript:void(0);"><i class="' + iconNext + '"></i></a></li>');
  12823. pagebar.append('<li class="csLastPage" title="' + msg.last_title + '" ><a href="javascript:void(0);"> <i class="' + iconLast + '"></i> </a></li>');
  12824. pagebar.show();
  12825. } else {
  12826. pagebar.find('li.pageInfoBox a').html(updatePageInfo());
  12827. }
  12828. };
  12829. var pagebar = self.elem.navi.find('ul'),
  12830. last_page = Math.ceil(cnt_whole / self.option.pageSize); //calculate total page
  12831. if (last_page === 0) page_num = 0;
  12832. else {
  12833. if (last_page < page_num) page_num = last_page;
  12834. else if (page_num === 0) page_num = 1;
  12835. }
  12836. self.prop.current_page = page_num;//update current page number
  12837. self.prop.max_page = last_page;//update page count
  12838. buildPageNav(self, pagebar, page_num, last_page);
  12839. //update paging status
  12840. var dClass = 'disabled',
  12841. first = pagebar.find('li.csFirstPage'),
  12842. previous = pagebar.find('li.csPreviousPage'),
  12843. next = pagebar.find('li.csNextPage'),
  12844. last = pagebar.find('li.csLastPage');
  12845. //first and previous
  12846. if (page_num === 1 || page_num === 0) {
  12847. if (!first.hasClass(dClass)) first.addClass(dClass);
  12848. if (!previous.hasClass(dClass)) previous.addClass(dClass);
  12849. } else {
  12850. if (first.hasClass(dClass)) first.removeClass(dClass);
  12851. if (previous.hasClass(dClass)) previous.removeClass(dClass);
  12852. }
  12853. //next and last
  12854. if (page_num === last_page || last_page === 0) {
  12855. if (!next.hasClass(dClass)) next.addClass(dClass);
  12856. if (!last.hasClass(dClass)) last.addClass(dClass);
  12857. } else {
  12858. if (next.hasClass(dClass)) next.removeClass(dClass);
  12859. if (last.hasClass(dClass)) last.removeClass(dClass);
  12860. }
  12861. if (last_page > 1) self.ePaging(); //pagination event bind
  12862. };
  12863. /**
  12864. * Render result list
  12865. * @param {Object} self
  12866. * @param {Object} json - result data
  12867. * @param {boolean} is_query - used to different from search to open and just click to open
  12868. */
  12869. SelectPage.prototype.displayResults = function (self, json, is_query) {
  12870. var p = self.option, el = self.elem;
  12871. el.results.hide().empty();
  12872. if (p.multiple && $.type(p.maxSelectLimit) === 'number' && p.maxSelectLimit > 0) {
  12873. var selectedSize = el.element_box.find('li.selected_tag').length;
  12874. if (selectedSize > 0 && selectedSize >= p.maxSelectLimit) {
  12875. var msg = self.message.max_selected;
  12876. self.showMessage(self, msg.replace(self.template.msg.maxSelectLimit, p.maxSelectLimit));
  12877. return;
  12878. }
  12879. }
  12880. if (json.candidate.length) {
  12881. var arr_candidate = json.candidate,
  12882. arr_primary_key = json.keyField,
  12883. keystr = el.hidden.val(),
  12884. keyArr = keystr ? keystr.split(',') : new Array(),
  12885. itemText = '';
  12886. for (var i = 0; i < arr_candidate.length; i++) {
  12887. if (p.formatItem && $.isFunction(p.formatItem)) {
  12888. try {
  12889. itemText = p.formatItem(json.originalResult[i]);
  12890. } catch (e) {
  12891. console.error('formatItem内容格式化函数内容设置不正确!');
  12892. itemText = arr_candidate[i];
  12893. }
  12894. } else itemText = arr_candidate[i];
  12895. var list = $('<li>').html(itemText).attr({
  12896. pkey: arr_primary_key[i],
  12897. index: i
  12898. });
  12899. if (!p.formatItem) list.attr('title', itemText);
  12900. //Set selected item highlight
  12901. if ($.inArray(arr_primary_key[i].toString(), keyArr) !== -1) {
  12902. list.addClass(self.css_class.selected);
  12903. }
  12904. //cache item data
  12905. list.data('dataObj', json.originalResult[i]);
  12906. el.results.append(list);
  12907. }
  12908. } else {
  12909. var li = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' +
  12910. self.message.not_found + '</li>';
  12911. el.results.append(li);
  12912. }
  12913. el.results.show();
  12914. if (p.multiple && p.multipleControlbar) el.control.show();
  12915. if (p.pagination) el.navi.show();
  12916. self.calcResultsSize(self);
  12917. self.setOpenStatus(self, true);
  12918. //Result item event bind
  12919. self.eResultList();
  12920. //scrolling listen
  12921. self.eScroll();
  12922. //auto highlight first item in search, have result and set autoSelectFirst to true situation
  12923. if (is_query && json.candidate.length && p.autoSelectFirst) self.nextLine(self);
  12924. };
  12925. /**
  12926. * Calculate result list size and position
  12927. * @param {Object} self
  12928. */
  12929. SelectPage.prototype.calcResultsSize = function (self) {
  12930. var p = self.option, el = self.elem;
  12931. var rePosition = function () {
  12932. if (el.container.css('position') === 'static') {
  12933. // position: static
  12934. var offset = el.combo_input.offset();
  12935. el.result_area.css({
  12936. top: offset.top + el.combo_input.outerHeight() + 'px',
  12937. left: offset.left + 'px'
  12938. });
  12939. } else {
  12940. if (!p.pagination) {
  12941. var itemHeight = el.results.find('li:first').outerHeight(true),
  12942. listHeight = itemHeight * p.listSize;
  12943. el.results.css({
  12944. 'max-height': listHeight,
  12945. 'overflow-y': 'auto'
  12946. });
  12947. }
  12948. //handle result list show up side(left, right, up or down)
  12949. var docWidth = $(document).width(),
  12950. docHeight = $(document).height(), //the document full height
  12951. viewHeight = $(window).height(), //browser visible area height
  12952. offset = el.container.offset(),
  12953. screenScrollTop = $(window).scrollTop(),
  12954. listWidth = el.result_area.outerWidth(),
  12955. //result list height
  12956. listHeight = el.result_area.outerHeight(),
  12957. //default left used input element left
  12958. defaultLeft = offset.left, //p.multiple ? -1 : 0;
  12959. //input element height
  12960. inputHeight = el.container.outerHeight(),
  12961. left = (offset.left + listWidth) > docWidth ?
  12962. defaultLeft - (listWidth - el.container.outerWidth()) :
  12963. defaultLeft,
  12964. //the actual top coordinate of input element(outer div)
  12965. screenTop = offset.top, //$(el.container).scrollTop();//offset.top - screenScrollTop;
  12966. top = 0, dist = 5, //set distance between input element and result list
  12967. //the actual top coordinate of result list
  12968. listBottom = screenTop + inputHeight + listHeight + dist,
  12969. listTop = screenTop + listHeight + dist,
  12970. hasOverflow = docHeight > viewHeight;
  12971. if ((screenTop - screenScrollTop - dist > listHeight) &&
  12972. (hasOverflow && listBottom > (viewHeight + screenScrollTop)) ||
  12973. (!hasOverflow && listBottom > viewHeight && screenTop >= listTop)) {
  12974. //open up
  12975. top = offset.top - listHeight - dist;
  12976. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowUp');
  12977. } else {
  12978. //open down
  12979. top = offset.top + (p.multiple ? el.container.outerHeight() : inputHeight);
  12980. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowDown');
  12981. top += dist;
  12982. }
  12983. return {
  12984. top: top + 'px', left: left + 'px'
  12985. };
  12986. }
  12987. };
  12988. if (el.result_area.is(':visible')) {
  12989. el.result_area.css(rePosition());
  12990. } else {
  12991. var pss = rePosition();
  12992. el.result_area.css(pss).show(1, function () {
  12993. var repss = rePosition();
  12994. if (pss.top !== repss.top || pss.left !== repss.left) el.result_area.css(repss);
  12995. });
  12996. }
  12997. };
  12998. /**
  12999. * hide result list
  13000. * @param {Object} self
  13001. */
  13002. SelectPage.prototype.hideResults = function (self) {
  13003. if (self.prop.key_paging) {
  13004. self.scrollWindow(self, true);
  13005. self.prop.key_paging = false;
  13006. }
  13007. self.setCssFocusedInput(self);
  13008. if (self.option.autoFillResult) {
  13009. //self.selectCurrentLine(self, true);
  13010. }
  13011. self.elem.results.empty();
  13012. self.elem.result_area.hide();
  13013. self.setOpenStatus(self, false);
  13014. //unbind window scroll listen
  13015. $(window).off('scroll.SelectPage');
  13016. self.abortAjax(self);
  13017. self.setButtonAttrDefault();
  13018. };
  13019. /**
  13020. * set plugin to disabled / enabled
  13021. * @param self
  13022. * @param disabled
  13023. */
  13024. SelectPage.prototype.disabled = function (self, disabled) {
  13025. var p = self.option, el = self.elem;
  13026. if ($.type(disabled) === 'undefined') return el.combo_input.prop('disabled');
  13027. if ($.type(disabled) === 'boolean') {
  13028. el.combo_input.prop('disabled', disabled);
  13029. if (disabled) el.container.addClass(self.css_class.disabled);
  13030. else el.container.removeClass(self.css_class.disabled);
  13031. }
  13032. };
  13033. /**
  13034. * Go fist page
  13035. * @param {Object} self
  13036. */
  13037. SelectPage.prototype.firstPage = function (self) {
  13038. if (self.prop.current_page > 1) {
  13039. self.prop.current_page = 1;
  13040. self.prop.page_move = true;
  13041. self.suggest(self);
  13042. }
  13043. };
  13044. /**
  13045. * Go previous page
  13046. * @param {Object} self
  13047. */
  13048. SelectPage.prototype.prevPage = function (self) {
  13049. if (self.prop.current_page > 1) {
  13050. self.prop.current_page--;
  13051. self.prop.page_move = true;
  13052. self.suggest(self);
  13053. }
  13054. };
  13055. /**
  13056. * Go next page
  13057. * @param {Object} self
  13058. */
  13059. SelectPage.prototype.nextPage = function (self) {
  13060. if (self.prop.current_page < self.prop.max_page) {
  13061. self.prop.current_page++;
  13062. self.prop.page_move = true;
  13063. self.suggest(self);
  13064. }
  13065. };
  13066. /**
  13067. * Go last page
  13068. * @param {Object} self
  13069. */
  13070. SelectPage.prototype.lastPage = function (self) {
  13071. if (self.prop.current_page < self.prop.max_page) {
  13072. self.prop.current_page = self.prop.max_page;
  13073. self.prop.page_move = true;
  13074. self.suggest(self);
  13075. }
  13076. };
  13077. /**
  13078. * do something after select/unSelect action
  13079. * @param {Object} self
  13080. * @param {boolean} reOpen
  13081. */
  13082. SelectPage.prototype.afterAction = function (self, reOpen) {
  13083. self.inputResize(self);
  13084. self.elem.combo_input.change();
  13085. self.setCssFocusedInput(self);
  13086. if (self.prop.init_set) return;
  13087. if (self.option.multiple) {
  13088. if (self.option.selectToCloseList) {
  13089. self.hideResults(self);
  13090. self.elem.combo_input.blur();
  13091. }
  13092. if (!self.option.selectToCloseList && reOpen) {
  13093. self.suggest(self);
  13094. self.elem.combo_input.focus();
  13095. }
  13096. } else {
  13097. self.hideResults(self);
  13098. self.elem.combo_input.blur();
  13099. }
  13100. };
  13101. /**
  13102. * Select current list item
  13103. * @param {Object} self
  13104. * @param {boolean} is_enter_key
  13105. */
  13106. SelectPage.prototype.selectCurrentLine = function (self, is_enter_key) {
  13107. self.scrollWindow(self, true);
  13108. var p = self.option, current = self.getCurrentLine(self);
  13109. if (current) {
  13110. var data = current.data('dataObj');
  13111. var text = data[p.showField] || current.text();
  13112. var value = current.attr('pkey');
  13113. if (!p.multiple) {
  13114. self.elem.combo_input.val(text);
  13115. self.elem.hidden.val(value);
  13116. } else {
  13117. //build tags in multiple selection mode
  13118. self.elem.combo_input.val('');
  13119. var item = {text: text, value: value};
  13120. if (!self.isAlreadySelected(self, item)) {
  13121. self.addNewTag(self, data, item);
  13122. self.tagValuesSet(self);
  13123. }
  13124. }
  13125. if (p.selectOnly) self.setButtonAttrDefault();
  13126. //Select item callback
  13127. if (p.eSelect && $.isFunction(p.eSelect)) p.eSelect(data, self);
  13128. self.prop.prev_value = self.elem.combo_input.val();
  13129. self.prop.selected_text = self.elem.combo_input.val();
  13130. self.putClearButton();
  13131. }
  13132. self.afterAction(self, true);
  13133. };
  13134. /**
  13135. * Show clear button when item selected in single selection mode
  13136. */
  13137. SelectPage.prototype.putClearButton = function () {
  13138. if (!this.option.multiple && !this.elem.combo_input.prop('disabled')) this.elem.container.append(this.elem.clear_btn);
  13139. };
  13140. /**
  13141. * Select all list item
  13142. * @param {Object} self
  13143. */
  13144. SelectPage.prototype.selectAllLine = function (self) {
  13145. var p = self.option, jsonarr = new Array();
  13146. self.elem.results.find('li').each(function (i, row) {
  13147. var $row = $(row), data = $row.data('dataObj');
  13148. var text = data[p.showField] || $row.text();
  13149. var value = $row.attr('pkey');
  13150. var item = {text: text, value: value};
  13151. if (!self.isAlreadySelected(self, item)) {
  13152. self.addNewTag(self, data, item);
  13153. self.tagValuesSet(self);
  13154. }
  13155. jsonarr.push(data);
  13156. //limited max selected items
  13157. if ($.type(p.maxSelectLimit) === 'number' &&
  13158. p.maxSelectLimit > 0 &&
  13159. p.maxSelectLimit === self.elem.element_box.find('li.selected_tag').length) {
  13160. return false;
  13161. }
  13162. });
  13163. if (p.eSelect && $.isFunction(p.eSelect)) p.eSelect(jsonarr, self);
  13164. self.afterAction(self, true);
  13165. };
  13166. /**
  13167. * Cancel select all item in current page
  13168. * @param {Object} self
  13169. */
  13170. SelectPage.prototype.unSelectAllLine = function (self) {
  13171. var p = self.option, size = self.elem.results.find('li').length, ds = [];
  13172. self.elem.results.find('li').each(function (i, row) {
  13173. var key = $(row).attr('pkey');
  13174. var tag = self.elem.element_box.find('li.selected_tag[itemvalue="' + key + '"]');
  13175. if (tag.length) ds.push(tag.data('dataObj'));
  13176. self.removeTag(self, tag);
  13177. });
  13178. self.afterAction(self, true);
  13179. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove(ds);
  13180. };
  13181. /**
  13182. * Clear all selected items
  13183. * @param {Object} self
  13184. * @param {boolean} open - open list after clear selected item
  13185. */
  13186. SelectPage.prototype.clearAll = function (self, open) {
  13187. var p = self.option, ds = [];
  13188. if (p.multiple) {
  13189. self.elem.element_box.find('li.selected_tag').each(function (i, row) {
  13190. ds.push($(row).data('dataObj'));
  13191. row.remove();
  13192. });
  13193. self.elem.element_box.find('li.selected_tag').remove();
  13194. }
  13195. self.reset(self);
  13196. self.afterAction(self, open);
  13197. if (p.multiple) {
  13198. if (p.eTagRemove && $.isFunction(p.eTagRemove)) p.eTagRemove(ds);
  13199. } else self.elem.clear_btn.remove();
  13200. };
  13201. /**
  13202. * reset
  13203. */
  13204. SelectPage.prototype.reset = function (self) {
  13205. self.elem.combo_input.val('');
  13206. self.elem.hidden.val('');
  13207. self.prop.prev_value = '';
  13208. self.prop.selected_text = '';
  13209. self.prop.current_page = 1;
  13210. };
  13211. /**
  13212. * Get current highlight item
  13213. * @param {Object} self
  13214. */
  13215. SelectPage.prototype.getCurrentLine = function (self) {
  13216. if (self.elem.result_area.is(':hidden')) return false;
  13217. var obj = self.elem.results.find('li.' + self.css_class.select);
  13218. if (obj.length) return obj;
  13219. else return false;
  13220. };
  13221. /**
  13222. * Check the result item is already selected or not
  13223. * @param {Object} self
  13224. * @param {Object} item - item info
  13225. */
  13226. SelectPage.prototype.isAlreadySelected = function (self, item) {
  13227. var isExist = false;
  13228. if (item.value) {
  13229. var keys = self.elem.hidden.val();
  13230. if (keys) {
  13231. var karr = keys.split(',');
  13232. if (karr && karr.length && $.inArray(item.value, karr) != -1) isExist = true;
  13233. }
  13234. }
  13235. return isExist;
  13236. };
  13237. /**
  13238. * Add a new tag in multiple selection mode
  13239. * @param {Object} self
  13240. * @param {object} data - raw row data
  13241. * @param {Object} item
  13242. */
  13243. SelectPage.prototype.addNewTag = function (self, data, item) {
  13244. if (!self.option.multiple || !data || !item) return;
  13245. var tmp = self.template.tag.content, tag;
  13246. tmp = tmp.replace(self.template.tag.textKey, item.text);
  13247. tmp = tmp.replace(self.template.tag.valueKey, item.value);
  13248. tag = $(tmp);
  13249. tag.data('dataObj', data);
  13250. if (self.elem.combo_input.prop('disabled')) tag.find('span.tag_close').hide();
  13251. self.elem.combo_input.closest('li').before(tag);
  13252. };
  13253. /**
  13254. * Remove a tag in multiple selection mode
  13255. * @param {Object} self
  13256. * @param {Object} item
  13257. */
  13258. SelectPage.prototype.removeTag = function (self, item) {
  13259. var key = $(item).attr('itemvalue');
  13260. var keys = self.elem.hidden.val();
  13261. if ($.type(key) != 'undefined' && keys) {
  13262. var keyarr = keys.split(','),
  13263. index = $.inArray(key.toString(), keyarr);
  13264. if (index != -1) {
  13265. keyarr.splice(index, 1);
  13266. self.elem.hidden.val(keyarr.toString()).trigger("change");
  13267. }
  13268. }
  13269. $(item).remove();
  13270. self.inputResize(self);
  13271. };
  13272. /**
  13273. * Selected item value(keyField) put in to hidden element
  13274. * @param {Object} self
  13275. */
  13276. SelectPage.prototype.tagValuesSet = function (self) {
  13277. if (!self.option.multiple) return;
  13278. var tags = self.elem.element_box.find('li.selected_tag');
  13279. if (tags && tags.length) {
  13280. var result = new Array();
  13281. $.each(tags, function (i, li) {
  13282. var v = $(li).attr('itemvalue');
  13283. if ($.type(v) !== 'undefined') result.push(v);
  13284. });
  13285. if (result.length) {
  13286. self.elem.hidden.val(result.join(',')).trigger("change");
  13287. }
  13288. }
  13289. };
  13290. /**
  13291. * auto resize input element width in multiple select mode
  13292. * @param {Object} self
  13293. */
  13294. SelectPage.prototype.inputResize = function (self) {
  13295. if (!self.option.multiple) return;
  13296. var width = '',
  13297. inputLi = self.elem.combo_input.closest('li');
  13298. var setDefaultSize = function (self, inputLi) {
  13299. inputLi.removeClass('full_width');
  13300. var minimumWidth = self.elem.combo_input.val().length + 1,
  13301. width = (minimumWidth * 0.75) + 'em';
  13302. self.elem.combo_input.css('width', width).removeAttr('placeholder');
  13303. };
  13304. if (self.elem.element_box.find('li.selected_tag').length === 0) {
  13305. if (!inputLi.hasClass('full_width')) inputLi.addClass('full_width');
  13306. if (self.elem.combo_input.attr('placeholder_bak')) {
  13307. self.elem.combo_input.attr('placeholder', self.elem.combo_input.attr('placeholder_bak')).removeAttr('style');
  13308. }
  13309. } else setDefaultSize(self, inputLi);
  13310. };
  13311. /**
  13312. * Move to next line
  13313. * @param {Object} self
  13314. */
  13315. SelectPage.prototype.nextLine = function (self) {
  13316. var obj = self.getCurrentLine(self), idx;
  13317. if (!obj) idx = -1;
  13318. else {
  13319. idx = self.elem.results.children('li').index(obj);
  13320. obj.removeClass(self.css_class.select);
  13321. }
  13322. idx++;
  13323. if (idx < self.elem.results.children('li').length) {
  13324. var next = self.elem.results.children('li').eq(idx);
  13325. next.addClass(self.css_class.select);
  13326. self.setCssFocusedResults(self);
  13327. } else self.setCssFocusedInput(self);
  13328. self.scrollWindow(self, false);
  13329. };
  13330. /**
  13331. * Move to previous line
  13332. * @param {Object} self
  13333. */
  13334. SelectPage.prototype.prevLine = function (self) {
  13335. var obj = self.getCurrentLine(self), idx;
  13336. if (!obj) idx = self.elem.results.children('li').length;
  13337. else {
  13338. idx = self.elem.results.children('li').index(obj);
  13339. obj.removeClass(self.css_class.select);
  13340. }
  13341. idx--;
  13342. if (idx > -1) {
  13343. var prev = self.elem.results.children('li').eq(idx);
  13344. prev.addClass(self.css_class.select);
  13345. self.setCssFocusedResults(self);
  13346. } else self.setCssFocusedInput(self);
  13347. self.scrollWindow(self, false);
  13348. };
  13349. /**
  13350. * SelectPage plugin definition
  13351. * @global
  13352. * @param option {Object} init plugin option
  13353. */
  13354. function Plugin(option) {
  13355. return this.each(function () {
  13356. var $this = $(this),
  13357. data = $this.data(SelectPage.dataKey),
  13358. params = $.extend({}, defaults, $this.data(), data && data.option, typeof option === 'object' && option);
  13359. if (!data) $this.data(SelectPage.dataKey, (data = new SelectPage(this, params)));
  13360. });
  13361. }
  13362. /**
  13363. * Get plugin object
  13364. * @param {object} obj
  13365. * @returns
  13366. */
  13367. function getPlugin(obj) {
  13368. return $(obj).closest('div.sp_container').find('input.sp_input');
  13369. }
  13370. /**
  13371. * Clear all selected item
  13372. */
  13373. function ClearSelected() {
  13374. return this.each(function () {
  13375. var $this = getPlugin(this),
  13376. data = $this.data(SelectPage.dataKey);
  13377. if (data) {
  13378. data.prop.init_set = true;
  13379. data.clearAll(data);
  13380. data.prop.init_set = false;
  13381. }
  13382. });
  13383. }
  13384. /**
  13385. * Refresh result list
  13386. * use case:
  13387. * 1.use $(obj).val('xxx') to modify selectpage selected item key
  13388. * 2.refresh selected item show content/tag text
  13389. */
  13390. function SelectedRefresh() {
  13391. return this.each(function () {
  13392. var $this = getPlugin(this),
  13393. data = $this.data(SelectPage.dataKey);
  13394. if (data && data.elem.hidden.val())
  13395. data.setInitRecord(true);
  13396. });
  13397. }
  13398. /**
  13399. * Modify plugin datasource, only work on json datasource mode
  13400. * @param {array} data - new datasource
  13401. * @example
  13402. * [{name:'aa',sex:1},{name:'bb',sex:0},{...}]
  13403. */
  13404. function ModifyDataSource(data) {
  13405. return this.each(function () {
  13406. if (data && $.isArray(data)) {
  13407. var $this = getPlugin(this),
  13408. plugin = $this.data(SelectPage.dataKey);
  13409. if (plugin) {
  13410. plugin.clearAll(plugin);
  13411. plugin.option.data = data;
  13412. }
  13413. }
  13414. });
  13415. }
  13416. /**
  13417. * Get plugin disabled status or Modify plugin disabled status
  13418. * @param disabled {boolean} set disabled status
  13419. */
  13420. function PluginDisabled(disabled) {
  13421. var status = false;
  13422. this.each(function () {
  13423. var $this = getPlugin(this),
  13424. plugin = $this.data(SelectPage.dataKey);
  13425. if (plugin) {
  13426. if ($.type(disabled) !== 'undefined')
  13427. plugin.disabled(plugin, disabled);
  13428. else
  13429. status = plugin.disabled(plugin);
  13430. }
  13431. });
  13432. return status;
  13433. }
  13434. /**
  13435. * Get selected item text
  13436. * @returns {string}
  13437. */
  13438. function GetInputText() {
  13439. var str = '';
  13440. this.each(function () {
  13441. var $this = getPlugin(this), data = $this.data(SelectPage.dataKey);
  13442. if (data) {
  13443. if (data.option.multiple) {
  13444. var tags = [];
  13445. data.elem.element_box.find('li.selected_tag').each(function (i, tag) {
  13446. tags.push($(tag).text());
  13447. });
  13448. str += tags.toString();
  13449. } else {
  13450. str += data.elem.combo_input.val();
  13451. }
  13452. }
  13453. });
  13454. return str;
  13455. }
  13456. var old = $.fn.selectPage;
  13457. $.fn.selectPage = Plugin;
  13458. $.fn.selectPage.Constructor = SelectPage;
  13459. $.fn.selectPageClear = ClearSelected;
  13460. $.fn.selectPageRefresh = SelectedRefresh;
  13461. $.fn.selectPageData = ModifyDataSource;
  13462. $.fn.selectPageDisabled = PluginDisabled;
  13463. $.fn.selectPageText = GetInputText;
  13464. // SelectPage no conflict
  13465. // =================
  13466. $.fn.selectPage.noConflict = function () {
  13467. $.fn.selectPage = old;
  13468. return this;
  13469. };
  13470. })(window.jQuery);
  13471. define("selectpage", function(){});