123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756 |
- !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;
- }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]),
- 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});
- if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(a>this.$items.length-1||a<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.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(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.7",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[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 e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.7",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",c).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.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(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.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(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){document===a.target||this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+e).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.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}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.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 e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m<o.top?"bottom":"right"==h&&k.right+l>o.width?"left":"left"==h&&k.left-l<o.left?"right":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",q).emulateTransitionEnd(c.TRANSITION_DURATION):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);if(this.$element.trigger(g),!g.isDefaultPrevented())return f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=window.SVGElement&&c instanceof window.SVGElement,g=d?{top:0,left:0}:f?null:b.offset(),h={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},i=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,h,i,g)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(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},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.7",c.DEFAULTS=a.extend({},a.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>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){
- this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.7",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return e<c&&"top";if("bottom"==this.affixed)return null!=c?!(e+this.unpin<=f.top)&&"bottom":!(e+g<=a-d)&&"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&e<=c?"top":null!=d&&i+j>=a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
- define("bootstrap", ["jquery"], function(){});
- require.config({
- urlArgs: "v=" + requirejs.s.contexts._.config.config.site.version,
- packages: [{
- name: 'moment',
- location: '../libs/moment',
- main: 'moment'
- }
- ],
-
- include: ['css', 'layer', 'toastr', 'fast', 'backend', 'backend-init', 'table', 'form', 'dragsort', 'drag', 'drop', 'addtabs', 'selectpage'],
- paths: {
- 'lang': "empty:",
- 'form': 'require-form',
- 'table': 'require-table',
- 'upload': 'require-upload',
- 'validator': 'require-validator',
- 'drag': 'jquery.drag.min',
- 'drop': 'jquery.drop.min',
- 'echarts': 'echarts.min',
- 'echarts-theme': 'echarts-theme',
- 'adminlte': 'adminlte',
- 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch',
- 'bootstrap-table-template': 'bootstrap-table-template',
-
-
- 'jquery': '../libs/jquery/dist/jquery.min',
- 'bootstrap': '../libs/bootstrap/dist/js/bootstrap.min',
- 'bootstrap-datetimepicker': '../libs/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min',
- 'bootstrap-daterangepicker': '../libs/bootstrap-daterangepicker/daterangepicker',
- 'bootstrap-select': '../libs/bootstrap-select/dist/js/bootstrap-select.min',
- 'bootstrap-select-lang': '../libs/bootstrap-select/dist/js/i18n/defaults-zh_CN',
- 'bootstrap-table': '../libs/bootstrap-table/dist/bootstrap-table.min',
- 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
- 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
- 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
- 'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',
- 'dragsort': '../libs/fastadmin-dragsort/jquery.dragsort',
- 'sortable': '../libs/Sortable/Sortable.min',
- 'addtabs': '../libs/fastadmin-addtabs/jquery.addtabs',
- 'slimscroll': '../libs/jquery-slimscroll/jquery.slimscroll',
- 'validator-core': '../libs/nice-validator/dist/jquery.validator',
- 'validator-lang': '../libs/nice-validator/dist/local/zh-CN',
- 'plupload': '../libs/plupload/js/plupload.min',
- 'toastr': '../libs/toastr/toastr',
- 'jstree': '../libs/jstree/dist/jstree.min',
- 'layer': '../libs/layer/dist/layer',
- 'cookie': '../libs/jquery.cookie/jquery.cookie',
- 'cxselect': '../libs/fastadmin-cxselect/js/jquery.cxselect',
- 'template': '../libs/art-template/dist/template-native',
- 'selectpage': '../libs/fastadmin-selectpage/selectpage',
- 'citypicker': '../libs/city-picker/dist/js/city-picker.min',
- 'citypicker-data': '../libs/city-picker/dist/js/city-picker.data',
- },
-
- shim: {
- 'addons': ['backend'],
- 'bootstrap': ['jquery'],
- 'bootstrap-table': {
- deps: [
- 'bootstrap',
- ],
- exports: '$.fn.bootstrapTable'
- },
- 'bootstrap-table-lang': {
- deps: ['bootstrap-table'],
- exports: '$.fn.bootstrapTable.defaults'
- },
- 'bootstrap-table-export': {
- deps: ['bootstrap-table', 'tableexport'],
- exports: '$.fn.bootstrapTable.defaults'
- },
- 'bootstrap-table-mobile': {
- deps: ['bootstrap-table'],
- exports: '$.fn.bootstrapTable.defaults'
- },
- 'bootstrap-table-advancedsearch': {
- deps: ['bootstrap-table'],
- exports: '$.fn.bootstrapTable.defaults'
- },
- 'bootstrap-table-commonsearch': {
- deps: ['bootstrap-table'],
- exports: '$.fn.bootstrapTable.defaults'
- },
- 'bootstrap-table-template': {
- deps: ['bootstrap-table', 'template'],
- exports: '$.fn.bootstrapTable.defaults'
- },
- 'tableexport': {
- deps: ['jquery'],
- exports: '$.fn.extend'
- },
- 'slimscroll': {
- deps: ['jquery'],
- exports: '$.fn.extend'
- },
- 'adminlte': {
- deps: ['bootstrap', 'slimscroll'],
- exports: '$.AdminLTE'
- },
- 'bootstrap-datetimepicker': [
- 'moment/locale/zh-cn',
- ],
- 'bootstrap-select': ['css!../libs/bootstrap-select/dist/css/bootstrap-select.min.css', ],
- 'bootstrap-select-lang': ['bootstrap-select'],
- 'jstree': ['css!../libs/jstree/dist/themes/default/style.css', ],
- 'plupload': {
- deps: ['../libs/plupload/js/moxie.min'],
- exports: "plupload"
- },
- 'validator-lang': ['validator-core'],
- 'citypicker': ['citypicker-data', 'css!../libs/city-picker/dist/css/city-picker.css']
- },
- baseUrl: requirejs.s.contexts._.config.config.site.cdnurl + '/assets/js/',
- map: {
- '*': {
- 'css': '../libs/require-css/css.min'
- }
- },
- waitSeconds: 30,
- charset: 'utf-8'
- });
- require(['jquery', 'bootstrap'], function ($, undefined) {
-
- var Config = requirejs.s.contexts._.config.config;
-
- window.Config = Config;
-
- var paths = {};
- paths['lang'] = Config.moduleurl + '/ajax/lang?callback=define&controllername=' + Config.controllername;
-
- paths['backend/'] = 'backend/';
- require.config({paths: paths});
-
- $(function () {
- require(['fast'], function (Fast) {
- require(['backend', 'backend-init', 'addons'], function (Backend, undefined, Addons) {
-
- if (Config.jsname) {
- require([Config.jsname], function (Controller) {
- Controller[Config.actionname] != undefined && Controller[Config.actionname]();
- }, function (e) {
- console.error(e);
-
- });
- }
- });
- });
- });
- });
- define("require-backend", function(){});
- 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});
- ;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=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}();return e.substring(0,e.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["确定","取消"],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=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(o.getStyle(document.getElementById(f),"width"))?i():setTimeout(u,100))}()}}},r={v:"3.1.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||{},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&&!o.config.skin)&&(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:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?t.creat():setTimeout(function(){t.creat()},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"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!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="layui-layer-shade" id="layui-layer-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]+(r.fixed?"":";position: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+'">'+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="layui-layer-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||"http://layer.layui.com","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(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),i("#layui-layer-shade"+e.index).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():e.offset(),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;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)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);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)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},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){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[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)},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){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass("layer-anim "+a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};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+">"+(e.value||"")+"</textarea>":function(){return'<input type="'+(1==e.formType?"password":"text")+'" class="layui-layer-input" value="'+(e.value||"")+'">'}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(e){s=e.find(".layui-layer-input"),s.focus(),"function"==typeof f&&f(e)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",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=t.photos.constructor===Object,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("没有图片")}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(){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),h()}),!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.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),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),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,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+'"><div class="layui-layer-imgsee">'+(u.length>1?'<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-imguide,.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("当前图片地址异常<br>是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],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(){o.run(e.jQuery),r.ready()}()}(window);
- (function (define) {
- define('toastr',['jquery'], function ($) {
- return (function () {
- var $container;
- var listener;
- var toastId = 0;
- var toastType = {
- error: 'error',
- info: 'info',
- success: 'success',
- warning: 'warning'
- };
- var toastr = {
- clear: clear,
- remove: remove,
- error: error,
- getContainer: getContainer,
- info: info,
- options: {},
- subscribe: subscribe,
- success: success,
- version: '2.1.3',
- warning: warning
- };
- var previousToast;
- return toastr;
-
- function error(message, title, optionsOverride) {
- return notify({
- type: toastType.error,
- iconClass: getOptions().iconClasses.error,
- message: message,
- optionsOverride: optionsOverride,
- title: title
- });
- }
- function getContainer(options, create) {
- if (!options) { options = getOptions(); }
- $container = $('#' + options.containerId);
- if ($container.length) {
- return $container;
- }
- if (create) {
- $container = createContainer(options);
- }
- return $container;
- }
- function info(message, title, optionsOverride) {
- return notify({
- type: toastType.info,
- iconClass: getOptions().iconClasses.info,
- message: message,
- optionsOverride: optionsOverride,
- title: title
- });
- }
- function subscribe(callback) {
- listener = callback;
- }
- function success(message, title, optionsOverride) {
- return notify({
- type: toastType.success,
- iconClass: getOptions().iconClasses.success,
- message: message,
- optionsOverride: optionsOverride,
- title: title
- });
- }
- function warning(message, title, optionsOverride) {
- return notify({
- type: toastType.warning,
- iconClass: getOptions().iconClasses.warning,
- message: message,
- optionsOverride: optionsOverride,
- title: title
- });
- }
- function clear($toastElement, clearOptions) {
- var options = getOptions();
- if (!$container) { getContainer(options); }
- if (!clearToast($toastElement, options, clearOptions)) {
- clearContainer(options);
- }
- }
- function remove($toastElement) {
- var options = getOptions();
- if (!$container) { getContainer(options); }
- if ($toastElement && $(':focus', $toastElement).length === 0) {
- removeToast($toastElement);
- return;
- }
- if ($container.children().length) {
- $container.remove();
- }
- }
-
- function clearContainer (options) {
- var toastsToClear = $container.children();
- for (var i = toastsToClear.length - 1; i >= 0; i--) {
- clearToast($(toastsToClear[i]), options);
- }
- }
- function clearToast ($toastElement, options, clearOptions) {
- var force = clearOptions && clearOptions.force ? clearOptions.force : false;
- if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
- $toastElement[options.hideMethod]({
- duration: options.hideDuration,
- easing: options.hideEasing,
- complete: function () { removeToast($toastElement); }
- });
- return true;
- }
- return false;
- }
- function createContainer(options) {
- $container = $('<div/>')
- .attr('id', options.containerId)
- .addClass(options.positionClass);
- $container.appendTo($(options.target));
- return $container;
- }
- function getDefaults() {
- return {
- tapToDismiss: true,
- toastClass: 'toast',
- containerId: 'toast-container',
- debug: false,
- showMethod: 'fadeIn',
- showDuration: 300,
- showEasing: 'swing',
- onShown: undefined,
- hideMethod: 'fadeOut',
- hideDuration: 1000,
- hideEasing: 'swing',
- onHidden: undefined,
- closeMethod: false,
- closeDuration: false,
- closeEasing: false,
- closeOnHover: true,
- extendedTimeOut: 1000,
- iconClasses: {
- error: 'toast-error',
- info: 'toast-info',
- success: 'toast-success',
- warning: 'toast-warning'
- },
- iconClass: 'toast-info',
- positionClass: 'toast-top-right',
- timeOut: 5000,
- titleClass: 'toast-title',
- messageClass: 'toast-message',
- escapeHtml: false,
- target: 'body',
- closeHtml: '<button type="button">×</button>',
- closeClass: 'toast-close-button',
- newestOnTop: true,
- preventDuplicates: false,
- progressBar: false,
- progressClass: 'toast-progress',
- rtl: false
- };
- }
- function publish(args) {
- if (!listener) { return; }
- listener(args);
- }
- function notify(map) {
- var options = getOptions();
- var iconClass = map.iconClass || options.iconClass;
- if (typeof (map.optionsOverride) !== 'undefined') {
- options = $.extend(options, map.optionsOverride);
- iconClass = map.optionsOverride.iconClass || iconClass;
- }
- if (shouldExit(options, map)) { return; }
- toastId++;
- $container = getContainer(options, true);
- var intervalId = null;
- var $toastElement = $('<div/>');
- var $titleElement = $('<div/>');
- var $messageElement = $('<div/>');
- var $progressElement = $('<div/>');
- var $closeElement = $(options.closeHtml);
- var progressBar = {
- intervalId: null,
- hideEta: null,
- maxHideTime: null
- };
- var response = {
- toastId: toastId,
- state: 'visible',
- startTime: new Date(),
- options: options,
- map: map
- };
- personalizeToast();
- displayToast();
- handleEvents();
- publish(response);
- if (options.debug && console) {
- console.log(response);
- }
- return $toastElement;
- function escapeHtml(source) {
- if (source == null) {
- source = '';
- }
- return source
- .replace(/&/g, '&')
- .replace(/"/g, '"')
- .replace(/'/g, ''')
- .replace(/</g, '<')
- .replace(/>/g, '>');
- }
- function personalizeToast() {
- setIcon();
- setTitle();
- setMessage();
- setCloseButton();
- setProgressBar();
- setRTL();
- setSequence();
- setAria();
- }
- function setAria() {
- var ariaValue = '';
- switch (map.iconClass) {
- case 'toast-success':
- case 'toast-info':
- ariaValue = 'polite';
- break;
- default:
- ariaValue = 'assertive';
- }
- $toastElement.attr('aria-live', ariaValue);
- }
- function handleEvents() {
- if (options.closeOnHover) {
- $toastElement.hover(stickAround, delayedHideToast);
- }
- if (!options.onclick && options.tapToDismiss) {
- $toastElement.click(hideToast);
- }
- if (options.closeButton && $closeElement) {
- $closeElement.click(function (event) {
- if (event.stopPropagation) {
- event.stopPropagation();
- } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
- event.cancelBubble = true;
- }
- if (options.onCloseClick) {
- options.onCloseClick(event);
- }
- hideToast(true);
- });
- }
- if (options.onclick) {
- $toastElement.click(function (event) {
- options.onclick(event);
- hideToast();
- });
- }
- }
- function displayToast() {
- $toastElement.hide();
- $toastElement[options.showMethod](
- {duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
- );
- if (options.timeOut > 0) {
- intervalId = setTimeout(hideToast, options.timeOut);
- progressBar.maxHideTime = parseFloat(options.timeOut);
- progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
- if (options.progressBar) {
- progressBar.intervalId = setInterval(updateProgress, 10);
- }
- }
- }
- function setIcon() {
- if (map.iconClass) {
- $toastElement.addClass(options.toastClass).addClass(iconClass);
- }
- }
- function setSequence() {
- if (options.newestOnTop) {
- $container.prepend($toastElement);
- } else {
- $container.append($toastElement);
- }
- }
- function setTitle() {
- if (map.title) {
- var suffix = map.title;
- if (options.escapeHtml) {
- suffix = escapeHtml(map.title);
- }
- $titleElement.append(suffix).addClass(options.titleClass);
- $toastElement.append($titleElement);
- }
- }
- function setMessage() {
- if (map.message) {
- var suffix = map.message;
- if (options.escapeHtml) {
- suffix = escapeHtml(map.message);
- }
- $messageElement.append(suffix).addClass(options.messageClass);
- $toastElement.append($messageElement);
- }
- }
- function setCloseButton() {
- if (options.closeButton) {
- $closeElement.addClass(options.closeClass).attr('role', 'button');
- $toastElement.prepend($closeElement);
- }
- }
- function setProgressBar() {
- if (options.progressBar) {
- $progressElement.addClass(options.progressClass);
- $toastElement.prepend($progressElement);
- }
- }
- function setRTL() {
- if (options.rtl) {
- $toastElement.addClass('rtl');
- }
- }
- function shouldExit(options, map) {
- if (options.preventDuplicates) {
- if (map.message === previousToast) {
- return true;
- } else {
- previousToast = map.message;
- }
- }
- return false;
- }
- function hideToast(override) {
- var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
- var duration = override && options.closeDuration !== false ?
- options.closeDuration : options.hideDuration;
- var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
- if ($(':focus', $toastElement).length && !override) {
- return;
- }
- clearTimeout(progressBar.intervalId);
- return $toastElement[method]({
- duration: duration,
- easing: easing,
- complete: function () {
- removeToast($toastElement);
- clearTimeout(intervalId);
- if (options.onHidden && response.state !== 'hidden') {
- options.onHidden();
- }
- response.state = 'hidden';
- response.endTime = new Date();
- publish(response);
- }
- });
- }
- function delayedHideToast() {
- if (options.timeOut > 0 || options.extendedTimeOut > 0) {
- intervalId = setTimeout(hideToast, options.extendedTimeOut);
- progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
- progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
- }
- }
- function stickAround() {
- clearTimeout(intervalId);
- progressBar.hideEta = 0;
- $toastElement.stop(true, true)[options.showMethod](
- {duration: options.showDuration, easing: options.showEasing}
- );
- }
- function updateProgress() {
- var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
- $progressElement.width(percentage + '%');
- }
- }
- function getOptions() {
- return $.extend({}, getDefaults(), toastr.options);
- }
- function removeToast($toastElement) {
- if (!$container) { $container = getContainer(); }
- if ($toastElement.is(':visible')) {
- return;
- }
- $toastElement.remove();
- $toastElement = null;
- if ($container.children().length === 0) {
- $container.remove();
- previousToast = undefined;
- }
- }
- })();
- });
- }(typeof define === 'function' && define.amd ? define : function (deps, factory) {
- if (typeof module !== 'undefined' && module.exports) {
- module.exports = factory(require('jquery'));
- } else {
- window.toastr = factory(window.jQuery);
- }
- }));
- define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) {
- var Fast = {
- config: {
-
- toastr: {
- "closeButton": true,
- "debug": false,
- "newestOnTop": false,
- "progressBar": false,
- "positionClass": "toast-top-center",
- "preventDuplicates": false,
- "onclick": null,
- "showDuration": "300",
- "hideDuration": "1000",
- "timeOut": "5000",
- "extendedTimeOut": "1000",
- "showEasing": "swing",
- "hideEasing": "linear",
- "showMethod": "fadeIn",
- "hideMethod": "fadeOut"
- }
- },
- events: {
-
- onAjaxSuccess: function (ret, onAjaxSuccess) {
- var data = typeof ret.data !== 'undefined' ? ret.data : null;
- var msg = typeof ret.msg !== 'undefined' && ret.msg ? ret.msg : __('Operation completed');
- if (typeof onAjaxSuccess === 'function') {
- var result = onAjaxSuccess.call(this, data, ret);
- if (result === false)
- return;
- }
- Toastr.success(msg);
- },
-
- onAjaxError: function (ret, onAjaxError) {
- var data = typeof ret.data !== 'undefined' ? ret.data : null;
- if (typeof onAjaxError === 'function') {
- var result = onAjaxError.call(this, data, ret);
- if (result === false) {
- return;
- }
- }
- Toastr.error(ret.msg);
- },
-
- onAjaxResponse: function (response) {
- try {
- var ret = typeof response === 'object' ? response : JSON.parse(response);
- if (!ret.hasOwnProperty('code')) {
- $.extend(ret, {code: -2, msg: response, data: null});
- }
- } catch (e) {
- var ret = {code: -1, msg: e.message, data: null};
- }
- return ret;
- }
- },
- api: {
-
- ajax: function (options, success, error) {
- options = typeof options === 'string' ? {url: options} : options;
- var index = Layer.load();
- options = $.extend({
- type: "POST",
- dataType: "json",
- success: function (ret) {
- Layer.close(index);
- ret = Fast.events.onAjaxResponse(ret);
- if (ret.code === 1) {
- Fast.events.onAjaxSuccess(ret, success);
- } else {
- Fast.events.onAjaxError(ret, error);
- }
- },
- error: function (xhr) {
- Layer.close(index);
- var ret = {code: xhr.status, msg: xhr.statusText, data: null};
- Fast.events.onAjaxError(ret, error);
- }
- }, options);
- $.ajax(options);
- },
-
- fixurl: function (url) {
- if (url.substr(0, 1) !== "/") {
- var r = new RegExp('^(?:[a-z]+:)?//', 'i');
- if (!r.test(url)) {
- url = Config.moduleurl + "/" + url;
- }
- } else if (url.substr(0, 8) === "/addons/") {
- url = Config.__PUBLIC__.replace(/(\/*$)/g, "") + url;
- }
- return url;
- },
-
- cdnurl: function (url) {
- return /^(?:[a-z]+:)?\/\//i.test(url) ? url : Config.upload.cdnurl + url;
- },
-
- query: function (name, url) {
- if (!url) {
- url = window.location.href;
- }
- name = name.replace(/[\[\]]/g, "\\$&");
- var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
- results = regex.exec(url);
- if (!results)
- return null;
- if (!results[2])
- return '';
- return decodeURIComponent(results[2].replace(/\+/g, " "));
- },
-
- open: function (url, title, options) {
- title = title ? title : "";
- url = Fast.api.fixurl(url);
- url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
- var area = [$(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%'];
- options = $.extend({
- type: 2,
- title: title,
- shadeClose: true,
- shade: false,
- maxmin: true,
- moveOut: true,
- area: area,
- content: url,
- zIndex: Layer.zIndex,
- success: function (layero, index) {
- var that = this;
-
- $(layero).data("callback", that.callback);
-
- Layer.setTop(layero);
- var frame = Layer.getChildFrame('html', index);
- var layerfooter = frame.find(".layer-footer");
- Fast.api.layerfooter(layero, index, that);
-
- if (layerfooter.size() > 0) {
-
-
- var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver
-
- var target = layerfooter[0];
-
- var observer = new MutationObserver(function (mutations) {
- Fast.api.layerfooter(layero, index, that);
- mutations.forEach(function (mutation) {
- });
- });
-
- var config = {attributes: true, childList: true, characterData: true, subtree: true}
-
- observer.observe(target, config);
-
-
- }
- }
- }, options ? options : {});
- if ($(window).width() < 480 || (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && top.$(".tab-pane.active").size() > 0)) {
- options.area = [top.$(".tab-pane.active").width() + "px", top.$(".tab-pane.active").height() + "px"];
- options.offset = [top.$(".tab-pane.active").scrollTop() + "px", "0px"];
- }
- return Layer.open(options);
- },
-
- close: function (data) {
- var index = parent.Layer.getFrameIndex(window.name);
- var callback = parent.$("#layui-layer" + index).data("callback");
-
- parent.Layer.close(index);
-
- if (typeof callback === 'function') {
- callback.call(undefined, data);
- }
- },
- layerfooter: function (layero, index, that) {
- var frame = Layer.getChildFrame('html', index);
- var layerfooter = frame.find(".layer-footer");
- if (layerfooter.size() > 0) {
- $(".layui-layer-footer", layero).remove();
- var footer = $("<div />").addClass('layui-layer-btn layui-layer-footer');
- footer.html(layerfooter.html());
- if ($(".row", footer).size() === 0) {
- $(">", footer).wrapAll("<div class='row'></div>");
- }
- footer.insertAfter(layero.find('.layui-layer-content'));
-
- footer.on("click", ".btn", function () {
- if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
- return;
- }
- $(".btn:eq(" + $(this).index() + ")", layerfooter).trigger("click");
- });
- var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
- var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
-
- $("iframe", layero).height(layero.height() - titHeight - btnHeight);
- }
-
- if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
- var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
- var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
- $("iframe", layero).parent().css("height", layero.height() - titHeight - btnHeight);
- $("iframe", layero).css("height", "100%");
- }
- },
- success: function (options, callback) {
- var type = typeof options === 'function';
- if (type) {
- callback = options;
- }
- return Layer.msg(__('Operation completed'), $.extend({
- offset: 0, icon: 1
- }, type ? {} : options), callback);
- },
- error: function (options, callback) {
- var type = typeof options === 'function';
- if (type) {
- callback = options;
- }
- return Layer.msg(__('Operation failed'), $.extend({
- offset: 0, icon: 2
- }, type ? {} : options), callback);
- },
- toastr: Toastr,
- layer: Layer
- },
- lang: function () {
- var args = arguments,
- string = args[0],
- i = 1;
- string = string.toLowerCase();
-
- if (typeof Lang[string] != 'undefined') {
- if (typeof Lang[string] == 'object')
- return Lang[string];
- string = Lang[string];
- } else if (string.indexOf('.') !== -1 && false) {
- var arr = string.split('.');
- var current = Lang[arr[0]];
- for (var i = 1; i < arr.length; i++) {
- current = typeof current[arr[i]] != 'undefined' ? current[arr[i]] : '';
- if (typeof current != 'object')
- break;
- }
- if (typeof current == 'object')
- return current;
- string = current;
- } else {
- string = args[0];
- }
- return string.replace(/%((%)|s|d)/g, function (m) {
-
- var val = null;
- if (m[2]) {
- val = m[2];
- } else {
- val = args[i];
-
- switch (m) {
- case '%d':
- val = parseFloat(val);
- if (isNaN(val)) {
- val = 0;
- }
- break;
- }
- i++;
- }
- return val;
- });
- },
- init: function () {
-
- $.ajaxSetup({
- beforeSend: function (xhr, setting) {
- setting.url = Fast.api.fixurl(setting.url);
- }
- });
- Layer.config({
- skin: 'layui-layer-fast'
- });
-
- $(window).keyup(function (e) {
- if (e.keyCode == 27) {
- if ($(".layui-layer").size() > 0) {
- var index = 0;
- $(".layui-layer").each(function () {
- index = Math.max(index, parseInt($(this).attr("times")));
- });
- if (index) {
- Layer.close(index);
- }
- }
- }
- });
-
-
- Toastr.options = Fast.config.toastr;
- }
- };
-
- window.Layer = Layer;
-
- window.Toastr = Toastr;
-
- window.__ = Fast.lang;
-
- window.Fast = Fast;
-
- Fast.init();
- return Fast;
- });
- ,"").replace(/\s*$/,""):e}function x(e){if("string"!=typeof e)return e;var t,i={t:1099511627776,g:1073741824,m:1048576,k:1024};return e=/^([0-9\.]+)([tmgk]?)$/.exec(e.toLowerCase().replace(/[^0-9\.tmkg]/g,"")),t=e[2],e=+e[1],i.hasOwnProperty(t)&&(e*=i[t]),Math.floor(e)}function v(t){var i=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=i.shift();return"undefined"!==e(t)?t:""})}function y(e,t){var i=this;setTimeout(function(){e.call(i)},t||1)}var w=function(){var e=0;return function(t){var i,n=(new Date).getTime().toString(32);for(i=0;5>i;i++)n+=Math.floor(65535*Math.random()).toString(32);return(t||"o_")+n+(e++).toString(32)}}();return{guid:w,typeOf:e,extend:t,extendIf:i,extendImmutable:n,extendImmutableIf:r,inherit:s,each:u,isEmptyObj:c,inSeries:l,inParallel:d,inArray:m,arrayDiff:h,arrayIntersect:f,toArray:p,trim:g,sprintf:v,parseSizeStr:x,delay:y}}),n("moxie/core/utils/Encode",[],function(){var e=function(e){return unescape(encodeURIComponent(e))},t=function(e){return decodeURIComponent(escape(e))},i=function(e,i){if("function"==typeof window.atob)return i?t(window.atob(e)):window.atob(e);var n,r,o,a,s,u,c,l,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,h=0,f="",p=[];if(!e)return e;e+="";do a=d.indexOf(e.charAt(m++)),s=d.indexOf(e.charAt(m++)),u=d.indexOf(e.charAt(m++)),c=d.indexOf(e.charAt(m++)),l=a<<18|s<<12|u<<6|c,n=255&l>>16,r=255&l>>8,o=255&l,p[h++]=64==u?String.fromCharCode(n):64==c?String.fromCharCode(n,r):String.fromCharCode(n,r,o);while(m<e.length);return f=p.join(""),i?t(f):f},n=function(t,i){if(i&&(t=e(t)),"function"==typeof window.btoa)return window.btoa(t);var n,r,o,a,s,u,c,l,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,h=0,f="",p=[];if(!t)return t;do n=t.charCodeAt(m++),r=t.charCodeAt(m++),o=t.charCodeAt(m++),l=n<<16|r<<8|o,a=63&l>>18,s=63&l>>12,u=63&l>>6,c=63&l,p[h++]=d.charAt(a)+d.charAt(s)+d.charAt(u)+d.charAt(c);while(m<t.length);f=p.join("");var g=t.length%3;return(g?f.slice(0,g-3):f)+"===".slice(g||3)};return{utf8_encode:e,utf8_decode:t,atob:i,btoa:n}}),n("moxie/core/utils/Env",["moxie/core/utils/Basic"],function(e){function t(e,t,i){var n=0,r=0,o=0,a={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},s=function(e){return e=(""+e).replace(/[_\-+]/g,"."),e=e.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),e.length?e.split("."):[-8]},u=function(e){return e?isNaN(e)?a[e]||-7:parseInt(e,10):0};for(e=s(e),t=s(t),r=Math.max(e.length,t.length),n=0;r>n;n++)if(e[n]!=t[n]){if(e[n]=u(e[n]),t[n]=u(t[n]),e[n]<t[n]){o=-1;break}if(e[n]>t[n]){o=1;break}}if(!i)return o;switch(i){case">":case"gt":return o>0;case">=":case"ge":return o>=0;case"<=":case"le":return 0>=o;case"==":case"=":case"eq":return 0===o;case"<>":case"!=":case"ne":return 0!==o;case"":case"<":case"lt":return 0>o;default:return null}}var i=function(e){var t="",i="?",n="function",r="undefined",o="object",a="name",s="version",u={has:function(e,t){return-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()}},c={rgx:function(){for(var t,i,a,s,u,c,l,d=0,m=arguments;d<m.length;d+=2){var h=m[d],f=m[d+1];if(typeof t===r){t={};for(s in f)u=f[s],typeof u===o?t[u[0]]=e:t[u]=e}for(i=a=0;i<h.length;i++)if(c=h[i].exec(this.getUA())){for(s=0;s<f.length;s++)l=c[++a],u=f[s],typeof u===o&&u.length>0?2==u.length?t[u[0]]=typeof u[1]==n?u[1].call(this,l):u[1]:3==u.length?t[u[0]]=typeof u[1]!==n||u[1].exec&&u[1].test?l?l.replace(u[1],u[2]):e:l?u[1].call(this,l,u[2]):e:4==u.length&&(t[u[0]]=l?u[3].call(this,l.replace(u[1],u[2])):e):t[u]=l?l:e;break}if(c)break}return t},str:function(t,n){for(var r in n)if(typeof n[r]===o&&n[r].length>0){for(var a=0;a<n[r].length;a++)if(u.has(n[r][a],t))return r===i?e:r}else if(u.has(n[r],t))return r===i?e:r;return t}},l={browser:{oldsafari:{major:{1:["/8","/1","/3"],2:"/4","?":"/"},version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",RT:"ARM"}}}},d={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[a,s],[/\s(opr)\/([\w\.]+)/i],[[a,"Opera"],s],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi)\/([\w\.-]+)/i],[a,s],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[a,"IE"],s],[/(edge)\/((\d+)?[\w\.]+)/i],[a,s],[/(yabrowser)\/([\w\.]+)/i],[[a,"Yandex"],s],[/(comodo_dragon)\/([\w\.]+)/i],[[a,/_/g," "],s],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i,/(uc\s?browser|qqbrowser)[\/\s]?([\w\.]+)/i],[a,s],[/(dolfin)\/([\w\.]+)/i],[[a,"Dolphin"],s],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[a,"Chrome"],s],[/XiaoMi\/MiuiBrowser\/([\w\.]+)/i],[s,[a,"MIUI Browser"]],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i],[s,[a,"Android Browser"]],[/FBAV\/([\w\.]+);/i],[s,[a,"Facebook"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[s,[a,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[s,a],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[a,[s,c.str,l.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[a,s],[/(navigator|netscape)\/([\w\.-]+)/i],[[a,"Netscape"],s],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]+)*/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[a,s]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[s,[a,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[a,s],[/rv\:([\w\.]+).*(gecko)/i],[s,a]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[a,s],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[a,[s,c.str,l.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[a,"Windows"],[s,c.str,l.os.windows.version]],[/\((bb)(10);/i],[[a,"BlackBerry"],s],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],[a,s],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[a,"Symbian"],s],[/\((series40);/i],[a],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[a,"Firefox OS"],s],[/(nintendo|playstation)\s([wids3portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[a,s],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[a,"Chromium OS"],s],[/(sunos)\s?([\w\.]+\d)*/i],[[a,"Solaris"],s],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[a,s],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[a,"iOS"],[s,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[[a,"Mac OS"],[s,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],[a,s]]},m=function(e){var i=e||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:t);this.getBrowser=function(){return c.rgx.apply(this,d.browser)},this.getEngine=function(){return c.rgx.apply(this,d.engine)},this.getOS=function(){return c.rgx.apply(this,d.os)},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS()}},this.getUA=function(){return i},this.setUA=function(e){return i=e,this},this.setUA(i)};return m}(),n=function(){var t={define_property:function(){return!1}(),create_canvas:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))}(),return_response_type:function(t){try{if(-1!==e.inArray(t,["","text","document"]))return!0;if(window.XMLHttpRequest){var i=new XMLHttpRequest;if(i.open("get","/"),"responseType"in i)return i.responseType=t,i.responseType!==t?!1:!0}}catch(n){}return!1},use_data_uri:function(){var e=new Image;return e.onload=function(){t.use_data_uri=1===e.width&&1===e.height},setTimeout(function(){e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="},1),!1}(),use_data_uri_over32kb:function(){return t.use_data_uri&&("IE"!==o.browser||o.version>=9)},use_data_uri_of:function(e){return t.use_data_uri&&33e3>e||t.use_data_uri_over32kb()},use_fileinput:function(){if(navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/))return!1;var e=document.createElement("input");return e.setAttribute("type","file"),!e.disabled}};return function(i){var n=[].slice.call(arguments);return n.shift(),"function"===e.typeOf(t[i])?t[i].apply(this,n):!!t[i]}}(),r=(new i).getResult(),o={can:n,uaParser:i,browser:r.browser.name,version:r.browser.version,os:r.os.name,osVersion:r.os.version,verComp:t,swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return o.OS=o.os,o}),n("moxie/core/Exceptions",["moxie/core/utils/Basic"],function(e){function t(e,t){var i;for(i in e)if(e[i]===t)return i;return null}return{RuntimeError:function(){function i(e,i){this.code=e,this.name=t(n,e),this.message=this.name+(i||": RuntimeError "+this.code)}var n={NOT_INIT_ERR:1,EXCEPTION_ERR:3,NOT_SUPPORTED_ERR:9,JS_ERR:4};return e.extend(i,n),i.prototype=Error.prototype,i}(),OperationNotAllowedException:function(){function t(e){this.code=e,this.name="OperationNotAllowedException"}return e.extend(t,{NOT_ALLOWED_ERR:1}),t.prototype=Error.prototype,t}(),ImageError:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": ImageError "+this.code}var n={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2,INVALID_META_ERR:3};return e.extend(i,n),i.prototype=Error.prototype,i}(),FileException:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": FileException "+this.code}var n={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return e.extend(i,n),i.prototype=Error.prototype,i}(),DOMException:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": DOMException "+this.code}var n={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return e.extend(i,n),i.prototype=Error.prototype,i}(),EventException:function(){function t(e){this.code=e,this.name="EventException"}return e.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0}),t.prototype=Error.prototype,t}()}}),n("moxie/core/utils/Dom",["moxie/core/utils/Env"],function(e){var t=function(e){return"string"!=typeof e?e:document.getElementById(e)},i=function(e,t){if(!e.className)return!1;var i=new RegExp("(^|\\s+)"+t+"(\\s+|$)");return i.test(e.className)},n=function(e,t){i(e,t)||(e.className=e.className?e.className.replace(/\s+$/,"")+" "+t:t)},r=function(e,t){if(e.className){var i=new RegExp("(^|\\s+)"+t+"(\\s+|$)");e.className=e.className.replace(i,function(e,t,i){return" "===t&&" "===i?" ":""})}},o=function(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(e,null)[t]:void 0},a=function(t,i){function n(e){var t,i,n=0,r=0;return e&&(i=e.getBoundingClientRect(),t="CSS1Compat"===c.compatMode?c.documentElement:c.body,n=i.left+t.scrollLeft,r=i.top+t.scrollTop),{x:n,y:r}}var r,o,a,s=0,u=0,c=document;if(t=t,i=i||c.body,t&&t.getBoundingClientRect&&"IE"===e.browser&&(!c.documentMode||c.documentMode<8))return o=n(t),a=n(i),{x:o.x-a.x,y:o.y-a.y};for(r=t;r&&r!=i&&r.nodeType;)s+=r.offsetLeft||0,u+=r.offsetTop||0,r=r.offsetParent;for(r=t.parentNode;r&&r!=i&&r.nodeType;)s-=r.scrollLeft||0,u-=r.scrollTop||0,r=r.parentNode;return{x:s,y:u}},s=function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}};return{get:t,hasClass:i,addClass:n,removeClass:r,getStyle:o,getPos:a,getSize:s}}),n("moxie/core/EventTarget",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic"],function(e,t,i){function n(){this.uid=i.guid()}var r={};return i.extend(n.prototype,{init:function(){this.uid||(this.uid=i.guid("uid_"))},addEventListener:function(e,t,n,o){var a,s=this;return this.hasOwnProperty("uid")||(this.uid=i.guid("uid_")),e=i.trim(e),/\s/.test(e)?(i.each(e.split(/\s+/),function(e){s.addEventListener(e,t,n,o)}),void 0):(e=e.toLowerCase(),n=parseInt(n,10)||0,a=r[this.uid]&&r[this.uid][e]||[],a.push({fn:t,priority:n,scope:o||this}),r[this.uid]||(r[this.uid]={}),r[this.uid][e]=a,void 0)},hasEventListener:function(e){var t;return e?(e=e.toLowerCase(),t=r[this.uid]&&r[this.uid][e]):t=r[this.uid],t?t:!1},removeEventListener:function(e,t){var n,o,a=this;if(e=e.toLowerCase(),/\s/.test(e))return i.each(e.split(/\s+/),function(e){a.removeEventListener(e,t)}),void 0;if(n=r[this.uid]&&r[this.uid][e]){if(t){for(o=n.length-1;o>=0;o--)if(n[o].fn===t){n.splice(o,1);break}}else n=[];n.length||(delete r[this.uid][e],i.isEmptyObj(r[this.uid])&&delete r[this.uid])}},removeAllEventListeners:function(){r[this.uid]&&delete r[this.uid]},dispatchEvent:function(e){var n,o,a,s,u,c={},l=!0;if("string"!==i.typeOf(e)){if(s=e,"string"!==i.typeOf(s.type))throw new t.EventException(t.EventException.UNSPECIFIED_EVENT_TYPE_ERR);e=s.type,s.total!==u&&s.loaded!==u&&(c.total=s.total,c.loaded=s.loaded),c.async=s.async||!1}if(-1!==e.indexOf("::")?function(t){n=t[0],e=t[1]}(e.split("::")):n=this.uid,e=e.toLowerCase(),o=r[n]&&r[n][e]){o.sort(function(e,t){return t.priority-e.priority}),a=[].slice.call(arguments),a.shift(),c.type=e,a.unshift(c);var d=[];i.each(o,function(e){a[0].target=e.scope,c.async?d.push(function(t){setTimeout(function(){t(e.fn.apply(e.scope,a)===!1)},1)}):d.push(function(t){t(e.fn.apply(e.scope,a)===!1)})}),d.length&&i.inSeries(d,function(e){l=!e})}return l},bindOnce:function(e,t,i,n){var r=this;r.bind.call(this,e,function o(){return r.unbind(e,o),t.apply(this,arguments)},i,n)},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},handleEventProps:function(e){var t=this;this.bind(e.join(" "),function(e){var t="on"+e.type.toLowerCase();"function"===i.typeOf(this[t])&&this[t].apply(this,arguments)}),i.each(e,function(e){e="on"+e.toLowerCase(e),"undefined"===i.typeOf(t[e])&&(t[e]=null)})}}),n.instance=new n,n}),n("moxie/runtime/Runtime",["moxie/core/utils/Env","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/EventTarget"],function(e,t,i,n){function r(e,n,o,s,u){var c,l=this,d=t.guid(n+"_"),m=u||"browser";e=e||{},a[d]=this,o=t.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},o),e.preferred_caps&&(m=r.getMode(s,e.preferred_caps,m)),c=function(){var e={};return{exec:function(t,i,n,r){return c[i]&&(e[t]||(e[t]={context:this,instance:new c[i]}),e[t].instance[n])?e[t].instance[n].apply(this,r):void 0},removeInstance:function(t){delete e[t]},removeAllInstances:function(){var i=this;t.each(e,function(e,n){"function"===t.typeOf(e.instance.destroy)&&e.instance.destroy.call(e.context),i.removeInstance(n)})}}}(),t.extend(this,{initialized:!1,uid:d,type:n,mode:r.getMode(s,e.required_caps,m),shimid:d+"_container",clients:0,options:e,can:function(e,i){var n=arguments[2]||o;if("string"===t.typeOf(e)&&"undefined"===t.typeOf(i)&&(e=r.parseCaps(e)),"object"===t.typeOf(e)){for(var a in e)if(!this.can(a,e[a],n))return!1;return!0}return"function"===t.typeOf(n[e])?n[e].call(this,i):i===n[e]},getShimContainer:function(){var e,n=i.get(this.shimid);return n||(e=i.get(this.options.container)||document.body,n=document.createElement("div"),n.id=this.shimid,n.className="moxie-shim moxie-shim-"+this.type,t.extend(n.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),e.appendChild(n),e=null),n},getShim:function(){return c},shimExec:function(e,t){var i=[].slice.call(arguments,2);return l.getShim().exec.call(this,this.uid,e,t,i)},exec:function(e,t){var i=[].slice.call(arguments,2);return l[e]&&l[e][t]?l[e][t].apply(this,i):l.shimExec.apply(this,arguments)},destroy:function(){if(l){var e=i.get(this.shimid);e&&e.parentNode.removeChild(e),c&&c.removeAllInstances(),this.unbindAll(),delete a[this.uid],this.uid=null,d=l=c=e=null}}}),this.mode&&e.required_caps&&!this.can(e.required_caps)&&(this.mode=!1)}var o={},a={};return r.order="html5,flash,silverlight,html4",r.getRuntime=function(e){return a[e]?a[e]:!1},r.addConstructor=function(e,t){t.prototype=n.instance,o[e]=t},r.getConstructor=function(e){return o[e]||null},r.getInfo=function(e){var t=r.getRuntime(e);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},r.parseCaps=function(e){var i={};return"string"!==t.typeOf(e)?e||{}:(t.each(e.split(","),function(e){i[e]=!0}),i)},r.can=function(e,t){var i,n,o=r.getConstructor(e);return o?(i=new o({required_caps:t}),n=i.mode,i.destroy(),!!n):!1},r.thatCan=function(e,t){var i=(t||r.order).split(/\s*,\s*/);for(var n in i)if(r.can(i[n],e))return i[n];return null},r.getMode=function(e,i,n){var r=null;if("undefined"===t.typeOf(n)&&(n="browser"),i&&!t.isEmptyObj(e)){if(t.each(i,function(i,n){if(e.hasOwnProperty(n)){var o=e[n](i);if("string"==typeof o&&(o=[o]),r){if(!(r=t.arrayIntersect(r,o)))return r=!1}else r=o}}),r)return-1!==t.inArray(n,r)?n:r[0];if(r===!1)return!1}return n},r.capTrue=function(){return!0},r.capFalse=function(){return!1},r.capTest=function(e){return function(){return!!e}},r}),n("moxie/runtime/RuntimeClient",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/Runtime"],function(e,t,i,n){return function(){var e;i.extend(this,{connectRuntime:function(r){function o(i){var a,u;return i.length?(a=i.shift().toLowerCase(),(u=n.getConstructor(a))?(e=new u(r),e.bind("Init",function(){e.initialized=!0,setTimeout(function(){e.clients++,s.ruid=e.uid,s.trigger("RuntimeInit",e)},1)}),e.bind("Error",function(){e.destroy(),o(i)}),e.bind("Exception",function(e,i){var n=i.name+"(#"+i.code+")"+(i.message?", from: "+i.message:"");s.trigger("RuntimeError",new t.RuntimeError(t.RuntimeError.EXCEPTION_ERR,n))}),e.mode?(e.init(),void 0):(e.trigger("Error"),void 0)):(o(i),void 0)):(s.trigger("RuntimeError",new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)),e=null,void 0)}var a,s=this;if("string"===i.typeOf(r)?a=r:"string"===i.typeOf(r.ruid)&&(a=r.ruid),a){if(e=n.getRuntime(a))return s.ruid=a,e.clients++,e;throw new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)}o((r.runtime_order||n.order).split(/\s*,\s*/))},disconnectRuntime:function(){e&&--e.clients<=0&&e.destroy(),e=null},getRuntime:function(){return e&&e.uid?e:e=null},exec:function(){return e?e.exec.apply(this,arguments):null},can:function(t){return e?e.can(t):!1}})}}),n("moxie/file/Blob",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient"],function(e,t,i){function n(o,a){function s(t,i,o){var a,s=r[this.uid];return"string"===e.typeOf(s)&&s.length?(a=new n(null,{type:o,size:i-t}),a.detach(s.substr(t,a.size)),a):null}i.call(this),o&&this.connectRuntime(o),a?"string"===e.typeOf(a)&&(a={data:a}):a={},e.extend(this,{uid:a.uid||e.guid("uid_"),ruid:o,size:a.size||0,type:a.type||"",slice:function(e,t,i){return this.isDetached()?s.apply(this,arguments):this.getRuntime().exec.call(this,"Blob","slice",this.getSource(),e,t,i)},getSource:function(){return r[this.uid]?r[this.uid]:null},detach:function(e){if(this.ruid&&(this.getRuntime().exec.call(this,"Blob","destroy"),this.disconnectRuntime(),this.ruid=null),e=e||"","data:"==e.substr(0,5)){var i=e.indexOf(";base64,");this.type=e.substring(5,i),e=t.atob(e.substring(i+8))}this.size=e.length,r[this.uid]=e},isDetached:function(){return!this.ruid&&"string"===e.typeOf(r[this.uid])},destroy:function(){this.detach(),delete r[this.uid]}}),a.data?this.detach(a.data):r[this.uid]=a}var r={};return n}),n("moxie/core/I18n",["moxie/core/utils/Basic"],function(e){var t={};return{addI18n:function(i){return e.extend(t,i)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(t){var i=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=i.shift();return"undefined"!==e.typeOf(t)?t:""})}}}),n("moxie/core/utils/Mime",["moxie/core/utils/Basic","moxie/core/I18n"],function(e,t){var i="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",n={mimes:{},extensions:{},addMimeType:function(e){var t,i,n,r=e.split(/,/);for(t=0;t<r.length;t+=2){for(n=r[t+1].split(/ /),i=0;i<n.length;i++)this.mimes[n[i]]=r[t];this.extensions[r[t]]=n}},extList2mimes:function(t,i){var n,r,o,a,s=this,u=[];for(r=0;r<t.length;r++)for(n=t[r].extensions.split(/\s*,\s*/),o=0;o<n.length;o++){if("*"===n[o])return[];if(a=s.mimes[n[o]],a&&-1===e.inArray(a,u)&&u.push(a),i&&/^\w+$/.test(n[o]))u.push("."+n[o]);else if(!a)return[]}return u},mimes2exts:function(t){var i=this,n=[];return e.each(t,function(t){if("*"===t)return n=[],!1;var r=t.match(/^(\w+)\/(\*|\w+)$/);r&&("*"===r[2]?e.each(i.extensions,function(e,t){new RegExp("^"+r[1]+"/").test(t)&&[].push.apply(n,i.extensions[t])}):i.extensions[t]&&[].push.apply(n,i.extensions[t]))}),n},mimes2extList:function(i){var n=[],r=[];return"string"===e.typeOf(i)&&(i=e.trim(i).split(/\s*,\s*/)),r=this.mimes2exts(i),n.push({title:t.translate("Files"),extensions:r.length?r.join(","):"*"}),n.mimes=i,n},getFileExtension:function(e){var t=e&&e.match(/\.([^.]+)$/);return t?t[1].toLowerCase():""},getFileMime:function(e){return this.mimes[this.getFileExtension(e)]||""}};return n.addMimeType(i),n}),n("moxie/file/FileInput",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Mime","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/I18n","moxie/runtime/Runtime","moxie/runtime/RuntimeClient"],function(e,t,i,n,r,o,a,s,u){function c(t){var o,c,d;if(-1!==e.inArray(e.typeOf(t),["string","node"])&&(t={browse_button:t}),c=n.get(t.browse_button),!c)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR);d={accept:[{title:a.translate("All Files"),extensions:"*"}],multiple:!1,required_caps:!1,container:c.parentNode||document.body},t=e.extend({},d,t),"string"==typeof t.required_caps&&(t.required_caps=s.parseCaps(t.required_caps)),"string"==typeof t.accept&&(t.accept=i.mimes2extList(t.accept)),o=n.get(t.container),o||(o=document.body),"static"===n.getStyle(o,"position")&&(o.style.position="relative"),o=c=null,u.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,shimid:null,files:null,init:function(){var i=this;i.bind("RuntimeInit",function(r,o){i.ruid=o.uid,i.shimid=o.shimid,i.bind("Ready",function(){i.trigger("Refresh")},999),i.bind("Refresh",function(){var i,r,a,s,u;a=n.get(t.browse_button),s=n.get(o.shimid),a&&(i=n.getPos(a,n.get(t.container)),r=n.getSize(a),u=parseInt(n.getStyle(a,"z-index"),10)||0,s&&e.extend(s.style,{top:i.y+"px",left:i.x+"px",width:r.w+"px",height:r.h+"px",zIndex:u+1})),s=a=null}),o.exec.call(i,"FileInput","init",t)}),i.connectRuntime(e.extend({},t,{required_caps:{select_file:!0}}))},getOption:function(e){return t[e]},setOption:function(e,n){if(t.hasOwnProperty(e)){var o=t[e];switch(e){case"accept":"string"==typeof n&&(n=i.mimes2extList(n));break;case"container":case"required_caps":throw new r.FileException(r.FileException.NO_MODIFICATION_ALLOWED_ERR)}t[e]=n,this.exec("FileInput","setOption",e,n),this.trigger("OptionChanged",e,n,o)}},disable:function(t){var i=this.getRuntime();i&&this.exec("FileInput","disable","undefined"===e.typeOf(t)?!0:t)},refresh:function(){this.trigger("Refresh")},destroy:function(){var t=this.getRuntime();t&&(t.exec.call(this,"FileInput","destroy"),this.disconnectRuntime()),"array"===e.typeOf(this.files)&&e.each(this.files,function(e){e.destroy()}),this.files=null,this.unbindAll()}}),this.handleEventProps(l)}var l=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];return c.prototype=o.instance,c}),n("moxie/file/File",["moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/file/Blob"],function(e,t,i){function n(n,r){r||(r={}),i.apply(this,arguments),this.type||(this.type=t.getFileMime(r.name));var o;if(r.name)o=r.name.replace(/\\/g,"/"),o=o.substr(o.lastIndexOf("/")+1);else if(this.type){var a=this.type.split("/")[0];o=e.guid((""!==a?a:"file")+"_"),t.extensions[this.type]&&(o+="."+t.extensions[this.type][0])}e.extend(this,{name:o||e.guid("file_"),relativePath:"",lastModifiedDate:r.lastModifiedDate||(new Date).toLocaleString()})}return n.prototype=i.prototype,n}),n("moxie/file/FileDrop",["moxie/core/I18n","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/core/utils/Env","moxie/file/File","moxie/runtime/RuntimeClient","moxie/core/EventTarget","moxie/core/utils/Mime"],function(e,t,i,n,r,o,a,s,u){function c(i){var r,o=this;"string"==typeof i&&(i={drop_zone:i}),r={accept:[{title:e.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}},i="object"==typeof i?n.extend({},r,i):r,i.container=t.get(i.drop_zone)||document.body,"static"===t.getStyle(i.container,"position")&&(i.container.style.position="relative"),"string"==typeof i.accept&&(i.accept=u.mimes2extList(i.accept)),a.call(o),n.extend(o,{uid:n.guid("uid_"),ruid:null,files:null,init:function(){o.bind("RuntimeInit",function(e,t){o.ruid=t.uid,t.exec.call(o,"FileDrop","init",i),o.dispatchEvent("ready")}),o.connectRuntime(i)},destroy:function(){var e=this.getRuntime();e&&(e.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime()),this.files=null,this.unbindAll()}}),this.handleEventProps(l)}var l=["ready","dragenter","dragleave","drop","error"];return c.prototype=s.instance,c}),n("moxie/file/FileReader",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/Exceptions","moxie/core/EventTarget","moxie/file/Blob","moxie/runtime/RuntimeClient"],function(e,t,i,n,r,o){function a(){function n(e,n){if(this.trigger("loadstart"),this.readyState===a.LOADING)return this.trigger("error",new i.DOMException(i.DOMException.INVALID_STATE_ERR)),this.trigger("loadend"),void 0;
- if(!(n instanceof r))return this.trigger("error",new i.DOMException(i.DOMException.NOT_FOUND_ERR)),this.trigger("loadend"),void 0;if(this.result=null,this.readyState=a.LOADING,n.isDetached()){var o=n.getSource();switch(e){case"readAsText":case"readAsBinaryString":this.result=o;break;case"readAsDataURL":this.result="data:"+n.type+";base64,"+t.btoa(o)}this.readyState=a.DONE,this.trigger("load"),this.trigger("loadend")}else this.connectRuntime(n.ruid),this.exec("FileReader","read",e,n)}o.call(this),e.extend(this,{uid:e.guid("uid_"),readyState:a.EMPTY,result:null,error:null,readAsBinaryString:function(e){n.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){n.call(this,"readAsDataURL",e)},readAsText:function(e){n.call(this,"readAsText",e)},abort:function(){this.result=null,-1===e.inArray(this.readyState,[a.EMPTY,a.DONE])&&(this.readyState===a.LOADING&&(this.readyState=a.DONE),this.exec("FileReader","abort"),this.trigger("abort"),this.trigger("loadend"))},destroy:function(){this.abort(),this.exec("FileReader","destroy"),this.disconnectRuntime(),this.unbindAll()}}),this.handleEventProps(s),this.bind("Error",function(e,t){this.readyState=a.DONE,this.error=t},999),this.bind("Load",function(){this.readyState=a.DONE},999)}var s=["loadstart","progress","load","abort","error","loadend"];return a.EMPTY=0,a.LOADING=1,a.DONE=2,a.prototype=n.instance,a}),n("moxie/core/utils/Url",[],function(){var e=function(t,i){for(var n=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],r=n.length,o={http:80,https:443},a={},s=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,u=s.exec(t||"");r--;)u[r]&&(a[n[r]]=u[r]);if(!a.scheme){i&&"string"!=typeof i||(i=e(i||document.location.href)),a.scheme=i.scheme,a.host=i.host,a.port=i.port;var c="";/^[^\/]/.test(a.path)&&(c=i.path,c=/\/[^\/]*\.[^\/]*$/.test(c)?c.replace(/\/[^\/]+$/,"/"):c.replace(/\/?$/,"/")),a.path=c+(a.path||"")}return a.port||(a.port=o[a.scheme]||80),a.port=parseInt(a.port,10),a.path||(a.path="/"),delete a.source,a},t=function(t){var i={http:80,https:443},n="object"==typeof t?t:e(t);return n.scheme+"://"+n.host+(n.port!==i[n.scheme]?":"+n.port:"")+n.path+(n.query?n.query:"")},i=function(t){function i(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof t&&(t=e(t)),i(e())===i(t)};return{parseUrl:e,resolveUrl:t,hasSameOrigin:i}}),n("moxie/runtime/RuntimeTarget",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,i){function n(){this.uid=e.guid("uid_"),t.call(this),this.destroy=function(){this.disconnectRuntime(),this.unbindAll()}}return n.prototype=i.instance,n}),n("moxie/file/FileReaderSync",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/utils/Encode"],function(e,t,i){return function(){function n(e,t){if(!t.isDetached()){var n=this.connectRuntime(t.ruid).exec.call(this,"FileReaderSync","read",e,t);return this.disconnectRuntime(),n}var r=t.getSource();switch(e){case"readAsBinaryString":return r;case"readAsDataURL":return"data:"+t.type+";base64,"+i.btoa(r);case"readAsText":for(var o="",a=0,s=r.length;s>a;a++)o+=String.fromCharCode(r[a]);return o}}t.call(this),e.extend(this,{uid:e.guid("uid_"),readAsBinaryString:function(e){return n.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){return n.call(this,"readAsDataURL",e)},readAsText:function(e){return n.call(this,"readAsText",e)}})}}),n("moxie/xhr/FormData",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/file/Blob"],function(e,t,i){function n(){var e,n=[];t.extend(this,{append:function(r,o){var a=this,s=t.typeOf(o);o instanceof i?e={name:r,value:o}:"array"===s?(r+="[]",t.each(o,function(e){a.append(r,e)})):"object"===s?t.each(o,function(e,t){a.append(r+"["+t+"]",e)}):"null"===s||"undefined"===s||"number"===s&&isNaN(o)?a.append(r,"false"):n.push({name:r,value:o.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return e&&e.value||null},getBlobName:function(){return e&&e.name||null},each:function(i){t.each(n,function(e){i(e.value,e.name)}),e&&i(e.value,e.name)},destroy:function(){e=null,n=[]}})}return n}),n("moxie/xhr/XMLHttpRequest",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/core/utils/Url","moxie/runtime/Runtime","moxie/runtime/RuntimeTarget","moxie/file/Blob","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/core/utils/Env","moxie/core/utils/Mime"],function(e,t,i,n,r,o,a,s,u,c,l,d){function m(){this.uid=e.guid("uid_")}function h(){function i(e,t){return I.hasOwnProperty(e)?1===arguments.length?l.can("define_property")?I[e]:A[e]:(l.can("define_property")?I[e]=t:A[e]=t,void 0):void 0}function u(t){function n(){R&&(R.destroy(),R=null),s.dispatchEvent("loadend"),s=null}function r(r){R.bind("LoadStart",function(e){i("readyState",h.LOADING),s.dispatchEvent("readystatechange"),s.dispatchEvent(e),L&&s.upload.dispatchEvent(e)}),R.bind("Progress",function(e){i("readyState")!==h.LOADING&&(i("readyState",h.LOADING),s.dispatchEvent("readystatechange")),s.dispatchEvent(e)}),R.bind("UploadProgress",function(e){L&&s.upload.dispatchEvent({type:"progress",lengthComputable:!1,total:e.total,loaded:e.loaded})}),R.bind("Load",function(t){i("readyState",h.DONE),i("status",Number(r.exec.call(R,"XMLHttpRequest","getStatus")||0)),i("statusText",f[i("status")]||""),i("response",r.exec.call(R,"XMLHttpRequest","getResponse",i("responseType"))),~e.inArray(i("responseType"),["text",""])?i("responseText",i("response")):"document"===i("responseType")&&i("responseXML",i("response")),U=r.exec.call(R,"XMLHttpRequest","getAllResponseHeaders"),s.dispatchEvent("readystatechange"),i("status")>0?(L&&s.upload.dispatchEvent(t),s.dispatchEvent(t)):(F=!0,s.dispatchEvent("error")),n()}),R.bind("Abort",function(e){s.dispatchEvent(e),n()}),R.bind("Error",function(e){F=!0,i("readyState",h.DONE),s.dispatchEvent("readystatechange"),M=!0,s.dispatchEvent(e),n()}),r.exec.call(R,"XMLHttpRequest","send",{url:x,method:v,async:T,user:y,password:w,headers:S,mimeType:D,encoding:O,responseType:s.responseType,withCredentials:s.withCredentials,options:k},t)}var s=this;E=(new Date).getTime(),R=new a,"string"==typeof k.required_caps&&(k.required_caps=o.parseCaps(k.required_caps)),k.required_caps=e.extend({},k.required_caps,{return_response_type:s.responseType}),t instanceof c&&(k.required_caps.send_multipart=!0),e.isEmptyObj(S)||(k.required_caps.send_custom_headers=!0),B||(k.required_caps.do_cors=!0),k.ruid?r(R.connectRuntime(k)):(R.bind("RuntimeInit",function(e,t){r(t)}),R.bind("RuntimeError",function(e,t){s.dispatchEvent("RuntimeError",t)}),R.connectRuntime(k))}function g(){i("responseText",""),i("responseXML",null),i("response",null),i("status",0),i("statusText",""),E=b=null}var x,v,y,w,E,b,R,_,A=this,I={timeout:0,readyState:h.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},T=!0,S={},O=null,D=null,N=!1,C=!1,L=!1,M=!1,F=!1,B=!1,P=null,H=null,k={},U="";e.extend(this,I,{uid:e.guid("uid_"),upload:new m,open:function(o,a,s,u,c){var l;if(!o||!a)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(o)||n.utf8_encode(o)!==o)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(~e.inArray(o.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(v=o.toUpperCase()),~e.inArray(v,["CONNECT","TRACE","TRACK"]))throw new t.DOMException(t.DOMException.SECURITY_ERR);if(a=n.utf8_encode(a),l=r.parseUrl(a),B=r.hasSameOrigin(l),x=r.resolveUrl(a),(u||c)&&!B)throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);if(y=u||l.user,w=c||l.pass,T=s||!0,T===!1&&(i("timeout")||i("withCredentials")||""!==i("responseType")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);N=!T,C=!1,S={},g.call(this),i("readyState",h.OPENED),this.dispatchEvent("readystatechange")},setRequestHeader:function(r,o){var a=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(i("readyState")!==h.OPENED||C)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(r)||n.utf8_encode(r)!==r)throw new t.DOMException(t.DOMException.SYNTAX_ERR);return r=e.trim(r).toLowerCase(),~e.inArray(r,a)||/^(proxy\-|sec\-)/.test(r)?!1:(S[r]?S[r]+=", "+o:S[r]=o,!0)},hasRequestHeader:function(e){return e&&S[e.toLowerCase()]||!1},getAllResponseHeaders:function(){return U||""},getResponseHeader:function(t){return t=t.toLowerCase(),F||~e.inArray(t,["set-cookie","set-cookie2"])?null:U&&""!==U&&(_||(_={},e.each(U.split(/\r\n/),function(t){var i=t.split(/:\s+/);2===i.length&&(i[0]=e.trim(i[0]),_[i[0].toLowerCase()]={header:i[0],value:e.trim(i[1])})})),_.hasOwnProperty(t))?_[t].header+": "+_[t].value:null},overrideMimeType:function(n){var r,o;if(~e.inArray(i("readyState"),[h.LOADING,h.DONE]))throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(n=e.trim(n.toLowerCase()),/;/.test(n)&&(r=n.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(n=r[1],r[2]&&(o=r[2])),!d.mimes[n])throw new t.DOMException(t.DOMException.SYNTAX_ERR);P=n,H=o},send:function(i,r){if(k="string"===e.typeOf(r)?{ruid:r}:r?r:{},this.readyState!==h.OPENED||C)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(i instanceof s)k.ruid=i.ruid,D=i.type||"application/octet-stream";else if(i instanceof c){if(i.hasBlob()){var o=i.getBlob();k.ruid=o.ruid,D=o.type||"application/octet-stream"}}else"string"==typeof i&&(O="UTF-8",D="text/plain;charset=UTF-8",i=n.utf8_encode(i));this.withCredentials||(this.withCredentials=k.required_caps&&k.required_caps.send_browser_cookies&&!B),L=!N&&this.upload.hasEventListener(),F=!1,M=!i,N||(C=!0),u.call(this,i)},abort:function(){if(F=!0,N=!1,~e.inArray(i("readyState"),[h.UNSENT,h.OPENED,h.DONE]))i("readyState",h.UNSENT);else{if(i("readyState",h.DONE),C=!1,!R)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);R.getRuntime().exec.call(R,"XMLHttpRequest","abort",M),M=!0}},destroy:function(){R&&("function"===e.typeOf(R.destroy)&&R.destroy(),R=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}}),this.handleEventProps(p.concat(["readystatechange"])),this.upload.handleEventProps(p)}var f={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};m.prototype=i.instance;var p=["loadstart","progress","abort","error","load","timeout","loadend"];return h.UNSENT=0,h.OPENED=1,h.HEADERS_RECEIVED=2,h.LOADING=3,h.DONE=4,h.prototype=i.instance,h}),n("moxie/runtime/Transporter",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,i,n){function r(){function n(){l=d=0,c=this.result=null}function o(t,i){var n=this;u=i,n.bind("TransportingProgress",function(t){d=t.loaded,l>d&&-1===e.inArray(n.state,[r.IDLE,r.DONE])&&a.call(n)},999),n.bind("TransportingComplete",function(){d=l,n.state=r.DONE,c=null,n.result=u.exec.call(n,"Transporter","getAsBlob",t||"")},999),n.state=r.BUSY,n.trigger("TransportingStarted"),a.call(n)}function a(){var e,i=this,n=l-d;m>n&&(m=n),e=t.btoa(c.substr(d,m)),u.exec.call(i,"Transporter","receive",e,l)}var s,u,c,l,d,m;i.call(this),e.extend(this,{uid:e.guid("uid_"),state:r.IDLE,result:null,transport:function(t,i,r){var a=this;if(r=e.extend({chunk_size:204798},r),(s=r.chunk_size%3)&&(r.chunk_size+=3-s),m=r.chunk_size,n.call(this),c=t,l=t.length,"string"===e.typeOf(r)||r.ruid)o.call(a,i,this.connectRuntime(r));else{var u=function(e,t){a.unbind("RuntimeInit",u),o.call(a,i,t)};this.bind("RuntimeInit",u),this.connectRuntime(r)}},abort:function(){var e=this;e.state=r.IDLE,u&&(u.exec.call(e,"Transporter","clear"),e.trigger("TransportingAborted")),n.call(e)},destroy:function(){this.unbindAll(),u=null,this.disconnectRuntime(),n.call(this)}})}return r.IDLE=0,r.BUSY=1,r.DONE=2,r.prototype=n.instance,r}),n("moxie/image/Image",["moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/file/FileReaderSync","moxie/xhr/XMLHttpRequest","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/runtime/Transporter","moxie/core/utils/Env","moxie/core/EventTarget","moxie/file/Blob","moxie/file/File","moxie/core/utils/Encode"],function(e,t,i,n,r,o,a,s,u,c,l,d,m){function h(){function n(e){try{return e||(e=this.exec("Image","getInfo")),this.size=e.size,this.width=e.width,this.height=e.height,this.type=e.type,this.meta=e.meta,""===this.name&&(this.name=e.name),!0}catch(t){return this.trigger("error",t.code),!1}}function c(t){var n=e.typeOf(t);try{if(t instanceof h){if(!t.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);p.apply(this,arguments)}else if(t instanceof l){if(!~e.inArray(t.type,["image/jpeg","image/png"]))throw new i.ImageError(i.ImageError.WRONG_FORMAT);g.apply(this,arguments)}else if(-1!==e.inArray(n,["blob","file"]))c.call(this,new d(null,t),arguments[1]);else if("string"===n)"data:"===t.substr(0,5)?c.call(this,new l(null,{data:t}),arguments[1]):x.apply(this,arguments);else{if("node"!==n||"img"!==t.nodeName.toLowerCase())throw new i.DOMException(i.DOMException.TYPE_MISMATCH_ERR);c.call(this,t.src,arguments[1])}}catch(r){this.trigger("error",r.code)}}function p(t,i){var n=this.connectRuntime(t.ruid);this.ruid=n.uid,n.exec.call(this,"Image","loadFromImage",t,"undefined"===e.typeOf(i)?!0:i)}function g(t,i){function n(e){r.ruid=e.uid,e.exec.call(r,"Image","loadFromBlob",t)}var r=this;r.name=t.name||"",t.isDetached()?(this.bind("RuntimeInit",function(e,t){n(t)}),i&&"string"==typeof i.required_caps&&(i.required_caps=o.parseCaps(i.required_caps)),this.connectRuntime(e.extend({required_caps:{access_image_binary:!0,resize_image:!0}},i))):n(this.connectRuntime(t.ruid))}function x(e,t){var i,n=this;i=new r,i.open("get",e),i.responseType="blob",i.onprogress=function(e){n.trigger(e)},i.onload=function(){g.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind("RuntimeError",function(e,t){n.trigger("RuntimeError",t)}),i.send(null,t)}a.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){c.apply(this,arguments)},resize:function(t){var n,r,o=this,a={x:0,y:0,width:o.width,height:o.height},s=e.extendIf({width:o.width,height:o.height,type:o.type||"image/jpeg",quality:90,crop:!1,fit:!0,preserveHeaders:!0,resample:"default",multipass:!0},t);try{if(!o.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);if(o.width>h.MAX_RESIZE_WIDTH||o.height>h.MAX_RESIZE_HEIGHT)throw new i.ImageError(i.ImageError.MAX_RESOLUTION_ERR);if(n=o.meta&&o.meta.tiff&&o.meta.tiff.Orientation||1,-1!==e.inArray(n,[5,6,7,8])){var u=s.width;s.width=s.height,s.height=u}if(s.crop){switch(r=Math.max(s.width/o.width,s.height/o.height),t.fit?(a.width=Math.min(Math.ceil(s.width/r),o.width),a.height=Math.min(Math.ceil(s.height/r),o.height),r=s.width/a.width):(a.width=Math.min(s.width,o.width),a.height=Math.min(s.height,o.height),r=1),"boolean"==typeof s.crop&&(s.crop="cc"),s.crop.toLowerCase().replace(/_/,"-")){case"rb":case"right-bottom":a.x=o.width-a.width,a.y=o.height-a.height;break;case"cb":case"center-bottom":a.x=Math.floor((o.width-a.width)/2),a.y=o.height-a.height;break;case"lb":case"left-bottom":a.x=0,a.y=o.height-a.height;break;case"lt":case"left-top":a.x=0,a.y=0;break;case"ct":case"center-top":a.x=Math.floor((o.width-a.width)/2),a.y=0;break;case"rt":case"right-top":a.x=o.width-a.width,a.y=0;break;case"rc":case"right-center":case"right-middle":a.x=o.width-a.width,a.y=Math.floor((o.height-a.height)/2);break;case"lc":case"left-center":case"left-middle":a.x=0,a.y=Math.floor((o.height-a.height)/2);break;case"cc":case"center-center":case"center-middle":default:a.x=Math.floor((o.width-a.width)/2),a.y=Math.floor((o.height-a.height)/2)}a.x=Math.max(a.x,0),a.y=Math.max(a.y,0)}else r=Math.min(s.width/o.width,s.height/o.height);this.exec("Image","resize",a,r,s)}catch(c){o.trigger("error",c.code)}},downsize:function(t){var i,n={width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,crop:!1,preserveHeaders:!0,resample:"default"};i="object"==typeof t?e.extend(n,t):e.extend(n,{width:arguments[0],height:arguments[1],crop:arguments[2],preserveHeaders:arguments[3]}),this.resize(i)},crop:function(e,t,i){this.downsize(e,t,!0,i)},getAsCanvas:function(){if(!u.can("create_canvas"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);var e=this.connectRuntime(this.ruid);return e.exec.call(this,"Image","getAsCanvas")},getAsBlob:function(e,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsBlob",e||"image/jpeg",t||90)},getAsDataURL:function(e,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsDataURL",e||"image/jpeg",t||90)},getAsBinaryString:function(e,t){var i=this.getAsDataURL(e,t);return m.atob(i.substring(i.indexOf("base64,")+7))},embed:function(n,r){function o(t,r){var o=this;if(u.can("create_canvas")){var l=o.getAsCanvas();if(l)return n.appendChild(l),l=null,o.destroy(),c.trigger("embedded"),void 0}var d=o.getAsDataURL(t,r);if(!d)throw new i.ImageError(i.ImageError.WRONG_FORMAT);if(u.can("use_data_uri_of",d.length))n.innerHTML='<img src="'+d+'" width="'+o.width+'" height="'+o.height+'" />',o.destroy(),c.trigger("embedded");else{var h=new s;h.bind("TransportingComplete",function(){a=c.connectRuntime(this.result.ruid),c.bind("Embedded",function(){e.extend(a.getShimContainer().style,{top:"0px",left:"0px",width:o.width+"px",height:o.height+"px"}),a=null},999),a.exec.call(c,"ImageView","display",this.result.uid,width,height),o.destroy()}),h.transport(m.atob(d.substring(d.indexOf("base64,")+7)),t,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:n})}}var a,c=this,l=e.extend({width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90},r);try{if(!(n=t.get(n)))throw new i.DOMException(i.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);this.width>h.MAX_RESIZE_WIDTH||this.height>h.MAX_RESIZE_HEIGHT;var d=new h;return d.bind("Resize",function(){o.call(this,l.type,l.quality)}),d.bind("Load",function(){d.downsize(l)}),this.meta.thumb&&this.meta.thumb.width>=l.width&&this.meta.thumb.height>=l.height?d.load(this.meta.thumb.data):d.clone(this,!1),d}catch(f){this.trigger("error",f.code)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.unbindAll()}}),this.handleEventProps(f),this.bind("Load Resize",function(){return n.call(this)},999)}var f=["progress","load","error","resize","embedded"];return h.MAX_RESIZE_WIDTH=8192,h.MAX_RESIZE_HEIGHT=8192,h.prototype=c.instance,h}),n("moxie/runtime/html5/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(e,t,i,n){function o(t){var o=this,u=i.capTest,c=i.capTrue,l=e.extend({access_binary:u(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return o.can("access_binary")&&!!s.Image},display_media:u((n.can("create_canvas")||n.can("use_data_uri_over32kb"))&&r("moxie/image/Image")),do_cors:u(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:u(function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&("IE"!==n.browser||n.verComp(n.version,9,">"))}()),filter_by_extension:u(function(){return!("Chrome"===n.browser&&n.verComp(n.version,28,"<")||"IE"===n.browser&&n.verComp(n.version,10,"<")||"Safari"===n.browser&&n.verComp(n.version,7,"<")||"Firefox"===n.browser&&n.verComp(n.version,37,"<"))}()),return_response_headers:c,return_response_type:function(e){return"json"===e&&window.JSON?!0:n.can("return_response_type",e)},return_status_code:c,report_upload_progress:u(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return o.can("access_binary")&&n.can("create_canvas")},select_file:function(){return n.can("use_fileinput")&&window.File},select_folder:function(){return o.can("select_file")&&("Chrome"===n.browser&&n.verComp(n.version,21,">=")||"Firefox"===n.browser&&n.verComp(n.version,42,">="))},select_multiple:function(){return!(!o.can("select_file")||"Safari"===n.browser&&"Windows"===n.os||"iOS"===n.os&&n.verComp(n.osVersion,"7.0.0",">")&&n.verComp(n.osVersion,"8.0.0","<"))},send_binary_string:u(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:u(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||o.can("send_binary_string")},slice_blob:u(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return o.can("slice_blob")&&o.can("send_multipart")},summon_file_dialog:function(){return o.can("select_file")&&("Firefox"===n.browser&&n.verComp(n.version,4,">=")||"Opera"===n.browser&&n.verComp(n.version,12,">=")||"IE"===n.browser&&n.verComp(n.version,10,">=")||!!~e.inArray(n.browser,["Chrome","Safari","Edge"]))},upload_filesize:c,use_http_method:c},arguments[2]);i.call(this,t,arguments[1]||a,l),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),s)}var a="html5",s={};return i.addConstructor(a,o),s}),n("moxie/runtime/html5/file/Blob",["moxie/runtime/html5/Runtime","moxie/file/Blob"],function(e,t){function i(){function e(e,t,i){var n;if(!window.File.prototype.slice)return(n=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?n.call(e,t,i):null;try{return e.slice(),e.slice(t,i)}catch(r){return e.slice(t,i-t)}}this.slice=function(){return new t(this.getRuntime().uid,e.apply(this,arguments))}}return e.Blob=i}),n("moxie/core/utils/Events",["moxie/core/utils/Basic"],function(e){function t(){this.returnValue=!1}function i(){this.cancelBubble=!0}var n={},r="moxie_"+e.guid(),o=function(o,a,s,u){var c,l;a=a.toLowerCase(),o.addEventListener?(c=s,o.addEventListener(a,c,!1)):o.attachEvent&&(c=function(){var e=window.event;e.target||(e.target=e.srcElement),e.preventDefault=t,e.stopPropagation=i,s(e)},o.attachEvent("on"+a,c)),o[r]||(o[r]=e.guid()),n.hasOwnProperty(o[r])||(n[o[r]]={}),l=n[o[r]],l.hasOwnProperty(a)||(l[a]=[]),l[a].push({func:c,orig:s,key:u})},a=function(t,i,o){var a,s;if(i=i.toLowerCase(),t[r]&&n[t[r]]&&n[t[r]][i]){a=n[t[r]][i];for(var u=a.length-1;u>=0&&(a[u].orig!==o&&a[u].key!==o||(t.removeEventListener?t.removeEventListener(i,a[u].func,!1):t.detachEvent&&t.detachEvent("on"+i,a[u].func),a[u].orig=null,a[u].func=null,a.splice(u,1),o===s));u--);if(a.length||delete n[t[r]][i],e.isEmptyObj(n[t[r]])){delete n[t[r]];try{delete t[r]}catch(c){t[r]=s}}}},s=function(t,i){t&&t[r]&&e.each(n[t[r]],function(e,n){a(t,n,i)})};return{addEvent:o,removeEvent:a,removeAllEvents:s}}),n("moxie/runtime/html5/file/FileInput",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,a){function s(){var e,s;i.extend(this,{init:function(u){var c,l,d,m,h,f,p=this,g=p.getRuntime();e=u,d=e.accept.mimes||o.extList2mimes(e.accept,g.can("filter_by_extension")),l=g.getShimContainer(),l.innerHTML='<input id="'+g.uid+'" type="file" style="font-size:999px;opacity:0;"'+(e.multiple&&g.can("select_multiple")?"multiple":"")+(e.directory&&g.can("select_folder")?"webkitdirectory directory":"")+(d?' accept="'+d.join(",")+'"':"")+" />",c=n.get(g.uid),i.extend(c.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),m=n.get(e.browse_button),s=n.getStyle(m,"z-index")||"auto",g.can("summon_file_dialog")&&("static"===n.getStyle(m,"position")&&(m.style.position="relative"),r.addEvent(m,"click",function(e){var t=n.get(g.uid);t&&!t.disabled&&t.click(),e.preventDefault()},p.uid),p.bind("Refresh",function(){h=parseInt(s,10)||1,n.get(e.browse_button).style.zIndex=h,this.getRuntime().getShimContainer().style.zIndex=h-1})),f=g.can("summon_file_dialog")?m:l,r.addEvent(f,"mouseover",function(){p.trigger("mouseenter")},p.uid),r.addEvent(f,"mouseout",function(){p.trigger("mouseleave")},p.uid),r.addEvent(f,"mousedown",function(){p.trigger("mousedown")},p.uid),r.addEvent(n.get(e.container),"mouseup",function(){p.trigger("mouseup")},p.uid),c.onchange=function x(){if(p.files=[],i.each(this.files,function(i){var n="";return e.directory&&"."==i.name?!0:(i.webkitRelativePath&&(n="/"+i.webkitRelativePath.replace(/^\//,"")),i=new t(g.uid,i),i.relativePath=n,p.files.push(i),void 0)}),"IE"!==a.browser&&"IEMobile"!==a.browser)this.value="";else{var n=this.cloneNode(!0);this.parentNode.replaceChild(n,this),n.onchange=x}p.files.length&&p.trigger("change")},p.trigger({type:"ready",async:!0}),l=null},setOption:function(e,t){var i=this.getRuntime(),r=n.get(i.uid);switch(e){case"accept":if(t){var a=t.mimes||o.extList2mimes(t,i.can("filter_by_extension"));r.setAttribute("accept",a.join(","))}else r.removeAttribute("accept");break;case"directory":t&&i.can("select_folder")?(r.setAttribute("directory",""),r.setAttribute("webkitdirectory","")):(r.removeAttribute("directory"),r.removeAttribute("webkitdirectory"));break;case"multiple":t&&i.can("select_multiple")?r.setAttribute("multiple",""):r.removeAttribute("multiple")}},disable:function(e){var t,i=this.getRuntime();(t=n.get(i.uid))&&(t.disabled=!!e)},destroy:function(){var t=this.getRuntime(),i=t.getShim(),o=t.getShimContainer(),a=e&&n.get(e.container),u=e&&n.get(e.browse_button);a&&r.removeAllEvents(a,this.uid),u&&(r.removeAllEvents(u,this.uid),u.style.zIndex=s),o&&(r.removeAllEvents(o,this.uid),o.innerHTML=""),i.removeInstance(this.uid),e=o=a=u=i=null}})}return e.FileInput=s}),n("moxie/runtime/html5/file/FileDrop",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime"],function(e,t,i,n,r,o){function a(){function e(e){if(!e.dataTransfer||!e.dataTransfer.types)return!1;var t=i.toArray(e.dataTransfer.types||[]);return-1!==i.inArray("Files",t)||-1!==i.inArray("public.file-url",t)||-1!==i.inArray("application/x-moz-file",t)}function a(e,i){if(u(e)){var n=new t(f,e);n.relativePath=i||"",p.push(n)}}function s(e){for(var t=[],n=0;n<e.length;n++)[].push.apply(t,e[n].extensions.split(/\s*,\s*/));return-1===i.inArray("*",t)?t:[]}function u(e){if(!g.length)return!0;var t=o.getFileExtension(e.name);return!t||-1!==i.inArray(t,g)}function c(e,t){var n=[];i.each(e,function(e){var t=e.webkitGetAsEntry();t&&(t.isFile?a(e.getAsFile(),t.fullPath):n.push(t))}),n.length?l(n,t):t()}function l(e,t){var n=[];i.each(e,function(e){n.push(function(t){d(e,t)})}),i.inSeries(n,function(){t()})}function d(e,t){e.isFile?e.file(function(i){a(i,e.fullPath),t()},function(){t()}):e.isDirectory?m(e,t):t()}function m(e,t){function i(e){r.readEntries(function(t){t.length?([].push.apply(n,t),i(e)):e()},e)}var n=[],r=e.createReader();i(function(){l(n,t)})}var h,f,p=[],g=[];i.extend(this,{init:function(t){var n,o=this;h=t,f=o.ruid,g=s(h.accept),n=h.container,r.addEvent(n,"dragover",function(t){e(t)&&(t.preventDefault(),t.dataTransfer.dropEffect="copy")},o.uid),r.addEvent(n,"drop",function(t){e(t)&&(t.preventDefault(),p=[],t.dataTransfer.items&&t.dataTransfer.items[0].webkitGetAsEntry?c(t.dataTransfer.items,function(){o.files=p,o.trigger("drop")}):(i.each(t.dataTransfer.files,function(e){a(e)}),o.files=p,o.trigger("drop")))},o.uid),r.addEvent(n,"dragenter",function(){o.trigger("dragenter")},o.uid),r.addEvent(n,"dragleave",function(){o.trigger("dragleave")},o.uid)},destroy:function(){r.removeAllEvents(h&&n.get(h.container),this.uid),f=p=g=h=null}})}return e.FileDrop=a}),n("moxie/runtime/html5/file/FileReader",["moxie/runtime/html5/Runtime","moxie/core/utils/Encode","moxie/core/utils/Basic"],function(e,t,i){function n(){function e(e){return t.atob(e.substring(e.indexOf("base64,")+7))}var n,r=!1;i.extend(this,{read:function(t,o){var a=this;a.result="",n=new window.FileReader,n.addEventListener("progress",function(e){a.trigger(e)}),n.addEventListener("load",function(t){a.result=r?e(n.result):n.result,a.trigger(t)}),n.addEventListener("error",function(e){a.trigger(e,n.error)}),n.addEventListener("loadend",function(e){n=null,a.trigger(e)}),"function"===i.typeOf(n[t])?(r=!1,n[t](o.getSource())):"readAsBinaryString"===t&&(r=!0,n.readAsDataURL(o.getSource()))},abort:function(){n&&n.abort()},destroy:function(){n=null}})}return e.FileReader=n}),n("moxie/runtime/html5/xhr/XMLHttpRequest",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/core/utils/Url","moxie/file/File","moxie/file/Blob","moxie/xhr/FormData","moxie/core/Exceptions","moxie/core/utils/Env"],function(e,t,i,n,r,o,a,s,u){function c(){function e(e,t){var i,n,r=this;i=t.getBlob().getSource(),n=new window.FileReader,n.onload=function(){t.append(t.getBlobName(),new o(null,{type:i.type,data:n.result})),f.send.call(r,e,t)},n.readAsBinaryString(i)}function c(){return!window.XMLHttpRequest||"IE"===u.browser&&u.verComp(u.version,8,"<")?function(){for(var e=["Msxml2.XMLHTTP.6.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{return new ActiveXObject(e[t])}catch(i){}}():new window.XMLHttpRequest}function l(e){var t=e.responseXML,i=e.responseText;return"IE"===u.browser&&i&&t&&!t.documentElement&&/[^\/]+\/[^\+]+\+xml/.test(e.getResponseHeader("Content-Type"))&&(t=new window.ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.validateOnParse=!1,t.loadXML(i)),t&&("IE"===u.browser&&0!==t.parseError||!t.documentElement||"parsererror"===t.documentElement.tagName)?null:t}function d(e){var t="----moxieboundary"+(new Date).getTime(),i="--",n="\r\n",r="",a=this.getRuntime();if(!a.can("send_binary_string"))throw new s.RuntimeError(s.RuntimeError.NOT_SUPPORTED_ERR);return m.setRequestHeader("Content-Type","multipart/form-data; boundary="+t),e.each(function(e,a){r+=e instanceof o?i+t+n+'Content-Disposition: form-data; name="'+a+'"; filename="'+unescape(encodeURIComponent(e.name||"blob"))+'"'+n+"Content-Type: "+(e.type||"application/octet-stream")+n+n+e.getSource()+n:i+t+n+'Content-Disposition: form-data; name="'+a+'"'+n+n+unescape(encodeURIComponent(e))+n}),r+=i+t+i+n}var m,h,f=this;t.extend(this,{send:function(i,r){var s=this,l="Mozilla"===u.browser&&u.verComp(u.version,4,">=")&&u.verComp(u.version,7,"<"),f="Android Browser"===u.browser,p=!1;if(h=i.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),m=c(),m.open(i.method,i.url,i.async,i.user,i.password),r instanceof o)r.isDetached()&&(p=!0),r=r.getSource();
- else if(r instanceof a){if(r.hasBlob())if(r.getBlob().isDetached())r=d.call(s,r),p=!0;else if((l||f)&&"blob"===t.typeOf(r.getBlob().getSource())&&window.FileReader)return e.call(s,i,r),void 0;if(r instanceof a){var g=new window.FormData;r.each(function(e,t){e instanceof o?g.append(t,e.getSource()):g.append(t,e)}),r=g}}m.upload?(i.withCredentials&&(m.withCredentials=!0),m.addEventListener("load",function(e){s.trigger(e)}),m.addEventListener("error",function(e){s.trigger(e)}),m.addEventListener("progress",function(e){s.trigger(e)}),m.upload.addEventListener("progress",function(e){s.trigger({type:"UploadProgress",loaded:e.loaded,total:e.total})})):m.onreadystatechange=function(){switch(m.readyState){case 1:break;case 2:break;case 3:var e,t;try{n.hasSameOrigin(i.url)&&(e=m.getResponseHeader("Content-Length")||0),m.responseText&&(t=m.responseText.length)}catch(r){e=t=0}s.trigger({type:"progress",lengthComputable:!!e,total:parseInt(e,10),loaded:t});break;case 4:m.onreadystatechange=function(){},0===m.status?s.trigger("error"):s.trigger("load")}},t.isEmptyObj(i.headers)||t.each(i.headers,function(e,t){m.setRequestHeader(t,e)}),""!==i.responseType&&"responseType"in m&&(m.responseType="json"!==i.responseType||u.can("return_response_type","json")?i.responseType:"text"),p?m.sendAsBinary?m.sendAsBinary(r):function(){for(var e=new Uint8Array(r.length),t=0;t<r.length;t++)e[t]=255&r.charCodeAt(t);m.send(e.buffer)}():m.send(r),s.trigger("loadstart")},getStatus:function(){try{if(m)return m.status}catch(e){}return 0},getResponse:function(e){var t=this.getRuntime();try{switch(e){case"blob":var n=new r(t.uid,m.response),o=m.getResponseHeader("Content-Disposition");if(o){var a=o.match(/filename=([\'\"'])([^\1]+)\1/);a&&(h=a[2])}return n.name=h,n.type||(n.type=i.getFileMime(h)),n;case"json":return u.can("return_response_type","json")?m.response:200===m.status&&window.JSON?JSON.parse(m.responseText):null;case"document":return l(m);default:return""!==m.responseText?m.responseText:null}}catch(s){return null}},getAllResponseHeaders:function(){try{return m.getAllResponseHeaders()}catch(e){}return""},abort:function(){m&&m.abort()},destroy:function(){f=h=null}})}return e.XMLHttpRequest=c}),n("moxie/runtime/html5/utils/BinaryReader",["moxie/core/utils/Basic"],function(e){function t(e){e instanceof ArrayBuffer?i.apply(this,arguments):n.apply(this,arguments)}function i(t){var i=new DataView(t);e.extend(this,{readByteAt:function(e){return i.getUint8(e)},writeByteAt:function(e,t){i.setUint8(e,t)},SEGMENT:function(e,n,r){switch(arguments.length){case 2:return t.slice(e,e+n);case 1:return t.slice(e);case 3:if(null===r&&(r=new ArrayBuffer),r instanceof ArrayBuffer){var o=new Uint8Array(this.length()-n+r.byteLength);e>0&&o.set(new Uint8Array(t.slice(0,e)),0),o.set(new Uint8Array(r),e),o.set(new Uint8Array(t.slice(e+n)),e+r.byteLength),this.clear(),t=o.buffer,i=new DataView(t);break}default:return t}},length:function(){return t?t.byteLength:0},clear:function(){i=t=null}})}function n(t){function i(e,i,n){n=3===arguments.length?n:t.length-i-1,t=t.substr(0,i)+e+t.substr(n+i)}e.extend(this,{readByteAt:function(e){return t.charCodeAt(e)},writeByteAt:function(e,t){i(String.fromCharCode(t),e,1)},SEGMENT:function(e,n,r){switch(arguments.length){case 1:return t.substr(e);case 2:return t.substr(e,n);case 3:i(null!==r?r:"",e,n);break;default:return t}},length:function(){return t?t.length:0},clear:function(){t=null}})}return e.extend(t.prototype,{littleEndian:!1,read:function(e,t){var i,n,r;if(e+t>this.length())throw new Error("You are trying to read outside the source boundaries.");for(n=this.littleEndian?0:-8*(t-1),r=0,i=0;t>r;r++)i|=this.readByteAt(e+r)<<Math.abs(n+8*r);return i},write:function(e,t,i){var n,r;if(e>this.length())throw new Error("You are trying to write outside the source boundaries.");for(n=this.littleEndian?0:-8*(i-1),r=0;i>r;r++)this.writeByteAt(e+r,255&t>>Math.abs(n+8*r))},BYTE:function(e){return this.read(e,1)},SHORT:function(e){return this.read(e,2)},LONG:function(e){return this.read(e,4)},SLONG:function(e){var t=this.read(e,4);return t>2147483647?t-4294967296:t},CHAR:function(e){return String.fromCharCode(this.read(e,1))},STRING:function(e,t){return this.asArray("CHAR",e,t).join("")},asArray:function(e,t,i){for(var n=[],r=0;i>r;r++)n[r]=this[e](t+r);return n}}),t}),n("moxie/runtime/html5/image/JPEGHeaders",["moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(e,t){return function i(n){var r,o,a,s=[],u=0;if(r=new e(n),65496!==r.SHORT(0))throw r.clear(),new t.ImageError(t.ImageError.WRONG_FORMAT);for(o=2;o<=r.length();)if(a=r.SHORT(o),a>=65488&&65495>=a)o+=2;else{if(65498===a||65497===a)break;u=r.SHORT(o+2)+2,a>=65505&&65519>=a&&s.push({hex:a,name:"APP"+(15&a),start:o,length:u,segment:r.SEGMENT(o,u)}),o+=u}return r.clear(),{headers:s,restore:function(t){var i,n,r;for(r=new e(t),o=65504==r.SHORT(2)?4+r.SHORT(4):2,n=0,i=s.length;i>n;n++)r.SEGMENT(o,0,s[n].segment),o+=s[n].length;return t=r.SEGMENT(),r.clear(),t},strip:function(t){var n,r,o,a;for(o=new i(t),r=o.headers,o.purge(),n=new e(t),a=r.length;a--;)n.SEGMENT(r[a].start,r[a].length,"");return t=n.SEGMENT(),n.clear(),t},get:function(e){for(var t=[],i=0,n=s.length;n>i;i++)s[i].name===e.toUpperCase()&&t.push(s[i].segment);return t},set:function(e,t){var i,n,r,o=[];for("string"==typeof t?o.push(t):o=t,i=n=0,r=s.length;r>i&&(s[i].name===e.toUpperCase()&&(s[i].segment=o[n],s[i].length=o[n].length,n++),!(n>=o.length));i++);},purge:function(){this.headers=s=[]}}}}),n("moxie/runtime/html5/image/ExifParser",["moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(e,i,n){function r(o){function a(i,r){var o,a,s,u,c,m,h,f,p=this,g=[],x={},v={1:"BYTE",7:"UNDEFINED",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",9:"SLONG",10:"SRATIONAL"},y={BYTE:1,UNDEFINED:1,ASCII:1,SHORT:2,LONG:4,RATIONAL:8,SLONG:4,SRATIONAL:8};for(o=p.SHORT(i),a=0;o>a;a++)if(g=[],h=i+2+12*a,s=r[p.SHORT(h)],s!==t){if(u=v[p.SHORT(h+=2)],c=p.LONG(h+=2),m=y[u],!m)throw new n.ImageError(n.ImageError.INVALID_META_ERR);if(h+=4,m*c>4&&(h=p.LONG(h)+d.tiffHeader),h+m*c>=this.length())throw new n.ImageError(n.ImageError.INVALID_META_ERR);"ASCII"!==u?(g=p.asArray(u,h,c),f=1==c?g[0]:g,x[s]=l.hasOwnProperty(s)&&"object"!=typeof f?l[s][f]:f):x[s]=e.trim(p.STRING(h,c).replace(/\0$/,""))}return x}function s(e,t,i){var n,r,o,a=0;if("string"==typeof t){var s=c[e.toLowerCase()];for(var u in s)if(s[u]===t){t=u;break}}n=d[e.toLowerCase()+"IFD"],r=this.SHORT(n);for(var l=0;r>l;l++)if(o=n+12*l+2,this.SHORT(o)==t){a=o+8;break}if(!a)return!1;try{this.write(a,i,4)}catch(m){return!1}return!0}var u,c,l,d,m,h;if(i.call(this,o),c={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"},thumb:{513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength"}},l={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}},d={tiffHeader:10},m=d.tiffHeader,u={clear:this.clear},e.extend(this,{read:function(){try{return r.prototype.read.apply(this,arguments)}catch(e){throw new n.ImageError(n.ImageError.INVALID_META_ERR)}},write:function(){try{return r.prototype.write.apply(this,arguments)}catch(e){throw new n.ImageError(n.ImageError.INVALID_META_ERR)}},UNDEFINED:function(){return this.BYTE.apply(this,arguments)},RATIONAL:function(e){return this.LONG(e)/this.LONG(e+4)},SRATIONAL:function(e){return this.SLONG(e)/this.SLONG(e+4)},ASCII:function(e){return this.CHAR(e)},TIFF:function(){return h||null},EXIF:function(){var t=null;if(d.exifIFD){try{t=a.call(this,d.exifIFD,c.exif)}catch(i){return null}if(t.ExifVersion&&"array"===e.typeOf(t.ExifVersion)){for(var n=0,r="";n<t.ExifVersion.length;n++)r+=String.fromCharCode(t.ExifVersion[n]);t.ExifVersion=r}}return t},GPS:function(){var t=null;if(d.gpsIFD){try{t=a.call(this,d.gpsIFD,c.gps)}catch(i){return null}t.GPSVersionID&&"array"===e.typeOf(t.GPSVersionID)&&(t.GPSVersionID=t.GPSVersionID.join("."))}return t},thumb:function(){if(d.IFD1)try{var e=a.call(this,d.IFD1,c.thumb);if("JPEGInterchangeFormat"in e)return this.SEGMENT(d.tiffHeader+e.JPEGInterchangeFormat,e.JPEGInterchangeFormatLength)}catch(t){}return null},setExif:function(e,t){return"PixelXDimension"!==e&&"PixelYDimension"!==e?!1:s.call(this,"exif",e,t)},clear:function(){u.clear(),o=c=l=h=d=u=null}}),65505!==this.SHORT(0)||"EXIF\0"!==this.STRING(4,5).toUpperCase())throw new n.ImageError(n.ImageError.INVALID_META_ERR);if(this.littleEndian=18761==this.SHORT(m),42!==this.SHORT(m+=2))throw new n.ImageError(n.ImageError.INVALID_META_ERR);d.IFD0=d.tiffHeader+this.LONG(m+=2),h=a.call(this,d.IFD0,c.tiff),"ExifIFDPointer"in h&&(d.exifIFD=d.tiffHeader+h.ExifIFDPointer,delete h.ExifIFDPointer),"GPSInfoIFDPointer"in h&&(d.gpsIFD=d.tiffHeader+h.GPSInfoIFDPointer,delete h.GPSInfoIFDPointer),e.isEmptyObj(h)&&(h=null);var f=this.LONG(d.IFD0+12*this.SHORT(d.IFD0)+2);f&&(d.IFD1=d.tiffHeader+f)}return r.prototype=i.prototype,r}),n("moxie/runtime/html5/image/JPEG",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEGHeaders","moxie/runtime/html5/utils/BinaryReader","moxie/runtime/html5/image/ExifParser"],function(e,t,i,n,r){function o(o){function a(e){var t,i,n=0;for(e||(e=c);n<=e.length();){if(t=e.SHORT(n+=2),t>=65472&&65475>=t)return n+=5,{height:e.SHORT(n),width:e.SHORT(n+=2)};i=e.SHORT(n+=2),n+=i-2}return null}function s(){var e,t,i=d.thumb();return i&&(e=new n(i),t=a(e),e.clear(),t)?(t.data=i,t):null}function u(){d&&l&&c&&(d.clear(),l.purge(),c.clear(),m=l=d=c=null)}var c,l,d,m;if(c=new n(o),65496!==c.SHORT(0))throw new t.ImageError(t.ImageError.WRONG_FORMAT);l=new i(o);try{d=new r(l.get("app1")[0])}catch(h){}m=a.call(this),e.extend(this,{type:"image/jpeg",size:c.length(),width:m&&m.width||0,height:m&&m.height||0,setExif:function(t,i){return d?("object"===e.typeOf(t)?e.each(t,function(e,t){d.setExif(t,e)}):d.setExif(t,i),l.set("app1",d.SEGMENT()),void 0):!1},writeHeaders:function(){return arguments.length?l.restore(arguments[0]):l.restore(o)},stripHeaders:function(e){return l.strip(e)},purge:function(){u.call(this)}}),d&&(this.meta={tiff:d.TIFF(),exif:d.EXIF(),gps:d.GPS(),thumb:s()})}return o}),n("moxie/runtime/html5/image/PNG",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader"],function(e,t,i){function n(n){function r(){var e,t;return e=a.call(this,8),"IHDR"==e.type?(t=e.start,{width:s.LONG(t),height:s.LONG(t+=4)}):null}function o(){s&&(s.clear(),n=l=u=c=s=null)}function a(e){var t,i,n,r;return t=s.LONG(e),i=s.STRING(e+=4,4),n=e+=4,r=s.LONG(e+t),{length:t,type:i,start:n,CRC:r}}var s,u,c,l;s=new i(n),function(){var t=0,i=0,n=[35152,20039,3338,6666];for(i=0;i<n.length;i++,t+=2)if(n[i]!=s.SHORT(t))throw new e.ImageError(e.ImageError.WRONG_FORMAT)}(),l=r.call(this),t.extend(this,{type:"image/png",size:s.length(),width:l.width,height:l.height,purge:function(){o.call(this)}}),o.call(this)}return n}),n("moxie/runtime/html5/image/ImageInfo",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEG","moxie/runtime/html5/image/PNG"],function(e,t,i,n){return function(r){var o,a=[i,n];o=function(){for(var e=0;e<a.length;e++)try{return new a[e](r)}catch(i){}throw new t.ImageError(t.ImageError.WRONG_FORMAT)}(),e.extend(this,{type:"",size:0,width:0,height:0,setExif:function(){},writeHeaders:function(e){return e},stripHeaders:function(e){return e},purge:function(){r=null}}),e.extend(this,o),this.purge=function(){o.purge(),o=null}}}),n("moxie/runtime/html5/image/ResizerCanvas",[],function(){function e(i,n){var r=i.width,o=Math.floor(r*n),a=!1;(.5>n||n>2)&&(n=.5>n?.5:2,a=!0);var s=t(i,n);return a?e(s,o/s.width):s}function t(e,t){var i=e.width,n=e.height,r=Math.floor(i*t),o=Math.floor(n*t),a=document.createElement("canvas");return a.width=r,a.height=o,a.getContext("2d").drawImage(e,0,0,i,n,0,0,r,o),e=null,a}return{scale:e}}),n("moxie/runtime/html5/image/Image",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/File","moxie/runtime/html5/image/ImageInfo","moxie/runtime/html5/image/ResizerCanvas","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,a,s,u){function c(){function e(){if(!v&&!g)throw new i.ImageError(i.DOMException.INVALID_STATE_ERR);return v||g}function c(){var t=e();return"canvas"==t.nodeName.toLowerCase()?t:(v=document.createElement("canvas"),v.width=t.width,v.height=t.height,v.getContext("2d").drawImage(t,0,0),v)}function l(e){return n.atob(e.substring(e.indexOf("base64,")+7))}function d(e,t){return"data:"+(t||"")+";base64,"+n.btoa(e)}function m(e){var t=this;g=new Image,g.onerror=function(){p.call(this),t.trigger("error",i.ImageError.WRONG_FORMAT)},g.onload=function(){t.trigger("load")},g.src="data:"==e.substr(0,5)?e:d(e,w.type)}function h(e,t){var n,r=this;return window.FileReader?(n=new FileReader,n.onload=function(){t(this.result)},n.onerror=function(){r.trigger("error",i.ImageError.WRONG_FORMAT)},n.readAsDataURL(e),void 0):t(e.getAsDataURL())}function f(e,i){var n=Math.PI/180,r=document.createElement("canvas"),o=r.getContext("2d"),a=e.width,s=e.height;switch(t.inArray(i,[5,6,7,8])>-1?(r.width=s,r.height=a):(r.width=a,r.height=s),i){case 2:o.translate(a,0),o.scale(-1,1);break;case 3:o.translate(a,s),o.rotate(180*n);break;case 4:o.translate(0,s),o.scale(1,-1);break;case 5:o.rotate(90*n),o.scale(1,-1);break;case 6:o.rotate(90*n),o.translate(0,-s);break;case 7:o.rotate(90*n),o.translate(a,-s),o.scale(-1,1);break;case 8:o.rotate(-90*n),o.translate(-a,0)}return o.drawImage(e,0,0,a,s),r}function p(){x&&(x.purge(),x=null),y=g=v=w=null,b=!1}var g,x,v,y,w,E=this,b=!1,R=!0;t.extend(this,{loadFromBlob:function(e){var t=this,n=t.getRuntime(),r=arguments.length>1?arguments[1]:!0;if(!n.can("access_binary"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);return w=e,e.isDetached()?(y=e.getSource(),m.call(this,y),void 0):(h.call(this,e.getSource(),function(e){r&&(y=l(e)),m.call(t,e)}),void 0)},loadFromImage:function(e,t){this.meta=e.meta,w=new o(null,{name:e.name,size:e.size,type:e.type}),m.call(this,t?y=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var t,i=this.getRuntime();return!x&&y&&i.can("access_image_binary")&&(x=new a(y)),t={width:e().width||0,height:e().height||0,type:w.type||u.getFileMime(w.name),size:y&&y.length||w.size||0,name:w.name||"",meta:null},R&&(t.meta=x&&x.meta||this.meta||{},!t.meta||!t.meta.thumb||t.meta.thumb.data instanceof r||(t.meta.thumb.data=new r(null,{type:"image/jpeg",data:t.meta.thumb.data}))),t},resize:function(t,i,n){var r=document.createElement("canvas");if(r.width=t.width,r.height=t.height,r.getContext("2d").drawImage(e(),t.x,t.y,t.width,t.height,0,0,r.width,r.height),v=s.scale(r,i),R=n.preserveHeaders,!R){var o=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1;v=f(v,o)}this.width=v.width,this.height=v.height,b=!0,this.trigger("Resize")},getAsCanvas:function(){return v||(v=c()),v.id=this.uid+"_canvas",v},getAsBlob:function(e,t){return e!==this.type?(b=!0,new o(null,{name:w.name||"",type:e,data:E.getAsDataURL(e,t)})):new o(null,{name:w.name||"",type:e,data:E.getAsBinaryString(e,t)})},getAsDataURL:function(e){var t=arguments[1]||90;if(!b)return g.src;if(c(),"image/jpeg"!==e)return v.toDataURL("image/png");try{return v.toDataURL("image/jpeg",t/100)}catch(i){return v.toDataURL("image/jpeg")}},getAsBinaryString:function(e,t){if(!b)return y||(y=l(E.getAsDataURL(e,t))),y;if("image/jpeg"!==e)y=l(E.getAsDataURL(e,t));else{var i;t||(t=90),c();try{i=v.toDataURL("image/jpeg",t/100)}catch(n){i=v.toDataURL("image/jpeg")}y=l(i),x&&(y=x.stripHeaders(y),R&&(x.meta&&x.meta.exif&&x.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),y=x.writeHeaders(y)),x.purge(),x=null)}return b=!1,y},destroy:function(){E=null,p.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}return e.Image=c}),n("moxie/runtime/flash/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(e,t,i,n,o){function a(){var e;try{e=navigator.plugins["Shockwave Flash"],e=e.description}catch(t){try{e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(i){e="0.0"}}return e=e.match(/\d+/g),parseFloat(e[0]+"."+e[1])}function s(e){var n=i.get(e);n&&"OBJECT"==n.nodeName&&("IE"===t.browser?(n.style.display="none",function r(){4==n.readyState?u(e):setTimeout(r,10)}()):n.parentNode.removeChild(n))}function u(e){var t=i.get(e);if(t){for(var n in t)"function"==typeof t[n]&&(t[n]=null);t.parentNode.removeChild(t)}}function c(u){var c,m=this;u=e.extend({swf_url:t.swf_url},u),o.call(this,u,l,{access_binary:function(e){return e&&"browser"===m.mode},access_image_binary:function(e){return e&&"browser"===m.mode},display_media:o.capTest(r("moxie/image/Image")),do_cors:o.capTrue,drag_and_drop:!1,report_upload_progress:function(){return"client"===m.mode},resize_image:o.capTrue,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!e.arrayDiff(t,["","text","document"])||"browser"===m.mode},return_status_code:function(t){return"browser"===m.mode||!e.arrayDiff(t,[200,404])},select_file:o.capTrue,select_multiple:o.capTrue,send_binary_string:function(e){return e&&"browser"===m.mode},send_browser_cookies:function(e){return e&&"browser"===m.mode},send_custom_headers:function(e){return e&&"browser"===m.mode},send_multipart:o.capTrue,slice_blob:function(e){return e&&"browser"===m.mode},stream_upload:function(e){return e&&"browser"===m.mode},summon_file_dialog:!1,upload_filesize:function(t){return e.parseSizeStr(t)<=2097152||"client"===m.mode},use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}},{access_binary:function(e){return e?"browser":"client"},access_image_binary:function(e){return e?"browser":"client"},report_upload_progress:function(e){return e?"browser":"client"},return_response_type:function(t){return e.arrayDiff(t,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"browser":["client","browser"]},send_binary_string:function(e){return e?"browser":"client"},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"browser":"client"},slice_blob:function(e){return e?"browser":"client"},stream_upload:function(e){return e?"client":"browser"},upload_filesize:function(t){return e.parseSizeStr(t)>=2097152?"client":"browser"}},"client"),a()<11.3&&(this.mode=!1),e.extend(this,{getShim:function(){return i.get(this.uid)},shimExec:function(e,t){var i=[].slice.call(arguments,2);return m.getShim().exec(this.uid,e,t,i)},init:function(){var i,r,o;o=this.getShimContainer(),e.extend(o.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),i='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+u.swf_url+'" ',"IE"===t.browser&&(i+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),i+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+u.swf_url+'" />'+'<param name="flashvars" value="uid='+escape(this.uid)+"&target="+t.global_event_dispatcher+'" />'+'<param name="wmode" value="transparent" />'+'<param name="allowscriptaccess" value="always" />'+"</object>","IE"===t.browser?(r=document.createElement("div"),o.appendChild(r),r.outerHTML=i,r=o=null):o.innerHTML=i,c=setTimeout(function(){m&&!m.initialized&&m.trigger("Error",new n.RuntimeError(n.RuntimeError.NOT_INIT_ERR))},5e3)},destroy:function(e){return function(){s(m.uid),e.call(m),clearTimeout(c),u=c=e=m=null}}(this.destroy)},d)}var l="flash",d={};return o.addConstructor(l,c),d}),n("moxie/runtime/flash/file/Blob",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(e,t){var i={slice:function(e,i,n,r){var o=this.getRuntime();return 0>i?i=Math.max(e.size+i,0):i>0&&(i=Math.min(i,e.size)),0>n?n=Math.max(e.size+n,0):n>0&&(n=Math.min(n,e.size)),e=o.shimExec.call(this,"Blob","slice",i,n,r||""),e&&(e=new t(o.uid,e)),e}};return e.Blob=i}),n("moxie/runtime/flash/file/FileInput",["moxie/runtime/flash/Runtime","moxie/file/File","moxie/core/utils/Basic"],function(e,t,i){var n={init:function(e){var n=this,r=this.getRuntime();this.bind("Change",function(){var e=r.shimExec.call(n,"FileInput","getFiles");n.files=[],i.each(e,function(e){n.files.push(new t(r.uid,e))})},999),this.getRuntime().shimExec.call(this,"FileInput","init",{accept:e.accept,multiple:e.multiple}),this.trigger("ready")}};return e.FileInput=n}),n("moxie/runtime/flash/file/FileReader",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(e,t){function i(e,i){switch(i){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var n={read:function(e,t){var n=this;return n.result="","readAsDataURL"===e&&(n.result="data:"+(t.type||"")+";base64,"),n.bind("Progress",function(t,r){r&&(n.result+=i(r,e))},999),n.getRuntime().shimExec.call(this,"FileReader","readAsBase64",t.uid)}};return e.FileReader=n}),n("moxie/runtime/flash/file/FileReaderSync",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(e,t){function i(e,i){switch(i){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var n={read:function(e,t){var n,r=this.getRuntime();return(n=r.shimExec.call(this,"FileReaderSync","readAsBase64",t.uid))?("readAsDataURL"===e&&(n="data:"+(t.type||"")+";base64,"+n),i(n,e,t.type)):null}};return e.FileReaderSync=n}),n("moxie/runtime/flash/runtime/Transporter",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(e,t){var i={getAsBlob:function(e){var i=this.getRuntime(),n=i.shimExec.call(this,"Transporter","getAsBlob",e);return n?new t(i.uid,n):null}};return e.Transporter=i}),n("moxie/runtime/flash/xhr/XMLHttpRequest",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/file/Blob","moxie/file/File","moxie/file/FileReaderSync","moxie/runtime/flash/file/FileReaderSync","moxie/xhr/FormData","moxie/runtime/Transporter","moxie/runtime/flash/runtime/Transporter"],function(e,t,i,n,r,o,a,s){var u={send:function(e,n){function r(){e.transport=l.mode,l.shimExec.call(c,"XMLHttpRequest","send",e,n)}function o(e,t){l.shimExec.call(c,"XMLHttpRequest","appendBlob",e,t.uid),n=null,r()}function u(e,t){var i=new s;i.bind("TransportingComplete",function(){t(this.result)}),i.transport(e.getSource(),e.type,{ruid:l.uid})}var c=this,l=c.getRuntime();if(t.isEmptyObj(e.headers)||t.each(e.headers,function(e,t){l.shimExec.call(c,"XMLHttpRequest","setRequestHeader",t,e.toString())}),n instanceof a){var d;if(n.each(function(e,t){e instanceof i?d=t:l.shimExec.call(c,"XMLHttpRequest","append",t,e)}),n.hasBlob()){var m=n.getBlob();m.isDetached()?u(m,function(e){m.destroy(),o(d,e)}):o(d,m)}else n=null,r()}else n instanceof i?n.isDetached()?u(n,function(e){n.destroy(),n=e.uid,r()}):(n=n.uid,r()):r()},getResponse:function(e){var i,o,a=this.getRuntime();if(o=a.shimExec.call(this,"XMLHttpRequest","getResponseAsBlob")){if(o=new n(a.uid,o),"blob"===e)return o;try{if(i=new r,~t.inArray(e,["","text"]))return i.readAsText(o);if("json"===e&&window.JSON)return JSON.parse(i.readAsText(o))}finally{o.destroy()}}return null},abort:function(){var e=this.getRuntime();e.shimExec.call(this,"XMLHttpRequest","abort"),this.dispatchEvent("readystatechange"),this.dispatchEvent("abort")}};return e.XMLHttpRequest=u}),n("moxie/runtime/flash/image/Image",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/runtime/Transporter","moxie/file/Blob","moxie/file/FileReaderSync"],function(e,t,i,n,r){var o={loadFromBlob:function(e){function t(e){r.shimExec.call(n,"Image","loadFromBlob",e.uid),n=r=null}var n=this,r=n.getRuntime();if(e.isDetached()){var o=new i;o.bind("TransportingComplete",function(){t(o.result.getSource())}),o.transport(e.getSource(),e.type,{ruid:r.uid})}else t(e.getSource())},loadFromImage:function(e){var t=this.getRuntime();return t.shimExec.call(this,"Image","loadFromImage",e.uid)},getInfo:function(){var e=this.getRuntime(),t=e.shimExec.call(this,"Image","getInfo");return!t.meta||!t.meta.thumb||t.meta.thumb.data instanceof n||(t.meta.thumb.data=new n(e.uid,t.meta.thumb.data)),t},getAsBlob:function(e,t){var i=this.getRuntime(),r=i.shimExec.call(this,"Image","getAsBlob",e,t);return r?new n(i.uid,r):null},getAsDataURL:function(){var e,t=this.getRuntime(),i=t.Image.getAsBlob.apply(this,arguments);return i?(e=new r,e.readAsDataURL(i)):null}};return e.Image=o}),n("moxie/runtime/silverlight/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(e,t,i,n,o){function a(e){var t,i,n,r,o,a=!1,s=null,u=0;try{try{s=new ActiveXObject("AgControl.AgControl"),s.IsVersionSupported(e)&&(a=!0),s=null}catch(c){var l=navigator.plugins["Silverlight Plug-In"];if(l){for(t=l.description,"1.0.30226.2"===t&&(t="2.0.30226.2"),i=t.split(".");i.length>3;)i.pop();for(;i.length<4;)i.push(0);for(n=e.split(".");n.length>4;)n.pop();do r=parseInt(n[u],10),o=parseInt(i[u],10),u++;while(u<n.length&&r===o);o>=r&&!isNaN(r)&&(a=!0)}}}catch(d){a=!1}return a}function s(s){var l,d=this;s=e.extend({xap_url:t.xap_url},s),o.call(this,s,u,{access_binary:o.capTrue,access_image_binary:o.capTrue,display_media:o.capTest(r("moxie/image/Image")),do_cors:o.capTrue,drag_and_drop:!1,report_upload_progress:o.capTrue,resize_image:o.capTrue,return_response_headers:function(e){return e&&"client"===d.mode},return_response_type:function(e){return"json"!==e?!0:!!window.JSON},return_status_code:function(t){return"client"===d.mode||!e.arrayDiff(t,[200,404])},select_file:o.capTrue,select_multiple:o.capTrue,send_binary_string:o.capTrue,send_browser_cookies:function(e){return e&&"browser"===d.mode},send_custom_headers:function(e){return e&&"client"===d.mode},send_multipart:o.capTrue,slice_blob:o.capTrue,stream_upload:!0,summon_file_dialog:!1,upload_filesize:o.capTrue,use_http_method:function(t){return"client"===d.mode||!e.arrayDiff(t,["GET","POST"])}},{return_response_headers:function(e){return e?"client":"browser"},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"client":["client","browser"]},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"client":"browser"},use_http_method:function(t){return e.arrayDiff(t,["GET","POST"])?"client":["client","browser"]}}),a("2.0.31005.0")&&"Opera"!==t.browser||(this.mode=!1),e.extend(this,{getShim:function(){return i.get(this.uid).content.Moxie},shimExec:function(e,t){var i=[].slice.call(arguments,2);return d.getShim().exec(this.uid,e,t,i)},init:function(){var e;e=this.getShimContainer(),e.innerHTML='<object id="'+this.uid+'" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">'+'<param name="source" value="'+s.xap_url+'"/>'+'<param name="background" value="Transparent"/>'+'<param name="windowless" value="true"/>'+'<param name="enablehtmlaccess" value="true"/>'+'<param name="initParams" value="uid='+this.uid+",target="+t.global_event_dispatcher+'"/>'+"</object>",l=setTimeout(function(){d&&!d.initialized&&d.trigger("Error",new n.RuntimeError(n.RuntimeError.NOT_INIT_ERR))},"Windows"!==t.OS?1e4:5e3)},destroy:function(e){return function(){e.call(d),clearTimeout(l),s=l=e=d=null}}(this.destroy)},c)}var u="silverlight",c={};return o.addConstructor(u,s),c}),n("moxie/runtime/silverlight/file/Blob",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/Blob"],function(e,t,i){return e.Blob=t.extend({},i)}),n("moxie/runtime/silverlight/file/FileInput",["moxie/runtime/silverlight/Runtime","moxie/file/File","moxie/core/utils/Basic"],function(e,t,i){function n(e){for(var t="",i=0;i<e.length;i++)t+=(""!==t?"|":"")+e[i].title+" | *."+e[i].extensions.replace(/,/g,";*.");return t}var r={init:function(e){var r=this,o=this.getRuntime();this.bind("Change",function(){var e=o.shimExec.call(r,"FileInput","getFiles");r.files=[],i.each(e,function(e){r.files.push(new t(o.uid,e))})},999),o.shimExec.call(this,"FileInput","init",n(e.accept),e.multiple),this.trigger("ready")},setOption:function(e,t){"accept"==e&&(t=n(t)),this.getRuntime().shimExec.call(this,"FileInput","setOption",e,t)}};return e.FileInput=r}),n("moxie/runtime/silverlight/file/FileDrop",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Dom","moxie/core/utils/Events"],function(e,t,i){var n={init:function(){var e,n=this,r=n.getRuntime();return e=r.getShimContainer(),i.addEvent(e,"dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},n.uid),i.addEvent(e,"dragenter",function(e){e.preventDefault();var i=t.get(r.uid).dragEnter(e);i&&e.stopPropagation()},n.uid),i.addEvent(e,"drop",function(e){e.preventDefault();var i=t.get(r.uid).dragDrop(e);i&&e.stopPropagation()},n.uid),r.shimExec.call(this,"FileDrop","init")}};return e.FileDrop=n}),n("moxie/runtime/silverlight/file/FileReader",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/FileReader"],function(e,t,i){return e.FileReader=t.extend({},i)}),n("moxie/runtime/silverlight/file/FileReaderSync",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/FileReaderSync"],function(e,t,i){return e.FileReaderSync=t.extend({},i)
- }),n("moxie/runtime/silverlight/runtime/Transporter",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/runtime/Transporter"],function(e,t,i){return e.Transporter=t.extend({},i)}),n("moxie/runtime/silverlight/xhr/XMLHttpRequest",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/xhr/XMLHttpRequest","moxie/runtime/silverlight/file/FileReaderSync","moxie/runtime/silverlight/runtime/Transporter"],function(e,t,i){return e.XMLHttpRequest=t.extend({},i)}),n("moxie/runtime/silverlight/image/Image",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/file/Blob","moxie/runtime/flash/image/Image"],function(e,t,i,n){return e.Image=t.extend({},n,{getInfo:function(){var e=this.getRuntime(),n=["tiff","exif","gps","thumb"],r={meta:{}},o=e.shimExec.call(this,"Image","getInfo");return o.meta&&(t.each(n,function(e){var t,i,n,a,s=o.meta[e];if(s&&s.keys)for(r.meta[e]={},i=0,n=s.keys.length;n>i;i++)t=s.keys[i],a=s[t],a&&(/^(\d|[1-9]\d+)$/.test(a)?a=parseInt(a,10):/^\d*\.\d+$/.test(a)&&(a=parseFloat(a)),r.meta[e][t]=a)}),!r.meta||!r.meta.thumb||r.meta.thumb.data instanceof i||(r.meta.thumb.data=new i(e.uid,r.meta.thumb.data))),r.width=parseInt(o.width,10),r.height=parseInt(o.height,10),r.size=parseInt(o.size,10),r.type=o.type,r.name=o.name,r},resize:function(e,t,i){this.getRuntime().shimExec.call(this,"Image","resize",e.x,e.y,e.width,e.height,t,i.preserveHeaders,i.resample)}})}),n("moxie/runtime/html4/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(e,t,i,n){function o(t){var o=this,u=i.capTest,c=i.capTrue;i.call(this,t,a,{access_binary:u(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:u((n.can("create_canvas")||n.can("use_data_uri_over32kb"))&&r("moxie/image/Image")),do_cors:!1,drag_and_drop:!1,filter_by_extension:u(function(){return!("Chrome"===n.browser&&n.verComp(n.version,28,"<")||"IE"===n.browser&&n.verComp(n.version,10,"<")||"Safari"===n.browser&&n.verComp(n.version,7,"<")||"Firefox"===n.browser&&n.verComp(n.version,37,"<"))}()),resize_image:function(){return s.Image&&o.can("access_binary")&&n.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!!~e.inArray(t,["text","document",""])},return_status_code:function(t){return!e.arrayDiff(t,[200,404])},select_file:function(){return n.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return o.can("select_file")},summon_file_dialog:function(){return o.can("select_file")&&("Firefox"===n.browser&&n.verComp(n.version,4,">=")||"Opera"===n.browser&&n.verComp(n.version,12,">=")||"IE"===n.browser&&n.verComp(n.version,10,">=")||!!~e.inArray(n.browser,["Chrome","Safari"]))},upload_filesize:c,use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}}),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),s)}var a="html4",s={};return i.addConstructor(a,o),s}),n("moxie/runtime/html4/file/FileInput",["moxie/runtime/html4/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,a){function s(){function e(){var o,c,d,m,h,f,p=this,g=p.getRuntime();f=i.guid("uid_"),o=g.getShimContainer(),s&&(d=n.get(s+"_form"),d&&i.extend(d.style,{top:"100%"})),m=document.createElement("form"),m.setAttribute("id",f+"_form"),m.setAttribute("method","post"),m.setAttribute("enctype","multipart/form-data"),m.setAttribute("encoding","multipart/form-data"),i.extend(m.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),h=document.createElement("input"),h.setAttribute("id",f),h.setAttribute("type","file"),h.setAttribute("accept",l.join(",")),i.extend(h.style,{fontSize:"999px",opacity:0}),m.appendChild(h),o.appendChild(m),i.extend(h.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"IE"===a.browser&&a.verComp(a.version,10,"<")&&i.extend(h.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}),h.onchange=function(){var i;if(this.value){if(this.files){if(i=this.files[0],0===i.size)return m.parentNode.removeChild(m),void 0}else i={name:this.value};i=new t(g.uid,i),this.onchange=function(){},e.call(p),p.files=[i],h.setAttribute("id",i.uid),m.setAttribute("id",i.uid+"_form"),p.trigger("change"),h=m=null}},g.can("summon_file_dialog")&&(c=n.get(u.browse_button),r.removeEvent(c,"click",p.uid),r.addEvent(c,"click",function(e){h&&!h.disabled&&h.click(),e.preventDefault()},p.uid)),s=f,o=d=c=null}var s,u,c,l=[];i.extend(this,{init:function(t){var i,a=this,s=a.getRuntime();u=t,l=t.accept.mimes||o.extList2mimes(t.accept,s.can("filter_by_extension")),i=s.getShimContainer(),function(){var e,o,l;e=n.get(t.browse_button),c=n.getStyle(e,"z-index")||"auto",s.can("summon_file_dialog")&&("static"===n.getStyle(e,"position")&&(e.style.position="relative"),a.bind("Refresh",function(){o=parseInt(c,10)||1,n.get(u.browse_button).style.zIndex=o,this.getRuntime().getShimContainer().style.zIndex=o-1})),l=s.can("summon_file_dialog")?e:i,r.addEvent(l,"mouseover",function(){a.trigger("mouseenter")},a.uid),r.addEvent(l,"mouseout",function(){a.trigger("mouseleave")},a.uid),r.addEvent(l,"mousedown",function(){a.trigger("mousedown")},a.uid),r.addEvent(n.get(t.container),"mouseup",function(){a.trigger("mouseup")},a.uid),e=null}(),e.call(this),i=null,a.trigger({type:"ready",async:!0})},setOption:function(e,t){var i,r=this.getRuntime();"accept"==e&&(l=t.mimes||o.extList2mimes(t,r.can("filter_by_extension"))),i=n.get(s),i&&i.setAttribute("accept",l.join(","))},disable:function(e){var t;(t=n.get(s))&&(t.disabled=!!e)},destroy:function(){var e=this.getRuntime(),t=e.getShim(),i=e.getShimContainer(),o=u&&n.get(u.container),a=u&&n.get(u.browse_button);o&&r.removeAllEvents(o,this.uid),a&&(r.removeAllEvents(a,this.uid),a.style.zIndex=c),i&&(r.removeAllEvents(i,this.uid),i.innerHTML=""),t.removeInstance(this.uid),s=l=u=i=o=a=t=null}})}return e.FileInput=s}),n("moxie/runtime/html4/file/FileReader",["moxie/runtime/html4/Runtime","moxie/runtime/html5/file/FileReader"],function(e,t){return e.FileReader=t}),n("moxie/runtime/html4/xhr/XMLHttpRequest",["moxie/runtime/html4/Runtime","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Url","moxie/core/Exceptions","moxie/core/utils/Events","moxie/file/Blob","moxie/xhr/FormData"],function(e,t,i,n,r,o,a,s){function u(){function e(e){var t,n,r,a,s=this,u=!1;if(l){if(t=l.id.replace(/_iframe$/,""),n=i.get(t+"_form")){for(r=n.getElementsByTagName("input"),a=r.length;a--;)switch(r[a].getAttribute("type")){case"hidden":r[a].parentNode.removeChild(r[a]);break;case"file":u=!0}r=[],u||n.parentNode.removeChild(n),n=null}setTimeout(function(){o.removeEvent(l,"load",s.uid),l.parentNode&&l.parentNode.removeChild(l);var t=s.getRuntime().getShimContainer();t.children.length||t.parentNode.removeChild(t),t=l=null,e()},1)}}var u,c,l;t.extend(this,{send:function(d,m){function h(){var i=y.getShimContainer()||document.body,r=document.createElement("div");r.innerHTML='<iframe id="'+f+'_iframe" name="'+f+'_iframe" src="javascript:""" style="display:none"></iframe>',l=r.firstChild,i.appendChild(l),o.addEvent(l,"load",function(){var i;try{i=l.contentWindow.document||l.contentDocument||window.frames[l.id].document,/^4(0[0-9]|1[0-7]|2[2346])\s/.test(i.title)?u=i.title.replace(/^(\d+).*$/,"$1"):(u=200,c=t.trim(i.body.innerHTML),v.trigger({type:"progress",loaded:c.length,total:c.length}),x&&v.trigger({type:"uploadprogress",loaded:x.size||1025,total:x.size||1025}))}catch(r){if(!n.hasSameOrigin(d.url))return e.call(v,function(){v.trigger("error")}),void 0;u=404}e.call(v,function(){v.trigger("load")})},v.uid)}var f,p,g,x,v=this,y=v.getRuntime();if(u=c=null,m instanceof s&&m.hasBlob()){if(x=m.getBlob(),f=x.uid,g=i.get(f),p=i.get(f+"_form"),!p)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR)}else f=t.guid("uid_"),p=document.createElement("form"),p.setAttribute("id",f+"_form"),p.setAttribute("method",d.method),p.setAttribute("enctype","multipart/form-data"),p.setAttribute("encoding","multipart/form-data"),y.getShimContainer().appendChild(p);p.setAttribute("target",f+"_iframe"),m instanceof s&&m.each(function(e,i){if(e instanceof a)g&&g.setAttribute("name",i);else{var n=document.createElement("input");t.extend(n,{type:"hidden",name:i,value:e}),g?p.insertBefore(n,g):p.appendChild(n)}}),p.setAttribute("action",d.url),h(),p.submit(),v.trigger("loadstart")},getStatus:function(){return u},getResponse:function(e){if("json"===e&&"string"===t.typeOf(c)&&window.JSON)try{return JSON.parse(c.replace(/^\s*<pre[^>]*>/,"").replace(/<\/pre>\s*$/,""))}catch(i){return null}return c},abort:function(){var t=this;l&&l.contentWindow&&(l.contentWindow.stop?l.contentWindow.stop():l.contentWindow.document.execCommand?l.contentWindow.document.execCommand("Stop"):l.src="about:blank"),e.call(this,function(){t.dispatchEvent("abort")})}})}return e.XMLHttpRequest=u}),n("moxie/runtime/html4/image/Image",["moxie/runtime/html4/Runtime","moxie/runtime/html5/image/Image"],function(e,t){return e.Image=t}),a(["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Dom","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/Blob","moxie/core/I18n","moxie/core/utils/Mime","moxie/file/FileInput","moxie/file/File","moxie/file/FileDrop","moxie/file/FileReader","moxie/core/utils/Url","moxie/runtime/RuntimeTarget","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/runtime/Transporter","moxie/image/Image","moxie/core/utils/Events","moxie/runtime/html5/image/ResizerCanvas"])}(this)});
- define("../libs/plupload/js/moxie.min", function(){});
- !function(e,t){var i=function(){var e={};return t.apply(e,arguments),e.plupload};"function"==typeof define&&define.amd?define("plupload",["./moxie"],i):"object"==typeof module&&module.exports?module.exports=i(require("./moxie")):e.plupload=i(e.moxie)}(this||window,function(e){!function(e,t,i){function n(e){function t(e,t,i){var r={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",urlstream_upload:"send_binary_string",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};r[e]?n[r[e]]=t:i||(n[e]=t)}var i=e.required_features,n={};return"string"==typeof i?l.each(i.split(/\s*,\s*/),function(e){t(e,!0)}):"object"==typeof i?l.each(i,function(e,i){t(i,e)}):i===!0&&(e.chunk_size>0&&(n.slice_blob=!0),l.isEmptyObj(e.resize)&&e.multipart||(n.send_binary_string=!0),l.each(e,function(e,i){t(i,!!e,!0)})),n}var r=window.setTimeout,s={},a=t.core.utils,o=t.runtime.Runtime,l={VERSION:"2.2.1",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:a.Mime.mimes,ua:a.Env,typeOf:a.Basic.typeOf,extend:a.Basic.extend,guid:a.Basic.guid,getAll:function(e){var t,i=[];"array"!==l.typeOf(e)&&(e=[e]);for(var n=e.length;n--;)t=l.get(e[n]),t&&i.push(t);return i.length?i:null},get:a.Dom.get,each:a.Basic.each,getPos:a.Dom.getPos,getSize:a.Dom.getSize,xmlEncode:function(e){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},i=/[<>&\"\']/g;return e?(""+e).replace(i,function(e){return t[e]?"&"+t[e]+";":e}):e},toArray:a.Basic.toArray,inArray:a.Basic.inArray,inSeries:a.Basic.inSeries,addI18n:t.core.I18n.addI18n,translate:t.core.I18n.translate,sprintf:a.Basic.sprintf,isEmptyObj:a.Basic.isEmptyObj,hasClass:a.Dom.hasClass,addClass:a.Dom.addClass,removeClass:a.Dom.removeClass,getStyle:a.Dom.getStyle,addEvent:a.Events.addEvent,removeEvent:a.Events.removeEvent,removeAllEvents:a.Events.removeAllEvents,cleanName:function(e){var t,i;for(i=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"],t=0;t<i.length;t+=2)e=e.replace(i[t],i[t+1]);return e=e.replace(/\s+/g,"_"),e=e.replace(/[^a-z0-9_\-\.]+/gi,"")},buildUrl:function(e,t){var i="";return l.each(t,function(e,t){i+=(i?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(e)}),i&&(e+=(e.indexOf("?")>0?"&":"?")+i),e},formatSize:function(e){function t(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}if(e===i||/\D/.test(e))return l.translate("N/A");var n=Math.pow(1024,4);return e>n?t(e/n,1)+" "+l.translate("tb"):e>(n/=1024)?t(e/n,1)+" "+l.translate("gb"):e>(n/=1024)?t(e/n,1)+" "+l.translate("mb"):e>1024?Math.round(e/1024)+" "+l.translate("kb"):e+" "+l.translate("b")},parseSize:a.Basic.parseSizeStr,predictRuntime:function(e,t){var i,n;return i=new l.Uploader(e),n=o.thatCan(i.getOption().required_features,t||e.runtimes),i.destroy(),n},addFileFilter:function(e,t){s[e]=t}};l.addFileFilter("mime_types",function(e,t,i){e.length&&!e.regexp.test(t.name)?(this.trigger("Error",{code:l.FILE_EXTENSION_ERROR,message:l.translate("File extension error."),file:t}),i(!1)):i(!0)}),l.addFileFilter("max_file_size",function(e,t,i){var n;e=l.parseSize(e),t.size!==n&&e&&t.size>e?(this.trigger("Error",{code:l.FILE_SIZE_ERROR,message:l.translate("File size error."),file:t}),i(!1)):i(!0)}),l.addFileFilter("prevent_duplicates",function(e,t,i){if(e)for(var n=this.files.length;n--;)if(t.name===this.files[n].name&&t.size===this.files[n].size)return this.trigger("Error",{code:l.FILE_DUPLICATE_ERROR,message:l.translate("Duplicate file error."),file:t}),i(!1),void 0;i(!0)}),l.Uploader=function(e){function a(){var e,t,i=0;if(this.state==l.STARTED){for(t=0;t<T.length;t++)e||T[t].status!=l.QUEUED?i++:(e=T[t],this.trigger("BeforeUpload",e)&&(e.status=l.UPLOADING,this.trigger("UploadFile",e)));i==T.length&&(this.state!==l.STOPPED&&(this.state=l.STOPPED,this.trigger("StateChanged")),this.trigger("UploadComplete",T))}}function u(e){e.percent=e.size>0?Math.ceil(100*(e.loaded/e.size)):100,d()}function d(){var e,t;for(w.reset(),e=0;e<T.length;e++)t=T[e],t.size!==i?(w.size+=t.origSize,w.loaded+=t.loaded*t.origSize/t.size):w.size=i,t.status==l.DONE?w.uploaded++:t.status==l.FAILED?w.failed++:w.queued++;w.size===i?w.percent=T.length>0?Math.ceil(100*(w.uploaded/T.length)):0:(w.bytesPerSec=Math.ceil(w.loaded/((+new Date-S||1)/1e3)),w.percent=w.size>0?Math.ceil(100*(w.loaded/w.size)):0)}function c(){var e=A[0]||P[0];return e?e.getRuntime().uid:!1}function f(e,t){if(e.ruid){var i=o.getInfo(e.ruid);if(i)return i.can(t)}return!1}function p(){this.bind("FilesAdded FilesRemoved",function(e){e.trigger("QueueChanged"),e.refresh()}),this.bind("CancelUpload",y),this.bind("BeforeUpload",m),this.bind("UploadFile",E),this.bind("UploadProgress",v),this.bind("StateChanged",b),this.bind("QueueChanged",d),this.bind("Error",z),this.bind("FileUploaded",R),this.bind("Destroy",O)}function g(e,i){var n=this,r=0,s=[],a={runtime_order:e.runtimes,required_caps:e.required_features,preferred_caps:F,swf_url:e.flash_swf_url,xap_url:e.silverlight_xap_url};l.each(e.runtimes.split(/\s*,\s*/),function(t){e[t]&&(a[t]=e[t])}),e.browse_button&&l.each(e.browse_button,function(i){s.push(function(s){var u=new t.file.FileInput(l.extend({},a,{accept:e.filters.mime_types,name:e.file_data_name,multiple:e.multi_selection,container:e.container,browse_button:i}));u.onready=function(){var e=o.getInfo(this.ruid);l.extend(n.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),multi_selection:e.can("select_multiple")}),r++,A.push(this),s()},u.onchange=function(){n.addFile(this.files)},u.bind("mouseenter mouseleave mousedown mouseup",function(t){U||(e.browse_button_hover&&("mouseenter"===t.type?l.addClass(i,e.browse_button_hover):"mouseleave"===t.type&&l.removeClass(i,e.browse_button_hover)),e.browse_button_active&&("mousedown"===t.type?l.addClass(i,e.browse_button_active):"mouseup"===t.type&&l.removeClass(i,e.browse_button_active)))}),u.bind("mousedown",function(){n.trigger("Browse")}),u.bind("error runtimeerror",function(){u=null,s()}),u.init()})}),e.drop_element&&l.each(e.drop_element,function(e){s.push(function(i){var s=new t.file.FileDrop(l.extend({},a,{drop_zone:e}));s.onready=function(){var e=o.getInfo(this.ruid);l.extend(n.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),dragdrop:e.can("drag_and_drop")}),r++,P.push(this),i()},s.ondrop=function(){n.addFile(this.files)},s.bind("error runtimeerror",function(){s=null,i()}),s.init()})}),l.inSeries(s,function(){"function"==typeof i&&i(r)})}function h(e,n,r){var s=new t.image.Image;try{s.onload=function(){return n.width>this.width&&n.height>this.height&&n.quality===i&&n.preserve_headers&&!n.crop?(this.destroy(),r(e)):(s.downsize(n.width,n.height,n.crop,n.preserve_headers),void 0)},s.onresize=function(){r(this.getAsBlob(e.type,n.quality)),this.destroy()},s.onerror=function(){r(e)},s.load(e)}catch(a){r(e)}}function _(e,i,r){function s(e,i,n){var r=I[e];switch(e){case"max_file_size":"max_file_size"===e&&(I.max_file_size=I.filters.max_file_size=i);break;case"chunk_size":(i=l.parseSize(i))&&(I[e]=i,I.send_file_name=!0);break;case"multipart":I[e]=i,i||(I.send_file_name=!0);break;case"unique_names":I[e]=i,i&&(I.send_file_name=!0);break;case"filters":"array"===l.typeOf(i)&&(i={mime_types:i}),n?l.extend(I.filters,i):I.filters=i,i.mime_types&&("string"===l.typeOf(i.mime_types)&&(i.mime_types=t.core.utils.Mime.mimes2extList(i.mime_types)),i.mime_types.regexp=function(e){var t=[];return l.each(e,function(e){l.each(e.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?t.push("\\.*"):t.push("\\."+e.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+t.join("|")+")$","i")}(i.mime_types),I.filters.mime_types=i.mime_types);break;case"resize":I.resize=i?l.extend({preserve_headers:!0,crop:!1},i):!1;break;case"prevent_duplicates":I.prevent_duplicates=I.filters.prevent_duplicates=!!i;break;case"container":case"browse_button":case"drop_element":i="container"===e?l.get(i):l.getAll(i);case"runtimes":case"multi_selection":case"flash_swf_url":case"silverlight_xap_url":I[e]=i,n||(u=!0);break;default:I[e]=i}n||a.trigger("OptionChanged",e,i,r)}var a=this,u=!1;"object"==typeof e?l.each(e,function(e,t){s(t,e,r)}):s(e,i,r),r?(I.required_features=n(l.extend({},I)),F=n(l.extend({},I,{required_features:!0}))):u&&(a.trigger("Destroy"),g.call(a,I,function(e){e?(a.runtime=o.getInfo(c()).type,a.trigger("Init",{runtime:a.runtime}),a.trigger("PostInit")):a.trigger("Error",{code:l.INIT_ERROR,message:l.translate("Init error.")})}))}function m(e,t){if(e.settings.unique_names){var i=t.name.match(/\.([^.]+)$/),n="part";i&&(n=i[1]),t.target_name=t.id+"."+n}}function E(e,i){function n(){d-->0?r(s,1e3):(i.loaded=p,e.trigger("Error",{code:l.HTTP_ERROR,message:l.translate("HTTP Error."),file:i,response:D.responseText,status:D.status,responseHeaders:D.getAllResponseHeaders()}))}function s(){var f,g,h,_={};i.status===l.UPLOADING&&e.state!==l.STOPPED&&(e.settings.send_file_name&&(_.name=i.target_name||i.name),u&&c.chunks&&a.size>u?(h=Math.min(u,a.size-p),f=a.slice(p,p+h)):(h=a.size,f=a),u&&c.chunks&&(e.settings.send_chunk_number?(_.chunk=Math.ceil(p/u),_.chunks=Math.ceil(a.size/u)):(_.offset=p,_.total=a.size)),D=new t.xhr.XMLHttpRequest,D.upload&&(D.upload.onprogress=function(t){i.loaded=Math.min(i.size,p+t.loaded),e.trigger("UploadProgress",i)}),D.onload=function(){return D.status>=400?(n(),void 0):(d=e.settings.max_retries,h<a.size?(f.destroy(),p+=h,i.loaded=Math.min(p,a.size),e.trigger("ChunkUploaded",i,{offset:i.loaded,total:a.size,response:D.responseText,status:D.status,responseHeaders:D.getAllResponseHeaders()}),"Android Browser"===l.ua.browser&&e.trigger("UploadProgress",i)):i.loaded=i.size,f=g=null,!p||p>=a.size?(i.size!=i.origSize&&(a.destroy(),a=null),e.trigger("UploadProgress",i),i.status=l.DONE,e.trigger("FileUploaded",i,{response:D.responseText,status:D.status,responseHeaders:D.getAllResponseHeaders()})):r(s,1),void 0)},D.onerror=function(){n()},D.onloadend=function(){this.destroy(),D=null},e.settings.multipart&&c.multipart?(D.open("post",o,!0),l.each(e.settings.headers,function(e,t){D.setRequestHeader(t,e)}),g=new t.xhr.FormData,l.each(l.extend(_,e.settings.multipart_params),function(e,t){g.append(t,e)}),g.append(e.settings.file_data_name,f),D.send(g,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:F,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})):(o=l.buildUrl(e.settings.url,l.extend(_,e.settings.multipart_params)),D.open("post",o,!0),l.each(e.settings.headers,function(e,t){D.setRequestHeader(t,e)}),D.hasRequestHeader("Content-Type")||D.setRequestHeader("Content-Type","application/octet-stream"),D.send(f,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:F,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})))}var a,o=e.settings.url,u=e.settings.chunk_size,d=e.settings.max_retries,c=e.features,p=0;i.loaded&&(p=i.loaded=u?u*Math.floor(i.loaded/u):0),a=i.getSource(),!l.isEmptyObj(e.settings.resize)&&f(a,"send_binary_string")&&-1!==l.inArray(a.type,["image/jpeg","image/png"])?h.call(this,a,e.settings.resize,function(e){a=e,i.size=e.size,s()}):s()}function v(e,t){u(t)}function b(e){if(e.state==l.STARTED)S=+new Date;else if(e.state==l.STOPPED)for(var t=e.files.length-1;t>=0;t--)e.files[t].status==l.UPLOADING&&(e.files[t].status=l.QUEUED,d())}function y(){D&&D.abort()}function R(e){d(),r(function(){a.call(e)},1)}function z(e,t){t.code===l.INIT_ERROR?e.destroy():t.code===l.HTTP_ERROR&&(t.file.status=l.FAILED,u(t.file),e.state==l.STARTED&&(e.trigger("CancelUpload"),r(function(){a.call(e)},1)))}function O(e){e.stop(),l.each(T,function(e){e.destroy()}),T=[],A.length&&(l.each(A,function(e){e.destroy()}),A=[]),P.length&&(l.each(P,function(e){e.destroy()}),P=[]),F={},U=!1,S=D=null,w.reset()}var I,S,w,D,x=l.guid(),T=[],F={},A=[],P=[],U=!1;I={runtimes:o.order,max_retries:0,chunk_size:0,multipart:!0,multi_selection:!0,file_data_name:"file",flash_swf_url:"js/Moxie.swf",silverlight_xap_url:"js/Moxie.xap",filters:{mime_types:[],prevent_duplicates:!1,max_file_size:0},resize:!1,send_file_name:!0,send_chunk_number:!0},_.call(this,e,null,!0),w=new l.QueueProgress,l.extend(this,{id:x,uid:x,state:l.STOPPED,features:{},runtime:null,files:T,settings:I,total:w,init:function(){var e,t,i=this;return e=i.getOption("preinit"),"function"==typeof e?e(i):l.each(e,function(e,t){i.bind(t,e)}),p.call(i),l.each(["container","browse_button","drop_element"],function(e){return null===i.getOption(e)?(t={code:l.INIT_ERROR,message:l.sprintf(l.translate("%s specified, but cannot be found."),e)},!1):void 0}),t?i.trigger("Error",t):I.browse_button||I.drop_element?(g.call(i,I,function(e){var t=i.getOption("init");"function"==typeof t?t(i):l.each(t,function(e,t){i.bind(t,e)}),e?(i.runtime=o.getInfo(c()).type,i.trigger("Init",{runtime:i.runtime}),i.trigger("PostInit")):i.trigger("Error",{code:l.INIT_ERROR,message:l.translate("Init error.")})}),void 0):i.trigger("Error",{code:l.INIT_ERROR,message:l.translate("You must specify either browse_button or drop_element.")})},setOption:function(e,t){_.call(this,e,t,!this.runtime)},getOption:function(e){return e?I[e]:I},refresh:function(){A.length&&l.each(A,function(e){e.trigger("Refresh")}),this.trigger("Refresh")},start:function(){this.state!=l.STARTED&&(this.state=l.STARTED,this.trigger("StateChanged"),a.call(this))},stop:function(){this.state!=l.STOPPED&&(this.state=l.STOPPED,this.trigger("StateChanged"),this.trigger("CancelUpload"))},disableBrowse:function(){U=arguments[0]!==i?arguments[0]:!0,A.length&&l.each(A,function(e){e.disable(U)}),this.trigger("DisableBrowse",U)},getFile:function(e){var t;for(t=T.length-1;t>=0;t--)if(T[t].id===e)return T[t]},addFile:function(e,i){function n(e,t){var i=[];l.each(u.settings.filters,function(t,n){s[n]&&i.push(function(i){s[n].call(u,t,e,function(e){i(!e)})})}),l.inSeries(i,t)}function a(e){var s=l.typeOf(e);if(e instanceof t.file.File){if(!e.ruid&&!e.isDetached()){if(!o)return!1;e.ruid=o,e.connectRuntime(o)}a(new l.File(e))}else e instanceof t.file.Blob?(a(e.getSource()),e.destroy()):e instanceof l.File?(i&&(e.name=i),d.push(function(t){n(e,function(i){i||(T.push(e),f.push(e),u.trigger("FileFiltered",e)),r(t,1)})})):-1!==l.inArray(s,["file","blob"])?a(new t.file.File(null,e)):"node"===s&&"filelist"===l.typeOf(e.files)?l.each(e.files,a):"array"===s&&(i=null,l.each(e,a))}var o,u=this,d=[],f=[];o=c(),a(e),d.length&&l.inSeries(d,function(){f.length&&u.trigger("FilesAdded",f)})},removeFile:function(e){for(var t="string"==typeof e?e:e.id,i=T.length-1;i>=0;i--)if(T[i].id===t)return this.splice(i,1)[0]},splice:function(e,t){var n=T.splice(e===i?0:e,t===i?T.length:t),r=!1;return this.state==l.STARTED&&(l.each(n,function(e){return e.status===l.UPLOADING?(r=!0,!1):void 0}),r&&this.stop()),this.trigger("FilesRemoved",n),l.each(n,function(e){e.destroy()}),r&&this.start(),n},dispatchEvent:function(e){var t,i;if(e=e.toLowerCase(),t=this.hasEventListener(e)){t.sort(function(e,t){return t.priority-e.priority}),i=[].slice.call(arguments),i.shift(),i.unshift(this);for(var n=0;n<t.length;n++)if(t[n].fn.apply(t[n].scope,i)===!1)return!1}return!0},bind:function(e,t,i,n){l.Uploader.prototype.bind.call(this,e,t,n,i)},destroy:function(){this.trigger("Destroy"),I=w=null,this.unbindAll()}})},l.Uploader.prototype=t.core.EventTarget.instance,l.File=function(){function e(e){l.extend(this,{id:l.guid(),name:e.name||e.fileName,type:e.type||"",size:e.size||e.fileSize,origSize:e.size||e.fileSize,loaded:0,percent:0,status:l.QUEUED,lastModifiedDate:e.lastModifiedDate||(new Date).toLocaleString(),getNative:function(){var e=this.getSource().getSource();return-1!==l.inArray(l.typeOf(e),["blob","file"])?e:null},getSource:function(){return t[this.id]?t[this.id]:null},destroy:function(){var e=this.getSource();e&&(e.destroy(),delete t[this.id])}}),t[this.id]=e}var t={};return e}(),l.QueueProgress=function(){var e=this;e.size=0,e.loaded=0,e.uploaded=0,e.failed=0,e.queued=0,e.percent=0,e.bytesPerSec=0,e.reset=function(){e.size=e.loaded=e.uploaded=e.failed=e.queued=e.percent=e.bytesPerSec=0}},e.plupload=l}(this,e)});
- define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, undefined, Plupload, Template) {
- var Upload = {
- list: {},
- config: {
- container: document.body,
- classname: '.plupload:not([initialized])',
- previewtpl: '<li class="col-xs-3"><a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail"><img src="<%=fullurl%>" class="img-responsive"></a><a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a></li>',
- },
- events: {
-
- onPostInit: function (up) {
- },
-
- onFileAdded: function (up, files) {
- var button = up.settings.button;
- $(button).data("bakup-html", $(button).html());
- var maxcount = $(button).data("maxcount");
- var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
- maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
- if (maxcount > 0 && input_id) {
- var inputObj = $("#" + input_id);
- if (inputObj.size() > 0) {
- var value = $.trim(inputObj.val());
- var nums = value === '' ? 0 : value.split(/\,/).length;
- var remains = maxcount - nums;
- if (files.length > remains) {
- for (var i = 0; i < files.length; i++) {
- up.removeFile(files[i]);
- }
- Toastr.error(__('You can upload up to %d file%s', remains));
- return false;
- }
- }
- }
-
- setTimeout(function () {
- up.start();
- }, 1);
- },
-
- onUploadProgress: function (up, file) {
- },
-
- onBeforeUpload: function (up, file) {
- },
-
- onUploadSuccess: function (up, ret) {
- var button = up.settings.button;
- var onUploadSuccess = up.settings.onUploadSuccess;
- var data = typeof ret.data !== 'undefined' ? ret.data : null;
-
- if (button) {
-
- var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
- if (input_id) {
- var urlArr = [];
- var inputObj = $("#" + input_id);
- if ($(button).data("multiple") && inputObj.val() !== "") {
- urlArr.push(inputObj.val());
- }
- urlArr.push(data.url);
- inputObj.val(urlArr.join(",")).trigger("change");
- }
-
- var onDomUploadSuccess = $(button).data("upload-success");
- if (onDomUploadSuccess) {
- if (typeof onDomUploadSuccess !== 'function' && typeof Upload.api.custom[onDomUploadSuccess] === 'function') {
- onDomUploadSuccess = Upload.api.custom[onDomUploadSuccess];
- }
- if (typeof onDomUploadSuccess === 'function') {
- var result = onDomUploadSuccess.call(button, data, ret);
- if (result === false)
- return;
- }
- }
- }
- if (typeof onUploadSuccess === 'function') {
- var result = onUploadSuccess.call(button, data, ret);
- if (result === false)
- return;
- }
- },
-
- onUploadError: function (up, ret) {
- var button = up.settings.button;
- var onUploadError = up.settings.onUploadError;
- var data = typeof ret.data !== 'undefined' ? ret.data : null;
- if (button) {
- var onDomUploadError = $(button).data("upload-error");
- if (onDomUploadError) {
- if (typeof onDomUploadError !== 'function' && typeof Upload.api.custom[onDomUploadError] === 'function') {
- onDomUploadError = Upload.api.custom[onDomUploadError];
- }
- if (typeof onDomUploadError === 'function') {
- var result = onDomUploadError.call(button, data, ret);
- if (result === false)
- return;
- }
- }
- }
- if (typeof onUploadError === 'function') {
- var result = onUploadError.call(button, data, ret);
- if (result === false) {
- return;
- }
- }
- Toastr.error(ret.msg + "(code:" + ret.code + ")");
- },
-
- onUploadResponse: function (response) {
- try {
- var ret = typeof response === 'object' ? response : JSON.parse(response);
- if (!ret.hasOwnProperty('code')) {
- $.extend(ret, {code: -2, msg: response, data: null});
- }
- } catch (e) {
- var ret = {code: -1, msg: e.message, data: null};
- }
- return ret;
- },
-
- onUploadComplete: function (up, files) {
- var button = up.settings.button;
- var onUploadComplete = up.settings.onUploadComplete;
- if (button) {
- var onDomUploadComplete = $(button).data("upload-complete");
- if (onDomUploadComplete) {
- if (typeof onDomUploadComplete !== 'function' && typeof Upload.api.custom[onDomUploadComplete] === 'function') {
- onDomUploadComplete = Upload.api.custom[onDomUploadComplete];
- }
- if (typeof onDomUploadComplete === 'function') {
- var result = onDomUploadComplete.call(button, files);
- if (result === false)
- return;
- }
- }
- }
- if (typeof onUploadComplete === 'function') {
- var result = onUploadComplete.call(button, files);
- if (result === false) {
- return;
- }
- }
- }
- },
- api: {
-
- plupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
- element = typeof element === 'undefined' ? Upload.config.classname : element;
- $(element, Upload.config.container).each(function () {
- if ($(this).attr("initialized")) {
- return true;
- }
- $(this).attr("initialized", true);
- var that = this;
- var id = $(this).prop("id");
- var url = $(this).data("url");
- var maxsize = $(this).data("maxsize");
- var mimetype = $(this).data("mimetype");
- var multipart = $(this).data("multipart");
- var multiple = $(this).data("multiple");
-
- var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
-
- var preview_id = $(that).data("preview-id") ? $(that).data("preview-id") : "";
-
- url = url ? url : Config.upload.uploadurl;
- url = Fast.api.fixurl(url);
-
- maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize;
-
- mimetype = typeof mimetype !== "undefined" ? mimetype : Config.upload.mimetype;
-
- multipart = typeof multipart !== "undefined" ? multipart : Config.upload.multipart;
-
- multiple = typeof multiple !== "undefined" ? multiple : Config.upload.multiple;
- var mimetypeArr = new Array();
-
- if (mimetype && mimetype !== "*" && mimetype.indexOf("/") === -1)
- {
- var tempArr = mimetype.split(',');
- for (var i = 0; i < tempArr.length; i++)
- {
- mimetypeArr.push({title: __('Files'), extensions: tempArr[i]});
- }
- mimetype = mimetypeArr;
- }
-
- Upload.list[id] = new Plupload.Uploader({
- runtimes: 'html5,flash,silverlight,html4',
- multi_selection: multiple,
- browse_button: id,
- container: $(this).parent().get(0),
- flash_swf_url: '/assets/libs/plupload/js/Moxie.swf',
- silverlight_xap_url: '/assets/libs/plupload/js/Moxie.xap',
- filters: {
- max_file_size: maxsize,
- mime_types: mimetype,
- },
- url: url,
- multipart_params: $.isArray(multipart) ? {} : multipart,
- init: {
- PostInit: Upload.events.onPostInit,
- FilesAdded: Upload.events.onFileAdded,
- BeforeUpload: Upload.events.onBeforeUpload,
- UploadProgress: function (up, file) {
- var button = up.settings.button;
- $(button).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + file.percent + "%");
- Upload.events.onUploadProgress(up, file);
- },
- FileUploaded: function (up, file, info) {
- var button = up.settings.button;
-
- $(button).prop("disabled", false).html($(button).data("bakup-html"));
- var ret = Upload.events.onUploadResponse(info.response, info, up, file);
- file.ret = ret;
- if (ret.code === 1) {
- Upload.events.onUploadSuccess(up, ret, file);
- } else {
- Upload.events.onUploadError(up, ret, file);
- }
- },
- UploadComplete: Upload.events.onUploadComplete,
- Error: function (up, err) {
- var button = up.settings.button;
- $(button).prop("disabled", false).html($(button).data("bakup-html"));
- var ret = {code: err.code, msg: err.message, data: null};
- Upload.events.onUploadError(up, ret);
- }
- },
- onUploadSuccess: onUploadSuccess,
- onUploadError: onUploadError,
- onUploadComplete: onUploadComplete,
- button: that
- });
-
- if (preview_id && multiple) {
- require(['dragsort'], function () {
- $("#" + preview_id).dragsort({
- dragSelector: "li",
- dragEnd: function () {
- $("#" + preview_id).trigger("fa.preview.change");
- },
- placeHolderTemplate: '<li class="col-xs-3"></li>'
- });
- });
- }
- if (preview_id && input_id) {
- $(document.body).on("keyup change", "#" + input_id, function () {
- var inputStr = $("#" + input_id).val();
- var inputArr = inputStr.split(/\,/);
- $("#" + preview_id).empty();
- var tpl = $("#" + preview_id).data("template") ? $("#" + preview_id).data("template") : "";
- $.each(inputArr, function (i, j) {
- if (!j) {
- return true;
- }
- var data = {url: j, fullurl: Fast.api.cdnurl(j), data: $(that).data()};
- var html = tpl ? Template(tpl, data) : Template.render(Upload.config.previewtpl, data);
- $("#" + preview_id).append(html);
- });
- });
- $("#" + input_id).trigger("change");
- }
- if (preview_id) {
-
- $(document.body).on("fa.preview.change", "#" + preview_id, function () {
- var urlArr = new Array();
- $("#" + preview_id + " [data-url]").each(function (i, j) {
- urlArr.push($(this).data("url"));
- });
- if (input_id) {
- $("#" + input_id).val(urlArr.join(","));
- }
- });
-
- $(document.body).on("click", "#" + preview_id + " .btn-trash", function () {
- $(this).closest("li").remove();
- $("#" + preview_id).trigger("fa.preview.change");
- });
- }
- Upload.list[id].init();
- });
- },
-
- send: function (file, onUploadSuccess, onUploadError, onUploadComplete) {
- var index = Layer.msg(__('Uploading'), {offset: 't', time: 0});
- var id = Plupload.guid();
- var _onPostInit = Upload.events.onPostInit;
- Upload.events.onPostInit = function () {
-
- Upload.list[id].addFile(file);
-
- };
- $('<button type="button" id="' + id + '" class="btn btn-danger hidden plupload" />').appendTo("body");
- $("#" + id).data("upload-complete", function (files) {
- Upload.events.onPostInit = _onPostInit;
- Layer.close(index);
- });
- Upload.api.plupload("#" + id, onUploadSuccess, onUploadError, onUploadComplete);
- },
- custom: {
-
- afteruploadcallback: function (response) {
- console.log(this, response);
- alert("Custom Callback,Response URL:" + response.url);
- },
- },
- }
- };
- return Upload;
- });
- ;(function(factory) {
- typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
- typeof define === 'function' && define.amd ? define('validator-core',['jquery'], factory) :
- factory(jQuery);
- }(function($, undefined) {
- "use strict";
- var NS = 'validator',
- CLS_NS = '.' + NS,
- CLS_NS_RULE = '.rule',
- CLS_NS_FIELD = '.field',
- CLS_NS_FORM = '.form',
- CLS_WRAPPER = 'nice-' + NS,
- CLS_MSG_BOX = 'msg-box',
- ARIA_INVALID = 'aria-invalid',
- DATA_RULE = 'data-rule',
- DATA_MSG = 'data-msg',
- DATA_TIP = 'data-tip',
- DATA_OK = 'data-ok',
- DATA_TIMELY = 'data-timely',
- DATA_TARGET = 'data-target',
- DATA_DISPLAY = 'data-display',
- DATA_MUST = 'data-must',
- NOVALIDATE = 'novalidate',
- INPUT_SELECTOR = ':verifiable',
- rRules = /(&)?(!)?\b(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?\s*(;|\|)?/g,
- rRule = /(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?/,
- rDisplay = /(?:([^:;\(\[]*):)?(.*)/,
- rDoubleBytes = /[^\x00-\xff]/g,
- rPos = /top|right|bottom|left/,
- rAjaxType = /(?:(cors|jsonp):)?(?:(post|get):)?(.+)/i,
- rUnsafe = /[<>'"`\\]|&#x?\d+[A-F]?;?|%3[A-F]/gmi,
- noop = $.noop,
- proxy = $.proxy,
- trim = $.trim,
- isFunction = $.isFunction,
- isString = function(s) {
- return typeof s === 'string';
- },
- isObject = function(o) {
- return o && Object.prototype.toString.call(o) === '[object Object]';
- },
- isIE = document.documentMode || +(navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1),
- attr = function(el, key, value) {
- if (!el || !el.tagName) return null;
- if (value !== undefined) {
- if (value === null) el.removeAttribute(key);
- else el.setAttribute(key, '' + value);
- } else {
- return el.getAttribute(key);
- }
- },
- novalidateonce,
- preinitialized = {},
- defaults = {
- debug: 0,
- theme: 'default',
- ignore: '',
- focusInvalid: true,
- focusCleanup: false,
- stopOnError: false,
- beforeSubmit: null,
- valid: null,
- invalid: null,
- validation: null,
- formClass: 'n-default',
- validClass: 'n-valid',
- invalidClass: 'n-invalid',
- bindClassTo: null
- },
- fieldDefaults = {
- timely: 1,
- display: null,
- target: null,
- ignoreBlank: false,
- showOk: true,
-
- dataFilter: function (data) {
- if ( isString(data) || ( isObject(data) && ('error' in data || 'ok' in data) ) ) {
- return data;
- }
- },
- msgMaker: function(opt) {
- var html;
- html = '<span role="alert" class="msg-wrap n-'+ opt.type + '">' + opt.arrow;
- if (opt.result) {
- $.each(opt.result, function(i, obj){
- html += '<span class="n-'+ obj.type +'">' + opt.icon + '<span class="n-msg">' + obj.msg + '</span></span>';
- });
- } else {
- html += opt.icon + '<span class="n-msg">' + opt.msg + '</span>';
- }
- html += '</span>';
- return html;
- },
- msgWrapper: 'span',
- msgArrow: '',
- msgIcon: '<span class="n-icon"></span>',
- msgClass: 'n-right',
- msgStyle: '',
- msgShow: null,
- msgHide: null
- },
- themes = {};
-
- $.fn.validator = function(options) {
- var that = this,
- args = arguments;
- if (that.is(INPUT_SELECTOR)) return that;
- if (!that.is('form')) that = this.find('form');
- if (!that.length) that = this;
- that.each(function() {
- var instance = $(this).data(NS);
- if (instance) {
- if ( isString(options) ) {
- if ( options.charAt(0) === '_' ) return;
- instance[options].apply(instance, [].slice.call(args, 1));
- }
- else if (options) {
- instance._reset(true);
- instance._init(this, options);
- }
- } else {
- new Validator(this, options);
- }
- });
- return this;
- };
-
- $.fn.isValid = function(callback, hideMsg) {
- var me = _getInstance(this[0]),
- hasCallback = isFunction(callback),
- ret, opt;
- if (!me) return true;
- if (!hasCallback && hideMsg === undefined) hideMsg = callback;
- me.checkOnly = !!hideMsg;
- opt = me.options;
- ret = me._multiValidate(
- this.is(INPUT_SELECTOR) ? this : this.find(INPUT_SELECTOR),
- function(isValid){
- if (!isValid && opt.focusInvalid && !me.checkOnly) {
-
- me.$el.find('[' + ARIA_INVALID + ']:first').focus();
- }
- if (hasCallback) {
- if (callback.length) {
- callback(isValid);
- } else if (isValid) {
- callback();
- }
- }
- me.checkOnly = false;
- }
- );
-
- return hasCallback ? this : ret;
- };
- $.extend($.expr.pseudos || $.expr[':'], {
-
- verifiable: function(elem) {
- var name = elem.nodeName.toLowerCase();
- return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
- name === 'select' ||
- name === 'textarea' ||
- elem.contentEditable === 'true'
- ) && !elem.disabled;
- },
-
- filled: function(elem) {
- return !!trim($(elem).val());
- }
- });
-
- function Validator(element, options) {
- var me = this;
- if ( !(me instanceof Validator) ) {
- return new Validator(element, options);
- }
- if (Validator.pending) {
- $(window).on('validatorready', init);
- } else {
- init();
- }
- function init() {
- me.$el = $(element);
- if (me.$el.length) {
- me._init(me.$el[0], options);
- }
- else if (isString(element)) {
- preinitialized[element] = options;
- }
- }
- }
- Validator.prototype = {
- _init: function(element, options) {
- var me = this,
- opt, themeOpt, dataOpt;
-
- if ( isFunction(options) ) {
- options = {
- valid: options
- };
- }
- options = me._opt = options || {};
- dataOpt = attr(element, 'data-'+ NS +'-option');
- dataOpt = me._dataOpt = dataOpt && dataOpt.charAt(0) === '{' ? (new Function("return " + dataOpt))() : {};
- themeOpt = me._themeOpt = themes[ options.theme || dataOpt.theme || defaults.theme ];
- opt = me.options = $.extend({}, defaults, fieldDefaults, themeOpt, me.options, options, dataOpt);
- me.rules = new Rules(opt.rules, true);
- me.messages = new Messages(opt.messages, true);
- me.Field = _createFieldFactory(me);
- me.elements = me.elements || {};
- me.deferred = {};
- me.errors = {};
- me.fields = {};
-
- me._initFields(opt.fields);
-
- if ( !me.$el.data(NS) ) {
- me.$el.data(NS, me).addClass(CLS_WRAPPER +' '+ opt.formClass)
- .on('form-submit-validate', function(e, a, $form, opts, veto) {
- me.vetoed = veto.veto = !me.isValid;
- me.ajaxFormOptions = opts;
- })
- .on('submit'+ CLS_NS +' validate'+ CLS_NS, proxy(me, '_submit'))
- .on('reset'+ CLS_NS, proxy(me, '_reset'))
- .on('showmsg'+ CLS_NS, proxy(me, '_showmsg'))
- .on('hidemsg'+ CLS_NS, proxy(me, '_hidemsg'))
- .on('focusin'+ CLS_NS + ' click'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusin'))
- .on('focusout'+ CLS_NS +' validate'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusout'))
- .on('keyup'+ CLS_NS +' input'+ CLS_NS + ' compositionstart compositionend', INPUT_SELECTOR, proxy(me, '_focusout'))
- .on('click'+ CLS_NS, ':radio,:checkbox', 'click', proxy(me, '_focusout'))
- .on('change'+ CLS_NS, 'select,input[type="file"]', 'change', proxy(me, '_focusout'));
-
- me._NOVALIDATE = attr(element, NOVALIDATE);
-
-
- attr(element, NOVALIDATE, NOVALIDATE);
- }
-
- if ( isString(opt.target) ) {
- me.$el.find(opt.target).addClass('msg-container');
- }
- },
-
- _guessAjax: function(form) {
- var me = this;
- if ( !(me.isAjaxSubmit = !!me.options.valid) ) {
-
- var events = ($._data || $.data)(form, "events");
- me.isAjaxSubmit = issetEvent(events, 'valid', 'form') || issetEvent(events, 'submit', 'form-plugin');
- }
- function issetEvent(events, name, namespace) {
- if ( events && events[name] &&
- $.map(events[name], function(e){
- return ~e.namespace.indexOf(namespace) ? 1 : null;
- }).length
- ) {
- return true;
- }
- return false;
- }
- },
- _initFields: function(fields) {
- var me = this, k, arr, i,
- clear = fields === null;
-
- if (clear) fields = me.fields;
- if ( isObject(fields) ) {
- for (k in fields) {
- if (~k.indexOf(',')) {
- arr = k.split(',');
- i = arr.length;
- while (i--) {
- initField(trim(arr[i]), fields[k]);
- }
- } else {
- initField(k, fields[k]);
- }
- }
- }
-
- me.$el.find(INPUT_SELECTOR).each(function() {
- me._parse(this);
- });
- function initField(k, v) {
-
- if ( v === null || clear ) {
- var el = me.elements[k];
- if (el) me._resetElement(el, true);
- delete me.fields[k];
- } else {
- me.fields[k] = new me.Field(k, isString(v) ? {rule: v} : v, me.fields[k]);
- }
- }
- },
-
- _parse: function(el) {
- var me = this,
- field,
- key = el.name,
- display,
- timely,
- dataRule = attr(el, DATA_RULE);
- dataRule && attr(el, DATA_RULE, null);
-
- if ( el.id && (
- ('#' + el.id in me.fields) ||
- !key ||
-
- (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
- )
- ) {
- key = '#' + el.id;
- }
-
- if (!key) {
- key = '#' + (el.id = 'N' + String(Math.random()).slice(-12));
- }
- field = me.getField(key, true);
-
- field.rule = dataRule || field.rule;
- if (display = attr(el, DATA_DISPLAY)) {
- field.display = display;
- }
- if (field.rule) {
- if ( attr(el, DATA_MUST) !== null || /\b(?:match|checked)\b/.test(field.rule) ) {
- field.must = true;
- }
- if ( /\brequired\b/.test(field.rule) ) {
- field.required = true;
- }
- if (timely = attr(el, DATA_TIMELY)) {
- field.timely = +timely;
- } else if (field.timely > 3) {
- attr(el, DATA_TIMELY, field.timely);
- }
- me._parseRule(field);
- field.old = {};
- }
- if ( isString(field.target) ) {
- attr(el, DATA_TARGET, field.target);
- }
- if ( isString(field.tip) ) {
- attr(el, DATA_TIP, field.tip);
- }
- return me.fields[key] = field;
- },
-
- _parseRule: function(field) {
- var arr = rDisplay.exec(field.rule);
- if (!arr) return;
-
- field._i = 0;
- if (arr[1]) {
- field.display = arr[1];
- }
- if (arr[2]) {
- field._rules = [];
- arr[2].replace(rRules, function(){
- var args = arguments;
- args[4] = args[4] || args[5];
- field._rules.push({
- and: args[1] === "&",
- not: args[2] === "!",
- or: args[6] === "|",
- method: args[3],
- params: args[4] ? $.map( args[4].split(', '), trim ) : undefined
- });
- });
- }
- },
-
- _multiValidate: function($inputs, doneCallback){
- var me = this,
- opt = me.options;
- me.hasError = false;
- if (opt.ignore) {
- $inputs = $inputs.not(opt.ignore);
- }
- $inputs.each(function() {
- me._validate(this);
- if (me.hasError && opt.stopOnError) {
-
- return false;
- }
- });
-
- if (doneCallback) {
- me.validating = true;
- $.when.apply(
- null,
- $.map(me.deferred, function(v){return v;})
- ).done(function(){
- doneCallback.call(me, !me.hasError);
- me.validating = false;
- });
- }
-
-
- return !$.isEmptyObject(me.deferred) ? undefined : !me.hasError;
- },
-
- _submit: function(e) {
- var me = this,
- opt = me.options,
- form = e.target,
- canSubmit = e.type === 'submit' && form.tagName === 'FORM' && !e.isDefaultPrevented();
- e.preventDefault();
- if (
- novalidateonce && ~(novalidateonce = false) ||
-
- me.submiting ||
-
- e.type === 'validate' && me.$el[0] !== form ||
-
- isFunction(opt.beforeSubmit) && opt.beforeSubmit.call(me, form) === false
- ) {
- return;
- }
- if (me.isAjaxSubmit === undefined) {
- me._guessAjax(form);
- }
- me._debug('log', '\n<<< event: ' + e.type);
- me._reset();
- me.submiting = true;
- me._multiValidate(
- me.$el.find(INPUT_SELECTOR),
- function(isValid){
- var ret = (isValid || opt.debug === 2) ? 'valid' : 'invalid',
- errors;
- if (!isValid) {
- if (opt.focusInvalid) {
-
- me.$el.find('[' + ARIA_INVALID + ']:first').focus();
- }
- errors = $.map(me.errors, function(err){return err;});
- }
-
- me.submiting = false;
- me.isValid = isValid;
-
- isFunction(opt[ret]) && opt[ret].call(me, form, errors);
- me.$el.trigger(ret + CLS_NS_FORM, [form, errors]);
- me._debug('log', '>>> ' + ret);
- if (!isValid) return;
-
- if (me.vetoed) {
- $(form).ajaxSubmit(me.ajaxFormOptions);
- }
- else if (canSubmit && !me.isAjaxSubmit) {
- document.createElement('form').submit.call(form);
- }
- }
- );
- },
- _reset: function(e) {
- var me = this;
- me.errors = {};
- if (e) {
- me.reseting = true;
- me.$el.find(INPUT_SELECTOR).each( function(){
- me._resetElement(this);
- });
- delete me.reseting;
- }
- },
- _resetElement: function(el, all) {
- this._setClass(el, null);
- this.hideMsg(el);
- },
-
- _focusin: function(e) {
- var me = this,
- opt = me.options,
- el = e.target,
- timely,
- msg;
- if ( me.validating || ( e.type==='click' && document.activeElement === el ) ) {
- return;
- }
- if (opt.focusCleanup) {
- if ( attr(el, ARIA_INVALID) === 'true' ) {
- me._setClass(el, null);
- me.hideMsg(el);
- }
- }
- msg = attr(el, DATA_TIP);
- if (msg) {
- me.showMsg(el, {
- type: 'tip',
- msg: msg
- });
- } else {
- if (attr(el, DATA_RULE)) {
- me._parse(el);
- }
- if (timely = attr(el, DATA_TIMELY)) {
- if ( timely === 8 || timely === 9 ) {
- me._focusout(e);
- }
- }
- }
- },
-
- _focusout: function(e) {
- var me = this,
- opt = me.options,
- el = e.target,
- etype = e.type,
- etype0,
- focusin = etype === 'focusin',
- special = etype === 'validate',
- elem,
- field,
- old,
- value,
- timestamp,
- key, specialKey,
- timely,
- timer = 0;
- if (etype === 'compositionstart') {
- me.pauseValidate = true;
- }
- if (etype === 'compositionend') {
- me.pauseValidate = false;
- }
- if (me.pauseValidate) {
- return;
- }
-
- elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
-
- if (!(field = me.getField(elem)) || !field.rule) {
- return;
- }
-
- etype0 = field._e;
- field._e = etype;
- timely = field.timely;
- if (!special) {
- if (!timely || (_checkable(el) && etype !== 'click')) {
- return;
- }
- value = field.getValue();
-
- if ( field.ignoreBlank && !value && !focusin ) {
- me.hideMsg(el);
- return;
- }
- if ( etype === 'focusout' ) {
- if (etype0 === 'change') {
- return;
- }
- if ( timely === 2 || timely === 8 ) {
- old = field.old;
- if (value && old) {
- if (field.isValid && !old.showOk) {
- me.hideMsg(el);
- } else {
- me._makeMsg(el, field, old);
- }
- } else {
- return;
- }
- }
- }
- else {
- if ( timely < 2 && !e.data ) {
- return;
- }
-
- timestamp = +new Date();
- if ( timestamp - (el._ts || 0) < 100 ) {
- return;
- }
- el._ts = timestamp;
-
- if ( etype === 'keyup' ) {
- if (etype0 === 'input') {
- return;
- }
- key = e.keyCode;
- specialKey = {
- 8: 1,
- 9: 1,
- 16: 1,
- 32: 1,
- 46: 1
- };
-
- if ( key === 9 && !value ) {
- return;
- }
-
- if ( key < 48 && !specialKey[key] ) {
- return;
- }
- }
- if ( !focusin ) {
-
- timer = timely <100 ? (etype === 'click' || el.tagName === 'SELECT') ? 0 : 400 : timely;
- }
- }
- }
-
- if ( opt.ignore && $(el).is(opt.ignore) ) {
- return;
- }
- clearTimeout(field._t);
- if (timer) {
- field._t = setTimeout(function() {
- me._validate(el, field);
- }, timer);
- } else {
- if (special) field.old = {};
- me._validate(el, field);
- }
- },
- _setClass: function(el, isValid) {
- var $el = $(el), opt = this.options;
- if (opt.bindClassTo) {
- $el = $el.closest(opt.bindClassTo);
- }
- $el.removeClass( opt.invalidClass + ' ' + opt.validClass );
- if (isValid !== null) {
- $el.addClass( isValid ? opt.validClass : opt.invalidClass );
- }
- },
- _showmsg: function(e, type, msg) {
- var me = this,
- el = e.target;
- if ( me.$el.is(el) ) {
- if (isObject(type)) {
- me.showMsg(type)
- }
- else if ( type === 'tip' ) {
- me.$el.find(INPUT_SELECTOR +"["+ DATA_TIP +"]", el).each(function(){
- me.showMsg(this, {type: type, msg: msg});
- });
- }
- }
- else {
- me.showMsg(el, {type: type, msg: msg});
- }
- },
- _hidemsg: function(e) {
- var $el = $(e.target);
- if ( $el.is(INPUT_SELECTOR) ) {
- this.hideMsg($el);
- }
- },
-
- _validatedField: function(el, field, ret) {
- var me = this,
- opt = me.options,
- isValid = field.isValid = ret.isValid = !!ret.isValid,
- callback = isValid ? 'valid' : 'invalid';
- ret.key = field.key;
- ret.ruleName = field._r;
- ret.id = el.id;
- ret.value = field.value;
- me.elements[field.key] = ret.element = el;
- me.isValid = me.$el[0].isValid = isValid ? me.isFormValid() : isValid;
- if (isValid) {
- ret.type = 'ok';
- } else {
- if (me.submiting) {
- me.errors[field.key] = ret.msg;
- }
- me.hasError = true;
- }
-
- field.old = ret;
-
- isFunction(field[callback]) && field[callback].call(me, el, ret);
- isFunction(opt.validation) && opt.validation.call(me, el, ret);
-
- $(el).attr( ARIA_INVALID, isValid ? null : true )
- .trigger( callback + CLS_NS_FIELD, [ret, me] );
- me.$el.triggerHandler('validation', [ret, me]);
- if (me.checkOnly) return;
-
- me._setClass(el, ret.skip || ret.type === 'tip' ? null : isValid);
- me._makeMsg.apply(me, arguments);
- },
- _makeMsg: function(el, field, ret) {
-
- if (field.msgMaker) {
- ret = $.extend({}, ret);
- if (field._e === 'focusin') {
- ret.type = 'tip';
- }
- this[ ret.showOk || ret.msg || ret.type === 'tip' ? 'showMsg' : 'hideMsg' ](el, ret, field);
- }
- },
-
- _validatedRule: function(el, field, ret, msgOpt) {
- field = field || me.getField(el);
- msgOpt = msgOpt || {};
- var me = this,
- msg,
- rule,
- method = field._r,
- timely = field.timely,
- special = timely === 9 || timely === 8,
- transfer,
- temp,
- isValid = false;
-
- if (ret === null) {
- me._validatedField(el, field, {isValid: true, skip: true});
- field._i = 0;
- return;
- }
- else if (ret === undefined) {
- transfer = true;
- }
- else if (ret === true || ret === '') {
- isValid = true;
- }
- else if (isString(ret)) {
- msg = ret;
- }
- else if (isObject(ret)) {
- if (ret.error) {
- msg = ret.error;
- } else {
- msg = ret.ok;
- isValid = true;
- }
- }
- else {
- isValid = !!ret
- }
- rule = field._rules[field._i];
- if (rule.not) {
- msg = undefined;
- isValid = method === "required" || !isValid;
- }
- if (rule.or) {
- if (isValid) {
- while ( field._i < field._rules.length && field._rules[field._i].or ) {
- field._i++;
- }
- } else {
- transfer = true;
- }
- }
- else if (rule.and) {
- if (!field.isValid) transfer = true;
- }
- if (transfer) {
- isValid = true;
- }
-
- else {
- if (isValid) {
- if (field.showOk !== false) {
- temp = attr(el, DATA_OK);
- msg = temp === null ? isString(field.ok) ? field.ok : msg : temp;
- if (!isString(msg) && isString(field.showOk)) {
- msg = field.showOk;
- }
- if (isString(msg)) {
- msgOpt.showOk = isValid;
- }
- }
- }
- if (!isValid || special) {
-
- msg = (_getDataMsg(el, field, msg || rule.msg || me.messages[method]) || me.messages.fallback).replace(/\{0\|?([^\}]*)\}/, function(m, defaultDisplay){
- return me._getDisplay(el, field.display) || defaultDisplay || me.messages[0];
- });
- }
- if (!isValid) field.isValid = isValid;
- msgOpt.msg = msg;
- $(el).trigger( (isValid ? 'valid' : 'invalid') + CLS_NS_RULE, [method, msg]);
- }
- if (special && (!transfer || rule.and)) {
- if (!isValid && !field._m) field._m = msg;
- field._v = field._v || [];
- field._v.push({
- type: isValid ? !transfer ? 'ok' : 'tip' : 'error',
- msg: msg || rule.msg
- });
- }
- me._debug('log', ' ' + field._i + ': ' + method + ' => ' + (isValid || msg));
-
- if ( (isValid || special) && field._i < field._rules.length - 1) {
- field._i++;
- me._checkRule(el, field);
- }
-
- else {
- field._i = 0;
- if (special) {
- msgOpt.isValid = field.isValid;
- msgOpt.result = field._v;
- msgOpt.msg = field._m || '';
- if (!field.value && (field._e === 'focusin')) {
- msgOpt.type = 'tip';
- }
- } else {
- msgOpt.isValid = isValid;
- }
- me._validatedField(el, field, msgOpt);
- delete field._m;
- delete field._v;
- }
- },
-
- _checkRule: function(el, field) {
- var me = this,
- ret,
- fn,
- old,
- key = field.key,
- rule = field._rules[field._i],
- method = rule.method,
- params = rule.params;
-
- if (me.submiting && me.deferred[key]) {
- return;
- }
- old = field.old;
- field._r = method;
- if (old && !field.must && !rule.must && rule.result !== undefined &&
- old.ruleName === method && old.id === el.id &&
- field.value && old.value === field.value )
- {
-
- ret = rule.result;
- }
- else {
-
- fn = _getDataRule(el, method) || me.rules[method] || noop;
- ret = fn.call(field, el, params, field);
- if (fn.msg) rule.msg = fn.msg;
- }
-
- if (isObject(ret) && isFunction(ret.then)) {
- me.deferred[key] = ret;
-
- field.isValid = undefined;
-
- !me.checkOnly && me.showMsg(el, {
- type: 'loading',
- msg: me.messages.loading
- }, field);
-
- ret.then(
- function(d, textStatus, jqXHR) {
- var data = trim(jqXHR.responseText),
- result,
- dataFilter = field.dataFilter;
-
- if (/jsonp?/.test(this.dataType)) {
- data = d;
- } else if (data.charAt(0) === '{') {
- data = $.parseJSON(data);
- }
-
- result = dataFilter.call(this, data, field);
- if (result === undefined) result = dataFilter.call(this, data.data, field);
- rule.data = this.data;
- rule.result = field.old ? result : undefined;
- me._validatedRule(el, field, result);
- },
- function(jqXHR, textStatus){
- me._validatedRule(el, field, me.messages[textStatus] || textStatus);
- }
- ).always(function(){
- delete me.deferred[key];
- });
- }
-
- else {
- me._validatedRule(el, field, ret);
- }
- },
-
- _validate: function(el, field) {
- var me = this;
-
- if ( el.disabled || attr(el, NOVALIDATE) !== null ) {
- return;
- }
- field = field || me.getField(el);
- if (!field) return;
- if (!field._rules) me._parse(el);
- if (!field._rules) return;
- me._debug('info', field.key);
- field.isValid = true;
- field.element = el;
-
- field.value = field.getValue();
-
- if (!field.required && !field.must && !field.value) {
- if (!_checkable(el)) {
- me._validatedField(el, field, {isValid: true});
- return true;
- }
- }
- me._checkRule(el, field);
- return field.isValid;
- },
- _debug: function(type, messages) {
- if (window.console && this.options.debug) {
- console[type](messages);
- }
- },
-
- test: function(el, rule) {
- var me = this,
- ret,
- parts = rRule.exec(rule),
- field,
- method,
- params;
- if (parts) {
- method = parts[1];
- if (method in me.rules) {
- params = parts[2] || parts[3];
- params = params ? params.split(', ') : undefined;
- field = me.getField(el, true);
- field._r = method;
- field.value = field.getValue();
- ret = me.rules[method].call(field, el, params);
- }
- }
- return ret === true || ret === undefined || ret === null;
- },
- _getDisplay: function(el, str) {
- return !isString(str) ? isFunction(str) ? str.call(this, el) : '' : str;
- },
- _getMsgOpt: function(obj, field) {
- var opt = field ? field : this.options;
- return $.extend({
- type: 'error',
- pos: _getPos(opt.msgClass),
- target: opt.target,
- wrapper: opt.msgWrapper,
- style: opt.msgStyle,
- cls: opt.msgClass,
- arrow: opt.msgArrow,
- icon: opt.msgIcon
- }, isString(obj) ? {msg: obj} : obj);
- },
- _getMsgDOM: function(el, msgOpt) {
- var $el = $(el), $msgbox, datafor, tgt, container;
- if ( $el.is(INPUT_SELECTOR) ) {
- tgt = msgOpt.target || attr(el, DATA_TARGET);
- if (tgt) {
- tgt = !isFunction(tgt) ? tgt.charAt(0) === '#' ? $(tgt) : this.$el.find(tgt) : tgt.call(this, el);
- if (tgt.length) {
- if ( tgt.is(INPUT_SELECTOR) ) {
- $el = tgt
- el = tgt.get(0);
- } else if ( tgt.hasClass(CLS_MSG_BOX) ) {
- $msgbox = tgt;
- } else {
- container = tgt;
- }
- }
- }
- if (!$msgbox) {
- datafor = (!_checkable(el) || !el.name) && el.id ? el.id : el.name;
- $msgbox = (container || this.$el).find(msgOpt.wrapper + '.' + CLS_MSG_BOX + '[for="' + datafor + '"]');
- }
- } else {
- $msgbox = $el;
- }
-
- if (!msgOpt.hide && !$msgbox.length) {
- $msgbox = $('<'+ msgOpt.wrapper + '>').attr({
- 'class': CLS_MSG_BOX + (msgOpt.cls ? ' ' + msgOpt.cls : ''),
- 'style': msgOpt.style || undefined,
- 'for': datafor
- });
- if (container) {
- $msgbox.appendTo(container);
- } else {
- if ( _checkable(el) ) {
- var $parent = $el.parent();
- $msgbox.appendTo( $parent.is('label') ? $parent.parent() : $parent );
- } else {
- $msgbox[!msgOpt.pos || msgOpt.pos === 'right' ? 'insertAfter' : 'insertBefore']($el);
- }
- }
- }
- return $msgbox;
- },
-
- showMsg: function(el, msgOpt, field) {
- if (!el) return;
- var me = this,
- opt = me.options,
- msgShow,
- msgMaker,
- temp,
- $msgbox;
- if (isObject(el) && !el.jquery && !msgOpt) {
- $.each(el, function(key, msg) {
- var el = me.elements[key] || me.$el.find(_key2selector(key))[0];
- me.showMsg(el, msg);
- });
- return;
- }
- if ($(el).is(INPUT_SELECTOR)) {
- field = field || me.getField(el);
- }
- if (!(msgMaker = (field || opt).msgMaker)) {
- return;
- }
- msgOpt = me._getMsgOpt(msgOpt, field);
- el = (el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]') : $(el)).get(0);
-
- if (!msgOpt.msg && msgOpt.type !== 'error') {
- temp = attr(el, 'data-' + msgOpt.type);
- if (temp !== null) msgOpt.msg = temp;
- }
- if ( !isString(msgOpt.msg) ) {
- return;
- }
- $msgbox = me._getMsgDOM(el, msgOpt);
- !rPos.test($msgbox[0].className) && $msgbox.addClass(msgOpt.cls);
- if ( isIE === 6 && msgOpt.pos === 'bottom' ) {
- $msgbox[0].style.marginTop = $(el).outerHeight() + 'px';
- }
- $msgbox.html( msgMaker.call(me, msgOpt) )[0].style.display = '';
- if (isFunction(msgShow = field && field.msgShow || opt.msgShow)) {
- msgShow.call(me, $msgbox, msgOpt.type);
- }
- },
-
- hideMsg: function(el, msgOpt, field) {
- var me = this,
- opt = me.options,
- msgHide,
- $msgbox;
- el = $(el).get(0);
- if ($(el).is(INPUT_SELECTOR)) {
- field = field || me.getField(el);
- if (field) {
- if (field.isValid || me.reseting) attr(el, ARIA_INVALID, null);
- }
- }
- msgOpt = me._getMsgOpt(msgOpt, field);
- msgOpt.hide = true;
- $msgbox = me._getMsgDOM(el, msgOpt);
- if (!$msgbox.length) return;
- if ( isFunction(msgHide = field && field.msgHide || opt.msgHide) ) {
- msgHide.call(me, $msgbox, msgOpt.type);
- } else {
- $msgbox[0].style.display = 'none';
- $msgbox[0].innerHTML = '';
- }
- },
-
- getField: function(el, must) {
- var me = this,
- key,
- field;
- if (isString(el)) {
- key = el;
- el = undefined;
- } else {
- if (attr(el, DATA_RULE)) {
- return me._parse(el);
- }
- if (el.id && '#' + el.id in me.fields || !el.name) {
- key = '#' + el.id;
- } else {
- key = el.name;
- }
- }
- if ( (field = me.fields[key]) || must && (field = new me.Field(key)) ) {
- field.element = el;
- }
- return field;
- },
-
- setField: function(key, obj) {
- var fields = {};
- if (!key) return;
-
- if (isString(key)) {
- fields[key] = obj;
- }
-
- else {
- fields = key;
- }
- this._initFields(fields);
- },
-
- isFormValid: function() {
- var fields = this.fields, k, field;
- for (k in fields) {
- field = fields[k];
- if (!field._rules || !field.required && !field.must && !field.value) continue;
- if (!field.isValid) return false;
- }
- return true;
- },
-
- holdSubmit: function(hold) {
- this.submiting = hold === undefined || hold;
- },
-
- cleanUp: function() {
- this._reset(1);
- },
-
- destroy: function() {
- this._reset(1);
- this.$el.off(CLS_NS).removeData(NS);
- attr(this.$el[0], NOVALIDATE, this._NOVALIDATE);
- }
- };
-
- function _createFieldFactory(context) {
- function FieldFactory() {
- var options = this.options;
- for (var i in options) {
- if (i in fieldDefaults) this[i] = options[i];
- }
- $.extend(this, {
- _valHook: function() {
- return this.element.contentEditable === 'true' ? 'text' : 'val';
- },
- getValue: function() {
- var elem = this.element;
- if (elem.type === "number" && elem.validity && elem.validity.badInput) {
- return 'NaN';
- }
- return $(elem)[this._valHook()]();
- },
- setValue: function(value) {
- $(this.element)[this._valHook()](this.value = value);
- },
-
- getRangeMsg: function(value, params, suffix) {
- if (!params) return;
- var me = this,
- msg = me.messages[me._r] || '',
- result,
- p = params[0].split('~'),
- e = params[1] === 'false',
- a = p[0],
- b = p[1],
- c = 'rg',
- args = [''],
- isNumber = trim(value) && +value === +value;
- function compare(large, small) {
- return !e ? large >= small : large > small;
- }
- if (p.length === 2) {
- if (a && b) {
- if (isNumber && compare(value, +a) && compare(+b, value)) {
- result = true;
- }
- args = args.concat(p);
- c = e ? 'gtlt' : 'rg';
- }
- else if (a && !b) {
- if (isNumber && compare(value, +a)) {
- result = true;
- }
- args.push(a);
- c = e ? 'gt' : 'gte';
- }
- else if (!a && b) {
- if (isNumber && compare(+b, value)) {
- result = true;
- }
- args.push(b);
- c = e ? 'lt' : 'lte';
- }
- }
- else {
- if (value === +a) {
- result = true;
- }
- args.push(a);
- c = 'eq';
- }
- if (msg) {
- if (suffix && msg[c + suffix]) {
- c += suffix;
- }
- args[0] = msg[c];
- }
- return result || me._rules && ( me._rules[me._i].msg = me.renderMsg.apply(null, args) );
- },
-
- renderMsg: function() {
- var args = arguments,
- tpl = args[0],
- i = args.length;
- if (!tpl) return;
- while (--i) {
- tpl = tpl.replace('{' + i + '}', args[i]);
- }
- return tpl;
- }
- });
- }
- function Field(key, obj, oldField) {
- this.key = key;
- this.validator = context;
- $.extend(this, oldField, obj);
- }
- FieldFactory.prototype = context;
- Field.prototype = new FieldFactory();
- return Field;
- }
-
- function Rules(obj, context) {
- if (!isObject(obj)) return;
- var k, that = context ? context === true ? this : context : Rules.prototype;
- for (k in obj) {
- if (_checkRuleName(k))
- that[k] = _getRule(obj[k]);
- }
- }
-
- function Messages(obj, context) {
- if (!isObject(obj)) return;
- var k, that = context ? context === true ? this : context : Messages.prototype;
- for (k in obj) {
- that[k] = obj[k];
- }
- }
-
- function _getRule(fn) {
- switch ($.type(fn)) {
- case 'function':
- return fn;
- case 'array':
- var f = function() {
- return fn[0].test(this.value) || fn[1] || false;
- };
- f.msg = fn[1];
- return f;
- case 'regexp':
- return function() {
- return fn.test(this.value);
- };
- }
- }
-
- function _getInstance(el) {
- var wrap, k, options;
- if (!el || !el.tagName) return;
- switch (el.tagName) {
- case 'INPUT':
- case 'SELECT':
- case 'TEXTAREA':
- case 'BUTTON':
- case 'FIELDSET':
- wrap = el.form || $(el).closest('.' + CLS_WRAPPER);
- break;
- case 'FORM':
- wrap = el;
- break;
- default:
- wrap = $(el).closest('.' + CLS_WRAPPER);
- }
- for (k in preinitialized) {
- if ($(wrap).is(k)) {
- options = preinitialized[k];
- break;
- }
- }
- return $(wrap).data(NS) || $(wrap)[NS](options).data(NS);
- }
-
- function _getDataRule(el, method) {
- var fn = trim(attr(el, DATA_RULE + '-' + method));
- if ( fn && (fn = new Function("return " + fn)()) ) {
- return _getRule(fn);
- }
- }
-
- function _getDataMsg(el, field, m) {
- var msg = field.msg,
- item = field._r;
- if ( isObject(msg) ) msg = msg[item];
- if ( !isString(msg) ) {
- msg = attr(el, DATA_MSG + '-' + item) || attr(el, DATA_MSG) || ( m ? isString(m) ? m : m[item] : '');
- }
- return msg;
- }
-
- function _getPos(str) {
- var pos;
- if (str) pos = rPos.exec(str);
- return pos && pos[0];
- }
-
- function _checkable(el) {
- return el.tagName === 'INPUT' && el.type === 'checkbox' || el.type === 'radio';
- }
-
- function _parseDate(str) {
- return Date.parse(str.replace(/\.|\-/g, '/'));
- }
-
- function _checkRuleName(name) {
- return /^\w+$/.test(name);
- }
-
- function _key2selector(key) {
- var isID = key.charAt(0) === "#";
- key = key.replace(/([:.{(|)}/\[\]])/g, "\\$1");
- return isID ? key : '[name="'+ key +'"]:first';
- }
-
- $(window).on('beforeunload', function(){
- this.focus();
- });
- $(document)
- .on('click', ':submit', function(){
- var input = this, attrNode;
- if (!input.form) return;
-
- attrNode = input.getAttributeNode('formnovalidate');
- if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
- novalidateonce = true;
- }
- })
-
- .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
- if ( attr(this, NOVALIDATE) !== null ) return;
- var $form = $(this), me;
- if ( !$form.data(NS) && (me = _getInstance(this)) ) {
- if ( !$.isEmptyObject(me.fields) ) {
-
- if (e.type === 'focusin') {
- me._focusin(e);
- } else {
- me._submit(e);
- }
- } else {
- attr(this, NOVALIDATE, NOVALIDATE);
- $form.off(CLS_NS).removeData(NS);
- }
- }
- });
- new Messages({
- fallback: "This field is not valid.",
- loading: 'Validating...'
- });
-
- new Rules({
-
- required: function(element, params) {
- var me = this,
- val = trim(me.value),
- isValid = true;
- if (params) {
- if ( params.length === 1 ) {
- if ( !_checkRuleName(params[0]) ) {
- if (!val && !$(params[0], me.$el).length ) {
- return null;
- }
- }
- else if ( me.rules[params[0]] ) {
- if ( !val && !me.test(element, params[0]) ) {
- return null;
- }
- }
- }
- else if ( params[0] === 'not' ) {
- $.each(params.slice(1), function() {
- return (isValid = val !== trim(this));
- });
- }
- else if ( params[0] === 'from' ) {
- var $elements = me.$el.find(params[1]),
- VALIDATED = '_validated_',
- ret;
- isValid = $elements.filter(function(){
- var field = me.getField(this);
- return field && !!trim(field.getValue());
- }).length >= (params[2] || 1);
- if (isValid) {
- if (!val) ret = null;
- } else {
- ret = _getDataMsg($elements[0], me) || false;
- }
- if ( !$(element).data(VALIDATED) ) {
- $elements.data(VALIDATED, 1).each(function(){
- if (element !== this) {
- me._validate(this);
- }
- }).removeData(VALIDATED);
- }
- return ret;
- }
- }
- return isValid && !!val;
- },
-
- integer: function(element, params) {
- var re, z = '0|',
- p = '[1-9]\\d*',
- key = params ? params[0] : '*';
- switch (key) {
- case '+':
- re = p;
- break;
- case '-':
- re = '-' + p;
- break;
- case '+0':
- re = z + p;
- break;
- case '-0':
- re = z + '-' + p;
- break;
- default:
- re = z + '-?' + p;
- }
- re = '^(?:' + re + ')$';
- return new RegExp(re).test(this.value) || (this.messages.integer && this.messages.integer[key]);
- },
-
- match: function(element, params) {
- if (!params) return;
- var me = this,
- isValid = true,
- a, b,
- key, msg, type = 'eq', parser,
- selector2, elem2, field2;
- if (params.length === 1) {
- key = params[0];
- } else {
- type = params[0];
- key = params[1];
- }
- selector2 = _key2selector(key);
- elem2 = me.$el.find(selector2)[0];
-
- if (!elem2) return;
- field2 = me.getField(elem2);
- a = me.value;
- b = field2.getValue();
- if (!me._match) {
- me.$el.on('valid'+CLS_NS_FIELD+CLS_NS, selector2, function(){
- $(element).trigger('validate');
- });
- me._match = field2._match = 1;
- }
-
- if (!me.required && a === "" && b === "") {
- return null;
- }
- parser = params[2];
- if (parser) {
- if (/^date(time)?$/i.test(parser)) {
- a = _parseDate(a);
- b = _parseDate(b);
- } else if (parser === 'time') {
- a = +a.replace(/:/g, '');
- b = +b.replace(/:/g, '');
- }
- }
-
- if (type !== "eq" && !isNaN(+a) && isNaN(+b)) {
- return true;
- }
- switch (type) {
- case 'lt':
- isValid = +a < +b; break;
- case 'lte':
- isValid = +a <= +b; break;
- case 'gte':
- isValid = +a >= +b; break;
- case 'gt':
- isValid = +a > +b; break;
- case 'neq':
- isValid = a !== b; break;
- default:
- isValid = a === b;
- }
- return isValid || (
- isObject(me.messages.match)
- && me.messages.match[type].replace( '{1}', me._getDisplay( element, field2.display || key ) )
- );
- },
-
- range: function(element, params) {
- return this.getRangeMsg(this.value, params);
- },
-
- checked: function(element, params) {
- if ( !_checkable(element) ) return;
- var me = this,
- elem, count;
- if (element.name) {
- count = me.$el.find('input[name="' + element.name + '"]').filter(function() {
- var el = this;
- if (!elem && _checkable(el)) elem = el;
- return !el.disabled && el.checked;
- }).length;
- } else {
- elem = element;
- count = elem.checked;
- }
- if (params) {
- return me.getRangeMsg(count, params);
- } else {
- return !!count || _getDataMsg(elem, me, '') || me.messages.required || false;
- }
- },
-
- length: function(element, params) {
- var value = this.value,
- len = (params[1] === 'true' ? value.replace(rDoubleBytes, 'xx') : value).length;
- return this.getRangeMsg(len, params, (params[1] ? '_2' : ''));
- },
-
- remote: function(element, params) {
- if (!params) return;
- var me = this,
- arr = rAjaxType.exec(params[0]),
- rule = me._rules[me._i],
- data = {},
- queryString = '',
- url = arr[3],
- type = arr[2] || 'POST',
- rType = (arr[1]||'').toLowerCase(),
- dataType;
- rule.must = true;
- data[element.name] = me.value;
-
- if (params[1]) {
- $.map(params.slice(1), function(name) {
- var arr, key;
- if (~name.indexOf('=')) {
- queryString += '&' + name;
- } else {
- arr = name.split(':');
- name = trim(arr[0]);
- key = trim(arr[1]) || name;
- data[ name ] = me.$el.find( _key2selector(key) ).val();
- }
- });
- }
- data = $.param(data) + queryString;
- if (!me.must && rule.data && rule.data === data) {
- return rule.result;
- }
-
- if (rType !== 'cors' && /^https?:/.test(url) && !~url.indexOf(location.host)) {
- dataType = 'jsonp';
- }
-
- return $.ajax({
- url: url,
- type: type,
- data: data,
- dataType: dataType
- });
- },
-
- filter: function(element, params) {
- var value = this.value,
- temp = value.replace( params ? (new RegExp("[" + params[0] + "]", "gm")) : rUnsafe, '' );
- if (temp !== value) this.setValue(temp);
- }
- });
-
- Validator.config = function(key, value) {
- if (isObject(key)) {
- $.each(key, _config);
- }
- else if (isString(key)) {
- _config(key, value);
- }
- function _config(k, o) {
- if (k === 'rules') {
- new Rules(o);
- }
- else if (k === 'messages') {
- new Messages(o);
- }
- else if (k in fieldDefaults) {
- fieldDefaults[k] = o;
- }
- else {
- defaults[k] = o;
- }
- }
- };
-
- Validator.setTheme = function(name, obj) {
- if ( isObject(name) ) {
- $.extend(true, themes, name);
- }
- else if ( isString(name) && isObject(obj) ) {
- themes[name] = $.extend(themes[name], obj);
- }
- };
-
- Validator.load = function(str) {
- if (!str) return;
- var doc = document,
- params = {},
- node = doc.scripts[0],
- dir, el, ONLOAD;
- str.replace(/([^?=&]+)=([^&#]*)/g, function(m, key, value){
- params[key] = value;
- });
- dir = params.dir || Validator.dir;
- if (!Validator.css && params.css !== '') {
- el = doc.createElement('link');
- el.rel = 'stylesheet';
- el.href = Validator.css = dir + 'jquery.validator.css';
- node.parentNode.insertBefore(el, node);
- }
- if (!Validator.local && ~str.indexOf('local') && params.local !== '') {
- Validator.local = (params.local || doc.documentElement.lang || 'en').replace('_','-');
- Validator.pending = 1;
- el = doc.createElement('script');
- el.src = dir + 'local/' + Validator.local + '.js';
- ONLOAD = 'onload' in el ? 'onload' : 'onreadystatechange';
- el[ONLOAD] = function() {
- if (!el.readyState || /loaded|complete/.test(el.readyState)) {
- el = el[ONLOAD] = null;
- delete Validator.pending;
- $(window).triggerHandler('validatorready');
- }
- };
- node.parentNode.insertBefore(el, node);
- }
- };
-
- (function(){
- var scripts = document.scripts,
- i = scripts.length, node, arr,
- re = /(.*validator(?:\.min)?.js)(\?.*(?:local|css|dir)(?:=[\w\-]*)?)?/;
- while (i-- && !arr) {
- node = scripts[i];
- arr = (node.hasAttribute ? node.src : node.getAttribute('src',4)||'').match(re);
- }
- if (!arr) return;
- Validator.dir = arr[1].split('/').slice(0, -1).join('/')+'/';
- Validator.load(arr[2]);
- })();
- return $[NS] = Validator;
- }));
- (function(factory) {
- typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
- typeof define === 'function' && define.amd ? define('validator-lang',['jquery'], factory) :
- factory(jQuery);
- }(function($) {
-
- $.validator.config({
-
-
-
-
-
- rules: {
- digits: [/^\d+$/, "请填写数字"]
- ,letters: [/^[a-z]+$/i, "请填写字母"]
- ,date: [/^\d{4}-\d{2}-\d{2}$/, "请填写有效的日期,格式:yyyy-mm-dd"]
- ,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请填写有效的时间,00:00到23:59之间"]
- ,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "请填写有效的邮箱"]
- ,url: [/^(https?|s?ftp):\/\/\S+$/i, "请填写有效的网址"]
- ,qq: [/^[1-9]\d{4,}$/, "请填写有效的QQ号"]
- ,IDcard: [/^\d{6}(19|2\d)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)?$/, "请填写正确的身份证号码"]
- ,tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "请填写有效的电话号码"]
- ,mobile: [/^1[3-9]\d{9}$/, "请填写有效的手机号"]
- ,zipcode: [/^\d{6}$/, "请检查邮政编码格式"]
- ,chinese: [/^[\u0391-\uFFE5]+$/, "请填写中文字符"]
- ,username: [/^\w{3,12}$/, "请填写3-12位数字、字母、下划线"]
- ,password: [/^[\S]{6,16}$/, "请填写6-16位字符,不能包含空格"]
- ,accept: function (element, params){
- if (!params) return true;
- var ext = params[0],
- value = $(element).val();
- return (ext === '*') ||
- (new RegExp(".(?:" + ext + ")$", "i")).test(value) ||
- this.renderMsg("只接受{1}后缀的文件", ext.replace(/\|/g, ','));
- }
-
- },
-
- messages: {
- 0: "此处",
- fallback: "{0}格式不正确",
- loading: "正在验证...",
- error: "网络异常",
- timeout: "请求超时",
- required: "{0}不能为空",
- remote: "{0}已被使用",
- integer: {
- '*': "请填写整数",
- '+': "请填写正整数",
- '+0': "请填写正整数或0",
- '-': "请填写负整数",
- '-0': "请填写负整数或0"
- },
- match: {
- eq: "{0}与{1}不一致",
- neq: "{0}与{1}不能相同",
- lt: "{0}必须小于{1}",
- gt: "{0}必须大于{1}",
- lte: "{0}不能大于{1}",
- gte: "{0}不能小于{1}"
- },
- range: {
- rg: "请填写{1}到{2}的数",
- gte: "请填写不小于{1}的数",
- lte: "请填写最大{1}的数",
- gtlt: "请填写{1}到{2}之间的数",
- gt: "请填写大于{1}的数",
- lt: "请填写小于{1}的数"
- },
- checked: {
- eq: "请选择{1}项",
- rg: "请选择{1}到{2}项",
- gte: "请至少选择{1}项",
- lte: "请最多选择{1}项"
- },
- length: {
- eq: "请填写{1}个字符",
- rg: "请填写{1}到{2}个字符",
- gte: "请至少填写{1}个字符",
- lte: "请最多填写{1}个字符",
- eq_2: "",
- rg_2: "",
- gte_2: "",
- lte_2: ""
- }
- }
- });
-
- var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
- $.validator.setTheme({
- 'simple_right': {
- formClass: 'n-simple',
- msgClass: 'n-right'
- },
- 'simple_bottom': {
- formClass: 'n-simple',
- msgClass: 'n-bottom'
- },
- 'yellow_top': {
- formClass: 'n-yellow',
- msgClass: 'n-top',
- msgArrow: TPL_ARROW
- },
- 'yellow_right': {
- formClass: 'n-yellow',
- msgClass: 'n-right',
- msgArrow: TPL_ARROW
- },
- 'yellow_right_effect': {
- formClass: 'n-yellow',
- msgClass: 'n-right',
- msgArrow: TPL_ARROW,
- msgShow: function($msgbox, type){
- var $el = $msgbox.children();
- if ($el.is(':animated')) return;
- if (type === 'error') {
- $el.css({left: '20px', opacity: 0})
- .delay(100).show().stop()
- .animate({left: '-4px', opacity: 1}, 150)
- .animate({left: '3px'}, 80)
- .animate({left: 0}, 80);
- } else {
- $el.css({left: 0, opacity: 1}).fadeIn(200);
- }
- },
- msgHide: function($msgbox, type){
- var $el = $msgbox.children();
- $el.stop().delay(100).show()
- .animate({left: '20px', opacity: 0}, 300, function(){
- $msgbox.hide();
- });
- }
- }
- });
- }));
- define('validator',['validator-core', 'validator-lang'], function (Validator, undefined) {
- return Validator;
- });
- define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, Upload, Validator) {
- var Form = {
- config: {
- 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%>" size="30" /> <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>'
- },
- events: {
- validator: function (form, success, error, submit) {
- if (!form.is("form"))
- return;
-
- form.validator($.extend({
- validClass: 'has-success',
- invalidClass: 'has-error',
- bindClassTo: '.form-group',
- formClass: 'n-default n-bootstrap',
- msgClass: 'n-right',
- stopOnError: true,
- display: function (elem) {
- return $(elem).closest('.form-group').find(".control-label").text().replace(/\:/, '');
- },
- dataFilter: function (data) {
- if (data.code === 1) {
- return "";
- } else {
- return data.msg;
- }
- },
- target: function (input) {
- var target = $(input).data("target");
- if (target && $(target).size() > 0) {
- return $(target);
- }
- var $formitem = $(input).closest('.form-group'),
- $msgbox = $formitem.find('span.msg-box');
- if (!$msgbox.length) {
- return [];
- }
- return $msgbox;
- },
- valid: function (ret) {
- var that = this, submitBtn = $(".layer-footer [type=submit]", form);
- that.holdSubmit();
- $(".layer-footer [type=submit]", form).addClass("disabled");
-
- Form.api.submit($(ret), function (data, ret) {
- that.holdSubmit(false);
- submitBtn.removeClass("disabled");
- if (false === $(this).triggerHandler("success.form", [data, ret])) {
- return false;
- }
- if (typeof success === 'function') {
- if (false === success.call($(this), data, ret)) {
- return false;
- }
- }
-
- var msg = ret.hasOwnProperty("msg") && ret.msg !== "" ? ret.msg : __('Operation completed');
- parent.Toastr.success(msg);
- parent.$(".btn-refresh").trigger("click");
- var index = parent.Layer.getFrameIndex(window.name);
- parent.Layer.close(index);
- return false;
- }, function (data, ret) {
- that.holdSubmit(false);
- if (false === $(this).triggerHandler("error.form", [data, ret])) {
- return false;
- }
- submitBtn.removeClass("disabled");
- if (typeof error === 'function') {
- if (false === error.call($(this), data, ret)) {
- return false;
- }
- }
- }, submit);
- return false;
- }
- }, form.data("validator-options") || {}));
-
- $(".layer-footer [type=submit],.fixed-footer [type=submit],.normal-footer [type=submit]", form).removeClass("disabled");
- },
- selectpicker: function (form) {
-
- if ($(".selectpicker", form).size() > 0) {
- require(['bootstrap-select', 'bootstrap-select-lang'], function () {
- $('.selectpicker', form).selectpicker();
- });
- }
- },
- selectpage: function (form) {
-
- if ($(".selectpage", form).size() > 0) {
- require(['selectpage'], function () {
- $('.selectpage', form).selectPage({
- eAjaxSuccess: function (data) {
- data.list = typeof data.rows !== 'undefined' ? data.rows : (typeof data.list !== 'undefined' ? data.list : []);
- data.totalRow = typeof data.total !== 'undefined' ? data.total : (typeof data.totalRow !== 'undefined' ? data.totalRow : data.list.length);
- return data;
- }
- });
- });
-
- $(document).on("change", ".sp_hidden", function () {
- $(this).trigger("validate");
- });
- $(document).on("change", ".sp_input", function () {
- $(this).closest(".sp_container").find(".sp_hidden").trigger("change");
- });
- $(form).on("reset", function () {
- setTimeout(function () {
- $('.selectpage', form).selectPageClear();
- }, 1);
- });
- }
- },
- cxselect: function (form) {
-
- if ($("[data-toggle='cxselect']", form).size() > 0) {
- require(['cxselect'], function () {
- $.cxSelect.defaults.jsonName = 'name';
- $.cxSelect.defaults.jsonValue = 'value';
- $.cxSelect.defaults.jsonSpace = 'data';
- $("[data-toggle='cxselect']", form).cxSelect();
- });
- }
- },
- citypicker: function (form) {
-
- if ($("[data-toggle='city-picker']", form).size() > 0) {
- require(['citypicker'], function () {
- });
- }
- },
- datetimepicker: function (form) {
-
- if ($(".datetimepicker", form).size() > 0) {
- require(['bootstrap-datetimepicker'], function () {
- var options = {
- format: 'YYYY-MM-DD HH:mm:ss',
- icons: {
- time: 'fa fa-clock-o',
- date: 'fa fa-calendar',
- up: 'fa fa-chevron-up',
- down: 'fa fa-chevron-down',
- previous: 'fa fa-chevron-left',
- next: 'fa fa-chevron-right',
- today: 'fa fa-history',
- clear: 'fa fa-trash',
- close: 'fa fa-remove'
- },
- showTodayButton: true,
- showClose: true
- };
- $('.datetimepicker', form).parent().css('position', 'relative');
- $('.datetimepicker', form).datetimepicker(options);
- });
- }
- },
- daterangepicker: function (form) {
-
- if ($(".datetimerange", form).size() > 0) {
- require(['bootstrap-daterangepicker'], function () {
- var ranges = {};
- ranges[__('Today')] = [Moment().startOf('day'), Moment().endOf('day')];
- ranges[__('Yesterday')] = [Moment().subtract(1, 'days').startOf('day'), Moment().subtract(1, 'days').endOf('day')];
- ranges[__('Last 7 Days')] = [Moment().subtract(6, 'days').startOf('day'), Moment().endOf('day')];
- ranges[__('Last 30 Days')] = [Moment().subtract(29, 'days').startOf('day'), Moment().endOf('day')];
- ranges[__('This Month')] = [Moment().startOf('month'), Moment().endOf('month')];
- ranges[__('Last Month')] = [Moment().subtract(1, 'month').startOf('month'), Moment().subtract(1, 'month').endOf('month')];
- var options = {
- timePicker: false,
- autoUpdateInput: false,
- timePickerSeconds: true,
- timePicker24Hour: true,
- autoApply: true,
- locale: {
- format: 'YYYY-MM-DD HH:mm:ss',
- customRangeLabel: __("Custom Range"),
- applyLabel: __("Apply"),
- cancelLabel: __("Clear"),
- },
- ranges: ranges,
- };
- var origincallback = function (start, end) {
- $(this.element).val(start.format(options.locale.format) + " - " + end.format(options.locale.format));
- $(this.element).trigger('blur');
- };
- $(".datetimerange", form).each(function () {
- var callback = typeof $(this).data('callback') == 'function' ? $(this).data('callback') : origincallback;
- $(this).on('apply.daterangepicker', function (ev, picker) {
- callback.call(picker, picker.startDate, picker.endDate);
- });
- $(this).on('cancel.daterangepicker', function (ev, picker) {
- $(this).val('').trigger('blur');
- });
- $(this).daterangepicker($.extend({}, options, $(this).data()), callback);
- });
- });
- }
- },
- plupload: function (form) {
-
- if ($(".plupload", form).size() > 0) {
- Upload.api.plupload($(".plupload", form));
- }
- },
- faselect: function (form) {
-
- if ($(".fachoose", form).size() > 0) {
- $(".fachoose", form).on('click', function () {
- var that = this;
- var multiple = $(this).data("multiple") ? $(this).data("multiple") : false;
- var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : '';
- parent.Fast.api.open("general/attachment/select?element_id=" + $(this).attr("id") + "&multiple=" + multiple + "&mimetype=" + mimetype, __('Choose'), {
- callback: function (data) {
- var button = $("#" + $(that).attr("id"));
- var maxcount = $(button).data("maxcount");
- var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
- maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
- if (input_id && data.multiple) {
- var urlArr = [];
- var inputObj = $("#" + input_id);
- var value = $.trim(inputObj.val());
- if (value !== "") {
- urlArr.push(inputObj.val());
- }
- urlArr.push(data.url)
- var result = urlArr.join(",");
- if (maxcount > 0) {
- var nums = value === '' ? 0 : value.split(/\,/).length;
- var files = data.url !== "" ? data.url.split(/\,/) : [];
- var remains = maxcount - nums;
- if (files.length > remains) {
- Toastr.error(__('You can choose up to %d file%s', remains));
- return false;
- }
- }
- inputObj.val(result).trigger("change");
- } else {
- $("#" + input_id).val(data.url).trigger("change");
- }
- }
- });
- return false;
- });
- }
- },
- fieldlist: function (form) {
-
- if ($(".fieldlist", form).size() > 0) {
- require(['dragsort', 'template'], function (undefined, Template) {
-
- var refresh = function (name) {
- var data = {};
- var textarea = $("textarea[name='" + name + "']", form);
- var container = textarea.closest("dl");
- var template = container.data("template");
- console.log(name, container);
- $.each($("input,select", container).serializeArray(), function (i, j) {
- var reg = /\[(\w+)\]\[(\w+)\]$/g;
- var match = reg.exec(j.name);
- if (!match)
- return true;
- match[1] = "x" + parseInt(match[1]);
- if (typeof data[match[1]] == 'undefined') {
- data[match[1]] = {};
- }
- data[match[1]][match[2]] = j.value;
- });
- var result = template ? [] : {};
- $.each(data, function (i, j) {
- if (j) {
- if (!template) {
- if (j.key != '') {
- result[j.key] = j.value;
- }
- } else {
- result.push(j);
- }
- }
- });
- textarea.val(JSON.stringify(result));
- };
-
- $(document).on('change keyup', ".fieldlist input,.fieldlist textarea,.fieldlist select", function () {
- refresh($(this).closest("dl").data("name"));
- });
-
- $(".fieldlist", form).on("click", ".btn-append,.append", function (e, row) {
- var container = $(this).closest("dl");
- var index = container.data("index");
- var name = container.data("name");
- var template = container.data("template");
- var data = container.data();
- index = index ? parseInt(index) : 0;
- container.data("index", index + 1);
- var row = row ? row : {};
- var vars = {index: index, name: name, data: data, row: row};
- var html = template ? Template(template, vars) : Template.render(Form.config.fieldlisttpl, vars);
- $(html).insertBefore($(this).closest("dd"));
- $(this).trigger("fa.event.appendfieldlist", $(this).closest("dd").prev());
- });
-
- $(".fieldlist", form).on("click", "dd .btn-remove", function () {
- var container = $(this).closest("dl");
- $(this).closest("dd").remove();
- refresh(container.data("name"));
- });
-
- $("dl.fieldlist", form).dragsort({
- itemSelector: 'dd',
- dragSelector: ".btn-dragsort",
- dragEnd: function () {
- refresh($(this).closest("dl").data("name"));
- },
- placeHolderTemplate: "<dd></dd>"
- });
-
- $(".fieldlist", form).each(function () {
- var container = this;
- var textarea = $("textarea[name='" + $(this).data("name") + "']", form);
- if (textarea.val() == '') {
- return true;
- }
- var template = $(this).data("template");
- var json = {};
- try {
- json = JSON.parse(textarea.val());
- } catch (e) {
- }
- $.each(json, function (i, j) {
- $(".btn-append,.append", container).trigger('click', template ? j : {
- key: i,
- value: j
- });
- });
- });
- });
- }
- },
- bindevent: function (form) {
- }
- },
- api: {
- submit: function (form, success, error, submit) {
- if (form.size() === 0)
- return Toastr.error("表单未初始化完成,无法提交");
- if (typeof submit === 'function') {
- if (false === submit.call(form)) {
- return false;
- }
- }
- var type = form.attr("method").toUpperCase();
- type = type && (type === 'GET' || type === 'POST') ? type : 'GET';
- url = form.attr("action");
- url = url ? url : location.href;
-
- var params = {};
- var multipleList = $("[name$='[]']", form);
- if (multipleList.size() > 0) {
- var postFields = form.serializeArray().map(function (obj) {
- return $(obj).prop("name");
- });
- $.each(multipleList, function (i, j) {
- if (postFields.indexOf($(this).prop("name")) < 0) {
- params[$(this).prop("name")] = '';
- }
- });
- }
-
- Fast.api.ajax({
- type: type,
- url: url,
- data: form.serialize() + (Object.keys(params).length > 0 ? '&' + $.param(params) : ''),
- dataType: 'json',
- complete: function (xhr) {
- var token = xhr.getResponseHeader('__token__');
- if (token) {
- $("input[name='__token__']", form).val(token);
- }
- }
- }, function (data, ret) {
- $('.form-group', form).removeClass('has-feedback has-success has-error');
- if (data && typeof data === 'object') {
-
- if (typeof data.token !== 'undefined') {
- $("input[name='__token__']", form).val(data.token);
- }
-
- if (typeof data.callback !== 'undefined' && typeof data.callback === 'function') {
- data.callback.call(form, data);
- }
- }
- if (typeof success === 'function') {
- if (false === success.call(form, data, ret)) {
- return false;
- }
- }
- }, function (data, ret) {
- if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
- $("input[name='__token__']", form).val(data.token);
- }
- if (typeof error === 'function') {
- if (false === error.call(form, data, ret)) {
- return false;
- }
- }
- });
- return false;
- },
- bindevent: function (form, success, error, submit) {
- form = typeof form === 'object' ? form : $(form);
- var events = Form.events;
- events.bindevent(form);
- events.validator(form, success, error, submit);
- events.selectpicker(form);
- events.daterangepicker(form);
- events.selectpage(form);
- events.cxselect(form);
- events.citypicker(form);
- events.datetimepicker(form);
- events.plupload(form);
- events.faselect(form);
- events.fieldlist(form);
- },
- custom: {}
- },
- };
- return Form;
- });
- !function ($) {
- 'use strict';
- var ColumnsForSearch = [];
- var sprintf = $.fn.bootstrapTable.utils.sprintf;
- var initCommonSearch = function (pColumns, that) {
- var vFormCommon = createFormCommon(pColumns, that);
- var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden");
- vModal += vFormCommon;
- vModal += "</div>";
- that.$container.prepend($(vModal));
- that.$commonsearch = $(".commonsearch-table", that.$container);
- var form = $("form.form-commonsearch", that.$commonsearch);
- require(['form'], function (Form) {
- Form.api.bindevent(form);
- form.validator("destroy");
- });
-
- form.on("submit", function (event) {
- event.preventDefault();
- that.onCommonSearch();
- return false;
- });
-
- form.on("click", "button[type=reset]", function (event) {
- form[0].reset();
- that.onCommonSearch();
- });
- };
- var createFormCommon = function (pColumns, that) {
-
- if (that.options.searchFormTemplate) {
- return Template(that.options.searchFormTemplate, {columns: pColumns, table: that});
- }
- var htmlForm = [];
- htmlForm.push(sprintf('<form class="form-horizontal form-commonsearch" novalidate method="post" action="%s" >', that.options.actionForm));
- htmlForm.push('<fieldset>');
- if (that.options.titleForm.length > 0)
- htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
- htmlForm.push('<div class="row">');
- for (var i in pColumns) {
- var vObjCol = pColumns[i];
- if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
- var query = Backend.api.query(vObjCol.field);
- var operate = Backend.api.query(vObjCol.field + "-operate");
- vObjCol.defaultValue = that.options.renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue);
- vObjCol.operate = that.options.renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate);
- ColumnsForSearch.push(vObjCol);
- htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
- htmlForm.push(sprintf('<label for="%s" class="control-label col-xs-4">%s</label>', vObjCol.field, vObjCol.title));
- htmlForm.push('<div class="col-xs-8">');
- vObjCol.operate = vObjCol.operate ? vObjCol.operate.toUpperCase() : '=';
- 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));
- var addClass = typeof vObjCol.addClass === 'undefined' ? (typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass) : 'form-control ' + vObjCol.addClass;
- var extend = typeof vObjCol.extend === 'undefined' ? '' : vObjCol.extend;
- var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style);
- extend = typeof vObjCol.data !== 'undefined' && extend == '' ? vObjCol.data : extend;
- if (vObjCol.searchList) {
- if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') {
- htmlForm.push(sprintf('<select class="%s" name="%s" %s %s>%s</select>', addClass, vObjCol.field, style, extend, sprintf('<option value="">%s</option>', that.options.formatCommonChoose())));
- (function (vObjCol, that) {
- $.when(vObjCol.searchList).done(function (ret) {
- var isArray = false;
- if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) {
- var resultlist = {};
- $.each(ret.data.searchlist, function (key, value) {
- resultlist[value.id] = value.name;
- });
- } else if (ret.constructor === Array || ret.constructor === Object) {
- var resultlist = ret;
- isArray = ret.constructor === Array ? true : isArray;
- }
- var optionList = [];
- $.each(resultlist, function (key, value) {
- var isSelect = (isArray ? value : key) == vObjCol.defaultValue ? 'selected' : '';
- optionList.push(sprintf("<option value='" + (isArray ? value : key) + "' %s>" + value + "</option>", isSelect));
- });
- $("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).append(optionList.join(''));
- });
- })(vObjCol, that);
- } else if (typeof vObjCol.searchList == 'function') {
- htmlForm.push(vObjCol.searchList.call(this, vObjCol));
- } else {
- var isArray = vObjCol.searchList.constructor === Array;
- var searchList = [];
- searchList.push(sprintf('<option value="">%s</option>', that.options.formatCommonChoose()));
- $.each(vObjCol.searchList, function (key, value) {
- var isSelect = (isArray ? value : key) == vObjCol.defaultValue ? 'selected' : '';
- searchList.push(sprintf("<option value='" + (isArray ? value : key) + "' %s>" + value + "</option>", isSelect));
- });
- htmlForm.push(sprintf('<select class="%s" name="%s" %s %s>%s</select>', addClass, vObjCol.field, style, extend, searchList.join('')));
- }
- } else {
- var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder;
- var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type;
- var defaultValue = typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue;
- if (/BETWEEN$/.test(vObjCol.operate)) {
- var defaultValueArr = defaultValue.toString().match(/\|/) ? defaultValue.split('|') : ['', ''];
- var placeholderArr = placeholder.toString().match(/\|/) ? placeholder.split('|') : [placeholder, placeholder];
- htmlForm.push('<div class="row row-between">');
- htmlForm.push(sprintf('<div class="col-xs-6"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s></div>', type, addClass, vObjCol.field, defaultValueArr[0], placeholderArr[0], vObjCol.field, i, style, extend));
- htmlForm.push(sprintf('<div class="col-xs-6"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s></div>', type, addClass, vObjCol.field, defaultValueArr[1], placeholderArr[1], vObjCol.field, i, style, extend));
- htmlForm.push('</div>');
- } else {
- 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));
- }
- }
- htmlForm.push('</div>');
- htmlForm.push('</div>');
- }
- }
- htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
- htmlForm.push(createFormBtn(that).join(''));
- htmlForm.push('</div>');
- htmlForm.push('</div>');
- htmlForm.push('</fieldset>');
- htmlForm.push('</form>');
- return htmlForm.join('');
- };
- var createFormBtn = function (that) {
- var htmlBtn = [];
- var searchSubmit = that.options.formatCommonSubmitButton();
- var searchReset = that.options.formatCommonResetButton();
- htmlBtn.push('<div class="col-sm-8 col-xs-offset-4">');
- htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" formnovalidate>%s</button> ', searchSubmit));
- htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
- htmlBtn.push('</div>');
- return htmlBtn;
- };
- var isSearchAvailble = function (that) {
-
- if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) {
- return false;
- }
- return true;
- };
- var getSearchQuery = function (that, removeempty) {
- var op = {};
- var filter = {};
- var value = '';
- $("form.form-commonsearch .operate", that.$commonsearch).each(function (i) {
- var name = $(this).data("name");
- var sym = $(this).is("select") ? $("option:selected", this).val() : $(this).val().toUpperCase();
- var obj = $("[name='" + name + "']", that.$commonsearch);
- if (obj.size() == 0)
- return true;
- var vObjCol = ColumnsForSearch[i];
- if (obj.size() > 1) {
- if (/BETWEEN$/.test(sym)) {
- var value_begin = $.trim($("[name='" + name + "']:first", that.$commonsearch).val()),
- value_end = $.trim($("[name='" + name + "']:last", that.$commonsearch).val());
- if (value_begin.length || value_end.length) {
- if (typeof vObjCol.process === 'function') {
- value_begin = vObjCol.process(value_begin, 'begin');
- value_end = vObjCol.process(value_end, 'end');
- }
- value = value_begin + ',' + value_end;
- } else {
- value = '';
- }
-
- if ($("[name='" + name + "']:first", that.$commonsearch).hasClass("datetimepicker")) {
- sym = 'RANGE';
- }
- } else {
- value = $("[name='" + name + "']:checked", that.$commonsearch).val();
- value = (vObjCol && typeof vObjCol.process === 'function') ? vObjCol.process(obj.val()) : obj.val();
- }
- } else {
- value = (vObjCol && typeof vObjCol.process === 'function') ? vObjCol.process(obj.val()) : obj.val();
- }
- if (removeempty && (value == '' || value == null || ($.isArray(value) && value.length == 0)) && !sym.match(/null/i)) {
- return true;
- }
- op[name] = sym;
- filter[name] = value;
- });
- return {op: op, filter: filter};
- };
- var getQueryParams = function (params, searchQuery, removeempty) {
- params.filter = typeof params.filter === 'Object' ? params.filter : (params.filter ? JSON.parse(params.filter) : {});
- params.op = typeof params.op === 'Object' ? params.op : (params.op ? JSON.parse(params.op) : {});
- params.filter = $.extend({}, params.filter, searchQuery.filter);
- params.op = $.extend({}, params.op, searchQuery.op);
-
- if (removeempty) {
- $.each(params.filter, function (i, j) {
- if ((j == '' || j == null || ($.isArray(j) && j.length == 0)) && !params.op[i].match(/null/i)) {
- delete params.filter[i];
- delete params.op[i];
- }
- });
- }
- params.filter = JSON.stringify(params.filter);
- params.op = JSON.stringify(params.op);
- return params;
- };
- $.extend($.fn.bootstrapTable.defaults, {
- commonSearch: false,
- titleForm: "Common search",
- actionForm: "",
- searchFormTemplate: "",
- searchFormVisible: true,
- searchClass: 'searchit',
- showSearch: true,
- renderDefault: true,
- onCommonSearch: function (field, text) {
- return false;
- },
- onPostCommonSearch: function (table) {
- return false;
- }
- });
- $.extend($.fn.bootstrapTable.defaults.icons, {
- commonSearchIcon: 'glyphicon-search'
- });
- $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
- 'common-search.bs.table': 'onCommonSearch',
- 'post-common-search.bs.table': 'onPostCommonSearch'
- });
- $.extend($.fn.bootstrapTable.locales[$.fn.bootstrapTable.defaults.locale], {
- formatCommonSearch: function () {
- return "Common search";
- },
- formatCommonSubmitButton: function () {
- return "Submit";
- },
- formatCommonResetButton: function () {
- return "Reset";
- },
- formatCommonCloseButton: function () {
- return "Close";
- },
- formatCommonChoose: function () {
- return "Choose";
- }
- });
- $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
- var BootstrapTable = $.fn.bootstrapTable.Constructor,
- _initHeader = BootstrapTable.prototype.initHeader,
- _initToolbar = BootstrapTable.prototype.initToolbar,
- _load = BootstrapTable.prototype.load,
- _initSearch = BootstrapTable.prototype.initSearch;
- BootstrapTable.prototype.initHeader = function () {
- _initHeader.apply(this, Array.prototype.slice.apply(arguments));
- this.$header.find('th[data-field]').each(function (i) {
- var column = $(this).data();
- if (typeof column['width'] !== 'undefined') {
- $(this).css("min-width", column['width']);
- }
- });
- };
- BootstrapTable.prototype.initToolbar = function () {
- _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
- if (!isSearchAvailble(this)) {
- return;
- }
- var that = this,
- html = [];
- if(that.options.showSearch){
- html.push(sprintf('<div class="columns-%s pull-%s" style="margin-top:10px;margin-bottom:10px;">', this.options.buttonsAlign, this.options.buttonsAlign));
- 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()));
- html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.commonSearchIcon))
- html.push('</button></div>');
- }
- if (that.$toolbar.find(".pull-right").size() > 0) {
- $(html.join('')).insertBefore(that.$toolbar.find(".pull-right:first"));
- } else {
- that.$toolbar.append(html.join(''));
- }
- initCommonSearch(that.columns, that);
- that.$toolbar.find('button[name="commonSearch"]')
- .off('click').on('click', function () {
- that.$commonsearch.toggleClass("hidden");
- return;
- });
- that.$container.on("click", "." + that.options.searchClass, function () {
- var obj = $("form [name='" + $(this).data("field") + "']", that.$commonsearch);
- if (obj.size() > 0) {
- obj.val($(this).data("value"));
- $("form", that.$commonsearch).trigger("submit");
- }
- });
- var queryParams = that.options.queryParams;
-
- this.options.queryParams = function (params) {
- return queryParams(getQueryParams(params, getSearchQuery(that, true)));
- };
- this.trigger('post-common-search', that);
- };
- BootstrapTable.prototype.onCommonSearch = function () {
- var searchQuery = getSearchQuery(this);
- this.trigger('common-search', this, searchQuery);
- this.options.pageNumber = 1;
- this.refresh({});
- };
- BootstrapTable.prototype.load = function (data) {
- _load.apply(this, Array.prototype.slice.apply(arguments));
- if (!isSearchAvailble(this)) {
- return;
- }
- };
- BootstrapTable.prototype.initSearch = function () {
- _initSearch.apply(this, Array.prototype.slice.apply(arguments));
- if (!isSearchAvailble(this)) {
- return;
- }
- var that = this;
- var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
- this.data = fp ? $.grep(this.data, function (item, i) {
- for (var key in fp) {
- var fval = fp[key].toLowerCase();
- var value = item[key];
- value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
- that.header.formatters[$.inArray(key, that.header.fields)],
- [value, item, i], value);
- if (!($.inArray(key, that.header.fields) !== -1 &&
- (typeof value === 'string' || typeof value === 'number') &&
- (value + '').toLowerCase().indexOf(fval) !== -1)) {
- return false;
- }
- }
- return true;
- }) : this.data;
- };
- }(jQuery);
- define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) {
- return function () {
- var ret, fn;
- return ret || global.$.fn.bootstrapTable.defaults;
- };
- }(this)));
- !function ($) {
- 'use strict';
- $.extend($.fn.bootstrapTable.defaults, {
-
- templateView: false,
-
- templateFormatter: "itemtpl",
-
- templateParentClass: "row row-flex",
-
- templateTableClass: "table-template",
- });
- var BootstrapTable = $.fn.bootstrapTable.Constructor,
- _initContainer = BootstrapTable.prototype.initContainer,
- _initBody = BootstrapTable.prototype.initBody,
- _initRow = BootstrapTable.prototype.initRow;
- BootstrapTable.prototype.initContainer = function () {
- _initContainer.apply(this, Array.prototype.slice.apply(arguments));
- var that = this;
- if (!that.options.templateView) {
- return;
- }
- that.options.cardView = true;
- };
- BootstrapTable.prototype.initBody = function () {
- var that = this;
- $.extend(that.options, {
- showHeader: !that.options.templateView ? $.fn.bootstrapTable.defaults.showHeader : false,
- showFooter: !that.options.templateView ? $.fn.bootstrapTable.defaults.showFooter : false,
- });
- $(that.$el).toggleClass(that.options.templateTableClass, that.options.templateView);
- _initBody.apply(this, Array.prototype.slice.apply(arguments));
- if (!that.options.templateView) {
- return;
- } else {
-
- $("> *:not(.no-records-found)", that.$body).wrapAll($("<div />").addClass(that.options.templateParentClass));
- }
- };
- BootstrapTable.prototype.initRow = function (item, i, data, parentDom) {
- var that = this;
-
- if (!that.options.templateView) {
- return _initRow.apply(that, Array.prototype.slice.apply(arguments));
- }
- var $content = '';
- if (typeof that.options.templateFormatter === 'function') {
- $content = that.options.templateFormatter.call(that, item, i, data);
- } else {
- var Template = require('template');
- $content = Template(that.options.templateFormatter, {item: item, i: i, data: data});
- }
- return $content;
- };
- }(jQuery);
- define("bootstrap-table-template", ["bootstrap-table","template"], (function (global) {
- return function () {
- var ret, fn;
- return ret || global.$.fn.bootstrapTable.defaults;
- };
- }(this)));
- define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-export', 'bootstrap-table-commonsearch', 'bootstrap-table-template'], function ($, undefined, Moment) {
- var Table = {
- list: {},
-
- defaults: {
- url: '',
- sidePagination: 'server',
- method: 'get',
- toolbar: ".toolbar",
- search: true,
- cache: false,
- commonSearch: true,
- searchFormVisible: false,
- titleForm: '',
- idTable: 'commonTable',
- showExport: true,
- exportDataType: "all",
- exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
- pageSize: 10,
- pageList: [10, 25, 50, 'All'],
- pagination: true,
- clickToSelect: true,
- singleSelect: false,
- showRefresh: false,
- locale: 'zh-CN',
- showToggle: true,
- showColumns: true,
- pk: 'id',
- sortName: 'id',
- sortOrder: 'desc',
- paginationFirstText: __("First"),
- paginationPreText: __("Previous"),
- paginationNextText: __("Next"),
- paginationLastText: __("Last"),
- cardView: false,
- checkOnInit: true,
- escape: true,
- extend: {
- index_url: '',
- add_url: '',
- edit_url: '',
- del_url: '',
- import_url: '',
- multi_url: '',
- dragsort_url: 'ajax/weigh',
- }
- },
-
- columnDefaults: {
- align: 'center',
- valign: 'middle',
- },
- config: {
- firsttd: 'tbody tr td:first-child:not(:has(div.card-views))',
- toolbar: '.toolbar',
- refreshbtn: '.btn-refresh',
- addbtn: '.btn-add',
- editbtn: '.btn-edit',
- delbtn: '.btn-del',
- importbtn: '.btn-import',
- multibtn: '.btn-multi',
- disabledbtn: '.btn-disabled',
- editonebtn: '.btn-editone',
- dragsortfield: 'weigh',
- },
- api: {
- init: function (defaults, columnDefaults, locales) {
- defaults = defaults ? defaults : {};
- columnDefaults = columnDefaults ? columnDefaults : {};
- locales = locales ? locales : {};
-
- if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
- Table.defaults.cardView = true;
- }
-
- $.extend(true, $.fn.bootstrapTable.defaults, Table.defaults, defaults);
-
- $.extend($.fn.bootstrapTable.columnDefaults, Table.columnDefaults, columnDefaults);
-
- $.extend($.fn.bootstrapTable.locales[Table.defaults.locale], {
- formatCommonSearch: function () {
- return __('Common search');
- },
- formatCommonSubmitButton: function () {
- return __('Submit');
- },
- formatCommonResetButton: function () {
- return __('Reset');
- },
- formatCommonCloseButton: function () {
- return __('Close');
- },
- formatCommonChoose: function () {
- return __('Choose');
- }
- }, locales);
- },
-
- bindevent: function (table) {
-
- var parenttable = table.closest('.bootstrap-table');
-
- var options = table.bootstrapTable('getOptions');
-
- var toolbar = $(options.toolbar, parenttable);
-
- table.on('load-error.bs.table', function (status, res, e) {
- if (e.status === 0) {
- return;
- }
- Toastr.error(__('Unknown data format'));
- });
-
- table.on('refresh.bs.table', function (e, settings, data) {
- $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
- });
-
- table.on('dbl-click-row.bs.table', function (e, row, element, field) {
- $(Table.config.editonebtn, element).trigger("click");
- });
-
- table.on('post-body.bs.table', function (e, settings, json, xhr) {
- $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
- $(Table.config.disabledbtn, toolbar).toggleClass('disabled', true);
- if ($(Table.config.firsttd, table).find("input[type='checkbox'][data-index]").size() > 0) {
-
- require(['drag', 'drop'], function () {
- $(Table.config.firsttd, table).drag("start", function (ev, dd) {
- return $('<div class="selection" />').css('opacity', .65).appendTo(document.body);
- }).drag(function (ev, dd) {
- $(dd.proxy).css({
- top: Math.min(ev.pageY, dd.startY),
- left: Math.min(ev.pageX, dd.startX),
- height: Math.abs(ev.pageY - dd.startY),
- width: Math.abs(ev.pageX - dd.startX)
- });
- }).drag("end", function (ev, dd) {
- $(dd.proxy).remove();
- });
- $(Table.config.firsttd, table).drop("start", function () {
- Table.api.toggleattr(this);
- }).drop(function () {
- Table.api.toggleattr(this);
- }).drop("end", function () {
- Table.api.toggleattr(this);
- });
- $.drop({
- multi: true
- });
- });
- }
- });
-
- table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () {
- var ids = Table.api.selectedids(table);
- $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !ids.length);
- });
-
- $(toolbar).on('click', Table.config.refreshbtn, function () {
- table.bootstrapTable('refresh');
- });
-
- $(toolbar).on('click', Table.config.addbtn, function () {
- var ids = Table.api.selectedids(table);
- var url = options.extend.add_url;
- if (url.indexOf("{ids}") !== -1) {
- url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
- }
- Fast.api.open(url, __('Add'), $(this).data() || {});
- });
-
- if ($(Table.config.importbtn, toolbar).size() > 0) {
- require(['upload'], function (Upload) {
- Upload.api.plupload($(Table.config.importbtn, toolbar), function (data, ret) {
- Fast.api.ajax({
- url: options.extend.import_url,
- data: {file: data.url},
- }, function (data, ret) {
- table.bootstrapTable('refresh');
- });
- });
- });
- }
-
- $(toolbar).on('click', Table.config.editbtn, function () {
- var that = this;
-
- $.each(table.bootstrapTable('getSelections'), function (index, row) {
- var url = options.extend.edit_url;
- row = $.extend({}, row ? row : {}, {ids: row[options.pk]});
- var url = Table.api.replaceurl(url, row, table);
- Fast.api.open(url, __('Edit'), $(that).data() || {});
- });
- });
-
- $(toolbar).on('click', Table.config.multibtn, function () {
- var ids = Table.api.selectedids(table);
- Table.api.multi($(this).data("action"), ids, table, this);
- });
-
- $(toolbar).on('click', Table.config.delbtn, function () {
- var that = this;
- var ids = Table.api.selectedids(table);
- Layer.confirm(
- __('Are you sure you want to delete the %s selected item?', ids.length),
- {icon: 3, title: __('Warning'), offset: 0, shadeClose: true},
- function (index) {
- Table.api.multi("del", ids, table, that);
- Layer.close(index);
- }
- );
- });
-
- require(['dragsort'], function () {
-
- $("tbody", table).dragsort({
- itemSelector: 'tr:visible',
- dragSelector: "a.btn-dragsort",
- dragEnd: function (a, b) {
- var element = $("a.btn-dragsort", this);
- var data = table.bootstrapTable('getData');
- var current = data[parseInt($(this).data("index"))];
- var options = table.bootstrapTable('getOptions');
-
- var ids = $.map($("tbody tr:visible", table), function (tr) {
- return data[parseInt($(tr).data("index"))][options.pk];
- });
- var changeid = current[options.pk];
- var pid = typeof current.pid != 'undefined' ? current.pid : '';
- var params = {
- url: table.bootstrapTable('getOptions').extend.dragsort_url,
- data: {
- ids: ids.join(','),
- changeid: changeid,
- pid: pid,
- field: Table.config.dragsortfield,
- orderway: options.sortOrder,
- table: options.extend.table
- }
- };
- Fast.api.ajax(params, function (data, ret) {
- var success = $(element).data("success") || $.noop;
- if (typeof success === 'function') {
- if (false === success.call(element, data, ret)) {
- return false;
- }
- }
- table.bootstrapTable('refresh');
- }, function () {
- var error = $(element).data("error") || $.noop;
- if (typeof error === 'function') {
- if (false === error.call(element, data, ret)) {
- return false;
- }
- }
- table.bootstrapTable('refresh');
- });
- },
- placeHolderTemplate: ""
- });
- });
- $(table).on("click", "input[data-id][name='checkbox']", function (e) {
- var ids = $(this).data("id");
- var row = Table.api.getrowbyid(table, ids);
- table.trigger('check.bs.table', [row, this]);
- });
- $(table).on("click", "[data-id].btn-change", function (e) {
- e.preventDefault();
- Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this);
- });
- $(table).on("click", "[data-id].btn-edit", function (e) {
- e.preventDefault();
- var ids = $(this).data("id");
- var row = Table.api.getrowbyid(table, ids);
- row.ids = ids;
- var url = Table.api.replaceurl(options.extend.edit_url, row, table);
- Fast.api.open(url, __('Edit'), $(this).data() || {});
- });
- $(table).on("click", "[data-id].btn-del", function (e) {
- e.preventDefault();
- var id = $(this).data("id");
- var that = this;
- Layer.confirm(
- __('Are you sure you want to delete this item?'),
- {icon: 3, title: __('Warning'), shadeClose: true},
- function (index) {
- Table.api.multi("del", id, table, that);
- Layer.close(index);
- }
- );
- });
- var id = table.attr("id");
- Table.list[id] = table;
- return table;
- },
-
- multi: function (action, ids, table, element) {
- var options = table.bootstrapTable('getOptions');
- var data = element ? $(element).data() : {};
- var ids = ($.isArray(ids) ? ids.join(",") : ids);
- var url = typeof data.url !== "undefined" ? data.url : (action == "del" ? options.extend.del_url : options.extend.multi_url);
- url = this.replaceurl(url, {ids: ids}, table);
- var params = typeof data.params !== "undefined" ? (typeof data.params == 'object' ? $.param(data.params) : data.params) : '';
- var options = {url: url, data: {action: action, ids: ids, params: params}};
- Fast.api.ajax(options, function (data, ret) {
- var success = $(element).data("success") || $.noop;
- if (typeof success === 'function') {
- if (false === success.call(element, data, ret)) {
- return false;
- }
- }
- table.bootstrapTable('refresh');
- }, function (data, ret) {
- var error = $(element).data("error") || $.noop;
- if (typeof error === 'function') {
- if (false === error.call(element, data, ret)) {
- return false;
- }
- }
- });
- },
-
- events: {
- operate: {
- 'click .btn-editone': function (e, value, row, index) {
- e.stopPropagation();
- e.preventDefault();
- var table = $(this).closest('table');
- var options = table.bootstrapTable('getOptions');
- var ids = row[options.pk];
- row = $.extend({}, row ? row : {}, {ids: ids});
- var url = options.extend.edit_url;
- Fast.api.open(Table.api.replaceurl(url, row, table), __('Edit'), $(this).data() || {});
- },
- 'click .btn-delone': function (e, value, row, index) {
- e.stopPropagation();
- e.preventDefault();
- var that = this;
- var top = $(that).offset().top - $(window).scrollTop();
- var left = $(that).offset().left - $(window).scrollLeft() - 260;
- if (top + 154 > $(window).height()) {
- top = top - 154;
- }
- if ($(window).width() < 480) {
- top = left = undefined;
- }
- Layer.confirm(
- __('Are you sure you want to delete this item?'),
- {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true},
- function (index) {
- var table = $(that).closest('table');
- var options = table.bootstrapTable('getOptions');
- Table.api.multi("del", row[options.pk], table, that);
- Layer.close(index);
- }
- );
- }
- }
- },
-
- formatter: {
- icon: function (value, row, index) {
- if (!value)
- return '';
- value = value.indexOf(" ") > -1 ? value : "fa fa-" + value;
-
- return '<i class="' + value + '"></i> ' + value;
- },
- image: function (value, row, index) {
- value = value ? value : '/assets/img/blank.gif';
- var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
- return '<img class="' + classname + '" src="' + Fast.api.cdnurl(value) + '" />';
- },
- images: function (value, row, index) {
- value = value === null ? '' : value.toString();
- var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
- var arr = value.split(',');
- var html = [];
- $.each(arr, function (i, value) {
- value = value ? value : '/assets/img/blank.gif';
- html.push('<img class="' + classname + '" src="' + Fast.api.cdnurl(value) + '" />');
- });
- return html.join(' ');
- },
- status: function (value, row, index) {
-
- var colorArr = {normal: 'success', hidden: 'grey', deleted: 'danger', locked: 'info'};
-
- if (typeof this.custom !== 'undefined') {
- colorArr = $.extend(colorArr, this.custom);
- }
- value = value === null ? '' : value.toString();
- var color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
- value = value.charAt(0).toUpperCase() + value.slice(1);
-
- var html = '<span class="text-' + color + '"><i class="fa fa-circle"></i> ' + __(value) + '</span>';
- return html;
- },
- url: function (value, row, index) {
- 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>';
- },
- search: function (value, row, index) {
- return '<a href="javascript:;" class="searchit" data-field="' + this.field + '" data-value="' + value + '">' + value + '</a>';
- },
- addtabs: function (value, row, index) {
- var url = Table.api.replaceurl(this.url, row, this.table);
- var title = this.atitle ? this.atitle : __("Search %s", value);
- return '<a href="' + Fast.api.fixurl(url) + '" class="addtabsit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
- },
- dialog: function (value, row, index) {
- var url = Table.api.replaceurl(this.url, row, this.table);
- var title = this.atitle ? this.atitle : __("View %s", value);
- return '<a href="' + Fast.api.fixurl(url) + '" class="dialogit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
- },
- flag: function (value, row, index) {
- value = value === null ? '' : value.toString();
- var colorArr = {index: 'success', hot: 'warning', recommend: 'danger', 'new': 'info'};
-
- if (typeof this.custom !== 'undefined') {
- colorArr = $.extend(colorArr, this.custom);
- }
- if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
- value = row[this.customField];
- }
-
- var html = [];
- var arr = value.split(',');
- $.each(arr, function (i, value) {
- value = value === null ? '' : value.toString();
- if (value == '')
- return true;
- var color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
- value = value.charAt(0).toUpperCase() + value.slice(1);
- html.push('<span class="label label-' + color + '">' + __(value) + '</span>');
- });
- return html.join(' ');
- },
- label: function (value, row, index) {
- return Table.api.formatter.flag.call(this, value, row, index);
- },
- datetime: function (value, row, index) {
- return value ? Moment(parseInt(value) * 1000).format("YYYY-MM-DD HH:mm:ss") : __('None');
- },
- operate: function (value, row, index) {
- var table = this.table;
-
- var options = table ? table.bootstrapTable('getOptions') : {};
-
- var buttons = $.extend([], this.buttons || []);
- if (options.extend.dragsort_url !== '') {
- buttons.push({
- name: 'dragsort',
- icon: 'fa fa-arrows',
- title: __('Drag to sort'),
- classname: 'btn btn-xs btn-primary btn-dragsort'
- });
- }
- if (options.extend.edit_url !== '') {
- buttons.push({
- name: 'edit',
- icon: 'fa fa-pencil',
- title: __('Edit'),
- classname: 'btn btn-xs btn-success btn-editone',
- url: options.extend.edit_url
- });
- }
- if (options.extend.del_url !== '') {
- buttons.push({
- name: 'del',
- icon: 'fa fa-trash',
- title: __('Del'),
- classname: 'btn btn-xs btn-danger btn-delone'
- });
- }
- return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
- },
- buttons: function (value, row, index) {
-
- var buttons = $.extend([], this.buttons || []);
- return Table.api.buttonlink(this, buttons, value, row, index, 'buttons');
- }
- },
- buttonlink: function (column, buttons, value, row, index, type) {
- var table = column.table;
- type = typeof type === 'undefined' ? 'buttons' : type;
- var options = table ? table.bootstrapTable('getOptions') : {};
- var html = [];
- var hidden, url, classname, icon, text, title, refresh, confirm, extend;
- var fieldIndex = column.fieldIndex;
- $.each(buttons, function (i, j) {
- if (type === 'operate') {
- if (j.name === 'dragsort' && typeof row[Table.config.dragsortfield] === 'undefined') {
- return true;
- }
- if (['add', 'edit', 'del', 'multi', 'dragsort'].indexOf(j.name) > -1 && !options.extend[j.name + "_url"]) {
- return true;
- }
- }
- var attr = table.data(type + "-" + j.name);
- if (typeof attr === 'undefined' || attr) {
- hidden = typeof j.hidden === 'function' ? j.hidden.call(table, row, j) : (j.hidden ? j.hidden : false);
- if (hidden) {
- return true;
- }
- url = j.url ? j.url : '';
- url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
- classname = j.classname ? j.classname : 'btn-primary btn-' + name + 'one';
- icon = j.icon ? j.icon : '';
- text = j.text ? j.text : '';
- title = j.title ? j.title : text;
- refresh = j.refresh ? 'data-refresh="' + j.refresh + '"' : '';
- confirm = j.confirm ? 'data-confirm="' + j.confirm + '"' : '';
- extend = j.extend ? j.extend : '';
- html.push('<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>');
- }
- });
- return html.join(' ');
- },
-
- replaceurl: function (url, row, table) {
- var options = table ? table.bootstrapTable('getOptions') : null;
- var ids = options ? row[options.pk] : 0;
- row.ids = ids ? ids : (typeof row.ids !== 'undefined' ? row.ids : 0);
-
- url = !url.match(/\{ids\}/i) ? url + (url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + '{ids}' : url;
- url = url.replace(/\{(.*?)\}/gi, function (matched) {
- matched = matched.substring(1, matched.length - 1);
- if (matched.indexOf(".") !== -1) {
- var temp = row;
- var arr = matched.split(/\./);
- for (var i = 0; i < arr.length; i++) {
- if (typeof temp[arr[i]] !== 'undefined') {
- temp = temp[arr[i]];
- }
- }
- return typeof temp === 'object' ? '' : temp;
- }
- return row[matched];
- });
- return url;
- },
-
- selectedids: function (table) {
- var options = table.bootstrapTable('getOptions');
- if (options.templateView) {
- return $.map($("input[data-id][name='checkbox']:checked"), function (dom) {
- return $(dom).data("id");
- });
- } else {
- return $.map(table.bootstrapTable('getSelections'), function (row) {
- return row[options.pk];
- });
- }
- },
-
- toggleattr: function (table) {
- $("input[type='checkbox']", table).trigger('click');
- },
-
- getrowdata: function (table, index) {
- index = parseInt(index);
- var data = table.bootstrapTable('getData');
- return typeof data[index] !== 'undefined' ? data[index] : null;
- },
-
- getrowbyindex: function (table, index) {
- return Table.api.getrowdata(table, index);
- },
-
- getrowbyid: function (table, id) {
- var row = {};
- var options = table.bootstrapTable("getOptions");
- $.each(table.bootstrapTable('getData'), function (i, j) {
- if (j[options.pk] == id) {
- row = j;
- return false;
- }
- });
- return row;
- }
- },
- };
- return Table;
- });
- (function($) {
- $.fn.dragsort = function(options) {
- if (options == "destroy") {
- $(this.selector).trigger("dragsort-uninit");
- return;
- }
- var opts = $.extend({}, $.fn.dragsort.defaults, options);
- var lists = [];
- var list = null, lastPos = null;
- this.each(function(i, cont) {
-
- if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody"))
- cont = $(cont).children().get(0);
- var newList = {
- draggedItem: null,
- placeHolderItem: null,
- pos: null,
- offset: null,
- offsetLimit: null,
- scroll: null,
- container: cont,
- init: function() {
-
- opts.tagName = opts.tagName == "" ? ($(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase()) : opts.tagName;
- if (opts.itemSelector == "")
- opts.itemSelector = opts.tagName;
- if (opts.dragSelector == "")
- opts.dragSelector = opts.tagName;
- if (opts.placeHolderTemplate == "")
- opts.placeHolderTemplate = "<" + opts.tagName + "> </" + opts.tagName + ">";
-
- $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit);
- this.styleDragHandlers(true);
- },
- uninit: function() {
- var list = lists[$(this).attr("data-listidx")];
- $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit");
- list.styleDragHandlers(false);
- },
- getItems: function() {
- return $(this.container).children(opts.itemSelector);
- },
- styleDragHandlers: function(cursor) {
- this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : "");
- },
- grabItem: function(e) {
- var list = lists[$(this).attr("data-listidx")];
- var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0);
- var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0;
-
- if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem)
- return;
-
-
-
-
- var dragHandle = e.target;
- while (!$(dragHandle).is(opts.dragSelector)) {
- if (dragHandle == this) return;
- dragHandle = dragHandle.parentNode;
- }
- $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor"));
- $(dragHandle).css("cursor", "move");
-
- var listElem = this;
- var trigger = function() {
- list.dragStart.call(listElem, e);
- $(list.container).unbind("mousemove", trigger);
- };
- $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); });
- },
- dragStart: function(e) {
- if (list != null && list.draggedItem != null)
- list.dropItem();
- list = lists[$(this).attr("data-listidx")];
- list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName)
-
- list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem));
-
- var mt = parseInt(list.draggedItem.css("marginTop"));
- var ml = parseInt(list.draggedItem.css("marginLeft"));
- list.offset = list.draggedItem.offset();
- list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1;
- list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1;
-
- if (!opts.dragBetween) {
- 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();
- list.offsetLimit = $(list.container).offset();
- list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth();
- list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
- }
-
- var h = list.draggedItem.height();
- var w = list.draggedItem.width();
- if (opts.tagName == "tr") {
- list.draggedItem.children().each(function() { $(this).width($(this).width()); });
- list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true);
- list.draggedItem.after(list.placeHolderItem);
-
- list.placeHolderItem.children().each(function() { $(this).html(" "); });
- } else {
- list.draggedItem.after(opts.placeHolderTemplate);
- list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true);
- }
- if (opts.tagName == "td") {
- var listTable = list.draggedItem.closest("table").get(0);
- $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").appendTo("body").children().append(list.draggedItem);
- }
-
- var orig = list.draggedItem.attr("style");
- list.draggedItem.attr("data-origstyle", orig ? orig : "");
- list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w });
-
- list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() };
- list.scroll.scrollY = window.setInterval(function() {
- if (opts.scrollContainer != window) {
- $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY);
- return;
- }
- var t = $(opts.scrollContainer).scrollTop();
- if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) {
- $(opts.scrollContainer).scrollTop(t + list.scroll.moveY);
- list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1);
- }
- }, 10);
- list.scroll.scrollX = window.setInterval(function() {
- if (opts.scrollContainer != window) {
- $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX);
- return;
- }
- var l = $(opts.scrollContainer).scrollLeft();
- if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) {
- $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX);
- list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1);
- }
- }, 10);
-
- $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
- list.setPos(e.pageX, e.pageY);
- $(document).bind("mousemove", list.swapItems);
- $(document).bind("mouseup", list.dropItem);
- if (opts.scrollContainer != window)
- $(window).bind("wheel", list.wheel);
- },
-
- setPos: function(x, y) {
-
- var top = y - this.offset.top;
- var left = x - this.offset.left;
-
- if (!opts.dragBetween) {
- top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
- left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
- }
-
- var parent = this.draggedItem.offsetParent().not("body").offset();
- if (parent != null) {
- top -= parent.top;
- left -= parent.left;
- }
-
- if (opts.scrollContainer == window) {
- y -= $(window).scrollTop();
- x -= $(window).scrollLeft();
- y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5);
- x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5);
- } else {
- var cont = $(opts.scrollContainer);
- var offset = cont.offset();
- y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top);
- x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left);
- }
-
- list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x);
- list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y);
-
- this.draggedItem.css({ top: top, left: left });
- },
-
- wheel: function(e) {
- if (list && opts.scrollContainer != window) {
- var cont = $(opts.scrollContainer);
- var offset = cont.offset();
- e = e.originalEvent;
- if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) {
- var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY;
- cont.scrollTop(cont.scrollTop() + deltaY);
- e.preventDefault();
- }
- }
- },
-
- buildPositionTable: function() {
- var pos = [];
- this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) {
- var loc = $(this).offset();
- loc.right = loc.left + $(this).outerWidth();
- loc.bottom = loc.top + $(this).outerHeight();
- loc.elm = this;
- pos[i] = loc;
- });
- this.pos = pos;
- },
- dropItem: function() {
- if (list.draggedItem == null)
- return;
-
-
- var orig = list.draggedItem.attr("data-origstyle");
- list.draggedItem.attr("style", orig);
- if (orig == "")
- list.draggedItem.removeAttr("style");
- list.draggedItem.removeAttr("data-origstyle");
- list.styleDragHandlers(true);
- list.placeHolderItem.before(list.draggedItem);
- list.placeHolderItem.remove();
- $("[data-droptarget], .dragSortItem").remove();
- window.clearInterval(list.scroll.scrollY);
- window.clearInterval(list.scroll.scrollX);
-
- if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem))
- if (opts.dragEnd.apply(list.draggedItem) == false) {
- var pos = list.draggedItem.attr("data-origpos").split('-');
- var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]);
- if (nextItem.size() > 0)
- nextItem.before(list.draggedItem);
- else if (pos[1] == 0)
- $(lists[pos[0]].container).prepend(list.draggedItem);
- else
- $(lists[pos[0]].container).append(list.draggedItem);
- }
- list.draggedItem.removeAttr("data-origpos");
- list.draggedItem = null;
- $(document).unbind("mousemove", list.swapItems);
- $(document).unbind("mouseup", list.dropItem);
- if (opts.scrollContainer != window)
- $(window).unbind("wheel", list.wheel);
- return false;
- },
-
- swapItems: function(e) {
- if (list.draggedItem == null)
- return false;
-
- list.setPos(e.pageX, e.pageY);
-
- var ei = list.findPos(e.pageX, e.pageY);
- var nlist = list;
- for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) {
- ei = lists[i].findPos(e.pageX, e.pageY);
- nlist = lists[i];
- }
-
- if (ei == -1)
- return false;
-
- var children = function() { return $(nlist.container).children().not(nlist.draggedItem); };
- var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); });
-
- if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left)
- $(nlist.pos[ei].elm).before(list.placeHolderItem);
- else
- $(nlist.pos[ei].elm).after(list.placeHolderItem);
-
- fixed.each(function() {
- var elm = children().eq(this.idx).get(0);
- if (this != elm && children().index(this) < this.idx)
- $(this).insertAfter(elm);
- else if (this != elm)
- $(this).insertBefore(elm);
- });
-
- $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
- lastPos = list.draggedItem.offset();
- return false;
- },
-
- findPos: function(x, y) {
- for (var i = 0; i < this.pos.length; i++) {
- if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y)
- return i;
- }
- return -1;
- },
-
- createDropTargets: function() {
- if (!opts.dragBetween)
- return;
- $(lists).each(function() {
- var ph = $(this.container).find("[data-placeholder]");
- var dt = $(this.container).find("[data-droptarget]");
- if (ph.size() > 0 && dt.size() > 0)
- dt.remove();
- else if (ph.size() == 0 && dt.size() == 0) {
- if (opts.tagName == "td")
- $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container);
- else
-
- $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true));
-
- list.placeHolderItem.attr("data-placeholder", true);
- }
- });
- }
- };
- newList.init();
- lists.push(newList);
- });
- return this;
- };
- $.fn.dragsort.defaults = {
- tagName:"",
- itemSelector: "",
- dragSelector: "",
- dragSelectorExclude: "input, textarea",
- dragEnd: function() { },
- dragBetween: false,
- placeHolderTemplate: "",
- scrollContainer: window,
- scrollSpeed: 5
- };
- })(jQuery);
- define("dragsort", function(){});
- ;(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);
- define("drag", function(){});
- ;(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);
- define("drop", function(){});
- $.fn.addtabs = function (options) {
- var obj = $(this);
- options = $.extend({
- content: '',
- close: true,
- monitor: 'body',
- nav: '.nav-addtabs',
- tab: '.tab-addtabs',
- iframeUse: true,
- iframeHeight: $(window).height() - 50,
- iframeForceRefresh: false,
- callback: function () {
-
- }
- }, options || {});
- var navobj = $(options.nav);
- var tabobj = $(options.tab);
- if (history.pushState) {
-
- $(window).on("popstate", function (e) {
- var state = e.originalEvent.state;
- if (state) {
- $("a[addtabs=" + state.id + "]", options.monitor).data("pushstate", true).trigger("click");
- }
- });
- }
- $(options.monitor).on('click', '[addtabs]', function (e) {
- if ($(this).attr('url').indexOf("javascript:") !== 0) {
- if ($(this).is("a")) {
- e.preventDefault();
- }
- var id = $(this).attr('addtabs');
- var title = $(this).attr('title') ? $(this).attr('title') : $.trim($(this).text());
- var url = $(this).attr('url');
- var content = options.content ? options.content : $(this).attr('content');
- var ajax = $(this).attr('ajax') ? true : false;
- var state = ({
- url: url, title: title, id: id, content: content, ajax: ajax
- });
- document.title = title;
- if (history.pushState && !$(this).data("pushstate")) {
- var pushurl = url.indexOf("ref=addtabs") == -1 ? (url + (url.indexOf("?") > -1 ? "&" : "?") + "ref=addtabs") : url;
- window.history.pushState(state, title, pushurl);
- }
- $(this).data("pushstate", null);
- _add.call(this, {
- id: id,
- title: $(this).attr('title') ? $(this).attr('title') : $(this).html(),
- content: content,
- url: url,
- ajax: ajax
- });
- }
- });
- navobj.on('click', '.close-tab', function (e) {
- id = $(this).prev("a").attr("aria-controls");
- _close(id);
- return false;
- });
- navobj.on('dblclick', 'li[role=presentation]', function (e) {
- $(this).find(".close-tab").trigger("click");
- });
- navobj.on('click', 'li[role=presentation]', function (e) {
- $("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click");
- });
- $(window).resize(function () {
- $("#nav").width($("#header > .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20);
- _drop();
- });
- _add = function (opts) {
- var id, tabid, conid, url;
- id = opts.id;
- tabid = 'tab_' + opts.id;
- conid = 'con_' + opts.id;
- url = opts.url;
- url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1");
- navobj.find("[role='presentation']").removeClass('active');
- tabobj.find("[role='tabpanel']").removeClass('active');
-
- if ($("#" + tabid).size() == 0) {
-
- title = $('<li role="presentation" id="' + tabid + '"><a href="#' + conid + '" node-id="' + opts.id + '" aria-controls="' + id + '" role="tab" data-toggle="tab">' + opts.title + '</a></li>');
-
- if (options.close && $("li", navobj).size() > 0) {
- title.append(' <i class="close-tab fa fa-remove"></i>');
- }
-
- content = $('<div role="tabpanel" class="tab-pane" id="' + conid + '"></div>');
-
- if (opts.content) {
- content.append(opts.content);
- } else if (options.iframeUse && !opts.ajax) {
- var height = options.iframeHeight;
- content.append('<iframe src="' + url + '" width="100%" height="' + height + '" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes"></iframe></div>');
- } else {
- $.get(url, function (data) {
- content.append(data);
- });
- }
-
- if ($('.tabdrop li').size() > 0) {
- $('.tabdrop ul').append(title);
- } else {
- navobj.append(title);
- }
- tabobj.append(content);
- } else {
-
- if (options.iframeForceRefresh) {
- $("#" + conid + " iframe").attr('src', function (i, val) {
- return val;
- });
- }
- }
- localStorage.setItem("addtabs", $(this).prop('outerHTML'));
-
- $("#" + tabid).addClass('active');
- $("#" + conid).addClass("active");
- _drop();
- };
- _close = function (id) {
- var tabid = 'tab_' + id;
- var conid = 'con_' + id;
-
- if (obj.find("li.active").not('.tabdrop').attr('id') == tabid) {
- if ($("#" + tabid).prev().not(".tabdrop").size() > 0) {
- $("#" + tabid).prev().not(".tabdrop").find("a").trigger("click");
- } else if ($("#" + tabid).next().size() > 0) {
- $("#" + tabid).next().trigger("click");
- } else {
- $(">li:last > a", navobj).trigger('click');
- }
- }
-
- $("#" + tabid).remove();
- $("#" + conid).remove();
- _drop();
- options.callback();
- };
- _drop = function () {
-
- var dropdown = $('<li class="dropdown pull-right hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;">' +
- '<i class="glyphicon glyphicon-align-justify"></i>' +
- ' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>');
-
- if (!$('.tabdrop').html()) {
- dropdown.prependTo(navobj);
- } else {
- dropdown = navobj.find('.tabdrop');
- }
-
- if (navobj.parent().is('.tabs-below')) {
- dropdown.addClass('dropup');
- }
- var collection = 0;
- var maxwidth = navobj.width() - 60;
- var liwidth = 0;
-
- var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop');
- var lisize = litabs.size();
- litabs.each(function (i, j) {
- liwidth += $(this).width();
- if (collection == 0 && i == lisize - 1 && liwidth <= navobj.width()) {
- return true;
- }
- if (liwidth > maxwidth) {
- dropdown.find('ul').append($(this));
- collection++;
- }
- });
-
- if (collection > 0) {
- dropdown.removeClass('hide');
- if (dropdown.find('.active').length == 1) {
- dropdown.addClass('active');
- } else {
- dropdown.removeClass('active');
- }
- } else {
- dropdown.addClass('hide');
- }
- };
- };
- define("addtabs", function(){});
- ;
- (function ($) {
- "use strict";
-
- var defaults = {
-
- data: undefined,
-
- lang: 'cn',
-
- multiple: false,
-
- pagination: true,
-
- dropButton: true,
-
- listSize: 10,
-
- multipleControlbar: true,
-
- maxSelectLimit: 0,
-
- selectToCloseList: false,
-
- initRecord: undefined,
-
- dbTable: 'tbl',
-
- keyField: 'id',
-
- showField: 'name',
-
- searchField: undefined,
-
- andOr: 'AND',
-
- orderBy: undefined,
-
- pageSize: 10,
-
- params: undefined,
-
- formatItem: undefined,
-
- autoFillResult: false,
-
- autoSelectFirst: false,
-
- noResultClean: true,
-
- selectOnly: false,
-
- inputDelay: 0.5,
-
-
- eSelect: undefined,
-
- eOpen: undefined,
-
- eAjaxSuccess: undefined,
-
- eTagRemove: undefined,
-
- eClear: undefined
- };
-
- var SelectPage = function (input, option) {
-
- $.each({data: 'source', keyField: 'primaryKey', showField: 'field', pageSize: 'perPage'}, function (i, j) {
- if (typeof option[j] !== 'undefined') {
- option[i] = option[j];
- delete option[j];
- }
- });
- this.setOption(option);
- this.setLanguage();
- this.setCssClass();
- this.setProp();
- this.setElem(input);
- this.setButtonAttrDefault();
- this.setInitRecord();
- this.eDropdownButton();
- this.eInput();
- this.eWhole();
- };
-
- SelectPage.version = '2.18';
-
- SelectPage.dataKey = 'selectPageObject';
-
- SelectPage.prototype.setOption = function (option) {
-
- option.searchField = option.searchField || option.showField;
- option.andOr = option.andOr.toUpperCase();
- if (option.andOr !== 'AND' && option.andOr !== 'OR')
- option.andOr = 'AND';
-
- var arr = ['searchField'];
- for (var i = 0; i < arr.length; i++) {
- option[arr[i]] = this.strToArray(option[arr[i]]);
- }
-
- option.orderBy = option.orderBy || option.showField;
-
-
- option.orderBy = this.setOrderbyOption(option.orderBy, option.showField);
-
- if (option.multiple && !option.selectToCloseList) {
- option.autoFillResult = false;
- option.autoSelectFirst = false;
- }
-
- if (!option.pagination)
- option.pageSize = 200;
- if ($.type(option.listSize) !== 'number' || option.listSize < 0)
- option.listSize = 10;
- this.option = option;
- };
-
- SelectPage.prototype.strToArray = function (str) {
- if (!str)
- return '';
- return str.replace(/[\s ]+/g, '').split(',');
- };
-
- SelectPage.prototype.setOrderbyOption = function (arg_order, arg_field) {
- var arr = [], orders = [];
- if (typeof arg_order == 'object') {
- for (var i = 0; i < arg_order.length; i++) {
- orders = $.trim(arg_order[i]).split(' ');
- arr[i] = (orders.length == 2) ? orders : [orders[0], 'ASC'];
- }
- } else {
- orders = $.trim(arg_order).split(' ');
- arr[0] = (orders.length == 2) ? orders : (orders[0].match(/^(ASC|DESC)$/i)) ? [arg_field, orders[0]] : [orders[0], 'ASC'];
- }
- return arr;
- };
-
- SelectPage.prototype.setLanguage = function () {
- var message, p = this.option;
- switch (p.lang) {
-
- case 'en':
- message = {
- add_btn: 'Add button',
- add_title: 'add a box',
- del_btn: 'Del button',
- del_title: 'delete a box',
- next: 'Next',
- next_title: 'Next' + p.pageSize + ' (Right key)',
- prev: 'Prev',
- prev_title: 'Prev' + p.pageSize + ' (Left key)',
- first_title: 'First (Shift + Left key)',
- last_title: 'Last (Shift + Right key)',
- get_all_btn: 'Get All (Down key)',
- get_all_alt: '(button)',
- close_btn: 'Close (Tab key)',
- close_alt: '(button)',
- loading: 'loading...',
- loading_alt: '(loading)',
- page_info: 'page_num of page_count',
- select_ng: 'Attention : Please choose from among the list.',
- select_ok: 'OK : Correctly selected.',
- not_found: 'not found',
- ajax_error: 'An error occurred while connecting to server.',
- clear: 'Clear content',
- select_all: 'Select current page',
- unselect_all: 'Clear current page',
- clear_all: 'Clear all selected',
- max_selected: 'You can only select up to max_selected_limit items'
- };
- break;
-
- case 'cn':
- default:
- message = {
- add_btn: '添加按钮',
- add_title: '添加区域',
- del_btn: '删除按钮',
- del_title: '删除区域',
- next: '下一页',
- next_title: '下' + p.pageSize + ' (→)',
- prev: '上一页',
- prev_title: '上' + p.pageSize + ' (←)',
- first_title: '首页 (Shift + ←)',
- last_title: '尾页 (Shift + →)',
- get_all_btn: '获得全部 (↓)',
- get_all_alt: '(按钮)',
- close_btn: '关闭 (Tab键)',
- close_alt: '(按钮)',
- loading: '读取中...',
- loading_alt: '(读取中)',
- page_info: '第 page_num 页(共page_count页)',
- select_ng: '请注意:请从列表中选择.',
- select_ok: 'OK : 已经选择.',
- not_found: '无查询结果',
- ajax_error: '连接到服务器时发生错误!',
- clear: '清除内容',
- select_all: '选择当前页项目',
- unselect_all: '取消选择当前页项目',
- clear_all: '清除全部已选择项目',
- max_selected: '最多只能选择 max_selected_limit 个项目'
- };
- break;
- }
- this.message = message;
- };
-
- SelectPage.prototype.setCssClass = function () {
- var css_class = {
- container: 'sp_container',
- container_open: 'sp_container_open',
- re_area: 'sp_result_area',
- result_open: 'sp_result_area_open',
- control_box: 'sp_control_box',
-
- element_box: 'sp_element_box',
- navi: 'sp_navi',
-
- results: 'sp_results',
- re_off: 'sp_results_off',
- select: 'sp_over',
- select_ok: 'sp_select_ok',
- select_ng: 'sp_select_ng',
- selected: 'sp_selected',
- input_off: 'sp_input_off',
- message_box: 'sp_message_box',
- disabled: 'sp_disabled',
- button: 'sp_button',
- btn_on: 'sp_btn_on',
- btn_out: 'sp_btn_out',
- input: 'sp_input',
- clear_btn: 'sp_clear_btn',
- align_right: 'sp_align_right'
- };
- this.css_class = css_class;
- };
-
- SelectPage.prototype.setProp = function () {
- this.prop = {
-
- disabled: false,
- current_page: 1,
-
- max_page: 1,
-
- is_loading: false,
- xhr: false,
- key_paging: false,
- key_select: false,
-
- prev_value: '',
-
- selected_text: '',
- last_input_time: undefined,
- init_set: false
- };
- this.template = {
- tag: {
- content: '<li class="selected_tag" itemvalue="#item_value#">#item_text#<span class="tag_close"><i class="spfont sp-close"></i></span></li>',
- textKey: '#item_text#',
- valueKey: '#item_value#'
- },
- page: {
- current: 'page_num',
- total: 'page_count'
- },
- msg: {
- maxSelectLimit: 'max_selected_limit'
- }
- };
- };
-
- SelectPage.prototype.elementRealSize = function (element, method) {
- var defaults = {
- absolute: false,
- clone: false,
- includeMargin: false,
- display: 'block'
- };
- var configs = defaults, $target = element.eq(0), fix, restore, tmp = [], style = '', $hidden;
- fix = function () {
-
- $hidden = $target.parents().addBack().filter(':hidden');
- style += 'visibility: hidden !important; display: ' + configs.display + ' !important; ';
- if (configs.absolute === true)
- style += 'position: absolute !important;';
-
-
- $hidden.each(function () {
-
- var $this = $(this), thisStyle = $this.attr('style');
- tmp.push(thisStyle);
-
- $this.attr('style', thisStyle ? thisStyle + ';' + style : style);
- });
- };
- restore = function () {
-
- $hidden.each(function (i) {
- var $this = $(this), _tmp = tmp[ i ];
- if (_tmp === undefined)
- $this.removeAttr('style');
- else
- $this.attr('style', _tmp);
- });
- };
- fix();
-
-
-
- var actual = /(outer)/.test(method) ?
- $target[ method ](configs.includeMargin) :
- $target[ method ]();
- restore();
-
- return actual;
- };
-
- SelectPage.prototype.setElem = function (combo_input) {
-
- var elem = {}, p = this.option, css = this.css_class, msg = this.message, input = $(combo_input);
- var orgWidth = input.outerWidth();
-
- if (orgWidth <= 0)
- orgWidth = this.elementRealSize(input, 'outerWidth');
- if (orgWidth < 150)
- orgWidth = 150;
- elem.combo_input = input.attr({'autocomplete': 'off'}).addClass(css.input).wrap('<div>');
- if (p.selectOnly)
- elem.combo_input.prop('readonly', true);
- elem.container = elem.combo_input.parent().addClass(css.container);
- if (elem.combo_input.prop('disabled')) {
- if (p.multiple)
- elem.container.addClass(css.disabled);
- else
- elem.combo_input.addClass(css.input_off);
- }
-
- elem.container.width(orgWidth);
- elem.button = $('<div>').addClass(css.button);
-
- elem.dropdown = $('<span class="sp_caret"></span>');
-
- elem.clear_btn = $('<div>').html($('<i>').addClass('spfont sp-close')).addClass(css.clear_btn).attr('title', msg.clear);
- if (!p.dropButton)
- elem.clear_btn.addClass(css.align_right);
-
- elem.element_box = $('<ul>').addClass(css.element_box);
- if (p.multiple && p.multipleControlbar)
- elem.control = $('<div>').addClass(css.control_box);
-
- elem.result_area = $('<div>').addClass(css.re_area);
-
- if (p.pagination)
- elem.navi = $('<div>').addClass('sp_pagination').append('<ul>');
- elem.results = $('<ul>').addClass(css.results);
- var namePrefix = '_text',
- input_id = elem.combo_input.attr('id') || elem.combo_input.attr('name'),
- input_name = elem.combo_input.attr('name') || 'selectPage',
- hidden_name = input_name,
- hidden_id = input_id;
-
- elem.hidden = $('<input type="hidden" class="sp_hidden" />').attr({
- name: hidden_name,
- id: hidden_id
- }).val('');
- elem.combo_input.attr({
- name: input_name + namePrefix,
- id: input_id + namePrefix
- });
-
- elem.container.append(elem.hidden);
- if (p.dropButton) {
- elem.container.append(elem.button)
- elem.button.append(elem.dropdown);
- }
- $(document.body).append(elem.result_area);
- elem.result_area.append(elem.results);
- if (p.pagination)
- elem.result_area.append(elem.navi);
-
- if (p.multiple) {
- if (p.multipleControlbar) {
- elem.control.append('<button type="button" class="btn btn-default sp_clear_all" ><i class="spfont sp-clear"></i></button>');
- elem.control.append('<button type="button" class="btn btn-default sp_unselect_all" ><i class="spfont sp-unselect-all"></i></button>');
- elem.control.append('<button type="button" class="btn btn-default sp_select_all" ><i class="spfont sp-select-all"></i></button>');
- elem.control_text = $('<p>');
- elem.control.append(elem.control_text);
- elem.result_area.prepend(elem.control);
- }
- elem.container.addClass('sp_container_combo');
- elem.combo_input.addClass('sp_combo_input').before(elem.element_box);
- var li = $('<li>').addClass('input_box');
- li.append(elem.combo_input);
- elem.element_box.append(li);
- if (elem.combo_input.attr('placeholder'))
- elem.combo_input.attr('placeholder_bak', elem.combo_input.attr('placeholder'));
- }
- this.elem = elem;
- };
-
- SelectPage.prototype.setButtonAttrDefault = function () {
-
-
- if (this.option.dropButton)
- this.elem.button.attr('title', this.message.close_btn);
- };
-
- SelectPage.prototype.setInitRecord = function (refresh) {
- var self = this, p = self.option, el = self.elem, key = '';
- if ($.type(el.combo_input.data('init')) != 'undefined')
- p.initRecord = String(el.combo_input.data('init'));
-
-
- if (!refresh && !p.initRecord && el.combo_input.val())
- p.initRecord = el.combo_input.val();
- el.combo_input.val('');
- if (!refresh)
- el.hidden.val(p.initRecord);
- key = refresh && el.hidden.val() ? el.hidden.val() : p.initRecord;
- if (key) {
- if (typeof p.data === 'object') {
- var data = new Array();
- var keyarr = key.split(',');
- $.each(keyarr, function (index, row) {
- for (var i = 0; i < p.data.length; i++) {
- if (p.data[i][p.keyField] == row) {
- data.push(p.data[i]);
- break;
- }
- }
- });
- if (!p.multiple && data.length > 1)
- data = [data[0]];
- self.afterInit(self, data);
- } else {
- $.ajax({
- dataType: 'json',
- type: 'POST',
- url: p.data,
- data: {
- searchTable: p.dbTable,
- searchKey: p.keyField,
- searchValue: key,
- orderBy: p.orderBy,
- showField: p.showField,
- keyField: p.keyField,
- keyValue: key,
- searchField: p.searchField
- },
- success: function (json) {
- var d = null;
- if (p.eAjaxSuccess && $.isFunction(p.eAjaxSuccess))
- d = p.eAjaxSuccess(json);
- self.afterInit(self, d.list);
- },
- error: function (jqXHR, textStatus, errorThrown) {
- self.ajaxErrorNotify(self, errorThrown);
- }
- });
- }
- }
- };
-
- SelectPage.prototype.afterInit = function (self, data) {
- if (!data || ($.isArray(data) && data.length === 0))
- return;
- if (!$.isArray(data))
- data = [data];
- var p = self.option, css = self.css_class;
- var getText = function (row) {
- var text = row[p.showField];
- if (p.formatItem && $.isFunction(p.formatItem)) {
- try {
- text = p.formatItem(row);
- } catch (e) {
- }
- }
- return text;
- };
- if (p.multiple) {
- self.prop.init_set = true;
- self.clearAll(self);
- $.each(data, function (i, row) {
- var item = {text: getText(row), value: row[p.keyField]};
- if (!self.isAlreadySelected(self, item))
- self.addNewTag(self, item);
- });
- self.tagValuesSet(self);
- self.inputResize(self);
- console.log(self.elem.hidden.blur());
- self.prop.init_set = false;
- } else {
- var row = data[0];
- self.elem.combo_input.val(getText(row));
- self.elem.hidden.val(row[p.keyField]);
- self.prop.prev_value = getText(row);
- self.prop.selected_text = getText(row);
- if (p.selectOnly) {
- self.elem.combo_input.attr('title', self.message.select_ok).removeClass(css.select_ng).addClass(css.select_ok);
- }
- self.putClearButton();
- }
- };
-
- SelectPage.prototype.eDropdownButton = function () {
- var self = this;
- if (self.option.dropButton) {
- self.elem.button.mouseup(function (ev) {
- ev.stopPropagation();
- if (self.elem.result_area.is(':hidden') && !self.elem.combo_input.prop('disabled')) {
- self.elem.combo_input.focus();
- } else
- self.hideResults(self);
- });
- }
- };
-
- SelectPage.prototype.eInput = function () {
- var self = this, p = self.option, el = self.elem, msg = self.message;
- var showList = function () {
- self.prop.page_move = false;
- self.suggest(self);
- self.setCssFocusedInput(self);
- };
- el.combo_input.keyup(function (e) {
- self.processKey(self, e);
- }).keydown(function (e) {
- self.processControl(self, e);
- }).focus(function (e) {
-
- if (el.result_area.is(':hidden')) {
- e.stopPropagation();
- self.prop.first_show = true;
- showList();
- }
- });
- el.container.on('click.SelectPage', 'div.' + self.css_class.clear_btn, function (e) {
- e.stopPropagation();
- if (!self.disabled(self)) {
- self.clearAll(self);
- self.elem.hidden.change();
- if (p.eClear && $.isFunction(p.eClear))
- p.eClear(self);
- }
- });
- el.result_area.on('mousedown.SelectPage', function (e) {
- e.stopPropagation();
- });
- if (p.multiple) {
- if (p.multipleControlbar) {
-
- el.control.find('.sp_select_all').on('click.SelectPage', function (e) {
- self.selectAllLine(self);
- }).hover(function () {
- el.control_text.html(msg.select_all);
- }, function () {
- el.control_text.html('');
- });
-
- el.control.find('.sp_unselect_all').on('click.SelectPage', function (e) {
- self.unSelectAllLine(self);
- }).hover(function () {
- el.control_text.html(msg.unselect_all);
- }, function () {
- el.control_text.html('');
- });
-
- el.control.find('.sp_clear_all').on('click.SelectPage', function (e) {
- self.clearAll(self);
- }).hover(function () {
- el.control_text.html(msg.clear_all);
- }, function () {
- el.control_text.html('');
- });
- }
- el.element_box.on('click.SelectPage', function (e) {
- var srcEl = e.target || e.srcElement;
- if ($(srcEl).is('ul'))
- el.combo_input.focus();
- });
-
- el.element_box.on('click.SelectPage', 'span.tag_close', function () {
- var li = $(this).closest('li');
- self.removeTag(self, li);
- showList();
- if (p.eTagRemove && $.isFunction(p.eTagRemove))
- p.eTagRemove(1, self);
- });
- self.inputResize(self);
- }
- };
-
- SelectPage.prototype.eWhole = function () {
- var self = this, css = self.css_class;
- var cleanContent = function (obj) {
- obj.elem.combo_input.val('');
- if (!obj.option.multiple)
- obj.elem.hidden.val('');
- obj.prop.selected_text = '';
- };
-
- $(document.body).off('mousedown.selectPage').on('mousedown.selectPage', function (e) {
- var ele = e.target || e.srcElement;
- var sp = $(ele).closest('div.' + css.container);
-
- $('div.' + css.container + '.' + css.container_open).each(function () {
- if (this == sp[0])
- return;
- var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey);
- if (!d.elem.combo_input.val() && d.elem.hidden.val() && !d.option.multiple) {
- d.prop.current_page = 1;
- cleanContent(d);
- d.hideResults(d);
- return true;
- }
- if (d.elem.results.find('li').not('.' + css.message_box).size()) {
- if (d.option.autoFillResult) {
-
- if (d.elem.hidden.val())
- d.hideResults(d);
- else if (d.elem.results.find('li.sp_over').size()) {
-
- d.selectCurrentLine(d, true);
- } else if (d.option.autoSelectFirst) {
-
- d.nextLine(d);
- d.selectCurrentLine(d, true);
- } else
- d.hideResults(d);
- } else
- d.hideResults(d);
- } else {
-
- if (d.option.noResultClean)
- cleanContent(d);
- else {
- if (!d.option.multiple)
- d.elem.hidden.val('');
- }
- d.hideResults(d);
- }
- });
- });
- };
-
- SelectPage.prototype.eResultList = function () {
- var self = this, css = this.css_class;
- self.elem.results.children('li').hover(function () {
- if (self.prop.key_select) {
- self.prop.key_select = false;
- return;
- }
- if (!$(this).hasClass(css.selected) && !$(this).hasClass(css.message_box)) {
- $(this).addClass(css.select);
- self.setCssFocusedResults(self);
- }
- }, function () {
- $(this).removeClass(css.select);
- }).click(function (e) {
- if (self.prop.key_select) {
- self.prop.key_select = false;
- return;
- }
- e.preventDefault();
- e.stopPropagation();
- if (!$(this).hasClass(css.selected))
- self.selectCurrentLine(self, false);
- });
- };
-
- SelectPage.prototype.eScroll = function () {
- var self = this, css = this.css_class;
- $(window).on('scroll.SelectPage', function (e) {
- $('div.' + css.container + '.' + css.container_open).each(function () {
- var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey),
- offset = d.elem.result_area.offset(),
- screenScrollTop = $(window).scrollTop(),
- docHeight = $(document).height(),
- viewHeight = $(window).height(),
- listHeight = d.elem.result_area.outerHeight(),
- listBottom = offset.top + listHeight,
- hasOverflow = docHeight > viewHeight,
- down = d.elem.result_area.hasClass('shadowDown');
- if (hasOverflow) {
- if (down) {
- if (listBottom > (viewHeight + screenScrollTop))
- d.calcResultsSize(d);
- } else {
- if (offset.top < screenScrollTop)
- d.calcResultsSize(d);
- }
- }
- });
- });
- };
-
- SelectPage.prototype.ePaging = function () {
- var self = this;
- if (!self.option.pagination)
- return;
- self.elem.navi.find('li.csFirstPage').off('click').on('click', function (ev) {
-
- ev.preventDefault();
- self.firstPage(self);
- });
- self.elem.navi.find('li.csPreviousPage').off('click').on('click', function (ev) {
-
- ev.preventDefault();
- self.prevPage(self);
- });
- self.elem.navi.find('li.csNextPage').off('click').on('click', function (ev) {
-
- ev.preventDefault();
- self.nextPage(self);
- });
- self.elem.navi.find('li.csLastPage').off('click').on('click', function (ev) {
-
- ev.preventDefault();
- self.lastPage(self);
- });
- };
-
- SelectPage.prototype.ajaxErrorNotify = function (self, errorThrown) {
- self.showMessage(self.message.ajax_error);
- };
-
- SelectPage.prototype.showMessage = function (self, msg) {
- if (!msg)
- return;
- var msgLi = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' + msg + '</li>';
- self.elem.results.empty().append(msgLi).show();
- self.calcResultsSize(self);
- self.setOpenStatus(self, true);
- self.elem.control.hide();
- if (self.option.pagination)
- self.elem.navi.hide();
- };
-
- SelectPage.prototype.scrollWindow = function (self, enforce) {
- var current_result = self.getCurrentLine(self),
- target_top = (current_result && !enforce) ? current_result.offset().top : self.elem.container.offset().top,
- target_size;
- self.prop.size_li = self.elem.results.children('li:first').outerHeight();
- target_size = self.prop.size_li;
- var gap, client_height = $(window).height(),
- scroll_top = $(window).scrollTop(),
- scroll_bottom = scroll_top + client_height - target_size;
- if (current_result.length) {
- if (target_top < scroll_top || target_size > client_height) {
-
- gap = target_top - scroll_top;
- } else if (target_top > scroll_bottom) {
-
- gap = target_top - scroll_bottom;
- } else
- return;
- } else if (target_top < scroll_top)
- gap = target_top - scroll_top;
- window.scrollBy(0, gap);
- };
-
- SelectPage.prototype.setOpenStatus = function (self, status) {
- var el = self.elem, css = self.css_class;
- if (status) {
- el.container.addClass(css.container_open);
- el.result_area.addClass(css.result_open);
- } else {
- el.container.removeClass(css.container_open);
- el.result_area.removeClass(css.result_open);
- }
- };
-
- SelectPage.prototype.setCssFocusedInput = function (self) {
-
-
- };
-
- SelectPage.prototype.setCssFocusedResults = function (self) {
-
-
- };
-
- SelectPage.prototype.checkValue = function (self) {
- var now_value = self.elem.combo_input.val();
- if (now_value != self.prop.prev_value) {
- self.prop.prev_value = now_value;
- self.prop.first_show = false;
- if (self.option.selectOnly)
- self.setButtonAttrDefault();
- if (!self.option.multiple && !now_value) {
- self.elem.combo_input.val('');
- self.elem.hidden.val('');
- self.elem.clear_btn.remove();
- }
- self.suggest(self);
- }
- };
-
- SelectPage.prototype.processKey = function (self, e) {
- if ($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9, 13]) === -1) {
- if (e.keyCode != 16)
- self.setCssFocusedInput(self);
- self.inputResize(self);
- if ($.type(self.option.data) === 'string') {
- self.prop.last_input_time = e.timeStamp;
- setTimeout(function () {
- if ((e.timeStamp - self.prop.last_input_time) === 0)
- self.checkValue(self);
- }, self.option.inputDelay * 1000);
- } else {
- self.checkValue(self);
- }
- }
- }
-
- SelectPage.prototype.processControl = function (self, e) {
- if (($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9]) > -1 && self.elem.result_area.is(':visible')) ||
- ($.inArray(e.keyCode, [13, 9]) > -1 && self.getCurrentLine(self))) {
- e.preventDefault();
- e.stopPropagation();
- e.cancelBubble = true;
- e.returnValue = false;
- switch (e.keyCode) {
- case 37:
- if (e.shiftKey)
- self.firstPage(self);
- else
- self.prevPage(self);
- break;
- case 38:
- self.prop.key_select = true;
- self.prevLine(self);
- break;
- case 39:
- if (e.shiftKey)
- self.lastPage(self);
- else
- self.nextPage(self);
- break;
- case 40:
- if (self.elem.results.children('li').length) {
- self.prop.key_select = true;
- self.nextLine(self);
- } else
- self.suggest(self);
- break;
- case 9:
- self.prop.key_paging = true;
- self.selectCurrentLine(self, true);
-
- break;
- case 13:
- self.selectCurrentLine(self, true);
- break;
- case 27:
- self.prop.key_paging = true;
- self.hideResults(self);
- break;
- }
- }
- };
-
- SelectPage.prototype.abortAjax = function (self) {
- if (self.prop.xhr) {
- self.prop.xhr.abort();
- self.prop.xhr = false;
- }
- };
-
- SelectPage.prototype.suggest = function (self) {
- var q_word, val = $.trim(self.elem.combo_input.val());
- if (self.option.multiple)
- q_word = val;
- else {
- if (val && val === self.prop.selected_text)
- q_word = '';
- else
- q_word = val;
- }
- q_word = q_word.split(/[\s ]+/);
-
- if (self.option.eOpen && $.isFunction(self.option.eOpen))
- self.option.eOpen.call(self);
- self.abortAjax(self);
-
- var which_page_num = self.prop.current_page || 1;
- if (typeof self.option.data == 'object')
- self.searchForJson(self, q_word, which_page_num);
- else
- self.searchForDb(self, q_word, which_page_num);
- };
-
- SelectPage.prototype.setLoading = function (self) {
- if (self.elem.results.html() === '') {
-
- self.setOpenStatus(self, true);
- }
- };
-
- SelectPage.prototype.searchForDb = function (self, q_word, which_page_num) {
- var p = self.option;
- if (!p.eAjaxSuccess || !$.isFunction(p.eAjaxSuccess))
- self.hideResults(self);
- var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
-
- if (q_word.length && q_word[0] && q_word[0] !== self.prop.prev_value)
- which_page_num = 1;
- var _orgParams = {
- q_word: q_word,
- pageNumber: which_page_num,
- pageSize: p.pageSize,
- andOr: p.andOr,
- orderBy: p.orderBy,
- searchTable: p.dbTable,
- showField: self.option.showField,
- keyField: self.option.keyField,
- searchField: self.option.searchField
- };
- _orgParams[searchKey] = q_word[0];
- if (_paramsFunc) {
- var result = $.isFunction(_paramsFunc) ? _paramsFunc() : _paramsFunc;
- if (result && $.isPlainObject(result)) {
- _params = $.extend({}, _orgParams, result);
- } else {
- _params = _orgParams;
- }
- } else
- _params = _orgParams;
- self.prop.xhr = $.ajax({
- dataType: 'json',
- url: p.data,
- type: 'POST',
- data: _params,
- success: function (returnData) {
- if (!returnData || !$.isPlainObject(returnData)) {
- self.hideResults(self);
- self.ajaxErrorNotify(self, errorThrown);
- return;
- }
- var data = {}, json = {};
- try {
- data = p.eAjaxSuccess(returnData);
- json.originalResult = data.list;
- json.cnt_whole = data.totalRow;
- } catch (e) {
- self.showMessage(self, self.message.ajax_error);
- return;
- }
- if(self.elem.navi) {
- $(self.elem.navi).toggleClass("hide", json.cnt_whole <= json.originalResult.length);
- }
-
- json.candidate = [];
- json.keyField = [];
- if (typeof json.originalResult != 'object') {
- self.prop.xhr = null;
- self.notFoundSearch(self);
- return;
- }
- json.cnt_page = json.originalResult.length;
- for (var i = 0; i < json.cnt_page; i++) {
- for (var key in json.originalResult[i]) {
- if (key == p.keyField) {
- json.keyField.push(json.originalResult[i][key]);
- }
- if (key == p.showField) {
- json.candidate.push(json.originalResult[i][key]);
- }
- }
- }
- self.prepareResults(self, json, q_word, which_page_num);
- },
- error: function (jqXHR, textStatus, errorThrown) {
- if (textStatus != 'abort') {
- self.hideResults(self);
- self.ajaxErrorNotify(self, errorThrown);
- }
- },
- complete: function () {
- self.prop.xhr = null;
- }
- });
- };
-
- SelectPage.prototype.searchForJson = function (self, q_word, which_page_num) {
- var p = self.option, matched = [], esc_q = [], sorted = [], json = {}, i = 0, arr_reg = [];
-
- do {
-
-
- esc_q[i] = q_word[i].replace(/\W/g, '\\$&').toString();
- arr_reg[i] = new RegExp(esc_q[i], 'gi');
- i++;
- } while (i < q_word.length);
-
- for (i = 0; i < p.data.length; i++) {
- var flag = false, row = p.data[i], itemText;
- for (var j = 0; j < arr_reg.length; j++) {
- itemText = row[p.searchField];
- if (p.formatItem && $.isFunction(p.formatItem))
- itemText = p.formatItem(row);
- if (itemText.match(arr_reg[j])) {
- flag = true;
- if (p.andOr == 'OR')
- break;
- } else {
- flag = false;
- if (p.andOr == 'AND')
- break;
- }
- }
- if (flag)
- matched.push(row);
- }
-
- var reg1 = new RegExp('^' + esc_q[0] + '$', 'gi'),
- reg2 = new RegExp('^' + esc_q[0], 'gi'),
- matched1 = [], matched2 = [], matched3 = [];
- for (i = 0; i < matched.length; i++) {
- var orderField = p.orderBy[0][0];
- var orderValue = String(matched[i][orderField]);
- if (orderValue.match(reg1)) {
- matched1.push(matched[i]);
- } else if (orderValue.match(reg2)) {
- matched2.push(matched[i]);
- } else {
- matched3.push(matched[i]);
- }
- }
- if (p.orderBy[0][1].match(/^asc$/i)) {
- matched1 = self.sortAsc(self, matched1);
- matched2 = self.sortAsc(self, matched2);
- matched3 = self.sortAsc(self, matched3);
- } else {
- matched1 = self.sortDesc(self, matched1);
- matched2 = self.sortDesc(self, matched2);
- matched3 = self.sortDesc(self, matched3);
- }
- sorted = sorted.concat(matched1).concat(matched2).concat(matched3);
-
- json.cnt_whole = sorted.length;
-
- if (!self.prop.page_move) {
-
- if (!p.multiple) {
-
- var currentValue = self.elem.hidden.val();
- if ($.type(currentValue) !== 'undefined' && $.trim(currentValue) !== '') {
- var index = 0;
- $.each(sorted, function (i, row) {
- if (row[p.keyField] == currentValue) {
- index = i + 1;
- return false;
- }
- });
- which_page_num = Math.ceil(index / p.pageSize);
- if (which_page_num < 1)
- which_page_num = 1;
- self.prop.current_page = which_page_num;
- }
- }
- } else {
-
- if (sorted.length <= ((which_page_num - 1) * p.pageSize)) {
- which_page_num = 1;
- self.prop.current_page = 1;
- }
- }
-
- var start = (which_page_num - 1) * p.pageSize, end = start + p.pageSize;
-
- json.originalResult = [];
-
- for (i = start; i < end; i++) {
- if (sorted[i] === undefined)
- break;
- json.originalResult.push(sorted[i]);
- for (var key in sorted[i]) {
- if (key == p.keyField) {
- if (json.keyField === undefined)
- json.keyField = [];
- json.keyField.push(sorted[i][key]);
- }
- if (key == p.showField) {
- if (json.candidate === undefined)
- json.candidate = [];
- json.candidate.push(sorted[i][key]);
- }
- }
- }
- if (json.candidate === undefined)
- json.candidate = [];
- json.cnt_page = json.candidate.length;
- self.prepareResults(self, json, q_word, which_page_num);
- };
-
- SelectPage.prototype.sortAsc = function (self, arr) {
- arr.sort(function (a, b) {
- var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
- return $.type(valA) === 'number' ? valA - valB : String(valA).localeCompare(String(valB));
- });
- return arr;
- };
-
- SelectPage.prototype.sortDesc = function (self, arr) {
- arr.sort(function (a, b) {
- var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
- return $.type(valA) === 'number' ? valB - valA : String(valB).localeCompare(String(valA));
- });
- return arr;
- };
-
- SelectPage.prototype.notFoundSearch = function (self) {
- self.elem.results.empty();
- self.calcResultsSize(self);
- self.setOpenStatus(self, true);
- self.setCssFocusedInput(self);
- };
-
- SelectPage.prototype.prepareResults = function (self, json, q_word, which_page_num) {
- if (self.option.pagination)
- self.setNavi(self, json.cnt_whole, json.cnt_page, which_page_num);
- if (!json.keyField)
- json.keyField = false;
- if (self.option.selectOnly && json.candidate.length === 1 && json.candidate[0] == q_word[0]) {
- self.elem.hidden.val(json.keyField[0]);
- this.setButtonAttrDefault();
- }
- var is_query = false;
- if (q_word && q_word.length && q_word[0])
- is_query = true;
- self.displayResults(self, json, is_query);
- };
-
- SelectPage.prototype.setNavi = function (self, cnt_whole, cnt_page, page_num) {
- var msg = self.message;
-
- var buildPageNav = function (self, pagebar, page_num, last_page) {
- var updatePageInfo = function () {
- var pageInfo = msg.page_info;
- return pageInfo.replace(self.template.page.current, page_num).replace(self.template.page.total, last_page);
- };
- if (pagebar.find('li').size() === 0) {
- pagebar.hide().empty();
- var iconFist = 'spfont sp-first',
- iconPrev = 'spfont sp-previous',
- iconNext = 'spfont sp-next',
- iconLast = 'spfont sp-last';
- pagebar.append('<li class="csFirstPage" title="' + msg.first_title + '" ><a href="javascript:void(0);"> <i class="' + iconFist + '"></i> </a></li>');
- pagebar.append('<li class="csPreviousPage" title="' + msg.prev_title + '" ><a href="javascript:void(0);"><i class="' + iconPrev + '"></i></a></li>');
-
- pagebar.append('<li class="pageInfoBox"><a href="javascript:void(0);"> ' + updatePageInfo() + ' </a></li>');
- pagebar.append('<li class="csNextPage" title="' + msg.next_title + '" ><a href="javascript:void(0);"><i class="' + iconNext + '"></i></a></li>');
- pagebar.append('<li class="csLastPage" title="' + msg.last_title + '" ><a href="javascript:void(0);"> <i class="' + iconLast + '"></i> </a></li>');
- pagebar.show();
- } else {
- pagebar.find('li.pageInfoBox a').html(updatePageInfo());
- }
- };
- var pagebar = self.elem.navi.find('ul'),
- last_page = Math.ceil(cnt_whole / self.option.pageSize);
- if (last_page === 0)
- page_num = 0;
- else {
- if (last_page < page_num)
- page_num = last_page;
- else if (page_num === 0)
- page_num = 1;
- }
- self.prop.current_page = page_num;
- self.prop.max_page = last_page;
- buildPageNav(self, pagebar, page_num, last_page);
-
- var dClass = 'disabled',
- first = pagebar.find('li.csFirstPage'),
- previous = pagebar.find('li.csPreviousPage'),
- next = pagebar.find('li.csNextPage'),
- last = pagebar.find('li.csLastPage');
-
- if (page_num === 1 || page_num === 0) {
- if (!first.hasClass(dClass))
- first.addClass(dClass);
- if (!previous.hasClass(dClass))
- previous.addClass(dClass);
- } else {
- if (first.hasClass(dClass))
- first.removeClass(dClass);
- if (previous.hasClass(dClass))
- previous.removeClass(dClass);
- }
-
- if (page_num === last_page || last_page === 0) {
- if (!next.hasClass(dClass))
- next.addClass(dClass);
- if (!last.hasClass(dClass))
- last.addClass(dClass);
- } else {
- if (next.hasClass(dClass))
- next.removeClass(dClass);
- if (last.hasClass(dClass))
- last.removeClass(dClass);
- }
- if (last_page > 1)
- self.ePaging();
- };
-
- SelectPage.prototype.displayResults = function (self, json, is_query) {
- var p = self.option, el = self.elem;
- el.results.hide().empty();
- if (p.multiple && $.type(p.maxSelectLimit) === 'number' && p.maxSelectLimit > 0) {
- var selectedSize = el.element_box.find('li.selected_tag').size();
- if (selectedSize > 0 && selectedSize >= p.maxSelectLimit) {
- var msg = self.message.max_selected;
- self.showMessage(self, msg.replace(self.template.msg.maxSelectLimit, p.maxSelectLimit));
- return;
- }
- }
- if (json.candidate.length) {
- var arr_candidate = json.candidate,
- arr_primary_key = json.keyField,
- keystr = el.hidden.val(),
- keyArr = keystr ? keystr.split(',') : new Array(),
- itemText = '';
- for (var i = 0; i < arr_candidate.length; i++) {
- if (p.formatItem && $.isFunction(p.formatItem)) {
- try {
- itemText = p.formatItem(json.originalResult[i]);
- } catch (e) {
- console.error('formatItem内容格式化函数内容设置不正确!');
- itemText = arr_candidate[i];
- }
- } else
- itemText = arr_candidate[i];
- var list = $('<li>').html(itemText).attr({
- pkey: arr_primary_key[i]
- });
- if (!p.formatItem)
- list.attr('title', itemText);
-
- if ($.inArray(arr_primary_key[i].toString(), keyArr) !== -1) {
- list.addClass(self.css_class.selected);
- }
-
- list.data('dataObj', json.originalResult[i]);
- el.results.append(list);
- }
- } else {
- var li = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' +
- self.message.not_found + '</li>';
- el.results.append(li);
- }
- el.results.show();
- if (p.multiple && p.multipleControlbar)
- el.control.show();
- if (p.pagination)
- el.navi.show();
- self.calcResultsSize(self);
- self.setOpenStatus(self, true);
-
- self.eResultList();
-
- self.eScroll();
-
- if (is_query && json.candidate.length && p.autoSelectFirst)
- self.nextLine(self);
- };
-
- SelectPage.prototype.calcResultsSize = function (self) {
- var p = self.option, el = self.elem;
- var rePosition = function () {
- if (el.container.css('position') === 'static') {
-
- var offset = el.combo_input.offset();
- el.result_area.css({
- top: offset.top + el.combo_input.outerHeight() + 'px',
- left: offset.left + 'px'
- });
- } else {
- if (!p.pagination) {
- var itemHeight = el.results.find('li:first').outerHeight(true),
- listHeight = itemHeight * p.listSize;
- el.results.css({
- 'max-height': listHeight,
- 'overflow-y': 'auto'
- });
- }
-
- var docWidth = $(document).width(),
- docHeight = $(document).height(),
- viewHeight = $(window).height(),
- offset = el.container.offset(),
- screenScrollTop = $(window).scrollTop(),
- listWidth = el.result_area.outerWidth(),
-
- listHeight = el.result_area.outerHeight(),
-
- defaultLeft = offset.left,
-
- inputHeight = el.container.outerHeight(),
- left = (offset.left + listWidth) > docWidth ?
- defaultLeft - (listWidth - el.container.outerWidth()) :
- defaultLeft,
-
- screenTop = offset.top,
- top = 0, dist = 5,
-
- listBottom = screenTop + inputHeight + listHeight + dist,
- hasOverflow = docHeight > viewHeight;
- if ((screenTop - screenScrollTop - dist > listHeight) &&
- (hasOverflow && listBottom > (viewHeight + screenScrollTop)) ||
- (!hasOverflow && listBottom > viewHeight)) {
-
- top = offset.top - listHeight - dist;
- el.result_area.removeClass('shadowUp shadowDown').addClass('shadowUp');
- } else {
-
- top = offset.top + (p.multiple ? el.container.outerHeight() : inputHeight);
- el.result_area.removeClass('shadowUp shadowDown').addClass('shadowDown');
- top += dist;
- }
- return {
- top: top + 'px', left: left + 'px'
- };
- }
- };
- if (el.result_area.is(':visible')) {
- el.result_area.css(rePosition());
- } else {
- var pss = rePosition();
- el.result_area.css(pss).show(1, function () {
- var repss = rePosition();
- if (pss.top !== repss.top || pss.left !== repss.left)
- el.result_area.css(repss);
- });
- }
- };
-
- SelectPage.prototype.hideResults = function (self) {
- if (self.prop.key_paging) {
- self.scrollWindow(self, true);
- self.prop.key_paging = false;
- }
- self.setCssFocusedInput(self);
- if (self.option.autoFillResult) {
-
- }
- self.elem.results.empty();
- self.elem.result_area.hide();
- self.setOpenStatus(self, false);
-
- $(window).off('scroll.SelectPage');
- self.abortAjax(self);
- self.setButtonAttrDefault();
- };
-
- SelectPage.prototype.disabled = function (self, disabled) {
- var p = self.option, el = self.elem;
- if ($.type(disabled) === 'undefined')
- return el.combo_input.prop('disabled');
- if ($.type(disabled) === 'boolean') {
- el.combo_input.prop('disabled', disabled);
- if (disabled)
- el.container.addClass(self.css_class.disabled);
- else
- el.container.removeClass(self.css_class.disabled);
- }
- };
-
- SelectPage.prototype.firstPage = function (self) {
- if (self.prop.current_page > 1) {
- self.prop.current_page = 1;
- self.prop.page_move = true;
- self.suggest(self);
- }
- };
-
- SelectPage.prototype.prevPage = function (self) {
- if (self.prop.current_page > 1) {
- self.prop.current_page--;
- self.prop.page_move = true;
- self.suggest(self);
- }
- };
-
- SelectPage.prototype.nextPage = function (self) {
- if (self.prop.current_page < self.prop.max_page) {
- self.prop.current_page++;
- self.prop.page_move = true;
- self.suggest(self);
- }
- };
-
- SelectPage.prototype.lastPage = function (self) {
- if (self.prop.current_page < self.prop.max_page) {
- self.prop.current_page = self.prop.max_page;
- self.prop.page_move = true;
- self.suggest(self);
- }
- };
-
- SelectPage.prototype.afterAction = function (self) {
- self.inputResize(self);
- self.elem.combo_input.change();
- self.setCssFocusedInput(self);
- if (self.prop.init_set)
- return;
- if (self.option.multiple) {
- if (self.option.selectToCloseList) {
- self.hideResults(self);
- self.elem.combo_input.blur();
- } else {
- self.suggest(self);
- self.elem.combo_input.focus();
- }
- } else {
- self.hideResults(self);
- self.elem.combo_input.blur();
- }
- };
-
- SelectPage.prototype.selectCurrentLine = function (self, is_enter_key) {
- self.scrollWindow(self, true);
- var p = self.option, current = self.getCurrentLine(self);
- if (current) {
- if (!p.multiple) {
- self.elem.combo_input.val(current.text());
- self.elem.hidden.val(current.attr('pkey'));
- } else {
-
- self.elem.combo_input.val('');
- var item = {text: current.text(), value: current.attr('pkey')};
- if (!self.isAlreadySelected(self, item)) {
- self.addNewTag(self, item);
- self.tagValuesSet(self);
- }
- }
- if (p.selectOnly)
- self.setButtonAttrDefault();
-
- if (p.eSelect && $.isFunction(p.eSelect))
- p.eSelect(current.data('dataObj'), self);
- self.prop.prev_value = self.elem.combo_input.val();
- self.prop.selected_text = self.elem.combo_input.val();
- self.putClearButton();
- }
- self.afterAction(self);
- };
-
- SelectPage.prototype.putClearButton = function () {
- if (!this.option.multiple && !this.elem.combo_input.prop('disabled'))
- this.elem.container.append(this.elem.clear_btn);
- };
-
- SelectPage.prototype.selectAllLine = function (self) {
- var p = self.option, jsonarr = new Array();
- self.elem.results.find('li').each(function (i, row) {
- var $row = $(row);
- var item = {text: $row.text(), value: $row.attr('pkey')};
- if (!self.isAlreadySelected(self, item)) {
- self.addNewTag(self, item);
- self.tagValuesSet(self);
- }
- jsonarr.push($row.data('dataObj'));
-
- if ($.type(p.maxSelectLimit) === 'number' &&
- p.maxSelectLimit > 0 &&
- p.maxSelectLimit === self.elem.element_box.find('li.selected_tag').size()) {
- return false;
- }
- });
- if (p.eSelect && $.isFunction(p.eSelect))
- p.eSelect(jsonarr, self);
- self.afterAction(self);
- };
-
- SelectPage.prototype.unSelectAllLine = function (self) {
- var p = self.option, size = self.elem.results.find('li').size();
- self.elem.results.find('li').each(function (i, row) {
- var key = $(row).attr('pkey');
- var tag = self.elem.element_box.find('li.selected_tag[itemvalue="' + key + '"]');
- self.removeTag(self, tag);
- });
- self.afterAction(self);
- if (p.eTagRemove && $.isFunction(p.eTagRemove))
- p.eTagRemove(size, self);
- };
-
- SelectPage.prototype.clearAll = function (self) {
- var p = self.option, size = 0;
- if (p.multiple) {
- size = self.elem.element_box.find('li.selected_tag').size();
- self.elem.element_box.find('li.selected_tag').remove();
- }
- self.reset(self);
- self.afterAction(self);
- if (!p.multiple)
- self.elem.clear_btn.remove();
- if (p.multiple) {
- if (p.eTagRemove && $.isFunction(p.eTagRemove))
- p.eTagRemove(size, self);
- }
- };
-
- SelectPage.prototype.reset = function (self) {
- self.elem.combo_input.val('');
- self.elem.hidden.val('');
- self.prop.prev_value = '';
- self.prop.selected_text = '';
- self.prop.current_page = 1;
- };
-
- SelectPage.prototype.getCurrentLine = function (self) {
- if (self.elem.result_area.is(':hidden'))
- return false;
- var obj = self.elem.results.find('li.' + self.css_class.select);
- if (obj.size())
- return obj;
- else
- return false;
- };
-
- SelectPage.prototype.isAlreadySelected = function (self, item) {
- var isExist = false;
- if (item.value) {
- var keys = self.elem.hidden.val();
- if (keys) {
- var karr = keys.split(',');
- if (karr && karr.length && $.inArray(item.value, karr) != -1)
- isExist = true;
- }
- }
- return isExist;
- };
-
- SelectPage.prototype.addNewTag = function (self, item) {
- if (!self.option.multiple || !item)
- return;
- var tmp = self.template.tag.content, tag;
- tmp = tmp.replace(self.template.tag.textKey, item.text);
- tmp = tmp.replace(self.template.tag.valueKey, item.value);
- tag = $(tmp);
- if (self.elem.combo_input.prop('disabled'))
- tag.find('span.tag_close').hide();
- self.elem.combo_input.closest('li').before(tag);
- };
-
- SelectPage.prototype.removeTag = function (self, item) {
- var key = $(item).attr('itemvalue');
- var keys = self.elem.hidden.val();
- if ($.type(key) != 'undefined' && keys) {
- var keyarr = keys.split(','),
- index = $.inArray(key.toString(), keyarr);
- if (index != -1) {
- keyarr.splice(index, 1);
- self.elem.hidden.val(keyarr.toString());
- }
- }
- $(item).remove();
- self.afterAction(self);
- };
-
- SelectPage.prototype.tagValuesSet = function (self) {
- if (!self.option.multiple)
- return;
- var tags = self.elem.element_box.find('li.selected_tag');
- if (tags && tags.size()) {
- var result = new Array();
- $.each(tags, function (i, li) {
- var v = $(li).attr('itemvalue');
- if ($.type(v) !== 'undefined')
- result.push(v);
- });
- if (result.length) {
- self.elem.hidden.val(result.join(','));
- }
- }
- };
-
- SelectPage.prototype.inputResize = function (self) {
- if (!self.option.multiple)
- return;
- var width = '',
- inputLi = self.elem.combo_input.closest('li');
- var setDefaultSize = function (self, inputLi) {
- inputLi.removeClass('full_width');
- var minimumWidth = self.elem.combo_input.val().length + 1,
- width = (minimumWidth * 0.75) + 'em';
- self.elem.combo_input.css('width', width).removeAttr('placeholder');
- };
- if (self.elem.element_box.find('li.selected_tag').size() === 0) {
- if (self.elem.combo_input.attr('placeholder_bak')) {
- if (!inputLi.hasClass('full_width'))
- inputLi.addClass('full_width');
- self.elem.combo_input.attr('placeholder', self.elem.combo_input.attr('placeholder_bak')).removeAttr('style');
- } else
- setDefaultSize(self, inputLi);
- } else
- setDefaultSize(self, inputLi);
- };
-
- SelectPage.prototype.nextLine = function (self) {
- var obj = self.getCurrentLine(self), idx;
- if (!obj)
- idx = -1;
- else {
- idx = self.elem.results.children('li').index(obj);
- obj.removeClass(self.css_class.select);
- }
- idx++;
- if (idx < self.elem.results.children('li').length) {
- var next = self.elem.results.children('li').eq(idx);
- next.addClass(self.css_class.select);
- self.setCssFocusedResults(self);
- } else
- self.setCssFocusedInput(self);
- self.scrollWindow(self, false);
- };
-
- SelectPage.prototype.prevLine = function (self) {
- var obj = self.getCurrentLine(self), idx;
- if (!obj)
- idx = self.elem.results.children('li').length;
- else {
- idx = self.elem.results.children('li').index(obj);
- obj.removeClass(self.css_class.select);
- }
- idx--;
- if (idx > -1) {
- var prev = self.elem.results.children('li').eq(idx);
- prev.addClass(self.css_class.select);
- self.setCssFocusedResults(self);
- } else
- self.setCssFocusedInput(self);
- self.scrollWindow(self, false);
- };
-
- function Plugin(option) {
- return this.each(function () {
- var $this = $(this),
- data = $this.data(SelectPage.dataKey),
- params = $.extend({}, defaults, $this.data(), data && data.option, typeof option === 'object' && option);
- if (!data)
- $this.data(SelectPage.dataKey, (data = new SelectPage(this, params)));
- });
- }
-
- function getPlugin(obj) {
- return $(obj).closest('div.sp_container').find('input.sp_input');
- }
-
- function ClearSelected() {
- return this.each(function () {
- var $this = getPlugin(this),
- data = $this.data(SelectPage.dataKey);
- if (data) {
- data.prop.init_set = true;
- data.clearAll(data);
- data.prop.init_set = false;
- }
- });
- }
-
- function SelectedRefresh() {
- return this.each(function () {
- var $this = getPlugin(this),
- data = $this.data(SelectPage.dataKey);
- if (data && data.elem.hidden.val())
- data.setInitRecord(true);
- });
- }
-
- function ModifyDataSource(data) {
- return this.each(function () {
- if (data && $.isArray(data)) {
- var $this = getPlugin(this),
- plugin = $this.data(SelectPage.dataKey);
- if (plugin) {
- plugin.clearAll(plugin);
- plugin.option.data = data;
- }
- }
- });
- }
-
- function PluginDisabled(disabled) {
- var status = false;
- this.each(function () {
- var $this = getPlugin(this),
- plugin = $this.data(SelectPage.dataKey);
- if (plugin) {
- if ($.type(disabled) !== 'undefined')
- plugin.disabled(plugin, disabled);
- else
- status = plugin.disabled(plugin);
- }
- });
- return status;
- }
-
- function GetInputText() {
- var str = '';
- this.each(function () {
- var $this = getPlugin(this), data = $this.data(SelectPage.dataKey);
- if (data) {
- if (data.option.multiple) {
- var tags = [];
- data.elem.element_box.find('li.selected_tag').each(function (i, tag) {
- tags.push($(tag).text());
- });
- str += tags.toString();
- } else {
- str += data.elem.combo_input.val();
- }
- }
- });
- return str;
- }
- var old = $.fn.selectPage;
- $.fn.selectPage = Plugin;
- $.fn.selectPage.Constructor = SelectPage;
- $.fn.selectPageClear = ClearSelected;
- $.fn.selectPageRefresh = SelectedRefresh;
- $.fn.selectPageData = ModifyDataSource;
- $.fn.selectPageDisabled = PluginDisabled;
- $.fn.selectPageText = GetInputText;
-
-
- $.fn.selectPage.noConflict = function () {
- $.fn.selectPage = old;
- return this;
- };
- })(window.jQuery);
- define("selectpage", function(){});
|